Merge remote-tracking branch 'origin/bugfix/HOR-3670' into release/3.2.2
This commit is contained in:
@@ -68,7 +68,6 @@
|
||||
"workflow/engine/includes/",
|
||||
"thirdparty/smarty/libs/Smarty.class.php",
|
||||
"thirdparty/jsmin/jsmin.php",
|
||||
"thirdparty/libchart/classes/",
|
||||
"thirdparty/pear",
|
||||
"thirdparty/html2ps_pdf",
|
||||
"thirdparty/phing",
|
||||
@@ -80,7 +79,8 @@
|
||||
"gulliver/includes/smarty_plugins/function.pmos.php",
|
||||
"thirdparty/pear/PEAR.php",
|
||||
"thirdparty/HTMLPurifier/HTMLPurifier.auto.php",
|
||||
"workflow/engine/classes/class.pmFunctions.php"
|
||||
"workflow/engine/classes/class.pmFunctions.php",
|
||||
"workflow/engine/src/ProcessMaker/Util/helpers.php"
|
||||
]
|
||||
},
|
||||
"autoload-dev": {
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
namespace Maveriks;
|
||||
|
||||
use Maveriks\Util;
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
use ProcessMaker\Services;
|
||||
use ProcessMaker\Services\Api;
|
||||
use Luracast\Restler\RestException;
|
||||
use Illuminate\Foundation\Http\Kernel;
|
||||
use G;
|
||||
|
||||
/**
|
||||
* Web application bootstrap
|
||||
@@ -287,7 +289,7 @@ class WebApplication
|
||||
Services\Api::setWorkspace(SYS_SYS);
|
||||
$cacheDir = defined("PATH_WORKSPACE") ? PATH_WORKSPACE : (defined("PATH_C")? PATH_C: sys_get_temp_dir());
|
||||
|
||||
$sysConfig = \PmSystem::getSystemConfiguration();
|
||||
$sysConfig = System::getSystemConfiguration();
|
||||
|
||||
\Luracast\Restler\Defaults::$cacheDirectory = $cacheDir;
|
||||
$productionMode = (bool) !(isset($sysConfig["service_api_debug"]) && $sysConfig["service_api_debug"]);
|
||||
@@ -448,7 +450,8 @@ class WebApplication
|
||||
define("PATH_CONTROLLERS", PATH_CORE . "controllers" . PATH_SEP);
|
||||
define("PATH_SERVICES_REST", PATH_CORE . "services" . PATH_SEP . "rest" . PATH_SEP);
|
||||
|
||||
$arraySystemConfiguration = \PmSystem::getSystemConfiguration();
|
||||
G::defineConstants();
|
||||
$arraySystemConfiguration = System::getSystemConfiguration();
|
||||
|
||||
ini_set('date.timezone', $arraySystemConfiguration['time_zone']); //Set Time Zone
|
||||
|
||||
@@ -500,7 +503,7 @@ class WebApplication
|
||||
exit(0);
|
||||
}
|
||||
|
||||
$arraySystemConfiguration = \PmSystem::getSystemConfiguration('', '', SYS_SYS);
|
||||
$arraySystemConfiguration = System::getSystemConfiguration('', '', SYS_SYS);
|
||||
|
||||
//Do not change any of these settings directly, use env.ini instead
|
||||
ini_set('display_errors', $arraySystemConfiguration['display_errors']);
|
||||
|
||||
@@ -1505,7 +1505,7 @@ function get_infoOnPM($workspace) {
|
||||
|
||||
if( defined("DB_HOST") ) {
|
||||
|
||||
$dbNetView = new NET(DB_HOST);
|
||||
$dbNetView = new Net(DB_HOST);
|
||||
$dbNetView->loginDbServer(DB_USER, DB_PASS);
|
||||
|
||||
$dbConns = new DbConnections('');
|
||||
|
||||
@@ -54,7 +54,7 @@ if (! is_file( XMLFORM_AJAX_PATH . $xmlFile )) {
|
||||
}
|
||||
}
|
||||
|
||||
$G_FORM = new form( $xmlFile, $sPath );
|
||||
$G_FORM = new Form( $xmlFile, $sPath );
|
||||
$G_FORM->id = urlDecode( $_POST['form'] );
|
||||
$G_FORM->values = isset( $_SESSION[$G_FORM->id] ) ? $_SESSION[$G_FORM->id] : array ();
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
|
||||
use ProcessMaker\Core\System;
|
||||
|
||||
/**
|
||||
* class.bootstrap.php
|
||||
*
|
||||
@@ -41,7 +44,7 @@ class Bootstrap
|
||||
|
||||
public static function getSystemConfiguration($globalIniFile = '', $wsIniFile = '', $wsName = '')
|
||||
{
|
||||
return PmSystem::getSystemConfiguration($globalIniFile, $wsIniFile, $wsName);
|
||||
return System::getSystemConfiguration($globalIniFile, $wsIniFile, $wsName);
|
||||
}
|
||||
/**
|
||||
* @deprecated 3.2.2, We keep this function only for backwards compatibility because is used in the plugin manager
|
||||
@@ -919,7 +922,7 @@ class Bootstrap
|
||||
if (((in_array($browserName, $enabledBrowsers)) || (in_array('ALL', $enabledBrowsers))) && (!(in_array($browserName, $disabledBrowsers)))) {
|
||||
if ($cssFileInfo['__ATTRIBUTES__']['file'] == 'rtl.css') {
|
||||
|
||||
$oServerConf = & serverConf::getSingleton();
|
||||
$oServerConf = & ServerConf::getSingleton();
|
||||
if (!(defined('SYS_LANG'))) {
|
||||
if (isset($_SERVER['HTTP_REFERER'])) {
|
||||
$syss = explode('://', $_SERVER['HTTP_REFERER']);
|
||||
@@ -1030,7 +1033,7 @@ class Bootstrap
|
||||
*/
|
||||
public function getCheckSum($files)
|
||||
{
|
||||
$key = PmSystem::getVersion();
|
||||
$key = System::getVersion();
|
||||
|
||||
if (!is_array($files)) {
|
||||
$tmp = $files;
|
||||
@@ -1923,7 +1926,7 @@ class Bootstrap
|
||||
/* Fix to prevent use uxs skin outside siplified interface,
|
||||
because that skin is not compatible with others interfaces */
|
||||
if ($args['SYS_SKIN'] == 'uxs' && $args['SYS_COLLECTION'] != 'home' && $args['SYS_COLLECTION'] != 'cases') {
|
||||
$config = PmSystem::getSystemConfiguration();
|
||||
$config = System::getSystemConfiguration();
|
||||
$args['SYS_SKIN'] = $config['default_skin'];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
|
||||
use ProcessMaker\Core\System;
|
||||
|
||||
if (!defined("T_ML_COMMENT")) {
|
||||
define("T_ML_COMMENT", T_COMMENT);
|
||||
} else {
|
||||
@@ -26,10 +29,10 @@ class CodeScanner
|
||||
if (!is_null($option)) {
|
||||
switch (gettype($option)) {
|
||||
case 'string':
|
||||
$workspace = new workspaceTools($option);
|
||||
$workspace = new WorkspaceTools($option);
|
||||
|
||||
if ($workspace->workspaceExists()) {
|
||||
$arraySystemConfiguration = PmSystem::getSystemConfiguration('', '', $workspace->name);
|
||||
$arraySystemConfiguration = System::getSystemConfiguration('', '', $workspace->name);
|
||||
$flag = (int)($arraySystemConfiguration['enable_blacklist']) == 1;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
class filterForm extends form
|
||||
class filterForm extends Form
|
||||
{
|
||||
public $cols = 3;
|
||||
public $type = 'filterform';
|
||||
|
||||
@@ -1,34 +1,8 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* class.database_base.php
|
||||
*
|
||||
* @package gulliver.system
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* Class Form
|
||||
*
|
||||
* @author David S. Callizaya S. <davidsantos@colosa.com>
|
||||
* @package gulliver.system
|
||||
* @access public
|
||||
*/
|
||||
@@ -57,7 +31,6 @@ class Form extends XmlForm
|
||||
/**
|
||||
* Function setDefaultValues
|
||||
*
|
||||
* @author David S. Callizaya S. <davidsantos@colosa.com>
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
@@ -109,7 +82,6 @@ class Form extends XmlForm
|
||||
/**
|
||||
* Function Form
|
||||
*
|
||||
* @author David S. Callizaya S. <davidsantos@colosa.com>
|
||||
* @access public
|
||||
* @param string filename
|
||||
* @param string home
|
||||
@@ -118,7 +90,7 @@ class Form extends XmlForm
|
||||
* @param string $visual_frontend
|
||||
* @return string
|
||||
*/
|
||||
public function Form ($filename, $home = '', $language = '', $forceParse = false, $visual_frontend = null)
|
||||
public function __construct ($filename, $home = '', $language = '', $forceParse = false, $visual_frontend = null)
|
||||
{
|
||||
$this->visual_frontend = $visual_frontend;
|
||||
if ($language === '') {
|
||||
@@ -218,7 +190,7 @@ class Form extends XmlForm
|
||||
$values = $this->values;
|
||||
$aValuekeys = array_keys( $values );
|
||||
if (isset( $aValuekeys[0] ) && ((int) $aValuekeys[0] == 1)) {
|
||||
$values = XmlForm_Field_Grid::flipValues( $values );
|
||||
$values = XmlFormFieldGrid::flipValues( $values );
|
||||
}
|
||||
//TODO: Review when $values of a grid has only one row it is converted as a $values for a list (when template="grid" at addContent())
|
||||
if (is_array( reset( $values ) )) {
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
|
||||
/**
|
||||
@@ -865,7 +866,7 @@ class G
|
||||
/* Fix to prevent use uxs skin outside siplified interface,
|
||||
because that skin is not compatible with others interfaces*/
|
||||
if ($args['SYS_SKIN'] == 'uxs' && $args['SYS_COLLECTION'] != 'home' && $args['SYS_COLLECTION'] != 'cases') {
|
||||
$config = PmSystem::getSystemConfiguration();
|
||||
$config = System::getSystemConfiguration();
|
||||
$args['SYS_SKIN'] = $config['default_skin'];
|
||||
}
|
||||
|
||||
@@ -1011,7 +1012,7 @@ class G
|
||||
|
||||
if (((in_array($browserName, $enabledBrowsers)) || (in_array('ALL', $enabledBrowsers)))&&(!(in_array($browserName, $disabledBrowsers)))) {
|
||||
if ($cssFileInfo['__ATTRIBUTES__']['file'] == 'rtl.css') {
|
||||
$oServerConf =& serverConf::getSingleton();
|
||||
$oServerConf =& ServerConf::getSingleton();
|
||||
if (!(defined('SYS_LANG'))) {
|
||||
if (isset($_SERVER['HTTP_REFERER'])) {
|
||||
$syss = explode('://', $_SERVER['HTTP_REFERER']);
|
||||
@@ -4649,7 +4650,7 @@ class G
|
||||
*/
|
||||
public function getCheckSum ($files)
|
||||
{
|
||||
$key = PmSystem::getVersion();
|
||||
$key = System::getVersion();
|
||||
|
||||
if (! is_array( $files )) {
|
||||
$tmp = $files;
|
||||
@@ -5280,7 +5281,7 @@ class G
|
||||
|
||||
public static function browserCacheFilesGetUid()
|
||||
{
|
||||
$sysConf = PmSystem::getSystemConfiguration(PATH_CONFIG . "env.ini");
|
||||
$sysConf = System::getSystemConfiguration(PATH_CONFIG . "env.ini");
|
||||
|
||||
return (isset($sysConf["browser_cache_files_uid"]))? $sysConf["browser_cache_files_uid"] : null;
|
||||
}
|
||||
@@ -5405,7 +5406,7 @@ class G
|
||||
*/
|
||||
public static function log($message, $pathData = PATH_DATA, $file = 'cron.log')
|
||||
{
|
||||
$config = PmSystem::getSystemConfiguration();
|
||||
$config = System::getSystemConfiguration();
|
||||
|
||||
|
||||
$oLogger = Logger::getSingleton($pathData, PATH_SEP, $file);
|
||||
@@ -5823,6 +5824,19 @@ class G
|
||||
$_SESSION['_DATA_TRIGGER_']['_TRI_LOG_'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the Processmaker constants.
|
||||
*
|
||||
*/
|
||||
public static function defineConstants()
|
||||
{
|
||||
//Moved from Enterprise class.
|
||||
if (file_exists(PATH_METHODS . "login/version-pmos.php")) {
|
||||
include (PATH_METHODS . "login/version-pmos.php");
|
||||
}
|
||||
//Removed default version from code.
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -5913,8 +5927,3 @@ function eprintln ($s = "", $c = null)
|
||||
print "$s\n";
|
||||
}
|
||||
}
|
||||
|
||||
function __ ($msgID, $lang = SYS_LANG, $data = null)
|
||||
{
|
||||
return G::LoadTranslation( $msgID, $lang, $data );
|
||||
}
|
||||
|
||||
@@ -360,7 +360,7 @@ class headPublisher
|
||||
//$head .= $this->getExtJsStylesheets();
|
||||
$head .= $this->getExtJsScripts();
|
||||
$head .= $this->getExtJsVariablesScript();
|
||||
$oServerConf = & serverConf::getSingleton();
|
||||
$oServerConf = & ServerConf::getSingleton();
|
||||
if ($oServerConf->isRtl(SYS_LANG)) {
|
||||
$head = $head . " <script type=\"text/javascript\" src=\"" . G::browserCacheFilesUrl("/js/ext/extjs_rtl.js") . "\"></script>\n";
|
||||
}
|
||||
@@ -751,7 +751,7 @@ class headPublisher
|
||||
$views = array();
|
||||
$keyState = "extJsViewState";
|
||||
$prefixExtJs = "ys-";
|
||||
$oServerConf = &serverConf::getSingleton();
|
||||
$oServerConf = &ServerConf::getSingleton();
|
||||
$deleteCache = true;
|
||||
|
||||
$sjson = $oServerConf->getProperty($keyState);
|
||||
|
||||
@@ -1,38 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* class.htmlArea.php
|
||||
*
|
||||
* @package gulliver.system
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @package gulliver.system
|
||||
*
|
||||
*/
|
||||
|
||||
class XmlForm_Field_HTML extends XmlForm_Field_Textarea
|
||||
class XmlFormFieldHTML extends XmlFormFieldTextarea
|
||||
{
|
||||
/* //'default','office2003','silver'
|
||||
var $skin = 'default';
|
||||
|
||||
@@ -90,7 +90,7 @@ class pagedTable
|
||||
public $name = 'pagedTable';
|
||||
public $id = 'A1';
|
||||
public $disableFooter = false;
|
||||
//This attribute is used to set STYLES to groups of TD, using the field type "cellMark" (see XmlForm_Field_cellMark)
|
||||
//This attribute is used to set STYLES to groups of TD, using the field type "cellMark" (see XmlFormFieldCellMark)
|
||||
public $tdStyle = '';
|
||||
public $tdClass = '';
|
||||
//Config Save definition
|
||||
|
||||
@@ -192,7 +192,7 @@ class Publisher
|
||||
|
||||
if (($this->publishType == 'dynaform') && (($Part['Template'] == 'xmlform') || ($Part['Template'] == 'xmlform_preview'))) {
|
||||
$dynaformShow = (isset( $G_FORM->printdynaform ) && ($G_FORM->printdynaform)) ? 'gulliver/dynaforms_OptionsPrint' : 'gulliver/dynaforms_Options';
|
||||
$G_FORM->fields = G::array_merges( array ('__DYNAFORM_OPTIONS' => new XmlForm_Field_XmlMenu( new Xml_Node( '__DYNAFORM_OPTIONS', 'complete', '', array ('type' => 'xmlmenu','xmlfile' => $dynaformShow, 'parentFormId' => $G_FORM->id
|
||||
$G_FORM->fields = G::array_merges( array ('__DYNAFORM_OPTIONS' => new XmlFormFieldXmlMenu( new Xml_Node( '__DYNAFORM_OPTIONS', 'complete', '', array ('type' => 'xmlmenu','xmlfile' => $dynaformShow, 'parentFormId' => $G_FORM->id
|
||||
) ), SYS_LANG, PATH_XMLFORM, $G_FORM )
|
||||
), $G_FORM->fields );
|
||||
}
|
||||
@@ -355,7 +355,7 @@ class Publisher
|
||||
/* End Block */
|
||||
|
||||
/* Start Block: PagedTable Right Click */
|
||||
$pm = new popupMenu( 'gulliver/pagedTable_PopupMenu' );
|
||||
$pm = new PopupMenu( 'gulliver/pagedTable_PopupMenu' );
|
||||
$pm->name = $oTable->id;
|
||||
$fields = array_keys( $oTable->fields );
|
||||
foreach ($fields as $f) {
|
||||
@@ -369,7 +369,7 @@ class Publisher
|
||||
default:
|
||||
$label = ($oTable->fields[$f]['Label'] != '') ? $oTable->fields[$f]['Label'] : $f;
|
||||
$label = str_replace( "\n", ' ', $label );
|
||||
$pm->fields[$f] = new XmlForm_Field_popupOption( new Xml_Node( $f, 'complete', '', array ('label' => $label,'type' => 'popupOption','launch' => $oTable->id . '.showHideField("' . $f . '")' ) ) );
|
||||
$pm->fields[$f] = new XmlFormFieldPopupOption( new Xml_Node( $f, 'complete', '', array ('label' => $label,'type' => 'popupOption','launch' => $oTable->id . '.showHideField("' . $f . '")' ) ) );
|
||||
$pm->values[$f] = '';
|
||||
}
|
||||
}
|
||||
@@ -430,7 +430,7 @@ class Publisher
|
||||
$_SESSION[$G_FORM->id] = $G_FORM->values;
|
||||
}
|
||||
|
||||
$oTable = new propelTable();
|
||||
$oTable = new PropelTable();
|
||||
$oTable->template = $Part['Template'];
|
||||
$oTable->criteria = $Part['Content'];
|
||||
if (isset( $Part['ajaxServer'] ) && ($Part['ajaxServer'] !== '')) {
|
||||
@@ -461,7 +461,7 @@ class Publisher
|
||||
/* End Block */
|
||||
|
||||
/* Start Block: PagedTable Right Click */
|
||||
$pm = new popupMenu( 'gulliver/pagedTable_PopupMenu' );
|
||||
$pm = new PopupMenu( 'gulliver/pagedTable_PopupMenu' );
|
||||
$sc = $pm->renderPopup( $oTable->id, $oTable->fields );
|
||||
/* End Block */
|
||||
//krumo ( $Part );
|
||||
|
||||
@@ -532,7 +532,7 @@ class RBAC
|
||||
{
|
||||
/*----------------------------------********---------------------------------*/
|
||||
|
||||
$licenseManager =& pmLicenseManager::getSingleton();
|
||||
$licenseManager =& PmLicenseManager::getSingleton();
|
||||
if (in_array(G::encryptOld($licenseManager->result), array('38afd7ae34bd5e3e6fc170d8b09178a3', 'ba2b45bdc11e2a4a6e86aab2ac693cbb'))) {
|
||||
return -7;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
* to allow NTLM authentication throw soap connection
|
||||
*/
|
||||
|
||||
use ProcessMaker\Core\System;
|
||||
|
||||
/**
|
||||
*
|
||||
* @package gulliver.system
|
||||
@@ -200,7 +202,7 @@ class soapNtlm
|
||||
curl_setopt( $this->ch, CURLOPT_USERPWD, $this->getuser() . ':' . $this->getpassword() ); // Ankit's code
|
||||
//Apply proxy settings
|
||||
if (class_exists( 'System' )) {
|
||||
$sysConf = PmSystem::getSystemConfiguration();
|
||||
$sysConf = System::getSystemConfiguration();
|
||||
$sysConf = $filter->xssFilterHard($sysConf);
|
||||
if ($sysConf['proxy_host'] != '') {
|
||||
curl_setopt( $this->ch, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : '') );
|
||||
@@ -243,7 +245,7 @@ class NTLMSoapClient extends SoapClient
|
||||
|
||||
//Apply proxy settings
|
||||
if (class_exists( 'System' )) {
|
||||
$sysConf = PmSystem::getSystemConfiguration();
|
||||
$sysConf = System::getSystemConfiguration();
|
||||
if ($sysConf['proxy_host'] != '') {
|
||||
curl_setopt( $ch, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : '') );
|
||||
if ($sysConf['proxy_port'] != '') {
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* XmlForm_Field_HTML class definition
|
||||
* XmlFormFieldWYSIWYGEditor class definition
|
||||
* It is useful to see dynaforms how are built
|
||||
*
|
||||
* @package gulliver.system
|
||||
@@ -36,7 +36,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
class XmlForm_Field_WYSIWYG_EDITOR extends XmlForm_Field
|
||||
class XmlFormFieldWYSIWYGEditor extends XmlFormField
|
||||
{
|
||||
public $width = '100%';
|
||||
public $height = '300';
|
||||
@@ -76,7 +76,7 @@ class XmlForm_Field_WYSIWYG_EDITOR extends XmlForm_Field
|
||||
{
|
||||
$editorDefinition = 'tinyMCE.baseURL = "/js/tinymce/jscripts/tiny_mce"; ';
|
||||
$editorDefinition .= 'var domainURL = "/sys'.SYS_SYS.'/'.SYS_LANG.'/'.SYS_SKIN.'/"';
|
||||
$serverConf =& serverConf::getSingleton();
|
||||
$serverConf =& ServerConf::getSingleton();
|
||||
|
||||
switch ($this->editorType){
|
||||
case 'EMAIL_TEMPLATE':
|
||||
|
||||
@@ -30,21 +30,21 @@
|
||||
*
|
||||
* @package gulliver.system
|
||||
*/
|
||||
class xmlMenu extends form
|
||||
class xmlMenu extends Form
|
||||
{
|
||||
public $type = 'xmlmenu';
|
||||
public $parentFormId;
|
||||
}
|
||||
|
||||
/**
|
||||
* XmlForm_Field_XmlMenu
|
||||
* XmlFormFieldXmlMenu
|
||||
*
|
||||
* extends XmlForm_Field
|
||||
* extends XmlFormField
|
||||
*
|
||||
* @package gulliver.system
|
||||
*
|
||||
*/
|
||||
class XmlForm_Field_XmlMenu extends XmlForm_Field
|
||||
class XmlFormFieldXmlMenu extends XmlFormField
|
||||
{
|
||||
public $xmlfile = '';
|
||||
public $type = 'xmlmenuDyn';
|
||||
@@ -54,7 +54,7 @@ class XmlForm_Field_XmlMenu extends XmlForm_Field
|
||||
public $parentFormId;
|
||||
|
||||
/**
|
||||
* XmlForm_Field_XmlMenu
|
||||
* XmlFormFieldXmlMenu
|
||||
*
|
||||
* @param string $xmlNode
|
||||
* @param string $lang default value 'en'
|
||||
@@ -63,9 +63,9 @@ class XmlForm_Field_XmlMenu extends XmlForm_Field
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
public function XmlForm_Field_XmlMenu ($xmlNode, $lang = 'en', $home = '', $owner = null)
|
||||
public function XmlFormFieldXmlMenu ($xmlNode, $lang = 'en', $home = '', $owner = null)
|
||||
{
|
||||
parent::XmlForm_Field( $xmlNode, $lang, $home, $owner );
|
||||
parent::__construct( $xmlNode, $lang, $home, $owner );
|
||||
$this->home = $home;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,36 +1,10 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* class.xmlformExtension.php
|
||||
*
|
||||
* @package gulliver.system
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @package gulliver.system
|
||||
*/
|
||||
class XmlForm_Field_Label extends XmlForm_Field
|
||||
class XmlFormFieldLabel extends XmlFormField
|
||||
{
|
||||
public $withoutValue = true;
|
||||
public $align = 'left';
|
||||
@@ -43,7 +17,7 @@ class XmlForm_Field_Label extends XmlForm_Field
|
||||
*
|
||||
* @package gulliver.system
|
||||
*/
|
||||
class XmlForm_Field_cellMark extends XmlForm_Field
|
||||
class XmlFormFieldCellMark extends XmlFormField
|
||||
{
|
||||
/* Defines the style of the next tds
|
||||
of the pagedTable.
|
||||
@@ -91,14 +65,14 @@ class XmlForm_Field_cellMark extends XmlForm_Field
|
||||
}
|
||||
|
||||
/**
|
||||
* XmlForm_Field_DVEditor
|
||||
* XmlFormFieldDVEditor
|
||||
*
|
||||
* extends XmlForm_Field
|
||||
* extends XmlFormField
|
||||
*
|
||||
* @package gulliver.system
|
||||
*
|
||||
*/
|
||||
class XmlForm_Field_DVEditor extends XmlForm_Field
|
||||
class XmlFormFieldDVEditor extends XmlFormField
|
||||
{
|
||||
public $toolbarSet = 'toolbar2lines.html';
|
||||
public $width = '90%';
|
||||
@@ -150,7 +124,7 @@ class XmlForm_Field_DVEditor extends XmlForm_Field
|
||||
*
|
||||
* @package gulliver.system
|
||||
*/
|
||||
class XmlForm_Field_FastSearch extends XmlForm_Field_Text
|
||||
class XmlFormFieldFastSearch extends XmlFormFieldText
|
||||
{
|
||||
public $onkeypress = "if (event.keyCode===13)@#PAGED_TABLE_ID.doFastSearch(this.value);if (event.keyCode===13)return false;";
|
||||
public $colAlign = "right";
|
||||
|
||||
@@ -81,4 +81,4 @@
|
||||
if (!is_dir(PATH_SMARTY_C)) G::mk_dir(PATH_SMARTY_C);
|
||||
if (!is_dir(PATH_SMARTY_CACHE)) G::mk_dir(PATH_SMARTY_CACHE);
|
||||
|
||||
?>
|
||||
G::defineConstants();
|
||||
|
||||
@@ -170,7 +170,7 @@ class WorkflowTestCase extends TestCase
|
||||
throw new \Exception('To continue please put a valid license at features/resources');
|
||||
}
|
||||
G::LoadClass('pmLicenseManager');
|
||||
$licenseManager = new pmLicenseManager();
|
||||
$licenseManager = new PmLicenseManager();
|
||||
$licenseManager->installLicense($licenseFile[0]);
|
||||
}
|
||||
|
||||
|
||||
1991
thirdparty/pear/Archive/Tar.php
vendored
1991
thirdparty/pear/Archive/Tar.php
vendored
File diff suppressed because it is too large
Load Diff
3620
thirdparty/pear/Archive/Zip.php
vendored
3620
thirdparty/pear/Archive/Zip.php
vendored
File diff suppressed because it is too large
Load Diff
905
thirdparty/pear/class.nusoap_base.php
vendored
905
thirdparty/pear/class.nusoap_base.php
vendored
@@ -1,905 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
$Id: class.nusoap_base.php,v 1.43 2005/08/04 01:27:42 snichol Exp $
|
||||
|
||||
NuSOAP - Web Services Toolkit for PHP
|
||||
|
||||
Copyright (c) 2002 NuSphere Corporation
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
If you have any questions or comments, please email:
|
||||
|
||||
Dietrich Ayala
|
||||
dietrich@ganx4.com
|
||||
http://dietrich.ganx4.com/nusoap
|
||||
|
||||
NuSphere Corporation
|
||||
http://www.nusphere.com
|
||||
|
||||
*/
|
||||
|
||||
/* load classes
|
||||
|
||||
// necessary classes
|
||||
require_once('class.soapclient.php');
|
||||
require_once('class.soap_val.php');
|
||||
require_once('class.soap_parser.php');
|
||||
require_once('class.soap_fault.php');
|
||||
|
||||
// transport classes
|
||||
require_once('class.soap_transport_http.php');
|
||||
|
||||
// optional add-on classes
|
||||
require_once('class.xmlschema.php');
|
||||
require_once('class.wsdl.php');
|
||||
|
||||
// server class
|
||||
require_once('class.soap_server.php');*/
|
||||
|
||||
// class variable emulation
|
||||
// cf. http://www.webkreator.com/php/techniques/php-static-class-variables.html
|
||||
$GLOBALS['_transient']['static']['nusoap_base']->globalDebugLevel = 9;
|
||||
|
||||
/**
|
||||
*
|
||||
* nusoap_base
|
||||
*
|
||||
* @author Dietrich Ayala <dietrich@ganx4.com>
|
||||
* @version $Id: class.nusoap_base.php,v 1.43 2005/08/04 01:27:42 snichol Exp $
|
||||
* @access public
|
||||
*/
|
||||
class nusoap_base {
|
||||
/**
|
||||
* Identification for HTTP headers.
|
||||
*
|
||||
* @var string
|
||||
* @access private
|
||||
*/
|
||||
var $title = 'NuSOAP';
|
||||
/**
|
||||
* Version for HTTP headers.
|
||||
*
|
||||
* @var string
|
||||
* @access private
|
||||
*/
|
||||
var $version = '0.7.2';
|
||||
/**
|
||||
* CVS revision for HTTP headers.
|
||||
*
|
||||
* @var string
|
||||
* @access private
|
||||
*/
|
||||
var $revision = '$Revision: 1.43 $';
|
||||
/**
|
||||
* Current error string (manipulated by getError/setError)
|
||||
*
|
||||
* @var string
|
||||
* @access private
|
||||
*/
|
||||
var $error_str = '';
|
||||
/**
|
||||
* Current debug string (manipulated by debug/appendDebug/clearDebug/getDebug/getDebugAsXMLComment)
|
||||
*
|
||||
* @var string
|
||||
* @access private
|
||||
*/
|
||||
var $debug_str = '';
|
||||
/**
|
||||
* toggles automatic encoding of special characters as entities
|
||||
* (should always be true, I think)
|
||||
*
|
||||
* @var boolean
|
||||
* @access private
|
||||
*/
|
||||
var $charencoding = true;
|
||||
/**
|
||||
* the debug level for this instance
|
||||
*
|
||||
* @var integer
|
||||
* @access private
|
||||
*/
|
||||
var $debugLevel;
|
||||
|
||||
/**
|
||||
* set schema version
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
var $XMLSchemaVersion = 'http://www.w3.org/2001/XMLSchema';
|
||||
|
||||
/**
|
||||
* charset encoding for outgoing messages
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
var $soap_defencoding = 'ISO-8859-1';
|
||||
//var $soap_defencoding = 'UTF-8';
|
||||
|
||||
/**
|
||||
* namespaces in an array of prefix => uri
|
||||
*
|
||||
* this is "seeded" by a set of constants, but it may be altered by code
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $namespaces = array(
|
||||
'SOAP-ENV' => 'http://schemas.xmlsoap.org/soap/envelope/',
|
||||
'xsd' => 'http://www.w3.org/2001/XMLSchema',
|
||||
'xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
|
||||
'SOAP-ENC' => 'http://schemas.xmlsoap.org/soap/encoding/'
|
||||
);
|
||||
|
||||
/**
|
||||
* namespaces used in the current context, e.g. during serialization
|
||||
*
|
||||
* @var array
|
||||
* @access private
|
||||
*/
|
||||
var $usedNamespaces = array();
|
||||
|
||||
/**
|
||||
* XML Schema types in an array of uri => (array of xml type => php type)
|
||||
* is this legacy yet?
|
||||
* no, this is used by the xmlschema class to verify type => namespace mappings.
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $typemap = array(
|
||||
'http://www.w3.org/2001/XMLSchema' => array(
|
||||
'string'=>'string','boolean'=>'boolean','float'=>'double','double'=>'double','decimal'=>'double',
|
||||
'duration'=>'','dateTime'=>'string','time'=>'string','date'=>'string','gYearMonth'=>'',
|
||||
'gYear'=>'','gMonthDay'=>'','gDay'=>'','gMonth'=>'','hexBinary'=>'string','base64Binary'=>'string',
|
||||
// abstract "any" types
|
||||
'anyType'=>'string','anySimpleType'=>'string',
|
||||
// derived datatypes
|
||||
'normalizedString'=>'string','token'=>'string','language'=>'','NMTOKEN'=>'','NMTOKENS'=>'','Name'=>'','NCName'=>'','ID'=>'',
|
||||
'IDREF'=>'','IDREFS'=>'','ENTITY'=>'','ENTITIES'=>'','integer'=>'integer','nonPositiveInteger'=>'integer',
|
||||
'negativeInteger'=>'integer','long'=>'integer','int'=>'integer','short'=>'integer','byte'=>'integer','nonNegativeInteger'=>'integer',
|
||||
'unsignedLong'=>'','unsignedInt'=>'','unsignedShort'=>'','unsignedByte'=>'','positiveInteger'=>''),
|
||||
'http://www.w3.org/2000/10/XMLSchema' => array(
|
||||
'i4'=>'','int'=>'integer','boolean'=>'boolean','string'=>'string','double'=>'double',
|
||||
'float'=>'double','dateTime'=>'string',
|
||||
'timeInstant'=>'string','base64Binary'=>'string','base64'=>'string','ur-type'=>'array'),
|
||||
'http://www.w3.org/1999/XMLSchema' => array(
|
||||
'i4'=>'','int'=>'integer','boolean'=>'boolean','string'=>'string','double'=>'double',
|
||||
'float'=>'double','dateTime'=>'string',
|
||||
'timeInstant'=>'string','base64Binary'=>'string','base64'=>'string','ur-type'=>'array'),
|
||||
'http://soapinterop.org/xsd' => array('SOAPStruct'=>'struct'),
|
||||
'http://schemas.xmlsoap.org/soap/encoding/' => array('base64'=>'string','array'=>'array','Array'=>'array'),
|
||||
'http://xml.apache.org/xml-soap' => array('Map')
|
||||
);
|
||||
|
||||
/**
|
||||
* XML entities to convert
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
* @deprecated
|
||||
* @see expandEntities
|
||||
*/
|
||||
var $xmlEntities = array('quot' => '"','amp' => '&',
|
||||
'lt' => '<','gt' => '>','apos' => "'");
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function nusoap_base() {
|
||||
$this->debugLevel = $GLOBALS['_transient']['static']['nusoap_base']->globalDebugLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the global debug level, which applies to future instances
|
||||
*
|
||||
* @return integer Debug level 0-9, where 0 turns off
|
||||
* @access public
|
||||
*/
|
||||
function getGlobalDebugLevel() {
|
||||
return $GLOBALS['_transient']['static']['nusoap_base']->globalDebugLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* sets the global debug level, which applies to future instances
|
||||
*
|
||||
* @param int $level Debug level 0-9, where 0 turns off
|
||||
* @access public
|
||||
*/
|
||||
function setGlobalDebugLevel($level) {
|
||||
$GLOBALS['_transient']['static']['nusoap_base']->globalDebugLevel = $level;
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the debug level for this instance
|
||||
*
|
||||
* @return int Debug level 0-9, where 0 turns off
|
||||
* @access public
|
||||
*/
|
||||
function getDebugLevel() {
|
||||
return $this->debugLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* sets the debug level for this instance
|
||||
*
|
||||
* @param int $level Debug level 0-9, where 0 turns off
|
||||
* @access public
|
||||
*/
|
||||
function setDebugLevel($level) {
|
||||
$this->debugLevel = $level;
|
||||
}
|
||||
|
||||
/**
|
||||
* adds debug data to the instance debug string with formatting
|
||||
*
|
||||
* @param string $string debug data
|
||||
* @access private
|
||||
*/
|
||||
function debug($string){
|
||||
if ($this->debugLevel > 0) {
|
||||
$this->appendDebug($this->getmicrotime().' '.get_class($this).": $string\n");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* adds debug data to the instance debug string without formatting
|
||||
*
|
||||
* @param string $string debug data
|
||||
* @access public
|
||||
*/
|
||||
function appendDebug($string){
|
||||
if ($this->debugLevel > 0) {
|
||||
// it would be nice to use a memory stream here to use
|
||||
// memory more efficiently
|
||||
$this->debug_str .= $string;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* clears the current debug data for this instance
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function clearDebug() {
|
||||
// it would be nice to use a memory stream here to use
|
||||
// memory more efficiently
|
||||
$this->debug_str = '';
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the current debug data for this instance
|
||||
*
|
||||
* @return debug data
|
||||
* @access public
|
||||
*/
|
||||
function &getDebug() {
|
||||
// it would be nice to use a memory stream here to use
|
||||
// memory more efficiently
|
||||
return $this->debug_str;
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the current debug data for this instance as an XML comment
|
||||
* this may change the contents of the debug data
|
||||
*
|
||||
* @return debug data as an XML comment
|
||||
* @access public
|
||||
*/
|
||||
function &getDebugAsXMLComment() {
|
||||
// it would be nice to use a memory stream here to use
|
||||
// memory more efficiently
|
||||
while (strpos($this->debug_str, '--')) {
|
||||
$this->debug_str = str_replace('--', '- -', $this->debug_str);
|
||||
}
|
||||
return "<!--\n" . $this->debug_str . "\n-->";
|
||||
}
|
||||
|
||||
/**
|
||||
* expands entities, e.g. changes '<' to '<'.
|
||||
*
|
||||
* @param string $val The string in which to expand entities.
|
||||
* @access private
|
||||
*/
|
||||
function expandEntities($val) {
|
||||
if ($this->charencoding) {
|
||||
$val = str_replace('&', '&', $val);
|
||||
$val = str_replace("'", ''', $val);
|
||||
$val = str_replace('"', '"', $val);
|
||||
$val = str_replace('<', '<', $val);
|
||||
$val = str_replace('>', '>', $val);
|
||||
}
|
||||
return $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns error string if present
|
||||
*
|
||||
* @return mixed error string or false
|
||||
* @access public
|
||||
*/
|
||||
function getError(){
|
||||
if($this->error_str != ''){
|
||||
return $this->error_str;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* sets error string
|
||||
*
|
||||
* @return boolean $string error string
|
||||
* @access private
|
||||
*/
|
||||
function setError($str){
|
||||
$this->error_str = $str;
|
||||
}
|
||||
|
||||
/**
|
||||
* detect if array is a simple array or a struct (associative array)
|
||||
*
|
||||
* @param mixed $val The PHP array
|
||||
* @return string (arraySimple|arrayStruct)
|
||||
* @access private
|
||||
*/
|
||||
function isArraySimpleOrStruct($val) {
|
||||
$keyList = array_keys($val);
|
||||
foreach ($keyList as $keyListValue) {
|
||||
if (!is_int($keyListValue)) {
|
||||
return 'arrayStruct';
|
||||
}
|
||||
}
|
||||
return 'arraySimple';
|
||||
}
|
||||
|
||||
/**
|
||||
* serializes PHP values in accordance w/ section 5. Type information is
|
||||
* not serialized if $use == 'literal'.
|
||||
*
|
||||
* @param mixed $val The value to serialize
|
||||
* @param string $name The name (local part) of the XML element
|
||||
* @param string $type The XML schema type (local part) for the element
|
||||
* @param string $name_ns The namespace for the name of the XML element
|
||||
* @param string $type_ns The namespace for the type of the element
|
||||
* @param array $attributes The attributes to serialize as name=>value pairs
|
||||
* @param string $use The WSDL "use" (encoded|literal)
|
||||
* @return string The serialized element, possibly with child elements
|
||||
* @access public
|
||||
*/
|
||||
function serialize_val($val,$name=false,$type=false,$name_ns=false,$type_ns=false,$attributes=false,$use='encoded'){
|
||||
$this->debug("in serialize_val: name=$name, type=$type, name_ns=$name_ns, type_ns=$type_ns, use=$use");
|
||||
$this->appendDebug('value=' . $this->varDump($val));
|
||||
$this->appendDebug('attributes=' . $this->varDump($attributes));
|
||||
|
||||
if(is_object($val) && get_class($val) == 'soapval'){
|
||||
return $val->serialize($use);
|
||||
}
|
||||
// force valid name if necessary
|
||||
if (is_numeric($name)) {
|
||||
$name = '__numeric_' . $name;
|
||||
} elseif (! $name) {
|
||||
$name = 'noname';
|
||||
}
|
||||
// if name has ns, add ns prefix to name
|
||||
$xmlns = '';
|
||||
if($name_ns){
|
||||
$prefix = 'nu'.rand(1000,9999);
|
||||
$name = $prefix.':'.$name;
|
||||
$xmlns .= " xmlns:$prefix=\"$name_ns\"";
|
||||
}
|
||||
// if type is prefixed, create type prefix
|
||||
if($type_ns != '' && $type_ns == $this->namespaces['xsd']){
|
||||
// need to fix this. shouldn't default to xsd if no ns specified
|
||||
// w/o checking against typemap
|
||||
$type_prefix = 'xsd';
|
||||
} elseif($type_ns){
|
||||
$type_prefix = 'ns'.rand(1000,9999);
|
||||
$xmlns .= " xmlns:$type_prefix=\"$type_ns\"";
|
||||
}
|
||||
// serialize attributes if present
|
||||
$atts = '';
|
||||
if($attributes){
|
||||
foreach($attributes as $k => $v){
|
||||
$atts .= " $k=\"".$this->expandEntities($v).'"';
|
||||
}
|
||||
}
|
||||
// serialize null value
|
||||
if (is_null($val)) {
|
||||
if ($use == 'literal') {
|
||||
// TODO: depends on minOccurs
|
||||
return "<$name$xmlns $atts/>";
|
||||
} else {
|
||||
if (isset($type) && isset($type_prefix)) {
|
||||
$type_str = " xsi:type=\"$type_prefix:$type\"";
|
||||
} else {
|
||||
$type_str = '';
|
||||
}
|
||||
return "<$name$xmlns$type_str $atts xsi:nil=\"true\"/>";
|
||||
}
|
||||
}
|
||||
// serialize if an xsd built-in primitive type
|
||||
if($type != '' && isset($this->typemap[$this->XMLSchemaVersion][$type])){
|
||||
if (is_bool($val)) {
|
||||
if ($type == 'boolean') {
|
||||
$val = $val ? 'true' : 'false';
|
||||
} elseif (! $val) {
|
||||
$val = 0;
|
||||
}
|
||||
} else if (is_string($val)) {
|
||||
$val = $this->expandEntities($val);
|
||||
}
|
||||
if ($use == 'literal') {
|
||||
return "<$name$xmlns $atts>$val</$name>";
|
||||
} else {
|
||||
return "<$name$xmlns $atts xsi:type=\"xsd:$type\">$val</$name>";
|
||||
}
|
||||
}
|
||||
// detect type and serialize
|
||||
$xml = '';
|
||||
switch(true) {
|
||||
case (is_bool($val) || $type == 'boolean'):
|
||||
if ($type == 'boolean') {
|
||||
$val = $val ? 'true' : 'false';
|
||||
} elseif (! $val) {
|
||||
$val = 0;
|
||||
}
|
||||
if ($use == 'literal') {
|
||||
$xml .= "<$name$xmlns $atts>$val</$name>";
|
||||
} else {
|
||||
$xml .= "<$name$xmlns xsi:type=\"xsd:boolean\"$atts>$val</$name>";
|
||||
}
|
||||
break;
|
||||
case (is_int($val) || is_long($val) || $type == 'int'):
|
||||
if ($use == 'literal') {
|
||||
$xml .= "<$name$xmlns $atts>$val</$name>";
|
||||
} else {
|
||||
$xml .= "<$name$xmlns xsi:type=\"xsd:int\"$atts>$val</$name>";
|
||||
}
|
||||
break;
|
||||
case (is_float($val)|| is_double($val) || $type == 'float'):
|
||||
if ($use == 'literal') {
|
||||
$xml .= "<$name$xmlns $atts>$val</$name>";
|
||||
} else {
|
||||
$xml .= "<$name$xmlns xsi:type=\"xsd:float\"$atts>$val</$name>";
|
||||
}
|
||||
break;
|
||||
case (is_string($val) || $type == 'string'):
|
||||
$val = $this->expandEntities($val);
|
||||
if ($use == 'literal') {
|
||||
$xml .= "<$name$xmlns $atts>$val</$name>";
|
||||
} else {
|
||||
$xml .= "<$name$xmlns xsi:type=\"xsd:string\"$atts>$val</$name>";
|
||||
}
|
||||
break;
|
||||
case is_object($val):
|
||||
if (! $name) {
|
||||
$name = get_class($val);
|
||||
$this->debug("In serialize_val, used class name $name as element name");
|
||||
} else {
|
||||
$this->debug("In serialize_val, do not override name $name for element name for class " . get_class($val));
|
||||
}
|
||||
foreach(get_object_vars($val) as $k => $v){
|
||||
$pXml = isset($pXml) ? $pXml.$this->serialize_val($v,$k,false,false,false,false,$use) : $this->serialize_val($v,$k,false,false,false,false,$use);
|
||||
}
|
||||
$xml .= '<'.$name.'>'.$pXml.'</'.$name.'>';
|
||||
break;
|
||||
break;
|
||||
case (is_array($val) || $type):
|
||||
// detect if struct or array
|
||||
$valueType = $this->isArraySimpleOrStruct($val);
|
||||
if($valueType=='arraySimple' || ereg('^ArrayOf',$type)){
|
||||
$i = 0;
|
||||
if(is_array($val) && count($val)> 0){
|
||||
foreach($val as $v){
|
||||
if(is_object($v) && get_class($v) == 'soapval'){
|
||||
$tt_ns = $v->type_ns;
|
||||
$tt = $v->type;
|
||||
} elseif (is_array($v)) {
|
||||
$tt = $this->isArraySimpleOrStruct($v);
|
||||
} else {
|
||||
$tt = gettype($v);
|
||||
}
|
||||
$array_types[$tt] = 1;
|
||||
// TODO: for literal, the name should be $name
|
||||
$xml .= $this->serialize_val($v,'item',false,false,false,false,$use);
|
||||
++$i;
|
||||
}
|
||||
if(count($array_types) > 1){
|
||||
$array_typename = 'xsd:anyType';
|
||||
} elseif(isset($tt) && isset($this->typemap[$this->XMLSchemaVersion][$tt])) {
|
||||
if ($tt == 'integer') {
|
||||
$tt = 'int';
|
||||
}
|
||||
$array_typename = 'xsd:'.$tt;
|
||||
} elseif(isset($tt) && $tt == 'arraySimple'){
|
||||
$array_typename = 'SOAP-ENC:Array';
|
||||
} elseif(isset($tt) && $tt == 'arrayStruct'){
|
||||
$array_typename = 'unnamed_struct_use_soapval';
|
||||
} else {
|
||||
// if type is prefixed, create type prefix
|
||||
if ($tt_ns != '' && $tt_ns == $this->namespaces['xsd']){
|
||||
$array_typename = 'xsd:' . $tt;
|
||||
} elseif ($tt_ns) {
|
||||
$tt_prefix = 'ns' . rand(1000, 9999);
|
||||
$array_typename = "$tt_prefix:$tt";
|
||||
$xmlns .= " xmlns:$tt_prefix=\"$tt_ns\"";
|
||||
} else {
|
||||
$array_typename = $tt;
|
||||
}
|
||||
}
|
||||
$array_type = $i;
|
||||
if ($use == 'literal') {
|
||||
$type_str = '';
|
||||
} else if (isset($type) && isset($type_prefix)) {
|
||||
$type_str = " xsi:type=\"$type_prefix:$type\"";
|
||||
} else {
|
||||
$type_str = " xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"".$array_typename."[$array_type]\"";
|
||||
}
|
||||
// empty array
|
||||
} else {
|
||||
if ($use == 'literal') {
|
||||
$type_str = '';
|
||||
} else if (isset($type) && isset($type_prefix)) {
|
||||
$type_str = " xsi:type=\"$type_prefix:$type\"";
|
||||
} else {
|
||||
$type_str = " xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"xsd:anyType[0]\"";
|
||||
}
|
||||
}
|
||||
// TODO: for array in literal, there is no wrapper here
|
||||
$xml = "<$name$xmlns$type_str$atts>".$xml."</$name>";
|
||||
} else {
|
||||
// got a struct
|
||||
if(isset($type) && isset($type_prefix)){
|
||||
$type_str = " xsi:type=\"$type_prefix:$type\"";
|
||||
} else {
|
||||
$type_str = '';
|
||||
}
|
||||
if ($use == 'literal') {
|
||||
$xml .= "<$name$xmlns $atts>";
|
||||
} else {
|
||||
$xml .= "<$name$xmlns$type_str$atts>";
|
||||
}
|
||||
foreach($val as $k => $v){
|
||||
// Apache Map
|
||||
if ($type == 'Map' && $type_ns == 'http://xml.apache.org/xml-soap') {
|
||||
$xml .= '<item>';
|
||||
$xml .= $this->serialize_val($k,'key',false,false,false,false,$use);
|
||||
$xml .= $this->serialize_val($v,'value',false,false,false,false,$use);
|
||||
$xml .= '</item>';
|
||||
} else {
|
||||
$xml .= $this->serialize_val($v,$k,false,false,false,false,$use);
|
||||
}
|
||||
}
|
||||
$xml .= "</$name>";
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$xml .= 'not detected, got '.gettype($val).' for '.$val;
|
||||
break;
|
||||
}
|
||||
return $xml;
|
||||
}
|
||||
|
||||
/**
|
||||
* serializes a message
|
||||
*
|
||||
* @param string $body the XML of the SOAP body
|
||||
* @param mixed $headers optional string of XML with SOAP header content, or array of soapval objects for SOAP headers
|
||||
* @param array $namespaces optional the namespaces used in generating the body and headers
|
||||
* @param string $style optional (rpc|document)
|
||||
* @param string $use optional (encoded|literal)
|
||||
* @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded)
|
||||
* @return string the message
|
||||
* @access public
|
||||
*/
|
||||
function serializeEnvelope($body,$headers=false,$namespaces=array(),$style='rpc',$use='encoded',$encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'){
|
||||
// TODO: add an option to automatically run utf8_encode on $body and $headers
|
||||
// if $this->soap_defencoding is UTF-8. Not doing this automatically allows
|
||||
// one to send arbitrary UTF-8 characters, not just characters that map to ISO-8859-1
|
||||
|
||||
$this->debug("In serializeEnvelope length=" . strlen($body) . " body (max 1000 characters)=" . substr($body, 0, 1000) . " style=$style use=$use encodingStyle=$encodingStyle");
|
||||
$this->debug("headers:");
|
||||
$this->appendDebug($this->varDump($headers));
|
||||
$this->debug("namespaces:");
|
||||
$this->appendDebug($this->varDump($namespaces));
|
||||
|
||||
// serialize namespaces
|
||||
$ns_string = '';
|
||||
foreach(array_merge($this->namespaces,$namespaces) as $k => $v){
|
||||
$ns_string .= " xmlns:$k=\"$v\"";
|
||||
}
|
||||
if($encodingStyle) {
|
||||
$ns_string = " SOAP-ENV:encodingStyle=\"$encodingStyle\"$ns_string";
|
||||
}
|
||||
|
||||
// serialize headers
|
||||
if($headers){
|
||||
if (is_array($headers)) {
|
||||
$xml = '';
|
||||
foreach ($headers as $header) {
|
||||
$xml .= $this->serialize_val($header, false, false, false, false, false, $use);
|
||||
}
|
||||
$headers = $xml;
|
||||
$this->debug("In serializeEnvelope, serialzied array of headers to $headers");
|
||||
}
|
||||
$headers = "<SOAP-ENV:Header>".$headers."</SOAP-ENV:Header>";
|
||||
}
|
||||
// serialize envelope
|
||||
return
|
||||
'<?xml version="1.0" encoding="'.$this->soap_defencoding .'"?'.">".
|
||||
'<SOAP-ENV:Envelope'.$ns_string.">".
|
||||
$headers.
|
||||
"<SOAP-ENV:Body>".
|
||||
$body.
|
||||
"</SOAP-ENV:Body>".
|
||||
"</SOAP-ENV:Envelope>";
|
||||
}
|
||||
|
||||
/**
|
||||
* formats a string to be inserted into an HTML stream
|
||||
*
|
||||
* @param string $str The string to format
|
||||
* @return string The formatted string
|
||||
* @access public
|
||||
* @deprecated
|
||||
*/
|
||||
function formatDump($str){
|
||||
$str = htmlspecialchars($str);
|
||||
return nl2br($str);
|
||||
}
|
||||
|
||||
/**
|
||||
* contracts (changes namespace to prefix) a qualified name
|
||||
*
|
||||
* @param string $qname qname
|
||||
* @return string contracted qname
|
||||
* @access private
|
||||
*/
|
||||
function contractQname($qname){
|
||||
// get element namespace
|
||||
//$this->xdebug("Contract $qname");
|
||||
if (strrpos($qname, ':')) {
|
||||
// get unqualified name
|
||||
$name = substr($qname, strrpos($qname, ':') + 1);
|
||||
// get ns
|
||||
$ns = substr($qname, 0, strrpos($qname, ':'));
|
||||
$p = $this->getPrefixFromNamespace($ns);
|
||||
if ($p) {
|
||||
return $p . ':' . $name;
|
||||
}
|
||||
return $qname;
|
||||
} else {
|
||||
return $qname;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* expands (changes prefix to namespace) a qualified name
|
||||
*
|
||||
* @param string $string qname
|
||||
* @return string expanded qname
|
||||
* @access private
|
||||
*/
|
||||
function expandQname($qname){
|
||||
// get element prefix
|
||||
if(strpos($qname,':') && !ereg('^http://',$qname)){
|
||||
// get unqualified name
|
||||
$name = substr(strstr($qname,':'),1);
|
||||
// get ns prefix
|
||||
$prefix = substr($qname,0,strpos($qname,':'));
|
||||
if(isset($this->namespaces[$prefix])){
|
||||
return $this->namespaces[$prefix].':'.$name;
|
||||
} else {
|
||||
return $qname;
|
||||
}
|
||||
} else {
|
||||
return $qname;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the local part of a prefixed string
|
||||
* returns the original string, if not prefixed
|
||||
*
|
||||
* @param string $str The prefixed string
|
||||
* @return string The local part
|
||||
* @access public
|
||||
*/
|
||||
function getLocalPart($str){
|
||||
if($sstr = strrchr($str,':')){
|
||||
// get unqualified name
|
||||
return substr( $sstr, 1 );
|
||||
} else {
|
||||
return $str;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the prefix part of a prefixed string
|
||||
* returns false, if not prefixed
|
||||
*
|
||||
* @param string $str The prefixed string
|
||||
* @return mixed The prefix or false if there is no prefix
|
||||
* @access public
|
||||
*/
|
||||
function getPrefix($str){
|
||||
if($pos = strrpos($str,':')){
|
||||
// get prefix
|
||||
return substr($str,0,$pos);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* pass it a prefix, it returns a namespace
|
||||
*
|
||||
* @param string $prefix The prefix
|
||||
* @return mixed The namespace, false if no namespace has the specified prefix
|
||||
* @access public
|
||||
*/
|
||||
function getNamespaceFromPrefix($prefix){
|
||||
if (isset($this->namespaces[$prefix])) {
|
||||
return $this->namespaces[$prefix];
|
||||
}
|
||||
//$this->setError("No namespace registered for prefix '$prefix'");
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the prefix for a given namespace (or prefix)
|
||||
* or false if no prefixes registered for the given namespace
|
||||
*
|
||||
* @param string $ns The namespace
|
||||
* @return mixed The prefix, false if the namespace has no prefixes
|
||||
* @access public
|
||||
*/
|
||||
function getPrefixFromNamespace($ns) {
|
||||
foreach ($this->namespaces as $p => $n) {
|
||||
if ($ns == $n || $ns == $p) {
|
||||
$this->usedNamespaces[$p] = $n;
|
||||
return $p;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the time in ODBC canonical form with microseconds
|
||||
*
|
||||
* @return string The time in ODBC canonical form with microseconds
|
||||
* @access public
|
||||
*/
|
||||
function getmicrotime() {
|
||||
if (function_exists('gettimeofday')) {
|
||||
$tod = gettimeofday();
|
||||
$sec = $tod['sec'];
|
||||
$usec = $tod['usec'];
|
||||
} else {
|
||||
$sec = time();
|
||||
$usec = 0;
|
||||
}
|
||||
return strftime('%Y-%m-%d %H:%M:%S', $sec) . '.' . sprintf('%06d', $usec);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string with the output of var_dump
|
||||
*
|
||||
* @param mixed $data The variable to var_dump
|
||||
* @return string The output of var_dump
|
||||
* @access public
|
||||
*/
|
||||
function varDump($data) {
|
||||
ob_start();
|
||||
var_dump($data);
|
||||
$ret_val = ob_get_contents();
|
||||
ob_end_clean();
|
||||
return $ret_val;
|
||||
}
|
||||
}
|
||||
|
||||
// XML Schema Datatype Helper Functions
|
||||
|
||||
//xsd:dateTime helpers
|
||||
|
||||
/**
|
||||
* convert unix timestamp to ISO 8601 compliant date string
|
||||
*
|
||||
* @param string $timestamp Unix time stamp
|
||||
* @access public
|
||||
*/
|
||||
function timestamp_to_iso8601($timestamp,$utc=true){
|
||||
$datestr = date('Y-m-d\TH:i:sO',$timestamp);
|
||||
if($utc){
|
||||
$eregStr =
|
||||
'([0-9]{4})-'. // centuries & years CCYY-
|
||||
'([0-9]{2})-'. // months MM-
|
||||
'([0-9]{2})'. // days DD
|
||||
'T'. // separator T
|
||||
'([0-9]{2}):'. // hours hh:
|
||||
'([0-9]{2}):'. // minutes mm:
|
||||
'([0-9]{2})(\.[0-9]*)?'. // seconds ss.ss...
|
||||
'(Z|[+\-][0-9]{2}:?[0-9]{2})?'; // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
|
||||
|
||||
if(ereg($eregStr,$datestr,$regs)){
|
||||
return sprintf('%04d-%02d-%02dT%02d:%02d:%02dZ',$regs[1],$regs[2],$regs[3],$regs[4],$regs[5],$regs[6]);
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
return $datestr;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* convert ISO 8601 compliant date string to unix timestamp
|
||||
*
|
||||
* @param string $datestr ISO 8601 compliant date string
|
||||
* @access public
|
||||
*/
|
||||
function iso8601_to_timestamp($datestr){
|
||||
$eregStr =
|
||||
'([0-9]{4})-'. // centuries & years CCYY-
|
||||
'([0-9]{2})-'. // months MM-
|
||||
'([0-9]{2})'. // days DD
|
||||
'T'. // separator T
|
||||
'([0-9]{2}):'. // hours hh:
|
||||
'([0-9]{2}):'. // minutes mm:
|
||||
'([0-9]{2})(\.[0-9]+)?'. // seconds ss.ss...
|
||||
'(Z|[+\-][0-9]{2}:?[0-9]{2})?'; // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
|
||||
if(ereg($eregStr,$datestr,$regs)){
|
||||
// not utc
|
||||
if($regs[8] != 'Z'){
|
||||
$op = substr($regs[8],0,1);
|
||||
$h = substr($regs[8],1,2);
|
||||
$m = substr($regs[8],strlen($regs[8])-2,2);
|
||||
if($op == '-'){
|
||||
$regs[4] = $regs[4] + $h;
|
||||
$regs[5] = $regs[5] + $m;
|
||||
} elseif($op == '+'){
|
||||
$regs[4] = $regs[4] - $h;
|
||||
$regs[5] = $regs[5] - $m;
|
||||
}
|
||||
}
|
||||
return strtotime("$regs[1]-$regs[2]-$regs[3] $regs[4]:$regs[5]:$regs[6]Z");
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* sleeps some number of microseconds
|
||||
*
|
||||
* @param string $usec the number of microseconds to sleep
|
||||
* @access public
|
||||
* @deprecated
|
||||
*/
|
||||
function usleepWindows($usec)
|
||||
{
|
||||
$start = gettimeofday();
|
||||
|
||||
do
|
||||
{
|
||||
$stop = gettimeofday();
|
||||
$timePassed = 1000000 * ($stop['sec'] - $start['sec'])
|
||||
+ $stop['usec'] - $start['usec'];
|
||||
}
|
||||
while ($timePassed < $usec);
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
859
thirdparty/pear/class.soapclient.php
vendored
859
thirdparty/pear/class.soapclient.php
vendored
@@ -1,859 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* soapclient higher level class for easy usage.
|
||||
*
|
||||
* usage:
|
||||
*
|
||||
* // instantiate client with server info
|
||||
* $soapclient = new soapclient( string path [ ,boolean wsdl] );
|
||||
*
|
||||
* // call method, get results
|
||||
* echo $soapclient->call( string methodname [ ,array parameters] );
|
||||
*
|
||||
* // bye bye client
|
||||
* unset($soapclient);
|
||||
*
|
||||
* @author Dietrich Ayala <dietrich@ganx4.com>
|
||||
* @version $Id: class.soapclient.php,v 1.52 2005/07/27 19:24:42 snichol Exp $
|
||||
* @access public
|
||||
*/
|
||||
class soapclient extends nusoap_base {
|
||||
|
||||
var $username = '';
|
||||
var $password = '';
|
||||
var $authtype = '';
|
||||
var $certRequest = array();
|
||||
var $requestHeaders = false; // SOAP headers in request (text)
|
||||
var $responseHeaders = ''; // SOAP headers from response (incomplete namespace resolution) (text)
|
||||
var $document = ''; // SOAP body response portion (incomplete namespace resolution) (text)
|
||||
var $endpoint;
|
||||
var $forceEndpoint = ''; // overrides WSDL endpoint
|
||||
var $proxyhost = '';
|
||||
var $proxyport = '';
|
||||
var $proxyusername = '';
|
||||
var $proxypassword = '';
|
||||
var $xml_encoding = ''; // character set encoding of incoming (response) messages
|
||||
var $http_encoding = false;
|
||||
var $timeout = 0; // HTTP connection timeout
|
||||
var $response_timeout = 30; // HTTP response timeout
|
||||
var $endpointType = ''; // soap|wsdl, empty for WSDL initialization error
|
||||
var $persistentConnection = false;
|
||||
var $defaultRpcParams = false; // This is no longer used
|
||||
var $request = ''; // HTTP request
|
||||
var $response = ''; // HTTP response
|
||||
var $responseData = ''; // SOAP payload of response
|
||||
var $cookies = array(); // Cookies from response or for request
|
||||
var $decode_utf8 = true; // toggles whether the parser decodes element content w/ utf8_decode()
|
||||
var $operations = array(); // WSDL operations, empty for WSDL initialization error
|
||||
|
||||
/*
|
||||
* fault related variables
|
||||
*/
|
||||
/**
|
||||
* @var fault
|
||||
* @access public
|
||||
*/
|
||||
var $fault;
|
||||
/**
|
||||
* @var faultcode
|
||||
* @access public
|
||||
*/
|
||||
var $faultcode;
|
||||
/**
|
||||
* @var faultstring
|
||||
* @access public
|
||||
*/
|
||||
var $faultstring;
|
||||
/**
|
||||
* @var faultdetail
|
||||
* @access public
|
||||
*/
|
||||
var $faultdetail;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
* @param mixed $endpoint SOAP server or WSDL URL (string), or wsdl instance (object)
|
||||
* @param bool $wsdl optional, set to true if using WSDL
|
||||
* @param int $portName optional portName in WSDL document
|
||||
* @param string $proxyhost
|
||||
* @param string $proxyport
|
||||
* @param string $proxyusername
|
||||
* @param string $proxypassword
|
||||
* @param integer $timeout set the connection timeout
|
||||
* @param integer $response_timeout set the response timeout
|
||||
* @access public
|
||||
*/
|
||||
function soapclient($endpoint,$wsdl = false,$proxyhost = false,$proxyport = false,$proxyusername = false, $proxypassword = false, $timeout = 0, $response_timeout = 30){
|
||||
parent::nusoap_base();
|
||||
$this->endpoint = $endpoint;
|
||||
$this->proxyhost = $proxyhost;
|
||||
$this->proxyport = $proxyport;
|
||||
$this->proxyusername = $proxyusername;
|
||||
$this->proxypassword = $proxypassword;
|
||||
$this->timeout = $timeout;
|
||||
$this->response_timeout = $response_timeout;
|
||||
|
||||
// make values
|
||||
if($wsdl){
|
||||
if (is_object($endpoint) && (get_class($endpoint) == 'wsdl')) {
|
||||
$this->wsdl = $endpoint;
|
||||
$this->endpoint = $this->wsdl->wsdl;
|
||||
$this->wsdlFile = $this->endpoint;
|
||||
$this->debug('existing wsdl instance created from ' . $this->endpoint);
|
||||
} else {
|
||||
$this->wsdlFile = $this->endpoint;
|
||||
|
||||
// instantiate wsdl object and parse wsdl file
|
||||
$this->debug('instantiating wsdl class with doc: '.$endpoint);
|
||||
$this->wsdl =& new wsdl($this->wsdlFile,$this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword,$this->timeout,$this->response_timeout);
|
||||
}
|
||||
$this->appendDebug($this->wsdl->getDebug());
|
||||
$this->wsdl->clearDebug();
|
||||
// catch errors
|
||||
if($errstr = $this->wsdl->getError()){
|
||||
$this->debug('got wsdl error: '.$errstr);
|
||||
$this->setError('wsdl error: '.$errstr);
|
||||
} elseif($this->operations = $this->wsdl->getOperations()){
|
||||
$this->debug( 'got '.count($this->operations).' operations from wsdl '.$this->wsdlFile);
|
||||
$this->endpointType = 'wsdl';
|
||||
} else {
|
||||
$this->debug( 'getOperations returned false');
|
||||
$this->setError('no operations defined in the WSDL document!');
|
||||
}
|
||||
} else {
|
||||
$this->debug("instantiate SOAP with endpoint at $endpoint");
|
||||
$this->endpointType = 'soap';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* calls method, returns PHP native type
|
||||
*
|
||||
* @param string $method SOAP server URL or path
|
||||
* @param mixed $params An array, associative or simple, of the parameters
|
||||
* for the method call, or a string that is the XML
|
||||
* for the call. For rpc style, this call will
|
||||
* wrap the XML in a tag named after the method, as
|
||||
* well as the SOAP Envelope and Body. For document
|
||||
* style, this will only wrap with the Envelope and Body.
|
||||
* IMPORTANT: when using an array with document style,
|
||||
* in which case there
|
||||
* is really one parameter, the root of the fragment
|
||||
* used in the call, which encloses what programmers
|
||||
* normally think of parameters. A parameter array
|
||||
* *must* include the wrapper.
|
||||
* @param string $namespace optional method namespace (WSDL can override)
|
||||
* @param string $soapAction optional SOAPAction value (WSDL can override)
|
||||
* @param mixed $headers optional string of XML with SOAP header content, or array of soapval objects for SOAP headers
|
||||
* @param boolean $rpcParams optional (no longer used)
|
||||
* @param string $style optional (rpc|document) the style to use when serializing parameters (WSDL can override)
|
||||
* @param string $use optional (encoded|literal) the use when serializing parameters (WSDL can override)
|
||||
* @return mixed response from SOAP call
|
||||
* @access public
|
||||
*/
|
||||
function call($operation,$params=array(),$namespace='http://tempuri.org',$soapAction='',$headers=false,$rpcParams=null,$style='rpc',$use='encoded'){
|
||||
$this->operation = $operation;
|
||||
$this->fault = false;
|
||||
$this->setError('');
|
||||
$this->request = '';
|
||||
$this->response = '';
|
||||
$this->responseData = '';
|
||||
$this->faultstring = '';
|
||||
$this->faultcode = '';
|
||||
$this->opData = array();
|
||||
|
||||
$this->debug("call: operation=$operation, namespace=$namespace, soapAction=$soapAction, rpcParams=$rpcParams, style=$style, use=$use, endpointType=$this->endpointType");
|
||||
$this->appendDebug('params=' . $this->varDump($params));
|
||||
$this->appendDebug('headers=' . $this->varDump($headers));
|
||||
if ($headers) {
|
||||
$this->requestHeaders = $headers;
|
||||
}
|
||||
// serialize parameters
|
||||
if($this->endpointType == 'wsdl' && $opData = $this->getOperationData($operation)){
|
||||
// use WSDL for operation
|
||||
$this->opData = $opData;
|
||||
$this->debug("found operation");
|
||||
$this->appendDebug('opData=' . $this->varDump($opData));
|
||||
if (isset($opData['soapAction'])) {
|
||||
$soapAction = $opData['soapAction'];
|
||||
}
|
||||
if (! $this->forceEndpoint) {
|
||||
$this->endpoint = $opData['endpoint'];
|
||||
} else {
|
||||
$this->endpoint = $this->forceEndpoint;
|
||||
}
|
||||
$namespace = isset($opData['input']['namespace']) ? $opData['input']['namespace'] : $namespace;
|
||||
$style = $opData['style'];
|
||||
$use = $opData['input']['use'];
|
||||
// add ns to ns array
|
||||
if($namespace != '' && !isset($this->wsdl->namespaces[$namespace])){
|
||||
$nsPrefix = 'ns' . rand(1000, 9999);
|
||||
$this->wsdl->namespaces[$nsPrefix] = $namespace;
|
||||
}
|
||||
$nsPrefix = $this->wsdl->getPrefixFromNamespace($namespace);
|
||||
// serialize payload
|
||||
if (is_string($params)) {
|
||||
$this->debug("serializing param string for WSDL operation $operation");
|
||||
$payload = $params;
|
||||
} elseif (is_array($params)) {
|
||||
$this->debug("serializing param array for WSDL operation $operation");
|
||||
$payload = $this->wsdl->serializeRPCParameters($operation,'input',$params);
|
||||
} else {
|
||||
$this->debug('params must be array or string');
|
||||
$this->setError('params must be array or string');
|
||||
return false;
|
||||
}
|
||||
$usedNamespaces = $this->wsdl->usedNamespaces;
|
||||
if (isset($opData['input']['encodingStyle'])) {
|
||||
$encodingStyle = $opData['input']['encodingStyle'];
|
||||
} else {
|
||||
$encodingStyle = '';
|
||||
}
|
||||
$this->appendDebug($this->wsdl->getDebug());
|
||||
$this->wsdl->clearDebug();
|
||||
if ($errstr = $this->wsdl->getError()) {
|
||||
$this->debug('got wsdl error: '.$errstr);
|
||||
$this->setError('wsdl error: '.$errstr);
|
||||
return false;
|
||||
}
|
||||
} elseif($this->endpointType == 'wsdl') {
|
||||
// operation not in WSDL
|
||||
$this->appendDebug($this->wsdl->getDebug());
|
||||
$this->wsdl->clearDebug();
|
||||
$this->setError( 'operation '.$operation.' not present.');
|
||||
$this->debug("operation '$operation' not present.");
|
||||
return false;
|
||||
} else {
|
||||
// no WSDL
|
||||
//$this->namespaces['ns1'] = $namespace;
|
||||
$nsPrefix = 'ns' . rand(1000, 9999);
|
||||
// serialize
|
||||
$payload = '';
|
||||
if (is_string($params)) {
|
||||
$this->debug("serializing param string for operation $operation");
|
||||
$payload = $params;
|
||||
} elseif (is_array($params)) {
|
||||
$this->debug("serializing param array for operation $operation");
|
||||
foreach($params as $k => $v){
|
||||
$payload .= $this->serialize_val($v,$k,false,false,false,false,$use);
|
||||
}
|
||||
} else {
|
||||
$this->debug('params must be array or string');
|
||||
$this->setError('params must be array or string');
|
||||
return false;
|
||||
}
|
||||
$usedNamespaces = array();
|
||||
if ($use == 'encoded') {
|
||||
$encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
|
||||
} else {
|
||||
$encodingStyle = '';
|
||||
}
|
||||
}
|
||||
// wrap RPC calls with method element
|
||||
if ($style == 'rpc') {
|
||||
if ($use == 'literal') {
|
||||
$this->debug("wrapping RPC request with literal method element");
|
||||
if ($namespace) {
|
||||
$payload = "<$operation xmlns=\"$namespace\">" . $payload . "</$operation>";
|
||||
} else {
|
||||
$payload = "<$operation>" . $payload . "</$operation>";
|
||||
}
|
||||
} else {
|
||||
$this->debug("wrapping RPC request with encoded method element");
|
||||
if ($namespace) {
|
||||
$payload = "<$nsPrefix:$operation xmlns:$nsPrefix=\"$namespace\">" .
|
||||
$payload .
|
||||
"</$nsPrefix:$operation>";
|
||||
} else {
|
||||
$payload = "<$operation>" .
|
||||
$payload .
|
||||
"</$operation>";
|
||||
}
|
||||
}
|
||||
}
|
||||
// serialize envelope
|
||||
$soapmsg = $this->serializeEnvelope($payload,$this->requestHeaders,$usedNamespaces,$style,$use,$encodingStyle);
|
||||
$this->debug("endpoint=$this->endpoint, soapAction=$soapAction, namespace=$namespace, style=$style, use=$use, encodingStyle=$encodingStyle");
|
||||
$this->debug('SOAP message length=' . strlen($soapmsg) . ' contents (max 1000 bytes)=' . substr($soapmsg, 0, 1000));
|
||||
// send
|
||||
$return = $this->send($this->getHTTPBody($soapmsg),$soapAction,$this->timeout,$this->response_timeout);
|
||||
if($errstr = $this->getError()){
|
||||
$this->debug('Error: '.$errstr);
|
||||
return false;
|
||||
} else {
|
||||
$this->return = $return;
|
||||
$this->debug('sent message successfully and got a(n) '.gettype($return));
|
||||
$this->appendDebug('return=' . $this->varDump($return));
|
||||
|
||||
// fault?
|
||||
if(is_array($return) && isset($return['faultcode'])){
|
||||
$this->debug('got fault');
|
||||
$this->setError($return['faultcode'].': '.$return['faultstring']);
|
||||
$this->fault = true;
|
||||
foreach($return as $k => $v){
|
||||
$this->$k = $v;
|
||||
$this->debug("$k = $v<br>");
|
||||
}
|
||||
return $return;
|
||||
} elseif ($style == 'document') {
|
||||
// NOTE: if the response is defined to have multiple parts (i.e. unwrapped),
|
||||
// we are only going to return the first part here...sorry about that
|
||||
return $return;
|
||||
} else {
|
||||
// array of return values
|
||||
if(is_array($return)){
|
||||
// multiple 'out' parameters, which we return wrapped up
|
||||
// in the array
|
||||
if(sizeof($return) > 1){
|
||||
return $return;
|
||||
}
|
||||
// single 'out' parameter (normally the return value)
|
||||
$return = array_shift($return);
|
||||
$this->debug('return shifted value: ');
|
||||
$this->appendDebug($this->varDump($return));
|
||||
return $return;
|
||||
// nothing returned (ie, echoVoid)
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get available data pertaining to an operation
|
||||
*
|
||||
* @param string $operation operation name
|
||||
* @return array array of data pertaining to the operation
|
||||
* @access public
|
||||
*/
|
||||
function getOperationData($operation){
|
||||
if(isset($this->operations[$operation])){
|
||||
return $this->operations[$operation];
|
||||
}
|
||||
$this->debug("No data for operation: $operation");
|
||||
}
|
||||
|
||||
/**
|
||||
* send the SOAP message
|
||||
*
|
||||
* Note: if the operation has multiple return values
|
||||
* the return value of this method will be an array
|
||||
* of those values.
|
||||
*
|
||||
* @param string $msg a SOAPx4 soapmsg object
|
||||
* @param string $soapaction SOAPAction value
|
||||
* @param integer $timeout set connection timeout in seconds
|
||||
* @param integer $response_timeout set response timeout in seconds
|
||||
* @return mixed native PHP types.
|
||||
* @access private
|
||||
*/
|
||||
function send($msg, $soapaction = '', $timeout=0, $response_timeout=30) {
|
||||
$this->checkCookies();
|
||||
// detect transport
|
||||
switch(true){
|
||||
// http(s)
|
||||
case ereg('^http',$this->endpoint):
|
||||
$this->debug('transporting via HTTP');
|
||||
if($this->persistentConnection == true && is_object($this->persistentConnection)){
|
||||
$http =& $this->persistentConnection;
|
||||
} else {
|
||||
$http = new soap_transport_http($this->endpoint);
|
||||
if ($this->persistentConnection) {
|
||||
$http->usePersistentConnection();
|
||||
}
|
||||
}
|
||||
$http->setContentType($this->getHTTPContentType(), $this->getHTTPContentTypeCharset());
|
||||
$http->setSOAPAction($soapaction);
|
||||
if($this->proxyhost && $this->proxyport){
|
||||
$http->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword);
|
||||
}
|
||||
if($this->authtype != '') {
|
||||
$http->setCredentials($this->username, $this->password, $this->authtype, array(), $this->certRequest);
|
||||
}
|
||||
if($this->http_encoding != ''){
|
||||
$http->setEncoding($this->http_encoding);
|
||||
}
|
||||
$this->debug('sending message, length='.strlen($msg));
|
||||
if(ereg('^http:',$this->endpoint)){
|
||||
//if(strpos($this->endpoint,'http:')){
|
||||
$this->responseData = $http->send($msg,$timeout,$response_timeout,$this->cookies);
|
||||
} elseif(ereg('^https',$this->endpoint)){
|
||||
//} elseif(strpos($this->endpoint,'https:')){
|
||||
//if(phpversion() == '4.3.0-dev'){
|
||||
//$response = $http->send($msg,$timeout,$response_timeout);
|
||||
//$this->request = $http->outgoing_payload;
|
||||
//$this->response = $http->incoming_payload;
|
||||
//} else
|
||||
$this->responseData = $http->sendHTTPS($msg,$timeout,$response_timeout,$this->cookies);
|
||||
} else {
|
||||
$this->setError('no http/s in endpoint url');
|
||||
}
|
||||
$this->request = $http->outgoing_payload;
|
||||
$this->response = $http->incoming_payload;
|
||||
$this->appendDebug($http->getDebug());
|
||||
$this->UpdateCookies($http->incoming_cookies);
|
||||
|
||||
// save transport object if using persistent connections
|
||||
if ($this->persistentConnection) {
|
||||
$http->clearDebug();
|
||||
if (!is_object($this->persistentConnection)) {
|
||||
$this->persistentConnection = $http;
|
||||
}
|
||||
}
|
||||
|
||||
if($err = $http->getError()){
|
||||
$this->setError('HTTP Error: '.$err);
|
||||
return false;
|
||||
} elseif($this->getError()){
|
||||
return false;
|
||||
} else {
|
||||
$this->debug('got response, length='. strlen($this->responseData).' type='.$http->incoming_headers['content-type']);
|
||||
return $this->parseResponse($http->incoming_headers, $this->responseData);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$this->setError('no transport found, or selected transport is not yet supported!');
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* processes SOAP message returned from server
|
||||
*
|
||||
* @param array $headers The HTTP headers
|
||||
* @param string $data unprocessed response data from server
|
||||
* @return mixed value of the message, decoded into a PHP type
|
||||
* @access private
|
||||
*/
|
||||
function parseResponse($headers, $data) {
|
||||
$this->debug('Entering parseResponse() for data of length ' . strlen($data) . ' and type ' . $headers['content-type']);
|
||||
if (!strstr($headers['content-type'], 'text/xml')) {
|
||||
$this->setError('Response not of type text/xml');
|
||||
return false;
|
||||
}
|
||||
if (strpos($headers['content-type'], '=')) {
|
||||
$enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1));
|
||||
$this->debug('Got response encoding: ' . $enc);
|
||||
if(preg_match('/(ISO-8859-1|US-ASCII|UTF-8)/',$enc)){
|
||||
$this->xml_encoding = strtoupper($enc);
|
||||
} else {
|
||||
$this->xml_encoding = 'US-ASCII';
|
||||
}
|
||||
} else {
|
||||
// should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
|
||||
$this->xml_encoding = 'ISO-8859-1';
|
||||
}
|
||||
$this->debug('Use encoding: ' . $this->xml_encoding . ' when creating soap_parser');
|
||||
$parser = new soap_parser($data,$this->xml_encoding,$this->operation,$this->decode_utf8);
|
||||
// add parser debug data to our debug
|
||||
$this->appendDebug($parser->getDebug());
|
||||
// if parse errors
|
||||
if($errstr = $parser->getError()){
|
||||
$this->setError( $errstr);
|
||||
// destroy the parser object
|
||||
unset($parser);
|
||||
return false;
|
||||
} else {
|
||||
// get SOAP headers
|
||||
$this->responseHeaders = $parser->getHeaders();
|
||||
// get decoded message
|
||||
$return = $parser->get_response();
|
||||
// add document for doclit support
|
||||
$this->document = $parser->document;
|
||||
// destroy the parser object
|
||||
unset($parser);
|
||||
// return decode message
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* sets the SOAP endpoint, which can override WSDL
|
||||
*
|
||||
* @param $endpoint string The endpoint URL to use, or empty string or false to prevent override
|
||||
* @access public
|
||||
*/
|
||||
function setEndpoint($endpoint) {
|
||||
$this->forceEndpoint = $endpoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* set the SOAP headers
|
||||
*
|
||||
* @param $headers mixed String of XML with SOAP header content, or array of soapval objects for SOAP headers
|
||||
* @access public
|
||||
*/
|
||||
function setHeaders($headers){
|
||||
$this->requestHeaders = $headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the SOAP response headers (namespace resolution incomplete)
|
||||
*
|
||||
* @return string
|
||||
* @access public
|
||||
*/
|
||||
function getHeaders(){
|
||||
return $this->responseHeaders;
|
||||
}
|
||||
|
||||
/**
|
||||
* set proxy info here
|
||||
*
|
||||
* @param string $proxyhost
|
||||
* @param string $proxyport
|
||||
* @param string $proxyusername
|
||||
* @param string $proxypassword
|
||||
* @access public
|
||||
*/
|
||||
function setHTTPProxy($proxyhost, $proxyport, $proxyusername = '', $proxypassword = '') {
|
||||
$this->proxyhost = $proxyhost;
|
||||
$this->proxyport = $proxyport;
|
||||
$this->proxyusername = $proxyusername;
|
||||
$this->proxypassword = $proxypassword;
|
||||
}
|
||||
|
||||
/**
|
||||
* if authenticating, set user credentials here
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
* @param string $authtype (basic|digest|certificate)
|
||||
* @param array $certRequest (keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs)
|
||||
* @access public
|
||||
*/
|
||||
function setCredentials($username, $password, $authtype = 'basic', $certRequest = array()) {
|
||||
$this->username = $username;
|
||||
$this->password = $password;
|
||||
$this->authtype = $authtype;
|
||||
$this->certRequest = $certRequest;
|
||||
}
|
||||
|
||||
/**
|
||||
* use HTTP encoding
|
||||
*
|
||||
* @param string $enc
|
||||
* @access public
|
||||
*/
|
||||
function setHTTPEncoding($enc='gzip, deflate'){
|
||||
$this->http_encoding = $enc;
|
||||
}
|
||||
|
||||
/**
|
||||
* use HTTP persistent connections if possible
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function useHTTPPersistentConnection(){
|
||||
$this->persistentConnection = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the default RPC parameter setting.
|
||||
* If true, default is that call params are like RPC even for document style.
|
||||
* Each call() can override this value.
|
||||
*
|
||||
* This is no longer used.
|
||||
*
|
||||
* @return boolean
|
||||
* @access public
|
||||
* @deprecated
|
||||
*/
|
||||
function getDefaultRpcParams() {
|
||||
return $this->defaultRpcParams;
|
||||
}
|
||||
|
||||
/**
|
||||
* sets the default RPC parameter setting.
|
||||
* If true, default is that call params are like RPC even for document style
|
||||
* Each call() can override this value.
|
||||
*
|
||||
* This is no longer used.
|
||||
*
|
||||
* @param boolean $rpcParams
|
||||
* @access public
|
||||
* @deprecated
|
||||
*/
|
||||
function setDefaultRpcParams($rpcParams) {
|
||||
$this->defaultRpcParams = $rpcParams;
|
||||
}
|
||||
|
||||
/**
|
||||
* dynamically creates an instance of a proxy class,
|
||||
* allowing user to directly call methods from wsdl
|
||||
*
|
||||
* @return object soap_proxy object
|
||||
* @access public
|
||||
*/
|
||||
function getProxy(){
|
||||
$r = rand();
|
||||
$evalStr = $this->_getProxyClassCode($r);
|
||||
//$this->debug("proxy class: $evalStr";
|
||||
// eval the class
|
||||
eval($evalStr);
|
||||
// instantiate proxy object
|
||||
eval("\$proxy = new soap_proxy_$r('');");
|
||||
// transfer current wsdl data to the proxy thereby avoiding parsing the wsdl twice
|
||||
$proxy->endpointType = 'wsdl';
|
||||
$proxy->wsdlFile = $this->wsdlFile;
|
||||
$proxy->wsdl = $this->wsdl;
|
||||
$proxy->operations = $this->operations;
|
||||
$proxy->defaultRpcParams = $this->defaultRpcParams;
|
||||
// transfer other state
|
||||
$proxy->username = $this->username;
|
||||
$proxy->password = $this->password;
|
||||
$proxy->authtype = $this->authtype;
|
||||
$proxy->proxyhost = $this->proxyhost;
|
||||
$proxy->proxyport = $this->proxyport;
|
||||
$proxy->proxyusername = $this->proxyusername;
|
||||
$proxy->proxypassword = $this->proxypassword;
|
||||
$proxy->timeout = $this->timeout;
|
||||
$proxy->response_timeout = $this->response_timeout;
|
||||
$proxy->http_encoding = $this->http_encoding;
|
||||
$proxy->persistentConnection = $this->persistentConnection;
|
||||
$proxy->requestHeaders = $this->requestHeaders;
|
||||
$proxy->soap_defencoding = $this->soap_defencoding;
|
||||
$proxy->endpoint = $this->endpoint;
|
||||
$proxy->forceEndpoint = $this->forceEndpoint;
|
||||
return $proxy;
|
||||
}
|
||||
|
||||
/**
|
||||
* dynamically creates proxy class code
|
||||
*
|
||||
* @return string PHP/NuSOAP code for the proxy class
|
||||
* @access private
|
||||
*/
|
||||
function _getProxyClassCode($r) {
|
||||
if ($this->endpointType != 'wsdl') {
|
||||
$evalStr = 'A proxy can only be created for a WSDL client';
|
||||
$this->setError($evalStr);
|
||||
return $evalStr;
|
||||
}
|
||||
$evalStr = '';
|
||||
foreach ($this->operations as $operation => $opData) {
|
||||
if ($operation != '') {
|
||||
// create param string and param comment string
|
||||
if (sizeof($opData['input']['parts']) > 0) {
|
||||
$paramStr = '';
|
||||
$paramArrayStr = '';
|
||||
$paramCommentStr = '';
|
||||
foreach ($opData['input']['parts'] as $name => $type) {
|
||||
$paramStr .= "\$$name, ";
|
||||
$paramArrayStr .= "'$name' => \$$name, ";
|
||||
$paramCommentStr .= "$type \$$name, ";
|
||||
}
|
||||
$paramStr = substr($paramStr, 0, strlen($paramStr)-2);
|
||||
$paramArrayStr = substr($paramArrayStr, 0, strlen($paramArrayStr)-2);
|
||||
$paramCommentStr = substr($paramCommentStr, 0, strlen($paramCommentStr)-2);
|
||||
} else {
|
||||
$paramStr = '';
|
||||
$paramCommentStr = 'void';
|
||||
}
|
||||
$opData['namespace'] = !isset($opData['namespace']) ? 'http://testuri.com' : $opData['namespace'];
|
||||
$evalStr .= "// $paramCommentStr
|
||||
function " . str_replace('.', '__', $operation) . "($paramStr) {
|
||||
\$params = array($paramArrayStr);
|
||||
return \$this->call('$operation', \$params, '".$opData['namespace']."', '".(isset($opData['soapAction']) ? $opData['soapAction'] : '')."');
|
||||
}
|
||||
";
|
||||
unset($paramStr);
|
||||
unset($paramCommentStr);
|
||||
}
|
||||
}
|
||||
$evalStr = 'class soap_proxy_'.$r.' extends soapclient {
|
||||
'.$evalStr.'
|
||||
}';
|
||||
return $evalStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* dynamically creates proxy class code
|
||||
*
|
||||
* @return string PHP/NuSOAP code for the proxy class
|
||||
* @access public
|
||||
*/
|
||||
function getProxyClassCode() {
|
||||
$r = rand();
|
||||
return $this->_getProxyClassCode($r);
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the HTTP body for the current request.
|
||||
*
|
||||
* @param string $soapmsg The SOAP payload
|
||||
* @return string The HTTP body, which includes the SOAP payload
|
||||
* @access private
|
||||
*/
|
||||
function getHTTPBody($soapmsg) {
|
||||
return $soapmsg;
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the HTTP content type for the current request.
|
||||
*
|
||||
* Note: getHTTPBody must be called before this.
|
||||
*
|
||||
* @return string the HTTP content type for the current request.
|
||||
* @access private
|
||||
*/
|
||||
function getHTTPContentType() {
|
||||
return 'text/xml';
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the HTTP content type charset for the current request.
|
||||
* returns false for non-text content types.
|
||||
*
|
||||
* Note: getHTTPBody must be called before this.
|
||||
*
|
||||
* @return string the HTTP content type charset for the current request.
|
||||
* @access private
|
||||
*/
|
||||
function getHTTPContentTypeCharset() {
|
||||
return $this->soap_defencoding;
|
||||
}
|
||||
|
||||
/*
|
||||
* whether or not parser should decode utf8 element content
|
||||
*
|
||||
* @return always returns true
|
||||
* @access public
|
||||
*/
|
||||
function decodeUTF8($bool){
|
||||
$this->decode_utf8 = $bool;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* adds a new Cookie into $this->cookies array
|
||||
*
|
||||
* @param string $name Cookie Name
|
||||
* @param string $value Cookie Value
|
||||
* @return if cookie-set was successful returns true, else false
|
||||
* @access public
|
||||
*/
|
||||
function setCookie($name, $value) {
|
||||
if (strlen($name) == 0) {
|
||||
return false;
|
||||
}
|
||||
$this->cookies[] = array('name' => $name, 'value' => $value);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* gets all Cookies
|
||||
*
|
||||
* @return array with all internal cookies
|
||||
* @access public
|
||||
*/
|
||||
function getCookies() {
|
||||
return $this->cookies;
|
||||
}
|
||||
|
||||
/**
|
||||
* checks all Cookies and delete those which are expired
|
||||
*
|
||||
* @return always return true
|
||||
* @access private
|
||||
*/
|
||||
function checkCookies() {
|
||||
if (sizeof($this->cookies) == 0) {
|
||||
return true;
|
||||
}
|
||||
$this->debug('checkCookie: check ' . sizeof($this->cookies) . ' cookies');
|
||||
$curr_cookies = $this->cookies;
|
||||
$this->cookies = array();
|
||||
foreach ($curr_cookies as $cookie) {
|
||||
if (! is_array($cookie)) {
|
||||
$this->debug('Remove cookie that is not an array');
|
||||
continue;
|
||||
}
|
||||
if ((isset($cookie['expires'])) && (! empty($cookie['expires']))) {
|
||||
if (strtotime($cookie['expires']) > time()) {
|
||||
$this->cookies[] = $cookie;
|
||||
} else {
|
||||
$this->debug('Remove expired cookie ' . $cookie['name']);
|
||||
}
|
||||
} else {
|
||||
$this->cookies[] = $cookie;
|
||||
}
|
||||
}
|
||||
$this->debug('checkCookie: '.sizeof($this->cookies).' cookies left in array');
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* updates the current cookies with a new set
|
||||
*
|
||||
* @param array $cookies new cookies with which to update current ones
|
||||
* @return always return true
|
||||
* @access private
|
||||
*/
|
||||
function UpdateCookies($cookies) {
|
||||
if (sizeof($this->cookies) == 0) {
|
||||
// no existing cookies: take whatever is new
|
||||
if (sizeof($cookies) > 0) {
|
||||
$this->debug('Setting new cookie(s)');
|
||||
$this->cookies = $cookies;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (sizeof($cookies) == 0) {
|
||||
// no new cookies: keep what we've got
|
||||
return true;
|
||||
}
|
||||
// merge
|
||||
foreach ($cookies as $newCookie) {
|
||||
if (!is_array($newCookie)) {
|
||||
continue;
|
||||
}
|
||||
if ((!isset($newCookie['name'])) || (!isset($newCookie['value']))) {
|
||||
continue;
|
||||
}
|
||||
$newName = $newCookie['name'];
|
||||
|
||||
$found = false;
|
||||
for ($i = 0; $i < count($this->cookies); $i++) {
|
||||
$cookie = $this->cookies[$i];
|
||||
if (!is_array($cookie)) {
|
||||
continue;
|
||||
}
|
||||
if (!isset($cookie['name'])) {
|
||||
continue;
|
||||
}
|
||||
if ($newName != $cookie['name']) {
|
||||
continue;
|
||||
}
|
||||
$newDomain = isset($newCookie['domain']) ? $newCookie['domain'] : 'NODOMAIN';
|
||||
$domain = isset($cookie['domain']) ? $cookie['domain'] : 'NODOMAIN';
|
||||
if ($newDomain != $domain) {
|
||||
continue;
|
||||
}
|
||||
$newPath = isset($newCookie['path']) ? $newCookie['path'] : 'NOPATH';
|
||||
$path = isset($cookie['path']) ? $cookie['path'] : 'NOPATH';
|
||||
if ($newPath != $path) {
|
||||
continue;
|
||||
}
|
||||
$this->cookies[$i] = $newCookie;
|
||||
$found = true;
|
||||
$this->debug('Update cookie ' . $newName . '=' . $newCookie['value']);
|
||||
break;
|
||||
}
|
||||
if (! $found) {
|
||||
$this->debug('Add cookie ' . $newName . '=' . $newCookie['value']);
|
||||
$this->cookies[] = $newCookie;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
?>
|
||||
817
thirdparty/pear/json/class.json.php
vendored
817
thirdparty/pear/json/class.json.php
vendored
@@ -1,817 +0,0 @@
|
||||
<?php
|
||||
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
|
||||
|
||||
/**
|
||||
* Converts to and from JSON format.
|
||||
*
|
||||
* JSON (JavaScript Object Notation) is a lightweight data-interchange
|
||||
* format. It is easy for humans to read and write. It is easy for machines
|
||||
* to parse and generate. It is based on a subset of the JavaScript
|
||||
* Programming Language, Standard ECMA-262 3rd Edition - December 1999.
|
||||
* This feature can also be found in Python. JSON is a text format that is
|
||||
* completely language independent but uses conventions that are familiar
|
||||
* to programmers of the C-family of languages, including C, C++, C#, Java,
|
||||
* JavaScript, Perl, TCL, and many others. These properties make JSON an
|
||||
* ideal data-interchange language.
|
||||
*
|
||||
* This package provides a simple encoder and decoder for JSON notation. It
|
||||
* is intended for use with client-side Javascript applications that make
|
||||
* use of HTTPRequest to perform server communication functions - data can
|
||||
* be encoded into JSON notation for use in a client-side javascript, or
|
||||
* decoded from incoming Javascript requests. JSON format is native to
|
||||
* Javascript, and can be directly eval()'ed with no further parsing
|
||||
* overhead
|
||||
*
|
||||
* All strings should be in ASCII or UTF-8 format!
|
||||
*
|
||||
* LICENSE: Redistribution and use in source and binary forms, with or
|
||||
* without modification, are permitted provided that the following
|
||||
* conditions are met: Redistributions of source code must retain the
|
||||
* above copyright notice, this list of conditions and the following
|
||||
* disclaimer. Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following disclaimer
|
||||
* in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
* NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
* DAMAGE.
|
||||
*
|
||||
* @category
|
||||
* @package Services_JSON
|
||||
* @author Michal Migurski <mike-json@teczno.com>
|
||||
* @author Matt Knapp <mdknapp[at]gmail[dot]com>
|
||||
* @author Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
|
||||
* @copyright 2005 Michal Migurski
|
||||
* @version CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php
|
||||
* @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198
|
||||
*/
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
if ( !defined('SERVICES_JSON_SLICE')) {
|
||||
define('SERVICES_JSON_SLICE', 1);
|
||||
}
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
if ( !defined('SERVICES_JSON_IN_STR')) {
|
||||
define('SERVICES_JSON_IN_STR', 2);
|
||||
}
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
if ( !defined('SERVICES_JSON_IN_ARR')) {
|
||||
define('SERVICES_JSON_IN_ARR', 3);
|
||||
}
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
if ( !defined('SERVICES_JSON_IN_OBJ')) {
|
||||
define('SERVICES_JSON_IN_OBJ', 4);
|
||||
}
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
if ( !defined('SERVICES_JSON_IN_CMT')) {
|
||||
define('SERVICES_JSON_IN_CMT', 5);
|
||||
}
|
||||
/**
|
||||
* Behavior switch for Services_JSON::decode()
|
||||
*/
|
||||
if ( !defined('SERVICES_JSON_LOOSE_TYPE')) {
|
||||
define('SERVICES_JSON_LOOSE_TYPE', 16);
|
||||
}
|
||||
/**
|
||||
* Behavior switch for Services_JSON::decode()
|
||||
*/
|
||||
if ( !defined('SERVICES_JSON_SUPPRESS_ERRORS')) {
|
||||
define('SERVICES_JSON_SUPPRESS_ERRORS', 32);
|
||||
}
|
||||
/**
|
||||
* Converts to and from JSON format.
|
||||
*
|
||||
* Brief example of use:
|
||||
*
|
||||
* <code>
|
||||
* // create a new instance of Services_JSON
|
||||
* $json = new Services_JSON();
|
||||
*
|
||||
* // convert a complexe value to JSON notation, and send it to the browser
|
||||
* $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4)));
|
||||
* $output = $json->encode($value);
|
||||
*
|
||||
* print($output);
|
||||
* // prints: ["foo","bar",[1,2,"baz"],[3,[4]]]
|
||||
*
|
||||
* // accept incoming POST data, assumed to be in JSON notation
|
||||
* $input = file_get_contents('php://input', 1000000);
|
||||
* $value = $json->decode($input);
|
||||
* </code>
|
||||
*/
|
||||
|
||||
if (class_exists ('Services_JSON') ) {
|
||||
return;
|
||||
}
|
||||
class Services_JSON
|
||||
{
|
||||
/**
|
||||
* constructs a new JSON instance
|
||||
*
|
||||
* @param int $use object behavior flags; combine with boolean-OR
|
||||
*
|
||||
* possible values:
|
||||
* - SERVICES_JSON_LOOSE_TYPE: loose typing.
|
||||
* "{...}" syntax creates associative arrays
|
||||
* instead of objects in decode().
|
||||
* - SERVICES_JSON_SUPPRESS_ERRORS: error suppression.
|
||||
* Values which can't be encoded (e.g. resources)
|
||||
* appear as NULL instead of throwing errors.
|
||||
* By default, a deeply-nested resource will
|
||||
* bubble up with an error, so all return values
|
||||
* from encode() should be checked with isError()
|
||||
*/
|
||||
function Services_JSON($use = 0)
|
||||
{
|
||||
$this->use = $use;
|
||||
}
|
||||
|
||||
/**
|
||||
* convert a string from one UTF-16 char to one UTF-8 char
|
||||
*
|
||||
* Normally should be handled by mb_convert_encoding, but
|
||||
* provides a slower PHP-only method for installations
|
||||
* that lack the multibye string extension.
|
||||
*
|
||||
* @param string $utf16 UTF-16 character
|
||||
* @return string UTF-8 character
|
||||
* @access private
|
||||
*/
|
||||
function utf162utf8($utf16)
|
||||
{
|
||||
// oh please oh please oh please oh please oh please
|
||||
if(function_exists('mb_convert_encoding')) {
|
||||
return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
|
||||
}
|
||||
|
||||
$bytes = (ord($utf16{0}) << 8) | ord($utf16{1});
|
||||
|
||||
switch(true) {
|
||||
case ((0x7F & $bytes) == $bytes):
|
||||
// this case should never be reached, because we are in ASCII range
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr(0x7F & $bytes);
|
||||
|
||||
case (0x07FF & $bytes) == $bytes:
|
||||
// return a 2-byte UTF-8 character
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr(0xC0 | (($bytes >> 6) & 0x1F))
|
||||
. chr(0x80 | ($bytes & 0x3F));
|
||||
|
||||
case (0xFFFF & $bytes) == $bytes:
|
||||
// return a 3-byte UTF-8 character
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr(0xE0 | (($bytes >> 12) & 0x0F))
|
||||
. chr(0x80 | (($bytes >> 6) & 0x3F))
|
||||
. chr(0x80 | ($bytes & 0x3F));
|
||||
}
|
||||
|
||||
// ignoring UTF-32 for now, sorry
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* convert a string from one UTF-8 char to one UTF-16 char
|
||||
*
|
||||
* Normally should be handled by mb_convert_encoding, but
|
||||
* provides a slower PHP-only method for installations
|
||||
* that lack the multibye string extension.
|
||||
*
|
||||
* @param string $utf8 UTF-8 character
|
||||
* @return string UTF-16 character
|
||||
* @access private
|
||||
*/
|
||||
function utf82utf16($utf8)
|
||||
{
|
||||
// oh please oh please oh please oh please oh please
|
||||
if(function_exists('mb_convert_encoding')) {
|
||||
return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
|
||||
}
|
||||
|
||||
switch(strlen($utf8)) {
|
||||
case 1:
|
||||
// this case should never be reached, because we are in ASCII range
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return $utf8;
|
||||
|
||||
case 2:
|
||||
// return a UTF-16 character from a 2-byte UTF-8 char
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr(0x07 & (ord($utf8{0}) >> 2))
|
||||
. chr((0xC0 & (ord($utf8{0}) << 6))
|
||||
| (0x3F & ord($utf8{1})));
|
||||
|
||||
case 3:
|
||||
// return a UTF-16 character from a 3-byte UTF-8 char
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr((0xF0 & (ord($utf8{0}) << 4))
|
||||
| (0x0F & (ord($utf8{1}) >> 2)))
|
||||
. chr((0xC0 & (ord($utf8{1}) << 6))
|
||||
| (0x7F & ord($utf8{2})));
|
||||
}
|
||||
|
||||
// ignoring UTF-32 for now, sorry
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* encodes an arbitrary variable into JSON format
|
||||
*
|
||||
* @param mixed $var any number, boolean, string, array, or object to be encoded.
|
||||
* see argument 1 to Services_JSON() above for array-parsing behavior.
|
||||
* if var is a strng, note that encode() always expects it
|
||||
* to be in ASCII or UTF-8 format!
|
||||
*
|
||||
* @return mixed JSON string representation of input var or an error if a problem occurs
|
||||
* @access public
|
||||
*/
|
||||
function encode($var)
|
||||
{
|
||||
switch (gettype($var)) {
|
||||
case 'boolean':
|
||||
return $var ? 'true' : 'false';
|
||||
|
||||
case 'NULL':
|
||||
return 'null';
|
||||
|
||||
case 'integer':
|
||||
return (int) $var;
|
||||
|
||||
case 'double':
|
||||
case 'float':
|
||||
return (float) $var;
|
||||
|
||||
case 'string':
|
||||
// STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
|
||||
$ascii = '';
|
||||
$strlen_var = strlen($var);
|
||||
|
||||
/*
|
||||
* Iterate over every character in the string,
|
||||
* escaping with a slash or encoding to UTF-8 where necessary
|
||||
*/
|
||||
for ($c = 0; $c < $strlen_var; ++$c) {
|
||||
|
||||
$ord_var_c = ord($var{$c});
|
||||
|
||||
switch (true) {
|
||||
case $ord_var_c == 0x08:
|
||||
$ascii .= '\b';
|
||||
break;
|
||||
case $ord_var_c == 0x09:
|
||||
$ascii .= '\t';
|
||||
break;
|
||||
case $ord_var_c == 0x0A:
|
||||
$ascii .= '\n';
|
||||
break;
|
||||
case $ord_var_c == 0x0C:
|
||||
$ascii .= '\f';
|
||||
break;
|
||||
case $ord_var_c == 0x0D:
|
||||
$ascii .= '\r';
|
||||
break;
|
||||
|
||||
case $ord_var_c == 0x22:
|
||||
case $ord_var_c == 0x2F:
|
||||
case $ord_var_c == 0x5C:
|
||||
// double quote, slash, slosh
|
||||
$ascii .= '\\'.$var{$c};
|
||||
break;
|
||||
|
||||
case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
|
||||
// characters U-00000000 - U-0000007F (same as ASCII)
|
||||
$ascii .= $var{$c};
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xE0) == 0xC0):
|
||||
// characters U-00000080 - U-000007FF, mask 110XXXXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c, ord($var{$c + 1}));
|
||||
$c += 1;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xF0) == 0xE0):
|
||||
// characters U-00000800 - U-0000FFFF, mask 1110XXXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c,
|
||||
ord($var{$c + 1}),
|
||||
ord($var{$c + 2}));
|
||||
$c += 2;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xF8) == 0xF0):
|
||||
// characters U-00010000 - U-001FFFFF, mask 11110XXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c,
|
||||
ord($var{$c + 1}),
|
||||
ord($var{$c + 2}),
|
||||
ord($var{$c + 3}));
|
||||
$c += 3;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xFC) == 0xF8):
|
||||
// characters U-00200000 - U-03FFFFFF, mask 111110XX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c,
|
||||
ord($var{$c + 1}),
|
||||
ord($var{$c + 2}),
|
||||
ord($var{$c + 3}),
|
||||
ord($var{$c + 4}));
|
||||
$c += 4;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xFE) == 0xFC):
|
||||
// characters U-04000000 - U-7FFFFFFF, mask 1111110X
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c,
|
||||
ord($var{$c + 1}),
|
||||
ord($var{$c + 2}),
|
||||
ord($var{$c + 3}),
|
||||
ord($var{$c + 4}),
|
||||
ord($var{$c + 5}));
|
||||
$c += 5;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return '"'.$ascii.'"';
|
||||
|
||||
case 'array':
|
||||
/*
|
||||
* As per JSON spec if any array key is not an integer
|
||||
* we must treat the the whole array as an object. We
|
||||
* also try to catch a sparsely populated associative
|
||||
* array with numeric keys here because some JS engines
|
||||
* will create an array with empty indexes up to
|
||||
* max_index which can cause memory issues and because
|
||||
* the keys, which may be relevant, will be remapped
|
||||
* otherwise.
|
||||
*
|
||||
* As per the ECMA and JSON specification an object may
|
||||
* have any string as a property. Unfortunately due to
|
||||
* a hole in the ECMA specification if the key is a
|
||||
* ECMA reserved word or starts with a digit the
|
||||
* parameter is only accessible using ECMAScript's
|
||||
* bracket notation.
|
||||
*/
|
||||
|
||||
// treat as a JSON object
|
||||
if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
|
||||
$properties = array_map(array($this, 'name_value'),
|
||||
array_keys($var),
|
||||
array_values($var));
|
||||
|
||||
foreach($properties as $property) {
|
||||
if(Services_JSON::isError($property)) {
|
||||
return $property;
|
||||
}
|
||||
}
|
||||
|
||||
return '{' . join(',', $properties) . '}';
|
||||
}
|
||||
|
||||
// treat it like a regular array
|
||||
$elements = array_map(array($this, 'encode'), $var);
|
||||
|
||||
foreach($elements as $element) {
|
||||
if(Services_JSON::isError($element)) {
|
||||
return $element;
|
||||
}
|
||||
}
|
||||
|
||||
return '[' . join(',', $elements) . ']';
|
||||
|
||||
case 'object':
|
||||
$vars = get_object_vars($var);
|
||||
|
||||
$properties = array_map(array($this, 'name_value'),
|
||||
array_keys($vars),
|
||||
array_values($vars));
|
||||
|
||||
foreach($properties as $property) {
|
||||
if(Services_JSON::isError($property)) {
|
||||
return $property;
|
||||
}
|
||||
}
|
||||
|
||||
return '{' . join(',', $properties) . '}';
|
||||
|
||||
default:
|
||||
return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
|
||||
? 'null'
|
||||
: new Services_JSON_Error(gettype($var)." can not be encoded as JSON string");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* array-walking function for use in generating JSON-formatted name-value pairs
|
||||
*
|
||||
* @param string $name name of key to use
|
||||
* @param mixed $value reference to an array element to be encoded
|
||||
*
|
||||
* @return string JSON-formatted name-value pair, like '"name":value'
|
||||
* @access private
|
||||
*/
|
||||
function name_value($name, $value)
|
||||
{
|
||||
$encoded_value = $this->encode($value);
|
||||
|
||||
if(Services_JSON::isError($encoded_value)) {
|
||||
return $encoded_value;
|
||||
}
|
||||
|
||||
return $this->encode(strval($name)) . ':' . $encoded_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* reduce a string by removing leading and trailing comments and whitespace
|
||||
*
|
||||
* @param $str string string value to strip of comments and whitespace
|
||||
*
|
||||
* @return string string value stripped of comments and whitespace
|
||||
* @access private
|
||||
*/
|
||||
function reduce_string($str)
|
||||
{
|
||||
$str = preg_replace(array(
|
||||
|
||||
// eliminate single line comments in '// ...' form
|
||||
'#^\s*//(.+)$#m',
|
||||
|
||||
// eliminate multi-line comments in '/* ... */' form, at start of string
|
||||
'#^\s*/\*(.+)\*/#Us',
|
||||
|
||||
// eliminate multi-line comments in '/* ... */' form, at end of string
|
||||
'#/\*(.+)\*/\s*$#Us'
|
||||
|
||||
), '', $str);
|
||||
|
||||
// eliminate extraneous space
|
||||
return trim($str);
|
||||
}
|
||||
|
||||
/**
|
||||
* decodes a JSON string into appropriate variable
|
||||
*
|
||||
* @param string $str JSON-formatted string
|
||||
*
|
||||
* @return mixed number, boolean, string, array, or object
|
||||
* corresponding to given JSON input string.
|
||||
* See argument 1 to Services_JSON() above for object-output behavior.
|
||||
* Note that decode() always returns strings
|
||||
* in ASCII or UTF-8 format!
|
||||
* @access public
|
||||
*/
|
||||
function decode($str)
|
||||
{
|
||||
$str = $this->reduce_string($str);
|
||||
|
||||
switch (strtolower($str)) {
|
||||
case 'true':
|
||||
return true;
|
||||
|
||||
case 'false':
|
||||
return false;
|
||||
|
||||
case 'null':
|
||||
return null;
|
||||
|
||||
default:
|
||||
$m = array();
|
||||
|
||||
if (is_numeric($str)) {
|
||||
// Lookie-loo, it's a number
|
||||
|
||||
// This would work on its own, but I'm trying to be
|
||||
// good about returning integers where appropriate:
|
||||
// return (float)$str;
|
||||
|
||||
// Return float or int, as appropriate
|
||||
return ((float)$str == (integer)$str)
|
||||
? (integer)$str
|
||||
: (float)$str;
|
||||
|
||||
} elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) {
|
||||
// STRINGS RETURNED IN UTF-8 FORMAT
|
||||
$delim = substr($str, 0, 1);
|
||||
$chrs = substr($str, 1, -1);
|
||||
$utf8 = '';
|
||||
$strlen_chrs = strlen($chrs);
|
||||
|
||||
for ($c = 0; $c < $strlen_chrs; ++$c) {
|
||||
|
||||
$substr_chrs_c_2 = substr($chrs, $c, 2);
|
||||
$ord_chrs_c = ord($chrs{$c});
|
||||
|
||||
switch (true) {
|
||||
case $substr_chrs_c_2 == '\b':
|
||||
$utf8 .= chr(0x08);
|
||||
++$c;
|
||||
break;
|
||||
case $substr_chrs_c_2 == '\t':
|
||||
$utf8 .= chr(0x09);
|
||||
++$c;
|
||||
break;
|
||||
case $substr_chrs_c_2 == '\n':
|
||||
$utf8 .= chr(0x0A);
|
||||
++$c;
|
||||
break;
|
||||
case $substr_chrs_c_2 == '\f':
|
||||
$utf8 .= chr(0x0C);
|
||||
++$c;
|
||||
break;
|
||||
case $substr_chrs_c_2 == '\r':
|
||||
$utf8 .= chr(0x0D);
|
||||
++$c;
|
||||
break;
|
||||
|
||||
case $substr_chrs_c_2 == '\\"':
|
||||
case $substr_chrs_c_2 == '\\\'':
|
||||
case $substr_chrs_c_2 == '\\\\':
|
||||
case $substr_chrs_c_2 == '\\/':
|
||||
if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
|
||||
($delim == "'" && $substr_chrs_c_2 != '\\"')) {
|
||||
$utf8 .= $chrs{++$c};
|
||||
}
|
||||
break;
|
||||
|
||||
case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)):
|
||||
// single, escaped unicode character
|
||||
$utf16 = chr(hexdec(substr($chrs, ($c + 2), 2)))
|
||||
. chr(hexdec(substr($chrs, ($c + 4), 2)));
|
||||
$utf8 .= $this->utf162utf8($utf16);
|
||||
$c += 5;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):
|
||||
$utf8 .= $chrs{$c};
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xE0) == 0xC0:
|
||||
// characters U-00000080 - U-000007FF, mask 110XXXXX
|
||||
//see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 2);
|
||||
++$c;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xF0) == 0xE0:
|
||||
// characters U-00000800 - U-0000FFFF, mask 1110XXXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 3);
|
||||
$c += 2;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xF8) == 0xF0:
|
||||
// characters U-00010000 - U-001FFFFF, mask 11110XXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 4);
|
||||
$c += 3;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xFC) == 0xF8:
|
||||
// characters U-00200000 - U-03FFFFFF, mask 111110XX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 5);
|
||||
$c += 4;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xFE) == 0xFC:
|
||||
// characters U-04000000 - U-7FFFFFFF, mask 1111110X
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 6);
|
||||
$c += 5;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $utf8;
|
||||
|
||||
} elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) {
|
||||
// array, or object notation
|
||||
|
||||
if ($str{0} == '[') {
|
||||
$stk = array(SERVICES_JSON_IN_ARR);
|
||||
$arr = array();
|
||||
} else {
|
||||
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
|
||||
$stk = array(SERVICES_JSON_IN_OBJ);
|
||||
$obj = array();
|
||||
} else {
|
||||
$stk = array(SERVICES_JSON_IN_OBJ);
|
||||
$obj = new stdClass();
|
||||
}
|
||||
}
|
||||
|
||||
array_push($stk, array('what' => SERVICES_JSON_SLICE,
|
||||
'where' => 0,
|
||||
'delim' => false));
|
||||
|
||||
$chrs = substr($str, 1, -1);
|
||||
$chrs = $this->reduce_string($chrs);
|
||||
|
||||
if ($chrs == '') {
|
||||
if (reset($stk) == SERVICES_JSON_IN_ARR) {
|
||||
return $arr;
|
||||
|
||||
} else {
|
||||
return $obj;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//print("\nparsing {$chrs}\n");
|
||||
|
||||
$strlen_chrs = strlen($chrs);
|
||||
|
||||
for ($c = 0; $c <= $strlen_chrs; ++$c) {
|
||||
|
||||
$top = end($stk);
|
||||
$substr_chrs_c_2 = substr($chrs, $c, 2);
|
||||
|
||||
if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
|
||||
// found a comma that is not inside a string, array, etc.,
|
||||
// OR we've reached the end of the character list
|
||||
$slice = substr($chrs, $top['where'], ($c - $top['where']));
|
||||
array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false));
|
||||
//print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||
|
||||
if (reset($stk) == SERVICES_JSON_IN_ARR) {
|
||||
// we are in an array, so just push an element onto the stack
|
||||
array_push($arr, $this->decode($slice));
|
||||
|
||||
} elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
|
||||
// we are in an object, so figure
|
||||
// out the property name and set an
|
||||
// element in an associative array,
|
||||
// for now
|
||||
$parts = array();
|
||||
|
||||
if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
|
||||
// "name":value pair
|
||||
$key = $this->decode($parts[1]);
|
||||
$val = $this->decode($parts[2]);
|
||||
|
||||
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
|
||||
$obj[$key] = $val;
|
||||
} else {
|
||||
$obj->$key = $val;
|
||||
}
|
||||
} elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
|
||||
// name:value pair, where name is unquoted
|
||||
$key = $parts[1];
|
||||
$val = $this->decode($parts[2]);
|
||||
|
||||
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
|
||||
$obj[$key] = $val;
|
||||
} else {
|
||||
$obj->$key = $val;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
|
||||
// found a quote, and we are not inside a string
|
||||
array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c}));
|
||||
//print("Found start of string at {$c}\n");
|
||||
|
||||
} elseif (($chrs{$c} == $top['delim']) &&
|
||||
($top['what'] == SERVICES_JSON_IN_STR) &&
|
||||
((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) {
|
||||
// found a quote, we're in a string, and it's not escaped
|
||||
// we know that it's not escaped becase there is _not_ an
|
||||
// odd number of backslashes at the end of the string so far
|
||||
array_pop($stk);
|
||||
//print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
|
||||
|
||||
} elseif (($chrs{$c} == '[') &&
|
||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
||||
// found a left-bracket, and we are in an array, object, or slice
|
||||
array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
|
||||
//print("Found start of array at {$c}\n");
|
||||
|
||||
} elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
|
||||
// found a right-bracket, and we're in an array
|
||||
array_pop($stk);
|
||||
//print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||
|
||||
} elseif (($chrs{$c} == '{') &&
|
||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
||||
// found a left-brace, and we are in an array, object, or slice
|
||||
array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
|
||||
//print("Found start of object at {$c}\n");
|
||||
|
||||
} elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
|
||||
// found a right-brace, and we're in an object
|
||||
array_pop($stk);
|
||||
//print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||
|
||||
} elseif (($substr_chrs_c_2 == '/*') &&
|
||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
||||
// found a comment start, and we are in an array, object, or slice
|
||||
array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false));
|
||||
$c++;
|
||||
//print("Found start of comment at {$c}\n");
|
||||
|
||||
} elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) {
|
||||
// found a comment end, and we're in one now
|
||||
array_pop($stk);
|
||||
$c++;
|
||||
|
||||
for ($i = $top['where']; $i <= $c; ++$i)
|
||||
$chrs = substr_replace($chrs, ' ', $i, 1);
|
||||
|
||||
//print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (reset($stk) == SERVICES_JSON_IN_ARR) {
|
||||
return $arr;
|
||||
|
||||
} elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
|
||||
return $obj;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Ultimately, this should just call PEAR::isError()
|
||||
*/
|
||||
function isError($data, $code = null)
|
||||
{
|
||||
if (class_exists('pear')) {
|
||||
return PEAR::isError($data, $code);
|
||||
} elseif (is_object($data) && (get_class($data) == 'services_json_error' ||
|
||||
is_subclass_of($data, 'services_json_error'))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (class_exists('PEAR_Error')) {
|
||||
|
||||
class Services_JSON_Error extends PEAR_Error
|
||||
{
|
||||
function Services_JSON_Error($message = 'unknown error', $code = null,
|
||||
$mode = null, $options = null, $userinfo = null)
|
||||
{
|
||||
parent::PEAR_Error($message, $code, $mode, $options, $userinfo);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
/**
|
||||
* @todo Ultimately, this class shall be descended from PEAR_Error
|
||||
*/
|
||||
class Services_JSON_Error
|
||||
{
|
||||
function Services_JSON_Error($message = 'unknown error', $code = null,
|
||||
$mode = null, $options = null, $userinfo = null)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
3602
thirdparty/phing/lib/Zip.php
vendored
3602
thirdparty/phing/lib/Zip.php
vendored
File diff suppressed because it is too large
Load Diff
51
thirdparty/phing/system/io/TokenReader.php
vendored
51
thirdparty/phing/system/io/TokenReader.php
vendored
@@ -1,51 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* $Id: TokenReader.php 3076 2006-12-18 08:52:12Z fabien $
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information please see
|
||||
* <http://phing.info>.
|
||||
*/
|
||||
|
||||
include_once 'phing/system/io/Reader.php';
|
||||
include_once 'phing/filters/ReplaceTokens.php'; // for class Token
|
||||
|
||||
/**
|
||||
* Abstract class for reading Tokens from a resource
|
||||
*
|
||||
* @author Manuel Holtgewe
|
||||
* @version $Revision: 1.3 $
|
||||
* @access public
|
||||
* @package phing.system.io
|
||||
*/
|
||||
class TokenReader extends Reader {
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
function __construct() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a token from the resource and returns it as a
|
||||
* Token object.
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function readToken() {
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
//test
|
||||
use ProcessMaker\Core\System;
|
||||
|
||||
class PmBootstrap extends Bootstrap
|
||||
{
|
||||
public $pmConfig = array();
|
||||
@@ -25,7 +27,7 @@ class PmBootstrap extends Bootstrap
|
||||
{
|
||||
parent::configure();
|
||||
|
||||
$this->pmConfig = PmSystem::getSystemConfiguration();
|
||||
$this->pmConfig = System::getSystemConfiguration();
|
||||
|
||||
$e_all = defined('E_DEPRECATED') ? E_ALL & ~E_DEPRECATED : E_ALL;
|
||||
$e_all = defined('E_STRICT') ? $e_all & ~E_STRICT : $e_all;
|
||||
@@ -82,7 +84,7 @@ class PmBootstrap extends Bootstrap
|
||||
$this->autoloader->registerClass('publisher', PATH_GULLIVER . 'class.publisher');
|
||||
$this->autoloader->registerClass('templatePower', PATH_GULLIVER . 'class.templatePower');
|
||||
$this->autoloader->registerClass('xmlDocument', PATH_GULLIVER . 'class.xmlDocument');
|
||||
$this->autoloader->registerClass('XmlForm_Field_XmlMenu', PATH_GULLIVER . 'class.xmlMenu');
|
||||
$this->autoloader->registerClass('XmlFormFieldXmlMenu', PATH_GULLIVER . 'class.xmlMenu');
|
||||
$this->autoloader->registerClass('xmlform', PATH_GULLIVER . 'class.xmlform');
|
||||
|
||||
$this->autoloader->registerClass('xmlformExtension', PATH_GULLIVER . 'class.xmlformExtension');
|
||||
@@ -96,8 +98,8 @@ class PmBootstrap extends Bootstrap
|
||||
$this->autoloader->registerClass('headPublisher', PATH_GULLIVER . 'class.headPublisher');
|
||||
$this->autoloader->registerClass('Xml_Node', PATH_GULLIVER . 'class.xmlDocument');
|
||||
$this->autoloader->registerClass('Xml_document', PATH_GULLIVER . 'class.xmlDocument');
|
||||
$this->autoloader->registerClass('XmlForm_Field_*', PATH_GULLIVER . 'class.xmlform');
|
||||
$this->autoloader->registerClass('serverConf', PATH_CORE . 'classes/class.serverConfiguration');
|
||||
$this->autoloader->registerClass('XmlFormField*', PATH_GULLIVER . 'class.xmlform');
|
||||
$this->autoloader->registerClass('ServerConf', PATH_CORE . 'classes/class.serverConfiguration');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
|
||||
use ProcessMaker\Core\System;
|
||||
|
||||
require_once(__DIR__ . '/../../../bootstrap/autoload.php');
|
||||
try {
|
||||
//Set variables
|
||||
@@ -77,7 +80,7 @@ try {
|
||||
$classLoader->addModelClassPath(PATH_TRUNK . 'workflow' . PATH_SEP . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'model' . PATH_SEP);
|
||||
//Load classes
|
||||
|
||||
$arraySystemConfiguration = PmSystem::getSystemConfiguration();
|
||||
$arraySystemConfiguration = System::getSystemConfiguration();
|
||||
|
||||
$e_all = (defined('E_DEPRECATED'))? E_ALL & ~E_DEPRECATED : E_ALL;
|
||||
$e_all = (defined('E_STRICT'))? $e_all & ~E_STRICT : $e_all;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
require_once(__DIR__ . '/../../../bootstrap/autoload.php');
|
||||
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
|
||||
register_shutdown_function(
|
||||
@@ -68,7 +69,7 @@ try {
|
||||
|
||||
$classLoader->addModelClassPath(PATH_TRUNK . 'workflow' . PATH_SEP . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'model' . PATH_SEP);
|
||||
|
||||
$arraySystemConfiguration = PmSystem::getSystemConfiguration('', '', $workspace);
|
||||
$arraySystemConfiguration = System::getSystemConfiguration('', '', $workspace);
|
||||
|
||||
$e_all = (defined('E_DEPRECATED'))? E_ALL & ~E_DEPRECATED : E_ALL;
|
||||
$e_all = (defined('E_STRICT'))? $e_all & ~E_STRICT : $e_all;
|
||||
@@ -333,7 +334,7 @@ function resendEmails()
|
||||
$dateResend = date("Y-m-d H:i:s", $mktDateSystem - (7 * 24 * 60 * 60));
|
||||
}
|
||||
|
||||
$oSpool = new spoolRun();
|
||||
$oSpool = new SpoolRun();
|
||||
$oSpool->resendEmails($dateResend, 1);
|
||||
|
||||
saveLog("resendEmails", "action", "Resending Emails", "c");
|
||||
@@ -980,7 +981,7 @@ function synchronizeGmailLabels()
|
||||
}
|
||||
$licensedFeatures = &PMLicensedFeatures::getSingleton();
|
||||
if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
|
||||
$pmGoogle = new PMGoogleApi();
|
||||
$pmGoogle = new PmGoogleApi();
|
||||
if ($pmGoogle->getServiceGmailStatus()) {
|
||||
setExecutionMessage("Synchronize labels in Gmail");
|
||||
$labGmail = new labelsGmail();
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
// php reindex_solr.php workspacename [reindexall|reindexmissing|optimizeindex] [-skip 1005] [-reindextrunksize 1000]
|
||||
// var_dump($argv);
|
||||
//(count ($argv) == 4) || ((count ($argv) == 5) && ($argv [3] != '-skip'))
|
||||
use ProcessMaker\Core\System;
|
||||
|
||||
$commandLineSyntaxMsg = "Invalid command line arguments: \n " .
|
||||
"syntax: ".
|
||||
"php reindex_solr.php [workspace_name] [reindexall|reindexmissing|optimizeindex|reindexone|deleteindexone] [-skip {record_number}] [-reindextrunksize {trunk_size}] [-appuid {APP_UID}]\n" .
|
||||
@@ -143,7 +145,7 @@ if (! defined ('SYS_SYS')) {
|
||||
// ****************************************
|
||||
// read initialize file
|
||||
require_once PATH_HOME . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'class.system.php';
|
||||
$config = PmSystem::getSystemConfiguration ('', '', SYS_SYS);
|
||||
$config = System::getSystemConfiguration ('', '', SYS_SYS);
|
||||
define ('MEMCACHED_ENABLED', $config ['memcached']);
|
||||
define ('MEMCACHED_SERVER', $config ['memcached_server']);
|
||||
define ('TIME_ZONE', $config ['time_zone']);
|
||||
@@ -259,7 +261,7 @@ function processWorkspace()
|
||||
|
||||
try {
|
||||
|
||||
if (($solrConf = PmSystem::solrEnv (SYS_SYS)) !== false) {
|
||||
if (($solrConf = System::solrEnv (SYS_SYS)) !== false) {
|
||||
print "Solr Configuration file: " . PATH_DATA_SITE . "env.ini\n";
|
||||
print "solr_enabled: " . $solrConf ['solr_enabled'] . "\n";
|
||||
print "solr_host: " . $solrConf ['solr_host'] . "\n";
|
||||
|
||||
@@ -57,7 +57,7 @@ function run_addon_core_install($args)
|
||||
}
|
||||
|
||||
///////
|
||||
$ws = new workspaceTools($workspace);
|
||||
$ws = new WorkspaceTools($workspace);
|
||||
$ws->initPropel(false);
|
||||
|
||||
require_once PATH_CORE . 'methods' . PATH_SEP . 'enterprise' . PATH_SEP . 'enterprise.php';
|
||||
@@ -73,7 +73,7 @@ function run_addon_core_install($args)
|
||||
$addon->install();
|
||||
|
||||
if ($addon->isCore()) {
|
||||
$ws = new workspaceTools($workspace);
|
||||
$ws = new WorkspaceTools($workspace);
|
||||
$ws->initPropel(false);
|
||||
$addon->setState("install-finish");
|
||||
} else {
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<?php
|
||||
|
||||
/* Get the size of the terminal (only works on Linux, on Windows it's always 80) */
|
||||
|
||||
use ProcessMaker\Core\System;
|
||||
|
||||
preg_match_all("/rows.([0-9]+);.columns.([0-9]+);/", strtolower(exec('stty -a |grep columns')), $output);
|
||||
if (sizeof($output) == 3 && isset($output[2]) && isset($output[2][0])) {
|
||||
define("COLUMNS", $output[2][0]);
|
||||
|
||||
@@ -22,7 +22,7 @@ function runHotfixInstall($command, $args)
|
||||
foreach ($arrayFile as $value) {
|
||||
$f = $value;
|
||||
|
||||
$result = workspaceTools::hotfixInstall($f);
|
||||
$result = WorkspaceTools::hotfixInstall($f);
|
||||
|
||||
CLI::logging($result["message"] . "\n");
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ function cliListIds($command, $args)
|
||||
$workspace->dbInfo['DB_USER'],
|
||||
$workspace->dbInfo['DB_PASS']
|
||||
);
|
||||
foreach (workspaceTools::$populateIdsQueries as $query) {
|
||||
foreach (WorkspaceTools::$populateIdsQueries as $query) {
|
||||
echo ".";
|
||||
$dbh->query($query);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
* @package workflow-engine-bin-tasks
|
||||
*/
|
||||
|
||||
use ProcessMaker\Core\System;
|
||||
|
||||
CLI::taskName('upgrade');
|
||||
CLI::taskDescription("Upgrade workspaces.\n\n This command should be run after upgrading ProcessMaker to a new version so that all workspaces are also upgraded to the\n new version.");
|
||||
|
||||
@@ -87,7 +89,7 @@ function run_upgrade($command, $args)
|
||||
}
|
||||
$flag = G::isPMUnderUpdating(1, $oneWorkspace);
|
||||
//start to upgrade
|
||||
$checksum = PmSystem::verifyChecksum();
|
||||
$checksum = System::verifyChecksum();
|
||||
if ($checksum === false) {
|
||||
CLI::logging(CLI::error("checksum.txt not found, integrity check is not possible") . "\n");
|
||||
if (!CLI::question("Integrity check failed, do you want to continue the upgrade?")) {
|
||||
@@ -177,7 +179,7 @@ function run_upgrade($command, $args)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
CLI::logging('ProcessMaker ' . PmSystem::getVersion(). ' installed', PATH_DATA . 'log/upgrades.log');
|
||||
CLI::logging('ProcessMaker ' . System::getVersion(). ' installed', PATH_DATA . 'log/upgrades.log');
|
||||
}
|
||||
|
||||
//Safe upgrade for JavaScript files
|
||||
@@ -219,10 +221,10 @@ function run_unify_database($args)
|
||||
if (sizeof($args) > 2) {
|
||||
$filename = array_pop($args);
|
||||
foreach ($args as $arg) {
|
||||
$workspaces[] = new workspaceTools($arg);
|
||||
$workspaces[] = new WorkspaceTools($arg);
|
||||
}
|
||||
} else if (sizeof($args) > 0) {
|
||||
$workspace = new workspaceTools($args[0]);
|
||||
$workspace = new WorkspaceTools($args[0]);
|
||||
$workspaces[] = $workspace;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -26,6 +26,8 @@
|
||||
// php reindex_solr.php workspacename [reindexall|reindexmissing|optimizeindex] [-skip 1005] [-reindextrunksize 1000]
|
||||
// var_dump($argv);
|
||||
//(count ($argv) == 4) || ((count ($argv) == 5) && ($argv [3] != '-skip'))
|
||||
use ProcessMaker\Core\System;
|
||||
|
||||
$commandLineSyntaxMsg = "Invalid command line arguments: \n " .
|
||||
"Verify the list of cases comparing db vs solr lists by user if usr_uid is specify only verify one user otherwhise all users ".
|
||||
"syntax: ".
|
||||
@@ -117,7 +119,7 @@ if (! defined ('SYS_SYS')) {
|
||||
// ****************************************
|
||||
// read initialize file
|
||||
require_once PATH_HOME . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'class.system.php';
|
||||
$config = PmSystem::getSystemConfiguration ('', '', SYS_SYS);
|
||||
$config = System::getSystemConfiguration ('', '', SYS_SYS);
|
||||
define ('MEMCACHED_ENABLED', $config ['memcached']);
|
||||
define ('MEMCACHED_SERVER', $config ['memcached_server']);
|
||||
define ('TIME_ZONE', $config ['time_zone']);
|
||||
@@ -335,7 +337,7 @@ function displayMissingCases($aAppUidsDB, $aAppUidsSolr)
|
||||
|
||||
function getListUids($usrUid, $action)
|
||||
{
|
||||
if (($solrConf = PmSystem::solrEnv (SYS_SYS)) !== false) {
|
||||
if (($solrConf = System::solrEnv (SYS_SYS)) !== false) {
|
||||
|
||||
print "Solr Configuration file: " . PATH_DATA_SITE . "env.ini\n";
|
||||
print "solr_enabled: " . $solrConf ['solr_enabled'] . "\n";
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<?php
|
||||
|
||||
|
||||
class actionsByEmailCoreClass extends PMPlugin
|
||||
|
||||
class ActionsByEmailCoreClass extends PMPlugin
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
@@ -170,7 +171,7 @@ class actionsByEmailCoreClass extends PMPlugin
|
||||
$field->label = '';
|
||||
$actionField = str_replace(array('@@', '@#', '@=', '@%', '@?', '@$'), '', $configuration['ABE_ACTION_FIELD']);
|
||||
|
||||
$obj = new pmDynaform($configuration['DYN_UID']);
|
||||
$obj = new PmDynaform($configuration['DYN_UID']);
|
||||
$configuration['CURRENT_DYNAFORM'] = $configuration['DYN_UID'];
|
||||
$file = $obj->printPmDynaformAbe($configuration);
|
||||
$__ABE__ .= $file;
|
||||
@@ -221,7 +222,7 @@ class actionsByEmailCoreClass extends PMPlugin
|
||||
}
|
||||
}
|
||||
|
||||
$obj = new pmDynaform($configuration['DYN_UID']);
|
||||
$obj = new PmDynaform($configuration['DYN_UID']);
|
||||
$configuration['CURRENT_DYNAFORM'] = $configuration['DYN_UID'];
|
||||
$file = $obj->printPmDynaformAbe($configuration);
|
||||
$__ABE__ .= $file;
|
||||
@@ -290,7 +291,7 @@ class actionsByEmailCoreClass extends PMPlugin
|
||||
}
|
||||
}
|
||||
|
||||
$wsBaseInstance = new wsBase();
|
||||
$wsBaseInstance = new WsBase();
|
||||
$result = $wsBaseInstance->sendMessage(
|
||||
$data->APP_UID,
|
||||
$emailFrom,
|
||||
@@ -333,4 +334,3 @@ class actionsByEmailCoreClass extends PMPlugin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Class InputDocumentDrive
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class InputDocumentDrive
|
||||
*/
|
||||
class AppDocumentDrive
|
||||
{
|
||||
/**
|
||||
* @var PMDrive $drive
|
||||
* @var PmDrive $drive
|
||||
*/
|
||||
private $drive;
|
||||
/**
|
||||
@@ -28,7 +32,7 @@ class AppDocumentDrive
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->drive = new PMDrive();
|
||||
$this->drive = new PmDrive();
|
||||
$status = $this->drive->getServiceDriveStatus();
|
||||
$status = !empty($status) ? ($status == 1 ? true : false): false;
|
||||
$this->usersEmail = '';
|
||||
2830
workflow/engine/classes/AppSolr.php
Normal file
2830
workflow/engine/classes/AppSolr.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/**
|
||||
* Invalid search text for Solr exception
|
||||
*/
|
||||
|
||||
/**
|
||||
* Application APP_DATA could not be unserialized exception
|
||||
*/
|
||||
class ApplicationAppDataUnserializeException 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";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* Invalid search text for Solr exception
|
||||
*
|
||||
* @author Herbert Saal Gutierrez
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Dynaform file corrupt
|
||||
*/
|
||||
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";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Application without Delegations exception
|
||||
*/
|
||||
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";
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
|
||||
|
||||
class Applications
|
||||
{
|
||||
/**
|
||||
@@ -1213,4 +1214,3 @@ class Applications
|
||||
return $steps;
|
||||
}
|
||||
}
|
||||
|
||||
365
workflow/engine/classes/Archive.php
Normal file
365
workflow/engine/classes/Archive.php
Normal file
@@ -0,0 +1,365 @@
|
||||
<?php
|
||||
/*--------------------------------------------------
|
||||
* TAR/GZIP/BZIP2/ZIP ARCHIVE CLASSES 2.1
|
||||
* By Devin Doucette
|
||||
* Copyright (c) 2005 Devin Doucette
|
||||
* Email: darksnoopy@shaw.ca
|
||||
*--------------------------------------------------
|
||||
* Email bugs/suggestions to darksnoopy@shaw.ca
|
||||
*--------------------------------------------------
|
||||
* This script has been created and released under
|
||||
* the GNU GPL and is free to use and redistribute
|
||||
* only if this copyright statement is not removed
|
||||
*--------------------------------------------------*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @package workflow.engine.classes
|
||||
*/
|
||||
class Archive
|
||||
{
|
||||
|
||||
/**
|
||||
* This function is the constructor of the class archive
|
||||
*
|
||||
* @param string $name
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
public function archive($name)
|
||||
{
|
||||
$this->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);
|
||||
}
|
||||
}
|
||||
@@ -1,34 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* class.ArrayPeer.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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
|
||||
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';
|
||||
|
||||
/**
|
||||
* Base static class for performing query and update operations on the 'APPLICATION' table.
|
||||
@@ -37,18 +9,11 @@ include_once 'classes/model/Application.php';
|
||||
*/
|
||||
abstract class ArrayBasePeer
|
||||
{
|
||||
|
||||
/**
|
||||
* The default database name for this class
|
||||
*/
|
||||
const DATABASE_NAME = 'dbarray';
|
||||
|
||||
/**
|
||||
* The table name for this class
|
||||
*/
|
||||
//const TABLE_NAME = 'APPLICATION';
|
||||
|
||||
|
||||
/**
|
||||
* A class that can be returned by this peer.
|
||||
*/
|
||||
@@ -150,10 +115,10 @@ abstract class ArrayBasePeer
|
||||
* First dimension keys are the type constants
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
private static $fieldNames = array (BasePeer::TYPE_PHPNAME => array ('AppUid','AppNumber','AppParent','AppStatus','ProUid','AppProcStatus','AppProcCode','AppParallel','AppInitUser','AppCurUser','AppCreateDate','AppInitDate','AppFinishDate','AppUpdateDate','AppData'
|
||||
),BasePeer::TYPE_COLNAME => array (ApplicationPeer::APP_UID,ApplicationPeer::APP_NUMBER,ApplicationPeer::APP_PARENT,ApplicationPeer::APP_STATUS,ApplicationPeer::PRO_UID,ApplicationPeer::APP_PROC_STATUS,ApplicationPeer::APP_PROC_CODE,ApplicationPeer::APP_PARALLEL,ApplicationPeer::APP_INIT_USER,ApplicationPeer::APP_CUR_USER,ApplicationPeer::APP_CREATE_DATE,ApplicationPeer::APP_INIT_DATE,ApplicationPeer::APP_FINISH_DATE,ApplicationPeer::APP_UPDATE_DATE,ApplicationPeer::APP_DATA
|
||||
),BasePeer::TYPE_FIELDNAME => array ('APP_UID','APP_NUMBER','APP_PARENT','APP_STATUS','PRO_UID','APP_PROC_STATUS','APP_PROC_CODE','APP_PARALLEL','APP_INIT_USER','APP_CUR_USER','APP_CREATE_DATE','APP_INIT_DATE','APP_FINISH_DATE','APP_UPDATE_DATE','APP_DATA'
|
||||
),BasePeer::TYPE_NUM => array (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14
|
||||
private static $fieldNames = array(BasePeer::TYPE_PHPNAME => array('AppUid', 'AppNumber', 'AppParent', 'AppStatus', 'ProUid', 'AppProcStatus', 'AppProcCode', 'AppParallel', 'AppInitUser', 'AppCurUser', 'AppCreateDate', 'AppInitDate', 'AppFinishDate', 'AppUpdateDate', 'AppData'
|
||||
), BasePeer::TYPE_COLNAME => array(ApplicationPeer::APP_UID, ApplicationPeer::APP_NUMBER, ApplicationPeer::APP_PARENT, ApplicationPeer::APP_STATUS, ApplicationPeer::PRO_UID, ApplicationPeer::APP_PROC_STATUS, ApplicationPeer::APP_PROC_CODE, ApplicationPeer::APP_PARALLEL, ApplicationPeer::APP_INIT_USER, ApplicationPeer::APP_CUR_USER, ApplicationPeer::APP_CREATE_DATE, ApplicationPeer::APP_INIT_DATE, ApplicationPeer::APP_FINISH_DATE, ApplicationPeer::APP_UPDATE_DATE, ApplicationPeer::APP_DATA
|
||||
), BasePeer::TYPE_FIELDNAME => array('APP_UID', 'APP_NUMBER', 'APP_PARENT', 'APP_STATUS', 'PRO_UID', 'APP_PROC_STATUS', 'APP_PROC_CODE', 'APP_PARALLEL', 'APP_INIT_USER', 'APP_CUR_USER', 'APP_CREATE_DATE', 'APP_INIT_DATE', 'APP_FINISH_DATE', 'APP_UPDATE_DATE', 'APP_DATA'
|
||||
), BasePeer::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
|
||||
)
|
||||
);
|
||||
|
||||
@@ -163,10 +128,10 @@ abstract class ArrayBasePeer
|
||||
* First dimension keys are the type constants
|
||||
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
private static $fieldKeys = array (BasePeer::TYPE_PHPNAME => array ('AppUid' => 0,'AppNumber' => 1,'AppParent' => 2,'AppStatus' => 3,'ProUid' => 4,'AppProcStatus' => 5,'AppProcCode' => 6,'AppParallel' => 7,'AppInitUser' => 8,'AppCurUser' => 9,'AppCreateDate' => 10,'AppInitDate' => 11,'AppFinishDate' => 12,'AppUpdateDate' => 13,'AppData' => 14
|
||||
),BasePeer::TYPE_COLNAME => array (ApplicationPeer::APP_UID => 0,ApplicationPeer::APP_NUMBER => 1,ApplicationPeer::APP_PARENT => 2,ApplicationPeer::APP_STATUS => 3,ApplicationPeer::PRO_UID => 4,ApplicationPeer::APP_PROC_STATUS => 5,ApplicationPeer::APP_PROC_CODE => 6,ApplicationPeer::APP_PARALLEL => 7,ApplicationPeer::APP_INIT_USER => 8,ApplicationPeer::APP_CUR_USER => 9,ApplicationPeer::APP_CREATE_DATE => 10,ApplicationPeer::APP_INIT_DATE => 11,ApplicationPeer::APP_FINISH_DATE => 12,ApplicationPeer::APP_UPDATE_DATE => 13,ApplicationPeer::APP_DATA => 14
|
||||
),BasePeer::TYPE_FIELDNAME => array ('APP_UID' => 0,'APP_NUMBER' => 1,'APP_PARENT' => 2,'APP_STATUS' => 3,'PRO_UID' => 4,'APP_PROC_STATUS' => 5,'APP_PROC_CODE' => 6,'APP_PARALLEL' => 7,'APP_INIT_USER' => 8,'APP_CUR_USER' => 9,'APP_CREATE_DATE' => 10,'APP_INIT_DATE' => 11,'APP_FINISH_DATE' => 12,'APP_UPDATE_DATE' => 13,'APP_DATA' => 14
|
||||
),BasePeer::TYPE_NUM => array (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14
|
||||
private static $fieldKeys = array(BasePeer::TYPE_PHPNAME => array('AppUid' => 0, 'AppNumber' => 1, 'AppParent' => 2, 'AppStatus' => 3, 'ProUid' => 4, 'AppProcStatus' => 5, 'AppProcCode' => 6, 'AppParallel' => 7, 'AppInitUser' => 8, 'AppCurUser' => 9, 'AppCreateDate' => 10, 'AppInitDate' => 11, 'AppFinishDate' => 12, 'AppUpdateDate' => 13, 'AppData' => 14
|
||||
), BasePeer::TYPE_COLNAME => array(ApplicationPeer::APP_UID => 0, ApplicationPeer::APP_NUMBER => 1, ApplicationPeer::APP_PARENT => 2, ApplicationPeer::APP_STATUS => 3, ApplicationPeer::PRO_UID => 4, ApplicationPeer::APP_PROC_STATUS => 5, ApplicationPeer::APP_PROC_CODE => 6, ApplicationPeer::APP_PARALLEL => 7, ApplicationPeer::APP_INIT_USER => 8, ApplicationPeer::APP_CUR_USER => 9, ApplicationPeer::APP_CREATE_DATE => 10, ApplicationPeer::APP_INIT_DATE => 11, ApplicationPeer::APP_FINISH_DATE => 12, ApplicationPeer::APP_UPDATE_DATE => 13, ApplicationPeer::APP_DATA => 14
|
||||
), BasePeer::TYPE_FIELDNAME => array('APP_UID' => 0, 'APP_NUMBER' => 1, 'APP_PARENT' => 2, 'APP_STATUS' => 3, 'PRO_UID' => 4, 'APP_PROC_STATUS' => 5, 'APP_PROC_CODE' => 6, 'APP_PARALLEL' => 7, 'APP_INIT_USER' => 8, 'APP_CUR_USER' => 9, 'APP_CREATE_DATE' => 10, 'APP_INIT_DATE' => 11, 'APP_FINISH_DATE' => 12, 'APP_UPDATE_DATE' => 13, 'APP_DATA' => 14
|
||||
), BasePeer::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
|
||||
)
|
||||
);
|
||||
|
||||
@@ -176,10 +141,10 @@ abstract class ArrayBasePeer
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function getMapBuilder ()
|
||||
public static function getMapBuilder()
|
||||
{
|
||||
include_once 'classes/model/map/ApplicationMapBuilder.php';
|
||||
return BasePeer::getMapBuilder( 'classes.model.map.ApplicationMapBuilder' );
|
||||
return BasePeer::getMapBuilder('classes.model.map.ApplicationMapBuilder');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -190,12 +155,12 @@ abstract class ArrayBasePeer
|
||||
* rethrown wrapped into a PropelException.
|
||||
* @deprecated Use the getFieldNames() and translateFieldName() methods instead of this.
|
||||
*/
|
||||
public static function getPhpNameMap ()
|
||||
public static function getPhpNameMap()
|
||||
{
|
||||
if (self::$phpNameMap === null) {
|
||||
$map = ApplicationPeer::getTableMap();
|
||||
$columns = $map->getColumns();
|
||||
$nameMap = array ();
|
||||
$nameMap = array();
|
||||
foreach ($columns as $column) {
|
||||
$nameMap[$column->getPhpName()] = $column->getColumnName();
|
||||
}
|
||||
@@ -213,12 +178,12 @@ abstract class ArrayBasePeer
|
||||
* @param string $toType One of the class type constants
|
||||
* @return string translated name of the field.
|
||||
*/
|
||||
static public function translateFieldName ($name, $fromType, $toType)
|
||||
static public function translateFieldName($name, $fromType, $toType)
|
||||
{
|
||||
$toNames = self::getFieldNames( $toType );
|
||||
$key = isset( self::$fieldKeys[$fromType][$name] ) ? self::$fieldKeys[$fromType][$name] : null;
|
||||
$toNames = self::getFieldNames($toType);
|
||||
$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
|
||||
if ($key === null) {
|
||||
throw new PropelException( "'$name' could not be found in the field names of type '$fromType'. These are: " . print_r( self::$fieldKeys[$fromType], true ) );
|
||||
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
|
||||
}
|
||||
return $toNames[$key];
|
||||
}
|
||||
@@ -232,10 +197,10 @@ abstract class ArrayBasePeer
|
||||
* @return array A list of field names
|
||||
*/
|
||||
|
||||
static public function getFieldNames ($type = BasePeer::TYPE_PHPNAME)
|
||||
static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
|
||||
{
|
||||
if (! array_key_exists( $type, self::$fieldNames )) {
|
||||
throw new PropelException( 'Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.' );
|
||||
if (!array_key_exists($type, self::$fieldNames)) {
|
||||
throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
|
||||
}
|
||||
return self::$fieldNames[$type];
|
||||
}
|
||||
@@ -253,9 +218,9 @@ abstract class ArrayBasePeer
|
||||
* @param string $column The column name for current table. (i.e. ApplicationPeer::COLUMN_NAME).
|
||||
* @return string
|
||||
*/
|
||||
public static function alias ($alias, $column)
|
||||
public static function alias($alias, $column)
|
||||
{
|
||||
return str_replace( ApplicationPeer::TABLE_NAME . '.', $alias . '.', $column );
|
||||
return str_replace(ApplicationPeer::TABLE_NAME . '.', $alias . '.', $column);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -269,7 +234,7 @@ abstract class ArrayBasePeer
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function addSelectColumns (Criteria $criteria)
|
||||
public static function addSelectColumns(Criteria $criteria)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -286,7 +251,7 @@ abstract class ArrayBasePeer
|
||||
* @return int Number of matching rows.
|
||||
* @todo Review declarated constant d'not used COUNT, COUNT_DISTINCT
|
||||
*/
|
||||
public static function doCount (Criteria $criteria, $distinct = false, $con = null)
|
||||
public static function doCount(Criteria $criteria, $distinct = false, $con = null)
|
||||
{
|
||||
// we're going to modify criteria, so copy it first
|
||||
$criteria = clone $criteria;
|
||||
@@ -301,14 +266,14 @@ abstract class ArrayBasePeer
|
||||
$criteria->addSelectColumn(ApplicationPeer::COUNT);
|
||||
}
|
||||
*/
|
||||
$criteria->addSelectColumn( 'COUNT(*)' );
|
||||
$criteria->addSelectColumn('COUNT(*)');
|
||||
|
||||
// just in case we're grouping: add those columns to the select statement
|
||||
foreach ($criteria->getGroupByColumns() as $column) {
|
||||
$criteria->addSelectColumn( $column );
|
||||
$criteria->addSelectColumn($column);
|
||||
}
|
||||
|
||||
$rs = ArrayBasePeer::doSelectRS( $criteria, $con );
|
||||
$rs = ArrayBasePeer::doSelectRS($criteria, $con);
|
||||
if ($rs->next()) {
|
||||
$row = $rs->getRow();
|
||||
return $row[1];
|
||||
@@ -327,11 +292,11 @@ abstract class ArrayBasePeer
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doSelectOne (Criteria $criteria, $con = null)
|
||||
public static function doSelectOne(Criteria $criteria, $con = null)
|
||||
{
|
||||
$critcopy = clone $criteria;
|
||||
$critcopy->setLimit( 1 );
|
||||
$objects = ApplicationPeer::doSelect( $critcopy, $con );
|
||||
$critcopy->setLimit(1);
|
||||
$objects = ApplicationPeer::doSelect($critcopy, $con);
|
||||
if ($objects) {
|
||||
return $objects[0];
|
||||
}
|
||||
@@ -347,18 +312,18 @@ abstract class ArrayBasePeer
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
private function createSelectSql ($criteria, $tableName, &$params)
|
||||
private function createSelectSql($criteria, $tableName, &$params)
|
||||
{
|
||||
$db = Propel::getDB( $criteria->getDbName() );
|
||||
$db = Propel::getDB($criteria->getDbName());
|
||||
|
||||
// redundant definition $selectModifiers = array();
|
||||
$selectClause = array ();
|
||||
$fromClause = array ();
|
||||
$joinClause = array ();
|
||||
$joinTables = array ();
|
||||
$whereClause = array ();
|
||||
$orderByClause = array ();
|
||||
$groupByClause = array ();
|
||||
$selectClause = array();
|
||||
$fromClause = array();
|
||||
$joinClause = array();
|
||||
$joinTables = array();
|
||||
$whereClause = array();
|
||||
$orderByClause = array();
|
||||
$groupByClause = array();
|
||||
|
||||
$orderBy = $criteria->getOrderByColumns();
|
||||
$groupBy = $criteria->getGroupByColumns();
|
||||
@@ -376,8 +341,8 @@ abstract class ArrayBasePeer
|
||||
$selectClause[] = $columnName; // the full column name: e.g. MAX(books.price)
|
||||
|
||||
|
||||
$parenPos = strpos( $columnName, '(' );
|
||||
$dotPos = strpos( $columnName, '.' );
|
||||
$parenPos = strpos($columnName, '(');
|
||||
$dotPos = strpos($columnName, '.');
|
||||
|
||||
// [HL] I think we really only want to worry about adding stuff to
|
||||
// the fromClause if this function has a TABLE.COLUMN in it at all.
|
||||
@@ -386,18 +351,18 @@ abstract class ArrayBasePeer
|
||||
if ($dotPos !== false) {
|
||||
|
||||
if ($parenPos === false) { // table.column
|
||||
$tableName = substr( $columnName, 0, $dotPos );
|
||||
$tableName = substr($columnName, 0, $dotPos);
|
||||
} else { // FUNC(table.column)
|
||||
$tableName = substr( $columnName, $parenPos + 1, $dotPos - ($parenPos + 1) );
|
||||
$tableName = substr($columnName, $parenPos + 1, $dotPos - ($parenPos + 1));
|
||||
// functions may contain qualifiers so only take the last
|
||||
// word as the table name.
|
||||
// COUNT(DISTINCT books.price)
|
||||
$lastSpace = strpos( $tableName, ' ' );
|
||||
$lastSpace = strpos($tableName, ' ');
|
||||
if ($lastSpace !== false) { // COUNT(DISTINCT books.price)
|
||||
$tableName = substr( $tableName, $lastSpace + 1 );
|
||||
$tableName = substr($tableName, $lastSpace + 1);
|
||||
}
|
||||
}
|
||||
$tableName2 = $criteria->getTableForAlias( $tableName );
|
||||
$tableName2 = $criteria->getTableForAlias($tableName);
|
||||
if ($tableName2 !== null) {
|
||||
$fromClause[] = $tableName2 . ' ' . $tableName;
|
||||
} else {
|
||||
@@ -415,13 +380,13 @@ abstract class ArrayBasePeer
|
||||
// add the criteria to WHERE clause
|
||||
foreach ($criteria->keys() as $key) {
|
||||
|
||||
$criterion = $criteria->getCriterion( $key );
|
||||
$criterion = $criteria->getCriterion($key);
|
||||
$someCriteria = $criterion->getAttachedCriterion();
|
||||
$someCriteriaLength = count( $someCriteria );
|
||||
$someCriteriaLength = count($someCriteria);
|
||||
$table = null;
|
||||
for ($i = 0; $i < $someCriteriaLength; $i ++) {
|
||||
for ($i = 0; $i < $someCriteriaLength; $i++) {
|
||||
$tableName = $someCriteria[$i]->getTable();
|
||||
$table = $criteria->getTableForAlias( $tableName );
|
||||
$table = $criteria->getTableForAlias($tableName);
|
||||
if ($table !== null) {
|
||||
$fromClause[] = $table . ' ' . $tableName;
|
||||
} else {
|
||||
@@ -429,11 +394,11 @@ abstract class ArrayBasePeer
|
||||
$table = $tableName;
|
||||
}
|
||||
|
||||
$ignoreCase = (($criteria->isIgnoreCase() || $someCriteria[$i]->isIgnoreCase()) && ($dbMap->getTable( $table )->getColumn( $someCriteria[$i]->getColumn() )->getType() == "string"));
|
||||
$ignoreCase = (($criteria->isIgnoreCase() || $someCriteria[$i]->isIgnoreCase()) && ($dbMap->getTable($table)->getColumn($someCriteria[$i]->getColumn())->getType() == "string"));
|
||||
|
||||
$someCriteria[$i]->setIgnoreCase( $ignoreCase );
|
||||
$someCriteria[$i]->setIgnoreCase($ignoreCase);
|
||||
}
|
||||
$criterion->setDB( $db );
|
||||
$criterion->setDB($db);
|
||||
|
||||
$cri['table'] = $criterion->table;
|
||||
$cri['field'] = $criterion->column;
|
||||
@@ -449,41 +414,41 @@ abstract class ArrayBasePeer
|
||||
|
||||
}
|
||||
// Unique from clause elements
|
||||
$fromClause = array_unique( $fromClause );
|
||||
$fromClause = array_unique($fromClause);
|
||||
|
||||
if (! empty( $orderBy )) {
|
||||
if (!empty($orderBy)) {
|
||||
|
||||
foreach ($orderBy as $orderByColumn) {
|
||||
// Add function expression as-is.
|
||||
if (strpos( $orderByColumn, '(' ) !== false) {
|
||||
if (strpos($orderByColumn, '(') !== false) {
|
||||
$orderByClause[] = $orderByColumn;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Split orderByColumn (i.e. "table.column DESC")
|
||||
$dotPos = strpos( $orderByColumn, '.' );
|
||||
$dotPos = strpos($orderByColumn, '.');
|
||||
if ($dotPos !== false) {
|
||||
$tableName = substr( $orderByColumn, 0, $dotPos );
|
||||
$columnName = substr( $orderByColumn, $dotPos + 1 );
|
||||
$tableName = substr($orderByColumn, 0, $dotPos);
|
||||
$columnName = substr($orderByColumn, $dotPos + 1);
|
||||
} else {
|
||||
$tableName = '';
|
||||
$columnName = $orderByColumn;
|
||||
}
|
||||
|
||||
$spacePos = strpos( $columnName, ' ' );
|
||||
$spacePos = strpos($columnName, ' ');
|
||||
if ($spacePos !== false) {
|
||||
$direction = substr( $columnName, $spacePos );
|
||||
$columnName = substr( $columnName, 0, $spacePos );
|
||||
$direction = substr($columnName, $spacePos);
|
||||
$columnName = substr($columnName, 0, $spacePos);
|
||||
} else {
|
||||
$direction = '';
|
||||
}
|
||||
$orderByClause[] = array ('columnName' => $columnName,'direction' => $direction
|
||||
$orderByClause[] = array('columnName' => $columnName, 'direction' => $direction
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Build the SQL from the arrays we compiled
|
||||
$sql = "SELECT " . ($selectModifiers ? implode( " ", $selectModifiers ) . " " : "") . implode( ", ", $selectClause ) . " FROM " . $fromClause[0] . ($whereClause ? " WHERE " . implode( " AND ", $whereClause ) : "") . ($groupByClause ? " GROUP BY " . implode( ",", $groupByClause ) : "");
|
||||
$sql = "SELECT " . ($selectModifiers ? implode(" ", $selectModifiers) . " " : "") . implode(", ", $selectClause) . " FROM " . $fromClause[0] . ($whereClause ? " WHERE " . implode(" AND ", $whereClause) : "") . ($groupByClause ? " GROUP BY " . implode(",", $groupByClause) : "");
|
||||
|
||||
$dataSql['selectClause'] = $selectClause;
|
||||
$dataSql['fromClause'] = $fromClause;
|
||||
@@ -503,27 +468,27 @@ abstract class ArrayBasePeer
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doSelect (Criteria $criteria, $tableName, $con = null)
|
||||
public static function doSelect(Criteria $criteria, $tableName, $con = null)
|
||||
{
|
||||
$dbMap = Propel::getDatabaseMap( $criteria->getDbName() );
|
||||
$dbMap = Propel::getDatabaseMap($criteria->getDbName());
|
||||
|
||||
$stmt = null;
|
||||
|
||||
try {
|
||||
$params = array ();
|
||||
$sql = self::createSelectSql( $criteria, $tableName, $params );
|
||||
$params = array();
|
||||
$sql = self::createSelectSql($criteria, $tableName, $params);
|
||||
$sql['params'] = $params;
|
||||
$stmt = $con->prepareStatement( $sql );
|
||||
$stmt = $con->prepareStatement($sql);
|
||||
//$stmt->setLimit($criteria->getLimit());
|
||||
$sql['limit'] = $criteria->getLimit();
|
||||
//$stmt->setOffset($criteria->getOffset());
|
||||
$sql['offset'] = $criteria->getOffset();
|
||||
//$rs = $stmt->executeQuery(ResultSet::FETCHMODE_NUM);
|
||||
$rs = $con->executeQuery( $sql, ResultSet::FETCHMODE_NUM );
|
||||
$rs = $con->executeQuery($sql, ResultSet::FETCHMODE_NUM);
|
||||
} catch (Exception $e) {
|
||||
if ($stmt)
|
||||
$stmt->close();
|
||||
throw new PropelException( $e );
|
||||
throw new PropelException($e);
|
||||
}
|
||||
|
||||
return $rs;
|
||||
@@ -543,34 +508,34 @@ abstract class ArrayBasePeer
|
||||
* @return ResultSet The resultset object with numerically-indexed fields.
|
||||
* @see BasePeer::doSelect()
|
||||
*/
|
||||
public static function doSelectRS (Criteria $criteria, $con = null)
|
||||
public static function doSelectRS(Criteria $criteria, $con = null)
|
||||
{
|
||||
global $_DBArray;
|
||||
if (! isset( $_DBArray )) {
|
||||
if (!isset($_DBArray)) {
|
||||
$_DBArray = $_SESSION['_DBArray'];
|
||||
}
|
||||
$tableName = $criteria->getDBArrayTable();
|
||||
if (! isset( $_DBArray[$tableName] )) {
|
||||
throw new Exception( "Error: the table '$tableName' doesn't exist in DBArray " );
|
||||
if (!isset($_DBArray[$tableName])) {
|
||||
throw new Exception("Error: the table '$tableName' doesn't exist in DBArray ");
|
||||
}
|
||||
|
||||
$arrayTable = $_DBArray[$tableName];
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection( self::DATABASE_NAME );
|
||||
$con = Propel::getConnection(self::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if (! $criteria->getSelectColumns()) {
|
||||
foreach (array_keys( $_DBArray[$tableName][0] ) as $key => $val)
|
||||
$criteria->addSelectColumn( $tableName . '.' . $val );
|
||||
if (!$criteria->getSelectColumns()) {
|
||||
foreach (array_keys($_DBArray[$tableName][0]) as $key => $val)
|
||||
$criteria->addSelectColumn($tableName . '.' . $val);
|
||||
}
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName( self::DATABASE_NAME );
|
||||
$criteria->setDbName(self::DATABASE_NAME);
|
||||
|
||||
// BasePeer returns a Creole ResultSet, set to return
|
||||
// rows indexed numerically.
|
||||
return ArrayBasePeer::doSelect( $criteria, $tableName, $con );
|
||||
return ArrayBasePeer::doSelect($criteria, $tableName, $con);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -580,17 +545,17 @@ abstract class ArrayBasePeer
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function populateObjects (ResultSet $rs)
|
||||
public static function populateObjects(ResultSet $rs)
|
||||
{
|
||||
$results = array ();
|
||||
$results = array();
|
||||
|
||||
// set the class once to avoid overhead in the loop
|
||||
$cls = ApplicationPeer::getOMClass();
|
||||
$cls = Propel::import( $cls );
|
||||
$cls = Propel::import($cls);
|
||||
// populate the object(s)
|
||||
while ($rs->next()) {
|
||||
$obj = new $cls();
|
||||
$obj->hydrate( $rs );
|
||||
$obj->hydrate($rs);
|
||||
$results[] = $obj;
|
||||
}
|
||||
return $results;
|
||||
@@ -604,9 +569,9 @@ abstract class ArrayBasePeer
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function getTableMap ()
|
||||
public static function getTableMap()
|
||||
{
|
||||
return Propel::getDatabaseMap( self::DATABASE_NAME )->getTable( self::TABLE_NAME );
|
||||
return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -618,7 +583,7 @@ abstract class ArrayBasePeer
|
||||
*
|
||||
* @return string path.to.ClassName
|
||||
*/
|
||||
public static function getOMClass ()
|
||||
public static function getOMClass()
|
||||
{
|
||||
return ApplicationPeer::CLASS_DEFAULT;
|
||||
}
|
||||
@@ -632,10 +597,10 @@ abstract class ArrayBasePeer
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doInsert ($values, $con = null)
|
||||
public static function doInsert($values, $con = null)
|
||||
{
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection( self::DATABASE_NAME );
|
||||
$con = Propel::getConnection(self::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
@@ -645,13 +610,13 @@ abstract class ArrayBasePeer
|
||||
}
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName( self::DATABASE_NAME );
|
||||
$criteria->setDbName(self::DATABASE_NAME);
|
||||
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table (I guess, conceivably)
|
||||
$con->begin();
|
||||
$pk = BasePeer::doInsert( $criteria, $con );
|
||||
$pk = BasePeer::doInsert($criteria, $con);
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollback();
|
||||
@@ -670,20 +635,20 @@ abstract class ArrayBasePeer
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doUpdate ($values, $con = null)
|
||||
public static function doUpdate($values, $con = null)
|
||||
{
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection( self::DATABASE_NAME );
|
||||
$con = Propel::getConnection(self::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$selectCriteria = new Criteria( self::DATABASE_NAME );
|
||||
$selectCriteria = new Criteria(self::DATABASE_NAME);
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
$criteria = clone $values; // rename for clarity
|
||||
|
||||
|
||||
$comparison = $criteria->getComparison( ApplicationPeer::APP_UID );
|
||||
$selectCriteria->add( ApplicationPeer::APP_UID, $criteria->remove( ApplicationPeer::APP_UID ), $comparison );
|
||||
$comparison = $criteria->getComparison(ApplicationPeer::APP_UID);
|
||||
$selectCriteria->add(ApplicationPeer::APP_UID, $criteria->remove(ApplicationPeer::APP_UID), $comparison);
|
||||
|
||||
} else { // $values is Application object
|
||||
$criteria = $values->buildCriteria(); // gets full criteria
|
||||
@@ -691,9 +656,9 @@ abstract class ArrayBasePeer
|
||||
}
|
||||
|
||||
// set the correct dbName
|
||||
$criteria->setDbName( self::DATABASE_NAME );
|
||||
$criteria->setDbName(self::DATABASE_NAME);
|
||||
|
||||
return BasePeer::doUpdate( $selectCriteria, $criteria, $con );
|
||||
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -702,17 +667,17 @@ abstract class ArrayBasePeer
|
||||
* @param Connection $con The connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver).
|
||||
*/
|
||||
public static function doDeleteAll ($con = null)
|
||||
public static function doDeleteAll($con = null)
|
||||
{
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection( self::DATABASE_NAME );
|
||||
$con = Propel::getConnection(self::DATABASE_NAME);
|
||||
}
|
||||
$affectedRows = 0; // initialize var to track total num of affected rows
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->begin();
|
||||
$affectedRows += BasePeer::doDeleteAll( ApplicationPeer::TABLE_NAME, $con );
|
||||
$affectedRows += BasePeer::doDeleteAll(ApplicationPeer::TABLE_NAME, $con);
|
||||
$con->commit();
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
@@ -732,10 +697,10 @@ abstract class ArrayBasePeer
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doDelete ($values, $con = null)
|
||||
public static function doDelete($values, $con = null)
|
||||
{
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection( ApplicationPeer::DATABASE_NAME );
|
||||
$con = Propel::getConnection(ApplicationPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
@@ -745,12 +710,12 @@ abstract class ArrayBasePeer
|
||||
$criteria = $values->buildPkeyCriteria();
|
||||
} else {
|
||||
// it must be the primary key
|
||||
$criteria = new Criteria( self::DATABASE_NAME );
|
||||
$criteria->add( ApplicationPeer::APP_UID, (array) $values, Criteria::IN );
|
||||
$criteria = new Criteria(self::DATABASE_NAME);
|
||||
$criteria->add(ApplicationPeer::APP_UID, (array)$values, Criteria::IN);
|
||||
}
|
||||
}
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName( self::DATABASE_NAME );
|
||||
$criteria->setDbName(self::DATABASE_NAME);
|
||||
|
||||
$affectedRows = 0; // initialize var to track total num of affected rows
|
||||
|
||||
@@ -760,7 +725,7 @@ abstract class ArrayBasePeer
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->begin();
|
||||
|
||||
$affectedRows += BasePeer::doDelete( $criteria, $con );
|
||||
$affectedRows += BasePeer::doDelete($criteria, $con);
|
||||
$con->commit();
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
@@ -781,33 +746,33 @@ abstract class ArrayBasePeer
|
||||
*
|
||||
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
|
||||
*/
|
||||
public static function doValidate (Application $obj, $cols = null)
|
||||
public static function doValidate(Application $obj, $cols = null)
|
||||
{
|
||||
$columns = array ();
|
||||
$columns = array();
|
||||
|
||||
if ($cols) {
|
||||
$dbMap = Propel::getDatabaseMap( ApplicationPeer::DATABASE_NAME );
|
||||
$tableMap = $dbMap->getTable( ApplicationPeer::TABLE_NAME );
|
||||
$dbMap = Propel::getDatabaseMap(ApplicationPeer::DATABASE_NAME);
|
||||
$tableMap = $dbMap->getTable(ApplicationPeer::TABLE_NAME);
|
||||
|
||||
if (! is_array( $cols )) {
|
||||
$cols = array ($cols
|
||||
if (!is_array($cols)) {
|
||||
$cols = array($cols
|
||||
);
|
||||
}
|
||||
|
||||
foreach ($cols as $colName) {
|
||||
if ($tableMap->containsColumn( $colName )) {
|
||||
$get = 'get' . $tableMap->getColumn( $colName )->getPhpName();
|
||||
if ($tableMap->containsColumn($colName)) {
|
||||
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
|
||||
$columns[$colName] = $obj->$get();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
if ($obj->isNew() || $obj->isColumnModified( ApplicationPeer::APP_STATUS ))
|
||||
if ($obj->isNew() || $obj->isColumnModified(ApplicationPeer::APP_STATUS))
|
||||
$columns[ApplicationPeer::APP_STATUS] = $obj->getAppStatus();
|
||||
|
||||
}
|
||||
|
||||
return BasePeer::doValidate( ApplicationPeer::DATABASE_NAME, ApplicationPeer::TABLE_NAME, $columns );
|
||||
return BasePeer::doValidate(ApplicationPeer::DATABASE_NAME, ApplicationPeer::TABLE_NAME, $columns);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -817,19 +782,19 @@ abstract class ArrayBasePeer
|
||||
* @param Connection $con the connection to use
|
||||
* @return Application
|
||||
*/
|
||||
public static function retrieveByPK ($pk, $con = null)
|
||||
public static function retrieveByPK($pk, $con = null)
|
||||
{
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection( self::DATABASE_NAME );
|
||||
$con = Propel::getConnection(self::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$criteria = new Criteria( ApplicationPeer::DATABASE_NAME );
|
||||
$criteria = new Criteria(ApplicationPeer::DATABASE_NAME);
|
||||
|
||||
$criteria->add( ApplicationPeer::APP_UID, $pk );
|
||||
$criteria->add(ApplicationPeer::APP_UID, $pk);
|
||||
|
||||
$v = ApplicationPeer::doSelect( $criteria, $con );
|
||||
$v = ApplicationPeer::doSelect($criteria, $con);
|
||||
|
||||
return ! empty( $v ) > 0 ? $v[0] : null;
|
||||
return !empty($v) > 0 ? $v[0] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -840,38 +805,21 @@ abstract class ArrayBasePeer
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function retrieveByPKs ($pks, $con = null)
|
||||
public static function retrieveByPKs($pks, $con = null)
|
||||
{
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection( self::DATABASE_NAME );
|
||||
$con = Propel::getConnection(self::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$objs = null;
|
||||
if (empty( $pks )) {
|
||||
$objs = array ();
|
||||
if (empty($pks)) {
|
||||
$objs = array();
|
||||
} else {
|
||||
$criteria = new Criteria();
|
||||
$criteria->add( ApplicationPeer::APP_UID, $pks, Criteria::IN );
|
||||
$objs = ApplicationPeer::doSelect( $criteria, $con );
|
||||
$criteria->add(ApplicationPeer::APP_UID, $pks, Criteria::IN);
|
||||
$objs = ApplicationPeer::doSelect($criteria, $con);
|
||||
}
|
||||
return $objs;
|
||||
}
|
||||
|
||||
} // 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' );
|
||||
}
|
||||
601
workflow/engine/classes/BpmnEngineSearchIndexAccessSolr.php
Normal file
601
workflow/engine/classes/BpmnEngineSearchIndexAccessSolr.php
Normal file
@@ -0,0 +1,601 @@
|
||||
<?php
|
||||
|
||||
use ProcessMaker\Core\System;
|
||||
|
||||
/**
|
||||
* Interface to the Solr Search server
|
||||
*/
|
||||
class BpmnEngineSearchIndexAccessSolr
|
||||
{
|
||||
const SOLR_VERSION = '&version=2.2';
|
||||
|
||||
private $_solrIsEnabled = false;
|
||||
private $_solrHost = "";
|
||||
|
||||
public function __construct($solrIsEnabled = false, $solrHost = "")
|
||||
{
|
||||
// use the parameters to initialize class
|
||||
$this->_solrIsEnabled = $solrIsEnabled;
|
||||
$this->_solrHost = $solrHost;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify if the Solr service is available
|
||||
* @gearman = false
|
||||
* @rest = false
|
||||
* @background = false
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isEnabled($workspace)
|
||||
{
|
||||
$resultServerStatus = false;
|
||||
// verify solr server response
|
||||
try {
|
||||
$resultServerStatus = $this->ping($workspace);
|
||||
} catch (Exception $ex) {
|
||||
$resultServerStatus = false;
|
||||
}
|
||||
|
||||
return $resultServerStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the total number of indexed documents
|
||||
* @gearman = false
|
||||
* @rest = false
|
||||
* @background = false
|
||||
*
|
||||
* @param
|
||||
* workspace: workspace name
|
||||
* @return total
|
||||
*/
|
||||
public function getNumberDocuments($workspace)
|
||||
{
|
||||
// get total number of documents in registry
|
||||
$solrIntruct = (substr($this->_solrHost, -1) == "/") ? $this->_solrHost : $this->_solrHost . "/";
|
||||
$solrIntruct .= $workspace;
|
||||
$solrIntruct .= "/select/?q=*:*";
|
||||
$solrIntruct .= self::SOLR_VERSION;
|
||||
$solrIntruct .= "&start=0&rows=0&echoParams=none&wt=json";
|
||||
|
||||
$handlerTotal = curl_init($solrIntruct);
|
||||
curl_setopt($handlerTotal, CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
//Apply proxy settings
|
||||
$sysConf = System::getSystemConfiguration();
|
||||
if ($sysConf['proxy_host'] != '') {
|
||||
curl_setopt($handlerTotal, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : ''));
|
||||
if ($sysConf['proxy_port'] != '') {
|
||||
curl_setopt($handlerTotal, CURLOPT_PROXYPORT, $sysConf['proxy_port']);
|
||||
}
|
||||
if ($sysConf['proxy_user'] != '') {
|
||||
curl_setopt($handlerTotal, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : ''));
|
||||
}
|
||||
curl_setopt($handlerTotal, CURLOPT_HTTPHEADER, array('Expect:'));
|
||||
}
|
||||
|
||||
$responseTotal = curl_exec($handlerTotal);
|
||||
curl_close($handlerTotal);
|
||||
|
||||
// verify the result of solr
|
||||
$responseSolrTotal = G::json_decode($responseTotal);
|
||||
if ($responseSolrTotal->responseHeader->status != 0) {
|
||||
throw new Exception(date('Y-m-d H:i:s:u') . " Error returning the total number of documents in Solr." . $solrIntruct . " response error: " . $response . "\n");
|
||||
}
|
||||
$numTotalDocs = $responseSolrTotal->response->numFound;
|
||||
return $numTotalDocs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a query in base to Requested data
|
||||
* @gearman = false
|
||||
* @rest = false
|
||||
* @background = false
|
||||
*
|
||||
* @return solr response
|
||||
*/
|
||||
public function executeQuery($solrRequestData)
|
||||
{
|
||||
$solrIntruct = '';
|
||||
// get configuration information in base to workspace parameter
|
||||
$workspace = $solrRequestData->workspace;
|
||||
|
||||
// format request
|
||||
$query = empty($solrRequestData->searchText) ? '*:*' : $solrRequestData->searchText;
|
||||
$query = rawurlencode($query);
|
||||
$start = '&start=' . $solrRequestData->startAfter;
|
||||
$rows = '&rows=' . $solrRequestData->pageSize;
|
||||
$fieldList = '';
|
||||
$cols = $solrRequestData->includeCols;
|
||||
if (!empty($cols)) {
|
||||
$fieldList = "&fl=" . implode(",", $cols);
|
||||
}
|
||||
$sort = '';
|
||||
if ($solrRequestData->numSortingCols > 0) {
|
||||
$sort = '&sort=';
|
||||
for ($i = 0; $i < $solrRequestData->numSortingCols; $i++) {
|
||||
$sort .= $solrRequestData->sortCols [$i] . "%20" . $solrRequestData->sortDir [$i] . ",";
|
||||
}
|
||||
|
||||
$sort = substr_replace($sort, "", -1);
|
||||
}
|
||||
$resultFormat = empty($solrRequestData->resultFormat) ? '' : '&wt=' . $solrRequestData->resultFormat;
|
||||
$filters = '';
|
||||
$aFilters = explode(',', $solrRequestData->filterText);
|
||||
foreach ($aFilters as $value) {
|
||||
$filters .= '&fq=' . urlencode($value);
|
||||
}
|
||||
|
||||
$solrIntruct = (substr($this->_solrHost, -1) == "/") ? $this->_solrHost : $this->_solrHost . "/";
|
||||
$solrIntruct .= $workspace;
|
||||
$solrIntruct .= "/select/?q=$query";
|
||||
$solrIntruct .= "&echoParams=none";
|
||||
$solrIntruct .= self::SOLR_VERSION;
|
||||
$solrIntruct .= $start;
|
||||
$solrIntruct .= $rows;
|
||||
$solrIntruct .= $fieldList;
|
||||
$solrIntruct .= $sort;
|
||||
$solrIntruct .= $filters;
|
||||
$solrIntruct .= $resultFormat;
|
||||
// send query
|
||||
// search the cases in base to datatable parameters
|
||||
$handler = curl_init($solrIntruct);
|
||||
curl_setopt($handler, CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
//Apply proxy settings
|
||||
$sysConf = System::getSystemConfiguration();
|
||||
if ($sysConf['proxy_host'] != '') {
|
||||
curl_setopt($handler, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : ''));
|
||||
if ($sysConf['proxy_port'] != '') {
|
||||
curl_setopt($handler, CURLOPT_PROXYPORT, $sysConf['proxy_port']);
|
||||
}
|
||||
if ($sysConf['proxy_user'] != '') {
|
||||
curl_setopt($handler, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : ''));
|
||||
}
|
||||
curl_setopt($handler, CURLOPT_HTTPHEADER, array('Expect:'));
|
||||
}
|
||||
|
||||
$response = curl_exec($handler);
|
||||
curl_close($handler);
|
||||
|
||||
// decode
|
||||
$responseSolr = G::json_decode($response);
|
||||
if ($responseSolr->responseHeader->status != 0) {
|
||||
throw new Exception(date('Y-m-d H:i:s:u') . " Error executing query to Solr." . $solrIntruct . " response error: " . $response . "\n");
|
||||
}
|
||||
|
||||
return $responseSolr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert or Update document index
|
||||
* @gearman = false
|
||||
* @rest = false
|
||||
* @background = false
|
||||
*
|
||||
* @return solr response
|
||||
*/
|
||||
public function updateDocument($solrUpdateDocument)
|
||||
{
|
||||
$solrIntruct = '';
|
||||
// get configuration information in base to workspace parameter
|
||||
$solrIntruct = (substr($this->_solrHost, -1) == "/") ? $this->_solrHost : $this->_solrHost . "/";
|
||||
$solrIntruct .= $solrUpdateDocument->workspace;
|
||||
$solrIntruct .= "/update";
|
||||
|
||||
$handler = curl_init($solrIntruct);
|
||||
curl_setopt($handler, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($handler, CURLOPT_HTTPHEADER, array(
|
||||
'Content-type:application/xml'
|
||||
));
|
||||
curl_setopt($handler, CURLOPT_BINARYTRANSFER, true); // --data-binary
|
||||
curl_setopt($handler, CURLOPT_POSTFIELDS, $solrUpdateDocument->document); // data
|
||||
//Apply proxy settings
|
||||
$sysConf = System::getSystemConfiguration();
|
||||
if ($sysConf['proxy_host'] != '') {
|
||||
curl_setopt($handler, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : ''));
|
||||
if ($sysConf['proxy_port'] != '') {
|
||||
curl_setopt($handler, CURLOPT_PROXYPORT, $sysConf['proxy_port']);
|
||||
}
|
||||
if ($sysConf['proxy_user'] != '') {
|
||||
curl_setopt($handler, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : ''));
|
||||
}
|
||||
curl_setopt($handler, CURLOPT_HTTPHEADER, array('Expect:'));
|
||||
}
|
||||
|
||||
$response = curl_exec($handler);
|
||||
curl_close($handler);
|
||||
|
||||
$swOk = strpos($response, '<int name="status">0</int>');
|
||||
if (!$swOk) {
|
||||
throw new Exception(date('Y-m-d H:i:s:u') . " Error updating document in Solr." . $solrIntruct . " response error: " . $response . "\n");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Commit the changes since the last commit
|
||||
* @gearman = false
|
||||
* @rest = false
|
||||
* @background = false
|
||||
*
|
||||
* @return solr response
|
||||
*/
|
||||
public function commitChanges($workspace)
|
||||
{
|
||||
$solrIntruct = '';
|
||||
// get configuration information in base to workspace parameter
|
||||
$solrIntruct = (substr($this->_solrHost, -1) == "/") ? $this->_solrHost : $this->_solrHost . "/";
|
||||
$solrIntruct .= $workspace;
|
||||
$solrIntruct .= "/update";
|
||||
|
||||
$handler = curl_init($solrIntruct);
|
||||
curl_setopt($handler, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($handler, CURLOPT_HTTPHEADER, array(
|
||||
'Content-type:application/xml'
|
||||
));
|
||||
curl_setopt($handler, CURLOPT_BINARYTRANSFER, true); // --data-binary
|
||||
curl_setopt($handler, CURLOPT_POSTFIELDS, "<commit/>"); // data
|
||||
//Apply proxy settings
|
||||
$sysConf = System::getSystemConfiguration();
|
||||
if ($sysConf['proxy_host'] != '') {
|
||||
curl_setopt($handler, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : ''));
|
||||
if ($sysConf['proxy_port'] != '') {
|
||||
curl_setopt($handler, CURLOPT_PROXYPORT, $sysConf['proxy_port']);
|
||||
}
|
||||
if ($sysConf['proxy_user'] != '') {
|
||||
curl_setopt($handler, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : ''));
|
||||
}
|
||||
curl_setopt($handler, CURLOPT_HTTPHEADER, array('Expect:'));
|
||||
}
|
||||
|
||||
$response = curl_exec($handler);
|
||||
curl_close($handler);
|
||||
|
||||
$swOk = strpos($response, '<int name="status">0</int>');
|
||||
if (!$swOk) {
|
||||
throw new Exception(date('Y-m-d H:i:s:u') . " Error commiting changes in Solr." . $solrIntruct . " response error: " . $response . "\n");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Rollback the changes since the last commit
|
||||
* @gearman = false
|
||||
* @rest = false
|
||||
* @background = false
|
||||
*
|
||||
* @return solr response
|
||||
*/
|
||||
public function rollbackChanges($workspace)
|
||||
{
|
||||
$solrIntruct = '';
|
||||
// get configuration information in base to workspace parameter
|
||||
$solrIntruct = (substr($this->_solrHost, -1) == "/") ? $this->_solrHost : $this->_solrHost . "/";
|
||||
$solrIntruct .= $workspace;
|
||||
$solrIntruct .= "/update";
|
||||
|
||||
$handler = curl_init($solrIntruct);
|
||||
curl_setopt($handler, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($handler, CURLOPT_HTTPHEADER, array(
|
||||
'Content-type:application/xml'
|
||||
));
|
||||
curl_setopt($handler, CURLOPT_BINARYTRANSFER, true); // --data-binary
|
||||
curl_setopt($handler, CURLOPT_POSTFIELDS, "<rollback/>"); // data
|
||||
//Apply proxy settings
|
||||
$sysConf = System::getSystemConfiguration();
|
||||
if ($sysConf['proxy_host'] != '') {
|
||||
curl_setopt($handler, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : ''));
|
||||
if ($sysConf['proxy_port'] != '') {
|
||||
curl_setopt($handler, CURLOPT_PROXYPORT, $sysConf['proxy_port']);
|
||||
}
|
||||
if ($sysConf['proxy_user'] != '') {
|
||||
curl_setopt($handler, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : ''));
|
||||
}
|
||||
curl_setopt($handler, CURLOPT_HTTPHEADER, array('Expect:'));
|
||||
}
|
||||
|
||||
$response = curl_exec($handler);
|
||||
curl_close($handler);
|
||||
|
||||
$swOk = strpos($response, '<int name="status">0</int>');
|
||||
if (!$swOk) {
|
||||
throw new Exception(date('Y-m-d H:i:s:u') . " Error rolling back changes in Solr." . $solrIntruct . " response error: " . $response . "\n");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Optimize Solr index
|
||||
* @gearman = false
|
||||
* @rest = false
|
||||
* @background = false
|
||||
*
|
||||
* @return solr response
|
||||
*/
|
||||
public function optimizeChanges($workspace)
|
||||
{
|
||||
$solrIntruct = '';
|
||||
// get configuration information in base to workspace parameter
|
||||
$solrIntruct = (substr($this->_solrHost, -1) == "/") ? $this->_solrHost : $this->_solrHost . "/";
|
||||
$solrIntruct .= $workspace;
|
||||
$solrIntruct .= "/update";
|
||||
|
||||
$handler = curl_init($solrIntruct);
|
||||
curl_setopt($handler, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($handler, CURLOPT_HTTPHEADER, array(
|
||||
'Content-type:application/xml'
|
||||
));
|
||||
curl_setopt($handler, CURLOPT_BINARYTRANSFER, true); // --data-binary
|
||||
curl_setopt($handler, CURLOPT_POSTFIELDS, "<optimize/>"); // data
|
||||
//Apply proxy settings
|
||||
$sysConf = System::getSystemConfiguration();
|
||||
if ($sysConf['proxy_host'] != '') {
|
||||
curl_setopt($handler, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : ''));
|
||||
if ($sysConf['proxy_port'] != '') {
|
||||
curl_setopt($handler, CURLOPT_PROXYPORT, $sysConf['proxy_port']);
|
||||
}
|
||||
if ($sysConf['proxy_user'] != '') {
|
||||
curl_setopt($handler, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : ''));
|
||||
}
|
||||
curl_setopt($handler, CURLOPT_HTTPHEADER, array('Expect:'));
|
||||
}
|
||||
|
||||
$response = curl_exec($handler);
|
||||
curl_close($handler);
|
||||
|
||||
$swOk = strpos($response, '<int name="status">0</int>');
|
||||
if (!$swOk) {
|
||||
throw new Exception(date('Y-m-d H:i:s:u') . " Error optimizing changes in Solr." . $solrIntruct . " response error: " . $response . "\n");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the list of the stored fields in Solr
|
||||
*
|
||||
* @param string $workspace
|
||||
* Solr instance name
|
||||
* @throws Exception
|
||||
* @return void mixed of field names
|
||||
*/
|
||||
public function getListIndexedStoredFields($workspace)
|
||||
{
|
||||
$solrIntruct = '';
|
||||
// get configuration information in base to workspace parameter
|
||||
$solrIntruct = (substr($this->_solrHost, -1) == "/") ? $this->_solrHost : $this->_solrHost . "/";
|
||||
$solrIntruct .= $workspace;
|
||||
$solrIntruct .= "/admin/luke?numTerms=0&wt=json";
|
||||
|
||||
$handler = curl_init($solrIntruct);
|
||||
curl_setopt($handler, CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
//Apply proxy settings
|
||||
$sysConf = System::getSystemConfiguration();
|
||||
if ($sysConf['proxy_host'] != '') {
|
||||
curl_setopt($handler, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : ''));
|
||||
if ($sysConf['proxy_port'] != '') {
|
||||
curl_setopt($handler, CURLOPT_PROXYPORT, $sysConf['proxy_port']);
|
||||
}
|
||||
if ($sysConf['proxy_user'] != '') {
|
||||
curl_setopt($handler, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : ''));
|
||||
}
|
||||
curl_setopt($handler, CURLOPT_HTTPHEADER, array('Expect:'));
|
||||
}
|
||||
|
||||
$response = curl_exec($handler);
|
||||
curl_close($handler);
|
||||
// decode
|
||||
$responseSolr = G::json_decode($response);
|
||||
if ($responseSolr->responseHeader->status != 0) {
|
||||
throw new Exception(date('Y-m-d H:i:s:u') . " Error getting index fields in Solr." . $solrIntruct . " response error: " . $response . "\n");
|
||||
}
|
||||
return $responseSolr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ping the Solr Server to check his health
|
||||
*
|
||||
* @param string $workspace
|
||||
* Solr instance name
|
||||
* @throws Exception
|
||||
* @return void mixed of field names
|
||||
*/
|
||||
public function ping($workspace)
|
||||
{
|
||||
$solrIntruct = '';
|
||||
// get configuration information in base to workspace parameter
|
||||
$solrIntruct = (substr($this->_solrHost, -1) == "/") ? $this->_solrHost : $this->_solrHost . "/";
|
||||
$solrIntruct .= $workspace;
|
||||
$solrIntruct .= "/admin/ping?wt=json";
|
||||
|
||||
$handler = curl_init($solrIntruct);
|
||||
curl_setopt($handler, CURLOPT_RETURNTRANSFER, true);
|
||||
$response = curl_exec($handler);
|
||||
curl_close($handler);
|
||||
|
||||
//there's no response
|
||||
if (!$response) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// decode
|
||||
$responseSolr = G::json_decode($response);
|
||||
if ($responseSolr->responseHeader->status != "OK") {
|
||||
throw new Exception(date('Y-m-d H:i:s:u') . " Error pinging Solr server." . $solrIntruct . " response error: " . $response . "\n");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all documents from index
|
||||
* @gearman = false
|
||||
* @rest = false
|
||||
* @background = false
|
||||
*
|
||||
* @return solr response
|
||||
*/
|
||||
public function deleteAllDocuments($workspace)
|
||||
{
|
||||
$solrIntruct = '';
|
||||
// get configuration information in base to workspace parameter
|
||||
$solrIntruct = (substr($this->_solrHost, -1) == "/") ? $this->_solrHost : $this->_solrHost . "/";
|
||||
$solrIntruct .= $workspace;
|
||||
$solrIntruct .= "/update";
|
||||
|
||||
$handler = curl_init($solrIntruct);
|
||||
curl_setopt($handler, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($handler, CURLOPT_HTTPHEADER, array(
|
||||
'Content-type:application/xml'
|
||||
));
|
||||
curl_setopt($handler, CURLOPT_BINARYTRANSFER, true); // --data-binary
|
||||
curl_setopt($handler, CURLOPT_POSTFIELDS, "<delete><query>*:*</query></delete>"); // data
|
||||
//Apply proxy settings
|
||||
$sysConf = System::getSystemConfiguration();
|
||||
if ($sysConf['proxy_host'] != '') {
|
||||
curl_setopt($handler, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : ''));
|
||||
if ($sysConf['proxy_port'] != '') {
|
||||
curl_setopt($handler, CURLOPT_PROXYPORT, $sysConf['proxy_port']);
|
||||
}
|
||||
if ($sysConf['proxy_user'] != '') {
|
||||
curl_setopt($handler, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : ''));
|
||||
}
|
||||
curl_setopt($handler, CURLOPT_HTTPHEADER, array('Expect:'));
|
||||
}
|
||||
|
||||
$response = curl_exec($handler);
|
||||
|
||||
curl_close($handler);
|
||||
|
||||
$swOk = strpos($response, '<int name="status">0</int>');
|
||||
if (!$swOk) {
|
||||
throw new Exception(date('Y-m-d H:i:s:u') . " Error deleting all documents in Solr." . $solrIntruct . " response error: " . $response . "\n");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete specified documents from index
|
||||
* @gearman = false
|
||||
* @rest = false
|
||||
* @background = false
|
||||
*
|
||||
* @return solr response
|
||||
*/
|
||||
public function deleteDocument($workspace, $idQuery)
|
||||
{
|
||||
$solrIntruct = '';
|
||||
// get configuration information in base to workspace parameter
|
||||
$solrIntruct = (substr($this->_solrHost, -1) == "/") ? $this->_solrHost : $this->_solrHost . "/";
|
||||
$solrIntruct .= $workspace;
|
||||
$solrIntruct .= "/update";
|
||||
|
||||
$handler = curl_init($solrIntruct);
|
||||
curl_setopt($handler, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($handler, CURLOPT_HTTPHEADER, array(
|
||||
'Content-type:application/xml'
|
||||
));
|
||||
curl_setopt($handler, CURLOPT_BINARYTRANSFER, true); // --data-binary
|
||||
curl_setopt($handler, CURLOPT_POSTFIELDS, "<delete><query>" . $idQuery . "</query></delete>"); // data
|
||||
//Apply proxy settings
|
||||
$sysConf = System::getSystemConfiguration();
|
||||
if ($sysConf['proxy_host'] != '') {
|
||||
curl_setopt($handler, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : ''));
|
||||
if ($sysConf['proxy_port'] != '') {
|
||||
curl_setopt($handler, CURLOPT_PROXYPORT, $sysConf['proxy_port']);
|
||||
}
|
||||
if ($sysConf['proxy_user'] != '') {
|
||||
curl_setopt($handler, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : ''));
|
||||
}
|
||||
curl_setopt($handler, CURLOPT_HTTPHEADER, array('Expect:'));
|
||||
}
|
||||
|
||||
$response = curl_exec($handler);
|
||||
|
||||
curl_close($handler);
|
||||
|
||||
$swOk = strpos($response, '<int name="status">0</int>');
|
||||
if (!$swOk) {
|
||||
throw new Exception(date('Y-m-d H:i:s:u') . " Error deleting document in Solr." . $solrIntruct . " response error: " . $response . "\n");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a query in base to Request data
|
||||
*
|
||||
* @param EntityFacetRequest $facetRequestEntity
|
||||
* @return solr response: list of facets array
|
||||
*/
|
||||
public function getFacetsList($facetRequest)
|
||||
{
|
||||
$solrIntruct = '';
|
||||
// get configuration information in base to workspace parameter
|
||||
$workspace = $facetRequest->workspace;
|
||||
|
||||
// format request
|
||||
$query = empty($facetRequest->searchText) ? '*:*' : $facetRequest->searchText;
|
||||
$query = rawurlencode($query);
|
||||
$start = '&start=0';
|
||||
$rows = '&rows=0';
|
||||
$facets = '&facet=on&facet.mincount=1&facet.limit=20'; // enable facet and
|
||||
// only return facets
|
||||
// with minimun one
|
||||
// instance
|
||||
foreach ($facetRequest->facetFields as $value) {
|
||||
$facets .= '&facet.field=' . $value;
|
||||
}
|
||||
foreach ($facetRequest->facetQueries as $value) {
|
||||
$facets .= '&facet.query=' . $value;
|
||||
}
|
||||
if (!empty($facetRequest->facetDates)) {
|
||||
foreach ($facetRequest->facetDates as $value) {
|
||||
$facets .= '&facet.date=' . $value;
|
||||
}
|
||||
$facets .= '&facet.date.start=' . $facetRequest->facetDatesStart;
|
||||
$facets .= '&facet.date.end=' . $facetRequest->facetDatesEnd;
|
||||
$facets .= '&facet.date.gap=' . $facetRequest->facetDateGap;
|
||||
}
|
||||
$filters = '';
|
||||
foreach ($facetRequest->filters as $value) {
|
||||
$filters .= '&fq=' . $value;
|
||||
}
|
||||
|
||||
$resultFormat = '&wt=json';
|
||||
|
||||
$solrIntruct = (substr($this->_solrHost, -1) == "/") ? $this->_solrHost : $this->_solrHost . "/";
|
||||
$solrIntruct .= $workspace;
|
||||
$solrIntruct .= "/select/?q=$query";
|
||||
$solrIntruct .= "&echoParams=none";
|
||||
$solrIntruct .= self::SOLR_VERSION;
|
||||
$solrIntruct .= $start;
|
||||
$solrIntruct .= $rows;
|
||||
$solrIntruct .= $facets;
|
||||
$solrIntruct .= $filters;
|
||||
$solrIntruct .= $resultFormat;
|
||||
|
||||
// send query
|
||||
// search the cases in base to datatable parameters
|
||||
$handler = curl_init($solrIntruct);
|
||||
curl_setopt($handler, CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
//Apply proxy settings
|
||||
$sysConf = System::getSystemConfiguration();
|
||||
if ($sysConf['proxy_host'] != '') {
|
||||
curl_setopt($handler, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : ''));
|
||||
if ($sysConf['proxy_port'] != '') {
|
||||
curl_setopt($handler, CURLOPT_PROXYPORT, $sysConf['proxy_port']);
|
||||
}
|
||||
if ($sysConf['proxy_user'] != '') {
|
||||
curl_setopt($handler, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : ''));
|
||||
}
|
||||
curl_setopt($handler, CURLOPT_HTTPHEADER, array('Expect:'));
|
||||
}
|
||||
|
||||
$response = curl_exec($handler);
|
||||
curl_close($handler);
|
||||
|
||||
// decode
|
||||
$responseSolr = G::json_decode($response);
|
||||
if ($responseSolr->responseHeader->status != 0) {
|
||||
throw new Exception(date('Y-m-d H:i:s:u') . " Error getting faceted list from Solr." . $solrIntruct . " response error: " . $response . "\n");
|
||||
}
|
||||
|
||||
return $responseSolr;
|
||||
}
|
||||
}
|
||||
346
workflow/engine/classes/BpmnEngineServicesSearchIndex.php
Normal file
346
workflow/engine/classes/BpmnEngineServicesSearchIndex.php
Normal file
@@ -0,0 +1,346 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Class used as interface to have access to the search index services
|
||||
*/
|
||||
class BpmnEngineServicesSearchIndex
|
||||
{
|
||||
private $_solrIsEnabled = false;
|
||||
private $_solrHost = "";
|
||||
|
||||
public function __construct($solrIsEnabled = false, $solrHost = "")
|
||||
{
|
||||
$this->_solrIsEnabled = $solrIsEnabled;
|
||||
$this->_solrHost = $solrHost;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify if the Solr service is available
|
||||
*
|
||||
* @gearman = false
|
||||
* @rest = false
|
||||
* @background = false no input parameters @param[in]
|
||||
* @param [out] bool true if index service is enabled false in other case
|
||||
*/
|
||||
public function isEnabled($workspace)
|
||||
{
|
||||
require_once('class.solr.php');
|
||||
$solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost);
|
||||
return $solr->isEnabled($workspace);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of facets in base to the specified query and filter
|
||||
*
|
||||
* @gearman = true
|
||||
* @rest = false
|
||||
* @background = false
|
||||
* @param [in] Entity_FacetRequest facetRequestEntity Facet request entity
|
||||
* @param [out] array FacetGroup
|
||||
*/
|
||||
public function getFacetsList($facetRequestEntity)
|
||||
{
|
||||
require_once('class.solr.php');
|
||||
require_once('entities/FacetGroup.php');
|
||||
require_once('entities/FacetItem.php');
|
||||
require_once('entities/SelectedFacetGroupItem.php');
|
||||
require_once('entities/FacetResult.php');
|
||||
|
||||
// get array of selected facet groups
|
||||
$facetRequestEntity->selectedFacetsString = str_replace(',,', ',', $facetRequestEntity->selectedFacetsString);
|
||||
// remove descriptions of selected facet groups
|
||||
|
||||
$aGroups = explode(',', $facetRequestEntity->selectedFacetsString);
|
||||
|
||||
$aGroups = array_filter($aGroups); // remove empty items
|
||||
|
||||
$aSelectedFacetGroups = array();
|
||||
foreach ($aGroups as $i => $value) {
|
||||
$gi = explode(':::', $value);
|
||||
$gr = explode('::', $gi [0]);
|
||||
$it = explode('::', $gi [1]);
|
||||
|
||||
// create string for remove condition
|
||||
$count = 0;
|
||||
$removeCondition = str_replace($value . ',', '', $facetRequestEntity->selectedFacetsString, $count);
|
||||
if ($count == 0) {
|
||||
$removeCondition = str_replace($value, '', $facetRequestEntity->selectedFacetsString, $count);
|
||||
}
|
||||
$selectedFacetGroupData = array(
|
||||
'selectedFacetGroupName' => $gr [0],
|
||||
'selectedFacetGroupPrintName' => $gr [1],
|
||||
'selectedFacetItemName' => $it [0],
|
||||
'selectedFacetItemPrintName' => $it [1],
|
||||
'selectedFacetRemoveCondition' => $removeCondition
|
||||
);
|
||||
|
||||
$aSelectedFacetGroups [] = EntitySelectedFacetGroupItem::createForRequest($selectedFacetGroupData);
|
||||
}
|
||||
|
||||
// convert request to index request
|
||||
// create filters
|
||||
$filters = array();
|
||||
if (!empty($aSelectedFacetGroups)) {
|
||||
// exclude facetFields and facetDates included in filter from the next
|
||||
// list of facets
|
||||
foreach ($aSelectedFacetGroups as $value) {
|
||||
$facetRequestEntity->facetFields = array_diff($facetRequestEntity->facetFields, array(
|
||||
$value->selectedFacetGroupName
|
||||
));
|
||||
$facetRequestEntity->facetDates = array_diff($facetRequestEntity->facetDates, array(
|
||||
$value->selectedFacetGroupName
|
||||
));
|
||||
}
|
||||
|
||||
foreach ($aSelectedFacetGroups as $group) {
|
||||
$filters [] = $group->selectedFacetGroupName . ':' . urlencode($group->selectedFacetItemName);
|
||||
}
|
||||
}
|
||||
$facetRequestEntity->filters = $filters;
|
||||
|
||||
$solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost);
|
||||
|
||||
// create list of facets
|
||||
$facetsList = $solr->getFacetsList($facetRequestEntity);
|
||||
|
||||
$numFound = $facetsList->response->numFound;
|
||||
|
||||
$facetCounts = $facetsList->facet_counts;
|
||||
|
||||
$facetGroups = array();
|
||||
|
||||
// convert facet fields result to objects
|
||||
// include facet field results
|
||||
$facetFieldsResult = $facetsList->facet_counts->facet_fields;
|
||||
if (!empty($facetFieldsResult)) {
|
||||
foreach ($facetFieldsResult as $facetGroup => $facetvalues) {
|
||||
if (count($facetvalues) > 0) { // if the group have facets included
|
||||
$data = array(
|
||||
'facetGroupName' => $facetGroup
|
||||
);
|
||||
$data ['facetGroupPrintName'] = $facetGroup;
|
||||
$data ['facetGroupType'] = 'field';
|
||||
$facetItems = array();
|
||||
for ($i = 0; $i < count($facetvalues); $i += 2) {
|
||||
$dataItem = array();
|
||||
$dataItem ['facetName'] = $facetvalues [$i];
|
||||
$dataItem ['facetPrintName'] = $facetvalues [$i];
|
||||
$dataItem ['facetCount'] = $facetvalues [$i + 1];
|
||||
$dataItem ['facetSelectCondition'] = $facetRequestEntity->selectedFacetsString . (empty($facetRequestEntity->selectedFacetsString) ? '' : ',') . $data ['facetGroupName'] . '::' . $data ['facetGroupPrintName'] . ':::' . $dataItem ['facetName'] . '::' . $dataItem ['facetPrintName'];
|
||||
$newFacetItem = EntityFacetItem::createForInsert($dataItem);
|
||||
$facetItems [] = $newFacetItem;
|
||||
}
|
||||
$data ['facetItems'] = $facetItems;
|
||||
$newFacetGroup = EntityFacetGroup::createForInsert($data);
|
||||
|
||||
$facetGroups [] = $newFacetGroup;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// include facet date ranges results
|
||||
$facetDatesResult = $facetsList->facet_counts->facet_dates;
|
||||
if (!empty($facetDatesResult)) {
|
||||
foreach ($facetDatesResult as $facetGroup => $facetvalues) {
|
||||
if (count((array) $facetvalues) > 3) { // if the group have any facets included
|
||||
// besides start, end and gap
|
||||
$data = array(
|
||||
'facetGroupName' => $facetGroup
|
||||
);
|
||||
$data ['facetGroupPrintName'] = $facetGroup;
|
||||
$data ['facetGroupType'] = 'daterange';
|
||||
$facetItems = array();
|
||||
$facetvalueskeys = array_keys((array) $facetvalues);
|
||||
foreach ($facetvalueskeys as $i => $k) {
|
||||
if ($k != 'gap' && $k != 'start' && $k != 'end') {
|
||||
$dataItem = array();
|
||||
if ($i < count($facetvalueskeys) - 4) {
|
||||
$dataItem ['facetName'] = '[' . $k . '%20TO%20' . $facetvalueskeys [$i + 1] . ']';
|
||||
$dataItem ['facetPrintName'] = '[' . $k . '%20TO%20' . $facetvalueskeys [$i + 1] . ']';
|
||||
} else {
|
||||
// the last group
|
||||
$dataItem ['facetName'] = '[' . $k . '%20TO%20' . $facetvalues->end . ']';
|
||||
$dataItem ['facetPrintName'] = '[' . $k . '%20TO%20' . $facetvalues->end . ']';
|
||||
}
|
||||
|
||||
$dataItem ['facetCount'] = $facetvalues->$k;
|
||||
$dataItem ['facetSelectCondition'] = $facetRequestEntity->selectedFacetsString . (empty($facetRequestEntity->selectedFacetsString) ? '' : ',') . $data ['facetGroupName'] . '::' . $data ['facetGroupPrintName'] . ':::' . $dataItem ['facetName'] . '::' . $dataItem ['facetPrintName'];
|
||||
$newFacetItem = EntityFacetItem::createForInsert($dataItem);
|
||||
$facetItems [] = $newFacetItem;
|
||||
}
|
||||
}
|
||||
|
||||
$data ['facetItems'] = $facetItems;
|
||||
$newFacetGroup = EntityFacetGroup::createForInsert($data);
|
||||
|
||||
$facetGroups [] = $newFacetGroup;
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO:convert facet queries
|
||||
// Create a filter string used in the filter of results of a datatable
|
||||
$filterText = ''; // the list of selected filters used for filtering result,
|
||||
// send in ajax
|
||||
foreach ($aSelectedFacetGroups as $selectedFacetGroup) {
|
||||
$filterText .= $selectedFacetGroup->selectedFacetGroupName . ':' . urlencode($selectedFacetGroup->selectedFacetItemName) . ',';
|
||||
}
|
||||
$filterText = substr_replace($filterText, '', - 1);
|
||||
|
||||
// Create result
|
||||
$dataFacetResult = array(
|
||||
'aFacetGroups' => $facetGroups,
|
||||
'aSelectedFacetGroups' => $aSelectedFacetGroups,
|
||||
'sFilterText' => $filterText
|
||||
);
|
||||
$facetResult = EntityFacetResult::createForRequest($dataFacetResult);
|
||||
|
||||
return $facetResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the total number of documents in search server
|
||||
* @param string $workspace
|
||||
* @return integer number of documents
|
||||
*
|
||||
*/
|
||||
public function getNumberDocuments($workspace)
|
||||
{
|
||||
require_once('class.solr.php');
|
||||
$solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost);
|
||||
|
||||
// create list of facets
|
||||
$numberDocuments = $solr->getNumberDocuments($workspace);
|
||||
|
||||
return $numberDocuments;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update document Index
|
||||
* @param SolrUpdateDocumentEntity $solrUpdateDocumentEntity
|
||||
*/
|
||||
public function updateIndexDocument($solrUpdateDocumentEntity)
|
||||
{
|
||||
$solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost);
|
||||
|
||||
// create list of facets
|
||||
$solr->updateDocument($solrUpdateDocumentEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete document from index
|
||||
* @param string $workspace
|
||||
* @param string $idQuery
|
||||
*/
|
||||
public function deleteDocumentFromIndex($workspace, $idQuery)
|
||||
{
|
||||
$solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost);
|
||||
|
||||
// create list of facets
|
||||
$solr->deleteDocument($workspace, $idQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* Commit index changes
|
||||
* @param string $workspace
|
||||
*/
|
||||
public function commitIndexChanges($workspace)
|
||||
{
|
||||
$solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost);
|
||||
|
||||
// commit
|
||||
$solr->commitChanges($workspace);
|
||||
}
|
||||
|
||||
/**
|
||||
* Optimize index changes
|
||||
* @param string $workspace
|
||||
*/
|
||||
public function optimizeIndexChanges($workspace)
|
||||
{
|
||||
$solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost);
|
||||
|
||||
// commit
|
||||
$solr->optimizeChanges($workspace);
|
||||
}
|
||||
|
||||
/**
|
||||
* Call Solr server to return the list of paginated pages.
|
||||
* @param FacetRequest $solrRequestData
|
||||
* @return EntitySolrQueryResult
|
||||
*/
|
||||
public function getDataTablePaginatedList($solrRequestData)
|
||||
{
|
||||
require_once('class.solr.php');
|
||||
require_once('entities/SolrRequestData.php');
|
||||
require_once('entities/SolrQueryResult.php');
|
||||
|
||||
// execute query
|
||||
$solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost);
|
||||
$solrPaginatedResult = $solr->executeQuery($solrRequestData);
|
||||
|
||||
// get total number of documents in index
|
||||
$numTotalDocs = $solr->getNumberDocuments($solrRequestData->workspace);
|
||||
|
||||
// create the Datatable response of the query
|
||||
$numFound = $solrPaginatedResult->response->numFound;
|
||||
|
||||
$docs = $solrPaginatedResult->response->docs;
|
||||
|
||||
// insert list of names in docs result
|
||||
$data = array(
|
||||
"sEcho" => '', // must be completed in response
|
||||
"iTotalRecords" => intval($numTotalDocs), // we must get the
|
||||
// total number of documents
|
||||
"iTotalDisplayRecords" => $numFound,
|
||||
"aaData" => array()
|
||||
);
|
||||
// copy result document or add placeholders to result
|
||||
foreach ($docs as $i => $doc) {
|
||||
$data ['aaData'] [$i] = array();
|
||||
foreach ($solrRequestData->includeCols as $columnName) {
|
||||
if ($columnName == '') {
|
||||
$data ['aaData'] [$i] [] = ''; // placeholder
|
||||
} else {
|
||||
if (isset($doc->$columnName)) {
|
||||
$data ['aaData'] [$i] [$columnName] = $doc->$columnName;
|
||||
} else {
|
||||
$data ['aaData'] [$i] [$columnName] = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$solrQueryResponse = EntitySolrQueryResult::createForRequest($data);
|
||||
|
||||
return $solrQueryResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the list of stored fields in the index.
|
||||
* @param string $workspace
|
||||
* @return array of index fields
|
||||
*/
|
||||
public function getIndexFields($workspace)
|
||||
{
|
||||
require_once('class.solr.php');
|
||||
|
||||
$solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost);
|
||||
|
||||
$solrFieldsData = $solr->getListIndexedStoredFields($workspace);
|
||||
// copy list of arrays
|
||||
$listFields = array();
|
||||
foreach ($solrFieldsData->fields as $key => $fieldData) {
|
||||
if (array_key_exists('dynamicBase', $fieldData)) {
|
||||
$originalFieldName = substr($key, 0, - strlen($fieldData->dynamicBase) + 1);
|
||||
|
||||
// Maintain case sensitive variable names
|
||||
$listFields [$originalFieldName] = $key;
|
||||
} else {
|
||||
// Maintain case sensitive variable names
|
||||
$listFields [$key] = $key;
|
||||
}
|
||||
}
|
||||
|
||||
return $listFields;
|
||||
}
|
||||
}
|
||||
59
workflow/engine/classes/BzipFile.php
Normal file
59
workflow/engine/classes/BzipFile.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This class is derived from the class archive, is employed to use files .bzip
|
||||
*/
|
||||
class BzipFile extends TarFile
|
||||
{
|
||||
|
||||
/**
|
||||
* This function is the constructor of the class bzip_file
|
||||
*
|
||||
* @param string $name
|
||||
* @return void
|
||||
*/
|
||||
public function BzipFile($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");
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,32 +1,7 @@
|
||||
<?php
|
||||
|
||||
use \ProcessMaker\BusinessModel\WebEntryEvent;
|
||||
|
||||
/**
|
||||
* class.case.php
|
||||
* @package workflow.engine.classes
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
|
||||
/**
|
||||
@@ -36,7 +11,6 @@ use ProcessMaker\Plugins\PluginRegistry;
|
||||
*/
|
||||
class Cases
|
||||
{
|
||||
|
||||
private $appSolr = null;
|
||||
public $dir = 'ASC';
|
||||
public $sort = 'APP_MSG_DATE';
|
||||
@@ -45,7 +19,7 @@ class Cases
|
||||
public function __construct()
|
||||
{
|
||||
//get Solr initialization variables
|
||||
if (($solrConf = PmSystem::solrEnv()) !== false) {
|
||||
if (($solrConf = System::solrEnv()) !== false) {
|
||||
$this->appSolr = new AppSolr($solrConf['solr_enabled'], $solrConf['solr_host'], $solrConf['solr_instance']);
|
||||
}
|
||||
}
|
||||
@@ -167,7 +141,7 @@ class Cases
|
||||
$c->addSelectColumn(TaskPeer::TAS_TITLE);
|
||||
$c->addSelectColumn(TaskPeer::PRO_UID);
|
||||
$c->addSelectColumn(ProcessPeer::PRO_TITLE);
|
||||
$c->addJoin (TaskPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN);
|
||||
$c->addJoin(TaskPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN);
|
||||
$c->add(TaskPeer::TAS_UID, $tasks, Criteria::IN);
|
||||
$c->addAscendingOrderByColumn(ProcessPeer::PRO_TITLE);
|
||||
$c->addAscendingOrderByColumn(TaskPeer::TAS_TITLE);
|
||||
@@ -278,7 +252,7 @@ class Cases
|
||||
$aConditions[] = array('PCS.PRO_CATEGORY', 'PCSCAT.CATEGORY_UID');
|
||||
$c->addJoinMC($aConditions, Criteria::LEFT_JOIN);
|
||||
}
|
||||
$c->addJoin (TaskPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN);
|
||||
$c->addJoin(TaskPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN);
|
||||
$c->add(TaskPeer::TAS_UID, $tasks, Criteria::IN);
|
||||
$c->add(ProcessPeer::PRO_SUBPROCESS, '0');
|
||||
$c->addAscendingOrderByColumn(ProcessPeer::PRO_TITLE);
|
||||
@@ -385,7 +359,7 @@ class Cases
|
||||
$c->addSelectColumn(TaskPeer::TAS_TITLE);
|
||||
$c->addSelectColumn(TaskPeer::PRO_UID);
|
||||
$c->addSelectColumn(ProcessPeer::PRO_TITLE);
|
||||
$c->addJoin (TaskPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN);
|
||||
$c->addJoin(TaskPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN);
|
||||
$c->add(TaskPeer::TAS_UID, $tasks, Criteria::IN);
|
||||
$c->addAscendingOrderByColumn(ProcessPeer::PRO_TITLE);
|
||||
$c->addAscendingOrderByColumn(TaskPeer::TAS_TITLE);
|
||||
@@ -538,14 +512,13 @@ class Cases
|
||||
$aFields['CURRENT_USER'] = implode(" - ", array_values($aFields['CURRENT_USER']));
|
||||
$tasksArray = array_filter(explode('|', $aFields['TAS_UID']));
|
||||
|
||||
if(count($tasksArray) == 1) {
|
||||
if (count($tasksArray) == 1) {
|
||||
$aFields['TAS_UID'] = $tasksArray[0];
|
||||
}
|
||||
} else {
|
||||
$oCurUser->load($aAppDel['USR_UID']);
|
||||
$aFields['CURRENT_USER'] = $oCurUser->getUsrFirstname() . ' ' . $oCurUser->getUsrLastname();
|
||||
}
|
||||
|
||||
} catch (Exception $oError) {
|
||||
$aFields['CURRENT_USER'] = '';
|
||||
}
|
||||
@@ -714,7 +687,7 @@ class Cases
|
||||
$cri->addSelectColumn(AppDelegationPeer::TAS_UID);
|
||||
$cri->add(AppDelegationPeer::APP_UID, $sAppUid);
|
||||
$cri->add(AppDelegationPeer::DEL_THREAD_STATUS, "OPEN");
|
||||
if(isset($fields['DEL_INDEX'])){
|
||||
if (isset($fields['DEL_INDEX'])) {
|
||||
$cri->add(AppDelegationPeer::DEL_INDEX, $fields['DEL_INDEX']);
|
||||
}
|
||||
$rsCri = AppDelegationPeer::doSelectRS($cri);
|
||||
@@ -843,7 +816,8 @@ class Cases
|
||||
return $aReturn;
|
||||
}
|
||||
|
||||
public function array_key_intersect(&$a, &$b) {
|
||||
public function array_key_intersect(&$a, &$b)
|
||||
{
|
||||
$array = array();
|
||||
while (list($key, $value) = each($a)) {
|
||||
if (isset($b[$key])) {
|
||||
@@ -893,7 +867,7 @@ class Cases
|
||||
if (isset($Fields['APP_DESCRIPTION'])) {
|
||||
$appFields['APP_DESCRIPTION'] = $Fields['APP_DESCRIPTION'];
|
||||
}
|
||||
if(isset($Fields['DEL_INDEX'])){
|
||||
if (isset($Fields['DEL_INDEX'])) {
|
||||
$appFields['DEL_INDEX'] = $Fields['DEL_INDEX'];
|
||||
}
|
||||
|
||||
@@ -908,9 +882,9 @@ class Cases
|
||||
//Add fields that weren't in previous version
|
||||
foreach ($aApplicationFields as $key => $value) {
|
||||
if (is_array($value) && isset($fieldsOnBoth[$key]) && is_array($fieldsOnBoth[$key])) {
|
||||
$afieldDifference = $this->arrayRecursiveDiff($value,$fieldsOnBoth[$key]);
|
||||
$dfieldDifference = $this->arrayRecursiveDiff($fieldsOnBoth[$key],$value);
|
||||
if ($afieldDifference || $dfieldDifference){
|
||||
$afieldDifference = $this->arrayRecursiveDiff($value, $fieldsOnBoth[$key]);
|
||||
$dfieldDifference = $this->arrayRecursiveDiff($fieldsOnBoth[$key], $value);
|
||||
if ($afieldDifference || $dfieldDifference) {
|
||||
$FieldsDifference[$key] = $value;
|
||||
}
|
||||
} else {
|
||||
@@ -1015,8 +989,8 @@ class Cases
|
||||
}
|
||||
|
||||
/*----------------------------------********---------------------------------*/
|
||||
if(!isset($Fields['DEL_INDEX'])){
|
||||
$Fields['DEL_INDEX'] = 1;
|
||||
if (!isset($Fields['DEL_INDEX'])) {
|
||||
$Fields['DEL_INDEX'] = 1;
|
||||
}
|
||||
$inbox = new ListInbox();
|
||||
unset($Fields['DEL_INIT_DATE']);
|
||||
@@ -1046,7 +1020,7 @@ class Cases
|
||||
|
||||
$oAppDocument = new AppDocument();
|
||||
|
||||
if($deleteDelegation) {
|
||||
if ($deleteDelegation) {
|
||||
//Delete the delegations of a application
|
||||
$this->deleteDelegation($sAppUid);
|
||||
}
|
||||
@@ -1103,7 +1077,7 @@ class Cases
|
||||
$oDerivation = new Derivation();
|
||||
$oDerivation->verifyIsCaseChild($sAppUid);
|
||||
}
|
||||
} catch(Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
Bootstrap::registerMonolog('DeleteCases', 200, 'Error in sub-process when trying to route a child case related to the case', ['application_uid' => $sAppUid, 'error' => $e->getMessage()], SYS_SYS, 'processmaker.log');
|
||||
}
|
||||
|
||||
@@ -1246,13 +1220,13 @@ class Cases
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Determines if the all threads of a multiinstance task are closed
|
||||
*
|
||||
* @$appUid string appUid of the instance to be tested
|
||||
* @$tasUid string task uid of the multiinstance task
|
||||
* @$previousDelIndex int previous del index of the instance corresponding to the multiinstance task
|
||||
*/
|
||||
/*
|
||||
* Determines if the all threads of a multiinstance task are closed
|
||||
*
|
||||
* @$appUid string appUid of the instance to be tested
|
||||
* @$tasUid string task uid of the multiinstance task
|
||||
* @$previousDelIndex int previous del index of the instance corresponding to the multiinstance task
|
||||
*/
|
||||
|
||||
public function multiInstanceIsCompleted($appUid, $tasUid, $previousDelIndex)
|
||||
{
|
||||
@@ -1267,15 +1241,14 @@ class Cases
|
||||
$rs = AppDelegationPeer::doSelectRs($c);
|
||||
|
||||
if ($rs->next()) {
|
||||
$result = false;
|
||||
$result = false;
|
||||
} else {
|
||||
$result = true;
|
||||
}
|
||||
|
||||
} catch (exception $e) {
|
||||
throw ($e);
|
||||
} finally {
|
||||
return $result;
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1434,7 +1407,8 @@ class Cases
|
||||
* @param array $previousTasks
|
||||
* @return array $taskReviewed
|
||||
*/
|
||||
public function getReviewedTasksRecursive($taskUid, $appUid, $previousTasks) {
|
||||
public function getReviewedTasksRecursive($taskUid, $appUid, $previousTasks)
|
||||
{
|
||||
$taskReviewed = array();
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->add(RoutePeer::ROU_NEXT_TASK, $taskUid);
|
||||
@@ -1494,11 +1468,11 @@ class Cases
|
||||
//If exist paused cases
|
||||
$closedTasks[] = $row;
|
||||
$aIndex[] = $row['DEL_INDEX'];
|
||||
$res = $this->GetAllOpenDelegation( array('APP_UID'=>$sAppUid, 'APP_THREAD_PARENT'=>$row['DEL_PREVIOUS']), 'NONE' );
|
||||
$res = $this->GetAllOpenDelegation(array('APP_UID'=>$sAppUid, 'APP_THREAD_PARENT'=>$row['DEL_PREVIOUS']), 'NONE');
|
||||
foreach ($res as $in) {
|
||||
$aIndex[] = $in['DEL_INDEX'];
|
||||
}
|
||||
$pausedTasks = $this->getReviewedTasksPaused($sAppUid,$aIndex);
|
||||
$pausedTasks = $this->getReviewedTasksPaused($sAppUid, $aIndex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1516,7 +1490,7 @@ class Cases
|
||||
* @return array within the paused tasks
|
||||
* false -> when has not any delegation started for that task
|
||||
*/
|
||||
public function getReviewedTasksPaused($sAppUid,$aDelIndex)
|
||||
public function getReviewedTasksPaused($sAppUid, $aDelIndex)
|
||||
{
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->add(AppDelayPeer::APP_UID, $sAppUid);
|
||||
@@ -2157,19 +2131,19 @@ class Cases
|
||||
$aUserFields = array();
|
||||
$taskAssignType = $task->getTasAssignType();
|
||||
$nextTaskAssignVariable = $task->getTasAssignVariable();
|
||||
if($taskAssignType == "MULTIPLE_INSTANCE" || $taskAssignType == "MULTIPLE_INSTANCE_VALUE_BASED"){
|
||||
if ($taskAssignType == "MULTIPLE_INSTANCE" || $taskAssignType == "MULTIPLE_INSTANCE_VALUE_BASED") {
|
||||
switch ($taskAssignType) {
|
||||
case 'MULTIPLE_INSTANCE':
|
||||
$userFields = $oDerivation->getUsersFullNameFromArray($oDerivation->getAllUsersFromAnyTask($sTasUid));
|
||||
break;
|
||||
default:
|
||||
throw (new Exception( 'Invalid Task Assignment method' ));
|
||||
throw (new Exception('Invalid Task Assignment method'));
|
||||
break;
|
||||
}
|
||||
$userFields = $oDerivation->getUsersFullNameFromArray($oDerivation->getAllUsersFromAnyTask($sTasUid));
|
||||
$count = 0;
|
||||
foreach($userFields as $rowUser){
|
||||
if($rowUser["USR_UID"] != $sUsrUid){
|
||||
foreach ($userFields as $rowUser) {
|
||||
if ($rowUser["USR_UID"] != $sUsrUid) {
|
||||
//appDelegation
|
||||
$AppDelegation = new AppDelegation;
|
||||
$iAppThreadIndex ++; // Start Thread
|
||||
@@ -2193,13 +2167,13 @@ class Cases
|
||||
(empty($user)) ? 0 : $user->getUsrId(),
|
||||
$this->Process->getProId()
|
||||
);
|
||||
//appThread
|
||||
$AppThread = new AppThread;
|
||||
$iAppThreadIndex = $AppThread->createAppThread($sAppUid, $iDelIndex1, 0);
|
||||
//Save Information
|
||||
$aUserFields[$count] = $rowUser;
|
||||
$aUserFields[$count]["DEL_INDEX"] = $iDelIndex1;
|
||||
$count++;
|
||||
//appThread
|
||||
$AppThread = new AppThread;
|
||||
$iAppThreadIndex = $AppThread->createAppThread($sAppUid, $iDelIndex1, 0);
|
||||
//Save Information
|
||||
$aUserFields[$count] = $rowUser;
|
||||
$aUserFields[$count]["DEL_INDEX"] = $iDelIndex1;
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2343,7 +2317,6 @@ class Cases
|
||||
$iPosition += 1;
|
||||
$aNextStep = null;
|
||||
if ($iPosition <= $iLastStep) {
|
||||
|
||||
while ($iPosition <= $iLastStep) {
|
||||
$bAccessStep = false;
|
||||
//step
|
||||
@@ -2374,25 +2347,25 @@ class Cases
|
||||
$sAction = '';
|
||||
break;
|
||||
}
|
||||
if(array_key_exists('gmail',$_SESSION) || (array_key_exists('gmail',$_GET) && $_GET['gmail'] == 1)){
|
||||
$aNextStep = array(
|
||||
'TYPE' => $oStep->getStepTypeObj(),
|
||||
'UID' => $oStep->getStepUidObj(),
|
||||
'POSITION' => $oStep->getStepPosition(),
|
||||
'PAGE' => 'cases_Step?TYPE=' . $oStep->getStepTypeObj() . '&UID=' .
|
||||
$oStep->getStepUidObj() . '&POSITION=' . $oStep->getStepPosition() .
|
||||
'&ACTION=' . $sAction .
|
||||
'&gmail=1'
|
||||
);
|
||||
} else{
|
||||
$aNextStep = array(
|
||||
'TYPE' => $oStep->getStepTypeObj(),
|
||||
'UID' => $oStep->getStepUidObj(),
|
||||
'POSITION' => $oStep->getStepPosition(),
|
||||
'PAGE' => 'cases_Step?TYPE=' . $oStep->getStepTypeObj() . '&UID=' .
|
||||
$oStep->getStepUidObj() . '&POSITION=' . $oStep->getStepPosition() .
|
||||
'&ACTION=' . $sAction
|
||||
);
|
||||
if (array_key_exists('gmail', $_SESSION) || (array_key_exists('gmail', $_GET) && $_GET['gmail'] == 1)) {
|
||||
$aNextStep = array(
|
||||
'TYPE' => $oStep->getStepTypeObj(),
|
||||
'UID' => $oStep->getStepUidObj(),
|
||||
'POSITION' => $oStep->getStepPosition(),
|
||||
'PAGE' => 'cases_Step?TYPE=' . $oStep->getStepTypeObj() . '&UID=' .
|
||||
$oStep->getStepUidObj() . '&POSITION=' . $oStep->getStepPosition() .
|
||||
'&ACTION=' . $sAction .
|
||||
'&gmail=1'
|
||||
);
|
||||
} else {
|
||||
$aNextStep = array(
|
||||
'TYPE' => $oStep->getStepTypeObj(),
|
||||
'UID' => $oStep->getStepUidObj(),
|
||||
'POSITION' => $oStep->getStepPosition(),
|
||||
'PAGE' => 'cases_Step?TYPE=' . $oStep->getStepTypeObj() . '&UID=' .
|
||||
$oStep->getStepUidObj() . '&POSITION=' . $oStep->getStepPosition() .
|
||||
'&ACTION=' . $sAction
|
||||
);
|
||||
}
|
||||
$iPosition = $iLastStep;
|
||||
}
|
||||
@@ -2401,21 +2374,21 @@ class Cases
|
||||
}
|
||||
}
|
||||
if (!$aNextStep) {
|
||||
if(array_key_exists('gmail',$_SESSION) || (array_key_exists('gmail',$_GET) && $_GET['gmail'] == 1)){
|
||||
$aNextStep = array(
|
||||
'TYPE' => 'DERIVATION',
|
||||
'UID' => -1,
|
||||
'POSITION' => ($iLastStep + 1),
|
||||
'PAGE' => 'cases_Step?TYPE=ASSIGN_TASK&UID=-1&POSITION=10000&ACTION=ASSIGN&gmail=1'
|
||||
);
|
||||
}else {
|
||||
$aNextStep = array(
|
||||
'TYPE' => 'DERIVATION',
|
||||
'UID' => -1,
|
||||
'POSITION' => ($iLastStep + 1),
|
||||
'PAGE' => 'cases_Step?TYPE=ASSIGN_TASK&UID=-1&POSITION=10000&ACTION=ASSIGN'
|
||||
);
|
||||
}
|
||||
if (array_key_exists('gmail', $_SESSION) || (array_key_exists('gmail', $_GET) && $_GET['gmail'] == 1)) {
|
||||
$aNextStep = array(
|
||||
'TYPE' => 'DERIVATION',
|
||||
'UID' => -1,
|
||||
'POSITION' => ($iLastStep + 1),
|
||||
'PAGE' => 'cases_Step?TYPE=ASSIGN_TASK&UID=-1&POSITION=10000&ACTION=ASSIGN&gmail=1'
|
||||
);
|
||||
} else {
|
||||
$aNextStep = array(
|
||||
'TYPE' => 'DERIVATION',
|
||||
'UID' => -1,
|
||||
'POSITION' => ($iLastStep + 1),
|
||||
'PAGE' => 'cases_Step?TYPE=ASSIGN_TASK&UID=-1&POSITION=10000&ACTION=ASSIGN'
|
||||
);
|
||||
}
|
||||
}
|
||||
return $aNextStep;
|
||||
} catch (exception $e) {
|
||||
@@ -2621,7 +2594,6 @@ class Cases
|
||||
///-- $c->addAsColumn('USR_NAME', "CONCAT(USR_LASTNAME, ' ', USR_FIRSTNAME)");
|
||||
$sDataBase = 'database_' . strtolower(DB_ADAPTER);
|
||||
if (G::LoadSystemExist($sDataBase)) {
|
||||
|
||||
$oDataBase = new database();
|
||||
$c->addAsColumn('USR_NAME', $oDataBase->concatString("USR_LASTNAME", "' '", "USR_FIRSTNAME"));
|
||||
$c->addAsColumn(
|
||||
@@ -3373,7 +3345,7 @@ class Cases
|
||||
if (!is_null($oApplication)) {
|
||||
return $oApplication->getDelIndex();
|
||||
}
|
||||
throw ( new Exception('This case has 0 current delegations') );
|
||||
throw (new Exception('This case has 0 current delegations'));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -4011,11 +3983,12 @@ class Cases
|
||||
* @param string $iDelegation
|
||||
* @return boolean
|
||||
*/
|
||||
public static function isUnassignedPauseCase($sAppUid, $iDelegation){
|
||||
public static function isUnassignedPauseCase($sAppUid, $iDelegation)
|
||||
{
|
||||
$oAppDelegation = new AppDelegation();
|
||||
$aFieldsDel = $oAppDelegation->Load($sAppUid, $iDelegation);
|
||||
$usrUid = $aFieldsDel['USR_UID'];
|
||||
if($usrUid === ''){
|
||||
if ($usrUid === '') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@@ -4036,8 +4009,8 @@ class Cases
|
||||
public function pauseCase($sApplicationUID, $iDelegation, $sUserUID, $sUnpauseDate = null, $appTitle = null)
|
||||
{
|
||||
// Check if the case is unassigned
|
||||
if($this->isUnassignedPauseCase($sApplicationUID, $iDelegation)){
|
||||
throw new Exception( G::LoadTranslation("ID_CASE_NOT_PAUSED", array(G::LoadTranslation("ID_UNASSIGNED_STATUS"))) );
|
||||
if ($this->isUnassignedPauseCase($sApplicationUID, $iDelegation)) {
|
||||
throw new Exception(G::LoadTranslation("ID_CASE_NOT_PAUSED", array(G::LoadTranslation("ID_UNASSIGNED_STATUS"))));
|
||||
}
|
||||
|
||||
$oApplication = new Application();
|
||||
@@ -4295,7 +4268,7 @@ class Cases
|
||||
$this->appSolr->updateApplicationSearchIndex($sApplicationUID);
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$data = array (
|
||||
$data = array(
|
||||
'APP_UID' => $sApplicationUID,
|
||||
'DEL_INDEX' => $iIndex,
|
||||
'USR_UID' => $user_logged,
|
||||
@@ -5531,7 +5504,7 @@ class Cases
|
||||
}
|
||||
|
||||
if ($sTo != null) {
|
||||
$oSpool = new spoolRun();
|
||||
$oSpool = new SpoolRun();
|
||||
|
||||
$oSpool->setConfig($dataLastEmail['configuration']);
|
||||
$oSpool->create(array(
|
||||
@@ -5599,10 +5572,10 @@ class Cases
|
||||
{
|
||||
$sTo = null;
|
||||
$sCc = null;
|
||||
$arrayResp = array ();
|
||||
$arrayResp = array();
|
||||
$tasks = new Tasks();
|
||||
$group = new Groups ();
|
||||
$oUser = new Users ();
|
||||
$group = new Groups();
|
||||
$oUser = new Users();
|
||||
|
||||
$task = TaskPeer::retrieveByPK($taskUid);
|
||||
|
||||
@@ -5693,14 +5666,14 @@ class Cases
|
||||
$arrayResp['to'] = $to;
|
||||
$arrayResp['cc'] = $cc;
|
||||
break;
|
||||
case "MULTIPLE_INSTANCE" :
|
||||
case "MULTIPLE_INSTANCE":
|
||||
$to = null;
|
||||
$cc = null;
|
||||
$sw = 1;
|
||||
$oDerivation = new Derivation ();
|
||||
$userFields = $oDerivation->getUsersFullNameFromArray ( $oDerivation->getAllUsersFromAnyTask ( $taskUid ) );
|
||||
if (isset ( $userFields )) {
|
||||
foreach ( $userFields as $row ) {
|
||||
$oDerivation = new Derivation();
|
||||
$userFields = $oDerivation->getUsersFullNameFromArray($oDerivation->getAllUsersFromAnyTask($taskUid));
|
||||
if (isset($userFields)) {
|
||||
foreach ($userFields as $row) {
|
||||
$toAux = ((($row ["USR_FIRSTNAME"] != "") || ($row ["USR_LASTNAME"] != "")) ? $row ["USR_FIRSTNAME"] . " " . $row ["USR_LASTNAME"] . " " : "") . "<" . $row ["USR_EMAIL"] . ">";
|
||||
if ($sw == 1) {
|
||||
$to = $toAux;
|
||||
@@ -5713,19 +5686,19 @@ class Cases
|
||||
$arrayResp ['cc'] = $cc;
|
||||
}
|
||||
break;
|
||||
case "MULTIPLE_INSTANCE_VALUE_BASED" :
|
||||
$oTask = new Task ();
|
||||
$aTaskNext = $oTask->load ( $taskUid );
|
||||
if (isset ( $aTaskNext ["TAS_ASSIGN_VARIABLE"] ) && ! empty ( $aTaskNext ["TAS_ASSIGN_VARIABLE"] )) {
|
||||
case "MULTIPLE_INSTANCE_VALUE_BASED":
|
||||
$oTask = new Task();
|
||||
$aTaskNext = $oTask->load($taskUid);
|
||||
if (isset($aTaskNext ["TAS_ASSIGN_VARIABLE"]) && ! empty($aTaskNext ["TAS_ASSIGN_VARIABLE"])) {
|
||||
$to = null;
|
||||
$cc = null;
|
||||
$sw = 1;
|
||||
$nextTaskAssignVariable = trim ( $aTaskNext ["TAS_ASSIGN_VARIABLE"], " @#" );
|
||||
$nextTaskAssignVariable = trim($aTaskNext ["TAS_ASSIGN_VARIABLE"], " @#");
|
||||
$arrayUsers = $arrayData [$nextTaskAssignVariable];
|
||||
$oDerivation = new Derivation ();
|
||||
$userFields = $oDerivation->getUsersFullNameFromArray ( $arrayUsers );
|
||||
$oDerivation = new Derivation();
|
||||
$userFields = $oDerivation->getUsersFullNameFromArray($arrayUsers);
|
||||
|
||||
foreach ( $userFields as $row ) {
|
||||
foreach ($userFields as $row) {
|
||||
$toAux = ((($row ["USR_FIRSTNAME"] != "") || ($row ["USR_LASTNAME"] != "")) ? $row ["USR_FIRSTNAME"] . " " . $row ["USR_LASTNAME"] . " " : "") . "<" . $row ["USR_EMAIL"] . ">";
|
||||
if ($sw == 1) {
|
||||
$to = $toAux;
|
||||
@@ -5738,7 +5711,7 @@ class Cases
|
||||
$arrayResp ['cc'] = $cc;
|
||||
}
|
||||
break;
|
||||
default :
|
||||
default:
|
||||
if (isset($userUid) && !empty($userUid)) {
|
||||
$aUser = $oUser->load($userUid);
|
||||
|
||||
@@ -5762,9 +5735,9 @@ class Cases
|
||||
*/
|
||||
public function getAllObjects($PRO_UID, $APP_UID, $TAS_UID = '', $USR_UID = '', $delIndex = 0)
|
||||
{
|
||||
$ACTIONS = Array('VIEW', 'BLOCK', 'DELETE'); //TO COMPLETE
|
||||
$MAIN_OBJECTS = Array();
|
||||
$RESULT_OBJECTS = Array();
|
||||
$ACTIONS = array('VIEW', 'BLOCK', 'DELETE'); //TO COMPLETE
|
||||
$MAIN_OBJECTS = array();
|
||||
$RESULT_OBJECTS = array();
|
||||
|
||||
foreach ($ACTIONS as $action) {
|
||||
$MAIN_OBJECTS[$action] = $this->getAllObjectsFrom($PRO_UID, $APP_UID, $TAS_UID, $USR_UID, $action, $delIndex);
|
||||
@@ -5988,9 +5961,9 @@ class Cases
|
||||
"OUTPUT_DOCUMENTS" => $result['OUTPUT'],
|
||||
"CASES_NOTES" => $result['CASES_NOTES'],
|
||||
"MSGS_HISTORY" => $result['MSGS_HISTORY']
|
||||
/*----------------------------------********---------------------------------*/
|
||||
/*----------------------------------********---------------------------------*/
|
||||
,"SUMMARY_FORM" => $result['SUMMARY_FORM']
|
||||
/*----------------------------------********---------------------------------*/
|
||||
/*----------------------------------********---------------------------------*/
|
||||
);
|
||||
}
|
||||
|
||||
@@ -6416,7 +6389,7 @@ class Cases
|
||||
$oCriteria = new Criteria('dbarray');
|
||||
$oCriteria->setDBArrayTable('messages');
|
||||
|
||||
usort( $aMessages, array($this, "ordProcess") );
|
||||
usort($aMessages, array($this, "ordProcess"));
|
||||
return $aMessages;
|
||||
}
|
||||
|
||||
@@ -6455,7 +6428,7 @@ class Cases
|
||||
|
||||
public function getAllObjectsFromProcess($PRO_UID, $OBJ_TYPE = '%')
|
||||
{
|
||||
$RESULT = Array();
|
||||
$RESULT = array();
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->addSelectColumn(AppDocumentPeer::APP_DOC_UID);
|
||||
$oCriteria->addSelectColumn(AppDocumentPeer::APP_UID);
|
||||
@@ -6753,7 +6726,7 @@ class Cases
|
||||
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
if (isset($sumary) && $sumary === true) {
|
||||
$sumary = Array();
|
||||
$sumary = array();
|
||||
while ($rs->next()) {
|
||||
$nCount++;
|
||||
$row = $rs->getRow();
|
||||
@@ -6764,7 +6737,7 @@ class Cases
|
||||
$sumary[$row['PRO_UID']]['name'] = $row['APP_PRO_TITLE'];
|
||||
}
|
||||
}
|
||||
return Array('count' => $nCount, 'sumary' => $sumary);
|
||||
return array('count' => $nCount, 'sumary' => $sumary);
|
||||
} else {
|
||||
while ($rs->next()) {
|
||||
$nCount++;
|
||||
@@ -6783,7 +6756,7 @@ class Cases
|
||||
*/
|
||||
public function getAllConditionCasesCount($types, $sumary = null)
|
||||
{
|
||||
$aResult = Array();
|
||||
$aResult = array();
|
||||
foreach ($types as $type) {
|
||||
$aResult[$type] = $this->getConditionCasesCount($type, $sumary);
|
||||
}
|
||||
@@ -6890,7 +6863,7 @@ class Cases
|
||||
$c = new Criteria();
|
||||
$c->add(AppDelegationPeer::APP_UID, $aData['APP_UID']);
|
||||
$c->add(AppDelegationPeer::DEL_PREVIOUS, $aData['APP_THREAD_PARENT']);
|
||||
if($status === 'OPEN'){
|
||||
if ($status === 'OPEN') {
|
||||
$c->add(AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN');
|
||||
}
|
||||
$rs = AppDelegationPeer::doSelectRs($c);
|
||||
@@ -6954,7 +6927,7 @@ class Cases
|
||||
global $RBAC;
|
||||
//Adding the actual user if this has the PM_SUPERVISOR permission assigned.
|
||||
if ($RBAC->userCanAccess('PM_SUPERVISOR') == 1) {
|
||||
if(!in_array($RBAC->aUserInfo['USER_INFO']['USR_UID'], $row)) {
|
||||
if (!in_array($RBAC->aUserInfo['USER_INFO']['USR_UID'], $row)) {
|
||||
$row[] = $RBAC->aUserInfo['USER_INFO']['USR_UID'];
|
||||
}
|
||||
}
|
||||
@@ -6969,7 +6942,7 @@ class Cases
|
||||
$rs = UsersPeer::doSelectRs($c);
|
||||
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$rows = Array();
|
||||
$rows = array();
|
||||
while ($rs->next()) {
|
||||
$rows[] = $rs->getRow();
|
||||
}
|
||||
@@ -6995,8 +6968,8 @@ class Cases
|
||||
$flagSupervisors = false;
|
||||
|
||||
if ($oDataset->next()) {
|
||||
if (!in_array($USR_UID,$row)) {
|
||||
$rows[] = $oDataset->getRow();
|
||||
if (!in_array($USR_UID, $row)) {
|
||||
$rows[] = $oDataset->getRow();
|
||||
}
|
||||
$flagSupervisors = true;
|
||||
}
|
||||
@@ -7025,7 +6998,7 @@ class Cases
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
if ($oDataset->next()) {
|
||||
if (!in_array($USR_UID,$row)) {
|
||||
if (!in_array($USR_UID, $row)) {
|
||||
$rows[] = $oDataset->getRow();
|
||||
}
|
||||
}
|
||||
@@ -7051,7 +7024,7 @@ class Cases
|
||||
$c->addSelectColumn(UsersPeer::USR_USERNAME);
|
||||
$c->addSelectColumn(UsersPeer::USR_EMAIL);
|
||||
|
||||
if($usrStatus != '') {
|
||||
if ($usrStatus != '') {
|
||||
$c->add(UsersPeer::USR_STATUS, $usrStatus, CRITERIA::EQUAL);
|
||||
}
|
||||
|
||||
@@ -7064,7 +7037,7 @@ class Cases
|
||||
$rs->next();
|
||||
while ($row = $rs->getRow()) {
|
||||
//In some cases the thread does not have a User Script task, Itee
|
||||
if($row['USR_UID'] !== ''){
|
||||
if ($row['USR_UID'] !== '') {
|
||||
$rows[$row['USR_UID']] = $row;
|
||||
}
|
||||
$rs->next();
|
||||
@@ -7076,7 +7049,7 @@ class Cases
|
||||
|
||||
public function getCaseNotes($applicationID, $type = 'array', $userUid = '')
|
||||
{
|
||||
require_once ( "classes/model/AppNotes.php" );
|
||||
require_once("classes/model/AppNotes.php");
|
||||
$appNotes = new AppNotes();
|
||||
$appNotes = $appNotes->getNotesList($applicationID, $userUid);
|
||||
$response = '';
|
||||
@@ -7201,27 +7174,26 @@ class Cases
|
||||
$pmTableName = $pmTable->toCamelCase($tableName);
|
||||
|
||||
//DELETE
|
||||
require_once (PATH_WORKSPACE . "classes" . PATH_SEP . "$pmTableName.php");
|
||||
require_once(PATH_WORKSPACE . "classes" . PATH_SEP . "$pmTableName.php");
|
||||
|
||||
$criteria3 = new Criteria("workflow");
|
||||
|
||||
eval("\$criteria3->add(" . $pmTableName . "Peer::APP_UID, \$applicationUid);");
|
||||
eval($pmTableName . "Peer::doDelete(\$criteria3);");
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function ordProcess ($a, $b)
|
||||
public function ordProcess($a, $b)
|
||||
{
|
||||
if ($this->sort == '') {
|
||||
$this->sort = 'APP_MSG_DATE';
|
||||
}
|
||||
if ($this->dir=='ASC') {
|
||||
if ($a[$this->sort] > $b[$this->sort]) {
|
||||
return 1;
|
||||
if ($this->sort == '') {
|
||||
$this->sort = 'APP_MSG_DATE';
|
||||
}
|
||||
if ($this->dir=='ASC') {
|
||||
if ($a[$this->sort] > $b[$this->sort]) {
|
||||
return 1;
|
||||
} elseif ($a[$this->sort] < $b[$this->sort]) {
|
||||
return - 1;
|
||||
} else {
|
||||
@@ -7229,16 +7201,17 @@ class Cases
|
||||
}
|
||||
} else {
|
||||
if ($a[$this->sort] > $b[$this->sort]) {
|
||||
return - 1;
|
||||
return - 1;
|
||||
} elseif ($a[$this->sort] < $b[$this->sort]) {
|
||||
return 1;
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function unserializeData($data) {
|
||||
public function unserializeData($data)
|
||||
{
|
||||
$unserializedData = @unserialize($data);
|
||||
|
||||
// BUG 8134, FIX!// for single/double quote troubles // Unserialize with utf8 content get trouble
|
||||
@@ -7310,26 +7283,27 @@ class Cases
|
||||
}
|
||||
}
|
||||
|
||||
private function orderStartCasesByCategoryAndName ($rows) {
|
||||
private function orderStartCasesByCategoryAndName($rows)
|
||||
{
|
||||
//now we order in category, proces_name order:
|
||||
$comparatorSequence = array(
|
||||
function($a, $b) {
|
||||
function ($a, $b) {
|
||||
$retval = 0;
|
||||
if(array_key_exists('catname', $a) && array_key_exists('catname', $b)) {
|
||||
if (array_key_exists('catname', $a) && array_key_exists('catname', $b)) {
|
||||
$retval = strcmp($a['catname'], $b['catname']);
|
||||
}
|
||||
return $retval;
|
||||
}
|
||||
, function($a, $b) {
|
||||
$retval = 0;
|
||||
if(array_key_exists('value', $a) && array_key_exists('value', $b)) {
|
||||
$retval = strcmp($a['value'], $b['value']);
|
||||
}
|
||||
return $retval;
|
||||
, function ($a, $b) {
|
||||
$retval = 0;
|
||||
if (array_key_exists('value', $a) && array_key_exists('value', $b)) {
|
||||
$retval = strcmp($a['value'], $b['value']);
|
||||
}
|
||||
return $retval;
|
||||
}
|
||||
);
|
||||
|
||||
usort($rows, function($a, $b) use ($comparatorSequence) {
|
||||
usort($rows, function ($a, $b) use ($comparatorSequence) {
|
||||
foreach ($comparatorSequence as $cmpFn) {
|
||||
$diff = call_user_func($cmpFn, $a, $b);
|
||||
if ($diff !== 0) {
|
||||
@@ -1,57 +1,14 @@
|
||||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* class.configuration.php
|
||||
*
|
||||
* @package workflow.engine.ProcessMaker
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
//
|
||||
// It works with the table CONFIGURATION in a WF dataBase
|
||||
// Copyright (C) 2007 COLOSA
|
||||
// License: LGPL, see LICENSE
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/**
|
||||
* ProcessConfiguration - ProcessConfiguration class
|
||||
*
|
||||
* @author David S. Callizaya S.
|
||||
* @copyright 2007 COLOSA
|
||||
*/
|
||||
require_once 'classes/model/Configuration.php';
|
||||
|
||||
/**
|
||||
* ProcessConfiguration - ProcessConfiguration
|
||||
* Extends Configuration
|
||||
*
|
||||
*
|
||||
* @copyright 2007 COLOSA
|
||||
* @version Release: @package_version@
|
||||
* @package workflow.engine.ProcessMaker
|
||||
*/
|
||||
class Configurations // extends Configuration
|
||||
{
|
||||
|
||||
public $aConfig = array();
|
||||
private $Configuration = null;
|
||||
private $UserConfig = null;
|
||||
@@ -81,16 +38,16 @@ class Configurations // extends Configuration
|
||||
$this->arrayClone($object[$k], $cloneObject[$k]);
|
||||
}
|
||||
} else {
|
||||
if (is_object( $object )) {
|
||||
if (is_object($object)) {
|
||||
} else {
|
||||
$cloneObject = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function exists($cfgID,$objID='')
|
||||
public function exists($cfgID, $objID='')
|
||||
{
|
||||
return $this->Configuration->exists($cfgID,$objID,'','','');
|
||||
return $this->Configuration->exists($cfgID, $objID, '', '', '');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -169,7 +126,6 @@ class Configurations // extends Configuration
|
||||
try {
|
||||
$this->Fields = $this->Configuration->load($cfg, $obj, $pro, $usr, $app);
|
||||
} catch (Exception $e) {
|
||||
|
||||
} // the configuration does not exist
|
||||
|
||||
|
||||
@@ -178,7 +134,7 @@ class Configurations // extends Configuration
|
||||
}
|
||||
|
||||
if (!is_array($this->aConfig)) {
|
||||
$this->aConfig = Array();
|
||||
$this->aConfig = array();
|
||||
}
|
||||
|
||||
return $this->aConfig;
|
||||
@@ -325,8 +281,8 @@ class Configurations // extends Configuration
|
||||
$theFormat = $this->UserConfig['format'];
|
||||
$fname = $oUser->getUsrFirstname();
|
||||
$lname = $oUser->getUsrLastname();
|
||||
if (strpos($theFormat, ',') !== false && ( trim($fname) == '' || trim($lname) == '')) {
|
||||
$theFormat = str_replace(',', '', $theFormat);
|
||||
if (strpos($theFormat, ',') !== false && (trim($fname) == '' || trim($lname) == '')) {
|
||||
$theFormat = str_replace(',', '', $theFormat);
|
||||
}
|
||||
|
||||
$aux = str_replace('@userName', trim($username), $theFormat);
|
||||
@@ -537,15 +493,15 @@ class Configurations // extends Configuration
|
||||
|
||||
public function getUserNameFormats()
|
||||
{
|
||||
$formats[] = Array('id' => '@firstName @lastName', //the id , don't translate
|
||||
$formats[] = array('id' => '@firstName @lastName', //the id , don't translate
|
||||
'name' => G::loadTranslation('ID_USERNAME_FORMAT_1') //label displayed, can be translated
|
||||
);
|
||||
$formats[] = Array('id' => '@firstName @lastName (@userName)', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_2'));
|
||||
$formats[] = Array('id' => '@userName', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_3'));
|
||||
$formats[] = Array('id' => '@userName (@firstName @lastName)', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_4'));
|
||||
$formats[] = Array('id' => '@lastName @firstName', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_5'));
|
||||
$formats[] = Array('id' => '@lastName, @firstName', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_6'));
|
||||
$formats[] = Array('id' => '@lastName, @firstName (@userName)', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_7'));
|
||||
$formats[] = array('id' => '@firstName @lastName (@userName)', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_2'));
|
||||
$formats[] = array('id' => '@userName', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_3'));
|
||||
$formats[] = array('id' => '@userName (@firstName @lastName)', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_4'));
|
||||
$formats[] = array('id' => '@lastName @firstName', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_5'));
|
||||
$formats[] = array('id' => '@lastName, @firstName', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_6'));
|
||||
$formats[] = array('id' => '@lastName, @firstName (@userName)', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_7'));
|
||||
|
||||
return $formats;
|
||||
}
|
||||
@@ -560,9 +516,9 @@ class Configurations // extends Configuration
|
||||
$creationDateMask = ($creationDateMask == '') ? $dateFormat : $creationDateMask;
|
||||
if ($creationDateMask != '') {
|
||||
if (strpos($dateTime, ' ') !== false) {
|
||||
list ($date, $time) = explode(' ', $dateTime);
|
||||
list ($y, $m, $d) = explode('-', $date);
|
||||
list ($h, $i, $s) = explode(':', $time);
|
||||
list($date, $time) = explode(' ', $dateTime);
|
||||
list($y, $m, $d) = explode('-', $date);
|
||||
list($h, $i, $s) = explode(':', $time);
|
||||
$newCreation = '';
|
||||
$maskTime = array('d' => '%d', 'D' => '%A', 'j' => '%d', 'l' => '%A', 'G' => '%I', 'g' => '%i', 'N' => '%u', 'S' => '%d', 'w' => '%w', 'z' => '%j', 'W' => '%W', 'F' => '%B', 'm' => '%m', 'M' => '%B', 'n' => '%m', 'o' => '%Y', 'Y' => '%Y', 'y' => '%g', 'a' => '%p', 'A' => '%p', 'g' => '%I', 'G' => '%H', 'h' => '%I', 'H' => '%H', 'i' => '%M', 's' => '%S');
|
||||
$creationDateMask = trim($creationDateMask);
|
||||
@@ -589,9 +545,9 @@ class Configurations // extends Configuration
|
||||
if (G::toLower(PHP_OS) == 'linux' || G::toLower(PHP_OS) == 'darwin') {
|
||||
if (SYS_LANG == 'es') {
|
||||
$langLocate = 'es_ES';
|
||||
} else if (strlen(SYS_LANG) > 2) {
|
||||
} elseif (strlen(SYS_LANG) > 2) {
|
||||
$langLocate = str_replace('-', '_', SYS_LANG);
|
||||
} else if ($location != '') {
|
||||
} elseif ($location != '') {
|
||||
$langLocate = SYS_LANG.'_'.$location;
|
||||
} else {
|
||||
$langLocate = 'en_US';
|
||||
@@ -1006,4 +962,3 @@ class Configurations // extends Configuration
|
||||
return $ver;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
|
||||
class ConsolidatedCases
|
||||
{
|
||||
private $existTable;
|
||||
@@ -51,7 +52,7 @@ class ConsolidatedCases
|
||||
$oReportTables = new ReportTables();
|
||||
$oReportTables->deleteAllReportVars($_POST['form']['REP_TAB_UID']);
|
||||
|
||||
$pmDyna = new pmDynaform(array());
|
||||
$pmDyna = new PmDynaform(array());
|
||||
$pmDyna->fields["CURRENT_DYNAFORM"] = $DynUid;
|
||||
$dataDyna = $pmDyna->getDynaform();
|
||||
$json = G::json_decode($dataDyna["DYN_CONTENT"]);
|
||||
@@ -1,15 +1,10 @@
|
||||
<?php
|
||||
|
||||
|
||||
class Dashboards
|
||||
{
|
||||
public function getListDashboards ($start=0, $limit=20, $sort='', $dir='DESC', $search='')
|
||||
{
|
||||
require_once 'classes/model/Dashboard.php';
|
||||
require_once 'classes/model/DashboardIndicator.php';
|
||||
require_once 'classes/model/Users.php';
|
||||
require_once 'classes/model/Groupwf.php';
|
||||
require_once 'classes/model/DashboardDasInd.php';
|
||||
|
||||
|
||||
$limit_size = isset($limit) ? $limit: 20;
|
||||
$start = isset($_REQUEST['start']) ? $_REQUEST['start'] : 0;
|
||||
@@ -1,8 +1,7 @@
|
||||
<?php
|
||||
|
||||
require_once 'classes/interfaces/dashletInterface.php';
|
||||
|
||||
class dashletOpenVSCompleted implements DashletInterface
|
||||
class DashletOpenVsCompleted implements DashletInterface
|
||||
{
|
||||
|
||||
const version = '1.0';
|
||||
@@ -275,7 +274,7 @@ class dashletOpenVSCompleted implements DashletInterface
|
||||
|
||||
public function render ($width = 300)
|
||||
{
|
||||
$g = new pmGauge();
|
||||
$g = new PmGauge();
|
||||
$g->w = $width;
|
||||
$g->value = $this->value;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
require_once 'classes/interfaces/dashletInterface.php';
|
||||
|
||||
class dashletProcessMakerCommunity implements DashletInterface
|
||||
|
||||
class DashletProcessMakerCommunity implements DashletInterface
|
||||
{
|
||||
|
||||
const version = '1.0';
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
require_once 'classes/interfaces/dashletInterface.php';
|
||||
|
||||
class dashletProcessMakerEnterprise implements DashletInterface
|
||||
|
||||
class DashletProcessMakerEnterprise implements DashletInterface
|
||||
{
|
||||
|
||||
const version = '1.0';
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
require_once 'classes/interfaces/dashletInterface.php';
|
||||
use ProcessMaker\Core\System;
|
||||
|
||||
class dashletRssReader implements DashletInterface
|
||||
class DashletRssReader implements DashletInterface
|
||||
{
|
||||
|
||||
const version = '1.0';
|
||||
@@ -54,7 +54,7 @@ class dashletRssReader implements DashletInterface
|
||||
curl_setopt( $pCurl, CURLOPT_VERBOSE, false );
|
||||
|
||||
//Apply proxy settings
|
||||
$sysConf = PmSystem::getSystemConfiguration();
|
||||
$sysConf = System::getSystemConfiguration();
|
||||
if ($sysConf['proxy_host'] != '') {
|
||||
curl_setopt( $pCurl, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : '') );
|
||||
if ($sysConf['proxy_port'] != '') {
|
||||
@@ -1,44 +1,6 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* class.dates.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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
* /
|
||||
*
|
||||
* /*
|
||||
* Created on 21/01/2008
|
||||
* This class is used for handling dates
|
||||
*
|
||||
* @author David Callizaya <davidsantos@colosa.com>
|
||||
*/
|
||||
require_once ("classes/model/TaskPeer.php");
|
||||
require_once ("classes/model/HolidayPeer.php");
|
||||
|
||||
/**
|
||||
*
|
||||
* @package workflow.engine.classes
|
||||
*/
|
||||
class dates
|
||||
class Dates
|
||||
{
|
||||
|
||||
private $holidays = array();
|
||||
@@ -529,4 +491,3 @@ class dates
|
||||
return $iDate;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,26 +1,5 @@
|
||||
<?php
|
||||
/**
|
||||
* Author: Erik Amaru Ortiz <erik@colosa.com>
|
||||
* 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';
|
||||
|
||||
/**
|
||||
* dbConnections
|
||||
*
|
||||
*
|
||||
* @copyright 2008 Colosa
|
||||
* @package workflow.engine.classes
|
||||
*
|
||||
*/
|
||||
class DbConnections
|
||||
{
|
||||
private $PRO_UID;
|
||||
@@ -1,12 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* derivation - derivation class
|
||||
*
|
||||
* @package workflow.engine.ProcessMaker
|
||||
*
|
||||
*/
|
||||
|
||||
class Derivation
|
||||
{
|
||||
var $case;
|
||||
@@ -1701,7 +1694,6 @@ class Derivation
|
||||
|
||||
function getGrpUser ($aData)
|
||||
{
|
||||
require_once 'classes/model/Content.php';
|
||||
$oTasks = new Tasks();
|
||||
$oGroups = new Groups();
|
||||
$oContent = new Content();
|
||||
@@ -1,36 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* class.dynaFormField.php
|
||||
*
|
||||
* @package workflow.engine.classes
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Dynaform Field - DynaformField class
|
||||
*
|
||||
* @package workflow.engine.classes
|
||||
*/
|
||||
class DynaFormField extends DBTable
|
||||
{
|
||||
|
||||
293
workflow/engine/classes/DynaformEditor.php
Normal file
293
workflow/engine/classes/DynaformEditor.php
Normal file
@@ -0,0 +1,293 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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 __construct($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 = '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
|
||||
$sampleForm .= '<dynaForm type="' . $this->dyn_type . '" name="" width="500" enabletemplate="0" mode="edit">' . "\n";
|
||||
switch ($this->dyn_type) {
|
||||
case "xmlform":
|
||||
/* $sampleForm.='<title type="title" enablehtml="0">' . "\n" .
|
||||
' <en>Sample form</en>' . "\n" .
|
||||
'</title>'."\n";
|
||||
$sampleForm.='<submit type="submit" enablehtml="0" onclick="">' . "\n" .
|
||||
' <en>Submit</en>' . "\n" .
|
||||
'</submit>'."\n"; */
|
||||
break;
|
||||
case "grid":
|
||||
/* $sampleForm.='<fieldA type="text" >' . "\n" .
|
||||
'<en>A</en>' . "\n" .
|
||||
'</fieldA>'."\n";
|
||||
$sampleForm.='<fieldB type="text" >' . "\n" .
|
||||
'<en>B</en>' . "\n" .
|
||||
'</fieldB>'."\n"; */
|
||||
break;
|
||||
}
|
||||
$sampleForm .= '</dynaForm>';
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -1,338 +1,13 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* class.dynaformEditor.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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*/
|
||||
/**
|
||||
* Created on 21/12/2007
|
||||
* Dynaform - Dynaform class
|
||||
*
|
||||
* @copyright 2007 COLOSA
|
||||
* @author David Callizaya <davidsantos@colosa.com>
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @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 = '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
|
||||
$sampleForm .= '<dynaForm type="' . $this->dyn_type . '" name="" width="500" enabletemplate="0" mode="edit">' . "\n";
|
||||
switch ($this->dyn_type) {
|
||||
case "xmlform":
|
||||
/* $sampleForm.='<title type="title" enablehtml="0">' . "\n" .
|
||||
' <en>Sample form</en>' . "\n" .
|
||||
'</title>'."\n";
|
||||
$sampleForm.='<submit type="submit" enablehtml="0" onclick="">' . "\n" .
|
||||
' <en>Submit</en>' . "\n" .
|
||||
'</submit>'."\n"; */
|
||||
break;
|
||||
case "grid":
|
||||
/* $sampleForm.='<fieldA type="text" >' . "\n" .
|
||||
'<en>A</en>' . "\n" .
|
||||
'</fieldA>'."\n";
|
||||
$sampleForm.='<fieldB type="text" >' . "\n" .
|
||||
'<en>B</en>' . "\n" .
|
||||
'</fieldB>'."\n"; */
|
||||
break;
|
||||
}
|
||||
$sampleForm .= '</dynaForm>';
|
||||
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
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -341,7 +16,7 @@ class dynaformEditorAjax extends dynaformEditor implements iDynaformEditorAjax
|
||||
* @param var $post
|
||||
* @return void
|
||||
*/
|
||||
public function dynaformEditorAjax($post)
|
||||
public function __construct($post)
|
||||
{
|
||||
$this->_run($post);
|
||||
}
|
||||
@@ -442,7 +117,7 @@ class dynaformEditorAjax extends dynaformEditor implements iDynaformEditorAjax
|
||||
$form = new Form($fileTmp, PATH_DYNAFORM, SYS_LANG, true);
|
||||
|
||||
//Navigation Bar
|
||||
$form->fields = G::array_merges(array("__DYNAFORM_OPTIONS" => new XmlForm_Field_XmlMenu(new Xml_Node("__DYNAFORM_OPTIONS", "complete", "", array("type" => "xmlmenu", "xmlfile" => "gulliver/dynaforms_Options"
|
||||
$form->fields = G::array_merges(array("__DYNAFORM_OPTIONS" => new XmlFormFieldXmlMenu(new Xml_Node("__DYNAFORM_OPTIONS", "complete", "", array("type" => "xmlmenu", "xmlfile" => "gulliver/dynaforms_Options"
|
||||
)), SYS_LANG, PATH_XMLFORM, $form)
|
||||
), $form->fields);
|
||||
|
||||
@@ -512,7 +187,7 @@ class dynaformEditorAjax extends dynaformEditor implements iDynaformEditorAjax
|
||||
$form = new Form($fileTmp, PATH_DYNAFORM, SYS_LANG, true);
|
||||
|
||||
//Navigation Bar
|
||||
$form->fields = G::array_merges(array("__DYNAFORM_OPTIONS" => new XmlForm_Field_XmlMenu(new Xml_Node("__DYNAFORM_OPTIONS", "complete", "", array("type" => "xmlmenu", "xmlfile" => "gulliver/dynaforms_Options"
|
||||
$form->fields = G::array_merges(array("__DYNAFORM_OPTIONS" => new XmlFormFieldXmlMenu(new Xml_Node("__DYNAFORM_OPTIONS", "complete", "", array("type" => "xmlmenu", "xmlfile" => "gulliver/dynaforms_Options"
|
||||
)), SYS_LANG, PATH_XMLFORM, $form)
|
||||
), $form->fields);
|
||||
|
||||
@@ -890,7 +565,7 @@ class dynaformEditorAjax extends dynaformEditor implements iDynaformEditorAjax
|
||||
if (file_exists(PATH_DYNAFORM . $file . '.html')) {
|
||||
$copyHtml = implode('', file(PATH_DYNAFORM . $file . '.html'));
|
||||
}
|
||||
$file = dynaformEditor::_getFilename($file);
|
||||
$file = DynaformEditor::_getFilename($file);
|
||||
$fcopy = fopen(PATH_DYNAFORM . $file . '.xml', "w");
|
||||
fwrite($fcopy, $copy);
|
||||
fclose($fcopy);
|
||||
@@ -930,7 +605,7 @@ class dynaformEditorAjax extends dynaformEditor implements iDynaformEditorAjax
|
||||
//return(array('response'=>$tmp['useTmpCopy']));
|
||||
if (isset($tmp['useTmpCopy'])) {
|
||||
//return(array('response'=>PATH_DYNAFORM . $file . '.xml'));
|
||||
if ($file !== dynaformEditor::_getFilename($file)) {
|
||||
if ($file !== DynaformEditor::_getFilename($file)) {
|
||||
// return(array('response'=>PATH_DYNAFORM . $file . '.xml'));
|
||||
if (file_exists($xmlFile)) {
|
||||
unlink($xmlFile);
|
||||
@@ -988,7 +663,7 @@ class dynaformEditorAjax extends dynaformEditor implements iDynaformEditorAjax
|
||||
($sp['ENABLETEMPLATE']!=$P['ENABLETEMPLATE']) ||
|
||||
($sp['MODE']!=$P['MODE']) */
|
||||
/* Compare copies */
|
||||
$fileOrigen = dynaformEditor::_getFilename($file);
|
||||
$fileOrigen = DynaformEditor::_getFilename($file);
|
||||
$copy = implode('', file(PATH_DYNAFORM . $file . '.xml'));
|
||||
$origen = implode('', file(PATH_DYNAFORM . $fileOrigen . '.xml'));
|
||||
$copyHTML = file_exists(PATH_DYNAFORM . $file . '.html') ? implode('', file(PATH_DYNAFORM . $file . '.html')) : false;
|
||||
@@ -1,15 +1,6 @@
|
||||
<?php
|
||||
require_once ("classes" . PATH_SEP . "class.enterpriseUtils.php");
|
||||
|
||||
if (!defined("PM_VERSION")) {
|
||||
if (file_exists(PATH_METHODS . "login/version-pmos.php")) {
|
||||
include (PATH_METHODS . "login/version-pmos.php");
|
||||
} else {
|
||||
define("PM_VERSION", "2.0.0");
|
||||
}
|
||||
}
|
||||
|
||||
class enterpriseClass extends PMPlugin
|
||||
class EnterpriseClass extends PMPlugin
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
@@ -108,7 +99,7 @@ class enterpriseClass extends PMPlugin
|
||||
|
||||
public function enterpriseLimitCreateUser()
|
||||
{
|
||||
$oServerConf = &serverConf::getSingleton();
|
||||
$oServerConf = &ServerConf::getSingleton();
|
||||
$infoLicense =$oServerConf->getProperty('LICENSE_INFO');
|
||||
if (isset($infoLicense[SYS_SYS]['LIMIT_USERS'])) {
|
||||
$criteria = new Criteria('workflow');
|
||||
@@ -156,8 +147,3 @@ class enterpriseClass extends PMPlugin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!class_exists("pmLicenseManager")) {
|
||||
require_once ("classes" . PATH_SEP . "class.pmLicenseManager.php");
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
require_once ("classes/model/Configuration.php");
|
||||
|
||||
use ProcessMaker\Core\System;
|
||||
|
||||
class EnterpriseUtils
|
||||
{
|
||||
@@ -40,7 +41,7 @@ class EnterpriseUtils
|
||||
curl_setopt($ch, CURLOPT_VERBOSE, true);
|
||||
|
||||
//Apply proxy settings
|
||||
$sysConf = PmSystem::getSystemConfiguration();
|
||||
$sysConf = System::getSystemConfiguration();
|
||||
if (isset($sysConf['proxy_host'])) {
|
||||
if ($sysConf['proxy_host'] != '') {
|
||||
curl_setopt($ch, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : ''));
|
||||
@@ -149,4 +150,3 @@ class EnterpriseUtils
|
||||
return $sw;
|
||||
}
|
||||
}
|
||||
|
||||
23
workflow/engine/classes/FeaturesDetail.php
Normal file
23
workflow/engine/classes/FeaturesDetail.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
class FeaturesDetail
|
||||
{
|
||||
public $featureName;
|
||||
public $description = null;
|
||||
public $enabled = false;
|
||||
public $workspaces = null;
|
||||
|
||||
/**
|
||||
* This function is the constructor of the featuresDetail class
|
||||
*
|
||||
* @param string $featureName
|
||||
* @param string $name
|
||||
* @param string $description
|
||||
* @return void
|
||||
*/
|
||||
public function __construct ($featureName, $description = '')
|
||||
{
|
||||
$this->featureName = $featureName;
|
||||
$this->description = $description;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
class FieldValidator
|
||||
{
|
||||
/**
|
||||
@@ -240,4 +241,3 @@ class FieldValidator
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
class FileCache
|
||||
{
|
||||
function __construct ($dir)
|
||||
@@ -122,4 +123,3 @@ class FileCache
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
class FormBatchRouting extends Form
|
||||
{
|
||||
public function getVars($bWhitSystemVars = true)
|
||||
@@ -18,4 +19,3 @@ class FormBatchRouting extends Form
|
||||
return $aFields;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,34 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* class.groups.php
|
||||
*
|
||||
* @package workflow.engine.ProcessMaker
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
require_once 'classes/model/Groupwf.php';
|
||||
require_once 'classes/model/GroupUser.php';
|
||||
require_once 'classes/model/Users.php';
|
||||
|
||||
* Groups - Groups
|
||||
/**
|
||||
* Groups - Groups class
|
||||
*
|
||||
@@ -463,4 +436,3 @@ class Groups
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* class.BasePeer.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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
|
||||
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.
|
||||
*
|
||||
@@ -702,20 +674,3 @@ abstract class GulliverBasePeer
|
||||
}
|
||||
|
||||
} // 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' );
|
||||
}
|
||||
74
workflow/engine/classes/Gzip_File.php
Normal file
74
workflow/engine/classes/Gzip_File.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/*--------------------------------------------------
|
||||
* TAR/GZIP/BZIP2/ZIP ARCHIVE CLASSES 2.1
|
||||
* By Devin Doucette
|
||||
* Copyright (c) 2005 Devin Doucette
|
||||
* Email: darksnoopy@shaw.ca
|
||||
*--------------------------------------------------
|
||||
* Email bugs/suggestions to darksnoopy@shaw.ca
|
||||
*--------------------------------------------------
|
||||
* This script has been created and released under
|
||||
* the GNU GPL and is free to use and redistribute
|
||||
* only if this copyright statement is not removed
|
||||
*--------------------------------------------------*/
|
||||
|
||||
|
||||
/**
|
||||
* This class is derived of the class archive, is employed to use archives .
|
||||
* gzip
|
||||
* @package workflow.engine.classes
|
||||
*/
|
||||
class GzipFile extends TarFile
|
||||
{
|
||||
|
||||
/**
|
||||
* 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");
|
||||
}
|
||||
}
|
||||
6
workflow/engine/classes/IDynaformEditorAjax.php
Normal file
6
workflow/engine/classes/IDynaformEditorAjax.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
interface IDynaformEditorAjax
|
||||
{
|
||||
|
||||
}
|
||||
@@ -651,7 +651,7 @@ class IndicatorsCalculator
|
||||
|
||||
private function pdoConnection() {
|
||||
$currentWS = defined('SYS_SYS') ? SYS_SYS : 'Wokspace Undefined';
|
||||
$workSpace = new workspaceTools($currentWS);
|
||||
$workSpace = new WorkspaceTools($currentWS);
|
||||
$arrayHost = explode(':', $workSpace->dbHost);
|
||||
$host = "host=".$arrayHost[0];
|
||||
$port = count($arrayHost) > 1 ? ";port=".$arrayHost[1] : "";
|
||||
|
||||
68
workflow/engine/classes/InvalidIndexSearchTextException.php
Normal file
68
workflow/engine/classes/InvalidIndexSearchTextException.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2012 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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";
|
||||
}
|
||||
}
|
||||
@@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
|
||||
class labelsGmail
|
||||
{
|
||||
function listLabels($service)
|
||||
@@ -97,9 +98,9 @@ class labelsGmail
|
||||
//The Subject to search the email
|
||||
$subject = "[PM] " . $proName . " (" . $index . ") Case: " . $appNumber;
|
||||
|
||||
$pmGoogle = new PMGoogleApi();
|
||||
$pmGoogle = new PmGoogleApi();
|
||||
$pmGoogle->setUser($mail);
|
||||
$pmGoogle->setScope(PMGoogleApi::GMAIL_MODIFY);
|
||||
$pmGoogle->setScope(PmGoogleApi::GMAIL_MODIFY);
|
||||
$client = $pmGoogle->serviceClient();
|
||||
$service = new Google_Service_Gmail($client);
|
||||
$labelsIds = $this->getLabelsIds($service);
|
||||
@@ -147,9 +148,9 @@ class labelsGmail
|
||||
//The Subject to search the email
|
||||
$subject = "[PM] " . $proName . " (" . $index . ") Case: " . $appNumber;
|
||||
|
||||
$pmGoogle = new PMGoogleApi();
|
||||
$pmGoogle = new PmGoogleApi();
|
||||
$pmGoogle->setUser($mail);
|
||||
$pmGoogle->setScope(PMGoogleApi::GMAIL_MODIFY);
|
||||
$pmGoogle->setScope(PmGoogleApi::GMAIL_MODIFY);
|
||||
$client = $pmGoogle->serviceClient();
|
||||
$service = new Google_Service_Gmail($client);
|
||||
$labelsIds = $this->getLabelsIds($service);
|
||||
@@ -201,11 +202,11 @@ class labelsGmail
|
||||
//The Subject to search the email
|
||||
$subject = "[PM] " . $proName . " (" . $index . ") Case: " . $appNumber;
|
||||
|
||||
$pmGoogle = new PMGoogleApi();
|
||||
$pmGoogle = new PmGoogleApi();
|
||||
|
||||
$pmGoogle->setUser($mail);
|
||||
|
||||
$pmGoogle->setScope(PMGoogleApi::GMAIL_MODIFY);
|
||||
$pmGoogle->setScope(PmGoogleApi::GMAIL_MODIFY);
|
||||
$client = $pmGoogle->serviceClient();
|
||||
|
||||
$service = new Google_Service_Gmail($client);
|
||||
@@ -280,9 +281,9 @@ class labelsGmail
|
||||
|
||||
//The Subject to search the email
|
||||
$subject = "[PM] " . $proName . " (" . $index . ") Case: " . $appNumber;
|
||||
$pmGoogle = new PMGoogleApi();
|
||||
$pmGoogle = new PmGoogleApi();
|
||||
$pmGoogle->setUser($mail);
|
||||
$pmGoogle->setScope(PMGoogleApi::GMAIL_MODIFY);
|
||||
$pmGoogle->setScope(PmGoogleApi::GMAIL_MODIFY);
|
||||
$client = $pmGoogle->serviceClient();
|
||||
$service = new Google_Service_Gmail($client);
|
||||
$labelsIds = $this->getLabelsIds($service);
|
||||
@@ -328,11 +329,11 @@ class labelsGmail
|
||||
*/
|
||||
public function deletePMGmailLabels($mail)
|
||||
{
|
||||
$pmGoogle = new PMGoogleApi();
|
||||
$pmGoogle = new PmGoogleApi();
|
||||
|
||||
$pmGoogle->setUser($mail);
|
||||
|
||||
$pmGoogle->setScope(PMGoogleApi::GMAIL_MODIFY);
|
||||
$pmGoogle->setScope(PmGoogleApi::GMAIL_MODIFY);
|
||||
$client = $pmGoogle->serviceClient();
|
||||
|
||||
$service = new Google_Service_Gmail($client);
|
||||
@@ -1,39 +1,10 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* class.ldapAdvanced.php
|
||||
* LDAP plugin for the RBAC class. This class encapsulates all the methods required in order to bind
|
||||
* ProcessMaker and a Ldap Directory server.
|
||||
*
|
||||
* @author
|
||||
* Fernando Ontiveros
|
||||
* Colosa
|
||||
* @copyright
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.
|
||||
* @package plugins.ldapAdvanced.classes
|
||||
* LDAP plugin for the RBAC class. This
|
||||
*/
|
||||
|
||||
// evaluating the requiring of some classes
|
||||
if (!class_exists("Department")) {
|
||||
require_once "classes/model/Department.php";
|
||||
}
|
||||
|
||||
if (!class_exists("Groupwf")) {
|
||||
require_once "classes/model/Groupwf.php";
|
||||
}
|
||||
|
||||
if (!class_exists("GroupUser")) {
|
||||
require_once "classes/model/GroupUser.php";
|
||||
}
|
||||
|
||||
if (!class_exists("RbacUsers")) {
|
||||
require_once PATH_RBAC."model/RbacUsers.php";
|
||||
}
|
||||
|
||||
if (!class_exists("RBAC")) {
|
||||
require_once PATH_TRUNK . "gulliver/system/class.rbac.php";
|
||||
}
|
||||
|
||||
class ldapAdvanced
|
||||
class LdapAdvanced
|
||||
{
|
||||
/**
|
||||
* The authsource id
|
||||
@@ -69,7 +40,7 @@ class ldapAdvanced
|
||||
* Object where an rbac instance is set
|
||||
* @var Object
|
||||
*/
|
||||
static private $instance = null;
|
||||
private static $instance = null;
|
||||
|
||||
private $arrayObjectClassFilter = array(
|
||||
"user" => "|(objectclass=inetorgperson)(objectclass=organizationalperson)(objectclass=person)(objectclass=user)",
|
||||
@@ -488,14 +459,14 @@ class ldapAdvanced
|
||||
$logFile = PATH_DATA . "log/ldapAdvanced.log";
|
||||
|
||||
if (!file_exists($logFile) || is_writable($logFile)) {
|
||||
$fpt= fopen ($logFile, "a");
|
||||
$fpt= fopen($logFile, "a");
|
||||
$ldapErrorMsg = "";
|
||||
$ldapErrorNr = 0;
|
||||
|
||||
if ($link != null) {
|
||||
$ldapErrorNr = ldap_errno($link);
|
||||
|
||||
if ( $ldapErrorNr != 0 ) {
|
||||
if ($ldapErrorNr != 0) {
|
||||
$ldapErrorMsg = ldap_error($link);
|
||||
$text = $ldapErrorMsg . " : " . $text;
|
||||
}
|
||||
@@ -505,7 +476,7 @@ class ldapAdvanced
|
||||
fwrite($fpt, sprintf("%s %s %s %s %s \n", date("Y-m-d H:i:s"), getenv("REMOTE_ADDR"), SYS_SYS, $ldapErrorNr, $text));
|
||||
fclose($fpt);
|
||||
} else {
|
||||
error_log ("file $logFile is not writable ");
|
||||
error_log("file $logFile is not writable ");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -536,11 +507,11 @@ class ldapAdvanced
|
||||
*/
|
||||
public function ldapConnection($aAuthSource)
|
||||
{
|
||||
$pass = explode("_",$aAuthSource["AUTH_SOURCE_PASSWORD"]);
|
||||
$pass = explode("_", $aAuthSource["AUTH_SOURCE_PASSWORD"]);
|
||||
|
||||
foreach ($pass as $index => $value) {
|
||||
if ($value == "2NnV3ujj3w") {
|
||||
$aAuthSource["AUTH_SOURCE_PASSWORD"] = G::decrypt($pass[0],$aAuthSource["AUTH_SOURCE_SERVER_NAME"]);
|
||||
$aAuthSource["AUTH_SOURCE_PASSWORD"] = G::decrypt($pass[0], $aAuthSource["AUTH_SOURCE_SERVER_NAME"]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1076,11 +1047,11 @@ class ldapAdvanced
|
||||
$strUser = trim($strUser);
|
||||
}
|
||||
|
||||
if ( $strUser == "" ) {
|
||||
if ($strUser == "") {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ( strlen( $strPass ) == 0) {
|
||||
if (strlen($strPass) == 0) {
|
||||
return -2;
|
||||
}
|
||||
|
||||
@@ -1171,7 +1142,7 @@ class ldapAdvanced
|
||||
|
||||
$ldapcnn = $this->ldapConnection($arrayAuthSource);
|
||||
$flagUpdate = false;
|
||||
switch(ldap_errno($ldapcnn)) {
|
||||
switch (ldap_errno($ldapcnn)) {
|
||||
case '0x00':
|
||||
$flagUpdate = true;
|
||||
$statusRbac = 1;
|
||||
@@ -1226,7 +1197,7 @@ class ldapAdvanced
|
||||
$validUserPass = -5;
|
||||
}
|
||||
|
||||
if ( $validUserPass == 1 ) {
|
||||
if ($validUserPass == 1) {
|
||||
$this->log($ldapcnn, "sucessful login user " . $verifiedUser["sDN"]);
|
||||
} else {
|
||||
$this->log($ldapcnn, "failure authentication for user $strUser");
|
||||
@@ -1326,7 +1297,7 @@ class ldapAdvanced
|
||||
$entries = ldap_count_entries($ldapcnn, $oSearch);
|
||||
$totalUser = $entries;
|
||||
|
||||
if ( $entries > 0) {
|
||||
if ($entries > 0) {
|
||||
$oEntry = ldap_first_entry($ldapcnn, $oSearch);
|
||||
|
||||
$countEntries=0;
|
||||
@@ -1577,11 +1548,11 @@ class ldapAdvanced
|
||||
$res = 0;
|
||||
|
||||
if (!empty($user)) {
|
||||
if ($this->VerifyLogin( $user['sUsername'], $strPass) === true) {
|
||||
if ($this->VerifyLogin($user['sUsername'], $strPass) === true) {
|
||||
$res = 1;
|
||||
}
|
||||
|
||||
if ($res == 0 && $this->VerifyLogin( $user['sDN'], $strPass) === true) {
|
||||
if ($res == 0 && $this->VerifyLogin($user['sDN'], $strPass) === true) {
|
||||
$res = 1;
|
||||
}
|
||||
} else {
|
||||
@@ -1614,8 +1585,8 @@ class ldapAdvanced
|
||||
|
||||
if (!empty($aAttributes)) {
|
||||
foreach ($aAttributes as $value) {
|
||||
if (isset( $user[$value['attributeUser']] )) {
|
||||
$aData[$value['attributeUser']] = str_replace( "*", "'", $user[$value['attributeUser']] );
|
||||
if (isset($user[$value['attributeUser']])) {
|
||||
$aData[$value['attributeUser']] = str_replace("*", "'", $user[$value['attributeUser']]);
|
||||
if ($value['attributeUser'] == 'USR_STATUS') {
|
||||
$evalValue = $aData[$value['attributeUser']];
|
||||
$statusValue = (isset($user['USR_STATUS'])) ? $user['USR_STATUS'] :'ACTIVE';
|
||||
@@ -1626,7 +1597,7 @@ class ldapAdvanced
|
||||
}
|
||||
|
||||
//req - accountexpires
|
||||
if (isset($user["USR_DUE_DATE"]) && $user["USR_DUE_DATE"]!='' ) {
|
||||
if (isset($user["USR_DUE_DATE"]) && $user["USR_DUE_DATE"]!='') {
|
||||
$aData["USR_DUE_DATE"] = $this->convertDateADtoPM($user["USR_DUE_DATE"]);
|
||||
}
|
||||
//end
|
||||
@@ -1799,12 +1770,12 @@ class ldapAdvanced
|
||||
* @param <type> $currentDN
|
||||
* @return <type>
|
||||
*/
|
||||
public function getDepUidIfExistsDN ($currentDN)
|
||||
public function getDepUidIfExistsDN($currentDN)
|
||||
{
|
||||
try {
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->add(DepartmentPeer::DEP_STATUS , 'ACTIVE' );
|
||||
$oCriteria->add(DepartmentPeer::DEP_LDAP_DN, $currentDN );
|
||||
$oCriteria->add(DepartmentPeer::DEP_STATUS, 'ACTIVE');
|
||||
$oCriteria->add(DepartmentPeer::DEP_LDAP_DN, $currentDN);
|
||||
|
||||
$oDataset = DepartmentPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
@@ -1919,7 +1890,7 @@ class ldapAdvanced
|
||||
BasePeer::doUpdate($c1, $c2, $con);
|
||||
}
|
||||
|
||||
public function deactivateUser ($userUid)
|
||||
public function deactivateUser($userUid)
|
||||
{
|
||||
if (!class_exists('RbacUsers')) {
|
||||
require_once(PATH_RBAC.'model/RbacUsers.php');
|
||||
@@ -2076,7 +2047,7 @@ class ldapAdvanced
|
||||
|
||||
$criteriaCount = new Criteria('workflow');
|
||||
$criteriaCount->clearSelectColumns();
|
||||
$criteriaCount->addSelectColumn( 'COUNT(*)' );
|
||||
$criteriaCount->addSelectColumn('COUNT(*)');
|
||||
$criteriaCount->add(DepartmentPeer::DEP_PARENT, $oDepartment->getDepUid(), Criteria::EQUAL);
|
||||
$rs = DepartmentPeer::doSelectRS($criteriaCount);
|
||||
$rs->next();
|
||||
@@ -2085,7 +2056,7 @@ class ldapAdvanced
|
||||
$result[] = $node;
|
||||
}
|
||||
|
||||
if ( count($result) >= 1 ) {
|
||||
if (count($result) >= 1) {
|
||||
$result[ count($result) -1 ]['DEP_LAST'] = 1;
|
||||
}
|
||||
|
||||
@@ -2139,11 +2110,11 @@ class ldapAdvanced
|
||||
$attributes = $aAuthSource["AUTH_SOURCE_DATA"];
|
||||
$this->sTerminatedOu = isset($attributes['AUTH_SOURCE_RETIRED_OU'])? trim($attributes['AUTH_SOURCE_RETIRED_OU']) : '';
|
||||
|
||||
if ($this->sTerminatedOu == '' ) {
|
||||
if ($this->sTerminatedOu == '') {
|
||||
return $aUsers;
|
||||
}
|
||||
|
||||
return $this->getUsersFromDepartmentByName( $this->sTerminatedOu );
|
||||
return $this->getUsersFromDepartmentByName($this->sTerminatedOu);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2173,8 +2144,8 @@ class ldapAdvanced
|
||||
$con = Propel::getConnection('rbac');
|
||||
// select set
|
||||
$c1 = new Criteria('rbac');
|
||||
$c1->add(RbacUsersPeer::USR_USERNAME, $aUsrUid, Criteria::IN );
|
||||
$c1->add(RbacUsersPeer::USR_STATUS, 1 );
|
||||
$c1->add(RbacUsersPeer::USR_USERNAME, $aUsrUid, Criteria::IN);
|
||||
$c1->add(RbacUsersPeer::USR_STATUS, 1);
|
||||
// update set
|
||||
$c2 = new Criteria('rbac');
|
||||
$c2->add(RbacUsersPeer::USR_STATUS, '0');
|
||||
@@ -2183,7 +2154,7 @@ class ldapAdvanced
|
||||
$con = Propel::getConnection('workflow');
|
||||
// select set
|
||||
$c1 = new Criteria('workflow');
|
||||
$c1->add(UsersPeer::USR_USERNAME, $aUsrUid, Criteria::IN );
|
||||
$c1->add(UsersPeer::USR_USERNAME, $aUsrUid, Criteria::IN);
|
||||
// update set
|
||||
$c2 = new Criteria('workflow');
|
||||
$c2->add(UsersPeer::USR_STATUS, 'INACTIVE');
|
||||
@@ -2391,7 +2362,7 @@ class ldapAdvanced
|
||||
{
|
||||
try {
|
||||
$criteria = new Criteria('workflow');
|
||||
$criteria->add(GroupwfPeer::GRP_STATUS , 'ACTIVE');
|
||||
$criteria->add(GroupwfPeer::GRP_STATUS, 'ACTIVE');
|
||||
$criteria->add(GroupwfPeer::GRP_LDAP_DN, $currentDN);
|
||||
$dataset = GroupwfPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
@@ -1,31 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Project: Distrubution License Class
|
||||
* File: class.license.app.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 <publicmail at buggedcom dot co dot uk>
|
||||
* @history---------------------------------------------
|
||||
* see CHANGELOG
|
||||
*/
|
||||
class license_application extends padl
|
||||
|
||||
class license_application extends Padl
|
||||
{
|
||||
/**
|
||||
* The number of allowed differences between the $_SERVER vars and the vars
|
||||
@@ -513,4 +488,3 @@ class license_application extends padl
|
||||
return (empty($data['RESULT'])) ? 'SOCKET_FAILED' : $data['RESULT'];
|
||||
}
|
||||
}
|
||||
|
||||
229
workflow/engine/classes/MultipleFilesBackup.php
Normal file
229
workflow/engine/classes/MultipleFilesBackup.php
Normal file
@@ -0,0 +1,229 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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";
|
||||
private $fileSize = "1000";
|
||||
// 1 GB by default.
|
||||
private $sizeDescriptor = "m";
|
||||
//megabytes
|
||||
private $tempDirectories = array();
|
||||
|
||||
/* Constructor
|
||||
* @filename contains the path and filename of the comppress file(s).
|
||||
* @size got the Max size of the compressed files, by default if the $size less to zero will mantains 1000 Mb as Max size.
|
||||
*/
|
||||
public function MultipleFilesBackup($filename, $size)
|
||||
{
|
||||
if (!empty($filename)) {
|
||||
$this->filename = $filename;
|
||||
}
|
||||
if (!empty($size) && (int) $size > 0) {
|
||||
$this->fileSize = $size;
|
||||
}
|
||||
}
|
||||
|
||||
/* Gets workspace information enough to make its backup.
|
||||
* @workspace contains the workspace to be add to the commpression process.
|
||||
*/
|
||||
public function addToBackup($workspace)
|
||||
{
|
||||
//verifing if workspace exists.
|
||||
if (!$workspace->workspaceExists()) {
|
||||
echo "Workspace {$workspace->name} not found\n";
|
||||
return false;
|
||||
}
|
||||
//create destination path
|
||||
if (!file_exists(PATH_DATA . "upgrade/")) {
|
||||
mkdir(PATH_DATA . "upgrade/");
|
||||
}
|
||||
$tempDirectory = PATH_DATA . "upgrade/" . basename(tempnam(__FILE__, ''));
|
||||
mkdir($tempDirectory);
|
||||
$metadata = $workspace->getMetadata();
|
||||
CLI::logging("Creating temporary files on database...\n");
|
||||
$metadata["databases"] = $workspace->exportDatabase($tempDirectory);
|
||||
$metadata["directories"] = array("{$workspace->name}");
|
||||
$metadata["version"] = 1;
|
||||
$metaFilename = "$tempDirectory/{$workspace->name}.meta";
|
||||
if (!file_put_contents($metaFilename, str_replace(array(",", "{", "}"), array(",\n ", "{\n ", "\n}\n"), G::json_encode($metadata)))) {
|
||||
CLI::logging("Could not create backup metadata");
|
||||
}
|
||||
CLI::logging("Adding database to backup...\n");
|
||||
$this->addDirToBackup($tempDirectory);
|
||||
CLI::logging("Adding files to backup...\n");
|
||||
$this->addDirToBackup($workspace->path);
|
||||
$this->tempDirectories[] = $tempDirectory;
|
||||
}
|
||||
|
||||
/* Add a directory containing Db files or info files to be commpressed
|
||||
* @directory the name and path of the directory to be add to the commpression process.
|
||||
*/
|
||||
private function addDirToBackup($directory)
|
||||
{
|
||||
if (!empty($directory)) {
|
||||
$this->dir_to_compress .= $directory . " ";
|
||||
}
|
||||
}
|
||||
|
||||
// Commpress the DB and files into a single or several files with numerical series extentions
|
||||
|
||||
public function letsBackup()
|
||||
{
|
||||
// creating command
|
||||
$CommpressCommand = "tar czv ";
|
||||
$CommpressCommand .= $this->dir_to_compress;
|
||||
$CommpressCommand .= "| split -b ";
|
||||
$CommpressCommand .= $this->fileSize;
|
||||
$CommpressCommand .= "m -d - ";
|
||||
$CommpressCommand .= $this->filename . ".";
|
||||
//executing command to create the files
|
||||
echo exec($CommpressCommand);
|
||||
//Remove leftovers dirs.
|
||||
foreach ($this->tempDirectories as $tempDirectory) {
|
||||
CLI::logging("Deleting: " . $tempDirectory . "\n");
|
||||
G::rm_dir($tempDirectory);
|
||||
}
|
||||
}
|
||||
/* Restore from file(s) commpressed by letsBackup function, into a temporary directory
|
||||
* @ filename got the name and path of the compressed file(s), if there are many files with file extention as a numerical series, the extention should be discriminated.
|
||||
* @ srcWorkspace contains the workspace to be restored.
|
||||
* @ dstWorkspace contains the workspace to be overwriting.
|
||||
* @ overwrite got the option true if the workspace will be overwrite.
|
||||
*/
|
||||
public static function letsRestore($filename, $srcWorkspace, $dstWorkspace = null, $overwrite = true)
|
||||
{
|
||||
// Needed info:
|
||||
// TEMPDIR /shared/workflow_data/upgrade/
|
||||
// BACKUPS /shared/workflow_data/backups/
|
||||
// Creating command cat myfiles_split.tgz_* | tar xz
|
||||
$DecommpressCommand = "cat " . $filename . ".* ";
|
||||
$DecommpressCommand .= " | tar xzv";
|
||||
|
||||
$tempDirectory = PATH_DATA . "upgrade/" . basename(tempnam(__FILE__, ''));
|
||||
$tempDirectoryHelp = $tempDirectory;
|
||||
|
||||
$parentDirectory = PATH_DATA . "upgrade";
|
||||
if (is_writable($parentDirectory)) {
|
||||
mkdir($tempDirectory);
|
||||
} else {
|
||||
throw new Exception("Could not create directory:" . $parentDirectory);
|
||||
}
|
||||
//Extract all backup files, including database scripts and workspace files
|
||||
CLI::logging("Restoring into " . $tempDirectory . "\n");
|
||||
chdir($tempDirectory);
|
||||
echo exec($DecommpressCommand);
|
||||
CLI::logging("\nUncompressed into: " . $tempDirectory . "\n");
|
||||
|
||||
//Search for metafiles in the new standard (the old standard would contain meta files.
|
||||
$decommpressedfile = scandir($tempDirectoryHelp . dirname($tempDirectoryHelp), 1);
|
||||
$tempDirectory = $tempDirectoryHelp . dirname($tempDirectoryHelp) . "/" . $decommpressedfile[0];
|
||||
|
||||
$metaFiles = glob($tempDirectory . "/*.meta");
|
||||
if (empty($metaFiles)) {
|
||||
$metaFiles = glob($tempDirectory . "/*.txt");
|
||||
if (!empty($metaFiles)) {
|
||||
return WorkspaceTools::restoreLegacy($tempDirectory);
|
||||
} else {
|
||||
throw new Exception("No metadata found in backup");
|
||||
}
|
||||
} else {
|
||||
CLI::logging("Found " . count($metaFiles) . " workspaces in backup:\n");
|
||||
foreach ($metaFiles as $metafile) {
|
||||
CLI::logging("-> " . basename($metafile) . "\n");
|
||||
}
|
||||
}
|
||||
if (count($metaFiles) > 1 && (!isset($srcWorkspace))) {
|
||||
throw new Exception("Multiple workspaces in backup but no workspace specified to restore");
|
||||
}
|
||||
if (isset($srcWorkspace) && !in_array("$srcWorkspace.meta", array_map(basename, $metaFiles))) {
|
||||
throw new Exception("Workspace $srcWorkspace not found in backup");
|
||||
}
|
||||
foreach ($metaFiles as $metaFile) {
|
||||
$metadata = G::json_decode(file_get_contents($metaFile));
|
||||
if ($metadata->version != 1) {
|
||||
throw new Exception("Backup version {$metadata->version} not supported");
|
||||
}
|
||||
$backupWorkspace = $metadata->WORKSPACE_NAME;
|
||||
if (isset($dstWorkspace)) {
|
||||
$workspaceName = $dstWorkspace;
|
||||
$createWorkspace = true;
|
||||
} else {
|
||||
$workspaceName = $metadata->WORKSPACE_NAME;
|
||||
$createWorkspace = false;
|
||||
}
|
||||
if (isset($srcWorkspace) && strcmp($metadata->WORKSPACE_NAME, $srcWorkspace) != 0) {
|
||||
CLI::logging(CLI::warning("> Workspace $backupWorkspace found, but not restoring.") . "\n");
|
||||
continue;
|
||||
} else {
|
||||
CLI::logging("> Restoring " . CLI::info($backupWorkspace) . " to " . CLI::info($workspaceName) . "\n");
|
||||
}
|
||||
$workspace = new WorkspaceTools($workspaceName);
|
||||
if ($workspace->workspaceExists()) {
|
||||
if ($overwrite) {
|
||||
CLI::logging(CLI::warning("> Workspace $workspaceName already exist, overwriting!") . "\n");
|
||||
} else {
|
||||
throw new Exception("Destination workspace already exist (use -o to overwrite)");
|
||||
}
|
||||
}
|
||||
if (file_exists($workspace->path)) {
|
||||
G::rm_dir($workspace->path);
|
||||
}
|
||||
|
||||
$tempDirectorySite = $tempDirectoryHelp . dirname($workspace->path);
|
||||
|
||||
foreach ($metadata->directories as $dir) {
|
||||
CLI::logging("+> Restoring directory '$dir'\n");
|
||||
if (!rename("$tempDirectorySite/$dir", $workspace->path)) {
|
||||
throw new Exception("There was an error copying the backup files ($tempDirectory/$dir) to the workspace directory {$workspace->path}.");
|
||||
}
|
||||
}
|
||||
|
||||
CLI::logging("> Changing file permissions\n");
|
||||
$shared_stat = stat(PATH_DATA);
|
||||
if ($shared_stat !== false) {
|
||||
WorkspaceTools::dirPerms($workspace->path, $shared_stat['uid'], $shared_stat['gid'], $shared_stat['mode']);
|
||||
} else {
|
||||
CLI::logging(CLI::error("Could not get the shared folder permissions, not changing workspace permissions") . "\n");
|
||||
}
|
||||
|
||||
list($dbHost, $dbUser, $dbPass) = @explode(SYSTEM_HASH, G::decrypt(HASH_INSTALLATION, SYSTEM_HASH));
|
||||
|
||||
CLI::logging("> Connecting to system database in '$dbHost'\n");
|
||||
$link = mysql_connect($dbHost, $dbUser, $dbPass);
|
||||
@mysql_query("SET NAMES 'utf8';");
|
||||
@mysql_query("SET FOREIGN_KEY_CHECKS=0;");
|
||||
if (!$link) {
|
||||
throw new Exception('Could not connect to system database: ' . mysql_error());
|
||||
}
|
||||
|
||||
if (strpos($metadata->DB_RBAC_NAME, 'rb_') === false) {
|
||||
$onedb = true;
|
||||
} else {
|
||||
$onedb = false;
|
||||
}
|
||||
|
||||
$newDBNames = $workspace->resetDBInfo($dbHost, $createWorkspace, $onedb);
|
||||
$aParameters = array('dbHost' => $dbHost, 'dbUser' => $dbUser, 'dbPass' => $dbPass);
|
||||
|
||||
foreach ($metadata->databases as $db) {
|
||||
$dbName = $newDBNames[$db->name];
|
||||
CLI::logging("+> Restoring database {$db->name} to $dbName\n");
|
||||
$workspace->executeSQLScript($dbName, "$tempDirectory/{$db->name}.sql", $aParameters);
|
||||
$workspace->createDBUser($dbName, $db->pass, "localhost", $dbName);
|
||||
$workspace->createDBUser($dbName, $db->pass, "%", $dbName);
|
||||
}
|
||||
$workspace->upgradeCacheView(false);
|
||||
mysql_close($link);
|
||||
}
|
||||
CLI::logging("Removing temporary files\n");
|
||||
G::rm_dir($tempDirectory);
|
||||
CLI::logging(CLI::info("Done restoring") . "\n");
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,6 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LastModification 30/05/2008
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @package workflow.engine.classes
|
||||
*/
|
||||
|
||||
class NET
|
||||
class Net
|
||||
{
|
||||
public $hostname;
|
||||
public $ip;
|
||||
@@ -58,9 +49,9 @@ class NET
|
||||
$this->errstr = "";
|
||||
$this->db_instance = "";
|
||||
|
||||
unset( $this->db_user );
|
||||
unset( $this->db_passwd );
|
||||
unset( $this->db_sourcename );
|
||||
unset($this->db_user);
|
||||
unset($this->db_passwd);
|
||||
unset($this->db_sourcename);
|
||||
|
||||
#verifing valid param
|
||||
if ($pHost == "") {
|
||||
@@ -68,7 +59,7 @@ class NET
|
||||
$this->errstr = "NET::You must specify a host";
|
||||
//$this->showMsg();
|
||||
}
|
||||
$this->resolv( $pHost );
|
||||
$this->resolv($pHost);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,31 +68,31 @@ class NET
|
||||
* @param string $pHost
|
||||
* @return void
|
||||
*/
|
||||
public function resolv ($pHost)
|
||||
public function resolv($pHost)
|
||||
{
|
||||
$aHost = explode( "\\", $pHost );
|
||||
if (count( $aHost ) > 1) {
|
||||
$aHost = explode("\\", $pHost);
|
||||
if (count($aHost) > 1) {
|
||||
$ipHost = $aHost[0];
|
||||
$this->db_instance = $aHost[1];
|
||||
} else {
|
||||
$ipHost = $pHost;
|
||||
}
|
||||
if ($this->is_ipaddress( $ipHost )) {
|
||||
if ($this->is_ipaddress($ipHost)) {
|
||||
$this->ip = $ipHost;
|
||||
if (! $this->hostname = @gethostbyaddr( $ipHost )) {
|
||||
if (! $this->hostname = @gethostbyaddr($ipHost)) {
|
||||
$this->errno = 2000;
|
||||
$this->errstr = "NET::Host down";
|
||||
$this->error = G::loadTranslation('ID_HOST_UNREACHABLE');
|
||||
}
|
||||
} else {
|
||||
$ip = @gethostbyname( $ipHost );
|
||||
$long = ip2long( $ip );
|
||||
$ip = @gethostbyname($ipHost);
|
||||
$long = ip2long($ip);
|
||||
if ($long == - 1 || $long === false) {
|
||||
$this->errno = 2000;
|
||||
$this->errstr = "NET::Host down";
|
||||
$this->error = G::loadTranslation('ID_HOST_UNREACHABLE');
|
||||
} else {
|
||||
$this->ip = @gethostbyname( $ipHost );
|
||||
$this->ip = @gethostbyname($ipHost);
|
||||
$this->hostname = $pHost;
|
||||
}
|
||||
}
|
||||
@@ -113,14 +104,14 @@ class NET
|
||||
* @param string $pPort
|
||||
* @return true
|
||||
*/
|
||||
public function scannPort ($pPort)
|
||||
public function scannPort($pPort)
|
||||
{
|
||||
define( 'TIMEOUT', 5 );
|
||||
$hostip = @gethostbyname( $host ); // resloves IP from Hostname returns hostname on failure
|
||||
define('TIMEOUT', 5);
|
||||
$hostip = @gethostbyname($host); // resloves IP from Hostname returns hostname on failure
|
||||
// attempt to connect
|
||||
if (@fsockopen( $this->ip, $pPort, $this->errno, $this->errstr, TIMEOUT )) {
|
||||
if (@fsockopen($this->ip, $pPort, $this->errno, $this->errstr, TIMEOUT)) {
|
||||
return true;
|
||||
@fclose( $x ); //close connection (i dont know if this is needed or not).
|
||||
@fclose($x); //close connection (i dont know if this is needed or not).
|
||||
} else {
|
||||
$this->errno = 9999;
|
||||
$this->errstr = "NET::Port Host Unreachable";
|
||||
@@ -135,16 +126,16 @@ class NET
|
||||
* @param string $pHost
|
||||
* @return true
|
||||
*/
|
||||
public function is_ipaddress ($pHost)
|
||||
public function is_ipaddress($pHost)
|
||||
{
|
||||
$key = true;
|
||||
#verifing if is a ip address
|
||||
$tmp = explode( ".", $pHost );
|
||||
$tmp = explode(".", $pHost);
|
||||
#if have a ip address format
|
||||
if (count( $tmp ) == 4) {
|
||||
if (count($tmp) == 4) {
|
||||
#if a correct ip address
|
||||
for ($i = 0; $i < count( $tmp ); $i ++) {
|
||||
if (! is_int( $tmp[$i] )) {
|
||||
for ($i = 0; $i < count($tmp); $i ++) {
|
||||
if (! is_int($tmp[$i])) {
|
||||
$key = false;
|
||||
break;
|
||||
}
|
||||
@@ -161,12 +152,12 @@ class NET
|
||||
* @param string $pHost
|
||||
* @return true
|
||||
*/
|
||||
public function ping ($pTTL = 3000)
|
||||
public function ping($pTTL = 3000)
|
||||
{
|
||||
$cmd = "ping -w $pTTL $this->ip";
|
||||
$output = exec( $cmd, $a, $a1 );
|
||||
$output = exec($cmd, $a, $a1);
|
||||
$this->errstr = "";
|
||||
for ($i = 0; $i < count( $a ); $i ++) {
|
||||
for ($i = 0; $i < count($a); $i ++) {
|
||||
$this->errstr += $a[$i];
|
||||
}
|
||||
$this->errno = $a1;
|
||||
@@ -179,7 +170,7 @@ class NET
|
||||
* @param string $pPasswd
|
||||
* @return void
|
||||
*/
|
||||
public function loginDbServer ($pUser, $pPasswd)
|
||||
public function loginDbServer($pUser, $pPasswd)
|
||||
{
|
||||
$this->db_user = $pUser;
|
||||
$this->db_passwd = $pPasswd;
|
||||
@@ -192,7 +183,7 @@ class NET
|
||||
* @param string $pPort
|
||||
* @return void
|
||||
*/
|
||||
public function setDataBase ($pDb, $pPort = '')
|
||||
public function setDataBase($pDb, $pPort = '')
|
||||
{
|
||||
$this->db_sourcename = $pDb;
|
||||
$this->db_port = $pPort;
|
||||
@@ -208,10 +199,9 @@ class NET
|
||||
*/
|
||||
public function tryConnectServer($pDbDriver, array $arrayServerData = array(), $dbsEncode = "")
|
||||
{
|
||||
|
||||
$filter = new InputFilter();
|
||||
$this->ip = $filter->validateInput($this->ip);
|
||||
$this->db_port = $filter->validateInput($this->db_port,'int');
|
||||
$this->db_port = $filter->validateInput($this->db_port, 'int');
|
||||
$this->db_user = $filter->validateInput($this->db_user);
|
||||
$this->db_passwd = $filter->validateInput($this->db_passwd);
|
||||
$this->db_sourcename = $filter->validateInput($this->db_sourcename);
|
||||
@@ -223,10 +213,10 @@ class NET
|
||||
if (array_key_exists("connectionType", $arrayServerData) || array_key_exists("DBS_TYPEORACLE", $arrayServerData)) {
|
||||
if ($arrayServerData["connectionType"] == "TNS" || $arrayServerData["DBS_TYPEORACLE"] == "TNS") {
|
||||
$flagTns=1;
|
||||
}else{
|
||||
} else {
|
||||
$flagTns=0;
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
$flagTns=0;
|
||||
}
|
||||
|
||||
@@ -234,12 +224,12 @@ class NET
|
||||
switch ($pDbDriver) {
|
||||
case 'mysql':
|
||||
if ($this->db_passwd == '') {
|
||||
$link = @mysql_connect( $this->ip . (($this->db_port != '') && ($this->db_port != 0) ? ':' . $this->db_port : ''), $this->db_user );
|
||||
$link = @mysql_connect($this->ip . (($this->db_port != '') && ($this->db_port != 0) ? ':' . $this->db_port : ''), $this->db_user);
|
||||
} else {
|
||||
$link = @mysql_connect( $this->ip . (($this->db_port != '') && ($this->db_port != 0) ? ':' . $this->db_port : ''), $this->db_user, $this->db_passwd );
|
||||
$link = @mysql_connect($this->ip . (($this->db_port != '') && ($this->db_port != 0) ? ':' . $this->db_port : ''), $this->db_user, $this->db_passwd);
|
||||
}
|
||||
if ($link) {
|
||||
if (@mysql_ping( $link )) {
|
||||
if (@mysql_ping($link)) {
|
||||
$stat->status = 'SUCCESS';
|
||||
$this->errstr = "";
|
||||
$this->errno = 0;
|
||||
@@ -256,7 +246,7 @@ class NET
|
||||
break;
|
||||
case 'pgsql':
|
||||
$this->db_port = ($this->db_port == "") ? "5432" : $this->db_port;
|
||||
$link = @pg_connect( "host='$this->ip' port='$this->db_port' user='$this->db_user' password='$this->db_passwd' dbname='$this->db_sourcename'" );
|
||||
$link = @pg_connect("host='$this->ip' port='$this->db_port' user='$this->db_user' password='$this->db_passwd' dbname='$this->db_sourcename'");
|
||||
if ($link) {
|
||||
$stat->status = 'SUCCESS';
|
||||
$this->errstr = "";
|
||||
@@ -270,10 +260,10 @@ class NET
|
||||
case 'mssql':
|
||||
if ($this->db_instance != "") {
|
||||
$str_port = "";
|
||||
$link = @mssql_connect( $this->ip . "\\" . $this->db_instance, $this->db_user, $this->db_passwd );
|
||||
$link = @mssql_connect($this->ip . "\\" . $this->db_instance, $this->db_user, $this->db_passwd);
|
||||
} else {
|
||||
$str_port = (($this->db_port == "") || ($this->db_port == 0) || ($this->db_port == 1433)) ? "" : ":" . $this->db_port;
|
||||
$link = @mssql_connect( $this->ip . $str_port, $this->db_user, $this->db_passwd );
|
||||
$link = @mssql_connect($this->ip . $str_port, $this->db_user, $this->db_passwd);
|
||||
}
|
||||
|
||||
if ($link) {
|
||||
@@ -306,7 +296,7 @@ class NET
|
||||
$this->errno = 30001;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
throw new Exception( "[erik] Couldn't connect to Oracle Server! - " . $e->getMessage() );
|
||||
throw new Exception("[erik] Couldn't connect to Oracle Server! - " . $e->getMessage());
|
||||
}
|
||||
break;
|
||||
case 'informix':
|
||||
@@ -315,7 +305,7 @@ class NET
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
throw new Exception( "CLASS::NET::ERROR: No connections param." );
|
||||
throw new Exception("CLASS::NET::ERROR: No connections param.");
|
||||
}
|
||||
|
||||
return $stat;
|
||||
@@ -331,10 +321,9 @@ class NET
|
||||
*/
|
||||
public function tryOpenDataBase($pDbDriver, array $arrayServerData = array(), $dbsEncode = "")
|
||||
{
|
||||
|
||||
$filter = new InputFilter();
|
||||
$this->ip = $filter->validateInput($this->ip);
|
||||
$this->db_port = $filter->validateInput($this->db_port,'int');
|
||||
$this->db_port = $filter->validateInput($this->db_port, 'int');
|
||||
$this->db_user = $filter->validateInput($this->db_user);
|
||||
$this->db_passwd = $filter->validateInput($this->db_passwd);
|
||||
$this->db_sourcename = $filter->validateInput($this->db_sourcename);
|
||||
@@ -342,32 +331,32 @@ class NET
|
||||
return 0;
|
||||
}
|
||||
|
||||
set_time_limit( 0 );
|
||||
set_time_limit(0);
|
||||
$stat = new Stat();
|
||||
|
||||
if (array_key_exists("connectionType", $arrayServerData) || array_key_exists("DBS_TYPEORACLE", $arrayServerData)) {
|
||||
if ($arrayServerData["connectionType"] == "TNS" || $arrayServerData["DBS_TYPEORACLE"] == "TNS") {
|
||||
$flagTns=1;
|
||||
}else{
|
||||
} else {
|
||||
$flagTns=0;
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
$flagTns=0;
|
||||
}
|
||||
|
||||
if (isset($this->db_user) && (isset($this->db_passwd) || $this->db_passwd == "") && (isset($this->db_sourcename) || $flagTns == 1)) {
|
||||
switch ($pDbDriver) {
|
||||
case 'mysql':
|
||||
$link = @mysql_connect( $this->ip . (($this->db_port != '') && ($this->db_port != 0) ? ':' . $this->db_port : ''), $this->db_user, $this->db_passwd );
|
||||
$db = @mysql_select_db( $this->db_sourcename );
|
||||
$link = @mysql_connect($this->ip . (($this->db_port != '') && ($this->db_port != 0) ? ':' . $this->db_port : ''), $this->db_user, $this->db_passwd);
|
||||
$db = @mysql_select_db($this->db_sourcename);
|
||||
if ($link) {
|
||||
if ($db) {
|
||||
$result = @mysql_query( "show tables;" );
|
||||
$result = @mysql_query("show tables;");
|
||||
if ($result) {
|
||||
$stat->status = 'SUCCESS';
|
||||
$this->errstr = "";
|
||||
$this->errno = 0;
|
||||
@mysql_free_result( $result );
|
||||
@mysql_free_result($result);
|
||||
} else {
|
||||
$this->error = "the user $this->db_user doesn't have privileges to run queries!";
|
||||
$this->errstr = "NET::MYSQL->Test query failed";
|
||||
@@ -386,9 +375,9 @@ class NET
|
||||
break;
|
||||
case 'pgsql':
|
||||
$this->db_port = (($this->db_port == "") || ($this->db_port == 0)) ? "5432" : $this->db_port;
|
||||
$link = @pg_connect( "host='$this->ip' port='$this->db_port' user='$this->db_user' password='$this->db_passwd' dbname='$this->db_sourcename'" );
|
||||
$link = @pg_connect("host='$this->ip' port='$this->db_port' user='$this->db_user' password='$this->db_passwd' dbname='$this->db_sourcename'");
|
||||
if ($link) {
|
||||
if (@pg_ping( $link )) {
|
||||
if (@pg_ping($link)) {
|
||||
$stat->status = 'SUCCESS';
|
||||
$this->errstr = "";
|
||||
$this->errno = 0;
|
||||
@@ -408,13 +397,13 @@ class NET
|
||||
// $link = @mssql_connect($this->ip . $str_port, $this->db_user, $this->db_passwd);
|
||||
if ($this->db_instance != "") {
|
||||
$str_port = "";
|
||||
$link = @mssql_connect( $this->ip . "\\" . $this->db_instance, $this->db_user, $this->db_passwd );
|
||||
$link = @mssql_connect($this->ip . "\\" . $this->db_instance, $this->db_user, $this->db_passwd);
|
||||
} else {
|
||||
$str_port = (($this->db_port == "") || ($this->db_port == 0) || ($this->db_port == 1433)) ? "" : ":" . $this->db_port;
|
||||
$link = @mssql_connect( $this->ip . $str_port, $this->db_user, $this->db_passwd );
|
||||
$link = @mssql_connect($this->ip . $str_port, $this->db_user, $this->db_passwd);
|
||||
}
|
||||
if ($link) {
|
||||
$db = @mssql_select_db( $this->db_sourcename, $link );
|
||||
$db = @mssql_select_db($this->db_sourcename, $link);
|
||||
if ($db) {
|
||||
$stat->status = 'SUCCESS';
|
||||
$this->errstr = "";
|
||||
@@ -441,7 +430,7 @@ class NET
|
||||
|
||||
if ($cnn) {
|
||||
$stid = @oci_parse($cnn, 'select AUTHENTICATION_TYPE from v$session_connect_info');
|
||||
$result = @oci_execute( $stid, OCI_DEFAULT );
|
||||
$result = @oci_execute($stid, OCI_DEFAULT);
|
||||
if ($result) {
|
||||
$stat->status = 'SUCCESS';
|
||||
$this->errstr = "";
|
||||
@@ -464,7 +453,7 @@ class NET
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
throw new Exception( "CLASS::NET::ERROR: No connections param." );
|
||||
throw new Exception("CLASS::NET::ERROR: No connections param.");
|
||||
}
|
||||
return $stat;
|
||||
}
|
||||
@@ -475,30 +464,29 @@ class NET
|
||||
* @param string $driver
|
||||
* @return void
|
||||
*/
|
||||
public function getDbServerVersion ($driver)
|
||||
public function getDbServerVersion($driver)
|
||||
{
|
||||
if (! isset( $this->ip )) {
|
||||
$this->ip = getenv( 'HTTP_CLIENT_IP' );
|
||||
if (! isset($this->ip)) {
|
||||
$this->ip = getenv('HTTP_CLIENT_IP');
|
||||
}
|
||||
|
||||
if (isset( $this->ip ) && isset( $this->db_user ) && isset( $this->db_passwd )) {
|
||||
if (isset($this->ip) && isset($this->db_user) && isset($this->db_passwd)) {
|
||||
try {
|
||||
if (! isset( $this->db_sourcename )) {
|
||||
if (! isset($this->db_sourcename)) {
|
||||
$this->db_sourcename = DB_NAME;
|
||||
}
|
||||
$value = 'none';
|
||||
$sDataBase = 'database_' . strtolower( DB_ADAPTER );
|
||||
if (G::LoadSystemExist( $sDataBase )) {
|
||||
|
||||
$sDataBase = 'database_' . strtolower(DB_ADAPTER);
|
||||
if (G::LoadSystemExist($sDataBase)) {
|
||||
$oDataBase = new database();
|
||||
$value = $oDataBase->getServerVersion( $driver, $this->ip, $this->db_port, $this->db_user, $this->db_passwd, $this->db_sourcename );
|
||||
$value = $oDataBase->getServerVersion($driver, $this->ip, $this->db_port, $this->db_user, $this->db_passwd, $this->db_sourcename);
|
||||
}
|
||||
return $value;
|
||||
} catch (Exception $e) {
|
||||
throw new Exception( $e->getMessage() );
|
||||
throw new Exception($e->getMessage());
|
||||
}
|
||||
} else {
|
||||
throw new Exception( 'NET::Error->No params for Data Base Server!' );
|
||||
throw new Exception('NET::Error->No params for Data Base Server!');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -508,7 +496,7 @@ class NET
|
||||
* @param string $pAdapter
|
||||
* @return void
|
||||
*/
|
||||
public function dbName ($pAdapter)
|
||||
public function dbName($pAdapter)
|
||||
{
|
||||
switch ($pAdapter) {
|
||||
case 'mysql':
|
||||
@@ -538,7 +526,7 @@ class NET
|
||||
* @param string $pAdapter
|
||||
* @return void
|
||||
*/
|
||||
public function showMsg ()
|
||||
public function showMsg()
|
||||
{
|
||||
if ($this->errno != 0) {
|
||||
$msg = "
|
||||
@@ -552,7 +540,7 @@ class NET
|
||||
</div>
|
||||
</fieldset>
|
||||
<center>";
|
||||
print ($msg) ;
|
||||
print($msg) ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -562,7 +550,7 @@ class NET
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getErrno ()
|
||||
public function getErrno()
|
||||
{
|
||||
return $this->errno;
|
||||
}
|
||||
@@ -573,22 +561,8 @@ class NET
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getErrmsg ()
|
||||
public function getErrmsg()
|
||||
{
|
||||
return $this->errstr;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @package workflow.engine.classes
|
||||
*/
|
||||
class Stat
|
||||
{
|
||||
public $stutus;
|
||||
|
||||
public function __construct ()
|
||||
{
|
||||
$this->status = false;
|
||||
}
|
||||
}
|
||||
67
workflow/engine/classes/ObjectCollection.php
Normal file
67
workflow/engine/classes/ObjectCollection.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* ObjectDocument Collection
|
||||
*
|
||||
* @package workflow.engine.ProcessMaker
|
||||
*/
|
||||
class ObjectCollection
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
24
workflow/engine/classes/ObjectDocument.php
Normal file
24
workflow/engine/classes/ObjectDocument.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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 = '';
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,8 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* class, helping to set some not desirable settings but necesary
|
||||
* @author reav
|
||||
*
|
||||
*/
|
||||
use ProcessMaker\Core\System;
|
||||
|
||||
abstract class patch
|
||||
{
|
||||
static protected $isPathchable = false;
|
||||
static public $dbAdapter = 'mysql';
|
||||
abstract static public function isApplicable();
|
||||
abstract static public function execute();
|
||||
}
|
||||
|
||||
class p11835 extends patch
|
||||
class P11835 extends Patch
|
||||
{
|
||||
/*
|
||||
* Note.- Use before upgrade DB.
|
||||
@@ -30,7 +18,7 @@ class p11835 extends patch
|
||||
$rs->next();
|
||||
while($row = $rs->getRow()) {
|
||||
if ($row ['Field'] == "TAS_GROUP_VARIABLE") {
|
||||
$version = PmSystem::getVersion ();
|
||||
$version = System::getVersion ();
|
||||
$version = explode('-',$version);
|
||||
if ($version[0] == '2.5.1') {
|
||||
echo "Version " . $version[0] . " Patch\n";
|
||||
@@ -98,7 +86,7 @@ class p11835 extends patch
|
||||
$arrayHotfix = $conf->getConfiguration("HOTFIX", "");
|
||||
$arrayHotfix = (is_array($arrayHotfix))? $arrayHotfix : array($arrayHotfix);
|
||||
|
||||
$pmVersion = self::pmVersion(PmSystem::getVersion()) . "";
|
||||
$pmVersion = self::pmVersion(System::getVersion()) . "";
|
||||
|
||||
if (($pmVersion == "2.5.2.4" || $pmVersion == "2.8") && !in_array("15394", $arrayHotfix)) {
|
||||
$cnn = Propel::getConnection("workflow");
|
||||
@@ -116,4 +104,3 @@ class p11835 extends patch
|
||||
echo $count . " records where patched to use SELF_SERVICE feature.\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,28 +1,5 @@
|
||||
<?php
|
||||
|
||||
class featuresDetail
|
||||
{
|
||||
public $featureName;
|
||||
public $description = null;
|
||||
public $enabled = false;
|
||||
public $workspaces = null;
|
||||
|
||||
/**
|
||||
* This function is the constructor of the featuresDetail class
|
||||
*
|
||||
* @param string $featureName
|
||||
* @param string $name
|
||||
* @param string $description
|
||||
* @return void
|
||||
*/
|
||||
public function __construct ($featureName, $description = '')
|
||||
{
|
||||
$this->featureName = $featureName;
|
||||
$this->description = $description;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class PMLicensedFeatures
|
||||
{
|
||||
private $featuresDetails = array ();
|
||||
@@ -336,7 +313,7 @@ class PMLicensedFeatures
|
||||
$addons = AddonsManagerPeer::doSelect($criteria);
|
||||
foreach ($addons as $addon) {
|
||||
$this->features[] = $addon->getAddonId();
|
||||
$detail = new featuresDetail($addon->getAddonNick(), $addon->getAddonDescription());
|
||||
$detail = new FeaturesDetail($addon->getAddonNick(), $addon->getAddonDescription());
|
||||
$this->featuresDetails[$addon->getAddonId()] = $detail;
|
||||
}
|
||||
}
|
||||
@@ -357,14 +334,10 @@ class PMLicensedFeatures
|
||||
/*----------------------------------********---------------------------------*/
|
||||
public function verifyfeature ($featureName)
|
||||
{
|
||||
if (!class_exists("pmLicenseManager")) {
|
||||
require_once ("classes" . PATH_SEP . "class.pmLicenseManager.php");
|
||||
}
|
||||
|
||||
$licenseManager = pmLicenseManager::getSingleton(false);
|
||||
$licenseManager = PmLicenseManager::getSingleton(false);
|
||||
|
||||
$_SESSION['__sw__'] = true;
|
||||
$padl = new padl();
|
||||
$padl = new Padl();
|
||||
$value = $padl->_decrypt($featureName);
|
||||
|
||||
if (is_array($value)) {
|
||||
@@ -1,90 +1,8 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* class.pluginRegistry.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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*/
|
||||
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
|
||||
/**
|
||||
*
|
||||
* @package workflow.engine.classes
|
||||
*/
|
||||
|
||||
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
|
||||
{
|
||||
private $_aPluginDetails = array ();
|
||||
@@ -212,7 +130,7 @@ class PMPluginRegistry
|
||||
return;
|
||||
}
|
||||
|
||||
$detail = new pluginDetail( $sNamespace, $sClassName, $sFilename, $plugin->sFriendlyName, $plugin->sPluginFolder, $plugin->sDescription, $plugin->sSetupPage, $plugin->iVersion );
|
||||
$detail = new PluginDetail( $sNamespace, $sClassName, $sFilename, $plugin->sFriendlyName, $plugin->sPluginFolder, $plugin->sDescription, $plugin->sSetupPage, $plugin->iVersion );
|
||||
|
||||
if (isset( $plugin->aWorkspaces )) {
|
||||
$detail->aWorkspaces = $plugin->aWorkspaces;
|
||||
@@ -585,7 +503,7 @@ class PMPluginRegistry
|
||||
|
||||
public function uninstallPluginWorkspaces ($arrayPlugin)
|
||||
{
|
||||
$workspace = PmSystem::listWorkspaces();
|
||||
$workspace = System::listWorkspaces();
|
||||
|
||||
foreach ($workspace as $indexWS => $ws) {
|
||||
$wsPathDataSite = PATH_DATA . "sites" . PATH_SEP . $ws->name . PATH_SEP;
|
||||
@@ -1183,11 +1101,8 @@ class PMPluginRegistry
|
||||
public function setupPlugins ()
|
||||
{
|
||||
try {
|
||||
require_once(PATH_CORE . "methods" . PATH_SEP . "enterprise" . PATH_SEP . "enterprise.php");
|
||||
require_once("class.serverConfiguration.php");
|
||||
|
||||
$iPlugins = 0;
|
||||
$oServerConf = & serverConf::getSingleton();
|
||||
$oServerConf = & ServerConf::getSingleton();
|
||||
$oServerConf->addPlugin( SYS_SYS, $this->_aPluginDetails );
|
||||
foreach ($this->_aPluginDetails as $namespace => $detail) {
|
||||
if (isset( $detail->enabled ) && $detail->enabled) {
|
||||
@@ -1294,7 +1209,7 @@ class PMPluginRegistry
|
||||
//Found a License
|
||||
if (class_exists( 'pmLicenseManager' )) {
|
||||
$sSerializedFile = PATH_DATA_SITE . 'lmn.singleton';
|
||||
$pmLicenseManagerO = & pmLicenseManager::getSingleton();
|
||||
$pmLicenseManagerO = & PmLicenseManager::getSingleton();
|
||||
if (file_exists( $sSerializedFile )) {
|
||||
$pmLicenseManagerO->unSerializeInstance( file_get_contents( $sSerializedFile ) );
|
||||
}
|
||||
@@ -1629,7 +1544,7 @@ class PMPluginRegistry
|
||||
if (isset($pluginDetails->aWorkspaces) && is_array($pluginDetails->aWorkspaces) && count($pluginDetails->aWorkspaces) > 0) {
|
||||
$arrayWorkspace = array();
|
||||
|
||||
foreach (PmSystem::listWorkspaces() as $value) {
|
||||
foreach (System::listWorkspaces() as $value) {
|
||||
$workspaceTools = $value;
|
||||
|
||||
$arrayWorkspace[] = $workspaceTools->name;
|
||||
@@ -1,35 +1,4 @@
|
||||
<?php
|
||||
/**
|
||||
* class.memcached.php
|
||||
*
|
||||
* @package workflow.engine.ProcessMaker
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* The ProcessMaker memcached class
|
||||
*
|
||||
* @package workflow.engine.ProcessMaker
|
||||
*/
|
||||
|
||||
class PMmemcached
|
||||
{
|
||||
@@ -65,7 +34,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 +186,3 @@ class PMmemcached
|
||||
echo "</table>";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,37 @@
|
||||
* @history---------------------------------------------
|
||||
* see CHANGELOG
|
||||
*/
|
||||
class padl
|
||||
|
||||
use ProcessMaker\Core\System;
|
||||
|
||||
/**
|
||||
* 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 <publicmail at buggedcom dot co dot uk>
|
||||
* @version 0.1
|
||||
* @history---------------------------------------------
|
||||
* see CHANGELOG
|
||||
*/
|
||||
class Padl
|
||||
{
|
||||
/**
|
||||
* hash key 1 used to encrypt the generate key data.
|
||||
@@ -236,7 +266,7 @@ class padl
|
||||
}
|
||||
|
||||
// Proxy settings
|
||||
$sysConf = PmSystem::getSystemConfiguration();
|
||||
$sysConf = System::getSystemConfiguration();
|
||||
if ($sysConf['proxy_host'] != '') {
|
||||
if (!is_array($params['http'])) {
|
||||
$params['http'] = array();
|
||||
@@ -673,32 +703,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 "<br><b>\r\r" . $message . "\r\r</b>";
|
||||
}
|
||||
|
||||
function trace_r($array = "array is empty")
|
||||
{
|
||||
echo "<pre><b>\r\r";
|
||||
print_r($array);
|
||||
echo "\r\r</b></pre>";
|
||||
}
|
||||
|
||||
14
workflow/engine/classes/Patch.php
Normal file
14
workflow/engine/classes/Patch.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* class, helping to set some not desirable settings but necesary
|
||||
* @author reav
|
||||
*
|
||||
*/
|
||||
abstract class Patch
|
||||
{
|
||||
static protected $isPathchable = false;
|
||||
static public $dbAdapter = 'mysql';
|
||||
abstract static public function isApplicable();
|
||||
abstract static public function execute();
|
||||
}
|
||||
57
workflow/engine/classes/PluginDetail.php
Normal file
57
workflow/engine/classes/PluginDetail.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @package workflow.engine.classes
|
||||
*/
|
||||
|
||||
//@todo: Pending until class.plugin.php is solved.
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,8 @@
|
||||
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
|
||||
require_once 'classes/interfaces/dashletInterface.php';
|
||||
require_once 'classes/model/Dashlet.php';
|
||||
require_once 'classes/model/DashletInstance.php';
|
||||
|
||||
class PMDashlet extends DashletInstance implements DashletInterface
|
||||
class PmDashlet extends DashletInstance implements DashletInterface
|
||||
{
|
||||
|
||||
// Own properties
|
||||
@@ -6,8 +6,7 @@
|
||||
* @package workflow.engine.class
|
||||
*
|
||||
*/
|
||||
|
||||
class PMDrive extends PMGoogleApi
|
||||
class PmDrive extends PmGoogleApi
|
||||
{
|
||||
private $folderIdPMDrive = '';
|
||||
private $folderNamePMDrive;
|
||||
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
|
||||
use ProcessMaker\Core\System;
|
||||
|
||||
/**
|
||||
* class.pmDynaform.php
|
||||
* Implementing pmDynaform library in the running case.
|
||||
*
|
||||
* @author Roly Rudy Gutierrez Pinto
|
||||
* @package engine.classes
|
||||
*/
|
||||
class pmDynaform
|
||||
*/class PmDynaform
|
||||
{
|
||||
|
||||
public static $instance = null;
|
||||
@@ -36,7 +35,7 @@ class pmDynaform
|
||||
$this->context = \Bootstrap::getDefaultContextLog();
|
||||
$this->dataSources = array("database", "dataVariable");
|
||||
$this->pathRTLCss = '/lib/pmdynaform/build/css/PMDynaform-rtl.css';
|
||||
$this->serverConf = &serverConf::getSingleton();
|
||||
$this->serverConf = &ServerConf::getSingleton();
|
||||
$this->isRTL = ($this->serverConf->isRtl(SYS_LANG)) ? 'true' : 'false';
|
||||
$this->fields = $fields;
|
||||
$this->propertiesToExclude = array('dataVariable');
|
||||
@@ -1059,7 +1058,7 @@ class pmDynaform
|
||||
$javascript = "
|
||||
<script type=\"text/javascript\">
|
||||
var jsondata = " . G::json_encode($json) . ";
|
||||
var httpServerHostname = \"" . PmSystem::getHttpServerHostnameRequestsFrontEnd() . "\";
|
||||
var httpServerHostname = \"" . System::getHttpServerHostnameRequestsFrontEnd() . "\";
|
||||
var pm_run_outside_main_app = \"\";
|
||||
var dyn_uid = \"" . $this->fields["CURRENT_DYNAFORM"] . "\";
|
||||
var __DynaformName__ = \"" . $this->record["PRO_UID"] . "_" . $this->record["DYN_UID"] . "\";
|
||||
@@ -1120,7 +1119,7 @@ class pmDynaform
|
||||
$javascrip = "" .
|
||||
"<script type='text/javascript'>\n" .
|
||||
"var jsondata = " . G::json_encode($json) . ";\n" .
|
||||
"var httpServerHostname = \"" . PmSystem::getHttpServerHostnameRequestsFrontEnd() . "\";\n" .
|
||||
"var httpServerHostname = \"" . System::getHttpServerHostnameRequestsFrontEnd() . "\";\n" .
|
||||
"var pm_run_outside_main_app = null;\n" .
|
||||
"var dyn_uid = '" . $this->fields["CURRENT_DYNAFORM"] . "';\n" .
|
||||
"var __DynaformName__ = '" . $this->record["PRO_UID"] . "_" . $this->record["DYN_UID"] . "';\n" .
|
||||
@@ -1199,7 +1198,7 @@ class pmDynaform
|
||||
$javascrip = "" .
|
||||
"<script type='text/javascript'>\n" .
|
||||
"var jsondata = " . $this->json_encode($json) . ";\n" .
|
||||
"var httpServerHostname = \"" . PmSystem::getHttpServerHostnameRequestsFrontEnd() . "\";\n" .
|
||||
"var httpServerHostname = \"" . System::getHttpServerHostnameRequestsFrontEnd() . "\";\n" .
|
||||
"var pm_run_outside_main_app = '" . $this->fields["PM_RUN_OUTSIDE_MAIN_APP"] . "';\n" .
|
||||
"var dyn_uid = '" . $this->fields["CURRENT_DYNAFORM"] . "';\n" .
|
||||
"var __DynaformName__ = '" . $this->record["PRO_UID"] . "_" . $this->record["DYN_UID"] . "';\n" .
|
||||
@@ -1256,7 +1255,7 @@ class pmDynaform
|
||||
$javascrip = "
|
||||
<script type=\"text/javascript\">
|
||||
var jsondata = " . G::json_encode($json) . ";
|
||||
var httpServerHostname = \"" . PmSystem::getHttpServerHostnameRequestsFrontEnd() . "\";
|
||||
var httpServerHostname = \"" . System::getHttpServerHostnameRequestsFrontEnd() . "\";
|
||||
var pm_run_outside_main_app = null;
|
||||
var dyn_uid = \"" . $this->fields["CURRENT_DYNAFORM"] . "\";
|
||||
var __DynaformName__ = \"" . $this->fields["PRO_UID"] . "_" . $this->fields["CURRENT_DYNAFORM"] . "\";
|
||||
@@ -1300,7 +1299,7 @@ class pmDynaform
|
||||
$javascrip = "" .
|
||||
"<script type='text/javascript'>\n" .
|
||||
"var jsondata = " . G::json_encode($json) . ";\n" .
|
||||
"var httpServerHostname = \"" . PmSystem::getHttpServerHostnameRequestsFrontEnd() . "\";\n" .
|
||||
"var httpServerHostname = \"" . System::getHttpServerHostnameRequestsFrontEnd() . "\";\n" .
|
||||
"var pm_run_outside_main_app = null;\n" .
|
||||
"var dyn_uid = '" . $this->fields["CURRENT_DYNAFORM"] . "';\n" .
|
||||
"var __DynaformName__ = null;\n" .
|
||||
@@ -1342,7 +1341,7 @@ class pmDynaform
|
||||
$javascrip = "" .
|
||||
"<script type='text/javascript'>\n" .
|
||||
"var jsondata = " . G::json_encode($json) . ";\n" .
|
||||
"var httpServerHostname = \"" . PmSystem::getHttpServerHostnameRequestsFrontEnd() . "\";\n" .
|
||||
"var httpServerHostname = \"" . System::getHttpServerHostnameRequestsFrontEnd() . "\";\n" .
|
||||
"var pm_run_outside_main_app = null;\n" .
|
||||
"var dyn_uid = '" . $this->fields["CURRENT_DYNAFORM"] . "';\n" .
|
||||
"var __DynaformName__ = null;\n" .
|
||||
@@ -1384,7 +1383,7 @@ class pmDynaform
|
||||
"var pathRTLCss = '" . $this->pathRTLCss . "';\n" .
|
||||
"var delIndex = " . (isset($this->fields["DEL_INDEX"]) ? $this->fields["DEL_INDEX"] : "0") . ";\n" .
|
||||
"var jsonData = " . $this->json_encode($json) . ";\n" .
|
||||
"var httpServerHostname = \"" . PmSystem::getHttpServerHostnameRequestsFrontEnd() . "\";\n" .
|
||||
"var httpServerHostname = \"" . System::getHttpServerHostnameRequestsFrontEnd() . "\";\n" .
|
||||
"var leaveCaseWarning = " . $this->getLeaveCaseWarning() . ";\n" .
|
||||
$js .
|
||||
"</script>";
|
||||
@@ -1406,7 +1405,7 @@ class pmDynaform
|
||||
$javascrip = "" .
|
||||
"<script type='text/javascript'>\n" .
|
||||
"var jsondata = " . G::json_encode($json) . ";\n" .
|
||||
"var httpServerHostname = \"" . PmSystem::getHttpServerHostnameRequestsFrontEnd() . "\";\n" .
|
||||
"var httpServerHostname = \"" . System::getHttpServerHostnameRequestsFrontEnd() . "\";\n" .
|
||||
"var pm_run_outside_main_app = null;\n" .
|
||||
"var dyn_uid = '" . $currentDynaform . "';\n" .
|
||||
"var __DynaformName__ = null;\n" .
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
class pmGauge
|
||||
|
||||
class PmGauge
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -280,4 +281,3 @@ class pmGauge
|
||||
imagettftext($im, 9, 0, $centerX, $centerY, $black, $fontArial, $textToDisplay);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,11 @@
|
||||
|
||||
require_once PATH_TRUNK . 'vendor' . PATH_SEP . 'google' . PATH_SEP . 'apiclient' . PATH_SEP . 'src' . PATH_SEP . 'Google' . PATH_SEP . 'autoload.php';
|
||||
|
||||
class PMGoogleApi
|
||||
|
||||
/**
|
||||
* class.pmGoogleApi.php
|
||||
*
|
||||
*/class PmGoogleApi
|
||||
{
|
||||
const DRIVE = 'https://www.googleapis.com/auth/drive';
|
||||
const DRIVE_FILE = 'https://www.googleapis.com/auth/drive.file';
|
||||
@@ -2,28 +2,29 @@
|
||||
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
|
||||
require_once PATH_CORE . 'classes' . PATH_SEP . 'class.enterpriseUtils.php';
|
||||
|
||||
/**
|
||||
* class.pmLicenseManager.php
|
||||
*
|
||||
*/
|
||||
class pmLicenseManager
|
||||
|
||||
/**
|
||||
* class.pmLicenseManager.php
|
||||
*
|
||||
*/class PmLicenseManager
|
||||
{
|
||||
|
||||
private static $instance = null;
|
||||
|
||||
public function __construct($flagActivatePlugins = true)
|
||||
{
|
||||
$oServerConf = &serverConf::getSingleton();
|
||||
$oServerConf = &ServerConf::getSingleton();
|
||||
$oServerConf->setProperty('LOGIN_NO_WS', true);
|
||||
|
||||
//to do: this files probably needs to be in core, since they are GPL2
|
||||
//include_once (PATH_PLUGINS . 'enterprise' . PATH_SEP . 'classes' . PATH_SEP . 'class.license.lib.php');
|
||||
//include_once (PATH_PLUGINS . 'enterprise' . PATH_SEP . 'classes' . PATH_SEP . 'class.license.app.php');
|
||||
|
||||
require_once PATH_CORE . 'classes' . PATH_SEP . 'class.license.lib.php';
|
||||
require_once PATH_CORE . 'classes' . PATH_SEP . 'class.license.app.php';
|
||||
|
||||
//searching .dat files in workspace folder
|
||||
$server_array = $_SERVER;
|
||||
@@ -119,7 +120,7 @@ class pmLicenseManager
|
||||
public static function getSingleton($flagActivatePlugins = true)
|
||||
{
|
||||
if (self::$instance == null) {
|
||||
self::$instance = new pmLicenseManager($flagActivatePlugins);
|
||||
self::$instance = new PmLicenseManager($flagActivatePlugins);
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
@@ -379,7 +380,7 @@ class pmLicenseManager
|
||||
return false;
|
||||
} else {
|
||||
|
||||
$oServerConf = & serverConf::getSingleton ();
|
||||
$oServerConf = & ServerConf::getSingleton ();
|
||||
$oServerConf->setProperty ( 'ACTIVE_LICENSE',array(SYS_SYS => $path));
|
||||
$this->saveDataLicense( $results, $path, $redirect );
|
||||
if ($redirect) {
|
||||
@@ -510,4 +511,3 @@ class pmLicenseManager
|
||||
return unserialize(G::decrypt($this->serial, file_get_contents(PATH_PLUGINS . 'enterprise/data/default')));
|
||||
}
|
||||
}
|
||||
|
||||
13
workflow/engine/classes/PmPhing.php
Normal file
13
workflow/engine/classes/PmPhing.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Phing Class Wrapper
|
||||
*
|
||||
*/
|
||||
class PmPhing extends Phing
|
||||
{
|
||||
public function getPhingVersion()
|
||||
{
|
||||
return 'pmPhing Ver 1.0';
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user