diff --git a/workflow/engine/classes/class.actionsByEmailCore.php b/workflow/engine/classes/ActionsByEmailCoreClass.php similarity index 100% rename from workflow/engine/classes/class.actionsByEmailCore.php rename to workflow/engine/classes/ActionsByEmailCoreClass.php index 0a1cea35f..2ec036fc6 100644 --- a/workflow/engine/classes/class.actionsByEmailCore.php +++ b/workflow/engine/classes/ActionsByEmailCoreClass.php @@ -1,6 +1,7 @@ code}]: {$this->message}\n"; - } -} - -/** - * Application without Delegations exception - * - * @author Herbert Saal Gutierrez - * - * @category Colosa - * @copyright Copyright (c) 2005-2012 Colosa Inc. (http://www.colosa.com) - */ -class ApplicationWithoutDelegationRecordsException extends Exception -{ - // Redefine the exception so message isn't optional - public function __construct($message, $code = 0) - { - // some code - // make sure everything is assigned properly - parent::__construct ($message, $code); - } - - // custom string representation of object - public function __toString() - { - return __CLASS__ . ": [{$this->code}]: {$this->message}\n"; - } -} - -/** - * Dynaform file corrupt - * - * @author Herbert Saal Gutierrez - * - * @category Colosa - * @copyright Copyright (c) 2005-2012 Colosa Inc. (http://www.colosa.com) - */ -class ApplicationWithCorruptDynaformException extends Exception -{ - // Redefine the exception so message isn't optional - public function __construct($message, $code = 0) - { - // some code - // make sure everything is assigned properly - parent::__construct ($message, $code); - } - - // custom string representation of object - public function __toString() - { - return __CLASS__ . ": [{$this->code}]: {$this->message}\n"; - } -} - -/** - * Application APP_DATA could not be unserialized exception - * - * @author Herbert Saal Gutierrez - * - * @category Colosa - * @copyright Copyright (c) 2005-2012 Colosa Inc. (http://www.colosa.com) - */ -class ApplicationAPP_DATAUnserializeException extends Exception -{ - // Redefine the exception so message isn't optional - public function __construct($message, $code = 0) - { - // some code - // make sure everything is assigned properly - parent::__construct ($message, $code); - } - - // custom string representation of object - public function __toString() - { - return __CLASS__ . ": [{$this->code}]: {$this->message}\n"; - } -} -/* -class CheckSolrAvailability -{ - private static _classInstance = null; - private static _SolrIsAvailable = true; - - private function __construct($SolrEnabled, $SolrHost, $SolrInstance) - { - // define solr availability - $this->_solrIsEnabled = $SolrEnabled; - $this->_solrHost = $SolrHost; - $this->_solrInstance = $SolrInstance; - } - - public function getInstance(){ - if() - } -}*/ /** * Implementation to display application data in the PMOS2 grids using Solr @@ -162,8 +53,7 @@ class CheckSolrAvailability * @category Colosa * @copyright Copyright (c) 2005-2011 Colosa Inc. (http://www.colosa.com) * - */ -class AppSolr + */class AppSolr { private $_solrIsEnabled = false; private $_solrHost = ""; @@ -3089,4 +2979,3 @@ class AppSolr } } - diff --git a/workflow/engine/classes/ApplicationAPP_DATAUnserializeException.php b/workflow/engine/classes/ApplicationAPP_DATAUnserializeException.php new file mode 100644 index 000000000..fa5b818db --- /dev/null +++ b/workflow/engine/classes/ApplicationAPP_DATAUnserializeException.php @@ -0,0 +1,70 @@ +. + * + * For more information, contact Colosa Inc, 5304 Ventura Drive, + * Delray Beach, FL, 33484, USA, or email info@colosa.com. + * + */ + +require_once "classes/model/Application.php"; +require_once "classes/model/AppDelegation.php"; +require_once "classes/model/AppThread.php"; +require_once "classes/model/Content.php"; +require_once "classes/model/Users.php"; +require_once "classes/model/GroupUser.php"; +require_once "classes/model/Task.php"; +require_once "classes/model/TaskUser.php"; +require_once "classes/model/Dynaform.php"; +require_once "classes/model/ProcessVariables.php"; +require_once "entities/SolrRequestData.php"; +require_once "entities/SolrUpdateDocument.php"; +require_once "entities/AppSolrQueue.php"; +require_once "classes/model/AppSolrQueue.php"; + + +/** + * Invalid search text for Solr exception + * + * @author Herbert Saal Gutierrez + * + */ + +/** + * Application APP_DATA could not be unserialized exception + * + * @author Herbert Saal Gutierrez + * + * @category Colosa + * @copyright Copyright (c) 2005-2012 Colosa Inc. (http://www.colosa.com) + */class ApplicationAPP_DATAUnserializeException extends Exception +{ + // Redefine the exception so message isn't optional + public function __construct($message, $code = 0) + { + // some code + // make sure everything is assigned properly + parent::__construct ($message, $code); + } + + // custom string representation of object + public function __toString() + { + return __CLASS__ . ": [{$this->code}]: {$this->message}\n"; + } +} diff --git a/workflow/engine/classes/ApplicationWithCorruptDynaformException.php b/workflow/engine/classes/ApplicationWithCorruptDynaformException.php new file mode 100644 index 000000000..4d80ec312 --- /dev/null +++ b/workflow/engine/classes/ApplicationWithCorruptDynaformException.php @@ -0,0 +1,70 @@ +. + * + * For more information, contact Colosa Inc, 5304 Ventura Drive, + * Delray Beach, FL, 33484, USA, or email info@colosa.com. + * + */ + +require_once "classes/model/Application.php"; +require_once "classes/model/AppDelegation.php"; +require_once "classes/model/AppThread.php"; +require_once "classes/model/Content.php"; +require_once "classes/model/Users.php"; +require_once "classes/model/GroupUser.php"; +require_once "classes/model/Task.php"; +require_once "classes/model/TaskUser.php"; +require_once "classes/model/Dynaform.php"; +require_once "classes/model/ProcessVariables.php"; +require_once "entities/SolrRequestData.php"; +require_once "entities/SolrUpdateDocument.php"; +require_once "entities/AppSolrQueue.php"; +require_once "classes/model/AppSolrQueue.php"; + + +/** + * Invalid search text for Solr exception + * + * @author Herbert Saal Gutierrez + * + */ + +/** + * Dynaform file corrupt + * + * @author Herbert Saal Gutierrez + * + * @category Colosa + * @copyright Copyright (c) 2005-2012 Colosa Inc. (http://www.colosa.com) + */class ApplicationWithCorruptDynaformException extends Exception +{ + // Redefine the exception so message isn't optional + public function __construct($message, $code = 0) + { + // some code + // make sure everything is assigned properly + parent::__construct ($message, $code); + } + + // custom string representation of object + public function __toString() + { + return __CLASS__ . ": [{$this->code}]: {$this->message}\n"; + } +} diff --git a/workflow/engine/classes/ApplicationWithoutDelegationRecordsException.php b/workflow/engine/classes/ApplicationWithoutDelegationRecordsException.php new file mode 100644 index 000000000..b55d9f926 --- /dev/null +++ b/workflow/engine/classes/ApplicationWithoutDelegationRecordsException.php @@ -0,0 +1,70 @@ +. + * + * For more information, contact Colosa Inc, 5304 Ventura Drive, + * Delray Beach, FL, 33484, USA, or email info@colosa.com. + * + */ + +require_once "classes/model/Application.php"; +require_once "classes/model/AppDelegation.php"; +require_once "classes/model/AppThread.php"; +require_once "classes/model/Content.php"; +require_once "classes/model/Users.php"; +require_once "classes/model/GroupUser.php"; +require_once "classes/model/Task.php"; +require_once "classes/model/TaskUser.php"; +require_once "classes/model/Dynaform.php"; +require_once "classes/model/ProcessVariables.php"; +require_once "entities/SolrRequestData.php"; +require_once "entities/SolrUpdateDocument.php"; +require_once "entities/AppSolrQueue.php"; +require_once "classes/model/AppSolrQueue.php"; + + +/** + * Invalid search text for Solr exception + * + * @author Herbert Saal Gutierrez + * + */ + +/** + * Application without Delegations exception + * + * @author Herbert Saal Gutierrez + * + * @category Colosa + * @copyright Copyright (c) 2005-2012 Colosa Inc. (http://www.colosa.com) + */class ApplicationWithoutDelegationRecordsException extends Exception +{ + // Redefine the exception so message isn't optional + public function __construct($message, $code = 0) + { + // some code + // make sure everything is assigned properly + parent::__construct ($message, $code); + } + + // custom string representation of object + public function __toString() + { + return __CLASS__ . ": [{$this->code}]: {$this->message}\n"; + } +} diff --git a/workflow/engine/classes/class.applications.php b/workflow/engine/classes/Applications.php similarity index 100% rename from workflow/engine/classes/class.applications.php rename to workflow/engine/classes/Applications.php index 39b1e1fb5..9196779b6 100644 --- a/workflow/engine/classes/class.applications.php +++ b/workflow/engine/classes/Applications.php @@ -2,6 +2,7 @@ use ProcessMaker\Plugins\PluginRegistry; + class Applications { /** @@ -1213,4 +1214,3 @@ class Applications return $steps; } } - diff --git a/workflow/engine/classes/Archive.php b/workflow/engine/classes/Archive.php new file mode 100644 index 000000000..96b3666dc --- /dev/null +++ b/workflow/engine/classes/Archive.php @@ -0,0 +1,369 @@ +options = array ('basedir' => ".",'name' => $name,'prepend' => "",'inmemory' => 0,'overwrite' => 0,'recurse' => 1,'storepaths' => 1,'followlinks' => 0,'level' => 3,'method' => 1,'sfx' => "",'type' => "",'comment' => "" + ); + $this->files = array (); + $this->exclude = array (); + $this->storeonly = array (); + $this->error = array (); + } + + /** + * This function gives options to a archive + * + * @param array $options + * @return void + */ + public function set_options ($options) + { + foreach ($options as $key => $value) { + $this->options[$key] = $value; + } + if (! empty( $this->options['basedir'] )) { + $this->options['basedir'] = str_replace( "\\", "/", $this->options['basedir'] ); + $this->options['basedir'] = preg_replace( "/\/+/", "/", $this->options['basedir'] ); + $this->options['basedir'] = preg_replace( "/\/$/", "", $this->options['basedir'] ); + } + if (! empty( $this->options['name'] )) { + $this->options['name'] = str_replace( "\\", "/", $this->options['name'] ); + $this->options['name'] = preg_replace( "/\/+/", "/", $this->options['name'] ); + } + if (! empty( $this->options['prepend'] )) { + $this->options['prepend'] = str_replace( "\\", "/", $this->options['prepend'] ); + $this->options['prepend'] = preg_replace( "/^(\.*\/+)+/", "", $this->options['prepend'] ); + $this->options['prepend'] = preg_replace( "/\/+/", "/", $this->options['prepend'] ); + $this->options['prepend'] = preg_replace( "/\/$/", "", $this->options['prepend'] ) . "/"; + } + } + + /** + * This function is used to create a archive. + * + * @return boolean + */ + public function create_archive () + { + $this->make_list(); + if ($this->options['inmemory'] == 0) { + $pwd = getcwd(); + chdir( $this->options['basedir'] ); + if ($this->options['overwrite'] == 0 && file_exists( $this->options['name'] . ($this->options['type'] == "gzip" || $this->options['type'] == "bzip" ? ".tmp" : "") )) { + $this->error[] = "File {$this->options['name']} already exist."; + chdir( $pwd ); + return 0; + } elseif ($this->archive = @fopen( $this->options['name'] . ($this->options['type'] == "gzip" || $this->options['type'] == "bzip" ? ".tmp" : ""), "wb+" )) { + chdir( $pwd ); + } else { + $this->error[] = "Could not open {$this->options['name']} for writing."; + chdir( $pwd ); + return 0; + } + } else { + $this->archive = ""; + } + switch ($this->options['type']) { + case "zip": + if (! $this->create_zip()) { + $this->error[] = "Could not create zip file."; + return 0; + } + break; + case "bzip": + if (! $this->create_tar()) { + $this->error[] = "Could not create tar file."; + return 0; + } + if (! $this->create_bzip()) { + $this->error[] = "Could not create bzip2 file."; + return 0; + } + break; + case "gzip": + if (! $this->create_tar()) { + $this->error[] = "Could not create tar file."; + return 0; + } + if (! $this->create_gzip()) { + $this->error[] = "Could not create gzip file."; + return 0; + } + break; + case "tar": + if (! $this->create_tar()) { + $this->error[] = "Could not create tar file."; + return 0; + } + } + if ($this->options['inmemory'] == 0) { + fclose( $this->archive ); + if ($this->options['type'] == "gzip" || $this->options['type'] == "bzip") { + unlink( $this->options['basedir'] . "/" . $this->options['name'] . ".tmp" ); + } + } + } + + /** + * This function is used for add data to a archive + * + * @param string $data + * @return void + */ + public function add_data ($data) + { + if ($this->options['inmemory'] == 0) { + fwrite( $this->archive, $data ); + } else { + $this->archive .= $data; + } + } + + /** + * This function make a list + * + * @return void + */ + public function make_list () + { + if (! empty( $this->exclude )) { + foreach ($this->files as $key => $value) { + foreach ($this->exclude as $current) { + if ($value['name'] == $current['name']) { + unset( $this->files[$key] ); + } + } + } + } + if (! empty( $this->storeonly )) { + foreach ($this->files as $key => $value) { + foreach ($this->storeonly as $current) { + if ($value['name'] == $current['name']) { + $this->files[$key]['method'] = 0; + } + } + } + } + unset( $this->exclude, $this->storeonly ); + } + + /** + * Add files a list + * + * @param array $list + * @return void + */ + public function add_files ($list) + { + $temp = $this->list_files( $list ); + foreach ($temp as $current) { + $this->files[] = $current; + } + } + + /** + * This function exclude files of a list + * + * @param array $list + * @return void + */ + public function exclude_files ($list) + { + $temp = $this->list_files( $list ); + foreach ($temp as $current) { + $this->exclude[] = $current; + } + } + + /** + * This function store files + * + * @param array $list + */ + public function store_files ($list) + { + $temp = $this->list_files( $list ); + foreach ($temp as $current) { + $this->storeonly[] = $current; + } + } + + /** + * List files gives a List + * + * @param array $list + * @return array + */ + public function list_files ($list) + { + if (! is_array( $list )) { + $temp = $list; + $list = array ($temp + ); + unset( $temp ); + } + $files = array (); + $pwd = getcwd(); + chdir( $this->options['basedir'] ); + foreach ($list as $current) { + $current = str_replace( "\\", "/", $current ); + $current = preg_replace( "/\/+/", "/", $current ); + $current = preg_replace( "/\/$/", "", $current ); + if (strstr( $current, "*" )) { + $regex = preg_replace( "/([\\\^\$\.\[\]\|\(\)\?\+\{\}\/])/", "\\\\\\1", $current ); + $regex = str_replace( "*", ".*", $regex ); + $dir = strstr( $current, "/" ) ? substr( $current, 0, strrpos( $current, "/" ) ) : "."; + $temp = $this->parse_dir( $dir ); + foreach ($temp as $current2) { + if (preg_match( "/^{$regex}$/i", $current2['name'] )) { + $files[] = $current2; + } + } + unset( $regex, $dir, $temp, $current ); + } elseif (@is_dir( $current )) { + $temp = $this->parse_dir( $current ); + foreach ($temp as $file) { + $files[] = $file; + } + unset( $temp, $file ); + } elseif (@file_exists( $current )) { + $files[] = array ('name' => $current,'name2' => $this->options['prepend'] . preg_replace( "/(\.+\/+)+/", "", ($this->options['storepaths'] == 0 && strstr( $current, "/" )) ? substr( $current, strrpos( $current, "/" ) + 1 ) : $current ),'type' => @is_link( $current ) && $this->options['followlinks'] == 0 ? 2 : 0,'ext' => substr( $current, strrpos( $current, "." ) ),'stat' => stat( $current ) + ); + } + } + chdir( $pwd ); + unset( $current, $pwd ); + usort( $files, array ("archive","sort_files" + ) ); + return $files; + } + + /** + * This function is for parse a directory name + * + * @param string $dirname + * @return array + */ + public function parse_dir ($dirname) + { + if ($this->options['storepaths'] == 1 && ! preg_match( "/^(\.+\/*)+$/", $dirname )) { + $files = array (array ('name' => $dirname,'name2' => $this->options['prepend'] . preg_replace( "/(\.+\/+)+/", "", ($this->options['storepaths'] == 0 && strstr( $dirname, "/" )) ? substr( $dirname, strrpos( $dirname, "/" ) + 1 ) : $dirname ),'type' => 5,'stat' => stat( $dirname ) + ) + ); + } else { + $files = array (); + } + $dir = @opendir( $dirname ); + while ($file = @readdir( $dir )) { + $fullname = $dirname . "/" . $file; + if ($file == "." || $file == "..") { + continue; + } elseif (@is_dir( $fullname )) { + if (empty( $this->options['recurse'] )) { + continue; + } + $temp = $this->parse_dir( $fullname ); + foreach ($temp as $file2) { + $files[] = $file2; + } + } elseif (@file_exists( $fullname )) { + $files[] = array ('name' => $fullname,'name2' => $this->options['prepend'] . preg_replace( "/(\.+\/+)+/", "", ($this->options['storepaths'] == 0 && strstr( $fullname, "/" )) ? substr( $fullname, strrpos( $fullname, "/" ) + 1 ) : $fullname ),'type' => @is_link( $fullname ) && $this->options['followlinks'] == 0 ? 2 : 0,'ext' => substr( $file, strrpos( $file, "." ) ),'stat' => stat( $fullname ) + ); + } + } + @closedir( $dir ); + return $files; + } + + /** + * This function sort two files + * + * @param array $a + * @param array $b + * @return boolean + */ + public function sort_files ($a, $b) + { + if ($a['type'] != $b['type']) { + if ($a['type'] == 5 || $b['type'] == 2) { + return - 1; + } elseif ($a['type'] == 2 || $b['type'] == 5) { + return 1; + } elseif ($a['type'] == 5) { + return strcmp( strtolower( $a['name'] ), strtolower( $b['name'] ) ); + } elseif ($a['ext'] != $b['ext']) { + return strcmp( $a['ext'], $b['ext'] ); + } elseif ($a['stat'][7] != $b['stat'][7]) { + return $a['stat'][7] > $b['stat'][7] ? - 1 : 1; + } else { + return strcmp( strtolower( $a['name'] ), strtolower( $b['name'] ) ); + } + } + return 0; + } + + /** + * This function download a file + * + * @return void + */ + public function download_file () + { + if ($this->options['inmemory'] == 0) { + $this->error[] = "Can only use download_file() if archive is in memory. Redirect to file otherwise, it is faster."; + return; + } + switch ($this->options['type']) { + case "zip": + header( "Content-Type: application/zip" ); + break; + case "bzip": + header( "Content-Type: application/x-bzip2" ); + break; + case "gzip": + header( "Content-Type: application/x-gzip" ); + break; + case "tar": + header( "Content-Type: application/x-tar" ); + } + $header = "Content-Disposition: attachment; filename=\""; + $header .= strstr( $this->options['name'], "/" ) ? substr( $this->options['name'], strrpos( $this->options['name'], "/" ) + 1 ) : $this->options['name']; + $header .= "\""; + header( $header ); + header( "Content-Length: " . strlen( $this->archive ) ); + header( "Content-Transfer-Encoding: binary" ); + header( "Cache-Control: no-cache, must-revalidate, max-age=60" ); + header( "Expires: Sat, 01 Jan 2000 12:00:00 GMT" ); + print ($this->archive) ; + } +} diff --git a/workflow/engine/classes/class.ArrayPeer.php b/workflow/engine/classes/ArrayBasePeer.php similarity index 97% rename from workflow/engine/classes/class.ArrayPeer.php rename to workflow/engine/classes/ArrayBasePeer.php index d33ecf53d..c7f8598e4 100644 --- a/workflow/engine/classes/class.ArrayPeer.php +++ b/workflow/engine/classes/ArrayBasePeer.php @@ -26,16 +26,12 @@ */ require_once 'propel/util/BasePeer.php'; -// The object class -- needed for instanceof checks in this class. -// actual class may be a subclass -- as returned by ApplicationPeer::getOMClass() -include_once 'classes/model/Application.php'; - +// The object /** * Base static class for performing query and update operations on the 'APPLICATION' table. * * @package workflow.engine.classes - */ -abstract class ArrayBasePeer + */abstract class ArrayBasePeer { /** @@ -858,20 +854,3 @@ abstract class ArrayBasePeer } } // BaseApplicationPeer - - -// static code to register the map builder for this Peer with the main Propel class -if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { - BaseApplicationPeer::getMapBuilder(); - } catch (Exception $e) { - Propel::log( 'Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR ); - } -} else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'classes/model/map/ApplicationMapBuilder.php'; - Propel::registerMapBuilder( 'classes.model.map.ApplicationMapBuilder' ); -} diff --git a/workflow/engine/classes/class.solr.php b/workflow/engine/classes/BpmnEngine_SearchIndexAccess_Solr.php similarity index 99% rename from workflow/engine/classes/class.solr.php rename to workflow/engine/classes/BpmnEngine_SearchIndexAccess_Solr.php index 5e5698f67..06eae775c 100644 --- a/workflow/engine/classes/class.solr.php +++ b/workflow/engine/classes/BpmnEngine_SearchIndexAccess_Solr.php @@ -28,7 +28,12 @@ * @author Herbert Saal Gutierrez * */ -class BpmnEngine_SearchIndexAccess_Solr + +/** + * Interface to the Solr Search server + * @author Herbert Saal Gutierrez + * + */class BpmnEngine_SearchIndexAccess_Solr { const SOLR_VERSION = '&version=2.2'; private $_solrIsEnabled = false; diff --git a/workflow/engine/classes/class.searchIndex.php b/workflow/engine/classes/BpmnEngine_Services_SearchIndex.php similarity index 99% rename from workflow/engine/classes/class.searchIndex.php rename to workflow/engine/classes/BpmnEngine_Services_SearchIndex.php index 14bca73be..b946d96af 100644 --- a/workflow/engine/classes/class.searchIndex.php +++ b/workflow/engine/classes/BpmnEngine_Services_SearchIndex.php @@ -29,7 +29,13 @@ * @author Herbert Saal Gutierrez * */ -class BpmnEngine_Services_SearchIndex + +/** + * Class used as interface to have access to the search index services + * + * @author Herbert Saal Gutierrez + * + */class BpmnEngine_Services_SearchIndex { private $_solrIsEnabled = false; private $_solrHost = ""; diff --git a/workflow/engine/classes/Bzip_File.php b/workflow/engine/classes/Bzip_File.php new file mode 100644 index 000000000..760ccbd72 --- /dev/null +++ b/workflow/engine/classes/Bzip_File.php @@ -0,0 +1,80 @@ +tar_file( $name ); + $this->options['type'] = "bzip"; + } + + /** + * This function is employed to create files . + * bzip + * + * @return boolean + */ + public function create_bzip () + { + if ($this->options['inmemory'] == 0) { + $pwd = getcwd(); + chdir( $this->options['basedir'] ); + if ($fp = bzopen( $this->options['name'], "wb" )) { + fseek( $this->archive, 0 ); + while ($temp = fread( $this->archive, 1048576 )) { + bzwrite( $fp, $temp ); + } + bzclose( $fp ); + chdir( $pwd ); + } else { + $this->error[] = "Could not open {$this->options['name']} for writing."; + chdir( $pwd ); + return 0; + } + } else { + $this->archive = bzcompress( $this->archive, $this->options['level'] ); + } + return 1; + } + + /** + * This function open a archive of the class bzip_file + * + * @return void + */ + public function open_archive () + { + return @bzopen( $this->options['name'], "rb" ); + } +} diff --git a/workflow/engine/classes/class.cli.php b/workflow/engine/classes/CLI.php similarity index 99% rename from workflow/engine/classes/class.cli.php rename to workflow/engine/classes/CLI.php index 8a587bfc3..1a973f86b 100644 --- a/workflow/engine/classes/class.cli.php +++ b/workflow/engine/classes/CLI.php @@ -31,7 +31,11 @@ * * @package workflow.engine.classes */ -class CLI + +/** + * + * @package workflow.engine.classes + */class CLI { public static $tasks = array (); public static $currentTask = null; @@ -384,4 +388,3 @@ EOT; } } } - diff --git a/workflow/engine/classes/class.case.php b/workflow/engine/classes/Cases.php similarity index 99% rename from workflow/engine/classes/class.case.php rename to workflow/engine/classes/Cases.php index 2a37048bb..953a66956 100644 --- a/workflow/engine/classes/class.case.php +++ b/workflow/engine/classes/Cases.php @@ -34,7 +34,12 @@ use ProcessMaker\Plugins\PluginRegistry; * This object is applied to Task * @package workflow.engine.classes */ -class Cases + +/** + * A Cases object where you can do start, load, update, refresh about cases + * This object is applied to Task + * @package workflow.engine.classes + */class Cases { private $appSolr = null; diff --git a/workflow/engine/classes/class.configuration.php b/workflow/engine/classes/Configurations.php similarity index 99% rename from workflow/engine/classes/class.configuration.php rename to workflow/engine/classes/Configurations.php index eb548ba5b..ccaf3c984 100644 --- a/workflow/engine/classes/class.configuration.php +++ b/workflow/engine/classes/Configurations.php @@ -34,13 +34,7 @@ /** - * ProcessConfiguration - ProcessConfiguration class - * - * @author David S. Callizaya S. - * @copyright 2007 COLOSA - */ -require_once 'classes/model/Configuration.php'; - + * ProcessConfiguration - ProcessConfiguration /** * Extends Configuration * @@ -48,8 +42,7 @@ require_once 'classes/model/Configuration.php'; * @copyright 2007 COLOSA * @version Release: @package_version@ * @package workflow.engine.ProcessMaker - */ -class Configurations // extends Configuration + */class Configurations // extends Configuration { public $aConfig = array(); @@ -1006,4 +999,3 @@ class Configurations // extends Configuration return $ver; } } - diff --git a/workflow/engine/classes/class.consolidatedCases.php b/workflow/engine/classes/ConsolidatedCases.php similarity index 99% rename from workflow/engine/classes/class.consolidatedCases.php rename to workflow/engine/classes/ConsolidatedCases.php index c0c261b4d..a6de1de63 100644 --- a/workflow/engine/classes/class.consolidatedCases.php +++ b/workflow/engine/classes/ConsolidatedCases.php @@ -1,5 +1,6 @@ - */ -require_once ("classes/model/TaskPeer.php"); -require_once ("classes/model/HolidayPeer.php"); - + * This /** * * @package workflow.engine.classes - */ -class dates + */class dates { private $holidays = array(); @@ -529,4 +522,3 @@ class dates return $iDate; } } - diff --git a/workflow/engine/classes/class.dbConnections.php b/workflow/engine/classes/DbConnections.php similarity index 98% rename from workflow/engine/classes/class.dbConnections.php rename to workflow/engine/classes/DbConnections.php index 3eb1929c1..28ac7788b 100644 --- a/workflow/engine/classes/class.dbConnections.php +++ b/workflow/engine/classes/DbConnections.php @@ -1,18 +1,7 @@ - * Description:This is a class for load all additional connections; if exist in a particular proccess - * Date: 15-05-2008 - * - * - * class.dbConnections.php - * - * Email bugs/suggestions to erik@colosa.com - */ - -require_once 'model/DbSource.php'; -require_once 'model/Content.php'; - + * Description:This is a /** * dbConnections * @@ -20,8 +9,7 @@ require_once 'model/Content.php'; * @copyright 2008 Colosa * @package workflow.engine.classes * - */ -class DbConnections + */class DbConnections { private $PRO_UID; public $connections; diff --git a/workflow/engine/classes/class.derivation.php b/workflow/engine/classes/Derivation.php similarity index 99% rename from workflow/engine/classes/class.derivation.php rename to workflow/engine/classes/Derivation.php index 9dbd41bcc..8ebabe561 100644 --- a/workflow/engine/classes/class.derivation.php +++ b/workflow/engine/classes/Derivation.php @@ -1,13 +1,13 @@ . + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +/** + * Created on 21/12/2007 + * Dynaform - Dynaform +/** + * + * @package workflow.engine.classes + */class dynaformEditor extends WebResource +{ + + private $isOldCopy = false; + public $file = ''; + public $title = 'New Dynaform'; + public $dyn_uid = ''; + public $dyn_type = ''; + public $home = ''; + + /** + * Other Options for Editor: + * left: 'getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))', + * top: 'getAbsoluteTop(document.getElementById("dynaformEditor[0]"))', + * height: '3/4*(document.body.clientWidth-getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))*2)', + * left: 'getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))' + * left: 'getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))' + * + * Other Options for Toolbar: + * left: 'getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))', + * top: 'getAbsoluteTop(document.getElementById("dynaformEditor[0]"))', + */ + public $defaultConfig = array('Editor' => array('left' => '0', 'top' => '0', 'width' => 'document.body.clientWidth-4', 'height' => 'document.body.clientHeight-4'), + 'Toolbar' => array('left' => 'document.body.clientWidth-2-toolbar.clientWidth-24-3+7', 'top' => '52'), + 'FieldsList' => array('left' => '4+toolbar.clientWidth+24', 'top' => 'getAbsoluteTop(document.getElementById("dynaformEditor[0]"))', 'width' => 244, 'height' => 400) + ); + public $panelConf = array('style' => array('title' => array('textAlign' => 'center')), + 'width' => 700, 'height' => 600, 'tabWidth' => 120, 'modal' => true, 'drag' => false, 'resize' => false, 'blinkToFront' => false + ); + + /** + * Constructor of the class dynaformEditor + * + * @param string $get + * @return void + */ + public function dynaformEditor($get) + { + $this->panelConf = array_merge($this->panelConf, $this->defaultConfig['Editor']); + //'title' => G::LoadTranslation('ID_DYNAFORM_EDITOR').' - ['.$this->title.']', + } + + /** + * Create the xml form default + * + * @param string $filename + * @return void + */ + public function _createDefaultXmlForm($fileName) + { + //Create the default Dynaform + $sampleForm = '' . "\n"; + $sampleForm .= '' . "\n"; + switch ($this->dyn_type) { + case "xmlform": + /* $sampleForm.='' . "\n" . + ' <en>Sample form</en>' . "\n" . + ''."\n"; + $sampleForm.='' . "\n" . + ' Submit' . "\n" . + ''."\n"; */ + break; + case "grid": + /* $sampleForm.='' . "\n" . + 'A' . "\n" . + ''."\n"; + $sampleForm.='' . "\n" . + 'B' . "\n" . + ''."\n"; */ + break; + } + $sampleForm .= ''; + G::verifyPath(dirname($fileName), true); + $fp = fopen($fileName, 'w'); + $sampleForm = str_replace('name=""', 'name="' . $this->_getFilename($this->file) . '"', $sampleForm); + fwrite($fp, $sampleForm); + fclose($fp); + } + + /** + * Prints the DynaformEditor + * + * @return void + */ + public function _render() + { + global $G_PUBLISH; + $script = ''; + + /* Start Block: Load (Create if doesn't exist) the xmlform */ + $Parameters = array('SYS_LANG' => SYS_LANG, 'URL' => G::encrypt($this->file, URL_KEY), 'DYN_UID' => $this->dyn_uid, 'PRO_UID' => $this->pro_uid, 'DYNAFORM_NAME' => $this->dyn_title, 'FILE' => $this->file, 'DYN_EDITOR' => $this->dyn_editor + ); + $_SESSION['Current_Dynafom']['Parameters'] = $Parameters; + + $XmlEditor = array('URL' => G::encrypt($this->file, URL_KEY), 'XML' => '' //$openDoc->getXml() + ); + $JSEditor = array('URL' => G::encrypt($this->file, URL_KEY) + ); + + $A = G::encrypt($this->file, URL_KEY); + + try { + $openDoc = new Xml_Document(); + $fileName = $this->home . $this->file . '.xml'; + if (file_exists($fileName)) { + $openDoc->parseXmlFile($fileName); + } else { + $this->_createDefaultXmlForm($fileName); + $openDoc->parseXmlFile($fileName); + } + //$form = new Form( $this->file , $this->home, SYS_LANG, true ); + $Properties = dynaformEditorAjax::get_properties($A, $this->dyn_uid); + /* Start Block: Prepare the XMLDB connection */ + define('DB_XMLDB_HOST', PATH_DYNAFORM . $this->file . '.xml'); + define('DB_XMLDB_USER', ''); + define('DB_XMLDB_PASS', ''); + define('DB_XMLDB_NAME', ''); + define('DB_XMLDB_TYPE', 'myxml'); + /* Start Block: Prepare the dynaformEditor */ + $G_PUBLISH = new Publisher(); + $sName = 'dynaformEditor'; + $G_PUBLISH->publisherId = $sName; + $oHeadPublisher = & headPublisher::getSingleton(); + $oHeadPublisher->setTitle(G::LoadTranslation('ID_DYNAFORM_EDITOR') . ' - ' . $Properties['DYN_TITLE']); + $G_PUBLISH->AddContent('blank'); + $this->panelConf['title'] = ''; + $G_PUBLISH->AddContent('panel-init', 'mainPanel', $this->panelConf); + if ($Properties['DYN_TYPE'] == 'xmlform') { + $G_PUBLISH->AddContent('xmlform', 'toolbar', 'dynaforms/fields_Toolbar', 'display:none', $Parameters, '', ''); + } else { + $G_PUBLISH->AddContent('xmlform', 'toolbar', 'dynaforms/fields_ToolbarGrid', 'display:none', $Parameters, '', ''); + } + $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_Editor', 'display:none', $Parameters, '', ''); + $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_XmlEditor', 'display:none', $XmlEditor, '', ''); + $G_PUBLISH->AddContent('blank'); + $i = 0; + $aFields = array(); + $aFields[] = array('XMLNODE_NAME' => 'char', 'TYPE' => 'char', 'UP' => 'char', 'DOWN' => 'char' + ); + $oSession = new DBSession(new DBConnection(PATH_DYNAFORM . $this->file . '.xml', '', '', '', 'myxml')); + $oDataset = $oSession->Execute('SELECT * FROM dynaForm WHERE NOT( XMLNODE_NAME = "" ) AND TYPE <> "pmconnection"'); + $iMaximun = $oDataset->count(); + while ($aRow = $oDataset->Read()) { + $aFields[] = array('XMLNODE_NAME' => $aRow['XMLNODE_NAME'], 'TYPE' => $aRow['TYPE'], 'UP' => ($i > 0 ? G::LoadTranslation('ID_UP') : ''), 'DOWN' => ($i < $iMaximun - 1 ? G::LoadTranslation('ID_DOWN') : ''), 'row__' => ($i + 1) + ); + $i++; + break; + } + global $_DBArray; + $_DBArray['fields'] = $aFields; + $_SESSION['_DBArray'] = $_DBArray; + $oCriteria = new Criteria('dbarray'); + $oCriteria->setDBArrayTable('fields'); + /** + * *@Erik-> this is deprecated,. + * (unuseful) $G_PUBLISH->AddContent('propeltable', 'paged-table', 'dynaforms/fields_List', $oCriteria, $Parameters, '', SYS_URI.'dynaforms/dynaforms_PagedTableAjax');** + */ + $G_PUBLISH->AddContent('blank'); + $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_JSEditor', 'display:none', $JSEditor, '', ''); + } catch (Exception $e) { + + } + $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_Properties', 'display:none', $Properties, '', ''); + //for showHide tab option @Neyek + $G_PUBLISH->AddContent('blank'); + $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_PREVIEW"), $sName . '[3]', 'dynaformEditor.changeToPreview', 'dynaformEditor.saveCurrentView'); + $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_XML"), $sName . '[4]', 'dynaformEditor.changeToXmlCode', 'dynaformEditor.saveCurrentView'); + if ($Properties['DYN_TYPE'] != 'grid') { + $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_HTML"), $sName . '[5]', 'dynaformEditor.changeToHtmlCode', 'dynaformEditor.saveCurrentView'); + } + $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_FIELDS_LIST"), $sName . '[6]', 'dynaformEditor.changeToFieldsList', 'dynaformEditor.saveCurrentView'); + if ($Properties["DYN_TYPE"] != "grid") { + $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_JAVASCRIPTS"), $sName . '[7]', 'dynaformEditor.changeToJavascripts', 'dynaformEditor.saveCurrentView'); + } + $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_PROPERTIES"), $sName . '[8]', 'dynaformEditor.changeToProperties', 'dynaformEditor.saveCurrentView'); + + //for showHide tab option @Neyek + if ($Properties["DYN_TYPE"] != "grid") { + $G_PUBLISH->AddContent("panel-tab", G::LoadTranslation("ID_CONDITIONS_EDITOR"), $sName . "[9]", "dynaformEditor.changeToShowHide", "dynaformEditor.saveShowHide"); + } + + $G_PUBLISH->AddContent('panel-close'); + $oHeadPublisher->addScriptFile("/js/maborak/core/maborak.loader.js",2); + $oHeadPublisher->addScriptFile('/jscore/dynaformEditor/core/dynaformEditor.js'); + + $oHeadPublisher->addScriptFile('/js/codemirrorOld/js/codemirror.js',1); + + $oHeadPublisher->addScriptFile('/js/grid/core/grid.js'); + $oHeadPublisher->addScriptCode(' + var DYNAFORM_URL="' . $Parameters['URL'] . '"; + leimnud.event.add(window,"load",function(){ loadEditor(); }); + '); + $oHeadPublisher->addScriptCode(' var jsMeta;var __usernameLoggedDE__ = "' . (isset($_SESSION['USR_USERNAME']) ? $_SESSION['USR_USERNAME'] : '') . '";var SYS_LANG = "' . SYS_LANG . '";var __DYN_UID__ = "' . $this->dyn_uid . '";'); + + $arrayParameterAux = $Parameters; + $arrayParameterAux["DYNAFORM_NAME"] = base64_encode($arrayParameterAux["DYNAFORM_NAME"]); + $oHeadPublisher->addScriptCode('var dynaformEditorParams = \'' . serialize($arrayParameterAux) . '\';'); + + G::RenderPage("publish", 'blank'); + } + + /** + * Get the filename + * + * @param string $file + * @return string + */ + public function _getFilename($file) + { + return (strcasecmp(substr($file, - 5), '_tmp0') == 0) ? substr($file, 0, strlen($file) - 5) : $file; + } + + /** + * Set the temporal copy + * + * @param string $onOff + * @return void + */ + public function _setUseTemporalCopy($onOff) + { + $file = self::_getFilename($this->file); + if ($onOff) { + $this->file = $file . '_tmp0'; + self::_setTmpData(array('useTmpCopy' => true )); + if (!file_exists(PATH_DYNAFORM . $file . '.xml')) { + $this->_createDefaultXmlForm(PATH_DYNAFORM . $file . '.xml'); + } + //Creates a copy if it doesn't exist, else, use the old copy + if (!file_exists(PATH_DYNAFORM . $this->file . '.xml')) { + self::_copyFile(PATH_DYNAFORM . $file . '.xml', PATH_DYNAFORM . $this->file . '.xml'); + } + if (!file_exists(PATH_DYNAFORM . $this->file . '.html') && file_exists(PATH_DYNAFORM . $file . '.html')) { + self::_copyFile(PATH_DYNAFORM . $file . '.html', PATH_DYNAFORM . $this->file . '.html'); + } + } else { + $this->file = $file; + self::_setTmpData(array()); + } + } + + /** + * Set temporal data + * + * @param $data + * @return void + */ + public function _setTmpData($data) + { + G::verifyPath(PATH_C . 'dynEditor/', true); + $fp = fopen(PATH_C . 'dynEditor/' . session_id() . '.php', 'w'); + fwrite($fp, '$tmpData=unserialize(\'' . addcslashes(serialize($data), '\\\'') . '\');'); + fclose($fp); + } + + /** + * Get temporal data + * + * @param string $filename + * @return array + */ + public function _getTmpData() + { + $tmpData = array(); + $file = PATH_C . 'dynEditor/' . session_id() . '.php'; + if (file_exists($file)) { + eval(implode('', file($file))); + } + return $tmpData; + } + + /** + * Copy files + * + * @param file $from + * @param file $to + * @return void + */ + public function _copyFile($from, $to) + { + $copy = implode('', file($from)); + $fcopy = fopen($to, "w"); + fwrite($fcopy, $copy); + fclose($fcopy); + } +} diff --git a/workflow/engine/classes/class.dynaformEditor.php b/workflow/engine/classes/DynaformEditorAjax.php similarity index 65% rename from workflow/engine/classes/class.dynaformEditor.php rename to workflow/engine/classes/DynaformEditorAjax.php index 7f402904b..dd45319b4 100644 --- a/workflow/engine/classes/class.dynaformEditor.php +++ b/workflow/engine/classes/DynaformEditorAjax.php @@ -26,313 +26,12 @@ */ /** * Created on 21/12/2007 - * Dynaform - Dynaform class - * - * @copyright 2007 COLOSA - * @author David Callizaya - */ - -/** - * - * @package workflow.engine.classes - */ -class dynaformEditor extends WebResource -{ - - private $isOldCopy = false; - public $file = ''; - public $title = 'New Dynaform'; - public $dyn_uid = ''; - public $dyn_type = ''; - public $home = ''; - - /** - * Other Options for Editor: - * left: 'getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))', - * top: 'getAbsoluteTop(document.getElementById("dynaformEditor[0]"))', - * height: '3/4*(document.body.clientWidth-getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))*2)', - * left: 'getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))' - * left: 'getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))' - * - * Other Options for Toolbar: - * left: 'getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))', - * top: 'getAbsoluteTop(document.getElementById("dynaformEditor[0]"))', - */ - public $defaultConfig = array('Editor' => array('left' => '0', 'top' => '0', 'width' => 'document.body.clientWidth-4', 'height' => 'document.body.clientHeight-4'), - 'Toolbar' => array('left' => 'document.body.clientWidth-2-toolbar.clientWidth-24-3+7', 'top' => '52'), - 'FieldsList' => array('left' => '4+toolbar.clientWidth+24', 'top' => 'getAbsoluteTop(document.getElementById("dynaformEditor[0]"))', 'width' => 244, 'height' => 400) - ); - public $panelConf = array('style' => array('title' => array('textAlign' => 'center')), - 'width' => 700, 'height' => 600, 'tabWidth' => 120, 'modal' => true, 'drag' => false, 'resize' => false, 'blinkToFront' => false - ); - - /** - * Constructor of the class dynaformEditor - * - * @param string $get - * @return void - */ - public function dynaformEditor($get) - { - $this->panelConf = array_merge($this->panelConf, $this->defaultConfig['Editor']); - //'title' => G::LoadTranslation('ID_DYNAFORM_EDITOR').' - ['.$this->title.']', - } - - /** - * Create the xml form default - * - * @param string $filename - * @return void - */ - public function _createDefaultXmlForm($fileName) - { - //Create the default Dynaform - $sampleForm = '' . "\n"; - $sampleForm .= '' . "\n"; - switch ($this->dyn_type) { - case "xmlform": - /* $sampleForm.='' . "\n" . - ' <en>Sample form</en>' . "\n" . - ''."\n"; - $sampleForm.='' . "\n" . - ' Submit' . "\n" . - ''."\n"; */ - break; - case "grid": - /* $sampleForm.='' . "\n" . - 'A' . "\n" . - ''."\n"; - $sampleForm.='' . "\n" . - 'B' . "\n" . - ''."\n"; */ - break; - } - $sampleForm .= ''; - G::verifyPath(dirname($fileName), true); - $fp = fopen($fileName, 'w'); - $sampleForm = str_replace('name=""', 'name="' . $this->_getFilename($this->file) . '"', $sampleForm); - fwrite($fp, $sampleForm); - fclose($fp); - } - - /** - * Prints the DynaformEditor - * - * @return void - */ - public function _render() - { - global $G_PUBLISH; - $script = ''; - - /* Start Block: Load (Create if doesn't exist) the xmlform */ - $Parameters = array('SYS_LANG' => SYS_LANG, 'URL' => G::encrypt($this->file, URL_KEY), 'DYN_UID' => $this->dyn_uid, 'PRO_UID' => $this->pro_uid, 'DYNAFORM_NAME' => $this->dyn_title, 'FILE' => $this->file, 'DYN_EDITOR' => $this->dyn_editor - ); - $_SESSION['Current_Dynafom']['Parameters'] = $Parameters; - - $XmlEditor = array('URL' => G::encrypt($this->file, URL_KEY), 'XML' => '' //$openDoc->getXml() - ); - $JSEditor = array('URL' => G::encrypt($this->file, URL_KEY) - ); - - $A = G::encrypt($this->file, URL_KEY); - - try { - $openDoc = new Xml_Document(); - $fileName = $this->home . $this->file . '.xml'; - if (file_exists($fileName)) { - $openDoc->parseXmlFile($fileName); - } else { - $this->_createDefaultXmlForm($fileName); - $openDoc->parseXmlFile($fileName); - } - //$form = new Form( $this->file , $this->home, SYS_LANG, true ); - $Properties = dynaformEditorAjax::get_properties($A, $this->dyn_uid); - /* Start Block: Prepare the XMLDB connection */ - define('DB_XMLDB_HOST', PATH_DYNAFORM . $this->file . '.xml'); - define('DB_XMLDB_USER', ''); - define('DB_XMLDB_PASS', ''); - define('DB_XMLDB_NAME', ''); - define('DB_XMLDB_TYPE', 'myxml'); - /* Start Block: Prepare the dynaformEditor */ - $G_PUBLISH = new Publisher(); - $sName = 'dynaformEditor'; - $G_PUBLISH->publisherId = $sName; - $oHeadPublisher = & headPublisher::getSingleton(); - $oHeadPublisher->setTitle(G::LoadTranslation('ID_DYNAFORM_EDITOR') . ' - ' . $Properties['DYN_TITLE']); - $G_PUBLISH->AddContent('blank'); - $this->panelConf['title'] = ''; - $G_PUBLISH->AddContent('panel-init', 'mainPanel', $this->panelConf); - if ($Properties['DYN_TYPE'] == 'xmlform') { - $G_PUBLISH->AddContent('xmlform', 'toolbar', 'dynaforms/fields_Toolbar', 'display:none', $Parameters, '', ''); - } else { - $G_PUBLISH->AddContent('xmlform', 'toolbar', 'dynaforms/fields_ToolbarGrid', 'display:none', $Parameters, '', ''); - } - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_Editor', 'display:none', $Parameters, '', ''); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_XmlEditor', 'display:none', $XmlEditor, '', ''); - $G_PUBLISH->AddContent('blank'); - $i = 0; - $aFields = array(); - $aFields[] = array('XMLNODE_NAME' => 'char', 'TYPE' => 'char', 'UP' => 'char', 'DOWN' => 'char' - ); - $oSession = new DBSession(new DBConnection(PATH_DYNAFORM . $this->file . '.xml', '', '', '', 'myxml')); - $oDataset = $oSession->Execute('SELECT * FROM dynaForm WHERE NOT( XMLNODE_NAME = "" ) AND TYPE <> "pmconnection"'); - $iMaximun = $oDataset->count(); - while ($aRow = $oDataset->Read()) { - $aFields[] = array('XMLNODE_NAME' => $aRow['XMLNODE_NAME'], 'TYPE' => $aRow['TYPE'], 'UP' => ($i > 0 ? G::LoadTranslation('ID_UP') : ''), 'DOWN' => ($i < $iMaximun - 1 ? G::LoadTranslation('ID_DOWN') : ''), 'row__' => ($i + 1) - ); - $i++; - break; - } - global $_DBArray; - $_DBArray['fields'] = $aFields; - $_SESSION['_DBArray'] = $_DBArray; - $oCriteria = new Criteria('dbarray'); - $oCriteria->setDBArrayTable('fields'); - /** - * *@Erik-> this is deprecated,. - * (unuseful) $G_PUBLISH->AddContent('propeltable', 'paged-table', 'dynaforms/fields_List', $oCriteria, $Parameters, '', SYS_URI.'dynaforms/dynaforms_PagedTableAjax');** - */ - $G_PUBLISH->AddContent('blank'); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_JSEditor', 'display:none', $JSEditor, '', ''); - } catch (Exception $e) { - - } - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_Properties', 'display:none', $Properties, '', ''); - //for showHide tab option @Neyek - $G_PUBLISH->AddContent('blank'); - $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_PREVIEW"), $sName . '[3]', 'dynaformEditor.changeToPreview', 'dynaformEditor.saveCurrentView'); - $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_XML"), $sName . '[4]', 'dynaformEditor.changeToXmlCode', 'dynaformEditor.saveCurrentView'); - if ($Properties['DYN_TYPE'] != 'grid') { - $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_HTML"), $sName . '[5]', 'dynaformEditor.changeToHtmlCode', 'dynaformEditor.saveCurrentView'); - } - $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_FIELDS_LIST"), $sName . '[6]', 'dynaformEditor.changeToFieldsList', 'dynaformEditor.saveCurrentView'); - if ($Properties["DYN_TYPE"] != "grid") { - $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_JAVASCRIPTS"), $sName . '[7]', 'dynaformEditor.changeToJavascripts', 'dynaformEditor.saveCurrentView'); - } - $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_PROPERTIES"), $sName . '[8]', 'dynaformEditor.changeToProperties', 'dynaformEditor.saveCurrentView'); - - //for showHide tab option @Neyek - if ($Properties["DYN_TYPE"] != "grid") { - $G_PUBLISH->AddContent("panel-tab", G::LoadTranslation("ID_CONDITIONS_EDITOR"), $sName . "[9]", "dynaformEditor.changeToShowHide", "dynaformEditor.saveShowHide"); - } - - $G_PUBLISH->AddContent('panel-close'); - $oHeadPublisher->addScriptFile("/js/maborak/core/maborak.loader.js",2); - $oHeadPublisher->addScriptFile('/jscore/dynaformEditor/core/dynaformEditor.js'); - - $oHeadPublisher->addScriptFile('/js/codemirrorOld/js/codemirror.js',1); - - $oHeadPublisher->addScriptFile('/js/grid/core/grid.js'); - $oHeadPublisher->addScriptCode(' - var DYNAFORM_URL="' . $Parameters['URL'] . '"; - leimnud.event.add(window,"load",function(){ loadEditor(); }); - '); - $oHeadPublisher->addScriptCode(' var jsMeta;var __usernameLoggedDE__ = "' . (isset($_SESSION['USR_USERNAME']) ? $_SESSION['USR_USERNAME'] : '') . '";var SYS_LANG = "' . SYS_LANG . '";var __DYN_UID__ = "' . $this->dyn_uid . '";'); - - $arrayParameterAux = $Parameters; - $arrayParameterAux["DYNAFORM_NAME"] = base64_encode($arrayParameterAux["DYNAFORM_NAME"]); - $oHeadPublisher->addScriptCode('var dynaformEditorParams = \'' . serialize($arrayParameterAux) . '\';'); - - G::RenderPage("publish", 'blank'); - } - - /** - * Get the filename - * - * @param string $file - * @return string - */ - public function _getFilename($file) - { - return (strcasecmp(substr($file, - 5), '_tmp0') == 0) ? substr($file, 0, strlen($file) - 5) : $file; - } - - /** - * Set the temporal copy - * - * @param string $onOff - * @return void - */ - public function _setUseTemporalCopy($onOff) - { - $file = self::_getFilename($this->file); - if ($onOff) { - $this->file = $file . '_tmp0'; - self::_setTmpData(array('useTmpCopy' => true )); - if (!file_exists(PATH_DYNAFORM . $file . '.xml')) { - $this->_createDefaultXmlForm(PATH_DYNAFORM . $file . '.xml'); - } - //Creates a copy if it doesn't exist, else, use the old copy - if (!file_exists(PATH_DYNAFORM . $this->file . '.xml')) { - self::_copyFile(PATH_DYNAFORM . $file . '.xml', PATH_DYNAFORM . $this->file . '.xml'); - } - if (!file_exists(PATH_DYNAFORM . $this->file . '.html') && file_exists(PATH_DYNAFORM . $file . '.html')) { - self::_copyFile(PATH_DYNAFORM . $file . '.html', PATH_DYNAFORM . $this->file . '.html'); - } - } else { - $this->file = $file; - self::_setTmpData(array()); - } - } - - /** - * Set temporal data - * - * @param $data - * @return void - */ - public function _setTmpData($data) - { - G::verifyPath(PATH_C . 'dynEditor/', true); - $fp = fopen(PATH_C . 'dynEditor/' . session_id() . '.php', 'w'); - fwrite($fp, '$tmpData=unserialize(\'' . addcslashes(serialize($data), '\\\'') . '\');'); - fclose($fp); - } - - /** - * Get temporal data - * - * @param string $filename - * @return array - */ - public function _getTmpData() - { - $tmpData = array(); - $file = PATH_C . 'dynEditor/' . session_id() . '.php'; - if (file_exists($file)) { - eval(implode('', file($file))); - } - return $tmpData; - } - - /** - * Copy files - * - * @param file $from - * @param file $to - * @return void - */ - public function _copyFile($from, $to) - { - $copy = implode('', file($from)); - $fcopy = fopen($to, "w"); - fwrite($fcopy, $copy); - fclose($fcopy); - } -} - -interface iDynaformEditorAjax -{ - //public function render_preview($A); -} - + * Dynaform - Dynaform /** * DynaformEditorAjax - DynaformEditorAjax class * * @package workflow.engine.classes - */ -class dynaformEditorAjax extends dynaformEditor implements iDynaformEditorAjax + */class dynaformEditorAjax extends dynaformEditor implements iDynaformEditorAjax { /** diff --git a/workflow/engine/classes/class.enterprise.php b/workflow/engine/classes/EnterpriseClass.php similarity index 96% rename from workflow/engine/classes/class.enterprise.php rename to workflow/engine/classes/EnterpriseClass.php index 4d4615944..8ca368274 100644 --- a/workflow/engine/classes/class.enterprise.php +++ b/workflow/engine/classes/EnterpriseClass.php @@ -1,5 +1,4 @@ featureName = $featureName; + $this->description = $description; + } +} diff --git a/workflow/engine/classes/class.fieldValidator.php b/workflow/engine/classes/FieldValidator.php similarity index 100% rename from workflow/engine/classes/class.fieldValidator.php rename to workflow/engine/classes/FieldValidator.php index 4ab9462aa..de01411ae 100644 --- a/workflow/engine/classes/class.fieldValidator.php +++ b/workflow/engine/classes/FieldValidator.php @@ -1,4 +1,5 @@ . + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + * + */class FileCache { function __construct ($dir) { @@ -122,4 +147,3 @@ class FileCache return null; } } - diff --git a/workflow/engine/classes/class.formBatchRouting.php b/workflow/engine/classes/FormBatchRouting.php similarity index 100% rename from workflow/engine/classes/class.formBatchRouting.php rename to workflow/engine/classes/FormBatchRouting.php index 938ea0dfa..bfbbc6546 100644 --- a/workflow/engine/classes/class.formBatchRouting.php +++ b/workflow/engine/classes/FormBatchRouting.php @@ -1,4 +1,5 @@ getMessage(), Propel::LOG_ERR ); - } -} else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'classes/model/map/ApplicationMapBuilder.php'; - Propel::registerMapBuilder( 'classes.model.map.ApplicationMapBuilder' ); -} diff --git a/workflow/engine/classes/Gzip_File.php b/workflow/engine/classes/Gzip_File.php new file mode 100644 index 000000000..0bb6821d0 --- /dev/null +++ b/workflow/engine/classes/Gzip_File.php @@ -0,0 +1,79 @@ +tar_file( $name ); + $this->options['type'] = "gzip"; + } + + /** + * This function is employed to create files . + * gzip + * + * @return boolean + */ + public function create_gzip () + { + if ($this->options['inmemory'] == 0) { + $pwd = getcwd(); + chdir( $this->options['basedir'] ); + if ($fp = gzopen( $this->options['name'], "wb{$this->options['level']}" )) { + fseek( $this->archive, 0 ); + while ($temp = fread( $this->archive, 1048576 )) { + gzwrite( $fp, $temp ); + } + gzclose( $fp ); + chdir( $pwd ); + } else { + $this->error[] = "Could not open {$this->options['name']} for writing."; + chdir( $pwd ); + return 0; + } + } else { + $this->archive = gzencode( $this->archive, $this->options['level'] ); + } + return 1; + } + + /** + * This function open a archive of the class gzip_file + * + * @return void + */ + public function open_archive () + { + return @gzopen( $this->options['name'], "rb" ); + } +} diff --git a/workflow/engine/classes/IDynaformEditorAjax.php b/workflow/engine/classes/IDynaformEditorAjax.php new file mode 100644 index 000000000..5b09510ac --- /dev/null +++ b/workflow/engine/classes/IDynaformEditorAjax.php @@ -0,0 +1,6 @@ +. + * + * For more information, contact Colosa Inc, 5304 Ventura Drive, + * Delray Beach, FL, 33484, USA, or email info@colosa.com. + * + */ + +require_once "classes/model/Application.php"; +require_once "classes/model/AppDelegation.php"; +require_once "classes/model/AppThread.php"; +require_once "classes/model/Content.php"; +require_once "classes/model/Users.php"; +require_once "classes/model/GroupUser.php"; +require_once "classes/model/Task.php"; +require_once "classes/model/TaskUser.php"; +require_once "classes/model/Dynaform.php"; +require_once "classes/model/ProcessVariables.php"; +require_once "entities/SolrRequestData.php"; +require_once "entities/SolrUpdateDocument.php"; +require_once "entities/AppSolrQueue.php"; +require_once "classes/model/AppSolrQueue.php"; + + +/** + * Invalid search text for Solr exception + * + * @author Herbert Saal Gutierrez + * + */ + +/** + * Invalid search text for Solr exception + * + * @author Herbert Saal Gutierrez + * + */class InvalidIndexSearchTextException extends Exception +{ + // Redefine the exception so message isn't optional + public function __construct($message, $code = 0) + { + // some code + // make sure everything is assigned properly + parent::__construct ($message, $code); + } + + // custom string representation of object + public function __toString() + { + return __CLASS__ . ": [{$this->code}]: {$this->message}\n"; + } +} diff --git a/workflow/engine/classes/class.javaBridgePM.php b/workflow/engine/classes/JavaBridgePM.php similarity index 98% rename from workflow/engine/classes/class.javaBridgePM.php rename to workflow/engine/classes/JavaBridgePM.php index 11c6f95b7..8dc58c7c8 100644 --- a/workflow/engine/classes/class.javaBridgePM.php +++ b/workflow/engine/classes/JavaBridgePM.php @@ -38,7 +38,11 @@ if (! defined( 'JAVA_BRIDGE_HOST' )) { * * @package workflow.engine.classes */ -class JavaBridgePM + +/** + * + * @package workflow.engine.classes + */class JavaBridgePM { public $JavaBridgeDir = JAVA_BRIDGE_PATH; public $JavaBridgePort = JAVA_BRIDGE_PORT; @@ -174,4 +178,3 @@ class JavaBridgePM printf( "saved %s bytes in file %s \n", $iSize, $reportFilename ); } } - diff --git a/workflow/engine/classes/class.labelsGmail.php b/workflow/engine/classes/LabelsGmail.php similarity index 99% rename from workflow/engine/classes/class.labelsGmail.php rename to workflow/engine/classes/LabelsGmail.php index f77f796a3..9be041eea 100644 --- a/workflow/engine/classes/class.labelsGmail.php +++ b/workflow/engine/classes/LabelsGmail.php @@ -1,5 +1,6 @@ + * @history--------------------------------------------- + * see CHANGELOG + */class license_application extends padl { /** * The number of allowed differences between the $_SERVER vars and the vars @@ -513,4 +539,3 @@ class license_application extends padl return (empty($data['RESULT'])) ? 'SOCKET_FAILED' : $data['RESULT']; } } - diff --git a/workflow/engine/classes/class.multipleFilesBackup.php b/workflow/engine/classes/MultipleFilesBackup.php similarity index 95% rename from workflow/engine/classes/class.multipleFilesBackup.php rename to workflow/engine/classes/MultipleFilesBackup.php index 0abedf4c2..6f32655fd 100644 --- a/workflow/engine/classes/class.multipleFilesBackup.php +++ b/workflow/engine/classes/MultipleFilesBackup.php @@ -6,7 +6,13 @@ * * Exports the database and copies the files to an tar archive o several if the max filesize is reached. */ -class multipleFilesBackup + +/** + * Class MultipleFilesBackup + * create a backup of this workspace + * + * Exports the database and copies the files to an tar archive o several if the max filesize is reached. + */class multipleFilesBackup { private $dir_to_compress = ""; private $filename = "backUpProcessMaker.tar"; @@ -228,4 +234,3 @@ class multipleFilesBackup CLI::logging( CLI::info( "Done restoring" ) . "\n" ); } } - diff --git a/workflow/engine/classes/class.net.php b/workflow/engine/classes/NET.php similarity index 99% rename from workflow/engine/classes/class.net.php rename to workflow/engine/classes/NET.php index 1644b1801..8eb66b376 100644 --- a/workflow/engine/classes/class.net.php +++ b/workflow/engine/classes/NET.php @@ -9,7 +9,11 @@ * @package workflow.engine.classes */ -class NET + +/** + * + * @package workflow.engine.classes + */class NET { public $hostname; public $ip; @@ -578,17 +582,3 @@ class NET return $this->errstr; } } - -/** - * - * @package workflow.engine.classes - */ -class Stat -{ - public $stutus; - - public function __construct () - { - $this->status = false; - } -} diff --git a/workflow/engine/classes/ObjectCellection.php b/workflow/engine/classes/ObjectCellection.php new file mode 100644 index 000000000..bfa322df8 --- /dev/null +++ b/workflow/engine/classes/ObjectCellection.php @@ -0,0 +1,91 @@ +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + + +/** + * ObjectDocument Collection + * + * @package workflow.engine.ProcessMaker + */class ObjectCellection +{ + public $num; + public $swapc; + public $objects; + + /** + * Constructor + */ + public function __construct() + { + $this->objects = Array(); + $this->num = 0; + $this->swapc = $this->num; + array_push($this->objects, 'void'); + } + + /** + * add in the collecetion a new object Document + * + * @param $name name object document + * @param $type type object document + * @param $data data object document + * @param $origin origin object document + * @return void + */ + public function add($name, $type, $data, $origin) + { + $o = new ObjectDocument(); + $o->name = $name; + $o->type = $type; + $o->data = $data; + $o->origin = $origin; + + $this->num++; + array_push($this->objects, $o); + $this->swapc = $this->num; + } + + /** + * get the collection of ObjectDocument + * + * @param $name name object document + * @param $type type object document + * @param $data data object document + * @param $origin origin object document + * @return void + */ + public function get() + { + if ($this->swapc > 0) { + $e = $this->objects[$this->swapc]; + $this->swapc--; + return $e; + } else { + $this->swapc = $this->num; + return false; + } + } +} diff --git a/workflow/engine/classes/ObjectDocument.php b/workflow/engine/classes/ObjectDocument.php new file mode 100644 index 000000000..2723bcab2 --- /dev/null +++ b/workflow/engine/classes/ObjectDocument.php @@ -0,0 +1,49 @@ +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + + +/** + * Object Document class + * + * @package workflow.engine.ProcessMaker + */class ObjectDocument +{ + public $type; + public $name; + public $data; + public $origin; + + /** + * Constructor + */ + public function __construct() + { + $this->type = ''; + $this->name = ''; + $this->data = ''; + $this->origin = ''; + } +} diff --git a/workflow/engine/classes/class.patch.php b/workflow/engine/classes/P11835.php similarity index 94% rename from workflow/engine/classes/class.patch.php rename to workflow/engine/classes/P11835.php index 4976a0535..d4a8dad1a 100644 --- a/workflow/engine/classes/class.patch.php +++ b/workflow/engine/classes/P11835.php @@ -6,14 +6,7 @@ * */ -abstract class patch -{ - static protected $isPathchable = false; - static public $dbAdapter = 'mysql'; - abstract static public function isApplicable(); - abstract static public function execute(); -} - +abstract class p11835 extends patch { /* @@ -116,4 +109,3 @@ class p11835 extends patch echo $count . " records where patched to use SELF_SERVICE feature.\n"; } } - diff --git a/workflow/engine/classes/class.pmDashlet.php b/workflow/engine/classes/PMDashlet.php similarity index 99% rename from workflow/engine/classes/class.pmDashlet.php rename to workflow/engine/classes/PMDashlet.php index fdaf5d295..ebbfdebfa 100644 --- a/workflow/engine/classes/class.pmDashlet.php +++ b/workflow/engine/classes/PMDashlet.php @@ -2,10 +2,11 @@ use ProcessMaker\Plugins\PluginRegistry; -require_once 'classes/interfaces/dashletInterface.php'; +require_once 'classes/interfaces/DashletInterface.php'; require_once 'classes/model/Dashlet.php'; require_once 'classes/model/DashletInstance.php'; + class PMDashlet extends DashletInstance implements DashletInterface { diff --git a/workflow/engine/classes/class.pmDrive.php b/workflow/engine/classes/PMDrive.php similarity index 98% rename from workflow/engine/classes/class.pmDrive.php rename to workflow/engine/classes/PMDrive.php index 7966ea6e7..8ba11cd1e 100644 --- a/workflow/engine/classes/class.pmDrive.php +++ b/workflow/engine/classes/PMDrive.php @@ -1,13 +1,15 @@ featureName = $featureName; - $this->description = $description; - } -} - class PMLicensedFeatures { diff --git a/workflow/engine/classes/class.pluginRegistry.php b/workflow/engine/classes/PMPluginRegistry.php similarity index 97% rename from workflow/engine/classes/class.pluginRegistry.php rename to workflow/engine/classes/PMPluginRegistry.php index 675f4f535..5197975a6 100644 --- a/workflow/engine/classes/class.pluginRegistry.php +++ b/workflow/engine/classes/PMPluginRegistry.php @@ -35,57 +35,11 @@ use ProcessMaker\Plugins\PluginRegistry; require_once 'class.plugin.php'; -class pluginDetail -{ - public $sNamespace; - public $sClassName; - public $sFriendlyName = null; - public $sDescription = null; - public $sSetupPage = null; - public $sFilename; - public $sPluginFolder = ''; - public $sCompanyLogo = ''; - public $iVersion = 0; - public $enabled = false; - public $aWorkspaces = null; - public $bPrivate = false; - - /** - * This function is the constructor of the pluginDetail class - * - * @param string $sNamespace - * @param string $sClassName - * @param string $sFilename - * @param string $sFriendlyName - * @param string $sPluginFolder - * @param string $sDescription - * @param string $sSetupPage - * @param integer $iVersion - * @return void - */ - public function __construct ($sNamespace, $sClassName, $sFilename, $sFriendlyName = '', $sPluginFolder = '', $sDescription = '', $sSetupPage = '', $iVersion = 0) - { - $this->sNamespace = $sNamespace; - $this->sClassName = $sClassName; - $this->sFriendlyName = $sFriendlyName; - $this->sDescription = $sDescription; - $this->sSetupPage = $sSetupPage; - $this->iVersion = $iVersion; - $this->sFilename = $sFilename; - if ($sPluginFolder == '') { - $this->sPluginFolder = $sNamespace; - } else { - $this->sPluginFolder = $sPluginFolder; - } - } -} /** * * @package workflow.engine.classes - */ - -class PMPluginRegistry + */class PMPluginRegistry { private $_aPluginDetails = array (); private $_aPlugins = array (); diff --git a/workflow/engine/classes/class.memcached.php b/workflow/engine/classes/PMmemcached.php similarity index 98% rename from workflow/engine/classes/class.memcached.php rename to workflow/engine/classes/PMmemcached.php index 3a5bbfcd4..9b34ed7d8 100644 --- a/workflow/engine/classes/class.memcached.php +++ b/workflow/engine/classes/PMmemcached.php @@ -25,13 +25,13 @@ * */ +/** + * The ProcessMaker memcached /** * The ProcessMaker memcached class * * @package workflow.engine.ProcessMaker - */ - -class PMmemcached + */class PMmemcached { const ONE_MINUTE = 60; const ONE_HOUR = 3600; @@ -65,7 +65,6 @@ class PMmemcached $this->version = $this->mem->getVersion(); } } else { - require_once ("classes" . PATH_SEP . "class.fileCache.php"); //Create cache folder $cacheFolder = PATH_DATA . "sites". PATH_SEP . $workspace . PATH_SEP . "cachefiles" . PATH_SEP; @@ -218,4 +217,3 @@ class PMmemcached echo ""; } } - diff --git a/workflow/engine/classes/class.license.lib.php b/workflow/engine/classes/Padl.php similarity index 95% rename from workflow/engine/classes/class.license.lib.php rename to workflow/engine/classes/Padl.php index 8ae5a9be0..dfa760ebd 100644 --- a/workflow/engine/classes/class.license.lib.php +++ b/workflow/engine/classes/Padl.php @@ -26,7 +26,34 @@ * @history--------------------------------------------- * see CHANGELOG */ -class padl + +/** + * Project: Distrubution License Class + * File: class.license.lib.php + * + * Copyright (C) 2005 Oliver Lillie + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * 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 GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * @link http://www.buggedcom.co.uk/ + * @link http://www.phpclasses.org/browse/package/2298.html + * @author Oliver Lillie, buggedcom + * @version 0.1 + * @history--------------------------------------------- + * see CHANGELOG + */class padl { /** * hash key 1 used to encrypt the generate key data. @@ -673,32 +700,3 @@ class padl } } } - -/** - * custom functions to aid in debugging - * - * @var mixed - */ -function trace() -{ - $message = ''; - for ($i = 0; $i < func_num_args(); $i++) { - if (is_array(func_get_arg($i))) { - trace_r(func_get_arg($i)); - } else { - $message .= func_get_arg($i); - } - if ($i <= func_num_args() - 2) { - $message.=' : '; - } - } - echo "
\r\r" . $message . "\r\r"; -} - -function trace_r($array = "array is empty") -{ - echo "
\r\r";
-    print_r($array);
-    echo "\r\r
"; -} - diff --git a/workflow/engine/classes/Patch.php b/workflow/engine/classes/Patch.php new file mode 100644 index 000000000..597a1cf02 --- /dev/null +++ b/workflow/engine/classes/Patch.php @@ -0,0 +1,19 @@ +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +use ProcessMaker\Plugins\PluginRegistry; + +/** + * + * @package workflow.engine.classes + */ + +require_once 'class.plugin.php'; + + + +/** + * + * @package workflow.engine.classes + */class pluginDetail +{ + public $sNamespace; + public $sClassName; + public $sFriendlyName = null; + public $sDescription = null; + public $sSetupPage = null; + public $sFilename; + public $sPluginFolder = ''; + public $sCompanyLogo = ''; + public $iVersion = 0; + public $enabled = false; + public $aWorkspaces = null; + public $bPrivate = false; + + /** + * This function is the constructor of the pluginDetail class + * + * @param string $sNamespace + * @param string $sClassName + * @param string $sFilename + * @param string $sFriendlyName + * @param string $sPluginFolder + * @param string $sDescription + * @param string $sSetupPage + * @param integer $iVersion + * @return void + */ + public function __construct ($sNamespace, $sClassName, $sFilename, $sFriendlyName = '', $sPluginFolder = '', $sDescription = '', $sSetupPage = '', $iVersion = 0) + { + $this->sNamespace = $sNamespace; + $this->sClassName = $sClassName; + $this->sFriendlyName = $sFriendlyName; + $this->sDescription = $sDescription; + $this->sSetupPage = $sSetupPage; + $this->iVersion = $iVersion; + $this->sFilename = $sFilename; + if ($sPluginFolder == '') { + $this->sPluginFolder = $sNamespace; + } else { + $this->sPluginFolder = $sPluginFolder; + } + } +} diff --git a/workflow/engine/classes/class.pmDynaform.php b/workflow/engine/classes/PmDynaform.php similarity index 99% rename from workflow/engine/classes/class.pmDynaform.php rename to workflow/engine/classes/PmDynaform.php index 3bc58a7ae..c103ba8d2 100644 --- a/workflow/engine/classes/class.pmDynaform.php +++ b/workflow/engine/classes/PmDynaform.php @@ -7,7 +7,14 @@ * @author Roly Rudy Gutierrez Pinto * @package engine.classes */ -class pmDynaform + +/** + * class.pmDynaform.php + * Implementing pmDynaform library in the running case. + * + * @author Roly Rudy Gutierrez Pinto + * @package engine.classes + */class pmDynaform { public static $instance = null; diff --git a/workflow/engine/classes/class.pmGauge.php b/workflow/engine/classes/PmGauge.php similarity index 100% rename from workflow/engine/classes/class.pmGauge.php rename to workflow/engine/classes/PmGauge.php index 6c09d84ed..c059188b6 100644 --- a/workflow/engine/classes/class.pmGauge.php +++ b/workflow/engine/classes/PmGauge.php @@ -1,5 +1,6 @@ serial, file_get_contents(PATH_PLUGINS . 'enterprise/data/default'))); } } - diff --git a/workflow/engine/classes/class.pmPhing.php b/workflow/engine/classes/PmPhing.php similarity index 100% rename from workflow/engine/classes/class.pmPhing.php rename to workflow/engine/classes/PmPhing.php index 4f482e27a..20592272f 100644 --- a/workflow/engine/classes/class.pmPhing.php +++ b/workflow/engine/classes/PmPhing.php @@ -38,6 +38,7 @@ if (! class_exists( 'Phing' )) { throw new Exception( 'Fatal Error: Phing is not loaded!' ); } + class pmPhing extends Phing { @@ -46,4 +47,3 @@ class pmPhing extends Phing return 'pmPhing Ver 1.0'; } } - diff --git a/workflow/engine/classes/class.pmSso.php b/workflow/engine/classes/PmSsoClass.php similarity index 96% rename from workflow/engine/classes/class.pmSso.php rename to workflow/engine/classes/PmSsoClass.php index 19bda3a51..b76080080 100644 --- a/workflow/engine/classes/class.pmSso.php +++ b/workflow/engine/classes/PmSsoClass.php @@ -4,7 +4,11 @@ * */ - class pmSsoClass extends PMPlugin { + +/** + * class.pmSso.php + * + */ class pmSsoClass extends PMPlugin { function __construct() { } @@ -63,4 +67,3 @@ return $res; } } -?> \ No newline at end of file diff --git a/workflow/engine/classes/class.popupMenu.php b/workflow/engine/classes/PopupMenu.php similarity index 81% rename from workflow/engine/classes/class.popupMenu.php rename to workflow/engine/classes/PopupMenu.php index 7739ddc89..e0e97adb2 100644 --- a/workflow/engine/classes/class.popupMenu.php +++ b/workflow/engine/classes/PopupMenu.php @@ -26,14 +26,14 @@ * */ +/** + * popupMenu - popupMenu /** * popupMenu - popupMenu class * * @package workflow.engine.ProcessMaker * @copyright COLOSA - */ - -class popupMenu extends form + */class popupMenu extends form { var $type = 'popupMenu'; var $theme = 'processmaker'; @@ -73,27 +73,3 @@ class popupMenu extends form return $sc; } } - -/** - * XmlForm_Field_popupOption - XmlForm_Field_popupOption class - * - * @package workflow.engine.ProcessMaker - * @copyright COLOSA - */ - -class XmlForm_Field_popupOption extends XmlForm_Field -{ - var $launch = ''; - - /** - * Get Events - * - * @return string - */ - function getEvents () - { - $script = '{name:"' . $this->name . '",text:"' . addcslashes( $this->label, '\\"' ) . '", launch:leimnud.closure({Function:function(target){' . $this->launch . '}, args:target})}'; - return $script; - } -} - diff --git a/workflow/engine/classes/class.processes.php b/workflow/engine/classes/Processes.php similarity index 99% rename from workflow/engine/classes/class.processes.php rename to workflow/engine/classes/Processes.php index 8b4e1281a..8f8646aae 100644 --- a/workflow/engine/classes/class.processes.php +++ b/workflow/engine/classes/Processes.php @@ -24,7 +24,31 @@ * Coral Gables, FL, 33134, USA, or email info@colosa.com. */ -class Processes + +/** + * class.processes.php + * + * @package workflow.engine.ProcessMaker + * + * 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 + * License, or (at your option) any later version. + * + * 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 + * 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 . + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */class Processes { /** @@ -6183,96 +6207,3 @@ class Processes return $proTitle; } } - -//end class processes - - -/** - * Object Document class - * - * @package workflow.engine.ProcessMaker - */ -class ObjectDocument -{ - public $type; - public $name; - public $data; - public $origin; - - /** - * Constructor - */ - public function __construct() - { - $this->type = ''; - $this->name = ''; - $this->data = ''; - $this->origin = ''; - } -} - -/** - * ObjectDocument Collection - * - * @package workflow.engine.ProcessMaker - */ -class ObjectCellection -{ - public $num; - public $swapc; - public $objects; - - /** - * Constructor - */ - public function __construct() - { - $this->objects = Array(); - $this->num = 0; - $this->swapc = $this->num; - array_push($this->objects, 'void'); - } - - /** - * add in the collecetion a new object Document - * - * @param $name name object document - * @param $type type object document - * @param $data data object document - * @param $origin origin object document - * @return void - */ - public function add($name, $type, $data, $origin) - { - $o = new ObjectDocument(); - $o->name = $name; - $o->type = $type; - $o->data = $data; - $o->origin = $origin; - - $this->num++; - array_push($this->objects, $o); - $this->swapc = $this->num; - } - - /** - * get the collection of ObjectDocument - * - * @param $name name object document - * @param $type type object document - * @param $data data object document - * @param $origin origin object document - * @return void - */ - public function get() - { - if ($this->swapc > 0) { - $e = $this->objects[$this->swapc]; - $this->swapc--; - return $e; - } else { - $this->swapc = $this->num; - return false; - } - } -} diff --git a/workflow/engine/classes/class.propelTable.php b/workflow/engine/classes/PropelTable.php similarity index 97% rename from workflow/engine/classes/class.propelTable.php rename to workflow/engine/classes/PropelTable.php index 2dae0fa68..e0d751de9 100644 --- a/workflow/engine/classes/class.propelTable.php +++ b/workflow/engine/classes/PropelTable.php @@ -36,7 +36,15 @@ use ProcessMaker\Plugins\PluginRegistry; * dependencies TemplatePower Form XmlForm */ -class propelTable + +/** + * Class pagedTable + * + * @author David S. Callizaya S. * + * @access public + * @package workflow.gulliver.system + * dependencies TemplatePower Form XmlForm + */class propelTable { public $xmlFormFile; public $currentPage; @@ -910,4 +918,3 @@ class propelTable G::RenderPage( "publish", "blank" ); } } - diff --git a/workflow/engine/classes/class.replacementLogo.php b/workflow/engine/classes/ReplacementLogo.php similarity index 97% rename from workflow/engine/classes/class.replacementLogo.php rename to workflow/engine/classes/ReplacementLogo.php index fae2c5bf0..8c72ea09f 100644 --- a/workflow/engine/classes/class.replacementLogo.php +++ b/workflow/engine/classes/ReplacementLogo.php @@ -30,7 +30,11 @@ * @package workflow.engine.classes */ -class replacementLogo + +/** + * + * @package workflow.engine.classes + */class replacementLogo { //var $dir=''; @@ -109,4 +113,3 @@ class replacementLogo return ($ainfoLogo); } } - diff --git a/workflow/engine/classes/class.report.php b/workflow/engine/classes/Report.php similarity index 99% rename from workflow/engine/classes/class.report.php rename to workflow/engine/classes/Report.php index 9aafbe2fb..16606c2b7 100644 --- a/workflow/engine/classes/class.report.php +++ b/workflow/engine/classes/Report.php @@ -26,15 +26,15 @@ * */ +/** + * Report - Report /** * Report - Report class * * @package workflow.engine.ProcessMaker * @author Everth S. Berrios Morales * @copyright 2008 COLOSA - */ - -class Report + */class Report { /** @@ -852,4 +852,3 @@ class Report return; } } - diff --git a/workflow/engine/classes/class.reportTables.php b/workflow/engine/classes/ReportTables.php similarity index 99% rename from workflow/engine/classes/class.reportTables.php rename to workflow/engine/classes/ReportTables.php index 5674367f7..7a1c05864 100644 --- a/workflow/engine/classes/class.reportTables.php +++ b/workflow/engine/classes/ReportTables.php @@ -26,15 +26,15 @@ */ +/** + * ReportTables - Report tables /** * ReportTables - Report tables class * * @package workflow.engine.ProcessMaker * @author Julio Cesar Laura Avenda�o * @copyright 2007 COLOSA - */ - -class ReportTables + */class ReportTables { private $aDef = array ('mysql' => array ('number' => 'DOUBLE','char' => 'VARCHAR(255)','text' => 'TEXT','date' => 'DATETIME' ),'pgsql' => array ('number' => 'DOUBLE','char' => 'VARCHAR(255)','text' => 'TEXT','date' => 'DATETIME' @@ -844,4 +844,3 @@ class ReportTables return ($PropelDatabase); } } - diff --git a/workflow/engine/classes/class.serverConfiguration.php b/workflow/engine/classes/ServerConf.php similarity index 99% rename from workflow/engine/classes/class.serverConfiguration.php rename to workflow/engine/classes/ServerConf.php index 947c83a96..99faad879 100644 --- a/workflow/engine/classes/class.serverConfiguration.php +++ b/workflow/engine/classes/ServerConf.php @@ -25,6 +25,8 @@ * Coral Gables, FL, 33134, USA, or email info@colosa.com. */ +/** + * ServerConfiguration - serverConf /** * ServerConfiguration - serverConf class * @@ -32,8 +34,7 @@ * @copyright 2010 COLOSA * @license GNU Affero General Public License * @package workflow.engine.ProcessMaker - */ -class serverConf + */class serverConf { private $_aProperties = array(); @@ -110,7 +111,7 @@ class serverConf self::$instance = new serverConf(); } - if ($instance = @unserialize($serialized)) { + if ($instance = unserialize($serialized)) { self::$instance = $instance; } } diff --git a/workflow/engine/classes/class.sessions.php b/workflow/engine/classes/Sessions.php similarity index 99% rename from workflow/engine/classes/class.sessions.php rename to workflow/engine/classes/Sessions.php index 6cd403807..2a6f2b6d2 100644 --- a/workflow/engine/classes/class.sessions.php +++ b/workflow/engine/classes/Sessions.php @@ -26,15 +26,15 @@ */ require_once 'classes/model/Session.php'; +/** + * Sessions - Sessions /** * Sessions - Sessions class * * @package workflow.engine.ProcessMaker * @author Everth S. Berrios Morales * @copyright 2008 COLOSA - */ - -class Sessions + */class Sessions { protected $tmpfile; @@ -258,21 +258,3 @@ class Sessions } } - - - - - - - - - - - - - - - - - - diff --git a/workflow/engine/classes/class.spool.php b/workflow/engine/classes/SpoolRun.php similarity index 98% rename from workflow/engine/classes/class.spool.php rename to workflow/engine/classes/SpoolRun.php index 567dc7e09..5184c486c 100644 --- a/workflow/engine/classes/class.spool.php +++ b/workflow/engine/classes/SpoolRun.php @@ -39,21 +39,11 @@ * ========= * * 24-03-2010 Erik A.O. - * class: the $ExceptionCode and $aWarnings class attributes were added - * function handleFrom(): Validations for invalid data for {$this->fileData['from_email']} were added - * function resendEmails(): handler for warnings was added and fixes - * function getWarnings(): added - * function sendMail(): now is handling the exception - */ - -require_once ('classes/model/AppMessage.php'); - + * class: the $ExceptionCode and $aWarnings /** * * @package workflow.engine.ProcessMaker - */ - -class spoolRun + */class spoolRun { public $config; private $fileData; @@ -702,4 +692,3 @@ class spoolRun return $sUID; } } - diff --git a/workflow/engine/classes/Stat.php b/workflow/engine/classes/Stat.php new file mode 100644 index 000000000..7a825c847 --- /dev/null +++ b/workflow/engine/classes/Stat.php @@ -0,0 +1,24 @@ +status = false; + } +} diff --git a/workflow/engine/classes/Tar_File.php b/workflow/engine/classes/Tar_File.php new file mode 100644 index 000000000..d2d3b3c8c --- /dev/null +++ b/workflow/engine/classes/Tar_File.php @@ -0,0 +1,175 @@ +archive( $name ); + $this->options['type'] = "tar"; + } + + /** + * This function create a file . + * tar + * + * @return boolean + */ + public function create_tar () + { + $pwd = getcwd(); + chdir( $this->options['basedir'] ); + foreach ($this->files as $current) { + if ($current['name'] == $this->options['name']) { + continue; + } + if (strlen( $current['name2'] ) > 99) { + $path = substr( $current['name2'], 0, strpos( $current['name2'], "/", strlen( $current['name2'] ) - 100 ) + 1 ); + $current['name2'] = substr( $current['name2'], strlen( $path ) ); + if (strlen( $path ) > 154 || strlen( $current['name2'] ) > 99) { + $this->error[] = "Could not add {$path}{$current['name2']} to archive because the filename is too long."; + continue; + } + } + $block = pack( "a100a8a8a8a12a12a8a1a100a6a2a32a32a8a8a155a12", $current['name2'], sprintf( "%07o", $current['stat'][2] ), sprintf( "%07o", $current['stat'][4] ), sprintf( "%07o", $current['stat'][5] ), sprintf( "%011o", $current['type'] == 2 ? 0 : $current['stat'][7] ), sprintf( "%011o", $current['stat'][9] ), " ", $current['type'], $current['type'] == 2 ? @readlink( $current['name'] ) : "", "ustar ", " ", "Unknown", "Unknown", "", "", ! empty( $path ) ? $path : "", "" ); + $checksum = 0; + for ($i = 0; $i < 512; $i ++) { + $checksum += ord( substr( $block, $i, 1 ) ); + } + $checksum = pack( "a8", sprintf( "%07o", $checksum ) ); + $block = substr_replace( $block, $checksum, 148, 8 ); + if ($current['type'] == 2 || $current['stat'][7] == 0) { + $this->add_data( $block ); + } elseif ($fp = @fopen( $current['name'], "rb" )) { + $this->add_data( $block ); + while ($temp = fread( $fp, 1048576 )) { + $this->add_data( $temp ); + } + if ($current['stat'][7] % 512 > 0) { + $temp = ""; + for ($i = 0; $i < 512 - $current['stat'][7] % 512; $i ++) { + $temp .= "\0"; + } + $this->add_data( $temp ); + } + fclose( $fp ); + } else { + $this->error[] = "Could not open file {$current['name']} for reading. It was not added."; + } + } + $this->add_data( pack( "a1024", "" ) ); + chdir( $pwd ); + return 1; + } + + /** + * This function is used for extract files of the class tar_file + * + * @return void + */ + public function extract_files () + { + $pwd = getcwd(); + chdir( $this->options['basedir'] ); + if ($fp = $this->open_archive()) { + if ($this->options['inmemory'] == 1) { + $this->files = array (); + } + while ($block = fread( $fp, 512 )) { + $temp = unpack( "a100name/a8mode/a8uid/a8gid/a12size/a12mtime/a8checksum/a1type/a100symlink/a6magic/a2temp/a32temp/a32temp/a8temp/a8temp/a155prefix/a12temp", $block ); + $file = array ('name' => $this->options['basedir'] . '/' . $temp['prefix'] . $temp['name'],'stat' => array (2 => $temp['mode'],4 => octdec( $temp['uid'] ),5 => octdec( $temp['gid'] ),7 => octdec( $temp['size'] ),9 => octdec( $temp['mtime'] ) + ),'checksum' => octdec( $temp['checksum'] ),'type' => $temp['type'],'magic' => $temp['magic'] + ); + if ($file['checksum'] == 0x00000000) { + break; + } elseif (substr( $file['magic'], 0, 5 ) != "ustar") { + $this->error[] = "This script does not support extracting this type of tar file."; + break; + } + $block = substr_replace( $block, " ", 148, 8 ); + $checksum = 0; + for ($i = 0; $i < 512; $i ++) { + $checksum += ord( substr( $block, $i, 1 ) ); + } + if ($file['checksum'] != $checksum) { + $this->error[] = "Could not extract from {$this->options['name']}, it is corrupt."; + } + if ($this->options['inmemory'] == 1) { + $file['data'] = fread( $fp, $file['stat'][7] ); + fread( $fp, (512 - $file['stat'][7] % 512) == 512 ? 0 : (512 - $file['stat'][7] % 512) ); + unset( $file['checksum'], $file['magic'] ); + $this->files[] = $file; + } elseif ($file['type'] == 5) { + if (! is_dir( $file['name'] )) { + //mkdir($file['name'], $file['stat'][2]); + mkdir( $file['name'], 0775 ); + } + } elseif ($this->options['overwrite'] == 0 && file_exists( $file['name'] )) { + $this->error[] = "{$file['name']} already exist."; + continue; + } elseif ($file['type'] == 2) { + symlink( $temp['symlink'], $file['name'] ); + //chmod($file['name'], $file['stat'][2]); + } elseif ($new = @fopen( $file['name'], "wb" )) { + fwrite( $new, fread( $fp, $file['stat'][7] ) ); + if ((512 - $file['stat'][7] % 512) != 512) { + fread( $fp, (512 - $file['stat'][7] % 512) ); + } + //fread($fp, (512 - $file['stat'][7] % 512) == 512 ? 0 : (512 - $file['stat'][7] % 512)); + fclose( $new ); + //chmod($file['name'], $file['stat'][2]); + chmod( $file['name'], 0777 ); + $this->files[] = $file['name']; + } else { + $this->error[] = "Could not open {$file['name']} for writing."; + continue; + } + //chown($file['name'], $file['stat'][4]); + //chgrp($file['name'], $file['stat'][5]); + @touch( $file['name'], $file['stat'][9] ); + unset( $file ); + } + } else { + $this->error[] = "Could not open file {$this->options['name']}"; + } + chdir( $pwd ); + } + + /** + * This function open a archive of the class tar_file + * + * @return void + */ + public function open_archive () + { + return @fopen( $this->options['name'], "rb" ); + } +} diff --git a/workflow/engine/classes/class.tasks.php b/workflow/engine/classes/Tasks.php similarity index 99% rename from workflow/engine/classes/class.tasks.php rename to workflow/engine/classes/Tasks.php index b4f7220e5..01d442f08 100644 --- a/workflow/engine/classes/class.tasks.php +++ b/workflow/engine/classes/Tasks.php @@ -37,14 +37,15 @@ require_once 'classes/model/TaskUser.php'; require_once 'classes/model/Users.php'; require_once 'classes/model/Gateway.php'; +/** + * Tasks - Tasks /** * Tasks - Tasks class * * @package workflow.engine.ProcessMaker * @author Julio Cesar Laura Avenda�o * @copyright 2007 COLOSA - */ -class Tasks + */class Tasks { /** @@ -879,4 +880,3 @@ class Tasks } } } - diff --git a/workflow/engine/classes/ToolBar.php b/workflow/engine/classes/ToolBar.php new file mode 100644 index 000000000..fa339b7ac --- /dev/null +++ b/workflow/engine/classes/ToolBar.php @@ -0,0 +1,39 @@ +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + * + */ + +/** + * ToolBar - ToolBar +/** + * ToolBar - ToolBar class + * + * @package workflow.engine.ProcessMaker + */class ToolBar extends form +{ + public $type = 'toolbar'; + public $align = 'left'; +} diff --git a/workflow/engine/classes/class.triggerLibrary.php b/workflow/engine/classes/TriggerLibrary.php similarity index 96% rename from workflow/engine/classes/class.triggerLibrary.php rename to workflow/engine/classes/TriggerLibrary.php index b054b6ee4..e95f81d02 100644 --- a/workflow/engine/classes/class.triggerLibrary.php +++ b/workflow/engine/classes/TriggerLibrary.php @@ -3,17 +3,11 @@ * * @author Hugo Loza * - * This class Helps registering and implementing Wizard for Triggers - */ - -use ProcessMaker\Plugins\PluginRegistry; - + * This /** * * @package workflow.engine.ProcessMaker - */ - -class triggerLibrary + */class triggerLibrary { private $_aTriggerClasses_ = array (); @@ -166,5 +160,3 @@ class triggerLibrary //TODO - Insert your code here } } - -?> \ No newline at end of file diff --git a/workflow/engine/classes/class.Upgrade.php b/workflow/engine/classes/Upgrade.php similarity index 99% rename from workflow/engine/classes/class.Upgrade.php rename to workflow/engine/classes/Upgrade.php index 7d2df591e..8fa458057 100644 --- a/workflow/engine/classes/class.Upgrade.php +++ b/workflow/engine/classes/Upgrade.php @@ -19,6 +19,7 @@ function ls_dir($dir, $basename = null) return $files; } + class Upgrade { private $addon = null; diff --git a/workflow/engine/classes/class.wsTools.php b/workflow/engine/classes/WorkspaceTools.php similarity index 99% rename from workflow/engine/classes/class.wsTools.php rename to workflow/engine/classes/WorkspaceTools.php index 336610fa8..70fdc221e 100644 --- a/workflow/engine/classes/class.wsTools.php +++ b/workflow/engine/classes/WorkspaceTools.php @@ -3,14 +3,15 @@ use ProcessMaker\Util\FixReferencePath; use ProcessMaker\Plugins\Adapters\PluginAdapter; +/** + * /** * class workspaceTools. * * Utility functions to manage a workspace. * * @package workflow.engine.classes - */ -class workspaceTools + */class workspaceTools { public $name = null; public $path = null; diff --git a/workflow/engine/classes/class.wsBase.php b/workflow/engine/classes/WsBase.php similarity index 99% rename from workflow/engine/classes/class.wsBase.php rename to workflow/engine/classes/WsBase.php index 17ac90ea8..74b0bdebb 100644 --- a/workflow/engine/classes/class.wsBase.php +++ b/workflow/engine/classes/WsBase.php @@ -27,6 +27,12 @@ //It works with the table CONFIGURATION in a WF dataBase +/** + * Copyright (C) 2009 COLOSA + * License: LGPL, see LICENSE + * Last Modify: 26.06.2008 10:05:00 + * Last modify by: Erik Amaru Ortiz + * Last Modify comment(26.06.2008): the session expired verification was removed from here to soap /** * Copyright (C) 2009 COLOSA * License: LGPL, see LICENSE @@ -35,9 +41,7 @@ * Last Modify comment(26.06.2008): the session expired verification was removed from here to soap class * * @package workflow.engine.classes - */ - -class wsBase + */class wsBase { public $stored_system_variables; //boolean public $wsSessionId; //web service session id, if the wsbase function is used from a WS request diff --git a/workflow/engine/classes/WsCreateDepartmentResponse.php b/workflow/engine/classes/WsCreateDepartmentResponse.php new file mode 100644 index 000000000..d43e8cea0 --- /dev/null +++ b/workflow/engine/classes/WsCreateDepartmentResponse.php @@ -0,0 +1,61 @@ +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +/** + * + * @package workflow.engine.classes + */ + + +/** + * Class wsCreateDepartmentResponse + * + * @package workflow.engine.classes + */class wsCreateDepartmentResponse +{ + public $status_code = 0; + public $message = ''; + public $departmentUID = ''; + public $timestamp = ''; + + /** + * Function __construct + * Constructor of the class + * + * @param string $status + * @param string $message + * @param string $departmentUID + * @return void + */ + function __construct ($status, $message, $departmentUID) + { + $this->status_code = $status; + $this->message = $message; + $this->departmentUID = $departmentUID; + $this->timestamp = date( 'Y-m-d H:i:s' ); + } +} diff --git a/workflow/engine/classes/WsCreateGroupResponse.php b/workflow/engine/classes/WsCreateGroupResponse.php new file mode 100644 index 000000000..20dafc4d5 --- /dev/null +++ b/workflow/engine/classes/WsCreateGroupResponse.php @@ -0,0 +1,62 @@ +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +/** + * + * @package workflow.engine.classes + */ + + +/** + * Class wsCreateGroupResponse + * + * @package workflow.engine.classes + */class wsCreateGroupResponse +{ + public $status_code = 0; + public $message = ''; + public $groupUID = ''; + public $timestamp = ''; + + /** + * Function __construct + * Constructor of the class + * + * @param string $status + * @param string $message + * @param string $groupUID + * @return void + */ + function __construct ($status, $message, $groupUID) + { + $this->status_code = $status; + $this->message = $message; + $this->groupUID = $groupUID; + $this->timestamp = date( 'Y-m-d H:i:s' ); + } + +} diff --git a/workflow/engine/classes/WsCreateUserResponse.php b/workflow/engine/classes/WsCreateUserResponse.php new file mode 100644 index 000000000..e4a2b4058 --- /dev/null +++ b/workflow/engine/classes/WsCreateUserResponse.php @@ -0,0 +1,61 @@ +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +/** + * + * @package workflow.engine.classes + */ + + +/** + * Class wsCreateUserResponse + * + * @package workflow.engine.classes + */class wsCreateUserResponse +{ + public $status_code = 0; + public $message = ''; + public $userUID = ''; + public $timestamp = ''; + + /** + * Function __construct + * Constructor of the class + * + * @param string $status + * @param string $message + * @param string $userUID + * @return void + */ + function __construct ($status, $message, $userUID) + { + $this->status_code = $status; + $this->message = $message; + $this->userUID = $userUID; + $this->timestamp = date( 'Y-m-d H:i:s' ); + } +} diff --git a/workflow/engine/classes/WsGetCaseNotesResponse.php b/workflow/engine/classes/WsGetCaseNotesResponse.php new file mode 100644 index 000000000..cbf612504 --- /dev/null +++ b/workflow/engine/classes/WsGetCaseNotesResponse.php @@ -0,0 +1,61 @@ +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +/** + * + * @package workflow.engine.classes + */ + + +/** + * Class wsGetCaseNotesResponse + * + * @package workflow.engine.classes + */class wsGetCaseNotesResponse +{ + public $status_code = 0; + public $message = ''; + public $notes = null; + public $timestamp = ''; + + /** + * Function __construct + * Constructor of the class + * + * @param string $status + * @param string $message + * @param array|object|string $notes + * @return void + */ + function __construct ($status, $message, $notes) + { + $this->status_code = $status; + $this->message = $message; + $this->notes = $notes; + $this->timestamp = date( 'Y-m-d H:i:s' ); + } +} diff --git a/workflow/engine/classes/WsGetVariableResponse.php b/workflow/engine/classes/WsGetVariableResponse.php new file mode 100644 index 000000000..0c08c76b6 --- /dev/null +++ b/workflow/engine/classes/WsGetVariableResponse.php @@ -0,0 +1,61 @@ +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +/** + * + * @package workflow.engine.classes + */ + + +/** + * Class wsGetVariableResponse + * + * @package workflow.engine.classes + */class wsGetVariableResponse +{ + public $status_code = 0; + public $message = ''; + public $variables = null; + public $timestamp = ''; + + /** + * Function __construct + * Constructor of the class + * + * @param string $status + * @param string $message + * @param string $variables + * @return void + */ + function __construct ($status, $message, $variables) + { + $this->status_code = $status; + $this->message = $message; + $this->variables = $variables; + $this->timestamp = date( 'Y-m-d H:i:s' ); + } +} diff --git a/workflow/engine/classes/WsResponse.php b/workflow/engine/classes/WsResponse.php new file mode 100644 index 000000000..d113695b3 --- /dev/null +++ b/workflow/engine/classes/WsResponse.php @@ -0,0 +1,85 @@ +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +/** + * + * @package workflow.engine.classes + */ + + +/** + * + * @package workflow.engine.classes + */class wsResponse +{ + public $status_code = 0; + public $message = ''; + public $timestamp = ''; + + /** + * Function __construct + * Constructor of the class + * + * @param string $status + * @param string $message + * @return void + */ + function __construct ($status, $message) + { + $this->status_code = $status; + $this->message = $message; + $this->timestamp = date( 'Y-m-d H:i:s' ); + } + + /** + * Function getPayloadString + * + * @param string $operation + * @return string + */ + function getPayloadString ($operation) + { + $res = "<$operation>\n"; + $res .= "" . $this->status_code . ""; + $res .= "" . $this->message . ""; + $res .= "" . $this->timestamp . ""; + // $res .= "" . $this->timestamp . ""; + $res .= "<$operation>"; + return $res; + } + + /** + * Function getPayloadArray + * + * @return array + */ + function getPayloadArray () + { + return array ("status_code" => $this->status_code,'message' => $this->message,'timestamp' => $this->timestamp + ); + } +} diff --git a/workflow/engine/classes/class.xmlDb.php b/workflow/engine/classes/XMLConnection.php similarity index 92% rename from workflow/engine/classes/class.xmlDb.php rename to workflow/engine/classes/XMLConnection.php index c24af1a20..0a1f36ff7 100644 --- a/workflow/engine/classes/class.xmlDb.php +++ b/workflow/engine/classes/XMLConnection.php @@ -35,39 +35,6 @@ * @package workflow.engine.ProcessMaker * */ -class XMLDB -{ - - /** - * &connect - * - * @param string $dsn - * @return array $options - */ - public function &connect ($dsn, $options = array()) - { - //Needed for $mysql_real_escape_string - $mresdbc = new DBConnection(); - - if (! file_exists( $dsn )) { - $err = new DB_Error( "File $dsn not found." ); - return $err; - } - $dbc = new XMLConnection( $dsn ); - return $dbc; - } - - /** - * isError - * - * @param string $result - * @return boolean is_a($result, 'DB_Error') - */ - public function isError ($result) - { - return is_a( $result, 'DB_Error' ); - } -} /** * XMLConnection @@ -77,8 +44,7 @@ class XMLDB * @copyright (C) 2004 - 2008 Colosa Inc.23 * @package workflow.engine.ProcessMaker * - */ -class XMLConnection + */class XMLConnection { var $phptype = 'myxml'; var $caseFolding = true; @@ -555,73 +521,3 @@ class XMLConnection } } } - -/** - * XMLResult - * - * ProcessMaker Open Source Edition - * - * @copyright (C) 2004 - 2008 Colosa Inc.23 - * @package workflow.engine.ProcessMaker - * - */ -class XMLResult -{ - var $result = array (); - var $cursor = 0; - - /** - * XMLResult - * - * @param array $result - * @return void - */ - public function XMLResult ($result = array()) - { - $this->result = $result; - $this->cursor = 0; - } - - /** - * numRows - * - * @return integer sizeof($this->result) - */ - public function numRows () - { - return sizeof( $this->result ); - } - - /** - * fetchRow - * - * @param string $const - * @return integer $this->result[ $this->cursor-1 ]; - */ - public function fetchRow ($const) - { - if ($this->cursor >= $this->numRows()) { - return null; - } - $this->cursor ++; - return $this->result[$this->cursor - 1]; - } -} - -/** - * getNames - * - * @param object $children - * @return array $names - */ -function getNames ($children) -{ - $names = array (); - $r = 0; - foreach ($children as $child) { - $names[$r] = $child->name; - $r ++; - } - return $names; -} - diff --git a/workflow/engine/classes/XMLDB.php b/workflow/engine/classes/XMLDB.php new file mode 100644 index 000000000..a2d6598af --- /dev/null +++ b/workflow/engine/classes/XMLDB.php @@ -0,0 +1,79 @@ +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + * + */ + +/** + * XMLDB + * + * ProcessMaker Open Source Edition + * + * @copyright (C) 2004 - 2008 Colosa Inc.23 + * @package workflow.engine.ProcessMaker + * + */ + +/** + * XMLDB + * + * ProcessMaker Open Source Edition + * + * @copyright (C) 2004 - 2008 Colosa Inc.23 + * @package workflow.engine.ProcessMaker + * + */class XMLDB +{ + + /** + * &connect + * + * @param string $dsn + * @return array $options + */ + public function &connect ($dsn, $options = array()) + { + //Needed for $mysql_real_escape_string + $mresdbc = new DBConnection(); + + if (! file_exists( $dsn )) { + $err = new DB_Error( "File $dsn not found." ); + return $err; + } + $dbc = new XMLConnection( $dsn ); + return $dbc; + } + + /** + * isError + * + * @param string $result + * @return boolean is_a($result, 'DB_Error') + */ + public function isError ($result) + { + return is_a( $result, 'DB_Error' ); + } +} diff --git a/workflow/engine/classes/XMLResult.php b/workflow/engine/classes/XMLResult.php new file mode 100644 index 000000000..9f65f8470 --- /dev/null +++ b/workflow/engine/classes/XMLResult.php @@ -0,0 +1,88 @@ +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + * + */ + +/** + * XMLDB + * + * ProcessMaker Open Source Edition + * + * @copyright (C) 2004 - 2008 Colosa Inc.23 + * @package workflow.engine.ProcessMaker + * + */ + +/** + * XMLResult + * + * ProcessMaker Open Source Edition + * + * @copyright (C) 2004 - 2008 Colosa Inc.23 + * @package workflow.engine.ProcessMaker + * + */class XMLResult +{ + var $result = array (); + var $cursor = 0; + + /** + * XMLResult + * + * @param array $result + * @return void + */ + public function XMLResult ($result = array()) + { + $this->result = $result; + $this->cursor = 0; + } + + /** + * numRows + * + * @return integer sizeof($this->result) + */ + public function numRows () + { + return sizeof( $this->result ); + } + + /** + * fetchRow + * + * @param string $const + * @return integer $this->result[ $this->cursor-1 ]; + */ + public function fetchRow ($const) + { + if ($this->cursor >= $this->numRows()) { + return null; + } + $this->cursor ++; + return $this->result[$this->cursor - 1]; + } +} diff --git a/workflow/engine/classes/XmlForm_Field_CheckBoxTable.php b/workflow/engine/classes/XmlForm_Field_CheckBoxTable.php new file mode 100644 index 000000000..49078702f --- /dev/null +++ b/workflow/engine/classes/XmlForm_Field_CheckBoxTable.php @@ -0,0 +1,53 @@ +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + * + * @package workflow.engine.classes + **/ + + +/** + * Class XmlForm_Field_CheckBoxTable + */class XmlForm_Field_CheckBoxTable extends XmlForm_Field_Checkbox +{ + + /** + * Function render + * + * @author The Answer + * @access public + * @param eter string value + * @param eter string owner + * @return string + */ + public function render ($value = null, $owner = null) + { + //$optionName = $owner->values['USR_UID']; + $optionName = $value; + $onclick = (($this->onclick) ? ' onclick="' . G::replaceDataField( $this->onclick, $owner->values ) . '" ' : ''); + $html = ' '; + return $html; + } +} diff --git a/workflow/engine/classes/XmlForm_Field_Hours.php b/workflow/engine/classes/XmlForm_Field_Hours.php new file mode 100644 index 000000000..dd47dbd8d --- /dev/null +++ b/workflow/engine/classes/XmlForm_Field_Hours.php @@ -0,0 +1,151 @@ +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + * + * @package workflow.engine.classes + **/ + + +/** + * Class XmlForm_Field_hours + */class XmlForm_Field_hours extends XmlForm_Field_SimpleText +{ + public $size = 15; + public $maxLength = 64; + public $validate = 'Any'; + public $mask = ''; + public $defaultValue = ''; + public $required = false; + public $dependentFields = ''; + public $linkField = ''; + //Possible values:(-|UPPER|LOWER|CAPITALIZE) + public $strTo = ''; + public $readOnly = false; + public $sqlConnection = 0; + public $sql = ''; + public $sqlOption = array (); + //Atributes only for grids + public $formula = ''; + public $function = ''; + public $replaceTags = 0; + public $showVars = 0; + public $process = ''; + public $symbol = '@@'; + + /** + * Function render + * + * @author Julio Cesar Laura Avendano + * @access public + * @param eter string value + * @param eter string owner + * @return string + */ + public function render ($value = null, $owner = null) + { + if ($this->strTo === 'UPPER') { + $value = strtoupper( $value ); + } + if ($this->strTo === 'LOWER') { + $value = strtolower( $value ); + } + //if ($this->strTo==='CAPITALIZE') $value = strtocapitalize($value); + $onkeypress = G::replaceDataField( $this->onkeypress, $owner->values ); + if ($this->replaceTags == 1) { + $value = G::replaceDataField( $value, $owner->values ); + } + if ($this->showVars == 1) { + $this->process = G::replaceDataField( $this->process, $owner->values ); + //$sShowVars = ' ' . $this->symbol . ''; + $sShowVars = ' '; + } else { + $sShowVars = ''; + } + if ($this->mode === 'edit') { + if ($this->readOnly) { + return 'htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '\' readOnly="readOnly" style="' . htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>' . $sShowVars; + } else { + return 'htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '\' style="' . htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>' . $sShowVars; + } + } elseif ($this->mode === 'view') { + return 'htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '\' style="display:none;' . htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>' . $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ); + } else { + return $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ); + } + } + + /** + * Function renderGrid + * + * @author Julio Cesar Laura Avendano + * @access public + * @param eter array values + * @param eter string owner + * @return string + */ + public function renderGrid ($values = array(),$owner) + { + $result = array (); + $r = 1; + foreach ($values as $v) { + if ($this->replaceTags == 1) { + $v = G::replaceDataField( $v, $owner->values ); + } + if ($this->showVars == 1) { + $this->process = G::replaceDataField( $this->process, $owner->values ); + //$sShowVars = ' ' . $this->symbol . ''; + $sShowVars = ' '; + } else { + $sShowVars = ''; + } + if ($this->mode === 'edit') { + if ($this->readOnly) { + $result[] = '' . $sShowVars; + } else { + $result[] = '' . $sShowVars; + } + } elseif ($this->mode === 'view') { + $result[] = '

