diff --git a/gulliver/system/class.controller.php b/gulliver/system/class.controller.php index 494e6b91e..f42cb3add 100755 --- a/gulliver/system/class.controller.php +++ b/gulliver/system/class.controller.php @@ -6,7 +6,7 @@ * @package gulliver.system * @access private */ -class Controller +class Controller { /** * @var boolean debug switch for general purpose @@ -16,12 +16,12 @@ class Controller * @var array - private array to store proxy data */ private $__data__ = array(); - + /** - * @var object - private object to store the http request data + * @var object - private object to store the http request data */ private $__request__; - + /** * @var object - headPublisher object to handle the output */ @@ -36,25 +36,25 @@ class Controller * @var string - layout to pass skinEngine */ private $layout = ''; - + /** * Magic setter method - * + * * @param string $name * @param string $value */ - public function __set($name, $value) + public function __set($name, $value) { $this->__data__[$name] = $value; } /** * Magic getter method - * + * * @param string $name * @return string or NULL if the internal var doesn't exist */ - public function __get($name) + public function __get($name) { if (array_key_exists($name, $this->__data__)) { return $this->__data__[$name]; @@ -73,17 +73,17 @@ class Controller * Magic isset method * @param string $name */ - public function __isset($name) + public function __isset($name) { return isset($this->__data__[$name]); } - + /** * Magic unset method * @param string $name */ - public function __unset($name) + public function __unset($name) { unset($this->__data__[$name]); } @@ -96,12 +96,12 @@ class Controller { $this->responseType = $type; } - + /** * call to execute a internal proxy method and handle its exceptions * @param string $name */ - public function call($name) + public function call($name) { try { $result = $this->$name($this->__request__); @@ -122,7 +122,7 @@ class Controller $template->assign('trace', $e->getTraceAsString()); echo $template->getOutputContent(); - + } else { $result->success = false; $result->msg = $e->getMessage(); @@ -133,66 +133,69 @@ class Controller case 'UserException': $error = "USER ERROR"; break; } $result->error = $error; - + $result->exception->class = get_class($e); $result->exception->code = $e->getCode(); print G::json_encode($result); } } } - + /** * Set the http request data * @param array $data */ public function setHttpRequestData($data) { + if (!is_object($this->__request__)) { + $this->__request__ = new stdclass(); + } if( is_array($data) ) { while( $var = each($data) ) - $this->__request__->$var['key'] = $var['value']; - } else + $this->__request__->$var['key'] = $var['value']; + } else $this->__request__ = $data; } - + /** * Get debug var. method - * @param boolan $val boolean value for debug var. + * @param boolan $val boolean value for debug var. */ public function setDebug($val) { $this->debug = $val; } - + /** - * Get debug var. method + * Get debug var. method */ public function getDebug() { if ($this->debug === null) { $this->debug = defined('DEBUG') && DEBUG ? true : false; } - + return $this->debug; } - + /*** HeadPublisher Functions Binding ***/ - + /** * Include a particular extjs library or extension to the main output * @param string $srcFile path of a extjs library or extension * @param boolean $debug debug flag to indicate if the js output will be minifield or not * $debug: true -> the js content will be not minified (readable) - * false -> the js content will be minified + * false -> the js content will be minified */ public function includeExtJSLib($srcFile, $debug=false) { $this->getHeadPublisher()->usingExtJs($srcFile, ($debug ? $debug : $this->getDebug())); } - + /** * Include a javascript file that is using extjs framework to the main output - * @param string $srcFile path of javascrit file to include + * @param string $srcFile path of javascrit file to include * @param boolean $debug debug flag to indicate if the js output will be minifield or not * $debug: true -> the js content will be not minified (readable) * false -> the js content will be minified @@ -212,7 +215,7 @@ class Controller } /** - * Set variables to be accesible by javascripts + * Set variables to be accesible by javascripts * @param string $name contains var. name * @param string $value conatins var. value */ diff --git a/workflow/engine/controllers/installer.php b/workflow/engine/controllers/installer.php index 6e1f78538..80923dfab 100644 --- a/workflow/engine/controllers/installer.php +++ b/workflow/engine/controllers/installer.php @@ -5,7 +5,7 @@ * @author Erik A. O. */ -class Installer extends Controller +class Installer extends Controller { public $path_config; public $path_languages; @@ -16,7 +16,7 @@ class Installer extends Controller public $link; #resource for database connection - public function __construct() + public function __construct() { $this->path_config = PATH_CORE.'config/'; $this->path_languages = PATH_CORE.'content/languages/'; @@ -27,7 +27,7 @@ class Installer extends Controller $this->path_sep = PATH_SEP; } - public function index($httpData) + public function index($httpData) { $step1_txt = 'If any of these items is not supported (marked as No) then please take actions to correct them.

' . 'Failure to do so could lead to your ProcessMaker installation not functioning correctly!

' . @@ -38,7 +38,7 @@ class Installer extends Controller $step2_txt = 'These settings are recommended for PHP in order to ensure full compatibility with ProcessMaker. <> ' . 'However, ProcessMaker still operate if your settings do not quite match the recommended'; $step3_txt = 'In order for ProcessMaker to work correctly, it needs to be able read and write to certain directories and their files.
' . - 'Make sure to give read and write access to the directories listed below and all their subdirectories and files.'; + 'Make sure to give read and write access to the directories listed below and all their subdirectories and files.'; $step4_txt = 'ProcessMaker stores all of its data in a database. Enter the address and port number used by the database. Also enter' . 'the username and password of the database user who will set up the databases used by ProcessMaker
'; $step5_txt = 'ProcessMaker uses workspaces to store data in the database. Please enter a valid workspace name and a username and password to login'. @@ -76,7 +76,7 @@ class Installer extends Controller G::RenderPage('publish', 'extJs'); } - public function newSite() + public function newSite() { $textStep1 = 'ProcessMaker stores all of its data in a database. This screen gives the installation program the information needed to create this database.

' . 'If you are installing ProcessMaker on a remote web server, you will need to get this information from your Database Server.'; @@ -109,7 +109,7 @@ class Installer extends Controller G::RenderPage('publish', 'extJs'); } - public function getSystemInfo() + public function getSystemInfo() { $this->setResponseType('json'); @@ -118,6 +118,19 @@ class Installer extends Controller preg_match('/[0-9\.]+/', $phpVer, $match); $phpVerNum = (float) $match[0]; + $info = new stdclass(); + $info->php = new stdclass(); + $info->mysql = new stdclass(); + $info->mssql = new stdclass(); + $info->openssl = new stdclass(); + $info->curl = new stdclass(); + $info->dom = new stdclass(); + $info->gd = new stdclass(); + $info->multibyte = new stdclass(); + $info->soap = new stdclass(); + $info->ldap = new stdclass(); + $info->memory = new stdclass(); + $info->php->version = phpversion(); $info->php->result = $phpVerNum > 5.1 ? true : false; @@ -211,19 +224,19 @@ class Installer extends Controller return $info; } - public function is_dir_writable($path) + public function is_dir_writable($path) { return G::is_writable_r($path); } - public function getPermissionInfo() + public function getPermissionInfo() { $this->setResponseType('json'); - + $info = new StdClass(); $info->success = true; $noWritableFiles = array(); - + // pathConfig $info->pathConfig->message = 'unwriteable'; $info->pathConfig->result = G::is_writable_r($_REQUEST['pathConfig'], $noWritableFiles); @@ -296,7 +309,7 @@ class Installer extends Controller $info->pathLogFile->message = 'Could not create the installation log'; $info->pathLogFile->result = file_exists($_REQUEST['pathLogFile']); - + if ($info->pathLogFile->result) { $info->pathLogFile->message = 'Installation log created'; } @@ -313,7 +326,7 @@ class Installer extends Controller return $info; } - public function testConnection () + public function testConnection () { $this->setResponseType('json'); if ($_REQUEST['db_engine'] == 'mysql') { @@ -329,7 +342,7 @@ class Installer extends Controller * the install.log files should be placed in shared/logs * for that reason we are using the $_REQUEST of pathShared */ - public function installLog( $text ) + public function installLog( $text ) { $serverAddr = $_SERVER['SERVER_ADDR']; //if this function is called outside the createWorkspace, just returns and do nothing @@ -364,7 +377,7 @@ class Installer extends Controller * function to create a workspace * in fact this function is calling appropiate functions for mysql and mssql */ - public function createWorkspace() + public function createWorkspace() { $this->setResponseType('json'); if ($_REQUEST['db_engine'] == 'mysql') { @@ -377,7 +390,7 @@ class Installer extends Controller return $info; } - public function forceTogenerateTranslationsFiles($url) + public function forceTogenerateTranslationsFiles($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, (isset($_SERVER['HTTPS']) ? ($_SERVER['HTTPS'] != '' ? 'https://' : 'http://') : 'http://') . $_SERVER['HTTP_HOST'] . '/js/ext/translation.en.js?r=' . rand(1, 10000)); @@ -392,7 +405,7 @@ class Installer extends Controller /** * send a query to MySQL and log the query */ - public function mysqlQuery($sql) + public function mysqlQuery($sql) { $this->installLog($sql); $query = @mysql_query($sql, $this->link); @@ -409,7 +422,7 @@ class Installer extends Controller /** * send a query to MSSQL and log the query */ - public function mssqlQuery($sql) + public function mssqlQuery($sql) { $this->installLog( $sql ); $query = @mssql_query($sql, $this->link); @@ -430,7 +443,7 @@ class Installer extends Controller * @param string $connection * @return array $report */ - public function mysqlFileQuery($file) + public function mysqlFileQuery($file) { if ( !is_file($file) ) { throw ( new Exception ( sprintf ( "File $file is not a valid sql file", $file ) ) ); @@ -455,14 +468,14 @@ class Installer extends Controller // } //erik: New Update, to support more complex queries - + $lines = file($file); $previous = NULL; $errors = ''; @mysql_query("SET NAMES 'utf8';"); foreach ($lines as $j => $line) { $line = trim($line); // Remove comments from the script - + if (strpos($line, "--") === 0) { $line = substr($line, 0, strpos($line, "--")); } @@ -484,17 +497,17 @@ class Installer extends Controller $line = $previous . " " . $line; } $previous = NULL; - + // If the current line doesnt end with ; then put this line together // with the next one, thus supporting multi-line statements. if (strrpos($line, ";") != strlen($line) - 1) { $previous = $line; continue; } - + $line = substr($line, 0, strrpos($line, ";")); @mysql_query($line, $this->link); - } + } $endTime = microtime(true); $this->installLog ( sprintf ('File: %s processed in %3.2f seconds', basename($file) , $endTime - $startTime ) ); @@ -508,7 +521,7 @@ class Installer extends Controller * @param string $connection * @return array $report */ - public function mssqlFileQuery($file) + public function mssqlFileQuery($file) { if ( !is_file($file) ) { throw ( new Exception ( sprintf ( "File $file is not a valid sql file", $file ) ) ); @@ -542,7 +555,7 @@ class Installer extends Controller * @param string $psDatabase * @return void */ - public function setGrantPrivilegesMySQL($psUser, $psPassword, $psDatabase, $host) + public function setGrantPrivilegesMySQL($psUser, $psPassword, $psDatabase, $host) { $host = ($host == 'localhost' || $host == '127.0.0.1' ? 'localhost' : '%'); $query = sprintf("GRANT ALL PRIVILEGES ON `%s`.* TO %s@'%s' IDENTIFIED BY '%s' WITH GRANT OPTION", $psDatabase, $psUser, $host, $psPassword); @@ -557,7 +570,7 @@ class Installer extends Controller * @param string $psDatabase * @return void */ - public function setGrantPrivilegesMSSQL($psUser, $psPassword, $psDatabase) + public function setGrantPrivilegesMSSQL($psUser, $psPassword, $psDatabase) { $query = sprintf ( "IF EXISTS (SELECT * FROM sys.server_principals WHERE name = N'%s') DROP LOGIN [%s]", $psUser, $psUser ); @@ -590,7 +603,7 @@ class Installer extends Controller return true; } - public function createMySQLWorkspace() + public function createMySQLWorkspace() { ini_set('max_execution_time', '0'); $info->result = false; @@ -771,7 +784,7 @@ class Installer extends Controller define('SYS_SYS', 'workflow'); require_once("propel/Propel.php"); - + Propel::init( PATH_CORE . "config/databases.php" ); $con = Propel::getConnection('workflow'); @@ -780,27 +793,27 @@ class Installer extends Controller //setup the appcacheview object, and the path for the sql files $appCache = new AppCacheView(); - + $appCache->setPathToAppCacheFiles ( PATH_METHODS . 'setup' . PATH_SEP .'setupSchemas'. PATH_SEP ); - //APP_DELEGATION INSERT + //APP_DELEGATION INSERT $res = $appCache->triggerAppDelegationInsert($lang, true); - - //APP_DELEGATION Update + + //APP_DELEGATION Update $res = $appCache->triggerAppDelegationUpdate($lang, true); - - //APPLICATION UPDATE + + //APPLICATION UPDATE $res = $appCache->triggerApplicationUpdate($lang, true); - + //APPLICATION DELETE $res = $appCache->triggerApplicationDelete($lang, true); - + //CONTENT UPDATE $res = $appCache->triggerContentUpdate($lang, true); - + //build using the method in AppCacheView Class $res = $appCache->fillAppCacheView($lang); - + //end AppCacheView Build //erik: for new env conf handling @@ -854,7 +867,7 @@ class Installer extends Controller return $info; } - public function createMSSQLWorkspace() + public function createMSSQLWorkspace() { ini_set('max_execution_time', '0'); $info->result = false; @@ -1038,7 +1051,7 @@ class Installer extends Controller return $info; } - public function getEngines() + public function getEngines() { $this->setResponseType('json'); $engines = array(); @@ -1058,7 +1071,7 @@ class Installer extends Controller return $engines; } - public function checkDatabases() + public function checkDatabases() { $this->setResponseType('json'); $info = new stdclass(); @@ -1091,7 +1104,7 @@ class Installer extends Controller * Privates functions section, non callable by http request */ - private function testMySQLconnection() + private function testMySQLconnection() { $info->result = false; $info->message = ''; @@ -1129,7 +1142,7 @@ class Installer extends Controller return $info; } - private function testMSSQLconnection() + private function testMSSQLconnection() { $info->result = false; $info->message = '';