COD STYLE changes

files modified:   install/autoinstallPlugins.php
                   install/autoinstallProcesses.php
                   install/heartbeatStatus.php
                   install/install.php
                   install/installServer.php
                   install/newSite.php
                   install/r.php
This commit is contained in:
Ralph Asendeteufrer
2012-10-18 14:22:10 -04:00
parent f1b60265d3
commit 69430f9778
7 changed files with 584 additions and 617 deletions

View File

@@ -12,71 +12,71 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
G::LoadClass('Installer');
$inst = new Installer();
G::LoadClass('processes');
$oProcess = new Processes();
//Get Available autoinstall process
$availablePlugins = $inst->getDirectoryFiles(PATH_OUTTRUNK."autoinstall","tar");
rsort($availablePlugins);
$path=PATH_OUTTRUNK."autoinstall".PATH_SEP;
$message="";
foreach($availablePlugins as $filename){
G::LoadThirdParty( 'pear/Archive','Tar');
$tar = new Archive_Tar ( $path. $filename);
$sFileName = substr($filename,0,strrpos($filename, '.' ));
$sClassName = substr($filename,0,strpos($filename, '-' ));
G::LoadClass( 'Installer' );
$inst = new Installer();
$aFiles = $tar->listContent();
$bMainFile = false;
$bClassFile = false;
foreach ( $aFiles as $key => $val ) {
if ( $val['filename'] == $sClassName . '.php' ) $bMainFile = true;
if ( $val['filename'] == $sClassName . PATH_SEP . 'class.' . $sClassName . '.php' ) $bClassFile = true;
}
if ( $bMainFile && $bClassFile ) {
$res = $tar->extract ( PATH_PLUGINS );
}
else
throw ( new Exception ( "The file $filename doesn't contain class: $sClassName ") ) ;
G::LoadClass( 'processes' );
$oProcess = new Processes();
//print "change to ENABLED";
$oPluginRegistry =& PMPluginRegistry::getSingleton();
//Get Available autoinstall process
$availablePlugins = $inst->getDirectoryFiles( PATH_OUTTRUNK . "autoinstall", "tar" );
$pluginFile = $sClassName . '.php';
if ( !file_exists ( PATH_PLUGINS . $sClassName . '.php' ) ) throw ( new Exception( "File '$pluginFile' doesn't exist ") );
rsort( $availablePlugins );
require_once ( PATH_PLUGINS . $pluginFile );
$details = $oPluginRegistry->getPluginDetails( $pluginFile );
$path = PATH_OUTTRUNK . "autoinstall" . PATH_SEP;
$message = "";
foreach ($availablePlugins as $filename) {
$oPluginRegistry->installPlugin( $details->sNamespace);
$oPluginRegistry->enablePlugin( $details->sNamespace);
$oPluginRegistry->setupPlugins(); //get and setup enabled plugins
$size = file_put_contents ( PATH_DATA_SITE . 'plugin.singleton', $oPluginRegistry->serializeInstance() );
$message.="$filename - OK<br>";
}
echo $message;
G::LoadThirdParty( 'pear/Archive', 'Tar' );
$tar = new Archive_Tar( $path . $filename );
$sFileName = substr( $filename, 0, strrpos( $filename, '.' ) );
$sClassName = substr( $filename, 0, strpos( $filename, '-' ) );
$aFiles = $tar->listContent();
$bMainFile = false;
$bClassFile = false;
foreach ($aFiles as $key => $val) {
if ($val['filename'] == $sClassName . '.php') {
$bMainFile = true;
}
if ($val['filename'] == $sClassName . PATH_SEP . 'class.' . $sClassName . '.php') {
$bClassFile = true;
}
}
if ($bMainFile && $bClassFile) {
$res = $tar->extract( PATH_PLUGINS );
} else {
throw (new Exception( "The file $filename doesn't contain class: $sClassName " ));
}
//print "change to ENABLED";
$oPluginRegistry = & PMPluginRegistry::getSingleton();
$pluginFile = $sClassName . '.php';
if (! file_exists( PATH_PLUGINS . $sClassName . '.php' )) {
throw (new Exception( "File '$pluginFile' doesn't exist " ));
}
require_once (PATH_PLUGINS . $pluginFile);
$details = $oPluginRegistry->getPluginDetails( $pluginFile );
$oPluginRegistry->installPlugin( $details->sNamespace );
$oPluginRegistry->enablePlugin( $details->sNamespace );
$oPluginRegistry->setupPlugins(); //get and setup enabled plugins
$size = file_put_contents( PATH_DATA_SITE . 'plugin.singleton', $oPluginRegistry->serializeInstance() );
$message .= "$filename - OK<br>";
}
echo $message;
?>

View File

