Merge remote-tracking branch 'origin/bugfix/HOR-3670' into release/3.2.2

This commit is contained in:
David Callizaya
2017-08-15 10:07:12 -04:00
326 changed files with 11383 additions and 24998 deletions

View File

@@ -68,7 +68,6 @@
"workflow/engine/includes/", "workflow/engine/includes/",
"thirdparty/smarty/libs/Smarty.class.php", "thirdparty/smarty/libs/Smarty.class.php",
"thirdparty/jsmin/jsmin.php", "thirdparty/jsmin/jsmin.php",
"thirdparty/libchart/classes/",
"thirdparty/pear", "thirdparty/pear",
"thirdparty/html2ps_pdf", "thirdparty/html2ps_pdf",
"thirdparty/phing", "thirdparty/phing",
@@ -80,7 +79,8 @@
"gulliver/includes/smarty_plugins/function.pmos.php", "gulliver/includes/smarty_plugins/function.pmos.php",
"thirdparty/pear/PEAR.php", "thirdparty/pear/PEAR.php",
"thirdparty/HTMLPurifier/HTMLPurifier.auto.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": { "autoload-dev": {

View File

@@ -2,11 +2,13 @@
namespace Maveriks; namespace Maveriks;
use Maveriks\Util; use Maveriks\Util;
use ProcessMaker\Core\System;
use ProcessMaker\Plugins\PluginRegistry; use ProcessMaker\Plugins\PluginRegistry;
use ProcessMaker\Services; use ProcessMaker\Services;
use ProcessMaker\Services\Api; use ProcessMaker\Services\Api;
use Luracast\Restler\RestException; use Luracast\Restler\RestException;
use Illuminate\Foundation\Http\Kernel; use Illuminate\Foundation\Http\Kernel;
use G;
/** /**
* Web application bootstrap * Web application bootstrap
@@ -287,7 +289,7 @@ class WebApplication
Services\Api::setWorkspace(SYS_SYS); Services\Api::setWorkspace(SYS_SYS);
$cacheDir = defined("PATH_WORKSPACE") ? PATH_WORKSPACE : (defined("PATH_C")? PATH_C: sys_get_temp_dir()); $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; \Luracast\Restler\Defaults::$cacheDirectory = $cacheDir;
$productionMode = (bool) !(isset($sysConfig["service_api_debug"]) && $sysConfig["service_api_debug"]); $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_CONTROLLERS", PATH_CORE . "controllers" . PATH_SEP);
define("PATH_SERVICES_REST", PATH_CORE . "services" . PATH_SEP . "rest" . 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 ini_set('date.timezone', $arraySystemConfiguration['time_zone']); //Set Time Zone
@@ -500,7 +503,7 @@ class WebApplication
exit(0); exit(0);
} }
$arraySystemConfiguration = \PmSystem::getSystemConfiguration('', '', SYS_SYS); $arraySystemConfiguration = System::getSystemConfiguration('', '', SYS_SYS);
//Do not change any of these settings directly, use env.ini instead //Do not change any of these settings directly, use env.ini instead
ini_set('display_errors', $arraySystemConfiguration['display_errors']); ini_set('display_errors', $arraySystemConfiguration['display_errors']);

View File

@@ -1505,7 +1505,7 @@ function get_infoOnPM($workspace) {
if( defined("DB_HOST") ) { if( defined("DB_HOST") ) {
$dbNetView = new NET(DB_HOST); $dbNetView = new Net(DB_HOST);
$dbNetView->loginDbServer(DB_USER, DB_PASS); $dbNetView->loginDbServer(DB_USER, DB_PASS);
$dbConns = new DbConnections(''); $dbConns = new DbConnections('');

View File

@@ -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->id = urlDecode( $_POST['form'] );
$G_FORM->values = isset( $_SESSION[$G_FORM->id] ) ? $_SESSION[$G_FORM->id] : array (); $G_FORM->values = isset( $_SESSION[$G_FORM->id] ) ? $_SESSION[$G_FORM->id] : array ();

View File

@@ -1,4 +1,7 @@
<?php <?php
use ProcessMaker\Core\System;
/** /**
* class.bootstrap.php * class.bootstrap.php
* *
@@ -41,7 +44,7 @@ class Bootstrap
public static function getSystemConfiguration($globalIniFile = '', $wsIniFile = '', $wsName = '') 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 * @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 (((in_array($browserName, $enabledBrowsers)) || (in_array('ALL', $enabledBrowsers))) && (!(in_array($browserName, $disabledBrowsers)))) {
if ($cssFileInfo['__ATTRIBUTES__']['file'] == 'rtl.css') { if ($cssFileInfo['__ATTRIBUTES__']['file'] == 'rtl.css') {
$oServerConf = & serverConf::getSingleton(); $oServerConf = & ServerConf::getSingleton();
if (!(defined('SYS_LANG'))) { if (!(defined('SYS_LANG'))) {
if (isset($_SERVER['HTTP_REFERER'])) { if (isset($_SERVER['HTTP_REFERER'])) {
$syss = explode('://', $_SERVER['HTTP_REFERER']); $syss = explode('://', $_SERVER['HTTP_REFERER']);
@@ -1030,7 +1033,7 @@ class Bootstrap
*/ */
public function getCheckSum($files) public function getCheckSum($files)
{ {
$key = PmSystem::getVersion(); $key = System::getVersion();
if (!is_array($files)) { if (!is_array($files)) {
$tmp = $files; $tmp = $files;
@@ -1923,7 +1926,7 @@ class Bootstrap
/* Fix to prevent use uxs skin outside siplified interface, /* Fix to prevent use uxs skin outside siplified interface,
because that skin is not compatible with others interfaces */ because that skin is not compatible with others interfaces */
if ($args['SYS_SKIN'] == 'uxs' && $args['SYS_COLLECTION'] != 'home' && $args['SYS_COLLECTION'] != 'cases') { 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']; $args['SYS_SKIN'] = $config['default_skin'];
} }

View File

@@ -1,4 +1,7 @@
<?php <?php
use ProcessMaker\Core\System;
if (!defined("T_ML_COMMENT")) { if (!defined("T_ML_COMMENT")) {
define("T_ML_COMMENT", T_COMMENT); define("T_ML_COMMENT", T_COMMENT);
} else { } else {
@@ -26,10 +29,10 @@ class CodeScanner
if (!is_null($option)) { if (!is_null($option)) {
switch (gettype($option)) { switch (gettype($option)) {
case 'string': case 'string':
$workspace = new workspaceTools($option); $workspace = new WorkspaceTools($option);
if ($workspace->workspaceExists()) { if ($workspace->workspaceExists()) {
$arraySystemConfiguration = PmSystem::getSystemConfiguration('', '', $workspace->name); $arraySystemConfiguration = System::getSystemConfiguration('', '', $workspace->name);
$flag = (int)($arraySystemConfiguration['enable_blacklist']) == 1; $flag = (int)($arraySystemConfiguration['enable_blacklist']) == 1;
} }
break; break;

View File

@@ -32,7 +32,7 @@
* *
*/ */
class filterForm extends form class filterForm extends Form
{ {
public $cols = 3; public $cols = 3;
public $type = 'filterform'; public $type = 'filterform';

View File

@@ -1,34 +1,8 @@
<?php <?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 * Class Form
* *
* @author David S. Callizaya S. <davidsantos@colosa.com>
* @package gulliver.system * @package gulliver.system
* @access public * @access public
*/ */
@@ -57,7 +31,6 @@ class Form extends XmlForm
/** /**
* Function setDefaultValues * Function setDefaultValues
* *
* @author David S. Callizaya S. <davidsantos@colosa.com>
* @access public * @access public
* @return string * @return string
*/ */
@@ -109,7 +82,6 @@ class Form extends XmlForm
/** /**
* Function Form * Function Form
* *
* @author David S. Callizaya S. <davidsantos@colosa.com>
* @access public * @access public
* @param string filename * @param string filename
* @param string home * @param string home
@@ -118,7 +90,7 @@ class Form extends XmlForm
* @param string $visual_frontend * @param string $visual_frontend
* @return string * @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; $this->visual_frontend = $visual_frontend;
if ($language === '') { if ($language === '') {
@@ -218,7 +190,7 @@ class Form extends XmlForm
$values = $this->values; $values = $this->values;
$aValuekeys = array_keys( $values ); $aValuekeys = array_keys( $values );
if (isset( $aValuekeys[0] ) && ((int) $aValuekeys[0] == 1)) { 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()) //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 ) )) { if (is_array( reset( $values ) )) {

View File

@@ -24,6 +24,7 @@
* *
*/ */
use ProcessMaker\Core\System;
use ProcessMaker\Plugins\PluginRegistry; use ProcessMaker\Plugins\PluginRegistry;
/** /**
@@ -865,7 +866,7 @@ class G
/* Fix to prevent use uxs skin outside siplified interface, /* Fix to prevent use uxs skin outside siplified interface,
because that skin is not compatible with others interfaces*/ because that skin is not compatible with others interfaces*/
if ($args['SYS_SKIN'] == 'uxs' && $args['SYS_COLLECTION'] != 'home' && $args['SYS_COLLECTION'] != 'cases') { 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']; $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 (((in_array($browserName, $enabledBrowsers)) || (in_array('ALL', $enabledBrowsers)))&&(!(in_array($browserName, $disabledBrowsers)))) {
if ($cssFileInfo['__ATTRIBUTES__']['file'] == 'rtl.css') { if ($cssFileInfo['__ATTRIBUTES__']['file'] == 'rtl.css') {
$oServerConf =& serverConf::getSingleton(); $oServerConf =& ServerConf::getSingleton();
if (!(defined('SYS_LANG'))) { if (!(defined('SYS_LANG'))) {
if (isset($_SERVER['HTTP_REFERER'])) { if (isset($_SERVER['HTTP_REFERER'])) {
$syss = explode('://', $_SERVER['HTTP_REFERER']); $syss = explode('://', $_SERVER['HTTP_REFERER']);
@@ -4649,7 +4650,7 @@ class G
*/ */
public function getCheckSum ($files) public function getCheckSum ($files)
{ {
$key = PmSystem::getVersion(); $key = System::getVersion();
if (! is_array( $files )) { if (! is_array( $files )) {
$tmp = $files; $tmp = $files;
@@ -5280,7 +5281,7 @@ class G
public static function browserCacheFilesGetUid() 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; 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') public static function log($message, $pathData = PATH_DATA, $file = 'cron.log')
{ {
$config = PmSystem::getSystemConfiguration(); $config = System::getSystemConfiguration();
$oLogger = Logger::getSingleton($pathData, PATH_SEP, $file); $oLogger = Logger::getSingleton($pathData, PATH_SEP, $file);
@@ -5823,6 +5824,19 @@ class G
$_SESSION['_DATA_TRIGGER_']['_TRI_LOG_'] = true; $_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"; print "$s\n";
} }
} }
function __ ($msgID, $lang = SYS_LANG, $data = null)
{
return G::LoadTranslation( $msgID, $lang, $data );
}

View File

@@ -360,7 +360,7 @@ class headPublisher
//$head .= $this->getExtJsStylesheets(); //$head .= $this->getExtJsStylesheets();
$head .= $this->getExtJsScripts(); $head .= $this->getExtJsScripts();
$head .= $this->getExtJsVariablesScript(); $head .= $this->getExtJsVariablesScript();
$oServerConf = & serverConf::getSingleton(); $oServerConf = & ServerConf::getSingleton();
if ($oServerConf->isRtl(SYS_LANG)) { if ($oServerConf->isRtl(SYS_LANG)) {
$head = $head . " <script type=\"text/javascript\" src=\"" . G::browserCacheFilesUrl("/js/ext/extjs_rtl.js") . "\"></script>\n"; $head = $head . " <script type=\"text/javascript\" src=\"" . G::browserCacheFilesUrl("/js/ext/extjs_rtl.js") . "\"></script>\n";
} }
@@ -751,7 +751,7 @@ class headPublisher
$views = array(); $views = array();
$keyState = "extJsViewState"; $keyState = "extJsViewState";
$prefixExtJs = "ys-"; $prefixExtJs = "ys-";
$oServerConf = &serverConf::getSingleton(); $oServerConf = &ServerConf::getSingleton();
$deleteCache = true; $deleteCache = true;
$sjson = $oServerConf->getProperty($keyState); $sjson = $oServerConf->getProperty($keyState);

View File

@@ -1,38 +1,12 @@
<?php <?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 * @package gulliver.system
* *
*/ */
class XmlForm_Field_HTML extends XmlForm_Field_Textarea class XmlFormFieldHTML extends XmlFormFieldTextarea
{ {
/* //'default','office2003','silver' /* //'default','office2003','silver'
var $skin = 'default'; var $skin = 'default';

View File

@@ -90,7 +90,7 @@ class pagedTable
public $name = 'pagedTable'; public $name = 'pagedTable';
public $id = 'A1'; public $id = 'A1';
public $disableFooter = false; 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 $tdStyle = '';
public $tdClass = ''; public $tdClass = '';
//Config Save definition //Config Save definition

View File

@@ -192,7 +192,7 @@ class Publisher
if (($this->publishType == 'dynaform') && (($Part['Template'] == 'xmlform') || ($Part['Template'] == 'xmlform_preview'))) { 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'; $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 ) ) ), SYS_LANG, PATH_XMLFORM, $G_FORM )
), $G_FORM->fields ); ), $G_FORM->fields );
} }
@@ -355,7 +355,7 @@ class Publisher
/* End Block */ /* End Block */
/* Start Block: PagedTable Right Click */ /* Start Block: PagedTable Right Click */
$pm = new popupMenu( 'gulliver/pagedTable_PopupMenu' ); $pm = new PopupMenu( 'gulliver/pagedTable_PopupMenu' );
$pm->name = $oTable->id; $pm->name = $oTable->id;
$fields = array_keys( $oTable->fields ); $fields = array_keys( $oTable->fields );
foreach ($fields as $f) { foreach ($fields as $f) {
@@ -369,7 +369,7 @@ class Publisher
default: default:
$label = ($oTable->fields[$f]['Label'] != '') ? $oTable->fields[$f]['Label'] : $f; $label = ($oTable->fields[$f]['Label'] != '') ? $oTable->fields[$f]['Label'] : $f;
$label = str_replace( "\n", ' ', $label ); $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] = ''; $pm->values[$f] = '';
} }
} }
@@ -430,7 +430,7 @@ class Publisher
$_SESSION[$G_FORM->id] = $G_FORM->values; $_SESSION[$G_FORM->id] = $G_FORM->values;
} }
$oTable = new propelTable(); $oTable = new PropelTable();
$oTable->template = $Part['Template']; $oTable->template = $Part['Template'];
$oTable->criteria = $Part['Content']; $oTable->criteria = $Part['Content'];
if (isset( $Part['ajaxServer'] ) && ($Part['ajaxServer'] !== '')) { if (isset( $Part['ajaxServer'] ) && ($Part['ajaxServer'] !== '')) {
@@ -461,7 +461,7 @@ class Publisher
/* End Block */ /* End Block */
/* Start Block: PagedTable Right Click */ /* Start Block: PagedTable Right Click */
$pm = new popupMenu( 'gulliver/pagedTable_PopupMenu' ); $pm = new PopupMenu( 'gulliver/pagedTable_PopupMenu' );
$sc = $pm->renderPopup( $oTable->id, $oTable->fields ); $sc = $pm->renderPopup( $oTable->id, $oTable->fields );
/* End Block */ /* End Block */
//krumo ( $Part ); //krumo ( $Part );

View File

@@ -532,7 +532,7 @@ class RBAC
{ {
/*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/
$licenseManager =& pmLicenseManager::getSingleton(); $licenseManager =& PmLicenseManager::getSingleton();
if (in_array(G::encryptOld($licenseManager->result), array('38afd7ae34bd5e3e6fc170d8b09178a3', 'ba2b45bdc11e2a4a6e86aab2ac693cbb'))) { if (in_array(G::encryptOld($licenseManager->result), array('38afd7ae34bd5e3e6fc170d8b09178a3', 'ba2b45bdc11e2a4a6e86aab2ac693cbb'))) {
return -7; return -7;
} }

View File

@@ -30,6 +30,8 @@
* to allow NTLM authentication throw soap connection * to allow NTLM authentication throw soap connection
*/ */
use ProcessMaker\Core\System;
/** /**
* *
* @package gulliver.system * @package gulliver.system
@@ -200,7 +202,7 @@ class soapNtlm
curl_setopt( $this->ch, CURLOPT_USERPWD, $this->getuser() . ':' . $this->getpassword() ); // Ankit's code curl_setopt( $this->ch, CURLOPT_USERPWD, $this->getuser() . ':' . $this->getpassword() ); // Ankit's code
//Apply proxy settings //Apply proxy settings
if (class_exists( 'System' )) { if (class_exists( 'System' )) {
$sysConf = PmSystem::getSystemConfiguration(); $sysConf = System::getSystemConfiguration();
$sysConf = $filter->xssFilterHard($sysConf); $sysConf = $filter->xssFilterHard($sysConf);
if ($sysConf['proxy_host'] != '') { if ($sysConf['proxy_host'] != '') {
curl_setopt( $this->ch, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : '') ); 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 //Apply proxy settings
if (class_exists( 'System' )) { if (class_exists( 'System' )) {
$sysConf = PmSystem::getSystemConfiguration(); $sysConf = System::getSystemConfiguration();
if ($sysConf['proxy_host'] != '') { if ($sysConf['proxy_host'] != '') {
curl_setopt( $ch, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : '') ); curl_setopt( $ch, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : '') );
if ($sysConf['proxy_port'] != '') { if ($sysConf['proxy_port'] != '') {

View File

@@ -26,7 +26,7 @@
*/ */
/** /**
* XmlForm_Field_HTML class definition * XmlFormFieldWYSIWYGEditor class definition
* It is useful to see dynaforms how are built * It is useful to see dynaforms how are built
* *
* @package gulliver.system * @package gulliver.system
@@ -36,7 +36,7 @@
* *
*/ */
class XmlForm_Field_WYSIWYG_EDITOR extends XmlForm_Field class XmlFormFieldWYSIWYGEditor extends XmlFormField
{ {
public $width = '100%'; public $width = '100%';
public $height = '300'; public $height = '300';
@@ -76,7 +76,7 @@ class XmlForm_Field_WYSIWYG_EDITOR extends XmlForm_Field
{ {
$editorDefinition = 'tinyMCE.baseURL = "/js/tinymce/jscripts/tiny_mce"; '; $editorDefinition = 'tinyMCE.baseURL = "/js/tinymce/jscripts/tiny_mce"; ';
$editorDefinition .= 'var domainURL = "/sys'.SYS_SYS.'/'.SYS_LANG.'/'.SYS_SKIN.'/"'; $editorDefinition .= 'var domainURL = "/sys'.SYS_SYS.'/'.SYS_LANG.'/'.SYS_SKIN.'/"';
$serverConf =& serverConf::getSingleton(); $serverConf =& ServerConf::getSingleton();
switch ($this->editorType){ switch ($this->editorType){
case 'EMAIL_TEMPLATE': case 'EMAIL_TEMPLATE':

View File

@@ -30,21 +30,21 @@
* *
* @package gulliver.system * @package gulliver.system
*/ */
class xmlMenu extends form class xmlMenu extends Form
{ {
public $type = 'xmlmenu'; public $type = 'xmlmenu';
public $parentFormId; public $parentFormId;
} }
/** /**
* XmlForm_Field_XmlMenu * XmlFormFieldXmlMenu
* *
* extends XmlForm_Field * extends XmlFormField
* *
* @package gulliver.system * @package gulliver.system
* *
*/ */
class XmlForm_Field_XmlMenu extends XmlForm_Field class XmlFormFieldXmlMenu extends XmlFormField
{ {
public $xmlfile = ''; public $xmlfile = '';
public $type = 'xmlmenuDyn'; public $type = 'xmlmenuDyn';
@@ -54,7 +54,7 @@ class XmlForm_Field_XmlMenu extends XmlForm_Field
public $parentFormId; public $parentFormId;
/** /**
* XmlForm_Field_XmlMenu * XmlFormFieldXmlMenu
* *
* @param string $xmlNode * @param string $xmlNode
* @param string $lang default value 'en' * @param string $lang default value 'en'
@@ -63,9 +63,9 @@ class XmlForm_Field_XmlMenu extends XmlForm_Field
* *
* @return none * @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; $this->home = $home;
} }

File diff suppressed because it is too large Load Diff

View File

@@ -1,36 +1,10 @@
<?php <?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 * @package gulliver.system
*/ */
class XmlForm_Field_Label extends XmlForm_Field class XmlFormFieldLabel extends XmlFormField
{ {
public $withoutValue = true; public $withoutValue = true;
public $align = 'left'; public $align = 'left';
@@ -43,7 +17,7 @@ class XmlForm_Field_Label extends XmlForm_Field
* *
* @package gulliver.system * @package gulliver.system
*/ */
class XmlForm_Field_cellMark extends XmlForm_Field class XmlFormFieldCellMark extends XmlFormField
{ {
/* Defines the style of the next tds /* Defines the style of the next tds
of the pagedTable. 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 * @package gulliver.system
* *
*/ */
class XmlForm_Field_DVEditor extends XmlForm_Field class XmlFormFieldDVEditor extends XmlFormField
{ {
public $toolbarSet = 'toolbar2lines.html'; public $toolbarSet = 'toolbar2lines.html';
public $width = '90%'; public $width = '90%';
@@ -150,7 +124,7 @@ class XmlForm_Field_DVEditor extends XmlForm_Field
* *
* @package gulliver.system * @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 $onkeypress = "if (event.keyCode===13)@#PAGED_TABLE_ID.doFastSearch(this.value);if (event.keyCode===13)return false;";
public $colAlign = "right"; public $colAlign = "right";

View File

@@ -81,4 +81,4 @@
if (!is_dir(PATH_SMARTY_C)) G::mk_dir(PATH_SMARTY_C); if (!is_dir(PATH_SMARTY_C)) G::mk_dir(PATH_SMARTY_C);
if (!is_dir(PATH_SMARTY_CACHE)) G::mk_dir(PATH_SMARTY_CACHE); if (!is_dir(PATH_SMARTY_CACHE)) G::mk_dir(PATH_SMARTY_CACHE);
?> G::defineConstants();

View File

@@ -170,7 +170,7 @@ class WorkflowTestCase extends TestCase
throw new \Exception('To continue please put a valid license at features/resources'); throw new \Exception('To continue please put a valid license at features/resources');
} }
G::LoadClass('pmLicenseManager'); G::LoadClass('pmLicenseManager');
$licenseManager = new pmLicenseManager(); $licenseManager = new PmLicenseManager();
$licenseManager->installLicense($licenseFile[0]); $licenseManager->installLicense($licenseFile[0]);
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -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 '&lt;'.
*
* @param string $val The string in which to expand entities.
* @access private
*/
function expandEntities($val) {
if ($this->charencoding) {
$val = str_replace('&', '&amp;', $val);
$val = str_replace("'", '&apos;', $val);
$val = str_replace('"', '&quot;', $val);
$val = str_replace('<', '&lt;', $val);
$val = str_replace('>', '&gt;', $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);
}
?>

View File

@@ -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;
}
}
?>

View File

@@ -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)
{
}
}
}
?>

File diff suppressed because it is too large Load Diff

View File

@@ -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() {
}
}
?>

View File

@@ -1,5 +1,7 @@
<?php <?php
//test //test
use ProcessMaker\Core\System;
class PmBootstrap extends Bootstrap class PmBootstrap extends Bootstrap
{ {
public $pmConfig = array(); public $pmConfig = array();
@@ -25,7 +27,7 @@ class PmBootstrap extends Bootstrap
{ {
parent::configure(); 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_DEPRECATED') ? E_ALL & ~E_DEPRECATED : E_ALL;
$e_all = defined('E_STRICT') ? $e_all & ~E_STRICT : $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('publisher', PATH_GULLIVER . 'class.publisher');
$this->autoloader->registerClass('templatePower', PATH_GULLIVER . 'class.templatePower'); $this->autoloader->registerClass('templatePower', PATH_GULLIVER . 'class.templatePower');
$this->autoloader->registerClass('xmlDocument', PATH_GULLIVER . 'class.xmlDocument'); $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('xmlform', PATH_GULLIVER . 'class.xmlform');
$this->autoloader->registerClass('xmlformExtension', PATH_GULLIVER . 'class.xmlformExtension'); $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('headPublisher', PATH_GULLIVER . 'class.headPublisher');
$this->autoloader->registerClass('Xml_Node', PATH_GULLIVER . 'class.xmlDocument'); $this->autoloader->registerClass('Xml_Node', PATH_GULLIVER . 'class.xmlDocument');
$this->autoloader->registerClass('Xml_document', 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('XmlFormField*', PATH_GULLIVER . 'class.xmlform');
$this->autoloader->registerClass('serverConf', PATH_CORE . 'classes/class.serverConfiguration'); $this->autoloader->registerClass('ServerConf', PATH_CORE . 'classes/class.serverConfiguration');
} }
/** /**

View File

@@ -1,4 +1,7 @@
<?php <?php
use ProcessMaker\Core\System;
require_once(__DIR__ . '/../../../bootstrap/autoload.php'); require_once(__DIR__ . '/../../../bootstrap/autoload.php');
try { try {
//Set variables //Set variables
@@ -77,7 +80,7 @@ try {
$classLoader->addModelClassPath(PATH_TRUNK . 'workflow' . PATH_SEP . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'model' . PATH_SEP); $classLoader->addModelClassPath(PATH_TRUNK . 'workflow' . PATH_SEP . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'model' . PATH_SEP);
//Load classes //Load classes
$arraySystemConfiguration = PmSystem::getSystemConfiguration(); $arraySystemConfiguration = System::getSystemConfiguration();
$e_all = (defined('E_DEPRECATED'))? E_ALL & ~E_DEPRECATED : E_ALL; $e_all = (defined('E_DEPRECATED'))? E_ALL & ~E_DEPRECATED : E_ALL;
$e_all = (defined('E_STRICT'))? $e_all & ~E_STRICT : $e_all; $e_all = (defined('E_STRICT'))? $e_all & ~E_STRICT : $e_all;

View File

@@ -1,6 +1,7 @@
<?php <?php
require_once(__DIR__ . '/../../../bootstrap/autoload.php'); require_once(__DIR__ . '/../../../bootstrap/autoload.php');
use ProcessMaker\Core\System;
use ProcessMaker\Plugins\PluginRegistry; use ProcessMaker\Plugins\PluginRegistry;
register_shutdown_function( register_shutdown_function(
@@ -68,7 +69,7 @@ try {
$classLoader->addModelClassPath(PATH_TRUNK . 'workflow' . PATH_SEP . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'model' . PATH_SEP); $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_DEPRECATED'))? E_ALL & ~E_DEPRECATED : E_ALL;
$e_all = (defined('E_STRICT'))? $e_all & ~E_STRICT : $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)); $dateResend = date("Y-m-d H:i:s", $mktDateSystem - (7 * 24 * 60 * 60));
} }
$oSpool = new spoolRun(); $oSpool = new SpoolRun();
$oSpool->resendEmails($dateResend, 1); $oSpool->resendEmails($dateResend, 1);
saveLog("resendEmails", "action", "Resending Emails", "c"); saveLog("resendEmails", "action", "Resending Emails", "c");
@@ -980,7 +981,7 @@ function synchronizeGmailLabels()
} }
$licensedFeatures = &PMLicensedFeatures::getSingleton(); $licensedFeatures = &PMLicensedFeatures::getSingleton();
if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) { if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
$pmGoogle = new PMGoogleApi(); $pmGoogle = new PmGoogleApi();
if ($pmGoogle->getServiceGmailStatus()) { if ($pmGoogle->getServiceGmailStatus()) {
setExecutionMessage("Synchronize labels in Gmail"); setExecutionMessage("Synchronize labels in Gmail");
$labGmail = new labelsGmail(); $labGmail = new labelsGmail();

View File

@@ -26,6 +26,8 @@
// php reindex_solr.php workspacename [reindexall|reindexmissing|optimizeindex] [-skip 1005] [-reindextrunksize 1000] // php reindex_solr.php workspacename [reindexall|reindexmissing|optimizeindex] [-skip 1005] [-reindextrunksize 1000]
// var_dump($argv); // var_dump($argv);
//(count ($argv) == 4) || ((count ($argv) == 5) && ($argv [3] != '-skip')) //(count ($argv) == 4) || ((count ($argv) == 5) && ($argv [3] != '-skip'))
use ProcessMaker\Core\System;
$commandLineSyntaxMsg = "Invalid command line arguments: \n " . $commandLineSyntaxMsg = "Invalid command line arguments: \n " .
"syntax: ". "syntax: ".
"php reindex_solr.php [workspace_name] [reindexall|reindexmissing|optimizeindex|reindexone|deleteindexone] [-skip {record_number}] [-reindextrunksize {trunk_size}] [-appuid {APP_UID}]\n" . "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 // read initialize file
require_once PATH_HOME . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'class.system.php'; 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_ENABLED', $config ['memcached']);
define ('MEMCACHED_SERVER', $config ['memcached_server']); define ('MEMCACHED_SERVER', $config ['memcached_server']);
define ('TIME_ZONE', $config ['time_zone']); define ('TIME_ZONE', $config ['time_zone']);
@@ -259,7 +261,7 @@ function processWorkspace()
try { 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 Configuration file: " . PATH_DATA_SITE . "env.ini\n";
print "solr_enabled: " . $solrConf ['solr_enabled'] . "\n"; print "solr_enabled: " . $solrConf ['solr_enabled'] . "\n";
print "solr_host: " . $solrConf ['solr_host'] . "\n"; print "solr_host: " . $solrConf ['solr_host'] . "\n";

View File

@@ -57,7 +57,7 @@ function run_addon_core_install($args)
} }
/////// ///////
$ws = new workspaceTools($workspace); $ws = new WorkspaceTools($workspace);
$ws->initPropel(false); $ws->initPropel(false);
require_once PATH_CORE . 'methods' . PATH_SEP . 'enterprise' . PATH_SEP . 'enterprise.php'; require_once PATH_CORE . 'methods' . PATH_SEP . 'enterprise' . PATH_SEP . 'enterprise.php';
@@ -73,7 +73,7 @@ function run_addon_core_install($args)
$addon->install(); $addon->install();
if ($addon->isCore()) { if ($addon->isCore()) {
$ws = new workspaceTools($workspace); $ws = new WorkspaceTools($workspace);
$ws->initPropel(false); $ws->initPropel(false);
$addon->setState("install-finish"); $addon->setState("install-finish");
} else { } else {

View File

@@ -1,6 +1,9 @@
<?php <?php
/* Get the size of the terminal (only works on Linux, on Windows it's always 80) */ /* 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); 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])) { if (sizeof($output) == 3 && isset($output[2]) && isset($output[2][0])) {
define("COLUMNS", $output[2][0]); define("COLUMNS", $output[2][0]);

View File

@@ -22,7 +22,7 @@ function runHotfixInstall($command, $args)
foreach ($arrayFile as $value) { foreach ($arrayFile as $value) {
$f = $value; $f = $value;
$result = workspaceTools::hotfixInstall($f); $result = WorkspaceTools::hotfixInstall($f);
CLI::logging($result["message"] . "\n"); CLI::logging($result["message"] . "\n");
} }

View File

@@ -20,7 +20,7 @@ function cliListIds($command, $args)
$workspace->dbInfo['DB_USER'], $workspace->dbInfo['DB_USER'],
$workspace->dbInfo['DB_PASS'] $workspace->dbInfo['DB_PASS']
); );
foreach (workspaceTools::$populateIdsQueries as $query) { foreach (WorkspaceTools::$populateIdsQueries as $query) {
echo "."; echo ".";
$dbh->query($query); $dbh->query($query);
} }

View File

@@ -25,6 +25,8 @@
* @package workflow-engine-bin-tasks * @package workflow-engine-bin-tasks
*/ */
use ProcessMaker\Core\System;
CLI::taskName('upgrade'); 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."); 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); $flag = G::isPMUnderUpdating(1, $oneWorkspace);
//start to upgrade //start to upgrade
$checksum = PmSystem::verifyChecksum(); $checksum = System::verifyChecksum();
if ($checksum === false) { if ($checksum === false) {
CLI::logging(CLI::error("checksum.txt not found, integrity check is not possible") . "\n"); 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?")) { if (!CLI::question("Integrity check failed, do you want to continue the upgrade?")) {
@@ -177,7 +179,7 @@ function run_upgrade($command, $args)
} }
} }
} else { } 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 //Safe upgrade for JavaScript files
@@ -219,10 +221,10 @@ function run_unify_database($args)
if (sizeof($args) > 2) { if (sizeof($args) > 2) {
$filename = array_pop($args); $filename = array_pop($args);
foreach ($args as $arg) { foreach ($args as $arg) {
$workspaces[] = new workspaceTools($arg); $workspaces[] = new WorkspaceTools($arg);
} }
} else if (sizeof($args) > 0) { } else if (sizeof($args) > 0) {
$workspace = new workspaceTools($args[0]); $workspace = new WorkspaceTools($args[0]);
$workspaces[] = $workspace; $workspaces[] = $workspace;
} }

View File

@@ -1,29 +1,4 @@
<?php <?php
/**
* cliWorkspaces.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 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.
*
* @author Alexandre Rosenfeld <alexandre@colosa.com>
* @package workflow-engine-bin-tasks
*/
CLI::taskName('info'); CLI::taskName('info');
CLI::taskDescription(<<<EOT CLI::taskDescription(<<<EOT
@@ -72,8 +47,7 @@ CLI::taskOpt("overwrite", "If a workspace already exists, overwrite it.", "o", "
CLI::taskOpt("info", "Show information about backup file, but do not restore any workspaces.", "i"); CLI::taskOpt("info", "Show information about backup file, but do not restore any workspaces.", "i");
CLI::taskOpt("multiple", "Restore from multiple compressed backup files which are numbered.", "m"); CLI::taskOpt("multiple", "Restore from multiple compressed backup files which are numbered.", "m");
CLI::taskOpt("workspace", "Specify which workspace to restore if multiple workspaces are present in the backup file. CLI::taskOpt("workspace", "Specify which workspace to restore if multiple workspaces are present in the backup file.
Ex: -wworkflow.", Ex: -wworkflow.", "w:", "workspace=");
"w:", "workspace=");
CLI::taskOpt("lang", "Specify the language which will be used to rebuild the case cache list. If this option isn't included, then 'en' (English) will be used by default.", "l:", "lang="); CLI::taskOpt("lang", "Specify the language which will be used to rebuild the case cache list. If this option isn't included, then 'en' (English) will be used by default.", "l:", "lang=");
CLI::taskOpt("port", "Specify the port number used by MySQL. If not specified, then the port 3306 will be used by default.", "p:"); CLI::taskOpt("port", "Specify the port number used by MySQL. If not specified, then the port 3306 will be used by default.", "p:");
CLI::taskRun("run_workspace_restore"); CLI::taskRun("run_workspace_restore");
@@ -174,8 +148,7 @@ CLI::taskDescription(<<<EOT
EOT EOT
); );
//CLI::taskArg('workspace', true); //CLI::taskArg('workspace', true);
CLI::taskOpt("workspace", "Select the workspace whose case folders will be migrated, if multiple workspaces are present in the server.\n Ex: -wworkflow. Ex: --workspace=workflow", CLI::taskOpt("workspace", "Select the workspace whose case folders will be migrated, if multiple workspaces are present in the server.\n Ex: -wworkflow. Ex: --workspace=workflow", "w:", "workspace=");
"w:", "workspace=");
CLI::taskRun("runStructureDirectories"); CLI::taskRun("runStructureDirectories");
CLI::taskName("database-generate-self-service-by-value"); CLI::taskName("database-generate-self-service-by-value");
@@ -362,17 +335,18 @@ CLI::taskRun("regenerate_pmtable_classes");
* Function run_info * Function run_info
* access public * access public
*/ */
function run_info($args, $opts) { function run_info($args, $opts)
{
$workspaces = get_workspaces_from_args($args); $workspaces = get_workspaces_from_args($args);
workspaceTools::printSysInfo(); WorkspaceTools::printSysInfo();
foreach ($workspaces as $workspace) { foreach ($workspaces as $workspace) {
echo "\n"; echo "\n";
$workspace->printMetadata(false); $workspace->printMetadata(false);
} }
} }
function run_workspace_upgrade($args, $opts) { function run_workspace_upgrade($args, $opts)
{
$filter = new InputFilter(); $filter = new InputFilter();
$opts = $filter->xssFilterHard($opts); $opts = $filter->xssFilterHard($opts);
$args = $filter->xssFilterHard($args); $args = $filter->xssFilterHard($args);
@@ -410,7 +384,8 @@ function run_workspace_upgrade($args, $opts) {
* *
* @return void * @return void
*/ */
function run_translation_upgrade($args, $opts) { function run_translation_upgrade($args, $opts)
{
$noXml = array_key_exists('noxml', $opts) ? '--no-xml' : ''; $noXml = array_key_exists('noxml', $opts) ? '--no-xml' : '';
$noMafe = array_key_exists('nomafe', $opts) ? '--no-mafe' : ''; $noMafe = array_key_exists('nomafe', $opts) ? '--no-mafe' : '';
if (!empty($noXml)) { if (!empty($noXml)) {
@@ -459,8 +434,8 @@ function translation_upgrade($args, $opts)
} }
} }
function run_cacheview_upgrade($args, $opts) { function run_cacheview_upgrade($args, $opts)
{
$filter = new InputFilter(); $filter = new InputFilter();
$opts = $filter->xssFilterHard($opts); $opts = $filter->xssFilterHard($opts);
$args = $filter->xssFilterHard($args); $args = $filter->xssFilterHard($args);
@@ -475,7 +450,9 @@ function run_cacheview_upgrade($args, $opts) {
} }
} }
} }
function run_plugins_database_upgrade($args, $opts) {
function run_plugins_database_upgrade($args, $opts)
{
$workspaces = get_workspaces_from_args($args); $workspaces = get_workspaces_from_args($args);
foreach ($workspaces as $workspace) { foreach ($workspaces as $workspace) {
try { try {
@@ -487,14 +464,17 @@ function run_plugins_database_upgrade($args, $opts) {
} }
} }
function run_database_export($args, $opts) { function run_database_export($args, $opts)
if (count($args) < 2) {
if (count($args) < 2) {
throw new Exception("Please provide a workspace name and a directory for export"); throw new Exception("Please provide a workspace name and a directory for export");
$workspace = new workspaceTools($args[0]); }
$workspace = new WorkspaceTools($args[0]);
$workspace->exportDatabase($args[1]); $workspace->exportDatabase($args[1]);
} }
function run_database_import($args, $opts) { function run_database_import($args, $opts)
{
throw new Exception("Not implemented"); throw new Exception("Not implemented");
} }
@@ -506,7 +486,8 @@ function run_database_import($args, $opts) {
* *
* @return void * @return void
*/ */
function run_database_upgrade($args, $opts) { function run_database_upgrade($args, $opts)
{
//Check if the command is executed by a specific workspace //Check if the command is executed by a specific workspace
if (count($args) === 1) { if (count($args) === 1) {
database_upgrade('upgrade', $args); database_upgrade('upgrade', $args);
@@ -518,19 +499,23 @@ function run_database_upgrade($args, $opts) {
} }
} }
function run_database_check($args, $opts) { function run_database_check($args, $opts)
{
database_upgrade("check", $args); database_upgrade("check", $args);
} }
function run_migrate_new_cases_lists($args, $opts) { function run_migrate_new_cases_lists($args, $opts)
{
migrate_new_cases_lists("migrate", $args, $opts); migrate_new_cases_lists("migrate", $args, $opts);
} }
function run_migrate_counters($args, $opts) { function run_migrate_counters($args, $opts)
{
migrate_counters("migrate", $args); migrate_counters("migrate", $args);
} }
function run_migrate_list_unassigned($args, $opts) { function run_migrate_list_unassigned($args, $opts)
{
migrate_list_unassigned("migrate", $args, $opts); migrate_list_unassigned("migrate", $args, $opts);
} }
@@ -541,8 +526,8 @@ function run_migrate_list_unassigned($args, $opts) {
* *
* @return void * @return void
*/ */
function database_upgrade($command, $args) { function database_upgrade($command, $args)
{
$filter = new InputFilter(); $filter = new InputFilter();
$command = $filter->xssFilterHard($command); $command = $filter->xssFilterHard($command);
$args = $filter->xssFilterHard($args); $args = $filter->xssFilterHard($args);
@@ -580,17 +565,20 @@ function database_upgrade($command, $args) {
} }
} }
function delete_app_from_table($con, $tableName, $appUid, $col="APP_UID") { function delete_app_from_table($con, $tableName, $appUid, $col = "APP_UID")
{
$stmt = $con->createStatement(); $stmt = $con->createStatement();
$sql = "DELETE FROM " . $tableName . " WHERE " . $col . "='" . $appUid . "'"; $sql = "DELETE FROM " . $tableName . " WHERE " . $col . "='" . $appUid . "'";
$rs = $stmt->executeQuery($sql, ResultSet::FETCHMODE_NUM); $rs = $stmt->executeQuery($sql, ResultSet::FETCHMODE_NUM);
} }
function run_drafts_clean($args, $opts) { function run_drafts_clean($args, $opts)
{
echo "Cleaning drafts\n"; echo "Cleaning drafts\n";
if (count($args) < 1) if (count($args) < 1) {
throw new Exception("Please specify a workspace name"); throw new Exception("Please specify a workspace name");
}
$workspace = $args[0]; $workspace = $args[0];
if (!file_exists(PATH_DB . $workspace . '/db.php')) { if (!file_exists(PATH_DB . $workspace . '/db.php')) {
@@ -615,10 +603,11 @@ function run_drafts_clean($args, $opts) {
throw new Exception("Days value is not valid: " . $days); throw new Exception("Days value is not valid: " . $days);
} }
if ($allDrafts) if ($allDrafts) {
echo "Removing all drafts\n"; echo "Removing all drafts\n";
else } else {
echo "Removing drafts older than " . $days . " days\n"; echo "Removing drafts older than " . $days . " days\n";
}
/* Load the configuration from the workspace */ /* Load the configuration from the workspace */
require_once(PATH_DB . $workspace . '/db.php'); require_once(PATH_DB . $workspace . '/db.php');
@@ -629,10 +618,11 @@ function run_drafts_clean($args, $opts) {
$stmt = $con->createStatement(); $stmt = $con->createStatement();
if (!$allDrafts) if (!$allDrafts) {
$dateSql = "AND DATE_SUB(CURDATE(),INTERVAL " . $days . " DAY) >= APP_CREATE_DATE"; $dateSql = "AND DATE_SUB(CURDATE(),INTERVAL " . $days . " DAY) >= APP_CREATE_DATE";
else } else {
$dateSql = ""; $dateSql = "";
}
/* Search for all the draft cases */ /* Search for all the draft cases */
$sql = "SELECT APP_UID FROM APPLICATION WHERE APP_STATUS='DRAFT'" . $dateSql; $sql = "SELECT APP_UID FROM APPLICATION WHERE APP_STATUS='DRAFT'" . $dateSql;
$appRows = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC); $appRows = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);
@@ -665,15 +655,16 @@ function run_drafts_clean($args, $opts) {
echo "\n"; echo "\n";
} }
function run_workspace_backup($args, $opts) { function run_workspace_backup($args, $opts)
{
$workspaces = array(); $workspaces = array();
if (sizeof($args) > 2) { if (sizeof($args) > 2) {
$filename = array_pop($args); $filename = array_pop($args);
foreach ($args as $arg) { foreach ($args as $arg) {
$workspaces[] = new workspaceTools($arg); $workspaces[] = new WorkspaceTools($arg);
} }
} elseif (sizeof($args) > 0) { } elseif (sizeof($args) > 0) {
$workspace = new workspaceTools($args[0]); $workspace = new WorkspaceTools($args[0]);
$workspaces[] = $workspace; $workspaces[] = $workspace;
if (sizeof($args) == 2) { if (sizeof($args) == 2) {
$filename = $args[1]; $filename = $args[1];
@@ -704,7 +695,7 @@ function run_workspace_backup($args, $opts) {
CLI::error("This is not a Linux enviroment, cannot use this filesize [-s] feature.\n"); CLI::error("This is not a Linux enviroment, cannot use this filesize [-s] feature.\n");
return; return;
} }
$multipleBackup = new multipleFilesBackup ($filename,$filesize);//if filesize is 0 the default size will be took $multipleBackup = new MultipleFilesBackup($filename, $filesize); //if filesize is 0 the default size will be took
//using new method //using new method
foreach ($workspaces as $workspace) { foreach ($workspaces as $workspace) {
$multipleBackup->addToBackup($workspace); $multipleBackup->addToBackup($workspace);
@@ -712,23 +703,23 @@ function run_workspace_backup($args, $opts) {
$multipleBackup->letsBackup(); $multipleBackup->letsBackup();
} else { } else {
//ansient method to backup into one large file //ansient method to backup into one large file
$backup = workspaceTools::createBackup($filename); $backup = WorkspaceTools::createBackup($filename);
foreach ($workspaces as $workspace) { foreach ($workspaces as $workspace) {
$workspace->backup($backup); $workspace->backup($backup);
} }
} }
CLI::logging("\n"); CLI::logging("\n");
workspaceTools::printSysInfo(); WorkspaceTools::printSysInfo();
foreach ($workspaces as $workspace) { foreach ($workspaces as $workspace) {
CLI::logging("\n"); CLI::logging("\n");
$workspace->printMetadata(false); $workspace->printMetadata(false);
} }
} }
function run_workspace_restore($args, $opts) { function run_workspace_restore($args, $opts)
{
if (sizeof($args) > 0) { if (sizeof($args) > 0) {
$filename = $args[0]; $filename = $args[0];
G::verifyPath(PATH_DATA . 'upgrade', true); G::verifyPath(PATH_DATA . 'upgrade', true);
@@ -740,17 +731,18 @@ function run_workspace_restore($args, $opts) {
if (strpos($filename, "/") === false && strpos($filename, '\\') === false) { if (strpos($filename, "/") === false && strpos($filename, '\\') === false) {
$filename = PATH_DATA . "backups/$filename"; $filename = PATH_DATA . "backups/$filename";
if (!file_exists($filename) && substr_compare($filename, ".tar", -4, 4, true) != 0) if (!file_exists($filename) && substr_compare($filename, ".tar", -4, 4, true) != 0) {
$filename .= ".tar"; $filename .= ".tar";
} }
}
$info = array_key_exists("info", $opts); $info = array_key_exists("info", $opts);
$lang = array_key_exists("lang", $opts) ? $opts['lang'] : 'en'; $lang = array_key_exists("lang", $opts) ? $opts['lang'] : 'en';
$port = array_key_exists("port", $opts) ? $opts['port'] : ''; $port = array_key_exists("port", $opts) ? $opts['port'] : '';
if ($info) { if ($info) {
workspaceTools::getBackupInfo($filename); WorkspaceTools::getBackupInfo($filename);
} else { } else {
CLI::logging("Restoring from $filename\n"); CLI::logging("Restoring from $filename\n");
$workspace = array_key_exists("workspace", $opts) ? $opts['workspace'] : NULL; $workspace = array_key_exists("workspace", $opts) ? $opts['workspace'] : null;
$overwrite = array_key_exists("overwrite", $opts); $overwrite = array_key_exists("overwrite", $opts);
$multiple = array_key_exists("multiple", $opts); $multiple = array_key_exists("multiple", $opts);
$dstWorkspace = isset($args[1]) ? $args[1] : null; $dstWorkspace = isset($args[1]) ? $args[1] : null;
@@ -759,13 +751,11 @@ function run_workspace_restore($args, $opts) {
CLI::error("This is not a Linux enviroment, cannot use this multiple [-m] feature.\n"); CLI::error("This is not a Linux enviroment, cannot use this multiple [-m] feature.\n");
return; return;
} }
multipleFilesBackup::letsRestore ($filename,$workspace,$dstWorkspace,$overwrite); MultipleFilesBackup::letsRestore($filename, $workspace, $dstWorkspace, $overwrite);
} } else {
else{
$anotherExtention = ".*"; //if there are files with and extra extention: e.g. <file>.tar.number $anotherExtention = ".*"; //if there are files with and extra extention: e.g. <file>.tar.number
$multiplefiles = glob($filename . $anotherExtention); // example: //shared/workflow_data/backups/myWorkspace.tar.* $multiplefiles = glob($filename . $anotherExtention); // example: //shared/workflow_data/backups/myWorkspace.tar.*
if(count($multiplefiles) > 0) if (count($multiplefiles) > 0) {
{
CLI::error("Processmaker found these files: .\n"); CLI::error("Processmaker found these files: .\n");
foreach ($multiplefiles as $index => $value) { foreach ($multiplefiles as $index => $value) {
CLI::logging($value . "\n"); CLI::logging($value . "\n");
@@ -773,7 +763,7 @@ function run_workspace_restore($args, $opts) {
CLI::error("Please, you should use -m parameter to restore them.\n"); CLI::error("Please, you should use -m parameter to restore them.\n");
return; return;
} }
workspaceTools::restore($filename, $workspace, $dstWorkspace, $overwrite, $lang, $port ); WorkspaceTools::restore($filename, $workspace, $dstWorkspace, $overwrite, $lang, $port);
} }
} }
} else { } else {
@@ -781,7 +771,8 @@ function run_workspace_restore($args, $opts) {
} }
} }
function runStructureDirectories($command, $args) { function runStructureDirectories($command, $args)
{
$workspaces = get_workspaces_from_args($command); $workspaces = get_workspaces_from_args($command);
$count = count($workspaces); $count = count($workspaces);
$errors = false; $errors = false;
@@ -801,7 +792,6 @@ function runStructureDirectories($command, $args) {
function run_database_generate_self_service_by_value($args, $opts) function run_database_generate_self_service_by_value($args, $opts)
{ {
$filter = new InputFilter(); $filter = new InputFilter();
$opts = $filter->xssFilterHard($opts); $opts = $filter->xssFilterHard($opts);
$args = $filter->xssFilterHard($args); $args = $filter->xssFilterHard($args);
@@ -882,23 +872,23 @@ function verifyMigratedDataConsistency($args)
return $inconsistentRecords; return $inconsistentRecords;
} }
function run_migrate_itee_to_dummytask($args, $opts){ function run_migrate_itee_to_dummytask($args, $opts)
{
$filter = new InputFilter(); $filter = new InputFilter();
$opts = $filter->xssFilterHard($opts); $opts = $filter->xssFilterHard($opts);
$args = $filter->xssFilterHard($args); $args = $filter->xssFilterHard($args);
$arrayWorkspace = get_workspaces_from_args($args); $arrayWorkspace = get_workspaces_from_args($args);
foreach ($arrayWorkspace as $workspace) { foreach ($arrayWorkspace as $workspace) {
try { try {
$ws = new workspaceTools($workspace->name); $ws = new WorkspaceTools($workspace->name);
$res = $ws->migrateIteeToDummytask($workspace->name); $res = $ws->migrateIteeToDummytask($workspace->name);
} catch (Exception $e) { } catch (Exception $e) {
G::outRes("> Error: " . CLI::error($e->getMessage()) . "\n"); G::outRes("> Error: " . CLI::error($e->getMessage()) . "\n");
} }
} }
} }
/* ----------------------------------********--------------------------------- */ /* ----------------------------------********--------------------------------- */
/** /**
* Check if we need to execute an external program for each workspace * Check if we need to execute an external program for each workspace
* If we apply the command for all workspaces we will need to execute one by one by redefining the constants * If we apply the command for all workspaces we will need to execute one by one by redefining the constants
@@ -907,7 +897,8 @@ function run_migrate_itee_to_dummytask($args, $opts){
* *
* @return void * @return void
*/ */
function run_check_workspace_disabled_code($args, $opts) { function run_check_workspace_disabled_code($args, $opts)
{
//Check if the command is executed by a specific workspace //Check if the command is executed by a specific workspace
if (count($args) === 1) { if (count($args) === 1) {
check_workspace_disabled_code($args, $opts); check_workspace_disabled_code($args, $opts);
@@ -918,6 +909,7 @@ function run_check_workspace_disabled_code($args, $opts) {
} }
} }
} }
/** /**
* This function is executed only by one workspace * This function is executed only by one workspace
* Code Security Scanner related to the custom blacklist * Code Security Scanner related to the custom blacklist
@@ -980,7 +972,8 @@ function check_workspace_disabled_code($args, $opts)
} }
} }
function migrate_new_cases_lists($command, $args, $opts) { function migrate_new_cases_lists($command, $args, $opts)
{
$filter = new InputFilter(); $filter = new InputFilter();
$opts = $filter->xssFilterHard($opts); $opts = $filter->xssFilterHard($opts);
$args = $filter->xssFilterHard($args); $args = $filter->xssFilterHard($args);
@@ -997,7 +990,8 @@ function migrate_new_cases_lists($command, $args, $opts) {
} }
} }
function migrate_counters($command, $args) { function migrate_counters($command, $args)
{
$workspaces = get_workspaces_from_args($args); $workspaces = get_workspaces_from_args($args);
foreach ($workspaces as $workspace) { foreach ($workspaces as $workspace) {
@@ -1013,8 +1007,8 @@ function migrate_counters($command, $args) {
} }
} }
function migrate_list_unassigned($command, $args, $opts) { function migrate_list_unassigned($command, $args, $opts)
{
$filter = new InputFilter(); $filter = new InputFilter();
$opts = $filter->xssFilterHard($opts); $opts = $filter->xssFilterHard($opts);
$args = $filter->xssFilterHard($args); $args = $filter->xssFilterHard($args);
@@ -1040,7 +1034,8 @@ function migrate_list_unassigned($command, $args, $opts) {
* *
* @return void * @return void
*/ */
function run_migrate_content($args, $opts) { function run_migrate_content($args, $opts)
{
//Check the additional parameters //Check the additional parameters
$lang = array_key_exists("lang", $opts) ? '--lang=' . $opts['lang'] : '--lang=' . SYS_LANG; $lang = array_key_exists("lang", $opts) ? '--lang=' . $opts['lang'] : '--lang=' . SYS_LANG;
//Check if the command is executed by a specific workspace //Check if the command is executed by a specific workspace
@@ -1053,6 +1048,7 @@ function run_migrate_content($args, $opts) {
} }
} }
} }
/** /**
* This function is executed only by one workspace * This function is executed only by one workspace
* @param array $args, workspaceName for to apply the migrate-content * @param array $args, workspaceName for to apply the migrate-content
@@ -1081,8 +1077,8 @@ function migrate_content($args, $opts)
CLI::logging("<*> Optimizing content data Process took " . ($stop - $start) . " seconds.\n"); CLI::logging("<*> Optimizing content data Process took " . ($stop - $start) . " seconds.\n");
} }
function run_migrate_self_service_value($args, $opts) { function run_migrate_self_service_value($args, $opts)
{
$filter = new InputFilter(); $filter = new InputFilter();
$args = $filter->xssFilterHard($args); $args = $filter->xssFilterHard($args);
$workspaces = get_workspaces_from_args($args); $workspaces = get_workspaces_from_args($args);
@@ -1097,7 +1093,8 @@ function run_migrate_self_service_value($args, $opts) {
CLI::logging("<*> Migrating Self-Service records Process took " . ($stop - $start) . " seconds.\n"); CLI::logging("<*> Migrating Self-Service records Process took " . ($stop - $start) . " seconds.\n");
} }
function run_migrate_indexing_acv($args, $opts) { function run_migrate_indexing_acv($args, $opts)
{
$filter = new InputFilter(); $filter = new InputFilter();
$args = $filter->xssFilterHard($args); $args = $filter->xssFilterHard($args);
$workspaces = get_workspaces_from_args($args); $workspaces = get_workspaces_from_args($args);
@@ -1111,10 +1108,11 @@ function run_migrate_indexing_acv($args, $opts) {
CLI::logging("<*> Migrating and populating indexing for avoiding the use of table APP_CACHE_VIEW process took " . ($stop - $start) . " seconds.\n"); CLI::logging("<*> Migrating and populating indexing for avoiding the use of table APP_CACHE_VIEW process took " . ($stop - $start) . " seconds.\n");
} }
function run_migrate_plugin($args, $opts) { function run_migrate_plugin($args, $opts)
{
$workspaces = get_workspaces_from_args($args); $workspaces = get_workspaces_from_args($args);
//Check if the command is executed by a specific workspace //Check if the command is executed by a specific workspace
/** @var workspaceTools $workspace */ /** @var WorkspaceTools $workspace */
if (count($workspaces) === 1) { if (count($workspaces) === 1) {
$workspace = array_shift($workspaces); $workspace = array_shift($workspaces);
CLI::logging('Regenerating Singleton in: ' . pakeColor::colorize($workspace->name, 'INFO') . "\n"); CLI::logging('Regenerating Singleton in: ' . pakeColor::colorize($workspace->name, 'INFO') . "\n");
@@ -1130,6 +1128,7 @@ function run_migrate_plugin($args, $opts) {
CLI::logging("<*> Migrating and populating data Singleton took " . ($stop - $start) . " seconds.\n"); CLI::logging("<*> Migrating and populating data Singleton took " . ($stop - $start) . " seconds.\n");
} }
} }
/** /**
* This method recursively finds all PHP files that reference the path PATH_DATA * This method recursively finds all PHP files that reference the path PATH_DATA
* incorrectly, which is caused by importing processes where the data directory * incorrectly, which is caused by importing processes where the data directory
@@ -1148,7 +1147,7 @@ function regenerate_pmtable_classes($args, $opts)
CLI::logging("> Updating generated class files for PM Tables...\n"); CLI::logging("> Updating generated class files for PM Tables...\n");
Bootstrap::setConstantsRelatedWs($args[0]); Bootstrap::setConstantsRelatedWs($args[0]);
$workspaceTools = new workspaceTools($args[0]); $workspaceTools = new WorkspaceTools($args[0]);
$workspaceTools->fixReferencePathFiles(PATH_DATA_SITE . "classes", PATH_DATA); $workspaceTools->fixReferencePathFiles(PATH_DATA_SITE . "classes", PATH_DATA);
$stop = microtime(true); $stop = microtime(true);

View File

@@ -26,6 +26,8 @@
// php reindex_solr.php workspacename [reindexall|reindexmissing|optimizeindex] [-skip 1005] [-reindextrunksize 1000] // php reindex_solr.php workspacename [reindexall|reindexmissing|optimizeindex] [-skip 1005] [-reindextrunksize 1000]
// var_dump($argv); // var_dump($argv);
//(count ($argv) == 4) || ((count ($argv) == 5) && ($argv [3] != '-skip')) //(count ($argv) == 4) || ((count ($argv) == 5) && ($argv [3] != '-skip'))
use ProcessMaker\Core\System;
$commandLineSyntaxMsg = "Invalid command line arguments: \n " . $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 ". "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: ". "syntax: ".
@@ -117,7 +119,7 @@ if (! defined ('SYS_SYS')) {
// **************************************** // ****************************************
// read initialize file // read initialize file
require_once PATH_HOME . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'class.system.php'; 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_ENABLED', $config ['memcached']);
define ('MEMCACHED_SERVER', $config ['memcached_server']); define ('MEMCACHED_SERVER', $config ['memcached_server']);
define ('TIME_ZONE', $config ['time_zone']); define ('TIME_ZONE', $config ['time_zone']);
@@ -335,7 +337,7 @@ function displayMissingCases($aAppUidsDB, $aAppUidsSolr)
function getListUids($usrUid, $action) 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 Configuration file: " . PATH_DATA_SITE . "env.ini\n";
print "solr_enabled: " . $solrConf ['solr_enabled'] . "\n"; print "solr_enabled: " . $solrConf ['solr_enabled'] . "\n";

View File

@@ -1,7 +1,8 @@
<?php <?php
class actionsByEmailCoreClass extends PMPlugin
class ActionsByEmailCoreClass extends PMPlugin
{ {
public function __construct() public function __construct()
{ {
@@ -170,7 +171,7 @@ class actionsByEmailCoreClass extends PMPlugin
$field->label = ''; $field->label = '';
$actionField = str_replace(array('@@', '@#', '@=', '@%', '@?', '@$'), '', $configuration['ABE_ACTION_FIELD']); $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']; $configuration['CURRENT_DYNAFORM'] = $configuration['DYN_UID'];
$file = $obj->printPmDynaformAbe($configuration); $file = $obj->printPmDynaformAbe($configuration);
$__ABE__ .= $file; $__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']; $configuration['CURRENT_DYNAFORM'] = $configuration['DYN_UID'];
$file = $obj->printPmDynaformAbe($configuration); $file = $obj->printPmDynaformAbe($configuration);
$__ABE__ .= $file; $__ABE__ .= $file;
@@ -290,7 +291,7 @@ class actionsByEmailCoreClass extends PMPlugin
} }
} }
$wsBaseInstance = new wsBase(); $wsBaseInstance = new WsBase();
$result = $wsBaseInstance->sendMessage( $result = $wsBaseInstance->sendMessage(
$data->APP_UID, $data->APP_UID,
$emailFrom, $emailFrom,
@@ -333,4 +334,3 @@ class actionsByEmailCoreClass extends PMPlugin
} }
} }
} }

View File

@@ -1,13 +1,17 @@
<?php <?php
/**
* Class InputDocumentDrive
*/
/** /**
* Class InputDocumentDrive * Class InputDocumentDrive
*/ */
class AppDocumentDrive class AppDocumentDrive
{ {
/** /**
* @var PMDrive $drive * @var PmDrive $drive
*/ */
private $drive; private $drive;
/** /**
@@ -28,7 +32,7 @@ class AppDocumentDrive
*/ */
public function __construct() public function __construct()
{ {
$this->drive = new PMDrive(); $this->drive = new PmDrive();
$status = $this->drive->getServiceDriveStatus(); $status = $this->drive->getServiceDriveStatus();
$status = !empty($status) ? ($status == 1 ? true : false): false; $status = !empty($status) ? ($status == 1 ? true : false): false;
$this->usersEmail = ''; $this->usersEmail = '';

File diff suppressed because it is too large Load Diff

View File

@@ -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";
}
}

View File

@@ -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";
}
}

View File

@@ -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";
}
}

View File

@@ -2,6 +2,7 @@
use ProcessMaker\Plugins\PluginRegistry; use ProcessMaker\Plugins\PluginRegistry;
class Applications class Applications
{ {
/** /**
@@ -1213,4 +1214,3 @@ class Applications
return $steps; return $steps;
} }
} }

View 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);
}
}

View File

@@ -1,34 +1,6 @@
<?php <?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'; 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. * 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 abstract class ArrayBasePeer
{ {
/** /**
* The default database name for this class * The default database name for this class
*/ */
const DATABASE_NAME = 'dbarray'; const DATABASE_NAME = 'dbarray';
/**
* The table name for this class
*/
//const TABLE_NAME = 'APPLICATION';
/** /**
* A class that can be returned by this peer. * A class that can be returned by this peer.
*/ */
@@ -858,20 +823,3 @@ abstract class ArrayBasePeer
} }
} // BaseApplicationPeer } // 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' );
}

View 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;
}
}

View 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;
}
}

View 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");
}
}

View File

@@ -31,7 +31,11 @@
* *
* @package workflow.engine.classes * @package workflow.engine.classes
*/ */
class CLI
/**
*
* @package workflow.engine.classes
*/class CLI
{ {
public static $tasks = array (); public static $tasks = array ();
public static $currentTask = null; public static $currentTask = null;
@@ -384,4 +388,3 @@ EOT;
} }
} }
} }

View File

@@ -1,32 +1,7 @@
<?php <?php
use \ProcessMaker\BusinessModel\WebEntryEvent; use \ProcessMaker\BusinessModel\WebEntryEvent;
use ProcessMaker\Core\System;
/**
* 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\Plugins\PluginRegistry; use ProcessMaker\Plugins\PluginRegistry;
/** /**
@@ -36,7 +11,6 @@ use ProcessMaker\Plugins\PluginRegistry;
*/ */
class Cases class Cases
{ {
private $appSolr = null; private $appSolr = null;
public $dir = 'ASC'; public $dir = 'ASC';
public $sort = 'APP_MSG_DATE'; public $sort = 'APP_MSG_DATE';
@@ -45,7 +19,7 @@ class Cases
public function __construct() public function __construct()
{ {
//get Solr initialization variables //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']); $this->appSolr = new AppSolr($solrConf['solr_enabled'], $solrConf['solr_host'], $solrConf['solr_instance']);
} }
} }
@@ -545,7 +519,6 @@ class Cases
$oCurUser->load($aAppDel['USR_UID']); $oCurUser->load($aAppDel['USR_UID']);
$aFields['CURRENT_USER'] = $oCurUser->getUsrFirstname() . ' ' . $oCurUser->getUsrLastname(); $aFields['CURRENT_USER'] = $oCurUser->getUsrFirstname() . ' ' . $oCurUser->getUsrLastname();
} }
} catch (Exception $oError) { } catch (Exception $oError) {
$aFields['CURRENT_USER'] = ''; $aFields['CURRENT_USER'] = '';
} }
@@ -843,7 +816,8 @@ class Cases
return $aReturn; return $aReturn;
} }
public function array_key_intersect(&$a, &$b) { public function array_key_intersect(&$a, &$b)
{
$array = array(); $array = array();
while (list($key, $value) = each($a)) { while (list($key, $value) = each($a)) {
if (isset($b[$key])) { if (isset($b[$key])) {
@@ -1271,7 +1245,6 @@ class Cases
} else { } else {
$result = true; $result = true;
} }
} catch (exception $e) { } catch (exception $e) {
throw ($e); throw ($e);
} finally { } finally {
@@ -1434,7 +1407,8 @@ class Cases
* @param array $previousTasks * @param array $previousTasks
* @return array $taskReviewed * @return array $taskReviewed
*/ */
public function getReviewedTasksRecursive($taskUid, $appUid, $previousTasks) { public function getReviewedTasksRecursive($taskUid, $appUid, $previousTasks)
{
$taskReviewed = array(); $taskReviewed = array();
$oCriteria = new Criteria('workflow'); $oCriteria = new Criteria('workflow');
$oCriteria->add(RoutePeer::ROU_NEXT_TASK, $taskUid); $oCriteria->add(RoutePeer::ROU_NEXT_TASK, $taskUid);
@@ -2343,7 +2317,6 @@ class Cases
$iPosition += 1; $iPosition += 1;
$aNextStep = null; $aNextStep = null;
if ($iPosition <= $iLastStep) { if ($iPosition <= $iLastStep) {
while ($iPosition <= $iLastStep) { while ($iPosition <= $iLastStep) {
$bAccessStep = false; $bAccessStep = false;
//step //step
@@ -2621,7 +2594,6 @@ class Cases
///-- $c->addAsColumn('USR_NAME', "CONCAT(USR_LASTNAME, ' ', USR_FIRSTNAME)"); ///-- $c->addAsColumn('USR_NAME', "CONCAT(USR_LASTNAME, ' ', USR_FIRSTNAME)");
$sDataBase = 'database_' . strtolower(DB_ADAPTER); $sDataBase = 'database_' . strtolower(DB_ADAPTER);
if (G::LoadSystemExist($sDataBase)) { if (G::LoadSystemExist($sDataBase)) {
$oDataBase = new database(); $oDataBase = new database();
$c->addAsColumn('USR_NAME', $oDataBase->concatString("USR_LASTNAME", "' '", "USR_FIRSTNAME")); $c->addAsColumn('USR_NAME', $oDataBase->concatString("USR_LASTNAME", "' '", "USR_FIRSTNAME"));
$c->addAsColumn( $c->addAsColumn(
@@ -4011,7 +3983,8 @@ class Cases
* @param string $iDelegation * @param string $iDelegation
* @return boolean * @return boolean
*/ */
public static function isUnassignedPauseCase($sAppUid, $iDelegation){ public static function isUnassignedPauseCase($sAppUid, $iDelegation)
{
$oAppDelegation = new AppDelegation(); $oAppDelegation = new AppDelegation();
$aFieldsDel = $oAppDelegation->Load($sAppUid, $iDelegation); $aFieldsDel = $oAppDelegation->Load($sAppUid, $iDelegation);
$usrUid = $aFieldsDel['USR_UID']; $usrUid = $aFieldsDel['USR_UID'];
@@ -5531,7 +5504,7 @@ class Cases
} }
if ($sTo != null) { if ($sTo != null) {
$oSpool = new spoolRun(); $oSpool = new SpoolRun();
$oSpool->setConfig($dataLastEmail['configuration']); $oSpool->setConfig($dataLastEmail['configuration']);
$oSpool->create(array( $oSpool->create(array(
@@ -5762,9 +5735,9 @@ class Cases
*/ */
public function getAllObjects($PRO_UID, $APP_UID, $TAS_UID = '', $USR_UID = '', $delIndex = 0) public function getAllObjects($PRO_UID, $APP_UID, $TAS_UID = '', $USR_UID = '', $delIndex = 0)
{ {
$ACTIONS = Array('VIEW', 'BLOCK', 'DELETE'); //TO COMPLETE $ACTIONS = array('VIEW', 'BLOCK', 'DELETE'); //TO COMPLETE
$MAIN_OBJECTS = Array(); $MAIN_OBJECTS = array();
$RESULT_OBJECTS = Array(); $RESULT_OBJECTS = array();
foreach ($ACTIONS as $action) { foreach ($ACTIONS as $action) {
$MAIN_OBJECTS[$action] = $this->getAllObjectsFrom($PRO_UID, $APP_UID, $TAS_UID, $USR_UID, $action, $delIndex); $MAIN_OBJECTS[$action] = $this->getAllObjectsFrom($PRO_UID, $APP_UID, $TAS_UID, $USR_UID, $action, $delIndex);
@@ -6455,7 +6428,7 @@ class Cases
public function getAllObjectsFromProcess($PRO_UID, $OBJ_TYPE = '%') public function getAllObjectsFromProcess($PRO_UID, $OBJ_TYPE = '%')
{ {
$RESULT = Array(); $RESULT = array();
$oCriteria = new Criteria('workflow'); $oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(AppDocumentPeer::APP_DOC_UID); $oCriteria->addSelectColumn(AppDocumentPeer::APP_DOC_UID);
$oCriteria->addSelectColumn(AppDocumentPeer::APP_UID); $oCriteria->addSelectColumn(AppDocumentPeer::APP_UID);
@@ -6753,7 +6726,7 @@ class Cases
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
if (isset($sumary) && $sumary === true) { if (isset($sumary) && $sumary === true) {
$sumary = Array(); $sumary = array();
while ($rs->next()) { while ($rs->next()) {
$nCount++; $nCount++;
$row = $rs->getRow(); $row = $rs->getRow();
@@ -6764,7 +6737,7 @@ class Cases
$sumary[$row['PRO_UID']]['name'] = $row['APP_PRO_TITLE']; $sumary[$row['PRO_UID']]['name'] = $row['APP_PRO_TITLE'];
} }
} }
return Array('count' => $nCount, 'sumary' => $sumary); return array('count' => $nCount, 'sumary' => $sumary);
} else { } else {
while ($rs->next()) { while ($rs->next()) {
$nCount++; $nCount++;
@@ -6783,7 +6756,7 @@ class Cases
*/ */
public function getAllConditionCasesCount($types, $sumary = null) public function getAllConditionCasesCount($types, $sumary = null)
{ {
$aResult = Array(); $aResult = array();
foreach ($types as $type) { foreach ($types as $type) {
$aResult[$type] = $this->getConditionCasesCount($type, $sumary); $aResult[$type] = $this->getConditionCasesCount($type, $sumary);
} }
@@ -6969,7 +6942,7 @@ class Cases
$rs = UsersPeer::doSelectRs($c); $rs = UsersPeer::doSelectRs($c);
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$rows = Array(); $rows = array();
while ($rs->next()) { while ($rs->next()) {
$rows[] = $rs->getRow(); $rows[] = $rs->getRow();
} }
@@ -7207,7 +7180,6 @@ class Cases
eval("\$criteria3->add(" . $pmTableName . "Peer::APP_UID, \$applicationUid);"); eval("\$criteria3->add(" . $pmTableName . "Peer::APP_UID, \$applicationUid);");
eval($pmTableName . "Peer::doDelete(\$criteria3);"); eval($pmTableName . "Peer::doDelete(\$criteria3);");
} catch (Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
@@ -7238,7 +7210,8 @@ class Cases
} }
} }
public function unserializeData($data) { public function unserializeData($data)
{
$unserializedData = @unserialize($data); $unserializedData = @unserialize($data);
// BUG 8134, FIX!// for single/double quote troubles // Unserialize with utf8 content get trouble // BUG 8134, FIX!// for single/double quote troubles // Unserialize with utf8 content get trouble
@@ -7310,7 +7283,8 @@ class Cases
} }
} }
private function orderStartCasesByCategoryAndName ($rows) { private function orderStartCasesByCategoryAndName($rows)
{
//now we order in category, proces_name order: //now we order in category, proces_name order:
$comparatorSequence = array( $comparatorSequence = array(
function ($a, $b) { function ($a, $b) {

View File

@@ -1,57 +1,14 @@
<?php <?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 * Extends Configuration
* *
*
* @copyright 2007 COLOSA
* @version Release: @package_version@ * @version Release: @package_version@
* @package workflow.engine.ProcessMaker * @package workflow.engine.ProcessMaker
*/ */
class Configurations // extends Configuration class Configurations // extends Configuration
{ {
public $aConfig = array(); public $aConfig = array();
private $Configuration = null; private $Configuration = null;
private $UserConfig = null; private $UserConfig = null;
@@ -169,7 +126,6 @@ class Configurations // extends Configuration
try { try {
$this->Fields = $this->Configuration->load($cfg, $obj, $pro, $usr, $app); $this->Fields = $this->Configuration->load($cfg, $obj, $pro, $usr, $app);
} catch (Exception $e) { } catch (Exception $e) {
} // the configuration does not exist } // the configuration does not exist
@@ -178,7 +134,7 @@ class Configurations // extends Configuration
} }
if (!is_array($this->aConfig)) { if (!is_array($this->aConfig)) {
$this->aConfig = Array(); $this->aConfig = array();
} }
return $this->aConfig; return $this->aConfig;
@@ -537,15 +493,15 @@ class Configurations // extends Configuration
public function getUserNameFormats() 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 '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' => '@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', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_3'));
$formats[] = Array('id' => '@userName (@firstName @lastName)', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_4')); $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_5'));
$formats[] = Array('id' => '@lastName, @firstName', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_6')); $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' => '@lastName, @firstName (@userName)', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_7'));
return $formats; return $formats;
} }
@@ -1006,4 +962,3 @@ class Configurations // extends Configuration
return $ver; return $ver;
} }
} }

View File

@@ -1,5 +1,6 @@
<?php <?php
class ConsolidatedCases class ConsolidatedCases
{ {
private $existTable; private $existTable;
@@ -51,7 +52,7 @@ class ConsolidatedCases
$oReportTables = new ReportTables(); $oReportTables = new ReportTables();
$oReportTables->deleteAllReportVars($_POST['form']['REP_TAB_UID']); $oReportTables->deleteAllReportVars($_POST['form']['REP_TAB_UID']);
$pmDyna = new pmDynaform(array()); $pmDyna = new PmDynaform(array());
$pmDyna->fields["CURRENT_DYNAFORM"] = $DynUid; $pmDyna->fields["CURRENT_DYNAFORM"] = $DynUid;
$dataDyna = $pmDyna->getDynaform(); $dataDyna = $pmDyna->getDynaform();
$json = G::json_decode($dataDyna["DYN_CONTENT"]); $json = G::json_decode($dataDyna["DYN_CONTENT"]);

View File

@@ -1,15 +1,10 @@
<?php <?php
class Dashboards class Dashboards
{ {
public function getListDashboards ($start=0, $limit=20, $sort='', $dir='DESC', $search='') 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; $limit_size = isset($limit) ? $limit: 20;
$start = isset($_REQUEST['start']) ? $_REQUEST['start'] : 0; $start = isset($_REQUEST['start']) ? $_REQUEST['start'] : 0;

View File

@@ -1,8 +1,7 @@
<?php <?php
require_once 'classes/interfaces/dashletInterface.php';
class dashletOpenVSCompleted implements DashletInterface class DashletOpenVsCompleted implements DashletInterface
{ {
const version = '1.0'; const version = '1.0';
@@ -275,7 +274,7 @@ class dashletOpenVSCompleted implements DashletInterface
public function render ($width = 300) public function render ($width = 300)
{ {
$g = new pmGauge(); $g = new PmGauge();
$g->w = $width; $g->w = $width;
$g->value = $this->value; $g->value = $this->value;

View File

@@ -1,8 +1,8 @@
<?php <?php
require_once 'classes/interfaces/dashletInterface.php';
class dashletProcessMakerCommunity implements DashletInterface
class DashletProcessMakerCommunity implements DashletInterface
{ {
const version = '1.0'; const version = '1.0';

View File

@@ -1,8 +1,8 @@
<?php <?php
require_once 'classes/interfaces/dashletInterface.php';
class dashletProcessMakerEnterprise implements DashletInterface
class DashletProcessMakerEnterprise implements DashletInterface
{ {
const version = '1.0'; const version = '1.0';

View File

@@ -1,8 +1,8 @@
<?php <?php
require_once 'classes/interfaces/dashletInterface.php'; use ProcessMaker\Core\System;
class dashletRssReader implements DashletInterface class DashletRssReader implements DashletInterface
{ {
const version = '1.0'; const version = '1.0';
@@ -54,7 +54,7 @@ class dashletRssReader implements DashletInterface
curl_setopt( $pCurl, CURLOPT_VERBOSE, false ); curl_setopt( $pCurl, CURLOPT_VERBOSE, false );
//Apply proxy settings //Apply proxy settings
$sysConf = PmSystem::getSystemConfiguration(); $sysConf = System::getSystemConfiguration();
if ($sysConf['proxy_host'] != '') { if ($sysConf['proxy_host'] != '') {
curl_setopt( $pCurl, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : '') ); curl_setopt( $pCurl, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : '') );
if ($sysConf['proxy_port'] != '') { if ($sysConf['proxy_port'] != '') {

View File

@@ -1,44 +1,6 @@
<?php <?php
/** class Dates
* 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
{ {
private $holidays = array(); private $holidays = array();
@@ -529,4 +491,3 @@ class dates
return $iDate; return $iDate;
} }
} }

View File

@@ -1,26 +1,5 @@
<?php <?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 class DbConnections
{ {
private $PRO_UID; private $PRO_UID;

View File

@@ -1,12 +1,5 @@
<?php <?php
/**
* derivation - derivation class
*
* @package workflow.engine.ProcessMaker
*
*/
class Derivation class Derivation
{ {
var $case; var $case;
@@ -1701,7 +1694,6 @@ class Derivation
function getGrpUser ($aData) function getGrpUser ($aData)
{ {
require_once 'classes/model/Content.php';
$oTasks = new Tasks(); $oTasks = new Tasks();
$oGroups = new Groups(); $oGroups = new Groups();
$oContent = new Content(); $oContent = new Content();

View File

@@ -1,36 +1,5 @@
<?php <?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 class DynaFormField extends DBTable
{ {

View 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);
}
}

View File

@@ -1,338 +1,13 @@
<?php <?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 * Created on 21/12/2007
* Dynaform - Dynaform class * Dynaform - Dynaform
*
* @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);
}
/** /**
* DynaformEditorAjax - DynaformEditorAjax class * DynaformEditorAjax - DynaformEditorAjax class
* *
* @package workflow.engine.classes * @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 * @param var $post
* @return void * @return void
*/ */
public function dynaformEditorAjax($post) public function __construct($post)
{ {
$this->_run($post); $this->_run($post);
} }
@@ -442,7 +117,7 @@ class dynaformEditorAjax extends dynaformEditor implements iDynaformEditorAjax
$form = new Form($fileTmp, PATH_DYNAFORM, SYS_LANG, true); $form = new Form($fileTmp, PATH_DYNAFORM, SYS_LANG, true);
//Navigation Bar //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) )), SYS_LANG, PATH_XMLFORM, $form)
), $form->fields); ), $form->fields);
@@ -512,7 +187,7 @@ class dynaformEditorAjax extends dynaformEditor implements iDynaformEditorAjax
$form = new Form($fileTmp, PATH_DYNAFORM, SYS_LANG, true); $form = new Form($fileTmp, PATH_DYNAFORM, SYS_LANG, true);
//Navigation Bar //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) )), SYS_LANG, PATH_XMLFORM, $form)
), $form->fields); ), $form->fields);
@@ -890,7 +565,7 @@ class dynaformEditorAjax extends dynaformEditor implements iDynaformEditorAjax
if (file_exists(PATH_DYNAFORM . $file . '.html')) { if (file_exists(PATH_DYNAFORM . $file . '.html')) {
$copyHtml = implode('', file(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"); $fcopy = fopen(PATH_DYNAFORM . $file . '.xml', "w");
fwrite($fcopy, $copy); fwrite($fcopy, $copy);
fclose($fcopy); fclose($fcopy);
@@ -930,7 +605,7 @@ class dynaformEditorAjax extends dynaformEditor implements iDynaformEditorAjax
//return(array('response'=>$tmp['useTmpCopy'])); //return(array('response'=>$tmp['useTmpCopy']));
if (isset($tmp['useTmpCopy'])) { if (isset($tmp['useTmpCopy'])) {
//return(array('response'=>PATH_DYNAFORM . $file . '.xml')); //return(array('response'=>PATH_DYNAFORM . $file . '.xml'));
if ($file !== dynaformEditor::_getFilename($file)) { if ($file !== DynaformEditor::_getFilename($file)) {
// return(array('response'=>PATH_DYNAFORM . $file . '.xml')); // return(array('response'=>PATH_DYNAFORM . $file . '.xml'));
if (file_exists($xmlFile)) { if (file_exists($xmlFile)) {
unlink($xmlFile); unlink($xmlFile);
@@ -988,7 +663,7 @@ class dynaformEditorAjax extends dynaformEditor implements iDynaformEditorAjax
($sp['ENABLETEMPLATE']!=$P['ENABLETEMPLATE']) || ($sp['ENABLETEMPLATE']!=$P['ENABLETEMPLATE']) ||
($sp['MODE']!=$P['MODE']) */ ($sp['MODE']!=$P['MODE']) */
/* Compare copies */ /* Compare copies */
$fileOrigen = dynaformEditor::_getFilename($file); $fileOrigen = DynaformEditor::_getFilename($file);
$copy = implode('', file(PATH_DYNAFORM . $file . '.xml')); $copy = implode('', file(PATH_DYNAFORM . $file . '.xml'));
$origen = implode('', file(PATH_DYNAFORM . $fileOrigen . '.xml')); $origen = implode('', file(PATH_DYNAFORM . $fileOrigen . '.xml'));
$copyHTML = file_exists(PATH_DYNAFORM . $file . '.html') ? implode('', file(PATH_DYNAFORM . $file . '.html')) : false; $copyHTML = file_exists(PATH_DYNAFORM . $file . '.html') ? implode('', file(PATH_DYNAFORM . $file . '.html')) : false;

View File

@@ -1,15 +1,6 @@
<?php <?php
require_once ("classes" . PATH_SEP . "class.enterpriseUtils.php");
if (!defined("PM_VERSION")) { class EnterpriseClass extends PMPlugin
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
{ {
public function __construct() public function __construct()
{ {
@@ -108,7 +99,7 @@ class enterpriseClass extends PMPlugin
public function enterpriseLimitCreateUser() public function enterpriseLimitCreateUser()
{ {
$oServerConf = &serverConf::getSingleton(); $oServerConf = &ServerConf::getSingleton();
$infoLicense =$oServerConf->getProperty('LICENSE_INFO'); $infoLicense =$oServerConf->getProperty('LICENSE_INFO');
if (isset($infoLicense[SYS_SYS]['LIMIT_USERS'])) { if (isset($infoLicense[SYS_SYS]['LIMIT_USERS'])) {
$criteria = new Criteria('workflow'); $criteria = new Criteria('workflow');
@@ -156,8 +147,3 @@ class enterpriseClass extends PMPlugin
} }
} }
} }
if (!class_exists("pmLicenseManager")) {
require_once ("classes" . PATH_SEP . "class.pmLicenseManager.php");
}

View File

@@ -1,5 +1,6 @@
<?php <?php
require_once ("classes/model/Configuration.php");
use ProcessMaker\Core\System;
class EnterpriseUtils class EnterpriseUtils
{ {
@@ -40,7 +41,7 @@ class EnterpriseUtils
curl_setopt($ch, CURLOPT_VERBOSE, true); curl_setopt($ch, CURLOPT_VERBOSE, true);
//Apply proxy settings //Apply proxy settings
$sysConf = PmSystem::getSystemConfiguration(); $sysConf = System::getSystemConfiguration();
if (isset($sysConf['proxy_host'])) { if (isset($sysConf['proxy_host'])) {
if ($sysConf['proxy_host'] != '') { if ($sysConf['proxy_host'] != '') {
curl_setopt($ch, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : '')); curl_setopt($ch, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : ''));
@@ -149,4 +150,3 @@ class EnterpriseUtils
return $sw; return $sw;
} }
} }

View 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;
}
}

View File

@@ -1,4 +1,5 @@
<?php <?php
class FieldValidator class FieldValidator
{ {
/** /**
@@ -240,4 +241,3 @@ class FieldValidator
return $result; return $result;
} }
} }

View File

@@ -25,6 +25,7 @@
* *
*/ */
class FileCache class FileCache
{ {
function __construct ($dir) function __construct ($dir)
@@ -122,4 +123,3 @@ class FileCache
return null; return null;
} }
} }

View File

@@ -1,4 +1,5 @@
<?php <?php
class FormBatchRouting extends Form class FormBatchRouting extends Form
{ {
public function getVars($bWhitSystemVars = true) public function getVars($bWhitSystemVars = true)
@@ -18,4 +19,3 @@ class FormBatchRouting extends Form
return $aFields; return $aFields;
} }
} }

View File

@@ -1,34 +1,7 @@
<?php <?php
/** /**
* class.groups.php * Groups - Groups
*
* @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 class * Groups - Groups class
* *
@@ -463,4 +436,3 @@ class Groups
} }
} }
} }

View File

@@ -1,35 +1,7 @@
<?php <?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'; require_once 'propel/util/BasePeer.php';
// The object class -- needed for instanceof checks in this class. // The object
// 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. * Base static class for performing query and update operations on the 'APPLICATION' table.
* *
@@ -702,20 +674,3 @@ abstract class GulliverBasePeer
} }
} // BaseApplicationPeer } // 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' );
}

View 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");
}
}

View File

@@ -0,0 +1,6 @@
<?php
interface IDynaformEditorAjax
{
}

View File

@@ -651,7 +651,7 @@ class IndicatorsCalculator
private function pdoConnection() { private function pdoConnection() {
$currentWS = defined('SYS_SYS') ? SYS_SYS : 'Wokspace Undefined'; $currentWS = defined('SYS_SYS') ? SYS_SYS : 'Wokspace Undefined';
$workSpace = new workspaceTools($currentWS); $workSpace = new WorkspaceTools($currentWS);
$arrayHost = explode(':', $workSpace->dbHost); $arrayHost = explode(':', $workSpace->dbHost);
$host = "host=".$arrayHost[0]; $host = "host=".$arrayHost[0];
$port = count($arrayHost) > 1 ? ";port=".$arrayHost[1] : ""; $port = count($arrayHost) > 1 ? ";port=".$arrayHost[1] : "";

View 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";
}
}

View File

@@ -38,7 +38,11 @@ if (! defined( 'JAVA_BRIDGE_HOST' )) {
* *
* @package workflow.engine.classes * @package workflow.engine.classes
*/ */
class JavaBridgePM
/**
*
* @package workflow.engine.classes
*/class JavaBridgePM
{ {
public $JavaBridgeDir = JAVA_BRIDGE_PATH; public $JavaBridgeDir = JAVA_BRIDGE_PATH;
public $JavaBridgePort = JAVA_BRIDGE_PORT; public $JavaBridgePort = JAVA_BRIDGE_PORT;
@@ -174,4 +178,3 @@ class JavaBridgePM
printf( "saved %s bytes in file %s \n", $iSize, $reportFilename ); printf( "saved %s bytes in file %s \n", $iSize, $reportFilename );
} }
} }

View File

@@ -1,5 +1,6 @@
<?php <?php
class labelsGmail class labelsGmail
{ {
function listLabels($service) function listLabels($service)
@@ -97,9 +98,9 @@ class labelsGmail
//The Subject to search the email //The Subject to search the email
$subject = "[PM] " . $proName . " (" . $index . ") Case: " . $appNumber; $subject = "[PM] " . $proName . " (" . $index . ") Case: " . $appNumber;
$pmGoogle = new PMGoogleApi(); $pmGoogle = new PmGoogleApi();
$pmGoogle->setUser($mail); $pmGoogle->setUser($mail);
$pmGoogle->setScope(PMGoogleApi::GMAIL_MODIFY); $pmGoogle->setScope(PmGoogleApi::GMAIL_MODIFY);
$client = $pmGoogle->serviceClient(); $client = $pmGoogle->serviceClient();
$service = new Google_Service_Gmail($client); $service = new Google_Service_Gmail($client);
$labelsIds = $this->getLabelsIds($service); $labelsIds = $this->getLabelsIds($service);
@@ -147,9 +148,9 @@ class labelsGmail
//The Subject to search the email //The Subject to search the email
$subject = "[PM] " . $proName . " (" . $index . ") Case: " . $appNumber; $subject = "[PM] " . $proName . " (" . $index . ") Case: " . $appNumber;
$pmGoogle = new PMGoogleApi(); $pmGoogle = new PmGoogleApi();
$pmGoogle->setUser($mail); $pmGoogle->setUser($mail);
$pmGoogle->setScope(PMGoogleApi::GMAIL_MODIFY); $pmGoogle->setScope(PmGoogleApi::GMAIL_MODIFY);
$client = $pmGoogle->serviceClient(); $client = $pmGoogle->serviceClient();
$service = new Google_Service_Gmail($client); $service = new Google_Service_Gmail($client);
$labelsIds = $this->getLabelsIds($service); $labelsIds = $this->getLabelsIds($service);
@@ -201,11 +202,11 @@ class labelsGmail
//The Subject to search the email //The Subject to search the email
$subject = "[PM] " . $proName . " (" . $index . ") Case: " . $appNumber; $subject = "[PM] " . $proName . " (" . $index . ") Case: " . $appNumber;
$pmGoogle = new PMGoogleApi(); $pmGoogle = new PmGoogleApi();
$pmGoogle->setUser($mail); $pmGoogle->setUser($mail);
$pmGoogle->setScope(PMGoogleApi::GMAIL_MODIFY); $pmGoogle->setScope(PmGoogleApi::GMAIL_MODIFY);
$client = $pmGoogle->serviceClient(); $client = $pmGoogle->serviceClient();
$service = new Google_Service_Gmail($client); $service = new Google_Service_Gmail($client);
@@ -280,9 +281,9 @@ class labelsGmail
//The Subject to search the email //The Subject to search the email
$subject = "[PM] " . $proName . " (" . $index . ") Case: " . $appNumber; $subject = "[PM] " . $proName . " (" . $index . ") Case: " . $appNumber;
$pmGoogle = new PMGoogleApi(); $pmGoogle = new PmGoogleApi();
$pmGoogle->setUser($mail); $pmGoogle->setUser($mail);
$pmGoogle->setScope(PMGoogleApi::GMAIL_MODIFY); $pmGoogle->setScope(PmGoogleApi::GMAIL_MODIFY);
$client = $pmGoogle->serviceClient(); $client = $pmGoogle->serviceClient();
$service = new Google_Service_Gmail($client); $service = new Google_Service_Gmail($client);
$labelsIds = $this->getLabelsIds($service); $labelsIds = $this->getLabelsIds($service);
@@ -328,11 +329,11 @@ class labelsGmail
*/ */
public function deletePMGmailLabels($mail) public function deletePMGmailLabels($mail)
{ {
$pmGoogle = new PMGoogleApi(); $pmGoogle = new PmGoogleApi();
$pmGoogle->setUser($mail); $pmGoogle->setUser($mail);
$pmGoogle->setScope(PMGoogleApi::GMAIL_MODIFY); $pmGoogle->setScope(PmGoogleApi::GMAIL_MODIFY);
$client = $pmGoogle->serviceClient(); $client = $pmGoogle->serviceClient();
$service = new Google_Service_Gmail($client); $service = new Google_Service_Gmail($client);

View File

@@ -1,39 +1,10 @@
<?php <?php
/** /**
* class.ldapAdvanced.php * class.ldapAdvanced.php
* LDAP plugin for the RBAC class. This class encapsulates all the methods required in order to bind * LDAP plugin for the RBAC class. This
* ProcessMaker and a Ldap Directory server.
*
* @author
* Fernando Ontiveros
* Colosa
* @copyright
* Copyright (C) 2004 - 2008 Colosa Inc.
* @package plugins.ldapAdvanced.classes
*/ */
class LdapAdvanced
// 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
{ {
/** /**
* The authsource id * The authsource id
@@ -69,7 +40,7 @@ class ldapAdvanced
* Object where an rbac instance is set * Object where an rbac instance is set
* @var Object * @var Object
*/ */
static private $instance = null; private static $instance = null;
private $arrayObjectClassFilter = array( private $arrayObjectClassFilter = array(
"user" => "|(objectclass=inetorgperson)(objectclass=organizationalperson)(objectclass=person)(objectclass=user)", "user" => "|(objectclass=inetorgperson)(objectclass=organizationalperson)(objectclass=person)(objectclass=user)",

View File

@@ -1,31 +1,6 @@
<?php <?php
/**
* Project: Distrubution License Class class license_application extends Padl
* 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
{ {
/** /**
* The number of allowed differences between the $_SERVER vars and the vars * 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']; return (empty($data['RESULT'])) ? 'SOCKET_FAILED' : $data['RESULT'];
} }
} }

View 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");
}
}

View File

@@ -1,15 +1,6 @@
<?php <?php
/** class Net
* LastModification 30/05/2008
*/
/**
*
* @package workflow.engine.classes
*/
class NET
{ {
public $hostname; public $hostname;
public $ip; public $ip;
@@ -208,7 +199,6 @@ class NET
*/ */
public function tryConnectServer($pDbDriver, array $arrayServerData = array(), $dbsEncode = "") public function tryConnectServer($pDbDriver, array $arrayServerData = array(), $dbsEncode = "")
{ {
$filter = new InputFilter(); $filter = new InputFilter();
$this->ip = $filter->validateInput($this->ip); $this->ip = $filter->validateInput($this->ip);
$this->db_port = $filter->validateInput($this->db_port, 'int'); $this->db_port = $filter->validateInput($this->db_port, 'int');
@@ -331,7 +321,6 @@ class NET
*/ */
public function tryOpenDataBase($pDbDriver, array $arrayServerData = array(), $dbsEncode = "") public function tryOpenDataBase($pDbDriver, array $arrayServerData = array(), $dbsEncode = "")
{ {
$filter = new InputFilter(); $filter = new InputFilter();
$this->ip = $filter->validateInput($this->ip); $this->ip = $filter->validateInput($this->ip);
$this->db_port = $filter->validateInput($this->db_port, 'int'); $this->db_port = $filter->validateInput($this->db_port, 'int');
@@ -489,7 +478,6 @@ class NET
$value = 'none'; $value = 'none';
$sDataBase = 'database_' . strtolower(DB_ADAPTER); $sDataBase = 'database_' . strtolower(DB_ADAPTER);
if (G::LoadSystemExist($sDataBase)) { if (G::LoadSystemExist($sDataBase)) {
$oDataBase = new database(); $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);
} }
@@ -578,17 +566,3 @@ class NET
return $this->errstr; return $this->errstr;
} }
} }
/**
*
* @package workflow.engine.classes
*/
class Stat
{
public $stutus;
public function __construct ()
{
$this->status = false;
}
}

View 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;
}
}
}

View 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 = '';
}
}

View File

@@ -1,20 +1,8 @@
<?php <?php
/** use ProcessMaker\Core\System;
* class, helping to set some not desirable settings but necesary
* @author reav
*
*/
abstract class patch class P11835 extends Patch
{
static protected $isPathchable = false;
static public $dbAdapter = 'mysql';
abstract static public function isApplicable();
abstract static public function execute();
}
class p11835 extends patch
{ {
/* /*
* Note.- Use before upgrade DB. * Note.- Use before upgrade DB.
@@ -30,7 +18,7 @@ class p11835 extends patch
$rs->next(); $rs->next();
while($row = $rs->getRow()) { while($row = $rs->getRow()) {
if ($row ['Field'] == "TAS_GROUP_VARIABLE") { if ($row ['Field'] == "TAS_GROUP_VARIABLE") {
$version = PmSystem::getVersion (); $version = System::getVersion ();
$version = explode('-',$version); $version = explode('-',$version);
if ($version[0] == '2.5.1') { if ($version[0] == '2.5.1') {
echo "Version " . $version[0] . " Patch\n"; echo "Version " . $version[0] . " Patch\n";
@@ -98,7 +86,7 @@ class p11835 extends patch
$arrayHotfix = $conf->getConfiguration("HOTFIX", ""); $arrayHotfix = $conf->getConfiguration("HOTFIX", "");
$arrayHotfix = (is_array($arrayHotfix))? $arrayHotfix : array($arrayHotfix); $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)) { if (($pmVersion == "2.5.2.4" || $pmVersion == "2.8") && !in_array("15394", $arrayHotfix)) {
$cnn = Propel::getConnection("workflow"); $cnn = Propel::getConnection("workflow");
@@ -116,4 +104,3 @@ class p11835 extends patch
echo $count . " records where patched to use SELF_SERVICE feature.\n"; echo $count . " records where patched to use SELF_SERVICE feature.\n";
} }
} }

View File

@@ -1,28 +1,5 @@
<?php <?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 class PMLicensedFeatures
{ {
private $featuresDetails = array (); private $featuresDetails = array ();
@@ -336,7 +313,7 @@ class PMLicensedFeatures
$addons = AddonsManagerPeer::doSelect($criteria); $addons = AddonsManagerPeer::doSelect($criteria);
foreach ($addons as $addon) { foreach ($addons as $addon) {
$this->features[] = $addon->getAddonId(); $this->features[] = $addon->getAddonId();
$detail = new featuresDetail($addon->getAddonNick(), $addon->getAddonDescription()); $detail = new FeaturesDetail($addon->getAddonNick(), $addon->getAddonDescription());
$this->featuresDetails[$addon->getAddonId()] = $detail; $this->featuresDetails[$addon->getAddonId()] = $detail;
} }
} }
@@ -357,14 +334,10 @@ class PMLicensedFeatures
/*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/
public function verifyfeature ($featureName) public function verifyfeature ($featureName)
{ {
if (!class_exists("pmLicenseManager")) { $licenseManager = PmLicenseManager::getSingleton(false);
require_once ("classes" . PATH_SEP . "class.pmLicenseManager.php");
}
$licenseManager = pmLicenseManager::getSingleton(false);
$_SESSION['__sw__'] = true; $_SESSION['__sw__'] = true;
$padl = new padl(); $padl = new Padl();
$value = $padl->_decrypt($featureName); $value = $padl->_decrypt($featureName);
if (is_array($value)) { if (is_array($value)) {

View File

@@ -1,90 +1,8 @@
<?php <?php
/** use ProcessMaker\Core\System;
* 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\Plugins\PluginRegistry; 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 class PMPluginRegistry
{ {
private $_aPluginDetails = array (); private $_aPluginDetails = array ();
@@ -212,7 +130,7 @@ class PMPluginRegistry
return; 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 )) { if (isset( $plugin->aWorkspaces )) {
$detail->aWorkspaces = $plugin->aWorkspaces; $detail->aWorkspaces = $plugin->aWorkspaces;
@@ -585,7 +503,7 @@ class PMPluginRegistry
public function uninstallPluginWorkspaces ($arrayPlugin) public function uninstallPluginWorkspaces ($arrayPlugin)
{ {
$workspace = PmSystem::listWorkspaces(); $workspace = System::listWorkspaces();
foreach ($workspace as $indexWS => $ws) { foreach ($workspace as $indexWS => $ws) {
$wsPathDataSite = PATH_DATA . "sites" . PATH_SEP . $ws->name . PATH_SEP; $wsPathDataSite = PATH_DATA . "sites" . PATH_SEP . $ws->name . PATH_SEP;
@@ -1183,11 +1101,8 @@ class PMPluginRegistry
public function setupPlugins () public function setupPlugins ()
{ {
try { try {
require_once(PATH_CORE . "methods" . PATH_SEP . "enterprise" . PATH_SEP . "enterprise.php");
require_once("class.serverConfiguration.php");
$iPlugins = 0; $iPlugins = 0;
$oServerConf = & serverConf::getSingleton(); $oServerConf = & ServerConf::getSingleton();
$oServerConf->addPlugin( SYS_SYS, $this->_aPluginDetails ); $oServerConf->addPlugin( SYS_SYS, $this->_aPluginDetails );
foreach ($this->_aPluginDetails as $namespace => $detail) { foreach ($this->_aPluginDetails as $namespace => $detail) {
if (isset( $detail->enabled ) && $detail->enabled) { if (isset( $detail->enabled ) && $detail->enabled) {
@@ -1294,7 +1209,7 @@ class PMPluginRegistry
//Found a License //Found a License
if (class_exists( 'pmLicenseManager' )) { if (class_exists( 'pmLicenseManager' )) {
$sSerializedFile = PATH_DATA_SITE . 'lmn.singleton'; $sSerializedFile = PATH_DATA_SITE . 'lmn.singleton';
$pmLicenseManagerO = & pmLicenseManager::getSingleton(); $pmLicenseManagerO = & PmLicenseManager::getSingleton();
if (file_exists( $sSerializedFile )) { if (file_exists( $sSerializedFile )) {
$pmLicenseManagerO->unSerializeInstance( file_get_contents( $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) { if (isset($pluginDetails->aWorkspaces) && is_array($pluginDetails->aWorkspaces) && count($pluginDetails->aWorkspaces) > 0) {
$arrayWorkspace = array(); $arrayWorkspace = array();
foreach (PmSystem::listWorkspaces() as $value) { foreach (System::listWorkspaces() as $value) {
$workspaceTools = $value; $workspaceTools = $value;
$arrayWorkspace[] = $workspaceTools->name; $arrayWorkspace[] = $workspaceTools->name;

View File

@@ -1,35 +1,4 @@
<?php <?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 class PMmemcached
{ {
@@ -65,7 +34,6 @@ class PMmemcached
$this->version = $this->mem->getVersion(); $this->version = $this->mem->getVersion();
} }
} else { } else {
require_once ("classes" . PATH_SEP . "class.fileCache.php");
//Create cache folder //Create cache folder
$cacheFolder = PATH_DATA . "sites". PATH_SEP . $workspace . PATH_SEP . "cachefiles" . PATH_SEP; $cacheFolder = PATH_DATA . "sites". PATH_SEP . $workspace . PATH_SEP . "cachefiles" . PATH_SEP;
@@ -218,4 +186,3 @@ class PMmemcached
echo "</table>"; echo "</table>";
} }
} }

View File

@@ -26,7 +26,37 @@
* @history--------------------------------------------- * @history---------------------------------------------
* see CHANGELOG * 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. * hash key 1 used to encrypt the generate key data.
@@ -236,7 +266,7 @@ class padl
} }
// Proxy settings // Proxy settings
$sysConf = PmSystem::getSystemConfiguration(); $sysConf = System::getSystemConfiguration();
if ($sysConf['proxy_host'] != '') { if ($sysConf['proxy_host'] != '') {
if (!is_array($params['http'])) { if (!is_array($params['http'])) {
$params['http'] = array(); $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>";
}

View 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();
}

View 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;
}
}
}

View File

@@ -2,11 +2,8 @@
use ProcessMaker\Plugins\PluginRegistry; 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 // Own properties

View File

@@ -6,8 +6,7 @@
* @package workflow.engine.class * @package workflow.engine.class
* *
*/ */
class PmDrive extends PmGoogleApi
class PMDrive extends PMGoogleApi
{ {
private $folderIdPMDrive = ''; private $folderIdPMDrive = '';
private $folderNamePMDrive; private $folderNamePMDrive;

View File

@@ -1,13 +1,12 @@
<?php <?php
use ProcessMaker\Core\System;
/** /**
* class.pmDynaform.php
* Implementing pmDynaform library in the running case. * Implementing pmDynaform library in the running case.
* *
* @author Roly Rudy Gutierrez Pinto
* @package engine.classes * @package engine.classes
*/ */class PmDynaform
class pmDynaform
{ {
public static $instance = null; public static $instance = null;
@@ -36,7 +35,7 @@ class pmDynaform
$this->context = \Bootstrap::getDefaultContextLog(); $this->context = \Bootstrap::getDefaultContextLog();
$this->dataSources = array("database", "dataVariable"); $this->dataSources = array("database", "dataVariable");
$this->pathRTLCss = '/lib/pmdynaform/build/css/PMDynaform-rtl.css'; $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->isRTL = ($this->serverConf->isRtl(SYS_LANG)) ? 'true' : 'false';
$this->fields = $fields; $this->fields = $fields;
$this->propertiesToExclude = array('dataVariable'); $this->propertiesToExclude = array('dataVariable');
@@ -1059,7 +1058,7 @@ class pmDynaform
$javascript = " $javascript = "
<script type=\"text/javascript\"> <script type=\"text/javascript\">
var jsondata = " . G::json_encode($json) . "; var jsondata = " . G::json_encode($json) . ";
var httpServerHostname = \"" . PmSystem::getHttpServerHostnameRequestsFrontEnd() . "\"; var httpServerHostname = \"" . System::getHttpServerHostnameRequestsFrontEnd() . "\";
var pm_run_outside_main_app = \"\"; var pm_run_outside_main_app = \"\";
var dyn_uid = \"" . $this->fields["CURRENT_DYNAFORM"] . "\"; var dyn_uid = \"" . $this->fields["CURRENT_DYNAFORM"] . "\";
var __DynaformName__ = \"" . $this->record["PRO_UID"] . "_" . $this->record["DYN_UID"] . "\"; var __DynaformName__ = \"" . $this->record["PRO_UID"] . "_" . $this->record["DYN_UID"] . "\";
@@ -1120,7 +1119,7 @@ class pmDynaform
$javascrip = "" . $javascrip = "" .
"<script type='text/javascript'>\n" . "<script type='text/javascript'>\n" .
"var jsondata = " . G::json_encode($json) . ";\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 pm_run_outside_main_app = null;\n" .
"var dyn_uid = '" . $this->fields["CURRENT_DYNAFORM"] . "';\n" . "var dyn_uid = '" . $this->fields["CURRENT_DYNAFORM"] . "';\n" .
"var __DynaformName__ = '" . $this->record["PRO_UID"] . "_" . $this->record["DYN_UID"] . "';\n" . "var __DynaformName__ = '" . $this->record["PRO_UID"] . "_" . $this->record["DYN_UID"] . "';\n" .
@@ -1199,7 +1198,7 @@ class pmDynaform
$javascrip = "" . $javascrip = "" .
"<script type='text/javascript'>\n" . "<script type='text/javascript'>\n" .
"var jsondata = " . $this->json_encode($json) . ";\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 pm_run_outside_main_app = '" . $this->fields["PM_RUN_OUTSIDE_MAIN_APP"] . "';\n" .
"var dyn_uid = '" . $this->fields["CURRENT_DYNAFORM"] . "';\n" . "var dyn_uid = '" . $this->fields["CURRENT_DYNAFORM"] . "';\n" .
"var __DynaformName__ = '" . $this->record["PRO_UID"] . "_" . $this->record["DYN_UID"] . "';\n" . "var __DynaformName__ = '" . $this->record["PRO_UID"] . "_" . $this->record["DYN_UID"] . "';\n" .
@@ -1256,7 +1255,7 @@ class pmDynaform
$javascrip = " $javascrip = "
<script type=\"text/javascript\"> <script type=\"text/javascript\">
var jsondata = " . G::json_encode($json) . "; var jsondata = " . G::json_encode($json) . ";
var httpServerHostname = \"" . PmSystem::getHttpServerHostnameRequestsFrontEnd() . "\"; var httpServerHostname = \"" . System::getHttpServerHostnameRequestsFrontEnd() . "\";
var pm_run_outside_main_app = null; var pm_run_outside_main_app = null;
var dyn_uid = \"" . $this->fields["CURRENT_DYNAFORM"] . "\"; var dyn_uid = \"" . $this->fields["CURRENT_DYNAFORM"] . "\";
var __DynaformName__ = \"" . $this->fields["PRO_UID"] . "_" . $this->fields["CURRENT_DYNAFORM"] . "\"; var __DynaformName__ = \"" . $this->fields["PRO_UID"] . "_" . $this->fields["CURRENT_DYNAFORM"] . "\";
@@ -1300,7 +1299,7 @@ class pmDynaform
$javascrip = "" . $javascrip = "" .
"<script type='text/javascript'>\n" . "<script type='text/javascript'>\n" .
"var jsondata = " . G::json_encode($json) . ";\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 pm_run_outside_main_app = null;\n" .
"var dyn_uid = '" . $this->fields["CURRENT_DYNAFORM"] . "';\n" . "var dyn_uid = '" . $this->fields["CURRENT_DYNAFORM"] . "';\n" .
"var __DynaformName__ = null;\n" . "var __DynaformName__ = null;\n" .
@@ -1342,7 +1341,7 @@ class pmDynaform
$javascrip = "" . $javascrip = "" .
"<script type='text/javascript'>\n" . "<script type='text/javascript'>\n" .
"var jsondata = " . G::json_encode($json) . ";\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 pm_run_outside_main_app = null;\n" .
"var dyn_uid = '" . $this->fields["CURRENT_DYNAFORM"] . "';\n" . "var dyn_uid = '" . $this->fields["CURRENT_DYNAFORM"] . "';\n" .
"var __DynaformName__ = null;\n" . "var __DynaformName__ = null;\n" .
@@ -1384,7 +1383,7 @@ class pmDynaform
"var pathRTLCss = '" . $this->pathRTLCss . "';\n" . "var pathRTLCss = '" . $this->pathRTLCss . "';\n" .
"var delIndex = " . (isset($this->fields["DEL_INDEX"]) ? $this->fields["DEL_INDEX"] : "0") . ";\n" . "var delIndex = " . (isset($this->fields["DEL_INDEX"]) ? $this->fields["DEL_INDEX"] : "0") . ";\n" .
"var jsonData = " . $this->json_encode($json) . ";\n" . "var jsonData = " . $this->json_encode($json) . ";\n" .
"var httpServerHostname = \"" . PmSystem::getHttpServerHostnameRequestsFrontEnd() . "\";\n" . "var httpServerHostname = \"" . System::getHttpServerHostnameRequestsFrontEnd() . "\";\n" .
"var leaveCaseWarning = " . $this->getLeaveCaseWarning() . ";\n" . "var leaveCaseWarning = " . $this->getLeaveCaseWarning() . ";\n" .
$js . $js .
"</script>"; "</script>";
@@ -1406,7 +1405,7 @@ class pmDynaform
$javascrip = "" . $javascrip = "" .
"<script type='text/javascript'>\n" . "<script type='text/javascript'>\n" .
"var jsondata = " . G::json_encode($json) . ";\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 pm_run_outside_main_app = null;\n" .
"var dyn_uid = '" . $currentDynaform . "';\n" . "var dyn_uid = '" . $currentDynaform . "';\n" .
"var __DynaformName__ = null;\n" . "var __DynaformName__ = null;\n" .

View File

@@ -1,6 +1,7 @@
<?php <?php
class pmGauge
class PmGauge
{ {
/** /**
@@ -280,4 +281,3 @@ class pmGauge
imagettftext($im, 9, 0, $centerX, $centerY, $black, $fontArial, $textToDisplay); imagettftext($im, 9, 0, $centerX, $centerY, $black, $fontArial, $textToDisplay);
} }
} }

View File

@@ -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'; 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 = 'https://www.googleapis.com/auth/drive';
const DRIVE_FILE = 'https://www.googleapis.com/auth/drive.file'; const DRIVE_FILE = 'https://www.googleapis.com/auth/drive.file';

View File

@@ -2,28 +2,29 @@
use ProcessMaker\Plugins\PluginRegistry; use ProcessMaker\Plugins\PluginRegistry;
require_once PATH_CORE . 'classes' . PATH_SEP . 'class.enterpriseUtils.php';
/** /**
* class.pmLicenseManager.php * class.pmLicenseManager.php
* *
*/ */
class pmLicenseManager
/**
* class.pmLicenseManager.php
*
*/class PmLicenseManager
{ {
private static $instance = null; private static $instance = null;
public function __construct($flagActivatePlugins = true) public function __construct($flagActivatePlugins = true)
{ {
$oServerConf = &serverConf::getSingleton(); $oServerConf = &ServerConf::getSingleton();
$oServerConf->setProperty('LOGIN_NO_WS', true); $oServerConf->setProperty('LOGIN_NO_WS', true);
//to do: this files probably needs to be in core, since they are GPL2 //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.lib.php');
//include_once (PATH_PLUGINS . 'enterprise' . PATH_SEP . 'classes' . PATH_SEP . 'class.license.app.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 //searching .dat files in workspace folder
$server_array = $_SERVER; $server_array = $_SERVER;
@@ -119,7 +120,7 @@ class pmLicenseManager
public static function getSingleton($flagActivatePlugins = true) public static function getSingleton($flagActivatePlugins = true)
{ {
if (self::$instance == null) { if (self::$instance == null) {
self::$instance = new pmLicenseManager($flagActivatePlugins); self::$instance = new PmLicenseManager($flagActivatePlugins);
} }
return self::$instance; return self::$instance;
} }
@@ -379,7 +380,7 @@ class pmLicenseManager
return false; return false;
} else { } else {
$oServerConf = & serverConf::getSingleton (); $oServerConf = & ServerConf::getSingleton ();
$oServerConf->setProperty ( 'ACTIVE_LICENSE',array(SYS_SYS => $path)); $oServerConf->setProperty ( 'ACTIVE_LICENSE',array(SYS_SYS => $path));
$this->saveDataLicense( $results, $path, $redirect ); $this->saveDataLicense( $results, $path, $redirect );
if ($redirect) { if ($redirect) {
@@ -510,4 +511,3 @@ class pmLicenseManager
return unserialize(G::decrypt($this->serial, file_get_contents(PATH_PLUGINS . 'enterprise/data/default'))); return unserialize(G::decrypt($this->serial, file_get_contents(PATH_PLUGINS . 'enterprise/data/default')));
} }
} }

View 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