' . $this->htmlentities( number_format( $v, 2 ), ENT_COMPAT, 'utf-8' ) . '

'; + } else { + $result[] = '

' . $this->htmlentities( number_format( $v, 2 ), ENT_COMPAT, 'utf-8' ) . '

'; + } + $r ++; + } + return $result; + } + + /** + * Function attachEvents + * + * @access public + * @param eter string $element + * @return string + */ + public function attachEvents ($element) + { + return "myForm.aElements[i] = new G_Text(myForm, $element,'{$this->name}'); + myForm.aElements[i].setAttributes(" . $this->getAttributes() . ");"; + } +} diff --git a/workflow/engine/classes/XmlForm_Field_PopupOption.php b/workflow/engine/classes/XmlForm_Field_PopupOption.php new file mode 100644 index 000000000..ffa02cade --- /dev/null +++ b/workflow/engine/classes/XmlForm_Field_PopupOption.php @@ -0,0 +1,50 @@ +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + * + */ + +/** + * popupMenu - popupMenu +/** + * XmlForm_Field_popupOption - XmlForm_Field_popupOption class + * + * @package workflow.engine.ProcessMaker + * @copyright COLOSA + */class XmlForm_Field_popupOption extends XmlForm_Field +{ + var $launch = ''; + + /** + * Get Events + * + * @return string + */ + function getEvents () + { + $script = '{name:"' . $this->name . '",text:"' . addcslashes( $this->label, '\\"' ) . '", launch:leimnud.closure({Function:function(target){' . $this->launch . '}, args:target})}'; + return $script; + } +} diff --git a/workflow/engine/classes/XmlForm_Field_TextPM.php b/workflow/engine/classes/XmlForm_Field_TextPM.php new file mode 100644 index 000000000..54c23914a --- /dev/null +++ b/workflow/engine/classes/XmlForm_Field_TextPM.php @@ -0,0 +1,181 @@ +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + * + * @package workflow.engine.classes + **/ + + +/** + * class.xmlfield_InputPM.php + * + * @package workflow.engine.classes + * + * ProcessMaker Open Source Edition + * Copyright (C) 2004 - 2011 Colosa Inc. + * + * 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 + * License, or (at your option) any later version. + * + * 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 + * 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 . + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + * + * @package workflow.engine.classes + **/class XmlForm_Field_TextPM extends XmlForm_Field_SimpleText +{ + public $size = 15; + public $maxLength = 64; + public $validate = 'Any'; + public $mask = ''; + public $defaultValue = ''; + public $required = false; + public $dependentFields = ''; + public $linkField = ''; + //Possible values:(-|UPPER|LOWER|CAPITALIZE) + public $strTo = ''; + public $readOnly = false; + public $sqlConnection = 0; + public $sql = ''; + public $sqlOption = array (); + //Atributes only for grids + public $formula = ''; + public $function = ''; + public $replaceTags = 0; + public $showVars = 0; + public $process = ''; + public $symbol = '@@'; + + /** + * Function render + * + * @author Julio Cesar Laura Avendano + * @access public + * @param eter string value + * @param eter string owner + * @return string + */ + public function render ($value = null, $owner = null) + { + //$this->executeSQL(); + //if (isset($this->sqlOption)) { + // reset($this->sqlOption); + // $firstElement=key($this->sqlOption); + // if (isset($firstElement)) $value = $firstElement; + //} + //NOTE: string functions must be in G class + if ($this->strTo === 'UPPER') { + $value = strtoupper( $value ); + } + if ($this->strTo === 'LOWER') { + $value = strtolower( $value ); + } + //if ($this->strTo==='CAPITALIZE') $value = strtocapitalize($value); + $onkeypress = G::replaceDataField( $this->onkeypress, $owner->values ); + if ($this->replaceTags == 1) { + $value = G::replaceDataField( $value, $owner->values ); + } + if ($this->showVars == 1) { + $this->process = G::replaceDataField( $this->process, $owner->values ); + //$sShowVars = ' ' . $this->symbol . ''; + $sShowVars = ' '; + } else { + $sShowVars = ''; + } + if ($this->mode === 'edit') { + if ($this->readOnly) { + return 'htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '\' readOnly="readOnly" style="' . htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>' . $sShowVars; + } else { + return 'htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '\' style="' . htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>' . $sShowVars; + } + } elseif ($this->mode === 'view') { + return 'htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '\' style="display:none;' . htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>' . $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ); + } else { + return $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ); + } + } + + /** + * Function renderGrid + * + * @author Julio Cesar Laura Avendano + * @access public + * @param eter array values + * @param eter string owner + * @return string + */ + public function renderGrid ($values = array(), $owner) + { + $result = array (); + $r = 1; + foreach ($values as $v) { + if ($this->replaceTags == 1) { + $v = G::replaceDataField( $v, $owner->values ); + } + if ($this->showVars == 1) { + $this->process = G::replaceDataField( $this->process, $owner->values ); + //$sShowVars = ' ' . $this->symbol . ''; + $sShowVars = ' '; + } else { + $sShowVars = ''; + } + if ($this->mode === 'edit') { + if ($this->readOnly) { + $result[] = '' . $sShowVars; + } else { + $result[] = '' . $sShowVars; + } + } elseif ($this->mode === 'view') { + $result[] = $this->htmlentities( $v, ENT_COMPAT, 'utf-8' ); + } else { + $result[] = $this->htmlentities( $v, ENT_COMPAT, 'utf-8' ); + } + $r ++; + } + return $result; + } + + /** + * Function attachEvents + * + * @access public + * @param eter string $element + * @return string + */ + public function attachEvents ($element) + { + return "myForm.aElements[i] = new G_Text(myForm, $element,'{$this->name}'); + myForm.aElements[i].setAttributes(" . $this->getAttributes() . ");"; + } +} diff --git a/workflow/engine/classes/XmlForm_Field_TextareaPM.php b/workflow/engine/classes/XmlForm_Field_TextareaPM.php new file mode 100644 index 000000000..fa74e128e --- /dev/null +++ b/workflow/engine/classes/XmlForm_Field_TextareaPM.php @@ -0,0 +1,116 @@ +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + * + * @package workflow.engine.classes + **/ + + +/** + * Class XmlForm_Field_TextareaPM + */class XmlForm_Field_TextareaPM extends XmlForm_Field +{ + public $rows = 12; + public $cols = 40; + public $required = false; + public $readOnly = false; + public $wrap = 'OFF'; + public $showVars = 0; + public $process = ''; + public $symbol = '@@'; + + /** + * Function render + * + * @author Julio Cesar Laura Avendao + * @access public + * @param eter string value + * @param eter string owner + * @return string + */ + public function render ($value = null, $owner) + { + if ($this->showVars == 1) { + $this->process = G::replaceDataField( $this->process, $owner->values ); + $sShowVars = ' '; + } else { + $sShowVars = ''; + } + if ($this->mode === 'edit') { + if ($this->readOnly) { + return '' . $sShowVars; + } else { + return '' . $sShowVars; + } + } elseif ($this->mode === 'view') { + return ''; + } else { + return ''; + } + } + + /** + * Function renderGrid + * + * @author Julio Cesar Laura Avendano + * @access public + * @param eter string values + * @param eter string owner + * @return string + */ + public function renderGrid ($owner, $values = null) + { + $result = array (); + $r = 1; + foreach ($values as $v) { + if ($this->showVars == 1) { + $this->process = G::replaceDataField( $this->process, $owner->values ); + //$sShowVars = ' ' . $this->symbol . ''; + $sShowVars = ' '; + } else { + $sShowVars = ''; + } + if ($this->mode === 'edit') { + if ($this->readOnly) { + $result[] = 'htmlentities( $v, ENT_COMPAT, 'utf-8' ) . '\' readOnly="readOnly"/>' . $sShowVars; + } else { + $result[] = 'htmlentities( $v, ENT_COMPAT, 'utf-8' ) . '\' />' . $sShowVars; + } + } elseif ($this->mode === 'view') { + if (stristr( $_SERVER['HTTP_USER_AGENT'], 'iPhone' )) { + //$result[] = '
'.$this->htmlentities( $v , ENT_COMPAT, 'utf-8').'
'; + $result[] = $this->htmlentities( $v, ENT_COMPAT, 'utf-8' ); + } else { + //$result[] = '
'.$this->htmlentities( $v , ENT_COMPAT, 'utf-8').'
'; + $result[] = $this->htmlentities( $v, ENT_COMPAT, 'utf-8' ); + } + } else { + $result[] = $this->htmlentities( $v, ENT_COMPAT, 'utf-8' ); + } + $r ++; + } + return $result; + } +} diff --git a/workflow/engine/classes/XmlForm_Field_ToolBar.php b/workflow/engine/classes/XmlForm_Field_ToolBar.php new file mode 100644 index 000000000..0b815a7ce --- /dev/null +++ b/workflow/engine/classes/XmlForm_Field_ToolBar.php @@ -0,0 +1,75 @@ +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + * + */ + +/** + * ToolBar - ToolBar +/** + * XmlForm_Field_ToolBar - XmlForm_Field_ToolBar class + * + * @package workflow.engine.ProcessMaker + */class XmlForm_Field_ToolBar extends XmlForm_Field +{ + + public $xmlfile = ''; + public $type = 'toolbar'; + public $toolBar; + public $home = ''; + public $withoutLabel = true; + + /** + * Constructor of the class XmlForm_Field_ToolBar + * + * @param string $xmlNode + * @param string $lang + * @param string $home + * @param string $owner + * @return void + */ + public function XmlForm_Field_ToolBar($xmlNode, $lang = 'en', $home = '', $owner = ' ') + { + parent::XmlForm_Field($xmlNode, $lang, $home, $owner); + $this->home = $home; + } + + /** + * Prints the ToolBar + * + * @param string $value + * @return string + */ + public function render($value) + { + $this->toolBar = new toolBar($this->xmlfile, $this->home); + $template = PATH_CORE . 'templates/' . $this->type . '.html'; + $out = $this->toolBar->render($template, $scriptCode); + $oHeadPublisher = & headPublisher::getSingleton(); + $oHeadPublisher->addScriptFile($this->toolBar->scriptURL); + $oHeadPublisher->addScriptCode($scriptCode); + return $out; + } +} diff --git a/workflow/engine/classes/class.toolBar.php b/workflow/engine/classes/XmlForm_Field_ToolButton.php similarity index 81% rename from workflow/engine/classes/class.toolBar.php rename to workflow/engine/classes/XmlForm_Field_ToolButton.php index e8d66faba..a686fa5b5 100644 --- a/workflow/engine/classes/class.toolBar.php +++ b/workflow/engine/classes/XmlForm_Field_ToolButton.php @@ -27,69 +27,12 @@ */ /** - * ToolBar - ToolBar class - * - * @package workflow.engine.ProcessMaker - */ -class ToolBar extends form -{ - public $type = 'toolbar'; - public $align = 'left'; -} - -/** - * XmlForm_Field_ToolBar - XmlForm_Field_ToolBar class - * - * @package workflow.engine.ProcessMaker - */ -class XmlForm_Field_ToolBar extends XmlForm_Field -{ - - public $xmlfile = ''; - public $type = 'toolbar'; - public $toolBar; - public $home = ''; - public $withoutLabel = true; - - /** - * Constructor of the class XmlForm_Field_ToolBar - * - * @param string $xmlNode - * @param string $lang - * @param string $home - * @param string $owner - * @return void - */ - public function XmlForm_Field_ToolBar($xmlNode, $lang = 'en', $home = '', $owner = ' ') - { - parent::XmlForm_Field($xmlNode, $lang, $home, $owner); - $this->home = $home; - } - - /** - * Prints the ToolBar - * - * @param string $value - * @return string - */ - public function render($value) - { - $this->toolBar = new toolBar($this->xmlfile, $this->home); - $template = PATH_CORE . 'templates/' . $this->type . '.html'; - $out = $this->toolBar->render($template, $scriptCode); - $oHeadPublisher = & headPublisher::getSingleton(); - $oHeadPublisher->addScriptFile($this->toolBar->scriptURL); - $oHeadPublisher->addScriptCode($scriptCode); - return $out; - } -} - + * ToolBar - ToolBar /** * XmlForm_Field_toolButton - XmlForm_Field_toolButton class * * @package workflow.engine.ProcessMaker - */ -class XmlForm_Field_toolButton extends XmlForm_Field + */class XmlForm_Field_toolButton extends XmlForm_Field { public $file = ''; diff --git a/workflow/engine/classes/Zip_File.php b/workflow/engine/classes/Zip_File.php new file mode 100644 index 000000000..03a8819f6 --- /dev/null +++ b/workflow/engine/classes/Zip_File.php @@ -0,0 +1,113 @@ +archive( $name ); + $this->options['type'] = "zip"; + } + + /** + * This function is used to create archives . + * zip + * + * @return boolean + */ + public function create_zip () + { + $files = 0; + $offset = 0; + $central = ""; + if (! empty( $this->options['sfx'] )) { + if ($fp = @fopen( $this->options['sfx'], "rb" )) { + $temp = fread( $fp, filesize( $this->options['sfx'] ) ); + fclose( $fp ); + $this->add_data( $temp ); + $offset += strlen( $temp ); + unset( $temp ); + } else { + $this->error[] = "Could not open sfx module from {$this->options['sfx']}."; + } + } + $pwd = getcwd(); + chdir( $this->options['basedir'] ); + foreach ($this->files as $current) { + if ($current['name'] == $this->options['name']) { + continue; + } + $timedate = explode( " ", date( "Y n j G i s", $current['stat'][9] ) ); + $timedate = ($timedate[0] - 1980 << 25) | ($timedate[1] << 21) | ($timedate[2] << 16) | ($timedate[3] << 11) | ($timedate[4] << 5) | ($timedate[5]); + $block = pack( "VvvvV", 0x04034b50, 0x000A, 0x0000, (isset( $current['method'] ) || $this->options['method'] == 0) ? 0x0000 : 0x0008, $timedate ); + if ($current['stat'][7] == 0 && $current['type'] == 5) { + $block .= pack( "VVVvv", 0x00000000, 0x00000000, 0x00000000, strlen( $current['name2'] ) + 1, 0x0000 ); + $block .= $current['name2'] . "/"; + $this->add_data( $block ); + $central .= pack( "VvvvvVVVVvvvvvVV", 0x02014b50, 0x0014, $this->options['method'] == 0 ? 0x0000 : 0x000A, 0x0000, (isset( $current['method'] ) || $this->options['method'] == 0) ? 0x0000 : 0x0008, $timedate, 0x00000000, 0x00000000, 0x00000000, strlen( $current['name2'] ) + 1, 0x0000, 0x0000, 0x0000, 0x0000, $current['type'] == 5 ? 0x00000010 : 0x00000000, $offset ); + $central .= $current['name2'] . "/"; + $files ++; + $offset += (31 + strlen( $current['name2'] )); + } elseif ($current['stat'][7] == 0) { + $block .= pack( "VVVvv", 0x00000000, 0x00000000, 0x00000000, strlen( $current['name2'] ), 0x0000 ); + $block .= $current['name2']; + $this->add_data( $block ); + $central .= pack( "VvvvvVVVVvvvvvVV", 0x02014b50, 0x0014, $this->options['method'] == 0 ? 0x0000 : 0x000A, 0x0000, (isset( $current['method'] ) || $this->options['method'] == 0) ? 0x0000 : 0x0008, $timedate, 0x00000000, 0x00000000, 0x00000000, strlen( $current['name2'] ), 0x0000, 0x0000, 0x0000, 0x0000, $current['type'] == 5 ? 0x00000010 : 0x00000000, $offset ); + $central .= $current['name2']; + $files ++; + $offset += (30 + strlen( $current['name2'] )); + } elseif ($fp = @fopen( $current['name'], "rb" )) { + $temp = fread( $fp, $current['stat'][7] ); + fclose( $fp ); + $crc32 = G::encryptCrc32( $temp ); + if (! isset( $current['method'] ) && $this->options['method'] == 1) { + $temp = gzcompress( $temp, $this->options['level'] ); + $size = strlen( $temp ) - 6; + $temp = substr( $temp, 2, $size ); + } else { + $size = strlen( $temp ); + } + $block .= pack( "VVVvv", $crc32, $size, $current['stat'][7], strlen( $current['name2'] ), 0x0000 ); + $block .= $current['name2']; + $this->add_data( $block ); + $this->add_data( $temp ); + unset( $temp ); + $central .= pack( "VvvvvVVVVvvvvvVV", 0x02014b50, 0x0014, $this->options['method'] == 0 ? 0x0000 : 0x000A, 0x0000, (isset( $current['method'] ) || $this->options['method'] == 0) ? 0x0000 : 0x0008, $timedate, $crc32, $size, $current['stat'][7], strlen( $current['name2'] ), 0x0000, 0x0000, 0x0000, 0x0000, 0x00000000, $offset ); + $central .= $current['name2']; + $files ++; + $offset += (30 + strlen( $current['name2'] ) + $size); + } else { + $this->error[] = "Could not open file {$current['name']} for reading. It was not added."; + } + } + $this->add_data( $central ); + $this->add_data( pack( "VvvvvVVv", 0x06054b50, 0x0000, 0x0000, $files, $files, strlen( $central ), $offset, ! empty( $this->options['comment'] ) ? strlen( $this->options['comment'] ) : 0x0000 ) ); + if (! empty( $this->options['comment'] )) { + $this->add_data( $this->options['comment'] ); + } + chdir( $pwd ); + return 1; + } +} diff --git a/workflow/engine/classes/class.archive.php b/workflow/engine/classes/class.archive.php deleted file mode 100644 index 48dbe6a85..000000000 --- a/workflow/engine/classes/class.archive.php +++ /dev/null @@ -1,746 +0,0 @@ -options = array ('basedir' => ".",'name' => $name,'prepend' => "",'inmemory' => 0,'overwrite' => 0,'recurse' => 1,'storepaths' => 1,'followlinks' => 0,'level' => 3,'method' => 1,'sfx' => "",'type' => "",'comment' => "" - ); - $this->files = array (); - $this->exclude = array (); - $this->storeonly = array (); - $this->error = array (); - } - - /** - * This function gives options to a archive - * - * @param array $options - * @return void - */ - public function set_options ($options) - { - foreach ($options as $key => $value) { - $this->options[$key] = $value; - } - if (! empty( $this->options['basedir'] )) { - $this->options['basedir'] = str_replace( "\\", "/", $this->options['basedir'] ); - $this->options['basedir'] = preg_replace( "/\/+/", "/", $this->options['basedir'] ); - $this->options['basedir'] = preg_replace( "/\/$/", "", $this->options['basedir'] ); - } - if (! empty( $this->options['name'] )) { - $this->options['name'] = str_replace( "\\", "/", $this->options['name'] ); - $this->options['name'] = preg_replace( "/\/+/", "/", $this->options['name'] ); - } - if (! empty( $this->options['prepend'] )) { - $this->options['prepend'] = str_replace( "\\", "/", $this->options['prepend'] ); - $this->options['prepend'] = preg_replace( "/^(\.*\/+)+/", "", $this->options['prepend'] ); - $this->options['prepend'] = preg_replace( "/\/+/", "/", $this->options['prepend'] ); - $this->options['prepend'] = preg_replace( "/\/$/", "", $this->options['prepend'] ) . "/"; - } - } - - /** - * This function is used to create a archive. - * - * @return boolean - */ - public function create_archive () - { - $this->make_list(); - if ($this->options['inmemory'] == 0) { - $pwd = getcwd(); - chdir( $this->options['basedir'] ); - if ($this->options['overwrite'] == 0 && file_exists( $this->options['name'] . ($this->options['type'] == "gzip" || $this->options['type'] == "bzip" ? ".tmp" : "") )) { - $this->error[] = "File {$this->options['name']} already exist."; - chdir( $pwd ); - return 0; - } elseif ($this->archive = @fopen( $this->options['name'] . ($this->options['type'] == "gzip" || $this->options['type'] == "bzip" ? ".tmp" : ""), "wb+" )) { - chdir( $pwd ); - } else { - $this->error[] = "Could not open {$this->options['name']} for writing."; - chdir( $pwd ); - return 0; - } - } else { - $this->archive = ""; - } - switch ($this->options['type']) { - case "zip": - if (! $this->create_zip()) { - $this->error[] = "Could not create zip file."; - return 0; - } - break; - case "bzip": - if (! $this->create_tar()) { - $this->error[] = "Could not create tar file."; - return 0; - } - if (! $this->create_bzip()) { - $this->error[] = "Could not create bzip2 file."; - return 0; - } - break; - case "gzip": - if (! $this->create_tar()) { - $this->error[] = "Could not create tar file."; - return 0; - } - if (! $this->create_gzip()) { - $this->error[] = "Could not create gzip file."; - return 0; - } - break; - case "tar": - if (! $this->create_tar()) { - $this->error[] = "Could not create tar file."; - return 0; - } - } - if ($this->options['inmemory'] == 0) { - fclose( $this->archive ); - if ($this->options['type'] == "gzip" || $this->options['type'] == "bzip") { - unlink( $this->options['basedir'] . "/" . $this->options['name'] . ".tmp" ); - } - } - } - - /** - * This function is used for add data to a archive - * - * @param string $data - * @return void - */ - public function add_data ($data) - { - if ($this->options['inmemory'] == 0) { - fwrite( $this->archive, $data ); - } else { - $this->archive .= $data; - } - } - - /** - * This function make a list - * - * @return void - */ - public function make_list () - { - if (! empty( $this->exclude )) { - foreach ($this->files as $key => $value) { - foreach ($this->exclude as $current) { - if ($value['name'] == $current['name']) { - unset( $this->files[$key] ); - } - } - } - } - if (! empty( $this->storeonly )) { - foreach ($this->files as $key => $value) { - foreach ($this->storeonly as $current) { - if ($value['name'] == $current['name']) { - $this->files[$key]['method'] = 0; - } - } - } - } - unset( $this->exclude, $this->storeonly ); - } - - /** - * Add files a list - * - * @param array $list - * @return void - */ - public function add_files ($list) - { - $temp = $this->list_files( $list ); - foreach ($temp as $current) { - $this->files[] = $current; - } - } - - /** - * This function exclude files of a list - * - * @param array $list - * @return void - */ - public function exclude_files ($list) - { - $temp = $this->list_files( $list ); - foreach ($temp as $current) { - $this->exclude[] = $current; - } - } - - /** - * This function store files - * - * @param array $list - */ - public function store_files ($list) - { - $temp = $this->list_files( $list ); - foreach ($temp as $current) { - $this->storeonly[] = $current; - } - } - - /** - * List files gives a List - * - * @param array $list - * @return array - */ - public function list_files ($list) - { - if (! is_array( $list )) { - $temp = $list; - $list = array ($temp - ); - unset( $temp ); - } - $files = array (); - $pwd = getcwd(); - chdir( $this->options['basedir'] ); - foreach ($list as $current) { - $current = str_replace( "\\", "/", $current ); - $current = preg_replace( "/\/+/", "/", $current ); - $current = preg_replace( "/\/$/", "", $current ); - if (strstr( $current, "*" )) { - $regex = preg_replace( "/([\\\^\$\.\[\]\|\(\)\?\+\{\}\/])/", "\\\\\\1", $current ); - $regex = str_replace( "*", ".*", $regex ); - $dir = strstr( $current, "/" ) ? substr( $current, 0, strrpos( $current, "/" ) ) : "."; - $temp = $this->parse_dir( $dir ); - foreach ($temp as $current2) { - if (preg_match( "/^{$regex}$/i", $current2['name'] )) { - $files[] = $current2; - } - } - unset( $regex, $dir, $temp, $current ); - } elseif (@is_dir( $current )) { - $temp = $this->parse_dir( $current ); - foreach ($temp as $file) { - $files[] = $file; - } - unset( $temp, $file ); - } elseif (@file_exists( $current )) { - $files[] = array ('name' => $current,'name2' => $this->options['prepend'] . preg_replace( "/(\.+\/+)+/", "", ($this->options['storepaths'] == 0 && strstr( $current, "/" )) ? substr( $current, strrpos( $current, "/" ) + 1 ) : $current ),'type' => @is_link( $current ) && $this->options['followlinks'] == 0 ? 2 : 0,'ext' => substr( $current, strrpos( $current, "." ) ),'stat' => stat( $current ) - ); - } - } - chdir( $pwd ); - unset( $current, $pwd ); - usort( $files, array ("archive","sort_files" - ) ); - return $files; - } - - /** - * This function is for parse a directory name - * - * @param string $dirname - * @return array - */ - public function parse_dir ($dirname) - { - if ($this->options['storepaths'] == 1 && ! preg_match( "/^(\.+\/*)+$/", $dirname )) { - $files = array (array ('name' => $dirname,'name2' => $this->options['prepend'] . preg_replace( "/(\.+\/+)+/", "", ($this->options['storepaths'] == 0 && strstr( $dirname, "/" )) ? substr( $dirname, strrpos( $dirname, "/" ) + 1 ) : $dirname ),'type' => 5,'stat' => stat( $dirname ) - ) - ); - } else { - $files = array (); - } - $dir = @opendir( $dirname ); - while ($file = @readdir( $dir )) { - $fullname = $dirname . "/" . $file; - if ($file == "." || $file == "..") { - continue; - } elseif (@is_dir( $fullname )) { - if (empty( $this->options['recurse'] )) { - continue; - } - $temp = $this->parse_dir( $fullname ); - foreach ($temp as $file2) { - $files[] = $file2; - } - } elseif (@file_exists( $fullname )) { - $files[] = array ('name' => $fullname,'name2' => $this->options['prepend'] . preg_replace( "/(\.+\/+)+/", "", ($this->options['storepaths'] == 0 && strstr( $fullname, "/" )) ? substr( $fullname, strrpos( $fullname, "/" ) + 1 ) : $fullname ),'type' => @is_link( $fullname ) && $this->options['followlinks'] == 0 ? 2 : 0,'ext' => substr( $file, strrpos( $file, "." ) ),'stat' => stat( $fullname ) - ); - } - } - @closedir( $dir ); - return $files; - } - - /** - * This function sort two files - * - * @param array $a - * @param array $b - * @return boolean - */ - public function sort_files ($a, $b) - { - if ($a['type'] != $b['type']) { - if ($a['type'] == 5 || $b['type'] == 2) { - return - 1; - } elseif ($a['type'] == 2 || $b['type'] == 5) { - return 1; - } elseif ($a['type'] == 5) { - return strcmp( strtolower( $a['name'] ), strtolower( $b['name'] ) ); - } elseif ($a['ext'] != $b['ext']) { - return strcmp( $a['ext'], $b['ext'] ); - } elseif ($a['stat'][7] != $b['stat'][7]) { - return $a['stat'][7] > $b['stat'][7] ? - 1 : 1; - } else { - return strcmp( strtolower( $a['name'] ), strtolower( $b['name'] ) ); - } - } - return 0; - } - - /** - * This function download a file - * - * @return void - */ - public function download_file () - { - if ($this->options['inmemory'] == 0) { - $this->error[] = "Can only use download_file() if archive is in memory. Redirect to file otherwise, it is faster."; - return; - } - switch ($this->options['type']) { - case "zip": - header( "Content-Type: application/zip" ); - break; - case "bzip": - header( "Content-Type: application/x-bzip2" ); - break; - case "gzip": - header( "Content-Type: application/x-gzip" ); - break; - case "tar": - header( "Content-Type: application/x-tar" ); - } - $header = "Content-Disposition: attachment; filename=\""; - $header .= strstr( $this->options['name'], "/" ) ? substr( $this->options['name'], strrpos( $this->options['name'], "/" ) + 1 ) : $this->options['name']; - $header .= "\""; - header( $header ); - header( "Content-Length: " . strlen( $this->archive ) ); - header( "Content-Transfer-Encoding: binary" ); - header( "Cache-Control: no-cache, must-revalidate, max-age=60" ); - header( "Expires: Sat, 01 Jan 2000 12:00:00 GMT" ); - print ($this->archive) ; - } -} - -/** - * This class is derived from the class archive, is imployed to use files . - * tar - * - * @package workflow.engine.classes - * - */ -class tar_file extends archive -{ - - /** - * This function is the constructor of the class tar_file - * - * @param string $name - */ - public function tar_file ($name) - { - $this->archive( $name ); - $this->options['type'] = "tar"; - } - - /** - * This function create a file . - * tar - * - * @return boolean - */ - public function create_tar () - { - $pwd = getcwd(); - chdir( $this->options['basedir'] ); - foreach ($this->files as $current) { - if ($current['name'] == $this->options['name']) { - continue; - } - if (strlen( $current['name2'] ) > 99) { - $path = substr( $current['name2'], 0, strpos( $current['name2'], "/", strlen( $current['name2'] ) - 100 ) + 1 ); - $current['name2'] = substr( $current['name2'], strlen( $path ) ); - if (strlen( $path ) > 154 || strlen( $current['name2'] ) > 99) { - $this->error[] = "Could not add {$path}{$current['name2']} to archive because the filename is too long."; - continue; - } - } - $block = pack( "a100a8a8a8a12a12a8a1a100a6a2a32a32a8a8a155a12", $current['name2'], sprintf( "%07o", $current['stat'][2] ), sprintf( "%07o", $current['stat'][4] ), sprintf( "%07o", $current['stat'][5] ), sprintf( "%011o", $current['type'] == 2 ? 0 : $current['stat'][7] ), sprintf( "%011o", $current['stat'][9] ), " ", $current['type'], $current['type'] == 2 ? @readlink( $current['name'] ) : "", "ustar ", " ", "Unknown", "Unknown", "", "", ! empty( $path ) ? $path : "", "" ); - $checksum = 0; - for ($i = 0; $i < 512; $i ++) { - $checksum += ord( substr( $block, $i, 1 ) ); - } - $checksum = pack( "a8", sprintf( "%07o", $checksum ) ); - $block = substr_replace( $block, $checksum, 148, 8 ); - if ($current['type'] == 2 || $current['stat'][7] == 0) { - $this->add_data( $block ); - } elseif ($fp = @fopen( $current['name'], "rb" )) { - $this->add_data( $block ); - while ($temp = fread( $fp, 1048576 )) { - $this->add_data( $temp ); - } - if ($current['stat'][7] % 512 > 0) { - $temp = ""; - for ($i = 0; $i < 512 - $current['stat'][7] % 512; $i ++) { - $temp .= "\0"; - } - $this->add_data( $temp ); - } - fclose( $fp ); - } else { - $this->error[] = "Could not open file {$current['name']} for reading. It was not added."; - } - } - $this->add_data( pack( "a1024", "" ) ); - chdir( $pwd ); - return 1; - } - - /** - * This function is used for extract files of the class tar_file - * - * @return void - */ - public function extract_files () - { - $pwd = getcwd(); - chdir( $this->options['basedir'] ); - if ($fp = $this->open_archive()) { - if ($this->options['inmemory'] == 1) { - $this->files = array (); - } - while ($block = fread( $fp, 512 )) { - $temp = unpack( "a100name/a8mode/a8uid/a8gid/a12size/a12mtime/a8checksum/a1type/a100symlink/a6magic/a2temp/a32temp/a32temp/a8temp/a8temp/a155prefix/a12temp", $block ); - $file = array ('name' => $this->options['basedir'] . '/' . $temp['prefix'] . $temp['name'],'stat' => array (2 => $temp['mode'],4 => octdec( $temp['uid'] ),5 => octdec( $temp['gid'] ),7 => octdec( $temp['size'] ),9 => octdec( $temp['mtime'] ) - ),'checksum' => octdec( $temp['checksum'] ),'type' => $temp['type'],'magic' => $temp['magic'] - ); - if ($file['checksum'] == 0x00000000) { - break; - } elseif (substr( $file['magic'], 0, 5 ) != "ustar") { - $this->error[] = "This script does not support extracting this type of tar file."; - break; - } - $block = substr_replace( $block, " ", 148, 8 ); - $checksum = 0; - for ($i = 0; $i < 512; $i ++) { - $checksum += ord( substr( $block, $i, 1 ) ); - } - if ($file['checksum'] != $checksum) { - $this->error[] = "Could not extract from {$this->options['name']}, it is corrupt."; - } - if ($this->options['inmemory'] == 1) { - $file['data'] = fread( $fp, $file['stat'][7] ); - fread( $fp, (512 - $file['stat'][7] % 512) == 512 ? 0 : (512 - $file['stat'][7] % 512) ); - unset( $file['checksum'], $file['magic'] ); - $this->files[] = $file; - } elseif ($file['type'] == 5) { - if (! is_dir( $file['name'] )) { - //mkdir($file['name'], $file['stat'][2]); - mkdir( $file['name'], 0775 ); - } - } elseif ($this->options['overwrite'] == 0 && file_exists( $file['name'] )) { - $this->error[] = "{$file['name']} already exist."; - continue; - } elseif ($file['type'] == 2) { - symlink( $temp['symlink'], $file['name'] ); - //chmod($file['name'], $file['stat'][2]); - } elseif ($new = @fopen( $file['name'], "wb" )) { - fwrite( $new, fread( $fp, $file['stat'][7] ) ); - if ((512 - $file['stat'][7] % 512) != 512) { - fread( $fp, (512 - $file['stat'][7] % 512) ); - } - //fread($fp, (512 - $file['stat'][7] % 512) == 512 ? 0 : (512 - $file['stat'][7] % 512)); - fclose( $new ); - //chmod($file['name'], $file['stat'][2]); - chmod( $file['name'], 0777 ); - $this->files[] = $file['name']; - } else { - $this->error[] = "Could not open {$file['name']} for writing."; - continue; - } - //chown($file['name'], $file['stat'][4]); - //chgrp($file['name'], $file['stat'][5]); - @touch( $file['name'], $file['stat'][9] ); - unset( $file ); - } - } else { - $this->error[] = "Could not open file {$this->options['name']}"; - } - chdir( $pwd ); - } - - /** - * This function open a archive of the class tar_file - * - * @return void - */ - public function open_archive () - { - return @fopen( $this->options['name'], "rb" ); - } -} - -/** - * This class is derived of the class archive, is employed to use archives . - * gzip - * - * @package workflow.engine.classes - * - */ -class gzip_file extends tar_file -{ - - /** - * This function is the constructor of the class gzip_file - * - * @param string $name - * @return void - */ - public function gzip_file ($name) - { - $this->tar_file( $name ); - $this->options['type'] = "gzip"; - } - - /** - * This function is employed to create files . - * gzip - * - * @return boolean - */ - public function create_gzip () - { - if ($this->options['inmemory'] == 0) { - $pwd = getcwd(); - chdir( $this->options['basedir'] ); - if ($fp = gzopen( $this->options['name'], "wb{$this->options['level']}" )) { - fseek( $this->archive, 0 ); - while ($temp = fread( $this->archive, 1048576 )) { - gzwrite( $fp, $temp ); - } - gzclose( $fp ); - chdir( $pwd ); - } else { - $this->error[] = "Could not open {$this->options['name']} for writing."; - chdir( $pwd ); - return 0; - } - } else { - $this->archive = gzencode( $this->archive, $this->options['level'] ); - } - return 1; - } - - /** - * This function open a archive of the class gzip_file - * - * @return void - */ - public function open_archive () - { - return @gzopen( $this->options['name'], "rb" ); - } -} - -/** - * - * - * This class is derived from the class archive, is employed to use files .bzip - * - * @package workflow.engine.classes - * - */ -class bzip_file extends tar_file -{ - - /** - * This function is the constructor of the class bzip_file - * - * @param string $name - * @return void - */ - public function bzip_file ($name) - { - $this->tar_file( $name ); - $this->options['type'] = "bzip"; - } - - /** - * This function is employed to create files . - * bzip - * - * @return boolean - */ - public function create_bzip () - { - if ($this->options['inmemory'] == 0) { - $pwd = getcwd(); - chdir( $this->options['basedir'] ); - if ($fp = bzopen( $this->options['name'], "wb" )) { - fseek( $this->archive, 0 ); - while ($temp = fread( $this->archive, 1048576 )) { - bzwrite( $fp, $temp ); - } - bzclose( $fp ); - chdir( $pwd ); - } else { - $this->error[] = "Could not open {$this->options['name']} for writing."; - chdir( $pwd ); - return 0; - } - } else { - $this->archive = bzcompress( $this->archive, $this->options['level'] ); - } - return 1; - } - - /** - * This function open a archive of the class bzip_file - * - * @return void - */ - public function open_archive () - { - return @bzopen( $this->options['name'], "rb" ); - } -} - -/** - * This class is derived from the class archive, is imployed to use files . - * zip - * - * @package workflow.engine.classes - */ - -class zip_file extends archive -{ - - public function zip_file ($name) - { - $this->archive( $name ); - $this->options['type'] = "zip"; - } - - /** - * This function is used to create archives . - * zip - * - * @return boolean - */ - public function create_zip () - { - $files = 0; - $offset = 0; - $central = ""; - if (! empty( $this->options['sfx'] )) { - if ($fp = @fopen( $this->options['sfx'], "rb" )) { - $temp = fread( $fp, filesize( $this->options['sfx'] ) ); - fclose( $fp ); - $this->add_data( $temp ); - $offset += strlen( $temp ); - unset( $temp ); - } else { - $this->error[] = "Could not open sfx module from {$this->options['sfx']}."; - } - } - $pwd = getcwd(); - chdir( $this->options['basedir'] ); - foreach ($this->files as $current) { - if ($current['name'] == $this->options['name']) { - continue; - } - $timedate = explode( " ", date( "Y n j G i s", $current['stat'][9] ) ); - $timedate = ($timedate[0] - 1980 << 25) | ($timedate[1] << 21) | ($timedate[2] << 16) | ($timedate[3] << 11) | ($timedate[4] << 5) | ($timedate[5]); - $block = pack( "VvvvV", 0x04034b50, 0x000A, 0x0000, (isset( $current['method'] ) || $this->options['method'] == 0) ? 0x0000 : 0x0008, $timedate ); - if ($current['stat'][7] == 0 && $current['type'] == 5) { - $block .= pack( "VVVvv", 0x00000000, 0x00000000, 0x00000000, strlen( $current['name2'] ) + 1, 0x0000 ); - $block .= $current['name2'] . "/"; - $this->add_data( $block ); - $central .= pack( "VvvvvVVVVvvvvvVV", 0x02014b50, 0x0014, $this->options['method'] == 0 ? 0x0000 : 0x000A, 0x0000, (isset( $current['method'] ) || $this->options['method'] == 0) ? 0x0000 : 0x0008, $timedate, 0x00000000, 0x00000000, 0x00000000, strlen( $current['name2'] ) + 1, 0x0000, 0x0000, 0x0000, 0x0000, $current['type'] == 5 ? 0x00000010 : 0x00000000, $offset ); - $central .= $current['name2'] . "/"; - $files ++; - $offset += (31 + strlen( $current['name2'] )); - } elseif ($current['stat'][7] == 0) { - $block .= pack( "VVVvv", 0x00000000, 0x00000000, 0x00000000, strlen( $current['name2'] ), 0x0000 ); - $block .= $current['name2']; - $this->add_data( $block ); - $central .= pack( "VvvvvVVVVvvvvvVV", 0x02014b50, 0x0014, $this->options['method'] == 0 ? 0x0000 : 0x000A, 0x0000, (isset( $current['method'] ) || $this->options['method'] == 0) ? 0x0000 : 0x0008, $timedate, 0x00000000, 0x00000000, 0x00000000, strlen( $current['name2'] ), 0x0000, 0x0000, 0x0000, 0x0000, $current['type'] == 5 ? 0x00000010 : 0x00000000, $offset ); - $central .= $current['name2']; - $files ++; - $offset += (30 + strlen( $current['name2'] )); - } elseif ($fp = @fopen( $current['name'], "rb" )) { - $temp = fread( $fp, $current['stat'][7] ); - fclose( $fp ); - $crc32 = G::encryptCrc32( $temp ); - if (! isset( $current['method'] ) && $this->options['method'] == 1) { - $temp = gzcompress( $temp, $this->options['level'] ); - $size = strlen( $temp ) - 6; - $temp = substr( $temp, 2, $size ); - } else { - $size = strlen( $temp ); - } - $block .= pack( "VVVvv", $crc32, $size, $current['stat'][7], strlen( $current['name2'] ), 0x0000 ); - $block .= $current['name2']; - $this->add_data( $block ); - $this->add_data( $temp ); - unset( $temp ); - $central .= pack( "VvvvvVVVVvvvvvVV", 0x02014b50, 0x0014, $this->options['method'] == 0 ? 0x0000 : 0x000A, 0x0000, (isset( $current['method'] ) || $this->options['method'] == 0) ? 0x0000 : 0x0008, $timedate, $crc32, $size, $current['stat'][7], strlen( $current['name2'] ), 0x0000, 0x0000, 0x0000, 0x0000, 0x00000000, $offset ); - $central .= $current['name2']; - $files ++; - $offset += (30 + strlen( $current['name2'] ) + $size); - } else { - $this->error[] = "Could not open file {$current['name']} for reading. It was not added."; - } - } - $this->add_data( $central ); - $this->add_data( pack( "VvvvvVVv", 0x06054b50, 0x0000, 0x0000, $files, $files, strlen( $central ), $offset, ! empty( $this->options['comment'] ) ? strlen( $this->options['comment'] ) : 0x0000 ) ); - if (! empty( $this->options['comment'] )) { - $this->add_data( $this->options['comment'] ); - } - chdir( $pwd ); - return 1; - } -} - diff --git a/workflow/engine/classes/class.plugin.php b/workflow/engine/classes/class.plugin.php index 3b70a555f..49affd971 100644 --- a/workflow/engine/classes/class.plugin.php +++ b/workflow/engine/classes/class.plugin.php @@ -25,7 +25,6 @@ use ProcessMaker\Plugins\PluginRegistry; -require_once 'class.pluginRegistry.php'; define('G_PLUGIN_CLASS', 1); define('PM_CREATE_CASE', 1001); diff --git a/workflow/engine/classes/class.wsResponse.php b/workflow/engine/classes/class.wsResponse.php deleted file mode 100644 index f3c4ece35..000000000 --- a/workflow/engine/classes/class.wsResponse.php +++ /dev/null @@ -1,233 +0,0 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - */ - -/** - * - * @package workflow.engine.classes - */ - -class wsResponse -{ - public $status_code = 0; - public $message = ''; - public $timestamp = ''; - - /** - * Function __construct - * Constructor of the class - * - * @param string $status - * @param string $message - * @return void - */ - function __construct ($status, $message) - { - $this->status_code = $status; - $this->message = $message; - $this->timestamp = date( 'Y-m-d H:i:s' ); - } - - /** - * Function getPayloadString - * - * @param string $operation - * @return string - */ - function getPayloadString ($operation) - { - $res = "<$operation>\n"; - $res .= "" . $this->status_code . ""; - $res .= "" . $this->message . ""; - $res .= "" . $this->timestamp . ""; - // $res .= "" . $this->timestamp . ""; - $res .= "<$operation>"; - return $res; - } - - /** - * Function getPayloadArray - * - * @return array - */ - function getPayloadArray () - { - return array ("status_code" => $this->status_code,'message' => $this->message,'timestamp' => $this->timestamp - ); - } -} - -/** - * Class wsCreateUserResponse - * - * @package workflow.engine.classes - */ -class wsCreateUserResponse -{ - public $status_code = 0; - public $message = ''; - public $userUID = ''; - public $timestamp = ''; - - /** - * Function __construct - * Constructor of the class - * - * @param string $status - * @param string $message - * @param string $userUID - * @return void - */ - function __construct ($status, $message, $userUID) - { - $this->status_code = $status; - $this->message = $message; - $this->userUID = $userUID; - $this->timestamp = date( 'Y-m-d H:i:s' ); - } -} - -/** - * Class wsCreateGroupResponse - * - * @package workflow.engine.classes - */ -class wsCreateGroupResponse -{ - public $status_code = 0; - public $message = ''; - public $groupUID = ''; - public $timestamp = ''; - - /** - * Function __construct - * Constructor of the class - * - * @param string $status - * @param string $message - * @param string $groupUID - * @return void - */ - function __construct ($status, $message, $groupUID) - { - $this->status_code = $status; - $this->message = $message; - $this->groupUID = $groupUID; - $this->timestamp = date( 'Y-m-d H:i:s' ); - } - -} - -/** - * Class wsCreateDepartmentResponse - * - * @package workflow.engine.classes - */ -class wsCreateDepartmentResponse -{ - public $status_code = 0; - public $message = ''; - public $departmentUID = ''; - public $timestamp = ''; - - /** - * Function __construct - * Constructor of the class - * - * @param string $status - * @param string $message - * @param string $departmentUID - * @return void - */ - function __construct ($status, $message, $departmentUID) - { - $this->status_code = $status; - $this->message = $message; - $this->departmentUID = $departmentUID; - $this->timestamp = date( 'Y-m-d H:i:s' ); - } -} - -/** - * Class wsGetVariableResponse - * - * @package workflow.engine.classes - */ -class wsGetVariableResponse -{ - public $status_code = 0; - public $message = ''; - public $variables = null; - public $timestamp = ''; - - /** - * Function __construct - * Constructor of the class - * - * @param string $status - * @param string $message - * @param string $variables - * @return void - */ - function __construct ($status, $message, $variables) - { - $this->status_code = $status; - $this->message = $message; - $this->variables = $variables; - $this->timestamp = date( 'Y-m-d H:i:s' ); - } -} - -/** - * Class wsGetCaseNotesResponse - * - * @package workflow.engine.classes - */ -class wsGetCaseNotesResponse -{ - public $status_code = 0; - public $message = ''; - public $notes = null; - public $timestamp = ''; - - /** - * Function __construct - * Constructor of the class - * - * @param string $status - * @param string $message - * @param array|object|string $notes - * @return void - */ - function __construct ($status, $message, $notes) - { - $this->status_code = $status; - $this->message = $message; - $this->notes = $notes; - $this->timestamp = date( 'Y-m-d H:i:s' ); - } -} -?> \ No newline at end of file diff --git a/workflow/engine/classes/class.xmlfield_InputPM.php b/workflow/engine/classes/class.xmlfield_InputPM.php deleted file mode 100644 index 5bd2d3814..000000000 --- a/workflow/engine/classes/class.xmlfield_InputPM.php +++ /dev/null @@ -1,580 +0,0 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - * @package workflow.engine.classes - **/ - -class XmlForm_Field_TextPM extends XmlForm_Field_SimpleText -{ - public $size = 15; - public $maxLength = 64; - public $validate = 'Any'; - public $mask = ''; - public $defaultValue = ''; - public $required = false; - public $dependentFields = ''; - public $linkField = ''; - //Possible values:(-|UPPER|LOWER|CAPITALIZE) - public $strTo = ''; - public $readOnly = false; - public $sqlConnection = 0; - public $sql = ''; - public $sqlOption = array (); - //Atributes only for grids - public $formula = ''; - public $function = ''; - public $replaceTags = 0; - public $showVars = 0; - public $process = ''; - public $symbol = '@@'; - - /** - * Function render - * - * @author Julio Cesar Laura Avendano - * @access public - * @param eter string value - * @param eter string owner - * @return string - */ - public function render ($value = null, $owner = null) - { - //$this->executeSQL(); - //if (isset($this->sqlOption)) { - // reset($this->sqlOption); - // $firstElement=key($this->sqlOption); - // if (isset($firstElement)) $value = $firstElement; - //} - //NOTE: string functions must be in G class - if ($this->strTo === 'UPPER') { - $value = strtoupper( $value ); - } - if ($this->strTo === 'LOWER') { - $value = strtolower( $value ); - } - //if ($this->strTo==='CAPITALIZE') $value = strtocapitalize($value); - $onkeypress = G::replaceDataField( $this->onkeypress, $owner->values ); - if ($this->replaceTags == 1) { - $value = G::replaceDataField( $value, $owner->values ); - } - if ($this->showVars == 1) { - $this->process = G::replaceDataField( $this->process, $owner->values ); - //$sShowVars = ' ' . $this->symbol . ''; - $sShowVars = ' '; - } else { - $sShowVars = ''; - } - if ($this->mode === 'edit') { - if ($this->readOnly) { - return 'htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '\' readOnly="readOnly" style="' . htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>' . $sShowVars; - } else { - return 'htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '\' style="' . htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>' . $sShowVars; - } - } elseif ($this->mode === 'view') { - return 'htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '\' style="display:none;' . htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>' . $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ); - } else { - return $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ); - } - } - - /** - * Function renderGrid - * - * @author Julio Cesar Laura Avendano - * @access public - * @param eter array values - * @param eter string owner - * @return string - */ - public function renderGrid ($values = array(), $owner) - { - $result = array (); - $r = 1; - foreach ($values as $v) { - if ($this->replaceTags == 1) { - $v = G::replaceDataField( $v, $owner->values ); - } - if ($this->showVars == 1) { - $this->process = G::replaceDataField( $this->process, $owner->values ); - //$sShowVars = ' ' . $this->symbol . ''; - $sShowVars = ' '; - } else { - $sShowVars = ''; - } - if ($this->mode === 'edit') { - if ($this->readOnly) { - $result[] = '' . $sShowVars; - } else { - $result[] = '' . $sShowVars; - } - } elseif ($this->mode === 'view') { - $result[] = $this->htmlentities( $v, ENT_COMPAT, 'utf-8' ); - } else { - $result[] = $this->htmlentities( $v, ENT_COMPAT, 'utf-8' ); - } - $r ++; - } - return $result; - } - - /** - * Function attachEvents - * - * @access public - * @param eter string $element - * @return string - */ - public function attachEvents ($element) - { - return "myForm.aElements[i] = new G_Text(myForm, $element,'{$this->name}'); - myForm.aElements[i].setAttributes(" . $this->getAttributes() . ");"; - } -} - -/** - * Class XmlForm_Field_TextareaPM - */ -class XmlForm_Field_TextareaPM extends XmlForm_Field -{ - public $rows = 12; - public $cols = 40; - public $required = false; - public $readOnly = false; - public $wrap = 'OFF'; - public $showVars = 0; - public $process = ''; - public $symbol = '@@'; - - /** - * Function render - * - * @author Julio Cesar Laura Avendao - * @access public - * @param eter string value - * @param eter string owner - * @return string - */ - public function render ($value = null, $owner) - { - if ($this->showVars == 1) { - $this->process = G::replaceDataField( $this->process, $owner->values ); - $sShowVars = ' '; - } else { - $sShowVars = ''; - } - if ($this->mode === 'edit') { - if ($this->readOnly) { - return '' . $sShowVars; - } else { - return '' . $sShowVars; - } - } elseif ($this->mode === 'view') { - return ''; - } else { - return ''; - } - } - - /** - * Function renderGrid - * - * @author Julio Cesar Laura Avendano - * @access public - * @param eter string values - * @param eter string owner - * @return string - */ - public function renderGrid ($owner, $values = null) - { - $result = array (); - $r = 1; - foreach ($values as $v) { - if ($this->showVars == 1) { - $this->process = G::replaceDataField( $this->process, $owner->values ); - //$sShowVars = ' ' . $this->symbol . ''; - $sShowVars = ' '; - } else { - $sShowVars = ''; - } - if ($this->mode === 'edit') { - if ($this->readOnly) { - $result[] = 'htmlentities( $v, ENT_COMPAT, 'utf-8' ) . '\' readOnly="readOnly"/>' . $sShowVars; - } else { - $result[] = 'htmlentities( $v, ENT_COMPAT, 'utf-8' ) . '\' />' . $sShowVars; - } - } elseif ($this->mode === 'view') { - if (stristr( $_SERVER['HTTP_USER_AGENT'], 'iPhone' )) { - //$result[] = '
'.$this->htmlentities( $v , ENT_COMPAT, 'utf-8').'
'; - $result[] = $this->htmlentities( $v, ENT_COMPAT, 'utf-8' ); - } else { - //$result[] = '
'.$this->htmlentities( $v , ENT_COMPAT, 'utf-8').'
'; - $result[] = $this->htmlentities( $v, ENT_COMPAT, 'utf-8' ); - } - } else { - $result[] = $this->htmlentities( $v, ENT_COMPAT, 'utf-8' ); - } - $r ++; - } - return $result; - } -} - -/** - * Class XmlForm_Field_hours - */ -class XmlForm_Field_hours extends XmlForm_Field_SimpleText -{ - public $size = 15; - public $maxLength = 64; - public $validate = 'Any'; - public $mask = ''; - public $defaultValue = ''; - public $required = false; - public $dependentFields = ''; - public $linkField = ''; - //Possible values:(-|UPPER|LOWER|CAPITALIZE) - public $strTo = ''; - public $readOnly = false; - public $sqlConnection = 0; - public $sql = ''; - public $sqlOption = array (); - //Atributes only for grids - public $formula = ''; - public $function = ''; - public $replaceTags = 0; - public $showVars = 0; - public $process = ''; - public $symbol = '@@'; - - /** - * Function render - * - * @author Julio Cesar Laura Avendano - * @access public - * @param eter string value - * @param eter string owner - * @return string - */ - public function render ($value = null, $owner = null) - { - if ($this->strTo === 'UPPER') { - $value = strtoupper( $value ); - } - if ($this->strTo === 'LOWER') { - $value = strtolower( $value ); - } - //if ($this->strTo==='CAPITALIZE') $value = strtocapitalize($value); - $onkeypress = G::replaceDataField( $this->onkeypress, $owner->values ); - if ($this->replaceTags == 1) { - $value = G::replaceDataField( $value, $owner->values ); - } - if ($this->showVars == 1) { - $this->process = G::replaceDataField( $this->process, $owner->values ); - //$sShowVars = ' ' . $this->symbol . ''; - $sShowVars = ' '; - } else { - $sShowVars = ''; - } - if ($this->mode === 'edit') { - if ($this->readOnly) { - return 'htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '\' readOnly="readOnly" style="' . htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>' . $sShowVars; - } else { - return 'htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '\' style="' . htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>' . $sShowVars; - } - } elseif ($this->mode === 'view') { - return 'htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '\' style="display:none;' . htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>' . $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ); - } else { - return $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ); - } - } - - /** - * Function renderGrid - * - * @author Julio Cesar Laura Avendano - * @access public - * @param eter array values - * @param eter string owner - * @return string - */ - public function renderGrid ($values = array(),$owner) - { - $result = array (); - $r = 1; - foreach ($values as $v) { - if ($this->replaceTags == 1) { - $v = G::replaceDataField( $v, $owner->values ); - } - if ($this->showVars == 1) { - $this->process = G::replaceDataField( $this->process, $owner->values ); - //$sShowVars = ' ' . $this->symbol . ''; - $sShowVars = ' '; - } else { - $sShowVars = ''; - } - if ($this->mode === 'edit') { - if ($this->readOnly) { - $result[] = '' . $sShowVars; - } else { - $result[] = '' . $sShowVars; - } - } elseif ($this->mode === 'view') { - $result[] = '

' . $this->htmlentities( number_format( $v, 2 ), ENT_COMPAT, 'utf-8' ) . '

'; - } else { - $result[] = '

' . $this->htmlentities( number_format( $v, 2 ), ENT_COMPAT, 'utf-8' ) . '

'; - } - $r ++; - } - return $result; - } - - /** - * Function attachEvents - * - * @access public - * @param eter string $element - * @return string - */ - public function attachEvents ($element) - { - return "myForm.aElements[i] = new G_Text(myForm, $element,'{$this->name}'); - myForm.aElements[i].setAttributes(" . $this->getAttributes() . ");"; - } -} - -/** - * Function getDynaformsVars - * - * @access public - * @param eter string $sProcessUID - * @param eter boolean $bSystemVars - * @return array - */ -function getDynaformsVars ($sProcessUID, $typeVars = 'all', $bIncMulSelFields = 0) -{ - $aFields = array (); - $aFieldsNames = array (); - if ($typeVars == 'system' || $typeVars == 'all') { - $aAux = G::getSystemConstants(); - foreach ($aAux as $sName => $sValue) { - $aFields[] = array ('sName' => $sName,'sType' => 'system','sLabel' => G::LoadTranslation('ID_TINY_SYSTEM_VARIABLES')); - } - //we're adding the pin variable to the system list - $aFields[] = array ('sName' => 'PIN','sType' => 'system','sLabel' => G::LoadTranslation('ID_TINY_SYSTEM_VARIABLES')); - - //we're adding the app_number variable to the system list - $aFields[] = array('sName' => 'APP_NUMBER', 'sType' => 'system', 'sLabel' => G::LoadTranslation('ID_TINY_SYSTEM_VARIABLE'), 'sUid' => ''); - } - - $aInvalidTypes = array("title", "subtitle", "file", "button", "reset", "submit", "javascript", "pmconnection"); - $aMultipleSelectionFields = array("listbox", "checkgroup"); - - if ($bIncMulSelFields != 0) { - $aInvalidTypes = array_merge( $aInvalidTypes, $aMultipleSelectionFields ); - } - // getting bpmn projects - $oCriteria = new Criteria('workflow'); - $oCriteria->addSelectColumn(BpmnProjectPeer::PRJ_UID); - $oCriteria->add(BpmnProjectPeer::PRJ_UID, $sProcessUID); - $oDataset = ProcessPeer::doSelectRS($oCriteria, Propel::getDbConnection('workflow_ro')); - $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $oDataset->next(); - $row = $oDataset->getRow(); - if (isset($row["PRJ_UID"])) { - if($typeVars == 'process' || $typeVars == 'all') { - $oCriteria = new Criteria('workflow'); - $oCriteria->addSelectColumn(ProcessVariablesPeer::VAR_UID); - $oCriteria->addSelectColumn(ProcessVariablesPeer::VAR_NAME); - $oCriteria->addSelectColumn(ProcessVariablesPeer::VAR_FIELD_TYPE); - $oCriteria->add(ProcessVariablesPeer::PRJ_UID, $sProcessUID); - $oDataset = ProcessVariablesPeer::doSelectRS($oCriteria); - $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); - while ($oDataset->next()) { - $row = $oDataset->getRow(); - array_push($aFields, array( - "sName" => $row["VAR_NAME"], - "sType" => $row["VAR_FIELD_TYPE"], - "sLabel" => $row["VAR_FIELD_TYPE"] - )); - } - } - if($typeVars == 'grid' || $typeVars == 'all') { - $oC = new Criteria( 'workflow' ); - $oC->addSelectColumn( DynaformPeer::DYN_CONTENT ); - $oC->add( DynaformPeer::PRO_UID, $sProcessUID ); - $oC->add( DynaformPeer::DYN_TYPE, 'xmlform' ); - $oData = DynaformPeer::doSelectRS( $oC ); - $oData->setFetchmode( ResultSet::FETCHMODE_ASSOC ); - $oData->next(); - while ($aRowd = $oData->getRow()) { - $dynaform = G::json_decode($aRowd['DYN_CONTENT'],true); - if(is_array($dynaform) && sizeof($dynaform)) { - $items = $dynaform['items'][0]['items']; - foreach($items as $key => $val){ - if(isset($val[0]['type']) && $val[0]['type'] == 'grid'){ - if(sizeof($val[0]['columns'])) { - $columns = $val[0]['columns']; - foreach($columns as $column) { - array_push($aFields, array( - "sName" => $column['name'], - "sType" => $column['type'], - "sLabel" => $column['type'] - )); - } - } - } - } - } - $oData->next(); - } - } - - } else { - require_once 'classes/model/Dynaform.php'; - $oCriteria = new Criteria( 'workflow' ); - $oCriteria->addSelectColumn( DynaformPeer::DYN_FILENAME ); - $oCriteria->add( DynaformPeer::PRO_UID, $sProcessUID ); - $oCriteria->add( DynaformPeer::DYN_TYPE, 'xmlform' ); - $oDataset = DynaformPeer::doSelectRS( $oCriteria ); - $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); - $oDataset->next(); - while ($aRow = $oDataset->getRow()) { - if (file_exists( PATH_DYNAFORM . PATH_SEP . $aRow['DYN_FILENAME'] . '.xml' )) { - $G_FORM = new Form( $aRow['DYN_FILENAME'], PATH_DYNAFORM, SYS_LANG ); - if (($G_FORM->type == 'xmlform') || ($G_FORM->type == '')) { - foreach ($G_FORM->fields as $k => $v) { - if (! in_array( $v->type, $aInvalidTypes )) { - if (! in_array( $k, $aFieldsNames )) { - $aFields[] = array ('sName' => $k,'sType' => $v->type,'sLabel' => ($v->type != 'grid' ? $v->label : '[ ' . G::LoadTranslation( 'ID_GRID' ) . ' ]') - ); - $aFieldsNames[] = $k; - } - } - } - } - } - $oDataset->next(); - } - } - return $aFields; -} - -/** - * Function getGridsVars - * - * @access public - * @param eter string $sProcessUID - * @return array - */ -function getGridsVars ($sProcessUID) -{ - $aFields = array (); - $aFieldsNames = array (); - - require_once 'classes/model/Dynaform.php'; - $oCriteria = new Criteria( 'workflow' ); - $oCriteria->addSelectColumn( DynaformPeer::DYN_FILENAME ); - $oCriteria->add( DynaformPeer::PRO_UID, $sProcessUID ); - $oDataset = DynaformPeer::doSelectRS( $oCriteria ); - $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); - $oDataset->next(); - while ($aRow = $oDataset->getRow()) { - $G_FORM = new Form( $aRow['DYN_FILENAME'], PATH_DYNAFORM, SYS_LANG ); - if ($G_FORM->type == 'xmlform') { - foreach ($G_FORM->fields as $k => $v) { - if ($v->type == 'grid') { - if (! in_array( $k, $aFieldsNames )) { - $aFields[] = array ('sName' => $k,'sXmlForm' => str_replace( $sProcessUID . '/', '', $v->xmlGrid )); - $aFieldsNames[] = $k; - } - } - } - } - $oDataset->next(); - } - return $aFields; -} -/** - * Function getVarsGrid returns all variables of Grid - * - * @access public - * @param string proUid process ID - * @param string dynUid dynaform ID - * @return array - */ - -function getVarsGrid ($proUid, $dynUid) -{ - $dynaformFields = array (); - - if (is_file( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/'. $proUid .'/'.$dynUid. '.xml' ) && filesize( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/'. $proUid .'/'. $dynUid .'.xml' ) > 0) { - $dyn = new DynaformHandler( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/' .$proUid. '/' . $dynUid .'.xml' ); - $dynaformFields[] = $dyn->getFields(); - } - - $dynaformFieldTypes = array (); - - foreach ($dynaformFields as $aDynFormFields) { - foreach ($aDynFormFields as $field) { - - if ($field->getAttribute( 'validate' ) == 'Int') { - $dynaformFieldTypes[$field->nodeName] = 'Int'; - } elseif ($field->getAttribute( 'validate' ) == 'Real') { - $dynaformFieldTypes[$field->nodeName] = 'Real'; - } else { - $dynaformFieldTypes[$field->nodeName] = $field->getAttribute( 'type' ); - } - } - } - return $dynaformFieldTypes; -} - - -/** - * Class XmlForm_Field_CheckBoxTable - */ -class XmlForm_Field_CheckBoxTable extends XmlForm_Field_Checkbox -{ - - /** - * Function render - * - * @author The Answer - * @access public - * @param eter string value - * @param eter string owner - * @return string - */ - public function render ($value = null, $owner = null) - { - //$optionName = $owner->values['USR_UID']; - $optionName = $value; - $onclick = (($this->onclick) ? ' onclick="' . G::replaceDataField( $this->onclick, $owner->values ) . '" ' : ''); - $html = ' '; - return $html; - } -} - diff --git a/workflow/engine/classes/entities/AppSolrQueue.php b/workflow/engine/classes/entities/Entity_AppSolrQueue.php similarity index 89% rename from workflow/engine/classes/entities/AppSolrQueue.php rename to workflow/engine/classes/entities/Entity_AppSolrQueue.php index 8df7933fa..724845498 100644 --- a/workflow/engine/classes/entities/AppSolrQueue.php +++ b/workflow/engine/classes/entities/Entity_AppSolrQueue.php @@ -4,7 +4,10 @@ require_once ('Base.php'); /** * Application Solr Queue */ -class Entity_AppSolrQueue extends Entity_Base + +/** + * Application Solr Queue + */class Entity_AppSolrQueue extends Entity_Base { public $appUid = ''; public $appChangeDate = ''; diff --git a/workflow/engine/classes/entities/Base.php b/workflow/engine/classes/entities/Entity_Base.php similarity index 99% rename from workflow/engine/classes/entities/Base.php rename to workflow/engine/classes/entities/Entity_Base.php index 5aa927469..9bcb878e1 100644 --- a/workflow/engine/classes/entities/Base.php +++ b/workflow/engine/classes/entities/Entity_Base.php @@ -1,5 +1,6 @@ - auth Setup"; - $this->auth = $auth; - } - - public function setwsdlurl($wsdl) - { - //print "
- wsdl Setup"; - $this->wsdlurl = $wsdl; - //var_dump($wsdl); - } - - public function loadSOAPClient() - { - try { - // we unregister the current HTTP wrapper - stream_wrapper_unregister('http'); - // we register the new HTTP wrapper - //$client = new PMServiceProviderNTLMStream($this->auth); - PMServiceProviderNTLMStream::setAuthStream($this->auth); - stream_wrapper_register('http', 'PMServiceProviderNTLMStream') or die("Failed to register protocol"); - - // $this->client = new PMServiceNTLMSoapClient($this->wsdlurl, array('trace' => 1, 'auth' => $this->auth));// Hugo's code - $this->client = new PMServiceNTLMSoapClient($this->wsdlurl, array('trace' => 1)); // Ankit's Code - $this->client->setAuthClient($this->auth); - return true; - } catch (Exception $e) { - echo $e; - exit(); - } - } - - public function callWsMethod($methodName, $paramArray) - { - - try { - if ($methodName == 'DeleteDws' || $methodName == 'GetListCollection') { - $strResult = ""; - $strResult = $this->client->$methodName($paramArray = ""); - return $strResult; - } else { - $strResult = ""; - $strResult = $this->client->$methodName($paramArray); - return $strResult; - } - } catch (SoapFault $fault) { - echo 'Fault code: ' . $fault->faultcode; - echo 'Fault string: ' . $fault->faultstring; - } - stream_wrapper_restore('http'); - } -} - -class DestinationUrlCollection -{ - public $string; -} - -; - -class FieldInformation -{ -} - -class FieldInformationCollection -{ - public $FieldInformation; -} class pmTrSharepointClass { @@ -443,4 +365,3 @@ class pmTrSharepointClass } } } - diff --git a/workflow/engine/classes/triggers/Wscaller.php b/workflow/engine/classes/triggers/Wscaller.php new file mode 100644 index 000000000..467f818b6 --- /dev/null +++ b/workflow/engine/classes/triggers/Wscaller.php @@ -0,0 +1,72 @@ +- auth Setup"; + $this->auth = $auth; + } + + public function setwsdlurl($wsdl) + { + //print "
- wsdl Setup"; + $this->wsdlurl = $wsdl; + //var_dump($wsdl); + } + + public function loadSOAPClient() + { + try { + // we unregister the current HTTP wrapper + stream_wrapper_unregister('http'); + // we register the new HTTP wrapper + //$client = new PMServiceProviderNTLMStream($this->auth); + PMServiceProviderNTLMStream::setAuthStream($this->auth); + stream_wrapper_register('http', 'PMServiceProviderNTLMStream') or die("Failed to register protocol"); + + // $this->client = new PMServiceNTLMSoapClient($this->wsdlurl, array('trace' => 1, 'auth' => $this->auth));// Hugo's code + $this->client = new PMServiceNTLMSoapClient($this->wsdlurl, array('trace' => 1)); // Ankit's Code + $this->client->setAuthClient($this->auth); + return true; + } catch (Exception $e) { + echo $e; + exit(); + } + } + + public function callWsMethod($methodName, $paramArray) + { + + try { + if ($methodName == 'DeleteDws' || $methodName == 'GetListCollection') { + $strResult = ""; + $strResult = $this->client->$methodName($paramArray = ""); + return $strResult; + } else { + $strResult = ""; + $strResult = $this->client->$methodName($paramArray); + return $strResult; + } + } catch (SoapFault $fault) { + echo 'Fault code: ' . $fault->faultcode; + echo 'Fault string: ' . $fault->faultstring; + } + stream_wrapper_restore('http'); + } +} diff --git a/workflow/engine/classes/triggers/api/class.zimbraApi.php b/workflow/engine/classes/triggers/api/Zimbra.php similarity index 96% rename from workflow/engine/classes/triggers/api/class.zimbraApi.php rename to workflow/engine/classes/triggers/api/Zimbra.php index 0a564f8b7..812bb6a02 100644 --- a/workflow/engine/classes/triggers/api/class.zimbraApi.php +++ b/workflow/engine/classes/triggers/api/Zimbra.php @@ -10,7 +10,17 @@ * @author Zachary Tirrell * @GPL 2007, Plymouth State University, ITS */ -class Zimbra + +/** + * zimbra.class.php + * + * Zimbra API + * + * @version 1.3 + * @module zimbra.class.php + * @author Zachary Tirrell + * @GPL 2007, Plymouth State University, ITS + */class Zimbra { public $debug = false; @@ -1296,66 +1306,3 @@ class Zimbra // end getDocId } - -// end Zimbra class -// annoying sorting functions for getTasks... -// I don't know how to make usort calls to internal OO functions -// if someone knows how, please fix this :) - -/** - * zimbra_startSort - * - * sort of zimbra elements - * - * @since version 1.0 - * @access public - * @param array $task_a - * @param array $task_b - * @return int (($task_a['dueDate']-$task_a['dur']) < ($task_b['dueDate']-$task_b['dur'])) ? -1 : 1 - */ -function zimbra_startSort($task_a, $task_b) -{ - if (($task_a['dueDate'] - $task_a['dur']) == ($task_b['dueDate'] - $task_b['dur'])) { - return ($task_a['name'] < $task_b['name']) ? - 1 : 1; - } - return (($task_a['dueDate'] - $task_a['dur']) < ($task_b['dueDate'] - $task_b['dur'])) ? - 1 : 1; -} - -/** - * zimbra_dueSort - * - * sort by dueDate - * - * @since version 1.0 - * @access public - * @param array $task_a - * @param array $task_b - * @return int ($task_a['dueDate'] < $task_b['dueDate']) ? -1 : 1 - */ -function zimbra_dueSort($task_a, $task_b) -{ - if ($task_a['dueDate'] == $task_b['dueDate']) { - return ($task_a['name'] < $task_b['name']) ? - 1 : 1; - } - return ($task_a['dueDate'] < $task_b['dueDate']) ? - 1 : 1; -} - -/** - * zimbra_nameSort - * - * sort by name - * - * @since version 1.0 - * @access public - * @param array $task_a - * @param array $task_b - * @return int ($task_a['name'] < $task_b['name']) ? -1 : 1 - */ -function zimbra_nameSort($task_a, $task_b) -{ - if ($task_a['name'] == $task_b['name']) { - return 0; - } - return ($task_a['name'] < $task_b['name']) ? - 1 : 1; -} - diff --git a/workflow/engine/classes/triggers/class.pmTrZimbra.php b/workflow/engine/classes/triggers/class.pmTrZimbra.php index 2873a5258..75d5a42f5 100644 --- a/workflow/engine/classes/triggers/class.pmTrZimbra.php +++ b/workflow/engine/classes/triggers/class.pmTrZimbra.php @@ -40,7 +40,6 @@ * @return string | $result | Response | * */ -include_once PATH_CORE . 'classes' . PATH_SEP . 'triggers' . PATH_SEP . 'api' . PATH_SEP . "class.zimbraApi.php"; function getZimbraFolder($ServerUrl, $username, $preAuthKey, $folderName, $protocol = 'http') { diff --git a/workflow/engine/menus/setup.php b/workflow/engine/menus/setup.php index 989248d22..902690193 100644 --- a/workflow/engine/menus/setup.php +++ b/workflow/engine/menus/setup.php @@ -249,7 +249,6 @@ if ($RBAC->userCanAccess('PM_SETUP') === 1) { /*----------------------------------********---------------------------------*/ } /*----------------------------------********---------------------------------*/ -require_once 'classes/class.pmLicenseManager.php'; if (!file_exists(PATH_DATA_SITE . "plugin.singleton")) { require_once PATH_CORE . 'methods' . PATH_SEP . 'enterprise' . PATH_SEP . 'enterprise.php'; $enterprise = new enterprisePlugin('enterprise');