/** * Constructs a new Log_display object. * * @param string $name Ignored. * @param string $ident The identity string. * @param array $conf The configuration array. * @param int $level Log messages up to and including this level. * @access public */ function Log_display($name = '', $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG) { if (!class_exists('G')) { $realdocuroot = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']); $docuroot = explode('/', $realdocuroot); array_pop($docuroot); $pathhome = implode('/', $docuroot) . '/'; array_pop($docuroot); $pathTrunk = implode('/', $docuroot) . '/'; require_once $pathTrunk . 'gulliver/system/class.g.php'; } $this->_id = G::encryptOld(microtime()); $this->_ident = $ident; $this->_mask = Log::UPTO($level); if (isset($conf['error_prepend'])) { $this->_error_prepend = $conf['error_prepend']; } else { $this->_error_prepend = ini_get('error_prepend_string'); } if (isset($conf['error_append'])) { $this->_error_append = $conf['error_append']; } else { $this->_error_append = ini_get('error_append_string'); } if (isset($conf['linebreak'])) { $this->_linebreak = $conf['linebreak']; } }
/** * Constructs a new Log_firebug object. * * @param string $name Ignored. * @param string $ident The identity string. * @param array $conf The configuration array. * @param int $level Log messages up to and including this level. * @access public */ function Log_firebug($name = '', $ident = 'PHP', $conf = array(), $level = PEAR_LOG_DEBUG) { if (!class_exists('G')) { $realdocuroot = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']); $docuroot = explode('/', $realdocuroot); array_pop($docuroot); $pathhome = implode('/', $docuroot) . '/'; array_pop($docuroot); $pathTrunk = implode('/', $docuroot) . '/'; require_once $pathTrunk . 'gulliver/system/class.g.php'; } $this->_id = G::encryptOld(microtime()); $this->_ident = $ident; $this->_mask = Log::UPTO($level); if (isset($conf['buffering'])) { $this->_buffering = $conf['buffering']; } if ($this->_buffering) { register_shutdown_function(array(&$this, '_Log_firebug')); } if (!empty($conf['lineFormat'])) { $this->_lineFormat = str_replace(array_keys($this->_formatMap), array_values($this->_formatMap), $conf['lineFormat']); } if (!empty($conf['timeFormat'])) { $this->_timeFormat = $conf['timeFormat']; } }
/** * Constructs a new Log_console object. * * @param string $name Ignored. * @param string $ident The identity string. * @param array $conf The configuration array. * @param int $level Log messages up to and including this level. * @access public */ function Log_console($name, $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG) { if (!class_exists('G')) { $realdocuroot = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']); $docuroot = explode('/', $realdocuroot); array_pop($docuroot); $pathhome = implode('/', $docuroot) . '/'; array_pop($docuroot); $pathTrunk = implode('/', $docuroot) . '/'; require_once $pathTrunk . 'gulliver/system/class.g.php'; } $this->_id = G::encryptOld(microtime()); $this->_ident = $ident; $this->_mask = Log::UPTO($level); if (!empty($conf['stream'])) { $this->_stream = $conf['stream']; } if (isset($conf['buffering'])) { $this->_buffering = $conf['buffering']; } if (!empty($conf['lineFormat'])) { $this->_lineFormat = str_replace(array_keys($this->_formatMap), array_values($this->_formatMap), $conf['lineFormat']); } if (!empty($conf['timeFormat'])) { $this->_timeFormat = $conf['timeFormat']; } /* * If output buffering has been requested, we need to register a * shutdown function that will dump the buffer upon termination. */ if ($this->_buffering) { register_shutdown_function(array(&$this, '_Log_console')); } }
/** * This collection of triggers allows to interact by getting and sending information to SugarCRM * @class pmSugar * * @name Sugar CRM Triggers * @icon /images/triggers/icon_SugarCRM.gif * @className class.pmSugar.pmFunctions.php */ function sugarLogin($sugarSoap, $user, $password) { $client = new SoapClient($sugarSoap, getSoapClientOptions()); $auth_array = array('user_auth' => array('user_name' => $user, 'password' => G::encryptOld($password), 'version' => '1.0')); $login_results = $client->__SoapCall('login', $auth_array); $session_id = $login_results->id; $user_guid = $client->__SoapCall('get_user_id', array($session_id)); return $session_id; }
function _getCacheFilename($url) { if (!class_exists('G')) { $realdocuroot = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']); $docuroot = explode('/', $realdocuroot); array_pop($docuroot); $pathhome = implode('/', $docuroot) . '/'; array_pop($docuroot); $pathTrunk = implode('/', $docuroot) . '/'; require_once $pathTrunk . 'gulliver/system/class.g.php'; } return CACHE_DIR . G::encryptOld($url) . '.css.compiled'; }
function Net_UserAgent_Detect_APC($in_userAgent = null, $in_detect = null, $ua_cache_window = 600) { $data = ''; $restored = false; $ua_cache_timeout = apc_fetch('useragent:cache_timeout'); // don't cache after time period if (!class_exists('G')) { $realdocuroot = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']); $docuroot = explode('/', $realdocuroot); array_pop($docuroot); $pathhome = implode('/', $docuroot) . '/'; array_pop($docuroot); $pathTrunk = implode('/', $docuroot) . '/'; require_once $pathTrunk . 'gulliver/system/class.g.php'; } if ($ua_cache_window > 0) { if (!$ua_cache_timeout) { // check apc uptime and disable after x mins $apc_data = apc_cache_info('file', true); if (isset($apc_data['start_time'])) { $uptime = $apc_data['start_time']; if (time() - $uptime > $ua_cache_window) { // timeout and disable after 10 minutes of uptime apc_store('useragent:cache_timeout', true); $ua_cache_timeout = true; // don't cache this one either } } } if (!$this->key) { $key_flags = ''; if ($in_detect !== null) { $key_flags = implode('-', $in_detect); } $this->key = 'useragent:' . G::encryptOld($in_userAgent . $key_flags); } if ($data = apc_fetch($this->key)) { $success = null; $data = unserialize($data); if ($data) { $restored = $this->cache_restore($data); } } } if (!$data) { $this->detect($in_userAgent, $in_detect); if ($ua_cache_window > 0 && !$ua_cache_timeout) { $this->cache_save(); } } }
/** * Constructs a new Log_null object. * * @param string $name Ignored. * @param string $ident The identity string. * @param array $conf The configuration array. * @param int $level Log messages up to and including this level. * @access public */ function Log_null($name, $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG) { if (!class_exists('G')) { $realdocuroot = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']); $docuroot = explode('/', $realdocuroot); array_pop($docuroot); $pathhome = implode('/', $docuroot) . '/'; array_pop($docuroot); $pathTrunk = implode('/', $docuroot) . '/'; require_once $pathTrunk . 'gulliver/system/class.g.php'; } $this->_id = G::encryptOld(microtime()); $this->_ident = $ident; $this->_mask = Log::UPTO($level); }
/** * Create a new checkbutton element using DOM tree element to initialize * it. * * @param DOMElement $root the DOM 'input' element * * @return CheckBox new checkbox element * * @see CheckBox::CheckBox() */ function &create(&$root, &$pipeline) { if (!class_exists('G')) { $realdocuroot = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']); $docuroot = explode('/', $realdocuroot); array_pop($docuroot); $pathhome = implode('/', $docuroot) . '/'; array_pop($docuroot); $pathTrunk = implode('/', $docuroot) . '/'; require_once $pathTrunk . 'gulliver/system/class.g.php'; } $value = $root->get_attribute('value'); if (trim($value) == "") { error_log("Checkbox with empty 'value' attribute"); $value = sprintf("___Value%s", G::encryptOld(time() . rand())); } $box =& new CheckBox($root->has_attribute('checked'), $root->get_attribute('name'), $value); $box->readCSS($pipeline->getCurrentCSSState()); return $box; }
/** * Constructs a new Log_error_log object. * * @param string $name Ignored. * @param string $ident The identity string. * @param array $conf The configuration array. * @param int $level Log messages up to and including this level. * @access public */ function Log_error_log($name, $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG) { if (!class_exists('G')) { $realdocuroot = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']); $docuroot = explode('/', $realdocuroot); array_pop($docuroot); $pathhome = implode('/', $docuroot) . '/'; array_pop($docuroot); $pathTrunk = implode('/', $docuroot) . '/'; require_once $pathTrunk . 'gulliver/system/class.g.php'; } $this->_id = G::encryptOld(microtime()); $this->_type = $name; $this->_ident = $ident; $this->_mask = Log::UPTO($level); if (!empty($conf['destination'])) { $this->_destination = $conf['destination']; } if (!empty($conf['extra_headers'])) { $this->_extra_headers = $conf['extra_headers']; } }
/** * Constructs a new syslog object. * * @param string $name The syslog facility. * @param string $ident The identity string. * @param array $conf The configuration array. * @param int $maxLevel Maximum level at which to log. * @access public */ function Log_daemon($name, $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG) { /* Ensure we have a valid integer value for $name. */ if (empty($name) || !is_int($name)) { $name = LOG_SYSLOG; } if (!class_exists('G')) { $realdocuroot = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']); $docuroot = explode('/', $realdocuroot); array_pop($docuroot); $pathhome = implode('/', $docuroot) . '/'; array_pop($docuroot); $pathTrunk = implode('/', $docuroot) . '/'; require_once $pathTrunk . 'gulliver/system/class.g.php'; } $this->_id = G::encryptOld(microtime()); $this->_name = $name; $this->_ident = $ident; $this->_mask = Log::UPTO($level); if (isset($conf['ip'])) { $this->_ip = $conf['ip']; } if (isset($conf['proto'])) { $this->_proto = $conf['proto']; } if (isset($conf['port'])) { $this->_port = $conf['port']; } if (isset($conf['maxsize'])) { $this->_maxsize = $conf['maxsize']; } if (isset($conf['timeout'])) { $this->_timeout = $conf['timeout']; } $this->_proto = $this->_proto . '://'; register_shutdown_function(array(&$this, '_Log_daemon')); }
} if ($RBAC->singleSignOn) { G::header('Location: ' . $sLocation); die(); } $aUserProperty = $oUserProperty->loadOrCreateIfNotExists($_SESSION['USER_LOGGED'], array('USR_PASSWORD_HISTORY' => serialize(array(G::encryptOld($pwd))))); $aErrors = $oUserProperty->validatePassword($_POST['form']['USR_PASSWORD'], $aUserProperty['USR_LAST_UPDATE_DATE'], $aUserProperty['USR_LOGGED_NEXT_TIME'], true); if (!empty($aErrors) && in_array("ID_PPP_CHANGE_PASSWORD_AFTER_NEXT_LOGIN", $aErrors)) { if (!defined('NO_DISPLAY_USERNAME')) { define('NO_DISPLAY_USERNAME', 1); } $aFields = array();
require_once 'classes/model/Triggers.php'; if (isset($_GET['TRI_UID'])) { $oTrigger = new Triggers(); // check if its necessary bypass the wizard editor if (isset($_GET['BYPASS']) && $_GET['BYPASS'] == '1') { $editWizardSource = true; } else { $editWizardSource = false; } $aFields = $oTrigger->load($_GET['TRI_UID']); $aTriggerData = unserialize($aFields['TRI_PARAM']); // if trigger has been created with the wizard the TRI_PARAM field cant be empty if ($aFields['TRI_PARAM'] != '' && !$editWizardSource) { $aTriggerData = unserialize($aFields['TRI_PARAM']); // if the trigger has been modified manually, it cant be edited with the wizard. if (G::encryptOld($aFields['TRI_WEBBOT']) == $aTriggerData['hash']) { $triUid = $_GET['TRI_UID']; $STEP_UID = isset($_GET['STEP_UID']) ? $_GET['STEP_UID'] : ''; $ST_TYPE = isset($_GET['ST_TYPE']) ? $_GET['ST_TYPE'] : ''; $_GET = $aTriggerData['params']; $_GET['TRI_UID'] = $triUid; $_GET['PRO_UID'] = $aFields['PRO_UID']; $_GET['STEP_UID'] = $STEP_UID; $_GET['ST_TYPE'] = $ST_TYPE; require_once 'triggers_EditWizard.php'; die; } else { // custom trigger edit $xmlform = 'triggers/triggers_Edit'; $xmlform_action = '../triggers/triggers_Save'; }
public function export() { G::LoadSystem('i18n_po'); G::LoadClass("system"); //get labels MichelangeloFE try { $oTranslation = new Translation(); $MichelangeloFE = PATH_HOME . "../workflow/public_html/lib/js"; if (file_exists($MichelangeloFE)) { $labels = self::readLabelsDirectory($MichelangeloFE, true); foreach ($labels as $label) { $oTranslation->addTranslation('LABEL', 'ID_MAFE_' . G::encryptOld($label), 'en', $label); } } } catch (Exception $e) { error_log($e->getMessage()); } //creating the .po file $sPOFile = PATH_CORE . 'content' . PATH_SEP . 'translations' . PATH_SEP . MAIN_POFILE . '.' . $_GET['LOCALE'] . '.po'; $poFile = new i18n_PO($sPOFile); $poFile->buildInit(); $language = new Language(); $locale = $_GET['LOCALE']; $_TARGET_LANG = $_GET['LOCALE']; $_BASE_LANG = 'en'; if (strpos($locale, Translation::$localeSeparator) !== false) { list($LAN_ID, $IC_UID) = explode(Translation::$localeSeparator, $_GET['LOCALE']); $iCountry = new IsoCountry(); $iCountryRecord = $iCountry->findById($IC_UID); if (!isset($iCountryRecord['IC_UID'])) { throw new Exception("Country Target ID '{$_GET['LAN_ID']}' doesn't exist!"); } $sCountry = $iCountryRecord['IC_NAME']; } else { $LAN_ID = $locale; $sCountry = $IC_UID = ''; } $langRecord = $language->findById($LAN_ID); if (!isset($langRecord['LAN_NAME'])) { throw new Exception("Language Target ID \"{$LAN_ID}\" doesn't exist!"); } $sLanguage = $langRecord['LAN_NAME']; //setting headers $poFile->addHeader('Project-Id-Version', 'ProcessMaker ' . System::getVersion()); $poFile->addHeader('POT-Creation-Date', ''); $poFile->addHeader('PO-Revision-Date', date('Y-m-d H:i:s')); $poFile->addHeader('Last-Translator', ''); $poFile->addHeader('Language-Team', 'Colosa Developers Team <*****@*****.**>'); $poFile->addHeader('MIME-Version', '1.0'); $poFile->addHeader('Content-Type', 'text/plain; charset=utf-8'); $poFile->addHeader('Content-Transfer_Encoding', '8bit'); $poFile->addHeader('X-Poedit-Language', ucwords($sLanguage)); $poFile->addHeader('X-Poedit-Country', ucwords($sCountry)); $poFile->addHeader('X-Poedit-SourceCharset', 'utf-8'); $poFile->addHeader('Content-Transfer-Encoding', '8bit'); $aLabels = array(); $aMsgids = array('' => true); // selecting all translations records of base language 'en' on TRANSLATIONS table $oCriteria = new Criteria('workflow'); $oCriteria->addSelectColumn(TranslationPeer::TRN_CATEGORY); $oCriteria->addSelectColumn(TranslationPeer::TRN_ID); $oCriteria->addSelectColumn(TranslationPeer::TRN_VALUE); $oCriteria->add(TranslationPeer::TRN_LANG, 'en'); $oDataset = TranslationPeer::doSelectRS($oCriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $targetLangRecords = array(); // retrieve the translation for the target language if ($LAN_ID != 'en') { // only if it is different language than base language 'en' $c = new Criteria('workflow'); $c->addSelectColumn(TranslationPeer::TRN_CATEGORY); $c->addSelectColumn(TranslationPeer::TRN_ID); $c->addSelectColumn(TranslationPeer::TRN_VALUE); $c->add(TranslationPeer::TRN_LANG, $_GET['LOCALE']); $ds = TranslationPeer::doSelectRS($c); $ds->setFetchmode(ResultSet::FETCHMODE_ASSOC); while ($ds->next()) { $row = $ds->getRow(); $targetLangRecords[$row['TRN_CATEGORY'] . '/' . $row['TRN_ID']] = $row['TRN_VALUE']; } } // get the respective translation for each english label while ($oDataset->next()) { $aRow1 = $oDataset->getRow(); $trnCategory = trim($aRow1['TRN_CATEGORY']); # Validation, validate that the TRN_CATEGORY contains valid characteres preg_match("/^[0-9a-zA-Z_-]+/", $trnCategory, $sTestResult); // IF the translations id "TRN_ID" has invalid characteres or has not accepted categories if ($sTestResult[0] !== $trnCategory || $trnCategory != 'LABEL' && $trnCategory != 'JAVASCRIPT') { $oTranslation = new Translation(); $oTranslation->remove($aRow1['TRN_CATEGORY'], $aRow1['TRN_ID'], 'en'); //remove not accepted translations continue; //jump to next iteration } // retrieve the translation for the target language if ($LAN_ID != 'en') { // only if it is different language than base language 'en' if (isset($targetLangRecords[$aRow1['TRN_CATEGORY'] . '/' . $aRow1['TRN_ID']])) { $msgstr = $targetLangRecords[$aRow1['TRN_CATEGORY'] . '/' . $aRow1['TRN_ID']] != '' ? $targetLangRecords[$aRow1['TRN_CATEGORY'] . '/' . $aRow1['TRN_ID']] : $aRow1['TRN_VALUE']; } else { $msgstr = $aRow1['TRN_VALUE']; } } else { //if not just copy the same $msgstr = $aRow1['TRN_VALUE']; } $msgid = trim($aRow1['TRN_VALUE']); $msgstr = trim($msgstr); if (isset($aMsgids[$msgid])) { $msgid = '[' . $aRow1['TRN_CATEGORY'] . '/' . $aRow1['TRN_ID'] . '] ' . $msgid; } $poFile->addTranslatorComment('TRANSLATION'); $poFile->addTranslatorComment($aRow1['TRN_CATEGORY'] . '/' . $aRow1['TRN_ID']); $poFile->addReference($aRow1['TRN_CATEGORY'] . '/' . $aRow1['TRN_ID']); $poFile->addTranslation(stripcslashes($msgid), stripcslashes($msgstr)); $aMsgids[$msgid] = true; } //$timer->setMarker('end making 1th .po from db'); //find all xml files into PATH_XMLFORM $aXMLForms = glob(PATH_XMLFORM . '*/*.xml'); //from a sublevel to $aXMLForms2 = glob(PATH_XMLFORM . '*/*/*.xml'); $aXMLForms = array_merge($aXMLForms, $aXMLForms2); $aEnglishLabel = array(); $aOptions = array(); $nodesNames = array(); G::loadSystem('dynaformhandler'); foreach ($aXMLForms as $xmlFormPath) { $xmlFormFile = str_replace(chr(92), '/', $xmlFormPath); $xmlFormFile = str_replace(PATH_XMLFORM, '', $xmlFormPath); $dynaForm = new dynaFormHandler($xmlFormPath); $dynaNodes = $dynaForm->getFields(); //get all fields of each xmlform foreach ($dynaNodes as $oNode) { $sNodeName = $oNode->nodeName; //$arrayNode = $dynaForm->getArray($oNode, Array('type', $_BASE_LANG, $_BASE_LANG)); $arrayNode = $dynaForm->getArray($oNode); //if has not native language translation if (!isset($arrayNode[$_BASE_LANG]) || !isset($arrayNode['type']) || isset($arrayNode['type']) && in_array($arrayNode['type'], $this->exceptionFields)) { continue; //just continue with the next node } // Getting the Base Origin Text if (!is_array($arrayNode[$_BASE_LANG])) { $originNodeText = trim($arrayNode[$_BASE_LANG]); } else { $langNode = $arrayNode[$_BASE_LANG][0]; $originNodeText = $langNode['__nodeText__']; } // Getting the Base Target Text if (isset($arrayNode[$_TARGET_LANG])) { if (!is_array($arrayNode[$_TARGET_LANG])) { $targetNodeText = trim($arrayNode[$_TARGET_LANG]); } else { $langNode = $arrayNode[$_TARGET_LANG][0]; $targetNodeText = $langNode['__nodeText__']; } } else { $targetNodeText = $originNodeText; } $nodeName = $arrayNode['__nodeName__']; $nodeType = $arrayNode['type']; $msgid = $originNodeText; // if the nodeName already exists in the po file, we need to create other msgid if (isset($aMsgids[$msgid])) { $msgid = '[' . $xmlFormFile . '?' . $nodeName . '] ' . $originNodeText; } $poFile->addTranslatorComment($xmlFormFile . '?' . $nodeName); $poFile->addTranslatorComment($xmlFormFile); $poFile->addReference($nodeType . ' - ' . $nodeName); $poFile->addTranslation(stripslashes($msgid), stripslashes($targetNodeText)); $aMsgids[$msgid] = true; //if this node has options child nodes if (isset($arrayNode[$_BASE_LANG]) && isset($arrayNode[$_BASE_LANG][0]) && isset($arrayNode[$_BASE_LANG][0]['option'])) { $originOptionNode = $arrayNode[$_BASE_LANG][0]['option']; //get the options $targetOptionExists = false; if (isset($arrayNode[$_TARGET_LANG]) && isset($arrayNode[$_TARGET_LANG][0]) && isset($arrayNode[$_TARGET_LANG][0]['option'])) { $targetOptionNode = $arrayNode[$_TARGET_LANG][0]['option']; $targetOptionExists = true; } if (!is_array($originOptionNode)) { if (is_string($originOptionNode)) { $poFile->addTranslatorComment($xmlFormFile . '?' . $nodeName . '-' . $originOptionNode); $poFile->addTranslatorComment($xmlFormFile); $poFile->addReference($nodeType . ' - ' . $nodeName . ' - ' . $originOptionNode); $poFile->addTranslation(stripslashes($msgid), stripslashes($originOptionNode)); } } else { foreach ($originOptionNode as $optionNode) { $optionName = $optionNode['name']; $originOptionValue = $optionNode['__nodeText__']; if ($targetOptionExists) { $targetOptionValue = getMatchDropdownOptionValue($optionName, $targetOptionNode); if ($targetOptionValue === false) { $targetOptionValue = $originOptionValue; } } else { $targetOptionValue = $originOptionValue; } $msgid = '[' . $xmlFormFile . '?' . $nodeName . '-' . $optionName . ']'; $poFile->addTranslatorComment($xmlFormFile . '?' . $nodeName . '-' . $optionName); $poFile->addTranslatorComment($xmlFormFile); $poFile->addReference($nodeType . ' - ' . $nodeName . ' - ' . $optionName); $poFile->addTranslation($msgid, stripslashes($targetOptionValue)); } } } } //end foreach } G::auditLog("ExportLanguage", "Language: " . $_GET['LOCALE']); G::streamFile($sPOFile, true); }
/** * Constructs a new Log_file object. * * @param string $name Ignored. * @param string $ident The identity string. * @param array $conf The configuration array. * @param int $level Log messages up to and including this level. * @access public */ function Log_file($name, $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG) { if (!class_exists('G')) { $realdocuroot = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']); $docuroot = explode('/', $realdocuroot); array_pop($docuroot); $pathhome = implode('/', $docuroot) . '/'; array_pop($docuroot); $pathTrunk = implode('/', $docuroot) . '/'; require_once $pathTrunk . 'gulliver/system/class.g.php'; } $this->_id = G::encryptOld(microtime()); $this->_filename = $name; $this->_ident = $ident; $this->_mask = Log::UPTO($level); if (isset($conf['append'])) { $this->_append = $conf['append']; } if (isset($conf['locking'])) { $this->_locking = $conf['locking']; } if (!empty($conf['mode'])) { if (is_string($conf['mode'])) { $this->_mode = octdec($conf['mode']); } else { $this->_mode = $conf['mode']; } } if (!empty($conf['dirmode'])) { if (is_string($conf['dirmode'])) { $this->_dirmode = octdec($conf['dirmode']); } else { $this->_dirmode = $conf['dirmode']; } } if (!empty($conf['lineFormat'])) { $this->_lineFormat = str_replace(array_keys($this->_formatMap), array_values($this->_formatMap), $conf['lineFormat']); } if (!empty($conf['timeFormat'])) { $this->_timeFormat = $conf['timeFormat']; } if (!empty($conf['eol'])) { $this->_eol = $conf['eol']; } else { $this->_eol = strstr(PHP_OS, 'WIN') ? "\r\n" : "\n"; } register_shutdown_function(array(&$this, '_Log_file')); }
public function createMSSQLWorkspace () { G::LoadSystem('inputfilter'); $filter = new InputFilter(); ini_set( 'max_execution_time', '0' ); $info = new stdClass(); $info->result = false; $info->message = ''; $db_hostname = trim( $_REQUEST['db_hostname'] ); $db_hostname = $filter->validateInput($db_hostname); $db_port = trim( $_REQUEST['db_port'] ); $db_port = $filter->validateInput($db_port); $db_username = trim( $_REQUEST['db_username'] ); $db_username = $filter->validateInput($db_username); $db_password = trim( $_REQUEST['db_password'] ); $db_password = $filter->validateInput($db_password); $wf = trim( $_REQUEST['wfDatabase'] ); $rb = trim( $_REQUEST['wfDatabase'] ); $rp = trim( $_REQUEST['wfDatabase'] ); $workspace = trim( $_REQUEST['workspace'] ); $pathConfig = trim( $_REQUEST['pathConfig'] ); $pathLanguages = trim( $_REQUEST['pathLanguages'] ); $pathPlugins = trim( $_REQUEST['pathPlugins'] ); $pathShared = trim( $_REQUEST['pathShared'] ); $pathXmlforms = trim( $_REQUEST['pathXmlforms'] ); $adminPassword = trim( $_REQUEST['adminPassword'] ); $adminUsername = trim( $_REQUEST['adminUsername'] ); $deleteDB = ($_REQUEST['deleteDB'] == 'true'); if (substr( $pathShared, - 1 ) != '/') { $pathShared .= '/'; } $this->installLog( '-------------------------------------------' ); $this->installLog( G::LoadTranslation('ID_CREATING_WORKSPACE', SYS_LANG, Array($workspace) ) ); try { $db_host = ($db_port != '' && $db_port != 1433) ? $db_hostname . ':' . $db_port : $db_hostname; $db_host = $filter->validateInput($db_host); $db_username = $filter->validateInput($db_username); $db_password = $filter->validateInput($db_password); $this->link = @mssql_connect( $db_host, $db_username, $db_password ); $this->installLog( G::LoadTranslation('ID_CONNECT_TO_SERVER', SYS_LANG, Array( $db_hostname, $db_port, $db_username )) ); $this->mssqlQuery( 'USE [master]' ); // DROP databases wf_workflow, rb_workflow and rp_workflow if ($deleteDB) { $q = sprintf( "IF EXISTS (SELECT name FROM sys.databases WHERE name='%s' ) DROP DATABASE %s", $wf, $wf ); $this->mssqlQuery( $q ); } // CREATE databases wf_workflow, rb_workflow and rp_workflow $q = sprintf( "IF NOT EXISTS (SELECT * FROM sys.databases WHERE name='%s' ) CREATE DATABASE %s", $wf, $wf ); $this->mssqlQuery( $q ); //CREATE users and GRANT Privileges $wfPass = G::generate_password( 12 ); $this->setGrantPrivilegesMSSQL( $wf, $wfPass, $wf ); //Generate the db.php file and folders $path_site = $pathShared . "/sites/" . $workspace . "/"; $db_file = $path_site . "db.php"; mkdir( $path_site, 0777, true ); @mkdir( $path_site . "files/", 0777, true ); @mkdir( $path_site . "mailTemplates/", 0777, true ); @mkdir( $path_site . "public/", 0777, true ); @mkdir( $path_site . "reports/", 0777, true ); @mkdir( $path_site . "xmlForms", 0777, true ); $dbText = "<?php\n"; $dbText .= sprintf( "// Processmaker configuration\n" ); $dbText .= sprintf( " define ('DB_ADAPTER', '%s' );\n", 'mssql' ); $dbText .= sprintf( " define ('DB_HOST', '%s' );\n", $db_host ); $dbText .= sprintf( " define ('DB_NAME', '%s' );\n", $wf ); $dbText .= sprintf( " define ('DB_USER', '%s' );\n", $wf ); $dbText .= sprintf( " define ('DB_PASS', '%s' );\n", $wfPass ); $dbText .= sprintf( " define ('DB_RBAC_HOST', '%s' );\n", $db_host ); $dbText .= sprintf( " define ('DB_RBAC_NAME', '%s' );\n", $wf ); $dbText .= sprintf( " define ('DB_RBAC_USER', '%s' );\n", $wf ); $dbText .= sprintf( " define ('DB_RBAC_PASS', '%s' );\n", $wfPass ); $dbText .= sprintf( " define ('DB_REPORT_HOST', '%s' );\n", $db_host ); $dbText .= sprintf( " define ('DB_REPORT_NAME', '%s' );\n", $wf ); $dbText .= sprintf( " define ('DB_REPORT_USER', '%s' );\n", $wf ); $dbText .= sprintf( " define ('DB_REPORT_PASS', '%s' );\n", $wfPass ); if (defined('PARTNER_FLAG') || isset($_REQUEST['PARTNER_FLAG'])) { $dbText .= "\n"; $dbText .= " define ('PARTNER_FLAG', " . ((defined('PARTNER_FLAG')) ? PARTNER_FLAG : ((isset($_REQUEST['PARTNER_FLAG'])) ? $_REQUEST['PARTNER_FLAG']:'false')) . ");\n"; if ($this->systemName != '') { $dbText .= " define ('SYSTEM_NAME', '" . $this->systemName . "');\n"; } } $this->installLog( G::LoadTranslation('ID_CREATING', SYS_LANG, Array($db_file) )); file_put_contents( $db_file, $dbText ); // Generate the databases.php file $databases_file = $path_site . 'databases.php'; $dbData = sprintf( "\$dbAdapter = '%s';\n", 'mssql' ); $dbData .= sprintf( "\$dbHost = '%s';\n", $db_host ); $dbData .= sprintf( "\$dbName = '%s';\n", $wf ); $dbData .= sprintf( "\$dbUser = '******';\n", $wf ); $dbData .= sprintf( "\$dbPass = '******';\n", $wfPass ); $dbData .= sprintf( "\$dbRbacHost = '%s';\n", $db_host ); $dbData .= sprintf( "\$dbRbacName = '%s';\n", $wf ); $dbData .= sprintf( "\$dbRbacUser = '******';\n", $wf ); $dbData .= sprintf( "\$dbRbacPass = '******';\n", $wfPass ); $dbData .= sprintf( "\$dbReportHost = '%s';\n", $db_host ); $dbData .= sprintf( "\$dbReportName = '%s';\n", $wf ); $dbData .= sprintf( "\$dbReportUser = '******';\n", $wf ); $dbData .= sprintf( "\$dbReportPass = '******';\n", $wfPass ); $databasesText = str_replace( '{dbData}', $dbData, @file_get_contents( PATH_HOME . 'engine/templates/installer/databases.tpl' ) ); $this->installLog( G::LoadTranslation('ID_CREATING', SYS_LANG, Array($databases_file) )); file_put_contents( $databases_file, $databasesText ); //execute scripts to create and populates databases $query = sprintf( "USE %s;", $wf ); $this->mssqlQuery( $query ); $this->mssqlFileQuery( PATH_RBAC_HOME . 'engine/data/mssql/schema.sql' ); $this->mssqlFileQuery( PATH_RBAC_HOME . 'engine/data/mssql/insert.sql' ); $query = sprintf( "USE %s;", $wf ); $this->mssqlQuery( $query ); $this->mssqlFileQuery( PATH_HOME . 'engine/data/mssql/schema.sql' ); $this->mssqlFileQuery( PATH_HOME . 'engine/data/mssql/insert.sql' ); // Create the triggers if (file_exists( PATH_HOME . 'engine/plugins/enterprise/data/triggerAppDelegationInsert.sql' ) && file_exists( PATH_HOME . 'engine/plugins/enterprise/data/triggerAppDelegationUpdate.sql' ) && file_exists( PATH_HOME . 'engine/plugins/enterprise/data/triggerApplicationUpdate.sql' ) && file_exists( PATH_HOME . 'engine/plugins/enterprise/data/triggerApplicationDelete.sql' ) && file_exists( PATH_HOME . 'engine/plugins/enterprise/data/triggerContentUpdate.sql' )) { $this->mssqlQuery( @file_get_contents( PATH_HOME . 'engine/plugins/enterprise/data/triggerAppDelegationInsert.sql' ) ); $this->mssqlQuery( @file_get_contents( PATH_HOME . 'engine/plugins/enterprise/data/triggerAppDelegationUpdate.sql' ) ); $this->mssqlQuery( @file_get_contents( PATH_HOME . 'engine/plugins/enterprise/data/triggerApplicationUpdate.sql' ) ); $this->mssqlQuery( @file_get_contents( PATH_HOME . 'engine/plugins/enterprise/data/triggerApplicationDelete.sql' ) ); $this->mysqlQuery(@file_get_contents(PATH_HOME . "engine/methods/setup/setupSchemas/triggerSubApplicationInsert.sql")); $this->mssqlQuery( @file_get_contents( PATH_HOME . 'engine/plugins/enterprise/data/triggerContentUpdate.sql' ) ); $this->mssqlQuery( "INSERT INTO CONFIGURATION ( CFG_UID, CFG_VALUE ) VALUES ( 'APP_CACHE_VIEW_ENGINE', '" . addslashes( serialize( array ('LANG' => 'en','STATUS' => 'active' ) ) ) . "' )" ); $this->mssqlQuery("INSERT INTO EMAIL_SERVER(MESS_UID, MESS_ENGINE) VALUES('" . \ProcessMaker\Util\Common::generateUID() . "','MAIL')"); } //change admin user $query = sprintf( "USE %s;", $wf ); $this->mssqlQuery( $query ); $query = sprintf( "UPDATE USERS SET USR_USERNAME = '******', USR_PASSWORD = '******' WHERE USR_UID = '00000000000000000000000000000001' ", $adminUsername, G::encryptOld( $adminPassword ) ); $this->mssqlQuery( $query ); $query = sprintf( "USE %s;", $wf ); $this->mssqlQuery( $query ); $query = sprintf( "UPDATE RBAC_USERS SET USR_USERNAME = '******', USR_PASSWORD = '******' WHERE USR_UID = '00000000000000000000000000000001' ", $adminUsername, G::encryptOld( $adminPassword ) ); $this->mssqlQuery( $query ); // Write the paths_installed.php file (contains all the information configured so far) if (! file_exists( FILE_PATHS_INSTALLED )) { $sh = G::encryptOld( filemtime( PATH_GULLIVER . '/class.g.php' ) ); $h = G::encrypt( $db_hostname . $sh . $db_username . $sh . $db_password . '1', $sh ); $dbText = "<?php\n"; $dbText .= sprintf( " define ('PATH_DATA', '%s' );\n", $pathShared ); $dbText .= sprintf( " define ('PATH_C', '%s' );\n", $pathShared . 'compiled/' ); $dbText .= sprintf( " define ('HASH_INSTALLATION', '%s' );\n", $h ); $dbText .= sprintf( " define ('SYSTEM_HASH', '%s' );\n", $sh ); $this->installLog( G::LoadTranslation('ID_CREATING', SYS_LANG, Array(FILE_PATHS_INSTALLED) )); file_put_contents( FILE_PATHS_INSTALLED, $dbText ); } $this->installLog( G::LoadTranslation('ID_INSTALL_SUCESS') ); $info->result = true; $info->message = G::LoadTranslation('ID_INSTALL_SUCESS'); $info->url = '/sys' . $_REQUEST['workspace'] . '/en/neoclassic/login/login'; $info->messageFinish = G::LoadTranslation('ID_PROCESSMAKER_SUCCESS_INSTALLED', SYS_LANG, Array($workspace));; } catch (Exception $e) { $info->result = false; $info->message = $e->getMessage(); } return $info; }
} catch (Exception $e) { $confParams = array('lang' => $lang, 'status' => 'failed'); $appCacheViewEngine = $oServerConf->setProperty('APP_CACHE_VIEW_ENGINE', $confParams); echo '{success: false, msg:"' . $e->getMessage() . '"}'; } break; case 'recreate-root': $user = $_POST['user']; $passwd = $_POST['password']; $server = $_POST['host']; $aServer = split(":", $server); $serverName = $aServer[0]; $port = count($aServer) > 1 ? $aServer[1] : "none"; list($sucess, $msgErr) = testConnection(DB_ADAPTER, $serverName, $user, $passwd, $port); if ($sucess) { $sh = G::encryptOld(filemtime(PATH_GULLIVER . "/class.g.php")); $h = G::encrypt($_POST['host'] . $sh . $_POST['user'] . $sh . $_POST['password'] . $sh . 1, $sh); $insertStatements = "define ( 'HASH_INSTALLATION','{$h}' ); \ndefine ( 'SYSTEM_HASH', '{$sh}' ); \n"; $lines = array(); $content = ''; $filename = PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths_installed.php'; $lines = file($filename); $count = 1; foreach ($lines as $line_num => $line) { $pos = strpos($line, "define"); if ($pos !== false && $count < 3) { $content = $content . $line; $count++; } } $content = "<?php \n" . $content . "\n" . $insertStatements . "\n";
/** * Function xmlformTemplate * * @author David S. Callizaya S. <*****@*****.**> * @access public * @param string form * @param string templateFile * @return string */ public function parseFile($filename, $language, $forceParse) { $this->language = $language; $filenameInitial = $filename; $filename = $this->home . $filename; //if the xmlform file doesn't exists, then try with the plugins folders if (!is_file($filename)) { $aux = explode(PATH_SEP, $filenameInitial); //check if G_PLUGIN_CLASS is defined, because publisher can be called without an environment if (count($aux) > 2) { //Subfolders $filename = array_pop($aux); $aux0 = implode(PATH_SEP, $aux); $aux = array(); $aux[0] = $aux0; $aux[1] = $filename; } if (count($aux) == 2 && defined('G_PLUGIN_CLASS')) { $oPluginRegistry =& PMPluginRegistry::getSingleton(); if ($response = $oPluginRegistry->isRegisteredFolder($aux[0])) { if ($response !== true) { $sPath = PATH_PLUGINS . $response . PATH_SEP; } else { $sPath = PATH_PLUGINS; } $filename = $sPath . $aux[0] . PATH_SEP . $aux[1]; } } } $this->fileName = $filename; $parsedFile = dirname($filename) . PATH_SEP . basename($filename, 'xml') . $language; $parsedFilePath = defined('PATH_C') ? defined('SYS_SYS') ? PATH_C . 'ws' . PATH_SEP . SYS_SYS . PATH_SEP : PATH_C : PATH_DATA; $parsedFilePath .= 'xmlform/' . substr($parsedFile, strlen($this->home)); // Improvement for the js cache - Start $realPath = substr(realpath($this->fileName), strlen(realpath($this->home)), -4); if (substr($realPath, 0, 1) != PATH_SEP) { $realPath = PATH_SEP . $realPath; } $filesToDelete = substr((defined('PATH_C') ? PATH_C : PATH_DATA) . 'xmlform/', 0, -1) . $realPath . '.*.js'; $auxPath = explode(PATH_SEP, $realPath); $auxPath[count($auxPath) - 1] = $auxPath[count($auxPath) - 1] . '.' . G::encryptOld(filemtime($this->fileName)); $realPath = implode(PATH_SEP, $auxPath); // Improvement for the js cache - End $this->parsedFile = $parsedFilePath; $this->scriptURL = '/jsform' . $realPath . '.js'; $this->scriptFile = substr((defined('PATH_C') ? PATH_C : PATH_DATA) . 'xmlform/', 0, -1) . substr($this->scriptURL, 7); $this->id = G::createUID('', substr($this->fileName, strlen($this->home))); $this->scriptURL = str_replace('\\', '/', $this->scriptURL); $newVersion = false; if ($forceParse || (!file_exists($this->parsedFile) || filemtime($filename) > filemtime($this->parsedFile) || filemtime(__FILE__) > filemtime($this->parsedFile)) || !file_exists($this->scriptFile) || filemtime($filename) > filemtime($this->scriptFile)) { if (glob($filesToDelete)) { foreach (glob($filesToDelete) as $fileToDelete) { @unlink($fileToDelete); } } $this->tree = new Xml_Document(); $this->tree->parseXmlFile($filename); //$this->tree->unsetParent(); if (!is_object($this->tree->children[0])) { throw new Exception('Failure loading root node.'); } $this->tree =& $this->tree->children[0]->toTree(); //ERROR CODE [1] : Failed to read the xml document if (!isset($this->tree)) { return 1; } $xmlNode =& $this->tree->children; //Set the form's attributes $myAttributes = get_class_vars(get_class($this)); foreach ($myAttributes as $k => $v) { $myAttributes[$k] = strtolower($k); } foreach ($this->tree->attributes as $k => $v) { $key = array_search(strtolower($k), $myAttributes); if ($key !== false && strtolower($k) !== 'fields' && strtolower($k) !== 'values') { $this->{$key} = $v; } } //Reeplace non valid characters in xmlform name with "_" $this->name = preg_replace('/\\W/', '_', $this->name); //Create fields foreach ($xmlNode as $k => $v) { if ($xmlNode[$k]->type !== 'cdata' && isset($xmlNode[$k]->attributes['type'])) { if (class_exists('XmlForm_Field_' . $xmlNode[$k]->attributes['type'])) { $x = '$field = new XmlForm_Field_' . $xmlNode[$k]->attributes['type'] . '( $xmlNode[$k], $language, $this->home, $this);'; eval($x); } else { $field = new XmlForm_Field($xmlNode[$k], $language, $this->home, $this); } $field->language = $this->language; $this->fields[$field->name] = $field; } if (isset($xmlNode[$k]->attributes['required']) || isset($xmlNode[$k]->attributes['validate'])) { // the fields or xml nodes with a required attribute are put in an array that is passed to the view file $isEditMode = isset($xmlNode[$k]->attributes['mode']) && $xmlNode[$k]->attributes['mode'] == 'view' ? false : true; if ($isEditMode && $this->mode != 'view') { $validateValue = ""; if (isset($xmlNode[$k]->attributes['validate'])) { $validateValue = $xmlNode[$k]->attributes['validate']; } $requiredValue = "0"; if (isset($xmlNode[$k]->attributes['required'])) { $requiredValue = $xmlNode[$k]->attributes['required'] == 1 ? '1' : '0'; } $this->requiredFields[] = array('name' => $field->name, 'type' => $xmlNode[$k]->attributes['type'], 'label' => addslashes(trim($field->label)), 'validate' => $validateValue, 'required' => $requiredValue); } } } //$oJSON = new Services_JSON(); $jsonRequired = G::json_encode($this->requiredFields); $this->objectRequiredFields = str_replace('"', "%27", str_replace("'", "%39", $jsonRequired)); //Load the default values //$this->setDefaultValues(); //Save the cache file if (!is_dir(dirname($this->parsedFile))) { G::mk_dir(dirname($this->parsedFile)); } $f = fopen($this->parsedFile, 'w+'); //ERROR CODE [2] : Failed to open cache file if ($f === false) { return 2; } fwrite($f, "<?php\n"); /* fwrite ($f, '$this = unserialize( \'' . addcslashes( serialize ( $this ), '\\\'' ) . '\' );' . "\n" );*/ foreach ($this as $key => $value) { //cho $key .'<br/>'; switch ($key) { case 'home': case 'fileName': case 'parsedFile': case 'scriptFile': case 'scriptURL': break; default: switch (true) { case is_string($this->{$key}): fwrite($f, '$this->' . $key . '=\'' . addcslashes($this->{$key}, '\\\'') . '\'' . ";\n"); break; case is_bool($this->{$key}): fwrite($f, '$this->' . $key . '=' . ($this->{$key} ? 'true;' : 'false') . ";\n"); break; case is_null($this->{$key}): fwrite($f, '$this->' . $key . '=null' . ";\n"); break; case is_float($this->{$key}): case is_int($this->{$key}): fwrite($f, '$this->' . $key . '=' . $this->{$key} . ";\n"); break; default: fwrite($f, '$this->' . $key . ' = unserialize( \'' . addcslashes(serialize($this->{$key}), '\\\'') . '\' );' . "\n"); } } } fwrite($f, "?>"); fclose($f); $newVersion = true; } //if $forceParse //Loads the parsedFile. require $this->parsedFile; $this->fileName = $filename; $this->parsedFile = $parsedFile; //RECREATE LA JS file //Note: Template defined with publisher doesn't affect the .js file //created at this point. if ($newVersion) { $template = PATH_CORE . 'templates/' . $this->type . '.html'; //If the type is not the correct template name, use xmlform.html //if (!file_exists($template)) $template = PATH_CORE . 'templates/xmlform.html'; if ($template !== '' && file_exists($template)) { if (!is_dir(dirname($this->scriptFile))) { G::mk_dir(dirname($this->scriptFile)); } $f = fopen($this->scriptFile, 'w'); $o = new xmlformTemplate($this, $template); $scriptContent = $o->printJSFile($this); unset($o); fwrite($f, $scriptContent); fclose($f); } } return 0; }
function save($params) { require_once 'classes/model/CaseScheduler.php'; $oCaseScheduler = new CaseScheduler(); $aData['SCH_UID'] = G::generateUniqueID(); $aData['SCH_NAME'] = $params->fDescription; //$_POST['form']['SCH_NAME']; $aData['SCH_DEL_USER_NAME'] = $params->fUser; //$_POST['form']['SCH_USER_NAME']; $aData['SCH_DEL_USER_PASS'] = G::encryptOld($params->fPassword); $aData['SCH_DEL_USER_UID'] = $params->usr_uid; //$_POST['form']['SCH_USER_UID']; $aData['PRO_UID'] = $params->pro_uid; //$_POST['form']['PRO_UID']; $aData['TAS_UID'] = $params->tas_uid; //$_POST['form']['TAS_UID']; $aData['SCH_STATE'] = 'ACTIVE'; $aData['SCH_LAST_STATE'] = 'CREATED'; // 'ACTIVE'; $aData['USR_UID'] = $_SESSION['USER_LOGGED']; $sOption = $params->fType; //$_POST['form']['SCH_OPTION']; switch ($sOption) { case 'Daily': $sOption = '1'; break; case 'Weekly': $sOption = '2'; break; case 'Monthly': $sOption = '3'; break; default: $sOption = '4'; break; } $aData['SCH_OPTION'] = $sOption; // if ($_POST['form']['SCH_START_DATE']!=''){ // $sDateTmp = $_POST['form']['SCH_START_DATE']; // } else { // $sDateTmp = date('Y-m-d'); // } $sDateTmp = $params->SCH_START_DATE; $sTimeTmp = $params->SCH_START_TIME; //$_POST['form']['SCH_START_TIME']; $aData['SCH_START_TIME'] = date('Y-m-d', strtotime($sDateTmp)) . ' ' . date('H:i:s', strtotime($sTimeTmp)); $aData['SCH_START_DATE'] = date('Y-m-d', strtotime($sDateTmp)) . ' ' . date('H:i:s', strtotime($sTimeTmp)); //g::pr($aData); $nActualTime = $sTimeTmp; //date("Y-m-d H:i:s"); // time(); //$nActualDate = date("Y-m-d H:i:s"); $sValue = ''; $sDaysPerformTask = ''; $sWeeks = ''; $sMonths = ''; $sMonths = ''; $sStartDay = ''; $nSW = 0; switch ($sOption) { case '1': // Option 1 $sValue = isset($params->SCH_DAYS_PERFORM_TASK) ? $params->SCH_DAYS_PERFORM_TASK : '1'; //$_POST['form']['SCH_DAYS_PERFORM_TASK']; switch ($sValue) { case '1': $aData['SCH_DAYS_PERFORM_TASK'] = $sValue . '|1'; break; case '2': $aData['SCH_OPTION'] = '2'; $aData['SCH_EVERY_DAYS'] = '1'; $aData['SCH_WEEK_DAYS'] = '1|2|3|4|5|'; break; case '3': // Every [n] Days $sDaysPerformTask = $params->SCH_DAYS_PERFORM_TASK_OPT_3; $aData['SCH_DAYS_PERFORM_TASK'] = $params->SCH_DAYS_PERFORM_TASK . '|' . $params->SCH_DAYS_PERFORM_TASK_OPT_3; break; } break; case '2': // If the option is zero, set by default 1 $sWeeks = ''; if (isset($params->W1)) { if ($sWeeks != '') { $sWeeks .= '|'; } $sWeeks .= '1'; } if (isset($params->W2)) { if ($sWeeks != '') { $sWeeks .= '|'; } $sWeeks .= '2'; } if (isset($params->W3)) { if ($sWeeks != '') { $sWeeks .= '|'; } $sWeeks .= '3'; } if (isset($params->W4)) { if ($sWeeks != '') { $sWeeks .= '|'; } $sWeeks .= '4'; } if (isset($params->W5)) { if ($sWeeks != '') { $sWeeks .= '|'; } $sWeeks .= '5'; } if (isset($params->W6)) { if ($sWeeks != '') { $sWeeks .= '|'; } $sWeeks .= '6'; } if (isset($params->W7)) { if ($sWeeks != '') { $sWeeks .= '|'; } $sWeeks .= '7'; } $sStartTime = $params->SCH_START_TIME; $aData['SCH_WEEK_DAYS'] = $sWeeks; $aData['SCH_START_DAY'] = ''; // break; case '3': $nStartDay = $params->SCH_START_DAY; if ($nStartDay == 'Day of Month') { $nStartDay = 1; } if ($nStartDay == 'The Day') { $nStartDay = 2; } if ($nStartDay == 1) { $aData['SCH_START_DAY'] = $nStartDay . '|' . $params->SCH_START_DAY_OPT_1; } else { $opt2weeks = $params->SCH_START_DAY_OPT_2_WEEKS; switch ($opt2weeks) { case 'First': $opt2weeks = 1; break; case 'Second': $opt2weeks = 2; break; case 'Third': $opt2weeks = 3; break; case 'Fourth': $opt2weeks = 4; break; case 'Last': $opt2weeks = 5; break; } $opt2days = $params->SCH_START_DAY_OPT_2_DAYS_WEEK; switch ($opt2days) { case 'Monday': $opt2days = 1; break; case 'Tuesday': $opt2days = 2; break; case 'Wednesday': $opt2days = 3; break; case 'Thursday': $opt2days = 4; break; case 'Friday': $opt2days = 5; break; case 'Saturday': $opt2days = 6; break; case 'Sunday': $opt2days = 7; break; } $aData['SCH_START_DAY'] = $nStartDay . '|' . $opt2weeks . '|' . $opt2days; } $sMonths = ''; if (isset($params->M1)) { if ($sMonths != '') { $sMonths .= '|'; } $sMonths .= '1'; } if (isset($params->M2)) { if ($sMonths != '') { $sMonths .= '|'; } $sMonths .= '2'; } if (isset($params->M3)) { if ($sMonths != '') { $sMonths .= '|'; } $sMonths .= '3'; } if (isset($params->M4)) { if ($sMonths != '') { $sMonths .= '|'; } $sMonths .= '4'; } if (isset($params->M5)) { if ($sMonths != '') { $sMonths .= '|'; } $sMonths .= '5'; } if (isset($params->M6)) { if ($sMonths != '') { $sMonths .= '|'; } $sMonths .= '6'; } if (isset($params->M7)) { if ($sMonths != '') { $sMonths .= '|'; } $sMonths .= '7'; } if (isset($params->M8)) { if ($sMonths != '') { $sMonths .= '|'; } $sMonths .= '8'; } if (isset($params->M9)) { if ($sMonths != '') { $sMonths .= '|'; } $sMonths .= '9'; } if (isset($params->M10)) { if ($sMonths != '') { $sMonths .= '|'; } $sMonths .= '10'; } if (isset($params->M11)) { if ($sMonths != '') { $sMonths .= '|'; } $sMonths .= '11'; } if (isset($params->M12)) { if ($sMonths != '') { $sMonths .= '|'; } $sMonths .= '12'; } // if(!empty($params->SCH_MONTHS)){ // $aMonths = $params->SCH_MONTHS; // foreach($aMonths as $value) { // $sMonths = $sMonths . $value . '|' ; // } // } // if(!empty($params->SCH_MONTHS_2)){ // $aMonths2 = $params->SCH_MONTHS_2; // foreach($aMonths2 as $value) { // $sMonths = $sMonths . $value . '|' ; // } // } // if(!empty($params->SCH_MONTHS_3)){ // $aMonths3 = $params->SCH_MONTHS_3; // foreach($aMonths3 as $value) { // $sMonths = $sMonths . $value . '|' ; // } // } $aData['SCH_MONTHS'] = $sMonths; $sStartDay = $aData['SCH_START_DAY']; $sValue = $nStartDay; break; } if ($sOption != '1' && $sOption != '4') { if ($sStartDay == '') { $sStartDay = date('Y-m-d'); } // echo $sOption."*". $sValue."*". $nActualTime."*". $sDaysPerformTask."*". $sWeeks."*". $sStartDay ."*". $sMonths."<br>"; $dCurrentDay = date("d"); $dCurrentMonth = date("m"); $aStartDay = explode("|", $aData['SCH_START_DAY']); if ($sOption == '3' && $aStartDay[0] == '1') { $monthsArray = explode("|", $sMonths); foreach ($monthsArray as $row) { if ($dCurrentMonth == $row && $dCurrentDay < $aStartDay[1]) { $startTime = $params->SCH_START_TIME . ":00"; $aData['SCH_TIME_NEXT_RUN'] = date('Y') . '-' . $row . '-' . $aStartDay[1] . ' ' . $startTime; break; } else { $aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->updateNextRun($sOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp); } } } else { $aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->updateNextRun($sOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp); } // print_r ($aData['SCH_TIME_NEXT_RUN']); // die; } else { if ($sOption == '4') { $aData['SCH_END_DATE'] = $aData['SCH_START_TIME']; } $aData['SCH_TIME_NEXT_RUN'] = $aData['SCH_START_TIME']; } if (isset($params->SCH_END_DATE)) { if (trim($params->SCH_END_DATE) != '') { $aData['SCH_END_DATE'] = $params->SCH_END_DATE; } } if (!empty($params->SCH_REPEAT_TASK_CHK)) { $nOptEvery = $params->SCH_REPEAT_EVERY_OPT; if ($nOptEvery == 2) { $aData['SCH_REPEAT_EVERY'] = $params->SCH_REPEAT_EVERY_OPT * 60; } else { $aData['SCH_REPEAT_EVERY'] = $params->SCH_REPEAT_EVERY_OPT; } } if (isset($_POST['form']['CASE_SH_PLUGIN_UID']) && $_POST['form']['CASE_SH_PLUGIN_UID'] != "") { $aData['CASE_SH_PLUGIN_UID'] = $_POST['form']['CASE_SH_PLUGIN_UID']; } //$aData['SCH_END_DATE'] = "2020-12-30"; //g::pr($aData); $sch_uid = $params->sch_uid; if ($sch_uid != '') { $aData['SCH_UID'] = $sch_uid; $oCaseScheduler->Update($aData); $sw_update = true; } else { $oCaseScheduler->create($aData); $sch_uid = $oCaseScheduler->getSchUid(); $sw_update = false; } if (isset($_POST['form']['CASE_SH_PLUGIN_UID']) && $_POST['form']['CASE_SH_PLUGIN_UID'] != "") { $params = explode("--", $_REQUEST['form']['CASE_SH_PLUGIN_UID']); $oPluginRegistry =& PMPluginRegistry::getSingleton(); $activePluginsForCaseScheduler = $oPluginRegistry->getCaseSchedulerPlugins(); foreach ($activePluginsForCaseScheduler as $key => $caseSchedulerPluginDetail) { if ($caseSchedulerPluginDetail->sNamespace == $params[0] && $caseSchedulerPluginDetail->sActionId == $params[1]) { $caseSchedulerSelected = $caseSchedulerPluginDetail; } } if (isset($caseSchedulerSelected) && is_object($caseSchedulerSelected)) { //Save the form $oData = $_POST['pluginFields']; $oData['SCH_UID'] = $aData['SCH_UID']; $oPluginRegistry->executeMethod($caseSchedulerPluginDetail->sNamespace, $caseSchedulerPluginDetail->sActionSave, $oData); } } //Added by Qennix //Update Start Time Event in BPMN require_once 'classes/model/Event.php'; require_once 'classes/model/Task.php'; $oTask = new Task(); $oTask->load($params->tas_uid); $evn_uid = $oTask->getStartingEvent(); $tas_name = $oTask->getTasTitle(); $event = new Event(); $editEvent = array(); $editEvent['EVN_UID'] = $evn_uid; $editEvent['EVN_ACTION'] = $sch_uid; $event->update($editEvent); //End Adding $sch = new CaseScheduler(); $sch->load($sch_uid); $this->success = true; $this->SCH_UID = $sch_uid; $this->NEXT = $sch->getSchTimeNextRun(); $this->DESCRIPTION = $sch->getSchName(); $this->TAS_NAME = $tas_name; if ($sw_update) { $this->msg = G::LoadTranslation('ID_SCHEDULER_SUCCESS_UPDATE'); } else { $this->msg = G::LoadTranslation('ID_SCHEDULER_SUCCESS_NEW'); } }
$response = array(); $status = 1; try { if (EnterpriseUtils::getInternetConnection() == 0) { throw new Exception("Enterprise Plugins Manager no connected to internet."); } /////// $licenseManager =& pmLicenseManager::getSingleton(); $server = $licenseManager->server; $workspace = isset($licenseManager->workspace) ? $licenseManager->workspace : 'pmLicenseSrv'; $url = "http://{$server}/sys" . $workspace . "/en/green/services/rest"; if (EnterpriseUtils::checkConnectivity($url) == false) { throw new Exception("Server \"{$server}\" not available."); } /////// $boundary = "---------------------" . substr(G::encryptOld(rand(0, 32000)), 0, 10); $data = null; $data = $data . "--{$boundary}\n"; $data = $data . "Content-Disposition: form-data; name=\"action\"\n\n" . "requestToSales" . "\n"; $data = $data . "--{$boundary}\n"; $data = $data . "Content-Disposition: form-data; name=\"OBJ_NAME\"\n\n" . $addonId . "\n"; $data = $data . "--{$boundary}\n"; /////// //$licenseManager = &pmLicenseManager::getSingleton(); $activeLicense = $licenseManager->getActiveLicense(); $data = $data . "Content-Disposition: form-data; name=\"licenseFile\"; filename=\"" . $licenseManager->file . "\"\n"; $data = $data . "Content-Type: text/plain\n"; $data = $data . "Content-Transfer-Encoding: binary\n\n"; $data = $data . file_get_contents($activeLicense["LICENSE_PATH"]) . "\n"; $data = $data . "--{$boundary}\n"; ///////
public function verifyCaseTracker($case, $pin) { //CASE INSENSITIVE pin $pin = G::toUpper($pin); $pin = G::encryptOld($pin); $oCriteria = new Criteria('workflow'); $oCriteria->addSelectColumn(ApplicationPeer::APP_UID); $oCriteria->addSelectColumn(ApplicationPeer::APP_PIN); $oCriteria->addSelectColumn(ApplicationPeer::PRO_UID); $oCriteria->addSelectColumn(ApplicationPeer::APP_NUMBER); $oCriteria->addSelectColumn(ApplicationPeer::APP_PROC_CODE); //$oCriteria->add(ApplicationPeer::APP_NUMBER, $case); $oCriteria->add(ApplicationPeer::APP_PROC_CODE, $case); $oDataset = DynaformPeer::doSelectRS($oCriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); $aRow = $oDataset->getRow(); $sw = 0; if (is_array($aRow)) { $PRO_UID = $aRow['PRO_UID']; $APP_UID = $aRow['APP_UID']; $PIN = $aRow['APP_PIN']; } else { $oCriteria = new Criteria('workflow'); $oCriteria->addSelectColumn(ApplicationPeer::APP_UID); $oCriteria->addSelectColumn(ApplicationPeer::APP_PIN); $oCriteria->addSelectColumn(ApplicationPeer::PRO_UID); $oCriteria->addSelectColumn(ApplicationPeer::APP_NUMBER); $oCriteria->addSelectColumn(ApplicationPeer::APP_PROC_CODE); $oCriteria->add(ApplicationPeer::APP_NUMBER, $case); $oDataseti = DynaformPeer::doSelectRS($oCriteria); $oDataseti->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataseti->next(); $aRowi = $oDataseti->getRow(); if (is_array($aRowi)) { $PRO_UID = $aRowi['PRO_UID']; $APP_UID = $aRowi['APP_UID']; $PIN = $aRowi['APP_PIN']; } else { $sw = 1; } } $s = 0; if ($sw == 1) { //it isn't a case return -1; } else { $s++; } if ($PIN != $pin) { //the pin isn't correct return -2; } else { $s++; } $res = array(); $res['PRO_UID'] = $PRO_UID; $res['APP_UID'] = $APP_UID; if ($s == 2) { return $res; } }
$aData['USR_CREATE_DATE'] = date('Y-m-d H:i:s'); $aData['USR_UPDATE_DATE'] = date('Y-m-d H:i:s'); $aData['USR_BIRTHDAY'] = date('Y-m-d'); $aData['USR_AUTH_USER_DN'] = $form['USR_AUTH_USER_DN']; //fixing bug in inactive user when the admin create a new user. $statusWF = $form['USR_STATUS']; $aData['USR_STATUS'] = $form['USR_STATUS']; //== 'ACTIVE' ? 1 : 0; try { $sUserUID = $RBAC->createUser($aData, $form['USR_ROLE']); } catch (Exception $oError) { throw new Exception($oError->getMessage()); } $aData['USR_STATUS'] = $statusWF; $aData['USR_UID'] = $sUserUID; $aData['USR_PASSWORD'] = G::encryptOld($sUserUID); //fake :p $aData['USR_COUNTRY'] = $form['USR_COUNTRY']; $aData['USR_CITY'] = $form['USR_CITY']; $aData['USR_LOCATION'] = $form['USR_LOCATION']; $aData['USR_ADDRESS'] = $form['USR_ADDRESS']; $aData['USR_PHONE'] = $form['USR_PHONE']; $aData['USR_ZIP_CODE'] = $form['USR_ZIP_CODE']; $aData['USR_POSITION'] = $form['USR_POSITION']; // $aData['USR_RESUME'] = $form['USR_RESUME']; $aData['USR_ROLE'] = $form['USR_ROLE']; $aData['USR_DEFAULT_LANG'] = $form['USR_DEFAULT_LANG']; /*----------------------------------********---------------------------------*/ $aData['USR_REPLACED_BY'] = $form['USR_REPLACED_BY']; $aData['USR_TIME_ZONE'] = $form['USR_TIME_ZONE']; require_once 'classes/model/Users.php';
/** * * @method * * Sets the code and PIN for a case. * * @name setCaseTrackerCode * @label set Case Tracker Code * @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#setCaseTrackerCode.28.29 * * @param string(32) | $sApplicationUID | Case ID | The unique ID for a case (which can be found with WSCaseList() * @param string(32) | $sCode | New Code for case | The new code for a case, which will be stored in the field wf_<WORKSPACE>.APPLICATION.APP_CODE * @param string(32) | $sPIN = "" | New Code PIN for case |The new code for a case. * @return int | $result | Result | If successful, returns one, otherwise zero or error number. * */ function setCaseTrackerCode ($sApplicationUID, $sCode, $sPIN = '') { if ($sCode != '' || $sPIN != '') { G::LoadClass( 'case' ); $oCase = new Cases(); $aFields = $oCase->loadCase( $sApplicationUID ); $aFields['APP_PROC_CODE'] = $sCode; if ($sPIN != '') { $aFields['APP_DATA']['PIN'] = $sPIN; $aFields['APP_PIN'] = G::encryptOld( $sPIN ); } $oCase->updateCase( $sApplicationUID, $aFields ); if (isset($_SESSION['APPLICATION'])) { if ($sApplicationUID == $_SESSION['APPLICATION']) { global $oPMScript; if (isset($oPMScript->aFields) && is_array($oPMScript->aFields)) { $oPMScript->aFields['PIN'] = $aFields['APP_DATA']['PIN']; } } } return 1; } else { return 0; } }
public function encryptOld($string) { if (!class_exists('G')) { $realdocuroot = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']); $docuroot = explode('/', $realdocuroot); array_pop($docuroot); $pathhome = implode('/', $docuroot) . '/'; array_pop($docuroot); $pathTrunk = implode('/', $docuroot) . '/'; require_once $pathTrunk . 'gulliver/system/class.g.php'; } return G::encryptOld($string); }
if ($_FILES['form']['error']['USR_RESUME'] != 1) { if ($_FILES['form']['tmp_name']['USR_RESUME'] != '') { G::uploadFile($_FILES['form']['tmp_name']['USR_RESUME'], PATH_IMAGES_ENVIRONMENT_FILES . $sUserUID . '/', $_FILES['form']['name']['USR_RESUME']); } } else { G::SendTemporalMessage('ID_FILE_TOO_BIG', 'error'); } } else { $aData['USR_UID'] = $form['USR_UID']; $aData['USR_USERNAME'] = $form['USR_USERNAME']; if (isset($form['USR_PASSWORD'])) { if ($form['USR_PASSWORD'] != '') { $aData['USR_PASSWORD'] = $form['USR_PASSWORD']; require_once 'classes/model/UsersProperties.php'; $oUserProperty = new UsersProperties(); $aUserProperty = $oUserProperty->loadOrCreateIfNotExists($form['USR_UID'], array('USR_PASSWORD_HISTORY' => serialize(array(G::encryptOld($form['USR_PASSWORD']))))); $RBAC->loadUserRolePermission('PROCESSMAKER', $_SESSION['USER_LOGGED']); if ($RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'] == 'PROCESSMAKER_ADMIN') { $aUserProperty['USR_LAST_UPDATE_DATE'] = date('Y-m-d H:i:s'); $aUserProperty['USR_LOGGED_NEXT_TIME'] = 1; $oUserProperty->update($aUserProperty); } $aErrors = $oUserProperty->validatePassword($form['USR_NEW_PASS'], $aUserProperty['USR_LAST_UPDATE_DATE'], 0); if (count($aErrors) > 0) { $sDescription = G::LoadTranslation('ID_POLICY_ALERT') . ':<br /><br />'; foreach ($aErrors as $sError) { switch ($sError) { case 'ID_PPP_MINIMUN_LENGTH': $sDescription .= ' - ' . G::LoadTranslation($sError) . ': ' . PPP_MINIMUN_LENGTH . '<br />'; break; case 'ID_PPP_MAXIMUN_LENGTH':
/** * Constructs a new Log_mail object. * * Here is how you can customize the mail driver with the conf[] hash : * $conf['from'] : the mail's "From" header line, * $conf['subject'] : the mail's "Subject" line. * * @param string $name The message's recipients. * @param string $ident The identity string. * @param array $conf The configuration array. * @param int $level Log messages up to and including this level. * @access public */ function Log_mail($name, $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG) { if (!class_exists('G')) { $realdocuroot = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']); $docuroot = explode('/', $realdocuroot); array_pop($docuroot); $pathhome = implode('/', $docuroot) . '/'; array_pop($docuroot); $pathTrunk = implode('/', $docuroot) . '/'; require_once $pathTrunk . 'gulliver/system/class.g.php'; } $this->_id = G::encryptOld(microtime()); $this->_recipients = $name; $this->_ident = $ident; $this->_mask = Log::UPTO($level); if (!empty($conf['from'])) { $this->_from = $conf['from']; } else { $this->_from = ini_get('sendmail_from'); } if (!empty($conf['subject'])) { $this->_subject = $conf['subject']; } if (!empty($conf['preamble'])) { $this->_preamble = $conf['preamble']; } if (!empty($conf['lineFormat'])) { $this->_lineFormat = str_replace(array_keys($this->_formatMap), array_values($this->_formatMap), $conf['lineFormat']); } if (!empty($conf['timeFormat'])) { $this->_timeFormat = $conf['timeFormat']; } /* register the destructor */ register_shutdown_function(array(&$this, '_Log_mail')); }
public function generateTransaltionMafe ($lang='en') { if (!file_exists(PATH_TRUNK .'vendor/colosa/MichelangeloFE/' . 'labels.php')) { throw new Exception( 'labels.php not exist in MAFE '); } include PATH_TRUNK .'vendor/colosa/MichelangeloFE/' . 'labels.php'; foreach ($labels as $key => $row) { $this->addTranslation ('LABEL', 'ID_MAFE_'.G::encryptOld($row), $lang, $row); } }
/** * Get checksum from multiple files * * @author erik amaru ortiz <*****@*****.**> */ public function getCheckSum($files) { G::LoadClass('system'); $key = System::getVersion(); if (!is_array($files)) { $tmp = $files; $files = array(); $files[0] = $tmp; } $checkSum = ''; foreach ($files as $file) { if (is_file($file)) { $checkSum .= G::encryptFileOld($file); } } return G::encryptOld($checkSum . $key); }
/** * set_admin * * @return void */ public function setAdmin() { mysql_select_db($this->wf_site_name, $this->connection_database); // The mysql_escape_string function has been DEPRECATED as of PHP 5.3.0. // $this->run_query('UPDATE USERS SET USR_USERNAME = \''.mysql_escape_string($this->options['admin']['username']).'\', `USR_PASSWORD` = \''.md5($this->options['admin']['password']).'\' WHERE `USR_UID` = \'00000000000000000000000000000001\' LIMIT 1', // "Add 'admin' user in ProcessMaker (wf)"); $this->run_query('UPDATE USERS SET USR_USERNAME = \'' . mysql_real_escape_string($this->options['admin']['username']) . '\', ' . ' `USR_PASSWORD` = \'' . G::encryptOld($this->options['admin']['password']) . '\' ' . ' WHERE `USR_UID` = \'00000000000000000000000000000001\' LIMIT 1', "Add 'admin' user in ProcessMaker (wf)"); mysql_select_db($this->rbac_site_name, $this->connection_database); // The mysql_escape_string function has been DEPRECATED as of PHP 5.3.0. // $this->run_query('UPDATE USERS SET USR_USERNAME = \''.mysql_escape_string($this->options['admin']['username']).'\', `USR_PASSWORD` = \''.md5($this->options['admin']['password']).'\' WHERE `USR_UID` = \'00000000000000000000000000000001\' LIMIT 1', // "Add 'admin' user in ProcessMaker (rb)"); $this->run_query('UPDATE RBAC_USERS SET USR_USERNAME = \'' . mysql_real_escape_string($this->options['admin']['username']) . '\', ' . ' `USR_PASSWORD` = \'' . G::encryptOld($this->options['admin']['password']) . '\' ' . ' WHERE `USR_UID` = \'00000000000000000000000000000001\' LIMIT 1', "Add 'admin' user in ProcessMaker (rb)"); }
function getProcessList() { G::LoadClass('case'); G::LoadClass('process'); G::LoadClass('calendar'); $calendar = new Calendar(); $oProcess = new Process(); $oCase = new Cases(); //Get ProcessStatistics Info $start = 0; $limit = ''; $proData = $oProcess->getAllProcesses($start, $limit, null, null, false, true); $bCanStart = $oCase->canStartCase($_SESSION['USER_LOGGED']); if ($bCanStart) { $processListInitial = $oCase->getStartCasesPerType($_SESSION['USER_LOGGED'], 'category'); $processList = array(); foreach ($processListInitial as $key => $procInfo) { if (isset($procInfo['pro_uid'])) { if (trim($procInfo['cat']) == "") { $procInfo['cat'] = "_OTHER_"; } $processList[$procInfo['catname']][$procInfo['value']] = $procInfo; } } ksort($processList); foreach ($processList as $key => $processInfo) { ksort($processList[$key]); } if (!isset($_REQUEST['node'])) { $node = 'root'; } else { $node = $_REQUEST['node']; } foreach ($proData as $key => $proInfo) { $proData[$proInfo['PRO_UID']] = $proInfo; } $processListTree = array(); if (1) { foreach ($processList as $key => $processInfo) { $tempTree['text'] = $key; $tempTree['id'] = G::encryptOld($key); $tempTree['cls'] = 'folder'; $tempTree['draggable'] = true; $tempTree['optionType'] = "category"; //$tempTree['allowDrop']=false; $tempTree['singleClickExpand'] = true; if ($key != "No Category") { $tempTree['expanded'] = true; } else { //$tempTree ['expanded'] = false; $tempTree['expanded'] = true; } $tempTreeChildren = array(); foreach ($processList[$key] as $keyChild => $processInfoChild) { //print_r($processInfo); $tempTreeChild['text'] = htmlentities($keyChild, ENT_QUOTES, 'UTF-8'); //ellipsis ( $keyChild, 50 ); //$tempTree['text']=$key; $tempTreeChild['id'] = G::encryptOld($keyChild); $tempTreeChild['draggable'] = true; $tempTreeChild['leaf'] = true; $tempTreeChild['icon'] = '/images/icon.trigger.png'; $tempTreeChild['allowChildren'] = false; $tempTreeChild['optionType'] = "startProcess"; $tempTreeChild['pro_uid'] = $processInfoChild['pro_uid']; $tempTreeChild['tas_uid'] = $processInfoChild['uid']; $processInfoChild['myInbox'] = 0; $processInfoChild['totalInbox'] = 0; if (isset($proData[$processInfoChild['pro_uid']])) { $tempTreeChild['otherAttributes'] = array_merge($processInfoChild, $proData[$processInfoChild['pro_uid']], $calendar->getCalendarFor($_SESSION['USER_LOGGED'], $processInfoChild['pro_uid'], $processInfoChild['uid'])); $tempTreeChild['otherAttributes']['PRO_TAS_TITLE'] = str_replace(")", "", str_replace("(", "", trim(str_replace($tempTreeChild['otherAttributes']['PRO_TITLE'], "", $tempTreeChild['otherAttributes']["value"])))); $tempTreeChild['qtip'] = $tempTreeChild['otherAttributes']['PRO_DESCRIPTION']; //$tempTree['cls']='file'; $tempTreeChildren[] = $tempTreeChild; } } $tempTree['children'] = $tempTreeChildren; $processListTree[] = $tempTree; } } else { foreach ($processList[$node] as $key => $processInfo) { //print_r($processInfo); $tempTree['text'] = $key; //ellipsis ( $key, 50 ); //$tempTree['text']=$key; $tempTree['id'] = $key; $tempTree['draggable'] = true; $tempTree['leaf'] = true; $tempTree['icon'] = '/images/icon.trigger.png'; $tempTree['allowChildren'] = false; $tempTree['optionType'] = "startProcess"; $tempTree['pro_uid'] = $processInfo['pro_uid']; $tempTree['tas_uid'] = $processInfo['uid']; $processInfo['myInbox'] = 0; $processInfo['totalInbox'] = 0; $tempTree['otherAttributes'] = array_merge($processInfo, $proData[$processInfo['pro_uid']], $calendar->getCalendarFor($processInfo['uid'], $processInfo['uid'], $processInfo['uid'])); $tempTree['otherAttributes']['PRO_TAS_TITLE'] = str_replace(")", "", str_replace("(", "", trim(str_replace($tempTree['otherAttributes']['PRO_TITLE'], "", $tempTree['otherAttributes']["value"])))); $tempTree['qtip'] = $tempTree['otherAttributes']['PRO_DESCRIPTION']; //$tempTree['cls']='file'; $processListTree[] = $tempTree; } } $processList = $processListTree; } else { $processList['success'] = 'failure'; $processList['message'] = G::LoadTranslation('ID_USER_PROCESS_NOT_START'); } print G::json_encode($processList); die; }
//$err = eregi_replace("[\n|\r|\n\r]", ' ', $err); $err = preg_replace("[\n|\r|\n\r]", ' ', $err); //Made compatible to PHP 5.3 echo '{"status":1, "message":"' . $err . '"}'; } break; case 'storeInTmp': try { $con = Propel::getConnection($_GET['cnn']); if ($_GET['pkt'] == 'int') { $rs = $con->executeQuery("SELECT MAX({$_GET['pk']}) as lastId FROM {$_GET['table']};"); $rs->next(); $row = $rs->getRow(); $gKey = (int) $row['lastId'] + 1; } else { $gKey = G::encryptOld(date('Y-m-d H:i:s') . '@' . rand()); } $rs = $con->executeQuery("INSERT INTO {$_GET['table']} ({$_GET['pk']}, {$_GET['fld']}) VALUES ('{$gKey}', '{$_GET['value']}');"); echo "{status: 1, message: \"success\"}"; } catch (Exception $e) { $err = $e->getMessage(); //$err = eregi_replace("[\n|\r|\n\r]", ' ', $err); $err = preg_replace("[\n|\r|\n\r]", " ", $err); //Made compatible to PHP 5.3 echo "{status: 0, message: \"" . $err . "\"}"; } break; } } function sortByChar($aRows, $charSel) {