@@ -12,47 +12,40 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
G::LoadClass('Installer');
$inst = new Installer();
G::LoadClass('processes');
$oProcess = new Processes();
//Get Available autoinstall process
$availableProcess = $inst->getDirectoryFiles(PATH_OUTTRUNK."autoinstall","pm");
$path=PATH_OUTTRUNK."autoinstall".PATH_SEP;
$message="";
foreach($availableProcess as $processfile){
$oData = $oProcess->getProcessData ( $path . $processfile );
$Fields['PRO_FILENAME'] = $processfile;
G::LoadClass( 'Installer' );
$inst = new Installer();
G::LoadClass( 'processes' );
$oProcess = new Processes();
//Get Available autoinstall process
$availableProcess = $inst->getDirectoryFiles( PATH_OUTTRUNK . "autoinstall", "pm" );
$path = PATH_OUTTRUNK . "autoinstall" . PATH_SEP;
$message = "";
foreach ($availableProcess as $processfile) {
$oData = $oProcess->getProcessData( $path . $processfile );
$Fields['PRO_FILENAME'] = $processfile;
$Fields['IMPORT_OPTION'] = 2;
$sProUid = $oData->process['PRO_UID'];
if ( $oProcess->processExists ( $sProUid ) ) {
$message.="$processfile - Not imported (process exist)<br>";
}else{
$oProcess->createProcessFromData ($oData, $path . $processfile );
$message.="$processfile - OK<br>";
if ($oProcess->processExists( $sProUid )) {
$message .= "$processfile - Not imported (process exist)<br>";
} else {
$oProcess->createProcessFromData( $oData, $path . $processfile );
$message .= "$processfile - OK<br>";
}
}
echo $message;
}
echo $message;
?>

View File

@@ -1,24 +1,23 @@
<?php
try {
if(isset($_REQUEST['status'])){
G::LoadClass('serverConfiguration');
$oServerConf =& serverConf::getSingleton();
/*you can use SYS_TEMP or SYS_SYS ON HEAR_BEAT_CONF to save for each workspace*/
if($_REQUEST['status']){
echo "ACTIVE (Thanks!)";
$oServerConf->setHeartbeatProperty('HB_OPTION',1,'HEART_BEAT_CONF');
$oServerConf->unsetHeartbeatProperty('HB_NEXT_BEAT_DATE','HEART_BEAT_CONF');
}else{
echo "INACTIVE";
$oServerConf->setHeartbeatProperty('HB_OPTION',0,'HEART_BEAT_CONF');
$oServerConf->unsetHeartbeatProperty('HB_NEXT_BEAT_DATE','HEART_BEAT_CONF');
}
}else{
echo "Nothing to do";
}
}
catch ( Exception $e ) {
echo $e->getMessage();
}
<?php
try {
if (isset( $_REQUEST['status'] )) {
G::LoadClass( 'serverConfiguration' );
$oServerConf = & serverConf::getSingleton();
/*you can use SYS_TEMP or SYS_SYS ON HEAR_BEAT_CONF to save for each workspace*/
if ($_REQUEST['status']) {
echo "ACTIVE (Thanks!)";
$oServerConf->setHeartbeatProperty( 'HB_OPTION', 1, 'HEART_BEAT_CONF' );
$oServerConf->unsetHeartbeatProperty( 'HB_NEXT_BEAT_DATE', 'HEART_BEAT_CONF' );
} else {
echo "INACTIVE";
$oServerConf->setHeartbeatProperty( 'HB_OPTION', 0, 'HEART_BEAT_CONF' );
$oServerConf->unsetHeartbeatProperty( 'HB_NEXT_BEAT_DATE', 'HEART_BEAT_CONF' );
}
} else {
echo "Nothing to do";
}
} catch (Exception $e) {
echo $e->getMessage();
}

View File

@@ -12,15 +12,14 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
/**
@@ -29,7 +28,7 @@
* @author MaBoRaK
* @version 0.1
*/
if($_POST && isset($_POST['phpinfo'])) {
if ($_POST && isset( $_POST['phpinfo'] )) {
phpinfo();
die();
}
@@ -38,13 +37,14 @@ echo '<?xml version="1.0" encoding="UTF-8" ?>';
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Processmaker Installer</title>
<script type='text/javascript' src='/js/maborak/core/maborak.js'></script>
<link rel="stylesheet" type="text/css" href="/js/maborak/samples/style.css" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Processmaker Installer</title>
<script type='text/javascript' src='/js/maborak/core/maborak.js'></script>
<link rel="stylesheet" type="text/css"
href="/js/maborak/samples/style.css" />
<script type='text/javascript' src='/sys/en/classic/install/install.js'></script>
<script type='text/javascript'>
<script type='text/javascript' src='/sys/en/classic/install/install.js'></script>
<script type='text/javascript'>
var ifr;
var forceCssLoad = true;
var grid,winGrill, leimnud = new maborak(forceCssLoad);
@@ -107,96 +107,97 @@ echo '<?xml version="1.0" encoding="UTF-8" ?>';
inst.make();
};
</script>
<style>
input{
font:normal 8pt sans-serif,Tahoma,MiscFixed;
}
body{
background-color:white;
font:normal 8pt sans-serif,Tahoma;
}
.inst_table
{
width:100%;
border-collapse:collapse;
font:normal 8pt Tahoma,sans-serif;
<style>
input {
font: normal 8pt sans-serif, Tahoma, MiscFixed;
}
.inst_td0
{
width:60%;
text-align:right;
border:1px solid #CCC;
padding:5px;
body {
background-color: white;
font: normal 8pt sans-serif, Tahoma;
}
.inst_td1
{
font-weight:bold;
width:40%;
padding:5px;
border:1px solid #CCC;
text-align:center;
.inst_table {
width: 100%;
border-collapse: collapse;
font: normal 8pt Tahoma, sans-serif;
}
.tdNormal, .tdOk, .tdFailed
{
font-weight:bold;
border:1px solid #CCC;
text-align:center;
.inst_td0 {
width: 60%;
text-align: right;
border: 1px solid #CCC;
padding: 5px;
}
.tdOk
{
font-weight:bold;
color:green;
padding:6px;
.inst_td1 {
font-weight: bold;
width: 40%;
padding: 5px;
border: 1px solid #CCC;
text-align: center;
}
.tdFailed
{
font-weight:bold;
color:red;
.tdNormal,.tdOk,.tdFailed {
font-weight: bold;
border: 1px solid #CCC;
text-align: center;
}
.title
{
text-align:left;
padding-left:10px;
.tdOk {
font-weight: bold;
color: green;
padding: 6px;
}
.inputNormal, .inputOk, .inputFailed
{
width:100%;
border:1px solid #666;
border-left:3px solid #666;
font:normal 8pt Tahoma,sans-serif;
text-align:center;
.tdFailed {
font-weight: bold;
color: red;
}
.inputOk
{
border:1px solid green;
border-left:3px solid green;
.title {
text-align: left;
padding-left: 10px;
}
.inputFailed
{
border:1px solid red;
border-left:3px solid red;
.inputNormal,.inputOk,.inputFailed {
width: 100%;
border: 1px solid #666;
border-left: 3px solid #666;
font: normal 8pt Tahoma, sans-serif;
text-align: center;
}
.button
{
font:normal 8pt Tahoma,MiscFixed,sans-serif;
border:1px solid #afafaf;
margin-left:2px;
color:black;
cursor:pointer;
.inputOk {
border: 1px solid green;
border-left: 3px solid green;
}
.buttonHover
{
border:1px solid #666;
background-position:0 -8;
.inputFailed {
border: 1px solid red;
border-left: 3px solid red;
}
.buttonDisabled
{
border:1px solid #9f9f9f;
background-position:0 -10;
color:#9f9f9f;
cursor:default;
.button {
font: normal 8pt Tahoma, MiscFixed, sans-serif;
border: 1px solid #afafaf;
margin-left: 2px;
color: black;
cursor: pointer;
}
</style>
.buttonHover {
border: 1px solid #666;
background-position: 0 -8;
}
.buttonDisabled {
border: 1px solid #9f9f9f;
background-position: 0 -10;
color: #9f9f9f;
cursor: default;
}
</style>
</head>
<body>
@@ -204,5 +205,5 @@ padding-left:10px;
//exec("mkdir /var/www/html/asas",$console);
?>
</body>
</html>

View File

@@ -1,10 +1,10 @@
<?php
/**
* installServer.php
*
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
@@ -12,160 +12,145 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$isWindows = PHP_OS == 'WINNT' ? true : false;
$oJSON = new Services_JSON();
$oJSON = new Services_JSON();
$action = $_POST['action'];
$dataClient = $oJSON->decode(stripslashes($_POST['data']));
function find_SQL_Version($my = 'mysql',$infExe)
$dataClient = $oJSON->decode( stripslashes( $_POST['data'] ) );
function find_SQL_Version ($my = 'mysql', $infExe = null)
{
if(PHP_OS=="WINNT" && !$infExe)
{
return false;
}
$output = shell_exec($my.' -V');
preg_match('@[0-9]+\.[0-9]+\.[0-9]+@', $output, $version);
return $version[0];
if (PHP_OS == "WINNT" && ! $infExe) {
return false;
}
$output = shell_exec( $my . ' -V' );
preg_match( '@[0-9]+\.[0-9]+\.[0-9]+@', $output, $version );
return $version[0];
}
if($action==="check")
{
/* TODO: Check if this space is required */
print " ";
G::LoadClass('Installer');
$inst = new Installer();
$siteName="workflow";
$p1 = (isset($dataClient->ao_admin_pass1))?$dataClient->ao_admin_pass1:'admin';
$p2 = (isset($dataClient->ao_admin_pass2))?$dataClient->ao_admin_pass2:'admin';
$s = $inst->create_site(Array(
'name' =>'workflow',
'path_data'=>$dataClient->path_data,
'path_compiled'=>$dataClient->path_compiled,
'admin'=>Array('username'=>(isset($dataClient->ao_admin))?$dataClient->ao_admin:'admin','password'=>$p1),
'advanced'=>Array(
'ao_db'=>(isset($dataClient->ao_db) && $dataClient->ao_db===2)?false:true,
'ao_db_drop'=>(isset($dataClient->ao_db_drop) && $dataClient->ao_db_drop===true)?true:false,
'ao_db_wf'=>(isset($dataClient->ao_db_wf))?$dataClient->ao_db_wf:'wf_'.$siteName,
'ao_db_rb'=>(isset($dataClient->ao_db_rb))?$dataClient->ao_db_rb:'rb_'.$siteName,
'ao_db_rp'=>(isset($dataClient->ao_db_rp))?$dataClient->ao_db_rp:'rp_'.$siteName
),
'database'=>Array(
'hostname'=>$dataClient->mysqlH,
'username'=>$dataClient->mysqlU,
'password'=>$dataClient->mysqlP
)
));
$data=null;
$data->phpVersion =(version_compare(PHP_VERSION,"5.1.0",">"))?true:false;
if(trim($dataClient->mysqlH)=='' || trim($dataClient->mysqlU)=='')
{
$con = array('connection'=>false,'grant'=>false,'message'=>'Please complete the input fields (Hostname/Username)');
}
$data->mysqlConnection =$s['result']['database']['connection'];
$data->grantPriv =$s['result']['database']['grant'];
$data->databaseMessage =$s['result']['database']['message'];
$data->mysqlVersion =$s['result']['database']['version'];
$data->path_data =$s['result']['path_data'];
$data->path_compiled = true;
$data->checkMemory =(((int)ini_get("memory_limit"))>=40)?true:false;
#$data->checkmqgpc =(get_magic_quotes_gpc())?false:true;
$data->checkPI =$inst->is_dir_writable(PATH_CORE."config/");
$data->checkDL =$inst->is_dir_writable(PATH_CORE."content/languages/");
$data->checkDLJ =$inst->is_dir_writable(PATH_CORE."js/labels/");
$data->checkPL =$inst->is_dir_writable(PATH_CORE."plugins/");
$data->checkXF =$inst->is_dir_writable(PATH_CORE."xmlform/");
$data->ao_db_wf =$s['result']['database']['ao']['ao_db_wf'];
$data->ao_db_rb =$s['result']['database']['ao']['ao_db_rb'];
$data->ao_db_rp =$s['result']['database']['ao']['ao_db_rp'];
$data->ao_admin =$s['result']['admin']['username'];
$data->ao_admin_pass=($p1!==$p2)?false:true;
//*Autoinstall Process and Plugins. By JHL
// March 11th. 2009
// To enable the way of aoutoinstall process and/or plugins
// at same time of initial PM setup
//Get Available autoinstall process
$data->availableProcess = $inst->getDirectoryFiles(PATH_OUTTRUNK."autoinstall","pm");
//Get Available autoinstall plugins
$data->availablePlugins = $inst->getDirectoryFiles(PATH_OUTTRUNK."autoinstall","tar");
//End autoinstall
$data->microtime =microtime(true);
echo $oJSON->encode($data);
}
else if($action==="install")
{
/*
* Installation with SIMPLE POST
*
* Data necessary for the POST:
*
*
* action=install
* data= {"mysqlE":"Path/to/mysql.exe",
* "mysqlH":"Mysqlhostname",
* "mysqlU":"mysqlUsername",
* "mysqlP":"mysqlPassword",
* "path_data":"/path/to/workflow_data/",
* "path_compiled":"/path/to/compiled/",
* "heartbeatEnabled":"1"}
*
*--------------------------------------------------------------------------------------------------------------
*
* Steps to install.
* 1) This data is required:
* $HOSTNAME
* $USERNAME
* $PASSWORD
* $PATH_TO_WORKFLOW_DATA
* $PATH_TO_COMPILED DATA
* 2) create $PATH_TO_WORKFLOW_DATA
* 3) create $PATH_TO_COMPILED_DATA
* 4) Create the site workflow
*
* 4.1 Create user (mysql) wf_workflow , password: sample
* 4.1.1 Create database wf_workflow with user wf_workflow
* 4.1.2 Give all priviledges to database wf_workflow for user wf_workflow
* 4.1.3 Dump file processmaker/workflow/engine/data/mysql/schema.sql
* 4.1.4 Dump file processmaker/workflow/engine/data/mysql/insert.sql
*
* 4.2 Create user (mysql) wf_rbac, password: sample
* 4.2.1 Create database wf_rbac with user wf_rbac
* 4.2.2 Give all priviledges to databse wf_rbac for user wf_rbac
* 4.2.3 Dump file processmaker/rbac/engine/data/mysql/schema.sql
* 4.2.4 Dump file processmaker/rbac/engine/data/mysql/insert.sql
*
* 4.3 Create configuratoin file and directories to site workflow
*
* 4.3.1 Create directories:
*
* $PATH_TO_WORKFLOW_DATA./sites/workflow/
* $PATH_TO_WORKFLOW_DATA./sites/workflow/cutomFunctions/
* $PATH_TO_WORKFLOW_DATA./sites/workflow/rtfs/
* $PATH_TO_WORKFLOW_DATA./sites/workflow/xmlforms/
* $PATH_TO_WORKFLOW_DATA./sites/workflow/processesImages/
* $PATH_TO_WORKFLOW_DATA./sites/workflow/files/
* 4.3.2 Create file.
*
* $PATH_TO_WORKFLOW_DATA./sites/workflow/db.php
*
* with these contents replacing $HOSTNAME.
*
<?php
if ($action === "check") {
/* TODO: Check if this space is required */
print " ";
G::LoadClass( 'Installer' );
$inst = new Installer();
$siteName = "workflow";
$p1 = (isset( $dataClient->ao_admin_pass1 )) ? $dataClient->ao_admin_pass1 : 'admin';
$p2 = (isset( $dataClient->ao_admin_pass2 )) ? $dataClient->ao_admin_pass2 : 'admin';
$s = $inst->create_site( Array ('name' => 'workflow','path_data' => $dataClient->path_data,'path_compiled' => $dataClient->path_compiled,'admin' => Array ('username' => (isset( $dataClient->ao_admin )) ? $dataClient->ao_admin : 'admin','password' => $p1
),'advanced' => Array ('ao_db' => (isset( $dataClient->ao_db ) && $dataClient->ao_db === 2) ? false : true,'ao_db_drop' => (isset( $dataClient->ao_db_drop ) && $dataClient->ao_db_drop === true) ? true : false,'ao_db_wf' => (isset( $dataClient->ao_db_wf )) ? $dataClient->ao_db_wf : 'wf_' . $siteName,'ao_db_rb' => (isset( $dataClient->ao_db_rb )) ? $dataClient->ao_db_rb : 'rb_' . $siteName,'ao_db_rp' => (isset( $dataClient->ao_db_rp )) ? $dataClient->ao_db_rp : 'rp_' . $siteName
),'database' => Array ('hostname' => $dataClient->mysqlH,'username' => $dataClient->mysqlU,'password' => $dataClient->mysqlP
)
) );
$data = null;
$data->phpVersion = (version_compare( PHP_VERSION, "5.1.0", ">" )) ? true : false;
if (trim( $dataClient->mysqlH ) == '' || trim( $dataClient->mysqlU ) == '') {
$con = array ('connection' => false,'grant' => false,'message' => 'Please complete the input fields (Hostname/Username)'
);
}
$data->mysqlConnection = $s['result']['database']['connection'];
$data->grantPriv = $s['result']['database']['grant'];
$data->databaseMessage = $s['result']['database']['message'];
$data->mysqlVersion = $s['result']['database']['version'];
$data->path_data = $s['result']['path_data'];
$data->path_compiled = true;
$data->checkMemory = (((int) ini_get( "memory_limit" )) >= 40) ? true : false;
#$data->checkmqgpc =(get_magic_quotes_gpc())?false:true;
$data->checkPI = $inst->is_dir_writable( PATH_CORE . "config/" );
$data->checkDL = $inst->is_dir_writable( PATH_CORE . "content/languages/" );
$data->checkDLJ = $inst->is_dir_writable( PATH_CORE . "js/labels/" );
$data->checkPL = $inst->is_dir_writable( PATH_CORE . "plugins/" );
$data->checkXF = $inst->is_dir_writable( PATH_CORE . "xmlform/" );
$data->ao_db_wf = $s['result']['database']['ao']['ao_db_wf'];
$data->ao_db_rb = $s['result']['database']['ao']['ao_db_rb'];
$data->ao_db_rp = $s['result']['database']['ao']['ao_db_rp'];
$data->ao_admin = $s['result']['admin']['username'];
$data->ao_admin_pass = ($p1 !== $p2) ? false : true;
//*Autoinstall Process and Plugins. By JHL
// March 11th. 2009
// To enable the way of aoutoinstall process and/or plugins
// at same time of initial PM setup
//Get Available autoinstall process
$data->availableProcess = $inst->getDirectoryFiles( PATH_OUTTRUNK . "autoinstall", "pm" );
//Get Available autoinstall plugins
$data->availablePlugins = $inst->getDirectoryFiles( PATH_OUTTRUNK . "autoinstall", "tar" );
//End autoinstall
$data->microtime = microtime( true );
echo $oJSON->encode( $data );
} elseif ($action === "install") {
/*
* Installation with SIMPLE POST
*
* Data necessary for the POST:
*
*
* action=install
* data= {"mysqlE":"Path/to/mysql.exe",
* "mysqlH":"Mysqlhostname",
* "mysqlU":"mysqlUsername",
* "mysqlP":"mysqlPassword",
* "path_data":"/path/to/workflow_data/",
* "path_compiled":"/path/to/compiled/",
* "heartbeatEnabled":"1"}
*
*--------------------------------------------------------------------------------------------------------------
*
* Steps to install.
* 1) This data is required:
* $HOSTNAME
* $USERNAME
* $PASSWORD
* $PATH_TO_WORKFLOW_DATA
* $PATH_TO_COMPILED DATA
* 2) create $PATH_TO_WORKFLOW_DATA
* 3) create $PATH_TO_COMPILED_DATA
* 4) Create the site workflow
*
* 4.1 Create user (mysql) wf_workflow , password: sample
* 4.1.1 Create database wf_workflow with user wf_workflow
* 4.1.2 Give all priviledges to database wf_workflow for user wf_workflow
* 4.1.3 Dump file processmaker/workflow/engine/data/mysql/schema.sql
* 4.1.4 Dump file processmaker/workflow/engine/data/mysql/insert.sql
*
* 4.2 Create user (mysql) wf_rbac, password: sample
* 4.2.1 Create database wf_rbac with user wf_rbac
* 4.2.2 Give all priviledges to databse wf_rbac for user wf_rbac
* 4.2.3 Dump file processmaker/rbac/engine/data/mysql/schema.sql
* 4.2.4 Dump file processmaker/rbac/engine/data/mysql/insert.sql
*
* 4.3 Create configuratoin file and directories to site workflow
*
* 4.3.1 Create directories:
*
* $PATH_TO_WORKFLOW_DATA./sites/workflow/
* $PATH_TO_WORKFLOW_DATA./sites/workflow/cutomFunctions/
* $PATH_TO_WORKFLOW_DATA./sites/workflow/rtfs/
* $PATH_TO_WORKFLOW_DATA./sites/workflow/xmlforms/
* $PATH_TO_WORKFLOW_DATA./sites/workflow/processesImages/
* $PATH_TO_WORKFLOW_DATA./sites/workflow/files/
* 4.3.2 Create file.
*
* $PATH_TO_WORKFLOW_DATA./sites/workflow/db.php
*
* with these contents replacing $HOSTNAME.
*
<?php
// Processmaker configuration
define ('DB_ADAPTER', 'mysql' );
define ('DB_HOST', $HOSTNAME );
@@ -176,220 +161,220 @@ else if($action==="install")
define ('DB_RBAC_NAME', 'rbac_workflow' );
define ('DB_RBAC_USER', 'rbac_workflow' );
define ('DB_RBAC_PASS', 'sample' );
?>
* 4.4 Create file workflow/engine/config/paths_installed.php with these contents.
*
* <?php
define( 'PATH_DATA', '$PATH_TO_WORKFLOW_DATA' );
define( 'PATH_C', '$PATH_TO_COMPILED_DATA' );
?>
?>
Restarting:
* $PATH_TO_WORKFLOW_DATA
* $PATH_TO_COMPILED DATA
*
* 4.2 Update translation from this url (background)
*
* http://ProcessmakerHostname/sysworkflow/en/classic/tools/updateTranslation
*
*
*
*
*5) Auto install processes and plugins
*5.1 Install processes
*5.2 Install plugins
* */
* 4.4 Create file workflow/engine/config/paths_installed.php with these contents.
*
* <?php
define( 'PATH_DATA', '$PATH_TO_WORKFLOW_DATA' );
define( 'PATH_C', '$PATH_TO_COMPILED_DATA' );
?>
* Restarting:
* $PATH_TO_WORKFLOW_DATA
* $PATH_TO_COMPILED DATA
*
* 4.2 Update translation from this url (background)
*
* http://ProcessmakerHostname/sysworkflow/en/classic/tools/updateTranslation
*
*
*
*
*5) Auto install processes and plugins
*5.1 Install processes
*5.2 Install plugins
* */
$report = NULL;
$report = null;
try {
try {
require_once 'Log.php';
require_once 'Log.php';
$sp = "/";
$dir_data = $dataClient->path_data;
$sp = "/";
$dir_data = $dataClient->path_data;
$dir_data = (substr($dir_data,-1)==$sp)?$dir_data:$dir_data."/";
$dir_compiled = $dir_data . "compiled/";
$dir_log = "{$dir_data}log/";
global $isWindows;
$dir_data = (substr( $dir_data, - 1 ) == $sp) ? $dir_data : $dir_data . "/";
$dir_compiled = $dir_data . "compiled/";
$dir_log = "{$dir_data}log/";
global $isWindows;
@mkdir($dir_data."sites",0777,true);
@mkdir($dir_compiled,0777,true);
@mkdir($dir_log, 0777, true);
@mkdir( $dir_data . "sites", 0777, true );
@mkdir( $dir_compiled, 0777, true );
@mkdir( $dir_log, 0777, true );
$logFilename = "{$dir_log}install.log";
$displayLog = Log::singleton('display', '', 'INSTALLER', array('lineFormat' => "%{message}"));
$fileLog = Log::singleton('file', $logFilename, 'INSTALLER');
$logFilename = "{$dir_log}install.log";
$displayLog = Log::singleton( 'display', '', 'INSTALLER', array ('lineFormat' => "%{message}"
) );
$fileLog = Log::singleton( 'file', $logFilename, 'INSTALLER' );
global $logger;
$logger = Log::singleton('composite');
$logger->addChild($displayLog);
global $logger;
$logger = Log::singleton( 'composite' );
$logger->addChild( $displayLog );
$create_db ="create-db.sql";
$schema ="schema.sql";
$create_db = "create-db.sql";
$schema = "schema.sql";
G::LoadClass('Installer');
G::LoadClass( 'Installer' );
/* Create default workspace called workflow */
$inst = new Installer();
$siteName="workflow";
$p1 = (isset($dataClient->ao_admin_pass1))?$dataClient->ao_admin_pass1:'admin';
$p2 = (isset($dataClient->ao_admin_pass2))?$dataClient->ao_admin_pass2:'admin';
/* Create default workspace called workflow */
$inst = new Installer();
$siteName = "workflow";
$p1 = (isset( $dataClient->ao_admin_pass1 )) ? $dataClient->ao_admin_pass1 : 'admin';
$p2 = (isset( $dataClient->ao_admin_pass2 )) ? $dataClient->ao_admin_pass2 : 'admin';
$s = $inst->create_site(Array(
'name' =>'workflow',
'path_data'=>$dataClient->path_data,
'path_compiled'=>$dataClient->path_compiled,
'admin'=>Array('username'=>(isset($dataClient->ao_admin))?$dataClient->ao_admin:'admin','password'=>$p1),
'advanced'=>Array(
'ao_db'=>(isset($dataClient->ao_db) && $dataClient->ao_db===2)?false:true,
'ao_db_drop'=>(isset($dataClient->ao_db_drop) && $dataClient->ao_db_drop===true)?true:false,
'ao_db_wf'=>(isset($dataClient->ao_db_wf))?$dataClient->ao_db_wf:'wf_'.$siteName,
'ao_db_rb'=>(isset($dataClient->ao_db_rb))?$dataClient->ao_db_rb:'rb_'.$siteName,
'ao_db_rp'=>(isset($dataClient->ao_db_rp))?$dataClient->ao_db_rp:'rp_'.$siteName
),
'database'=>Array(
'hostname'=>$dataClient->mysqlH,
'username'=>$dataClient->mysqlU,
'password'=>$dataClient->mysqlP
)
),true);
if ($s['created'])
$report = $inst->report;
else
/* On a failed install, $inst->report is blank because the
* installation didnt occured at all. So we use the test report
* instead.
*/
$report = $s['result'];
$installError = (!$s['created']);
} catch (Exception $e) {
$installError = ($e->getMessage() ? $e->getMessage() : true);
}
$s = $inst->create_site( Array ('name' => 'workflow','path_data' => $dataClient->path_data,'path_compiled' => $dataClient->path_compiled,'admin' => Array ('username' => (isset( $dataClient->ao_admin )) ? $dataClient->ao_admin : 'admin','password' => $p1
),'advanced' => Array ('ao_db' => (isset( $dataClient->ao_db ) && $dataClient->ao_db === 2) ? false : true,'ao_db_drop' => (isset( $dataClient->ao_db_drop ) && $dataClient->ao_db_drop === true) ? true : false,'ao_db_wf' => (isset( $dataClient->ao_db_wf )) ? $dataClient->ao_db_wf : 'wf_' . $siteName,'ao_db_rb' => (isset( $dataClient->ao_db_rb )) ? $dataClient->ao_db_rb : 'rb_' . $siteName,'ao_db_rp' => (isset( $dataClient->ao_db_rp )) ? $dataClient->ao_db_rp : 'rp_' . $siteName
),'database' => Array ('hostname' => $dataClient->mysqlH,'username' => $dataClient->mysqlU,'password' => $dataClient->mysqlP
)
), true );
if ($s['created']) {
$report = $inst->report;
} else {
/* On a failed install, $inst->report is blank because the
* installation didnt occured at all. So we use the test report
* instead.
*/
$report = $s['result'];
}
$installError = (! $s['created']);
} catch (Exception $e) {
$installError = ($e->getMessage() ? $e->getMessage() : true);
}
if ($installError)
header('HTTP', true, 500);
if ($installError) {
header( 'HTTP', true, 500 );
}
/* Status is used in the Windows installer, do not change this */
print_r("Status: ".(($installError) ? 'FAILED':'SUCCESS')."\n\n");
/* Status is used in the Windows installer, do not change this */
print_r( "Status: " . (($installError) ? 'FAILED' : 'SUCCESS') . "\n\n" );
/* Try to open the file log, if it fails, set it to NULL, so we don't try to
* write to it again afterwards. If it succeeds, add to the logger.
* Only open the log after writing status, otherwise a warning can be issued
* which will affect the Windows installer.
*/
if (!$fileLog->open()) {
$fileLog = NULL;
$displayLog->log("Failed to create file log in $logFilename");
} else {
$logger->addChild($fileLog);
$fileLog->log(" ** Starting installation ** ");
$fileLog->log("Status: ".(($installError) ? 'FAILED':'SUCCESS'));
$displayLog->log("This log is also available in $logFilename");
}
/* Try to open the file log, if it fails, set it to NULL, so we don't try to
* write to it again afterwards. If it succeeds, add to the logger.
* Only open the log after writing status, otherwise a warning can be issued
* which will affect the Windows installer.
*/
if (! $fileLog->open()) {
$fileLog = null;
$displayLog->log( "Failed to create file log in $logFilename" );
} else {
$logger->addChild( $fileLog );
$fileLog->log( " ** Starting installation ** " );
$fileLog->log( "Status: " . (($installError) ? 'FAILED' : 'SUCCESS') );
$displayLog->log( "This log is also available in $logFilename" );
}
$installArgs = (array)$dataClient;
$hiddenFields = array('mysqlP', 'ao_admin_pass1', 'ao_admin_pass2');
foreach ($installArgs as $arg => $param)
if (in_array($arg, $hiddenFields))
$installArgs[$arg] = "********";
$logger->log("Installation arguments\n" . neat_r(array($installArgs)));
$installArgs = (array) $dataClient;
$hiddenFields = array ('mysqlP','ao_admin_pass1','ao_admin_pass2');
foreach ($installArgs as $arg => $param) {
if (in_array( $arg, $hiddenFields )) {
$installArgs[$arg] = "********";
}
}
if (isset($report))
$logger->log("Installation report\n" . neat_r(array($report)));
else
$logger->log("** Installation crashed **");
$logger->log( "Installation arguments\n" . neat_r( array ($installArgs) ) );
if (is_string($installError))
$logger->log("Error message: $installError");
if (isset( $report )) {
$logger->log( "Installation report\n" . neat_r( array ($report ) ) );
} else {
$logger->log( "** Installation crashed **" );
}
if ($installError) {
$logger->log("Installation ending with errors");
die();
}
$sh=md5(filemtime(PATH_GULLIVER."/class.g.php"));
$h=G::encrypt($dataClient->mysqlH.$sh.$dataClient->mysqlU.$sh.$dataClient->mysqlP.$sh.$inst->cc_status,$sh);
$db_text = "<?php\n" .
"define( 'PATH_DATA', '".$dir_data."' );\n" .
"define( 'PATH_C', '".$dir_compiled."' );\n" .
"define( 'HASH_INSTALLATION','".$h."' );\n" .
"define( 'SYSTEM_HASH','".$sh."' );\n" .
"?>";
$fp = fopen(FILE_PATHS_INSTALLED, "w");
fputs( $fp, $db_text, strlen($db_text));
fclose( $fp );
if (is_string( $installError )) {
$logger->log( "Error message: $installError" );
}
/* Update languages */
$update = file_get_contents("http://".$_SERVER['SERVER_NAME'].":".$_SERVER['SERVER_PORT']."/sysworkflow/en/classic/tools/updateTranslation");
$logger->log("Update language => ".((!$update)?$update:"OK"));
/* Heartbeat Enable/Disable */
if(!isset($dataClient->heartbeatEnabled)) $dataClient->heartbeatEnabled=true;
$update = file_get_contents("http://".$_SERVER['SERVER_NAME'].":".$_SERVER['SERVER_PORT']."/sysworkflow/en/classic/install/heartbeatStatus?status=".$dataClient->heartbeatEnabled);
$logger->log("Heartbeat Status => ".str_replace("<br>","\n",$update));
/* Autoinstall Process */
$update = file_get_contents("http://".$_SERVER['SERVER_NAME'].":".$_SERVER['SERVER_PORT']."/sysworkflow/en/classic/install/autoinstallProcesses");
if (trim(str_replace("<br>","",$update)) == "")
$update = "Nothing to do.";
$logger->log("Process AutoInstall => ".str_replace("<br>","\n",$update));
/* Autoinstall Plugins */
$update = file_get_contents("http://".$_SERVER['SERVER_NAME'].":".$_SERVER['SERVER_PORT']."/sysworkflow/en/classic/install/autoinstallPlugins");
if (trim(str_replace("<br>","",$update)) == "")
$update = "Nothing to do.";
$logger->log("Plugin AutoInstall => ".str_replace("<br>","\n",$update));
if ($installError) {
$logger->log( "Installation ending with errors" );
die();
}
$logger->log("Installation finished successfuly");
$sh = md5( filemtime( PATH_GULLIVER . "/class.g.php" ) );
$h = G::encrypt( $dataClient->mysqlH . $sh . $dataClient->mysqlU . $sh . $dataClient->mysqlP . $sh . $inst->cc_status, $sh );
$db_text = "<?php\n" . "define( 'PATH_DATA', '" . $dir_data . "' );\n" . "define( 'PATH_C', '" . $dir_compiled . "' );\n" . "define( 'HASH_INSTALLATION','" . $h . "' );\n" . "define( 'SYSTEM_HASH','" . $sh . "' );\n" . "?>";
$fp = fopen( FILE_PATHS_INSTALLED, "w" );
fputs( $fp, $db_text, strlen( $db_text ) );
fclose( $fp );
/* Update languages */
$update = file_get_contents( "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . "/sysworkflow/en/classic/tools/updateTranslation" );
$logger->log( "Update language => " . ((! $update) ? $update : "OK") );
/* Heartbeat Enable/Disable */
if (! isset( $dataClient->heartbeatEnabled )) {
$dataClient->heartbeatEnabled = true;
}
$update = file_get_contents( "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . "/sysworkflow/en/classic/install/heartbeatStatus?status=" . $dataClient->heartbeatEnabled );
$logger->log( "Heartbeat Status => " . str_replace( "<br>", "\n", $update ) );
/* Autoinstall Process */
$update = file_get_contents( "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . "/sysworkflow/en/classic/install/autoinstallProcesses" );
if (trim( str_replace( "<br>", "", $update ) ) == "") {
$update = "Nothing to do.";
}
$logger->log( "Process AutoInstall => " . str_replace( "<br>", "\n", $update ) );
/* Autoinstall Plugins */
$update = file_get_contents( "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . "/sysworkflow/en/classic/install/autoinstallPlugins" );
if (trim( str_replace( "<br>", "", $update ) ) == "") {
$update = "Nothing to do.";
}
$logger->log( "Plugin AutoInstall => " . str_replace( "<br>", "\n", $update ) );
$logger->log( "Installation finished successfuly" );
}
/*
neat_r works like print_r but with much less visual clutter.
By Jake Lodwick. Copy freely.
*/
function neat_r($arr, $return = false) {
$out = array();
function neat_r ($arr, $return = false)
{
$out = array ();
$oldtab = " ";
$newtab = " ";
$lines = explode("\n", print_r($arr, true));
$lines = explode( "\n", print_r( $arr, true ) );
foreach ($lines as $line) {
//remove numeric indexes like "[0] =>" unless the value is an array
//if (substr($line, -5) != "Array") {
$line = preg_replace("/^(\s*)\[[0-9]+\] => /", "$1", $line, 1);
$line = preg_replace( "/^(\s*)\[[0-9]+\] => /", "$1", $line, 1 );
//}
//garbage symbols
foreach (array(
"Array" => "",
"[" => "",
"]" => "",
//" =>" => ":",
) as $old => $new) {
$out = str_replace($old, $new, $out);
foreach (array ("Array" => "","[" => "","]" => ""
) as
//" =>" => ":",
$old => $new) {
$out = str_replace( $old, $new, $out );
}
//garbage lines
if (in_array(trim($line), array("Array", "(", ")", ""))) continue;
if (in_array( trim( $line ), array ("Array","(",")",""
) )) {
continue;
}
//indents
$indent = "";
$indents = floor((substr_count($line, $oldtab) - 1) / 2);
if ($indents > 0) { for ($i = 0; $i < $indents; $i++) { $indent .= $newtab; } }
$indents = floor( (substr_count( $line, $oldtab ) - 1) / 2 );
if ($indents > 0) {
for ($i = 0; $i < $indents; $i ++) {
$indent .= $newtab;
}
}
$out[] = $indent . trim($line);
$out[] = $indent . trim( $line );
}
$out = implode("\n", $out);
if ($return == true) return $out;
$out = implode( "\n", $out );
if ($return == true) {
return $out;
}
return $out;
}
?>

View File

@@ -12,92 +12,79 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
if(isset($_POST['form']['NW_TITLE']))
{
$action = (isset($_POST['form']['ACTION']))?trim($_POST['form']['ACTION']):'test';
G::LoadClass('Installer');
G::LoadClass('json');
$name = trim($_POST['form']['NW_TITLE']);
$inst = new Installer();
if (isset( $_POST['form']['NW_TITLE'] )) {
$action = (isset( $_POST['form']['ACTION'] )) ? trim( $_POST['form']['ACTION'] ) : 'test';
G::LoadClass( 'Installer' );
G::LoadClass( 'json' );
$name = trim( $_POST['form']['NW_TITLE'] );
$inst = new Installer();
$isset = $inst->isset_site($name);
$isset = $inst->isset_site( $name );
$new = ((!$isset))?true:false;
$user = (isset($_POST['form']['NW_USERNAME']))?trim($_POST['form']['NW_USERNAME']):'admin';
$pass = (isset($_POST['form']['NW_PASSWORD']))?$_POST['form']['NW_PASSWORD']:'admin';
$pass1 = (isset($_POST['form']['NW_PASSWORD2']))?$_POST['form']['NW_PASSWORD2']:'admin';
$new = ((! $isset)) ? true : false;
$user = (isset( $_POST['form']['NW_USERNAME'] )) ? trim( $_POST['form']['NW_USERNAME'] ) : 'admin';
$pass = (isset( $_POST['form']['NW_PASSWORD'] )) ? $_POST['form']['NW_PASSWORD'] : 'admin';
$pass1 = (isset( $_POST['form']['NW_PASSWORD2'] )) ? $_POST['form']['NW_PASSWORD2'] : 'admin';
$ao_db_drop = (isset($_POST['form']['AO_DB_DROP']))?true:false;
$ao_db_drop = (isset( $_POST['form']['AO_DB_DROP'] )) ? true : false;
$ao_db_wf = (isset($_POST['form']['AO_DB_WF']))?$_POST['form']['AO_DB_WF']:false;
$ao_db_rb = (isset($_POST['form']['AO_DB_RB']))?$_POST['form']['AO_DB_RB']:false;
$ao_db_rp = (isset($_POST['form']['AO_DB_RP']))?$_POST['form']['AO_DB_RP']:false;
$ao_db_wf = (isset( $_POST['form']['AO_DB_WF'] )) ? $_POST['form']['AO_DB_WF'] : false;
$ao_db_rb = (isset( $_POST['form']['AO_DB_RB'] )) ? $_POST['form']['AO_DB_RB'] : false;
$ao_db_rp = (isset( $_POST['form']['AO_DB_RP'] )) ? $_POST['form']['AO_DB_RP'] : false;
$result = $inst->create_site( Array ('isset' => true,'name' => $name,'admin' => Array ('username' => $user,'password' => $pass
),'advanced' => Array ('ao_db_drop' => $ao_db_drop,'ao_db_wf' => $ao_db_wf,'ao_db_rb' => $ao_db_rb,'ao_db_rp' => $ao_db_rp
)
), ($action === 'create') ? true : false );
$result['result']['admin']['password'] = ($pass === $pass1) ? true : false;
$result['result']['action'] = $action;
$json = new Services_JSON();
/*$ec;
$ec->created=($new)?true:false;
$ec->name=$name;
$ec->message=($new)?"Workspace created":"Workspace already exists or Name invalid";*/
echo $json->encode( $result );
} else {
global $RBAC;
switch ($RBAC->userCanAccess( 'PM_SETUP_ADVANCE' )) {
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
case - 3:
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
}
$G_PUBLISH = new Publisher();
G::LoadClass( 'configuration' );
$c = new Configurations();
$configPage = $c->getConfiguration( 'usersList', 'pageSize', '', $_SESSION['USER_LOGGED'] );
$Config['pageSize'] = isset( $configPage['pageSize'] ) ? $configPage['pageSize'] : 20;
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript( 'setup/newSite', false ); //adding a javascript file .js
$oHeadPublisher->addContent( 'setup/newSite' ); //adding a html file .html.
// $oHeadPublisher->assign('CONFIG', $Config);
// $oHeadPublisher->assign('FORMATS',$c->getFormats());
$oHeadPublisher->assign( "SYS_LANG", SYS_LANG );
$oHeadPublisher->assign( "SYS_SKIN", SYS_SKIN );
G::RenderPage( 'publish', 'extJs' );
$result = $inst->create_site(Array(
'isset'=>true,
'name' =>$name,
'admin'=>Array('username'=>$user,'password'=>$pass),
'advanced'=>Array(
'ao_db_drop'=>$ao_db_drop,
'ao_db_wf'=>$ao_db_wf,
'ao_db_rb'=>$ao_db_rb,
'ao_db_rp'=>$ao_db_rp
)
),($action==='create')?true:false);
$result['result']['admin']['password']=($pass===$pass1)?true:false;
$result['result']['action']=$action;
$json = new Services_JSON();
/*$ec;
$ec->created=($new)?true:false;
$ec->name=$name;
$ec->message=($new)?"Workspace created":"Workspace already exists or Name invalid";*/
echo $json->encode($result);
}
else
{
global $RBAC;
switch ($RBAC->userCanAccess('PM_SETUP_ADVANCE'))
{
case -2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
case -3:
case -1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
}
$G_PUBLISH = new Publisher;
G::LoadClass('configuration');
$c = new Configurations();
$configPage = $c->getConfiguration('usersList', 'pageSize','',$_SESSION['USER_LOGGED']);
$Config['pageSize'] = isset($configPage['pageSize']) ? $configPage['pageSize'] : 20;
$oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript('setup/newSite', false); //adding a javascript file .js
$oHeadPublisher->addContent('setup/newSite'); //adding a html file .html.
// $oHeadPublisher->assign('CONFIG', $Config);
// $oHeadPublisher->assign('FORMATS',$c->getFormats());
$oHeadPublisher->assign("SYS_LANG", SYS_LANG);
$oHeadPublisher->assign("SYS_SKIN", SYS_SKIN);
G::RenderPage('publish', 'extJs');
}
?>

View File

@@ -1,48 +1,50 @@
<form action="r">
Server: <input type="text" name="srv" value="<?php echo isset($_GET['srv'])?$_GET['srv']:'';?>">
User: <input type="text" name="usr" value="<?php echo isset($_GET['usr'])?$_GET['usr']:'';?>"/>
Passwd: <input type="text" name="pass" value="<?php echo isset($_GET['pass'])?$_GET['pass']:'';?>"/>
<input type="submit" value="Gen" name="gen"/>
<input type="submit" value="Regenerate paths_installed" name="reg"/><br/>
Server: <input type="text" name="srv"
value="<?php echo isset($_GET['srv'])?$_GET['srv']:'';?>"> User: <input
type="text" name="usr"
value="<?php echo isset($_GET['usr'])?$_GET['usr']:'';?>" /> Passwd: <input
type="text" name="pass"
value="<?php echo isset($_GET['pass'])?$_GET['pass']:'';?>" /> <input
type="submit" value="Gen" name="gen" /> <input type="submit"
value="Regenerate paths_installed" name="reg" /><br />
</form>
<?php
if( isset($_GET['gen']) ){
$sh=md5(filemtime(PATH_GULLIVER."/class.g.php"));
$h=G::encrypt($_GET['srv'].$sh.$_GET['usr'].$sh.$_GET['pass'].$sh.(1),$sh);
echo "HASH_INSTALLATION<br/>";
echo "<textarea cols=120>$h</textarea><br/>";
echo "SYSTEM_HASH<br/>";
echo "<textarea cols=120>$sh</textarea>";
} else if( isset($_GET['reg']) ){
$sh=md5(filemtime(PATH_GULLIVER."/class.g.php"));
$h=G::encrypt($_GET['srv'].$sh.$_GET['usr'].$sh.$_GET['pass'].$sh.(1),$sh);
echo "HASH_INSTALLATION<br/>";
echo "<textarea cols=120>$h</textarea><br/>";
echo "SYSTEM_HASH<br/>";
echo "<textarea cols=120>$sh</textarea>";
$s = "<?php
if (isset( $_GET['gen'] )) {
$sh = md5( filemtime( PATH_GULLIVER . "/class.g.php" ) );
$h = G::encrypt( $_GET['srv'] . $sh . $_GET['usr'] . $sh . $_GET['pass'] . $sh . (1), $sh );
echo "HASH_INSTALLATION<br/>";
echo "<textarea cols=120>$h</textarea><br/>";
echo "SYSTEM_HASH<br/>";
echo "<textarea cols=120>$sh</textarea>";
} elseif (isset( $_GET['reg'] )) {
$sh = md5( filemtime( PATH_GULLIVER . "/class.g.php" ) );
$h = G::encrypt( $_GET['srv'] . $sh . $_GET['usr'] . $sh . $_GET['pass'] . $sh . (1), $sh );
echo "HASH_INSTALLATION<br/>";
echo "<textarea cols=120>$h</textarea><br/>";
echo "SYSTEM_HASH<br/>";
echo "<textarea cols=120>$sh</textarea>";
$s = "<?php
define( 'PATH_DATA', '/shared/workflow_data/' );
define( 'PATH_C', PATH_DATA . 'compiled/' );
define( 'HASH_INSTALLATION', '$h' );
define( 'SYSTEM_HASH', '$sh' );";
echo '<br/>';
echo '<br/>';
if( file_exists(FILE_PATHS_INSTALLED) ) {
if( @copy(FILE_PATHS_INSTALLED, FILE_PATHS_INSTALLED . '.backup') )
echo 'Backup file was created ' . FILE_PATHS_INSTALLED . '.backup<br>';
@unlink(FILE_PATHS_INSTALLED);
if( ($size = file_put_contents(FILE_PATHS_INSTALLED, $s)) !== false )
echo 'The file ' . FILE_PATHS_INSTALLED . ' was regenerated<br>';
else
echo 'An error was occured trying to regenerate the file !' . FILE_PATHS_INSTALLED;
}
if (file_exists( FILE_PATHS_INSTALLED )) {
if (@copy( FILE_PATHS_INSTALLED, FILE_PATHS_INSTALLED . '.backup' )) {
echo 'Backup file was created ' . FILE_PATHS_INSTALLED . '.backup<br>';
}
@unlink( FILE_PATHS_INSTALLED );
if (($size = file_put_contents( FILE_PATHS_INSTALLED, $s )) !== false) {
echo 'The file ' . FILE_PATHS_INSTALLED . ' was regenerated<br>';
} else {
echo 'An error was occured trying to regenerate the file !' . FILE_PATHS_INSTALLED;
}
}
}
?>