diff --git a/framework/src/Maveriks/WebApplication.php b/framework/src/Maveriks/WebApplication.php index 2c85b2d08..c38f78fb6 100644 --- a/framework/src/Maveriks/WebApplication.php +++ b/framework/src/Maveriks/WebApplication.php @@ -7,6 +7,7 @@ use ProcessMaker\Services; use ProcessMaker\Services\Api; use Luracast\Restler\RestException; use Illuminate\Foundation\Http\Kernel; +use G; /** * Web application bootstrap @@ -448,6 +449,7 @@ class WebApplication define("PATH_CONTROLLERS", PATH_CORE . "controllers" . PATH_SEP); define("PATH_SERVICES_REST", PATH_CORE . "services" . PATH_SEP . "rest" . PATH_SEP); + G::defineConstants(); $arraySystemConfiguration = \PmSystem::getSystemConfiguration(); ini_set('date.timezone', $arraySystemConfiguration['time_zone']); //Set Time Zone diff --git a/gulliver/system/class.g.php b/gulliver/system/class.g.php index 174749f9f..464c5ab24 100644 --- a/gulliver/system/class.g.php +++ b/gulliver/system/class.g.php @@ -5823,6 +5823,19 @@ class G $_SESSION['_DATA_TRIGGER_']['_TRI_LOG_'] = true; } } + + /** + * Define the Processmaker constants. + * + */ + public static function defineConstants() + { + //Moved from Enterprise class. + if (file_exists(PATH_METHODS . "login/version-pmos.php")) { + include (PATH_METHODS . "login/version-pmos.php"); + } + //Removed default version from code. + } } /** diff --git a/gulliver/system/class.publisher.php b/gulliver/system/class.publisher.php index f0400afd0..31359711c 100644 --- a/gulliver/system/class.publisher.php +++ b/gulliver/system/class.publisher.php @@ -369,7 +369,7 @@ class Publisher default: $label = ($oTable->fields[$f]['Label'] != '') ? $oTable->fields[$f]['Label'] : $f; $label = str_replace( "\n", ' ', $label ); - $pm->fields[$f] = new XmlForm_Field_popupOption( new Xml_Node( $f, 'complete', '', array ('label' => $label,'type' => 'popupOption','launch' => $oTable->id . '.showHideField("' . $f . '")' ) ) ); + $pm->fields[$f] = new XmlForm_Field_PopupOption( new Xml_Node( $f, 'complete', '', array ('label' => $label,'type' => 'popupOption','launch' => $oTable->id . '.showHideField("' . $f . '")' ) ) ); $pm->values[$f] = ''; } } diff --git a/gulliver/system/class.rbac.php b/gulliver/system/class.rbac.php index 65c4754be..5bb5d5713 100644 --- a/gulliver/system/class.rbac.php +++ b/gulliver/system/class.rbac.php @@ -532,7 +532,7 @@ class RBAC { /*----------------------------------********---------------------------------*/ - $licenseManager =& pmLicenseManager::getSingleton(); + $licenseManager =& PmLicenseManager::getSingleton(); if (in_array(G::encryptOld($licenseManager->result), array('38afd7ae34bd5e3e6fc170d8b09178a3', 'ba2b45bdc11e2a4a6e86aab2ac693cbb'))) { return -7; } diff --git a/gulliver/system/class.xmlform.php b/gulliver/system/class.xmlform.php index 8c8e71236..909198ac6 100644 --- a/gulliver/system/class.xmlform.php +++ b/gulliver/system/class.xmlform.php @@ -5467,6 +5467,86 @@ class XmlForm public $requiredFields = array (); public $fieldContentWidth = 450; + /** + * List of xmlform controls and its classes. + * + * @var string[] + */ + private static $controls = [ + 'button' => XmlForm_Field_Button::class, + 'caption' => XmlForm_Field_Caption::class, + 'captioncurrency' => XmlForm_Field_CaptionCurrency::class, + 'captionpercentage' => XmlForm_Field_CaptionPercentage::class, + 'cellmark' => XmlForm_Field_cellMark::class, + 'checkbox2' => XmlForm_Field_Checkbox2::class, + 'checkbox' => XmlForm_Field_Checkbox::class, + 'checkboxpt' => XmlForm_Field_Checkboxpt::class, + 'checkboxtable' => XmlForm_Field_CheckBoxTable::class, + 'checkgroup' => XmlForm_Field_CheckGroup::class, + 'checkgroupview' => XmlForm_Field_CheckGroupView::class, + 'currency' => XmlForm_Field_Currency::class, + 'date2' => XmlForm_Field_Date2::class, + 'date5' => XmlForm_Field_Date5::class, + 'date' => XmlForm_Field_Date::class, + 'dateview' => XmlForm_Field_DateView::class, + 'dropdown' => XmlForm_Field_Dropdown::class, + 'dropdownpt' => XmlForm_Field_Dropdownpt::class, + 'dveditor' => XmlForm_Field_DVEditor::class, + 'fastsearch' => XmlForm_Field_FastSearch::class, + 'file' => XmlForm_Field_File::class, + 'grid' => XmlForm_Field_Grid::class, + 'hidden' => XmlForm_Field_Hidden::class, + 'hours' => XmlForm_Field_Hours::class, + 'html' => XmlForm_Field_HTML::class, + 'image' => XmlForm_Field_Image::class, + 'javascript' => XmlForm_Field_JavaScript::class, + 'label' => XmlForm_Field_Label::class, + 'link' => XmlForm_Field_Link::class, + 'listbox' => XmlForm_Field_Listbox::class, + 'password' => XmlForm_Field_Password::class, + 'percentage' => XmlForm_Field_Percentage::class, + 'popupoption' => XmlForm_Field_PopupOption::class, + 'print' => XmlForm_Field_Print::class, + 'radiogroup' => XmlForm_Field_RadioGroup::class, + 'radiogroupview' => XmlForm_Field_RadioGroupView::class, + 'reset' => XmlForm_Field_Reset::class, + 'simpletext' => XmlForm_Field_SimpleText::class, + 'submit' => XmlForm_Field_Submit::class, + 'subtitle' => XmlForm_Field_Subtitle::class, + 'suggest' => XmlForm_Field_Suggest::class, + 'text' => XmlForm_Field_Text::class, + 'textarea' => XmlForm_Field_Textarea::class, + 'textareapm' => XmlForm_Field_TextareaPM::class, + 'textpm' => XmlForm_Field_TextPM::class, + 'title' => XmlForm_Field_Title::class, + 'toolbar' => XmlForm_Field_ToolBar::class, + 'toolbutton' => XmlForm_Field_toolButton::class, + 'wysiwyg_editor' => XmlForm_Field_WYSIWYG_EDITOR::class, + 'xmlform' => XmlForm_Field_Xmlform::class, + 'xmlmenu' => XmlForm_Field_XmlMenu::class, + 'yesno' => XmlForm_Field_YesNo::class, + ]; + + /** + * Get xmlform control class by type. + * + * @param string $type + * @return string + */ + private function getClassByControlType($type) + { + $key = strtolower($type); + if (isset(self::$controls[$key])) { + return self::$controls[$key]; + } elseif (class_exists('XmlForm_Field_' . $type)) { + return 'XmlForm_Field_' . $type; + } elseif (class_exists('XmlForm_Field_' . $key)) { + return 'XmlForm_Field_' . $key; + } else { + return 'XmlForm_Field'; + } + } + /** * Function xmlformTemplate * @@ -5567,14 +5647,8 @@ class XmlForm 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 ); - } - + $class = $this->getClassByControlType($xmlNode[$k]->attributes['type']); + $field = new $class( $xmlNode[$k], $language, $this->home, $this ); $field->language = $this->language; $this->fields[$field->name] = $field; } diff --git a/rbac/engine/config/paths.php b/rbac/engine/config/paths.php index 38c3c4015..db7867be6 100644 --- a/rbac/engine/config/paths.php +++ b/rbac/engine/config/paths.php @@ -81,4 +81,4 @@ if (!is_dir(PATH_SMARTY_C)) G::mk_dir(PATH_SMARTY_C); if (!is_dir(PATH_SMARTY_CACHE)) G::mk_dir(PATH_SMARTY_CACHE); -?> +G::defineConstants(); diff --git a/tests/WorkflowTestCase.php b/tests/WorkflowTestCase.php index 56df31b9c..ccef158c9 100644 --- a/tests/WorkflowTestCase.php +++ b/tests/WorkflowTestCase.php @@ -170,7 +170,7 @@ class WorkflowTestCase extends TestCase throw new \Exception('To continue please put a valid license at features/resources'); } G::LoadClass('pmLicenseManager'); - $licenseManager = new pmLicenseManager(); + $licenseManager = new PmLicenseManager(); $licenseManager->installLicense($licenseFile[0]); } diff --git a/workflow/engine/classes/ActionsByEmailCoreClass.php b/workflow/engine/classes/ActionsByEmailCoreClass.php index c0826a502..88c11bafe 100644 --- a/workflow/engine/classes/ActionsByEmailCoreClass.php +++ b/workflow/engine/classes/ActionsByEmailCoreClass.php @@ -171,7 +171,7 @@ class ActionsByEmailCoreClass extends PMPlugin $field->label = ''; $actionField = str_replace(array('@@', '@#', '@=', '@%', '@?', '@$'), '', $configuration['ABE_ACTION_FIELD']); - $obj = new pmDynaform($configuration['DYN_UID']); + $obj = new PmDynaform($configuration['DYN_UID']); $configuration['CURRENT_DYNAFORM'] = $configuration['DYN_UID']; $file = $obj->printPmDynaformAbe($configuration); $__ABE__ .= $file; @@ -222,7 +222,7 @@ class ActionsByEmailCoreClass extends PMPlugin } } - $obj = new pmDynaform($configuration['DYN_UID']); + $obj = new PmDynaform($configuration['DYN_UID']); $configuration['CURRENT_DYNAFORM'] = $configuration['DYN_UID']; $file = $obj->printPmDynaformAbe($configuration); $__ABE__ .= $file; diff --git a/workflow/engine/classes/ConsolidatedCases.php b/workflow/engine/classes/ConsolidatedCases.php index a6de1de63..f3ffd8453 100644 --- a/workflow/engine/classes/ConsolidatedCases.php +++ b/workflow/engine/classes/ConsolidatedCases.php @@ -52,7 +52,7 @@ class ConsolidatedCases $oReportTables = new ReportTables(); $oReportTables->deleteAllReportVars($_POST['form']['REP_TAB_UID']); - $pmDyna = new pmDynaform(array()); + $pmDyna = new PmDynaform(array()); $pmDyna->fields["CURRENT_DYNAFORM"] = $DynUid; $dataDyna = $pmDyna->getDynaform(); $json = G::json_decode($dataDyna["DYN_CONTENT"]); diff --git a/workflow/engine/classes/DashletOpenVsCompleted.php b/workflow/engine/classes/DashletOpenVsCompleted.php index 8194416a6..7adc9c9f1 100644 --- a/workflow/engine/classes/DashletOpenVsCompleted.php +++ b/workflow/engine/classes/DashletOpenVsCompleted.php @@ -274,7 +274,7 @@ class DashletOpenVsCompleted implements DashletInterface public function render ($width = 300) { - $g = new pmGauge(); + $g = new PmGauge(); $g->w = $width; $g->value = $this->value; diff --git a/workflow/engine/classes/DynaformEditor.php b/workflow/engine/classes/DynaformEditor.php index 1591e5863..983b04b1b 100644 --- a/workflow/engine/classes/DynaformEditor.php +++ b/workflow/engine/classes/DynaformEditor.php @@ -1,6 +1,12 @@ panelConf = array_merge($this->panelConf, $this->defaultConfig['Editor']); //'title' => G::LoadTranslation('ID_DYNAFORM_EDITOR').' - ['.$this->title.']', @@ -111,7 +117,7 @@ class DynaformEditor extends WebResource $openDoc->parseXmlFile($fileName); } //$form = new Form( $this->file , $this->home, SYS_LANG, true ); - $Properties = dynaformEditorAjax::get_properties($A, $this->dyn_uid); + $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', ''); diff --git a/workflow/engine/classes/DynaformEditorAjax.php b/workflow/engine/classes/DynaformEditorAjax.php index dd45319b4..7e58676e9 100644 --- a/workflow/engine/classes/DynaformEditorAjax.php +++ b/workflow/engine/classes/DynaformEditorAjax.php @@ -1,718 +1,694 @@ -. - * - * 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 +_run($post); - } - - /** - * Function Run - * - * @param var $post - * @return void - */ - public function _run($post) - { - WebResource::WebResource($_SERVER['REQUEST_URI'], $post); - } - - /** - * Prints the DynaformEditorAjax - * - * @param object $A - * @return ob_get_clean - */ - public function render_preview($A) - { - ob_start(); - $file = G::decrypt($A, URL_KEY); - global $G_PUBLISH; - $G_PUBLISH = new Publisher(); - $G_PUBLISH->publisherId = 'preview'; - $form = new Form($file, PATH_DYNAFORM, SYS_LANG, true, $G_PUBLISH->publisherId); - switch (basename($form->template, '.html')) { - case 'grid': - $template = 'grid'; - $aAux = array_keys($form->fields); - if (count($aAux) > 0) { - $aFields = (array_combine($aAux, $aAux)); - } else { - $aFields = $aAux; - } - if (is_array($aFields)) { - foreach ($aFields as $key => $val) { - $aFields[$key] = array(1 => "", 2 => "", 3 => "", 4 => "", 5 => ""); - } - } - break; - default: - $template = 'xmlform_' . $G_PUBLISH->publisherId; - $aFields = array('__DYNAFORM_OPTIONS' => array('PREVIOUS_STEP' => '#', 'NEXT_STEP' => '#', 'NEXT_STEP_LABEL' => G::loadTranslation('ID_NEXT_STEP'), 'PREVIOUS_ACTION' => 'return false;', 'NEXT_ACTION' => 'return false;' - ) - ); - } - $G_PUBLISH->AddContent('dynaform', $template, $file, '', $aFields, ''); - G::RenderPage('publish', 'raw'); - return ob_get_clean(); - } - - /** - * Prints the Dynaform in format HTML - * - * @param object $A - * @return array - */ - public function render_htmledit($A) - { - $script = ''; - $file = G::decrypt($A, URL_KEY); - ob_start(); - global $G_PUBLISH; - $form = new Form($file, PATH_DYNAFORM, SYS_LANG, true); - $G_PUBLISH = new Publisher(); - $G_PUBLISH->publisherId = ''; - $html = $this->get_htmlcode($A); - if (!is_string($html)) { - $error = $html; - $html = ''; - } else { - $error = 0; - } - $HtmlEditor = array('URL' => $A, 'HTML' => $html, 'DYN_UID' => $file ); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_HtmlEditor', '', $HtmlEditor, '', ''); - G::RenderPage("publish", 'raw'); - return array('error' => $error, 'html' => ob_get_clean() - ); - } - - /** - * Get the html code - * Loads the stored HTML or the default Template if - * it doesn't exist. - * - * @param object $A - * @return code html - */ - public function get_htmlcode($A) - { - try { - $script = null; - $fileTmp = G::decrypt($A, URL_KEY); - $form = new Form($fileTmp, PATH_DYNAFORM, SYS_LANG, true); - - //Navigation Bar - $form->fields = G::array_merges(array("__DYNAFORM_OPTIONS" => new XmlForm_Field_XmlMenu(new Xml_Node("__DYNAFORM_OPTIONS", "complete", "", array("type" => "xmlmenu", "xmlfile" => "gulliver/dynaforms_Options" - )), SYS_LANG, PATH_XMLFORM, $form) - ), $form->fields); - - //Loads the stored HTML or the default Template if - //it doesn't exist. - $filename = substr($form->fileName, 0, - 3) . ($form->type === "xmlform" ? "" : "." . $form->type) . "html"; - - if (!file_exists($filename)) { - $html = $form->printTemplate($form->template, $script); - } else { - $html = implode("", file($filename)); - } - - /* - * It adds the new fields automatically at the bottom of the form. - * TODO: �TOP OR BOTTOM? - * Improving detection algorithm of new fields. - * Current: Do not check the fields that have already been reviewed (saving) - * Already checked the temporary file dynaforms editor. - */ - $tmp = self::_getTmpData(); - if (!isset($tmp['OLD_FIELDS'])) { - $tmp['OLD_FIELDS'] = array(); //var_dump($html);die; - } - $aAux = explode('', $html); - foreach ($form->fields as $field) { - if ((strpos($html, '{$form.' . $field->name . '}') === false) && (strpos($html, '{$' . $field->name . '}') === false)) { - //Aparantly is new (but could be a deleted or non visible like private type fields) - switch (strtolower($field->type)) { - case 'private': - case 'phpvariable': - break; - default: - if (array_search($field->name, $tmp['OLD_FIELDS']) === false) { - //TOP - $aAux[0] .= '
{$' . $field->name . '}' . '{$form.' . $field->name . '}'; - //$html.='
{$'.$field->name.'}'.'{$form.'.$field->name.'}'; - //BOTTOM - //$html='{$'.$field->name.'}'.'{$form.'.$field->name.'}'.$html; - //$tmp['OLD_FIELDS'][]=$field->name; - } - } - } - } - self::_setTmpData($tmp); - //$html=str_replace('{$form_className}','formDefault', $html ); - $html = str_replace('{$form_className}', 'formDefault', $aAux[0] . ''); - - return $html; - } catch (Exception $e) { - return (array) $e; - } - } - - /** - * Restore the html code - * - * @param object $A - * @return code html - */ - public function restore_html($A) - { - - $filter = new InputFilter(); - $script = null; - $fileTmp = G::decrypt($A, URL_KEY); - $form = new Form($fileTmp, PATH_DYNAFORM, SYS_LANG, true); - - //Navigation Bar - $form->fields = G::array_merges(array("__DYNAFORM_OPTIONS" => new XmlForm_Field_XmlMenu(new Xml_Node("__DYNAFORM_OPTIONS", "complete", "", array("type" => "xmlmenu", "xmlfile" => "gulliver/dynaforms_Options" - )), SYS_LANG, PATH_XMLFORM, $form) - ), $form->fields); - - $form->enableTemplate = false; - $html = $form->printTemplate($form->template, $script); - $html = str_replace('{$form_className}', 'formDefault', $html); - $pathTmp = $filter->xssFilterHard(PATH_DYNAFORM . $fileTmp . '.html', 'path'); - if (file_exists($pathTmp)) { - unlink($pathTmp); - } - $fp = fopen($pathTmp, 'w'); - fwrite($fp, $html); - fclose($fp); - - return $html; - } - - /** - * Set the html code - * - * @param object $A - * @return array - */ - public function set_htmlcode($A, $htmlcode) - { - try { - - $filter = new InputFilter(); - $iOcurrences = preg_match_all('/\{\$.*?\}/im', $htmlcode, $matches); - if ($iOcurrences) { - if (isset($matches[0])) { - $tagsHtml = $matches[0]; - foreach ($tagsHtml as $value) { - $aTagVar = strip_tags($value); - if ($value != $aTagVar) { - $htmlcode = str_replace($value, $aTagVar, $htmlcode); - } - } - } - } - $file = G::decrypt($A, URL_KEY); - $form = new Form($file, PATH_DYNAFORM, SYS_LANG, true); - $filename = substr($form->fileName, 0, - 3) . ($form->type === 'xmlform' ? '' : '.' . $form->type) . 'html'; - $filename = $filter->xssFilterHard($filename, 'path'); - $fp = fopen($filename, 'w'); - fwrite($fp, $htmlcode); - fclose($fp); - return 0; - } catch (Exception $e) { - return (array) $e; - } - } - - /** - * Get the xml code - * - * @param object $A - * @return array - */ - public function get_xmlcode($A) - { - try { - $file = G::decrypt($A, URL_KEY); - $xmlcode = implode('', file(PATH_DYNAFORM . $file . '.xml')); - return array("xmlcode" => $xmlcode, "error" => 0 - ); - } catch (Exception $e) { - return array("xmlcode" => "", "error" => (array) $e - ); - } - } - - /** - * Set the xml code - * - * @param object $A - * @param array $xmlcode - * @return string - */ - public function set_xmlcode($A, $xmlcode) - { - - $filter = new InputFilter(); - $xmlcode = urldecode($xmlcode); - $file = G::decrypt($A, URL_KEY); - $xmlcode = str_replace(' ', ' ', trim($xmlcode)); - $pathFile = $filter->xssFilterHard(PATH_DYNAFORM . $file . '.xml', "path"); - $fp = fopen($pathFile, 'w'); - fwrite($fp, $xmlcode); - fclose($fp); - return ""; - } - - /** - * Get the javascript code - * - * @param object $A - * @param string $fieldName - * @return array - */ - public function get_javascripts($A, $fieldName) - { - try { - $file = G::decrypt($A, URL_KEY); - $form = new Form($file, PATH_DYNAFORM, SYS_LANG, true); - $aOptions = array(); - $sCode = ''; - foreach ($form->fields as $name => $value) { - if (strcasecmp($value->type, "javascript") == 0) { - $aOptions[] = array('key' => $name, 'value' => $name - ); - if ($name == $fieldName) { - $sCode = $value->code; - } - } - } - return array('aOptions' => $aOptions, 'sCode' => $sCode - ); - } catch (Exception $e) { - return (array) $e; - } - } - - /** - * Set the javascript code - * - * @param object $A - * @param string $fieldName - * @param string $sCode - * @return array - */ - public function set_javascript($A, $fieldName, $sCode, $meta = '') - { - - $filter = new InputFilter(); - $fieldName = $filter->xssFilterHard($fieldName, 'path'); - if ($fieldName == '___pm_boot_strap___') { - return 0; - } - - $sCode = urldecode($sCode); - try { - $sCode = rtrim($sCode); - $file = G::decrypt($A, URL_KEY); - /* $dbc2 = new DBConnection( PATH_DYNAFORM . $file . '.xml' ,'','','','myxml' ); - $ses2 = new DBSession($dbc2); - $ses2->execute(G::replaceDataField("UPDATE dynaForm SET XMLNODE_VALUE = @@CODE WHERE XMLNODE_NAME = @@FIELDNAME ", array('FIELDNAME'=>$fieldName,'CODE'=>$sCode), "myxml" )); - */ - - - $pathFile = $filter->xssFilterHard(PATH_DYNAFORM . "{$file}.xml", 'path'); - $dynaform = new DynaformHandler($pathFile); - $dynaform->replace($fieldName, $fieldName, Array('type' => 'javascript', 'meta' => $meta, '#cdata' => $sCode - )); - - return 0; - } catch (Exception $e) { - return (array) $e; - } - } - - /** - * Get properties of the dynaForm - * - * @param file $A - * @param string $DYN_UID - * @return array - */ - public function get_properties($A, $DYN_UID) - { - $file = G::decrypt($A, URL_KEY); - $tmp = self::_getTmpData(); - if (!(isset($tmp['Properties']) && isset($tmp['useTmpCopy']))) { - $dynaform = new Dynaform(); - $dynaform->load($DYN_UID); - $form = new Form($file, PATH_DYNAFORM, SYS_LANG, true); - $Properties = array('A' => $A, 'DYN_UID' => $dynaform->getDynUid(), 'PRO_UID' => $dynaform->getProUid(), 'DYN_TITLE' => $dynaform->getDynTitle(), 'DYN_TYPE' => $dynaform->getDynType(), 'DYN_DESCRIPTION' => $dynaform->getDynDescription(), 'WIDTH' => $form->width, - //'ENABLETEMPLATE'=> $form->enableTemplate, - 'MODE' => $form->mode, 'PRINTDYNAFORM' => $form->printdynaform, 'ADJUSTGRIDSWIDTH' => $form->adjustgridswidth, 'NEXTSTEPSAVE' => $form->nextstepsave - ); - $tmp['Properties'] = $Properties; - self::_setTmpData($tmp); - } else { - $form = new Form($file, PATH_DYNAFORM, SYS_LANG, true); - $Properties = $tmp['Properties']; - if (!isset($Properties['ENABLETEMPLATE'])) { - $Properties['ENABLETEMPLATE'] = "0"; - } - $Properties['WIDTH'] = $form->width; - $Properties['MODE'] = $form->mode; - } - return $Properties; - } - - /** - * Set properties of the dynaForm - * - * @param file $A - * @param string $DYN_UID - * @param array $getFields - * @return array - */ - public function set_properties($A, $DYN_UID, $getFields) - { - try { - - $filter = new InputFilter(); - $post = array(); - parse_str($getFields, $post); - $Fields = $post['form']; - //if (!isset($Fields['ENABLETEMPLATE'])) $Fields['ENABLETEMPLATE'] ="0"; - $file = G::decrypt($A, URL_KEY); - $tmp = self::_getTmpData(); - if (!isset($tmp['useTmpCopy'])) { - $dynaform = new Dynaform(); - $dynaform->update($Fields); - } else { - $tmp['Properties'] = $Fields; - self::_setTmpData($tmp); - } - $pathFile = $filter->xssFilterHard(PATH_DYNAFORM . "{$file}.xml", 'path'); - $dynaform = new DynaformHandler($pathFile); - $dbc2 = new DBConnection($pathFile, '', '', '', 'myxml'); - $ses2 = new DBSession($dbc2); - //if (!isset($Fields['ENABLETEMPLATE'])) $Fields['ENABLETEMPLATE'] ="0"; - - /* if (isset($Fields['ENABLETEMPLATE'])) { - $ses2->execute(G::replaceDataField("UPDATE . SET ENABLETEMPLATE = @@ENABLETEMPLATE WHERE XMLNODE_NAME = 'dynaForm' ", $Fields)); - } */ - if (isset($Fields['DYN_TYPE'])) { - //$ses2->execute( G::replaceDataField( "UPDATE . SET TYPE = @@DYN_TYPE WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) ); - $dynaform->modifyHeaderAttribute('type', $Fields['DYN_TYPE']); - } - if (isset($Fields['WIDTH'])) { - // $ses2->execute( G::replaceDataField( "UPDATE . SET WIDTH = @@WIDTH WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) ); - $dynaform->modifyHeaderAttribute('width', $Fields['WIDTH']); - //g::pr($dynaform->getHeaderAttribute('width')); - } - if (isset($Fields['MODE'])) { - // $ses2->execute( G::replaceDataField( "UPDATE . SET MODE = @@MODE WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) ); - $dynaform->modifyHeaderAttribute('mode', $Fields['MODE']); - } - if (isset($Fields['NEXTSTEPSAVE'])) { - //$ses2->execute( G::replaceDataField( "UPDATE . SET NEXTSTEPSAVE = @@NEXTSTEPSAVE WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) ); - $dynaform->modifyHeaderAttribute('nextstepsave', $Fields['NEXTSTEPSAVE']); - } - if (isset($Fields['PRINTDYNAFORM'])) { - //$ses2->execute( G::replaceDataField( "UPDATE . SET PRINTDYNAFORM = @@PRINTDYNAFORM WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) ); - $dynaform->modifyHeaderAttribute('printdynaform', $Fields['PRINTDYNAFORM']); - } - if (isset($Fields['ADJUSTGRIDSWIDTH'])) { - //$ses2->execute( G::replaceDataField( "UPDATE . SET ADJUSTGRIDSWIDTH = @@ADJUSTGRIDSWIDTH WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) ); - $dynaform->modifyHeaderAttribute('adjustgridswidth', $Fields['ADJUSTGRIDSWIDTH']); - } - - return 0; - } catch (Exception $e) { - return (array) $e; - } - } - - /** - * Get enable template - * - * @param object $A - * @return string - */ - public function get_enabletemplate($A) - { - $file = G::decrypt($A, URL_KEY); - $form = new Form($file, PATH_DYNAFORM, SYS_LANG, true); - return $form->enableTemplate; - } - - /** - * Set enable template - * - * @param object $A - * @param string $value - * @return string - */ - public function set_enabletemplate($A, $value) - { - - $filter = new InputFilter(); - $file = G::decrypt($A, URL_KEY); - $value = $value == "1" ? "1" : "0"; - // $dbc2 = new DBConnection( PATH_DYNAFORM . $file . '.xml', '', '', '', 'myxml' ); - // $ses2 = new DBSession( $dbc2 ); - // $ses2->execute( "UPDATE . SET ENABLETEMPLATE = '$value'" ); - $pathFile = $filter->xssFilterHard(PATH_DYNAFORM . "{$file}.xml", 'path'); - $dynaform = new DynaformHandler($pathFile); - $dynaform->modifyHeaderAttribute('enabletemplate', $value); - - return $value; - } - - /** - * Save a dynaForm - * - * @param object $A - * @param string $DYN_UID - * @return array - */ - public function save($A, $DYN_UID) - { - try { - $answer = 0; - $file = G::decrypt($A, URL_KEY); - $tmp = self::_getTmpData(); - if (isset($tmp['Properties'])){ - $fileFirst = $tmp['Properties']['PRO_UID'].'/'.$tmp['Properties']['DYN_UID']; - } - if (isset($tmp['useTmpCopy'])) { - /* Save Register */ - $dynaform = new Dynaform(); - $dynaform->update($tmp['Properties']); - /* Save file */ - $copyFirst = implode('', file(PATH_DYNAFORM . $fileFirst . '.xml')); - $copy = implode('', file(PATH_DYNAFORM . $file . '.xml')); - /*Check differences between XML*/ - $elementFirst = new SimpleXMLElement($copyFirst); - $elementCopy = new SimpleXMLElement($copy); - $desAdd = ''; - $desDel = ''; - //Check the new fields - foreach ($elementCopy as $key1 => $row1){ - $swAll = true; - foreach ($elementFirst as $key2 => $row2){ - if ($key1 == $key2){ - $swAll = false; - break; - } - } - if ($swAll){ - $desAdd .= $key1." "; - } - } - //Check the delete fields - foreach ($elementFirst as $key1 => $row1){ - $swAll = true; - foreach ($elementCopy as $key2 => $row2){ - if ($key1 == $key2){ - $swAll = false; - break; - } - } - if ($swAll){ - $desDel .= $key1." "; - } - } - - $mode = empty($tmp['Properties']['MODE'])? 'Determined by Fields' : $tmp['Properties']['MODE']; - $auditDescription = "Dynaform Title: ".$tmp['Properties']['DYN_TITLE'].", Type: ".$tmp['Properties']['DYN_TYPE'].", Description: ".$tmp['Properties']['DYN_DESCRIPTION'].", Mode: ".$mode; - if($desAdd != ''){ - $auditDescription .= ", Field(s) Add: ".$desAdd; - } - if($desDel != ''){ - $auditDescription .= ", Field(s) Delete: ".$desDel; - } - //Add Audit Log - G::auditLog("UpdateDynaform", $auditDescription); - - - /* - * added by krlos carlos/a/colosa.com - * in here we are validation if a xmlform has a submit action - */ - // if (!preg_match("/type=\"submit\"/",$copy) && !preg_match("/type=\"grid\"/",$copy) && !isset($_SESSION['submitAction']) ){ - if (!preg_match("/type=\"submit\"/", $copy) && !preg_match("/type=\"grid\"/", $copy)) { - // $_SESSION['submitAction'] = 1; - $answer = 'noSub'; - } - $copyHtml = false; - if (file_exists(PATH_DYNAFORM . $file . '.html')) { - $copyHtml = implode('', file(PATH_DYNAFORM . $file . '.html')); - } - $file = dynaformEditor::_getFilename($file); - $fcopy = fopen(PATH_DYNAFORM . $file . '.xml', "w"); - fwrite($fcopy, $copy); - fclose($fcopy); - if ($copyHtml) { - $fcopy = fopen(PATH_DYNAFORM . $file . '.html', "w"); - fwrite($fcopy, $copyHtml); - fclose($fcopy); - } - } else { - //throw new Exception("It should not come here unless you have disabled the temporary copy."); - } - return $answer; - } catch (Exception $e) { - return (array) $e; - } - } - - /** - * Close a dynaform - * - * @param object $A - * @return array - */ - public function close($A) - { - try { - /* - * we are unseting this variable. It's our control about to save the xmlfrom - */ - // unset($_SESSION['submitAction']); - $file = G::decrypt($A, URL_KEY); - //return(array('response'=>PATH_DYNAFORM . $file . '.xml')); - /* Delete the temporal copy */ - $tmp = self::_getTmpData(); - $xmlFile = PATH_DYNAFORM . $file . '.xml'; - $htmlFile = PATH_DYNAFORM . $file . '.html'; - //return(array('response'=>$tmp['useTmpCopy'])); - if (isset($tmp['useTmpCopy'])) { - //return(array('response'=>PATH_DYNAFORM . $file . '.xml')); - if ($file !== dynaformEditor::_getFilename($file)) { - // return(array('response'=>PATH_DYNAFORM . $file . '.xml')); - if (file_exists($xmlFile)) { - unlink($xmlFile); - } - if (file_exists($htmlFile)) { - unlink($htmlFile); - } - } - } - return 0; - } catch (Exception $e) { - return (array) $e; - } - } - - /** - * Checks if a dynaform was changed - * - * @param file $A - * @param string $DYN_UID - * @return array - */ - public function is_modified($A, $DYN_UID) - { - $file = G::decrypt($A, URL_KEY); - try { - /* Compare Properties */ - $dynaform = new Dynaform(); - $dynaform->load($DYN_UID); - $form = new Form($file, PATH_DYNAFORM, SYS_LANG, true); - $sp = array('A' => $A, 'DYN_UID' => $dynaform->getDynUid(), 'PRO_UID' => $dynaform->getProUid(), 'DYN_TITLE' => $dynaform->getDynTitle(), 'DYN_TYPE' => $dynaform->getDynType(), 'DYN_DESCRIPTION' => $dynaform->getDynDescription(), 'WIDTH' => $form->width, 'ENABLETEMPLATE' => $form->enableTemplate, 'MODE' => $form->mode - ); - $P = self::get_properties($A, $DYN_UID); - if (!isset($P['DYN_TITLE'])) { - $P['DYN_TITLE'] = $sp['DYN_TITLE']; - } - if (!isset($P['DYN_TYPE'])) { - $P['DYN_TYPE'] = $sp['DYN_TYPE']; - } - if (!isset($P['DYN_DESCRIPTION'])) { - $P['DYN_DESCRIPTION'] = $sp['DYN_DESCRIPTION']; - } - if (!isset($P['WIDTH'])) { - $P['WIDTH'] = $sp['WIDTH']; - } - if (!isset($P['ENABLETEMPLATE'])) { - $P['ENABLETEMPLATE'] = $sp['ENABLETEMPLATE']; - } - if (!isset($P['MODE'])) { - $P['MODE'] = $sp['MODE']; - } - $modPro = ($sp['DYN_TITLE'] != $P['DYN_TITLE']) || ($sp['DYN_TYPE'] != $P['DYN_TYPE']) || ($sp['DYN_DESCRIPTION'] != $P['DYN_DESCRIPTION']); - /* || - ($sp['WIDTH']!=$P['WIDTH']) || - ($sp['ENABLETEMPLATE']!=$P['ENABLETEMPLATE']) || - ($sp['MODE']!=$P['MODE']) */ - /* Compare copies */ - $fileOrigen = dynaformEditor::_getFilename($file); - $copy = implode('', file(PATH_DYNAFORM . $file . '.xml')); - $origen = implode('', file(PATH_DYNAFORM . $fileOrigen . '.xml')); - $copyHTML = file_exists(PATH_DYNAFORM . $file . '.html') ? implode('', file(PATH_DYNAFORM . $file . '.html')) : false; - $origenHTML = file_exists(PATH_DYNAFORM . $fileOrigen . '.html') ? implode('', file(PATH_DYNAFORM . $fileOrigen . '.html')) : false; - $modFile = ($copy !== $origen) || ($origenHTML && ($copyHTML !== $origenHTML)); - //Return - //return array("*message"=>sprintf("%s, (%s= %s %s):", $modPro?"1":"0" , $modFile?"1":"0", ($copy!==$origen)?"1":"0" , ($origenHTML && ($copyHTML!==$origenHTML))?"1":"0" )); - //die("c'est fini"); - return $modPro || $modFile; - } catch (Exception $e) { - return (array) $e; - } - } - /* - Functionality: Funcion que convierte objecto en array - Parameters : Object $object que queremos convertir - Return: Array - */ - public function convertObjectToArray($object){ - if( !is_object( $object ) && !is_array( $object ) ){ - return $object; - } - if( is_object( $object ) ){ - $object = get_object_vars( $object ); - } - return array_map( 'objectToArray', $object ); - } -} +/** + * DynaformEditorAjax - DynaformEditorAjax class + * + * @package workflow.engine.classes + */class DynaformEditorAjax extends DynaformEditor implements IDynaformEditorAjax +{ + + /** + * Constructor of the class dynaformEditorAjax + * + * @param var $post + * @return void + */ + public function __construct($post) + { + $this->_run($post); + } + + /** + * Function Run + * + * @param var $post + * @return void + */ + public function _run($post) + { + WebResource::WebResource($_SERVER['REQUEST_URI'], $post); + } + + /** + * Prints the DynaformEditorAjax + * + * @param object $A + * @return ob_get_clean + */ + public function render_preview($A) + { + ob_start(); + $file = G::decrypt($A, URL_KEY); + global $G_PUBLISH; + $G_PUBLISH = new Publisher(); + $G_PUBLISH->publisherId = 'preview'; + $form = new Form($file, PATH_DYNAFORM, SYS_LANG, true, $G_PUBLISH->publisherId); + switch (basename($form->template, '.html')) { + case 'grid': + $template = 'grid'; + $aAux = array_keys($form->fields); + if (count($aAux) > 0) { + $aFields = (array_combine($aAux, $aAux)); + } else { + $aFields = $aAux; + } + if (is_array($aFields)) { + foreach ($aFields as $key => $val) { + $aFields[$key] = array(1 => "", 2 => "", 3 => "", 4 => "", 5 => ""); + } + } + break; + default: + $template = 'xmlform_' . $G_PUBLISH->publisherId; + $aFields = array('__DYNAFORM_OPTIONS' => array('PREVIOUS_STEP' => '#', 'NEXT_STEP' => '#', 'NEXT_STEP_LABEL' => G::loadTranslation('ID_NEXT_STEP'), 'PREVIOUS_ACTION' => 'return false;', 'NEXT_ACTION' => 'return false;' + ) + ); + } + $G_PUBLISH->AddContent('dynaform', $template, $file, '', $aFields, ''); + G::RenderPage('publish', 'raw'); + return ob_get_clean(); + } + + /** + * Prints the Dynaform in format HTML + * + * @param object $A + * @return array + */ + public function render_htmledit($A) + { + $script = ''; + $file = G::decrypt($A, URL_KEY); + ob_start(); + global $G_PUBLISH; + $form = new Form($file, PATH_DYNAFORM, SYS_LANG, true); + $G_PUBLISH = new Publisher(); + $G_PUBLISH->publisherId = ''; + $html = $this->get_htmlcode($A); + if (!is_string($html)) { + $error = $html; + $html = ''; + } else { + $error = 0; + } + $HtmlEditor = array('URL' => $A, 'HTML' => $html, 'DYN_UID' => $file ); + $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_HtmlEditor', '', $HtmlEditor, '', ''); + G::RenderPage("publish", 'raw'); + return array('error' => $error, 'html' => ob_get_clean() + ); + } + + /** + * Get the html code + * Loads the stored HTML or the default Template if + * it doesn't exist. + * + * @param object $A + * @return code html + */ + public function get_htmlcode($A) + { + try { + $script = null; + $fileTmp = G::decrypt($A, URL_KEY); + $form = new Form($fileTmp, PATH_DYNAFORM, SYS_LANG, true); + + //Navigation Bar + $form->fields = G::array_merges(array("__DYNAFORM_OPTIONS" => new XmlForm_Field_XmlMenu(new Xml_Node("__DYNAFORM_OPTIONS", "complete", "", array("type" => "xmlmenu", "xmlfile" => "gulliver/dynaforms_Options" + )), SYS_LANG, PATH_XMLFORM, $form) + ), $form->fields); + + //Loads the stored HTML or the default Template if + //it doesn't exist. + $filename = substr($form->fileName, 0, - 3) . ($form->type === "xmlform" ? "" : "." . $form->type) . "html"; + + if (!file_exists($filename)) { + $html = $form->printTemplate($form->template, $script); + } else { + $html = implode("", file($filename)); + } + + /* + * It adds the new fields automatically at the bottom of the form. + * TODO: �TOP OR BOTTOM? + * Improving detection algorithm of new fields. + * Current: Do not check the fields that have already been reviewed (saving) + * Already checked the temporary file dynaforms editor. + */ + $tmp = self::_getTmpData(); + if (!isset($tmp['OLD_FIELDS'])) { + $tmp['OLD_FIELDS'] = array(); //var_dump($html);die; + } + $aAux = explode('', $html); + foreach ($form->fields as $field) { + if ((strpos($html, '{$form.' . $field->name . '}') === false) && (strpos($html, '{$' . $field->name . '}') === false)) { + //Aparantly is new (but could be a deleted or non visible like private type fields) + switch (strtolower($field->type)) { + case 'private': + case 'phpvariable': + break; + default: + if (array_search($field->name, $tmp['OLD_FIELDS']) === false) { + //TOP + $aAux[0] .= '
{$' . $field->name . '}' . '{$form.' . $field->name . '}'; + //$html.='
{$'.$field->name.'}'.'{$form.'.$field->name.'}'; + //BOTTOM + //$html='{$'.$field->name.'}'.'{$form.'.$field->name.'}'.$html; + //$tmp['OLD_FIELDS'][]=$field->name; + } + } + } + } + self::_setTmpData($tmp); + //$html=str_replace('{$form_className}','formDefault', $html ); + $html = str_replace('{$form_className}', 'formDefault', $aAux[0] . ''); + + return $html; + } catch (Exception $e) { + return (array) $e; + } + } + + /** + * Restore the html code + * + * @param object $A + * @return code html + */ + public function restore_html($A) + { + + $filter = new InputFilter(); + $script = null; + $fileTmp = G::decrypt($A, URL_KEY); + $form = new Form($fileTmp, PATH_DYNAFORM, SYS_LANG, true); + + //Navigation Bar + $form->fields = G::array_merges(array("__DYNAFORM_OPTIONS" => new XmlForm_Field_XmlMenu(new Xml_Node("__DYNAFORM_OPTIONS", "complete", "", array("type" => "xmlmenu", "xmlfile" => "gulliver/dynaforms_Options" + )), SYS_LANG, PATH_XMLFORM, $form) + ), $form->fields); + + $form->enableTemplate = false; + $html = $form->printTemplate($form->template, $script); + $html = str_replace('{$form_className}', 'formDefault', $html); + $pathTmp = $filter->xssFilterHard(PATH_DYNAFORM . $fileTmp . '.html', 'path'); + if (file_exists($pathTmp)) { + unlink($pathTmp); + } + $fp = fopen($pathTmp, 'w'); + fwrite($fp, $html); + fclose($fp); + + return $html; + } + + /** + * Set the html code + * + * @param object $A + * @return array + */ + public function set_htmlcode($A, $htmlcode) + { + try { + + $filter = new InputFilter(); + $iOcurrences = preg_match_all('/\{\$.*?\}/im', $htmlcode, $matches); + if ($iOcurrences) { + if (isset($matches[0])) { + $tagsHtml = $matches[0]; + foreach ($tagsHtml as $value) { + $aTagVar = strip_tags($value); + if ($value != $aTagVar) { + $htmlcode = str_replace($value, $aTagVar, $htmlcode); + } + } + } + } + $file = G::decrypt($A, URL_KEY); + $form = new Form($file, PATH_DYNAFORM, SYS_LANG, true); + $filename = substr($form->fileName, 0, - 3) . ($form->type === 'xmlform' ? '' : '.' . $form->type) . 'html'; + $filename = $filter->xssFilterHard($filename, 'path'); + $fp = fopen($filename, 'w'); + fwrite($fp, $htmlcode); + fclose($fp); + return 0; + } catch (Exception $e) { + return (array) $e; + } + } + + /** + * Get the xml code + * + * @param object $A + * @return array + */ + public function get_xmlcode($A) + { + try { + $file = G::decrypt($A, URL_KEY); + $xmlcode = implode('', file(PATH_DYNAFORM . $file . '.xml')); + return array("xmlcode" => $xmlcode, "error" => 0 + ); + } catch (Exception $e) { + return array("xmlcode" => "", "error" => (array) $e + ); + } + } + + /** + * Set the xml code + * + * @param object $A + * @param array $xmlcode + * @return string + */ + public function set_xmlcode($A, $xmlcode) + { + + $filter = new InputFilter(); + $xmlcode = urldecode($xmlcode); + $file = G::decrypt($A, URL_KEY); + $xmlcode = str_replace(' ', ' ', trim($xmlcode)); + $pathFile = $filter->xssFilterHard(PATH_DYNAFORM . $file . '.xml', "path"); + $fp = fopen($pathFile, 'w'); + fwrite($fp, $xmlcode); + fclose($fp); + return ""; + } + + /** + * Get the javascript code + * + * @param object $A + * @param string $fieldName + * @return array + */ + public function get_javascripts($A, $fieldName) + { + try { + $file = G::decrypt($A, URL_KEY); + $form = new Form($file, PATH_DYNAFORM, SYS_LANG, true); + $aOptions = array(); + $sCode = ''; + foreach ($form->fields as $name => $value) { + if (strcasecmp($value->type, "javascript") == 0) { + $aOptions[] = array('key' => $name, 'value' => $name + ); + if ($name == $fieldName) { + $sCode = $value->code; + } + } + } + return array('aOptions' => $aOptions, 'sCode' => $sCode + ); + } catch (Exception $e) { + return (array) $e; + } + } + + /** + * Set the javascript code + * + * @param object $A + * @param string $fieldName + * @param string $sCode + * @return array + */ + public function set_javascript($A, $fieldName, $sCode, $meta = '') + { + + $filter = new InputFilter(); + $fieldName = $filter->xssFilterHard($fieldName, 'path'); + if ($fieldName == '___pm_boot_strap___') { + return 0; + } + + $sCode = urldecode($sCode); + try { + $sCode = rtrim($sCode); + $file = G::decrypt($A, URL_KEY); + /* $dbc2 = new DBConnection( PATH_DYNAFORM . $file . '.xml' ,'','','','myxml' ); + $ses2 = new DBSession($dbc2); + $ses2->execute(G::replaceDataField("UPDATE dynaForm SET XMLNODE_VALUE = @@CODE WHERE XMLNODE_NAME = @@FIELDNAME ", array('FIELDNAME'=>$fieldName,'CODE'=>$sCode), "myxml" )); + */ + + + $pathFile = $filter->xssFilterHard(PATH_DYNAFORM . "{$file}.xml", 'path'); + $dynaform = new DynaformHandler($pathFile); + $dynaform->replace($fieldName, $fieldName, Array('type' => 'javascript', 'meta' => $meta, '#cdata' => $sCode + )); + + return 0; + } catch (Exception $e) { + return (array) $e; + } + } + + /** + * Get properties of the dynaForm + * + * @param file $A + * @param string $DYN_UID + * @return array + */ + public function get_properties($A, $DYN_UID) + { + $file = G::decrypt($A, URL_KEY); + $tmp = self::_getTmpData(); + if (!(isset($tmp['Properties']) && isset($tmp['useTmpCopy']))) { + $dynaform = new Dynaform(); + $dynaform->load($DYN_UID); + $form = new Form($file, PATH_DYNAFORM, SYS_LANG, true); + $Properties = array('A' => $A, 'DYN_UID' => $dynaform->getDynUid(), 'PRO_UID' => $dynaform->getProUid(), 'DYN_TITLE' => $dynaform->getDynTitle(), 'DYN_TYPE' => $dynaform->getDynType(), 'DYN_DESCRIPTION' => $dynaform->getDynDescription(), 'WIDTH' => $form->width, + //'ENABLETEMPLATE'=> $form->enableTemplate, + 'MODE' => $form->mode, 'PRINTDYNAFORM' => $form->printdynaform, 'ADJUSTGRIDSWIDTH' => $form->adjustgridswidth, 'NEXTSTEPSAVE' => $form->nextstepsave + ); + $tmp['Properties'] = $Properties; + self::_setTmpData($tmp); + } else { + $form = new Form($file, PATH_DYNAFORM, SYS_LANG, true); + $Properties = $tmp['Properties']; + if (!isset($Properties['ENABLETEMPLATE'])) { + $Properties['ENABLETEMPLATE'] = "0"; + } + $Properties['WIDTH'] = $form->width; + $Properties['MODE'] = $form->mode; + } + return $Properties; + } + + /** + * Set properties of the dynaForm + * + * @param file $A + * @param string $DYN_UID + * @param array $getFields + * @return array + */ + public function set_properties($A, $DYN_UID, $getFields) + { + try { + + $filter = new InputFilter(); + $post = array(); + parse_str($getFields, $post); + $Fields = $post['form']; + //if (!isset($Fields['ENABLETEMPLATE'])) $Fields['ENABLETEMPLATE'] ="0"; + $file = G::decrypt($A, URL_KEY); + $tmp = self::_getTmpData(); + if (!isset($tmp['useTmpCopy'])) { + $dynaform = new Dynaform(); + $dynaform->update($Fields); + } else { + $tmp['Properties'] = $Fields; + self::_setTmpData($tmp); + } + $pathFile = $filter->xssFilterHard(PATH_DYNAFORM . "{$file}.xml", 'path'); + $dynaform = new DynaformHandler($pathFile); + $dbc2 = new DBConnection($pathFile, '', '', '', 'myxml'); + $ses2 = new DBSession($dbc2); + //if (!isset($Fields['ENABLETEMPLATE'])) $Fields['ENABLETEMPLATE'] ="0"; + + /* if (isset($Fields['ENABLETEMPLATE'])) { + $ses2->execute(G::replaceDataField("UPDATE . SET ENABLETEMPLATE = @@ENABLETEMPLATE WHERE XMLNODE_NAME = 'dynaForm' ", $Fields)); + } */ + if (isset($Fields['DYN_TYPE'])) { + //$ses2->execute( G::replaceDataField( "UPDATE . SET TYPE = @@DYN_TYPE WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) ); + $dynaform->modifyHeaderAttribute('type', $Fields['DYN_TYPE']); + } + if (isset($Fields['WIDTH'])) { + // $ses2->execute( G::replaceDataField( "UPDATE . SET WIDTH = @@WIDTH WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) ); + $dynaform->modifyHeaderAttribute('width', $Fields['WIDTH']); + //g::pr($dynaform->getHeaderAttribute('width')); + } + if (isset($Fields['MODE'])) { + // $ses2->execute( G::replaceDataField( "UPDATE . SET MODE = @@MODE WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) ); + $dynaform->modifyHeaderAttribute('mode', $Fields['MODE']); + } + if (isset($Fields['NEXTSTEPSAVE'])) { + //$ses2->execute( G::replaceDataField( "UPDATE . SET NEXTSTEPSAVE = @@NEXTSTEPSAVE WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) ); + $dynaform->modifyHeaderAttribute('nextstepsave', $Fields['NEXTSTEPSAVE']); + } + if (isset($Fields['PRINTDYNAFORM'])) { + //$ses2->execute( G::replaceDataField( "UPDATE . SET PRINTDYNAFORM = @@PRINTDYNAFORM WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) ); + $dynaform->modifyHeaderAttribute('printdynaform', $Fields['PRINTDYNAFORM']); + } + if (isset($Fields['ADJUSTGRIDSWIDTH'])) { + //$ses2->execute( G::replaceDataField( "UPDATE . SET ADJUSTGRIDSWIDTH = @@ADJUSTGRIDSWIDTH WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) ); + $dynaform->modifyHeaderAttribute('adjustgridswidth', $Fields['ADJUSTGRIDSWIDTH']); + } + + return 0; + } catch (Exception $e) { + return (array) $e; + } + } + + /** + * Get enable template + * + * @param object $A + * @return string + */ + public function get_enabletemplate($A) + { + $file = G::decrypt($A, URL_KEY); + $form = new Form($file, PATH_DYNAFORM, SYS_LANG, true); + return $form->enableTemplate; + } + + /** + * Set enable template + * + * @param object $A + * @param string $value + * @return string + */ + public function set_enabletemplate($A, $value) + { + + $filter = new InputFilter(); + $file = G::decrypt($A, URL_KEY); + $value = $value == "1" ? "1" : "0"; + // $dbc2 = new DBConnection( PATH_DYNAFORM . $file . '.xml', '', '', '', 'myxml' ); + // $ses2 = new DBSession( $dbc2 ); + // $ses2->execute( "UPDATE . SET ENABLETEMPLATE = '$value'" ); + $pathFile = $filter->xssFilterHard(PATH_DYNAFORM . "{$file}.xml", 'path'); + $dynaform = new DynaformHandler($pathFile); + $dynaform->modifyHeaderAttribute('enabletemplate', $value); + + return $value; + } + + /** + * Save a dynaForm + * + * @param object $A + * @param string $DYN_UID + * @return array + */ + public function save($A, $DYN_UID) + { + try { + $answer = 0; + $file = G::decrypt($A, URL_KEY); + $tmp = self::_getTmpData(); + if (isset($tmp['Properties'])){ + $fileFirst = $tmp['Properties']['PRO_UID'].'/'.$tmp['Properties']['DYN_UID']; + } + if (isset($tmp['useTmpCopy'])) { + /* Save Register */ + $dynaform = new Dynaform(); + $dynaform->update($tmp['Properties']); + /* Save file */ + $copyFirst = implode('', file(PATH_DYNAFORM . $fileFirst . '.xml')); + $copy = implode('', file(PATH_DYNAFORM . $file . '.xml')); + /*Check differences between XML*/ + $elementFirst = new SimpleXMLElement($copyFirst); + $elementCopy = new SimpleXMLElement($copy); + $desAdd = ''; + $desDel = ''; + //Check the new fields + foreach ($elementCopy as $key1 => $row1){ + $swAll = true; + foreach ($elementFirst as $key2 => $row2){ + if ($key1 == $key2){ + $swAll = false; + break; + } + } + if ($swAll){ + $desAdd .= $key1." "; + } + } + //Check the delete fields + foreach ($elementFirst as $key1 => $row1){ + $swAll = true; + foreach ($elementCopy as $key2 => $row2){ + if ($key1 == $key2){ + $swAll = false; + break; + } + } + if ($swAll){ + $desDel .= $key1." "; + } + } + + $mode = empty($tmp['Properties']['MODE'])? 'Determined by Fields' : $tmp['Properties']['MODE']; + $auditDescription = "Dynaform Title: ".$tmp['Properties']['DYN_TITLE'].", Type: ".$tmp['Properties']['DYN_TYPE'].", Description: ".$tmp['Properties']['DYN_DESCRIPTION'].", Mode: ".$mode; + if($desAdd != ''){ + $auditDescription .= ", Field(s) Add: ".$desAdd; + } + if($desDel != ''){ + $auditDescription .= ", Field(s) Delete: ".$desDel; + } + //Add Audit Log + G::auditLog("UpdateDynaform", $auditDescription); + + + /* + * added by krlos carlos/a/colosa.com + * in here we are validation if a xmlform has a submit action + */ + // if (!preg_match("/type=\"submit\"/",$copy) && !preg_match("/type=\"grid\"/",$copy) && !isset($_SESSION['submitAction']) ){ + if (!preg_match("/type=\"submit\"/", $copy) && !preg_match("/type=\"grid\"/", $copy)) { + // $_SESSION['submitAction'] = 1; + $answer = 'noSub'; + } + $copyHtml = false; + if (file_exists(PATH_DYNAFORM . $file . '.html')) { + $copyHtml = implode('', file(PATH_DYNAFORM . $file . '.html')); + } + $file = DynaformEditor::_getFilename($file); + $fcopy = fopen(PATH_DYNAFORM . $file . '.xml', "w"); + fwrite($fcopy, $copy); + fclose($fcopy); + if ($copyHtml) { + $fcopy = fopen(PATH_DYNAFORM . $file . '.html', "w"); + fwrite($fcopy, $copyHtml); + fclose($fcopy); + } + } else { + //throw new Exception("It should not come here unless you have disabled the temporary copy."); + } + return $answer; + } catch (Exception $e) { + return (array) $e; + } + } + + /** + * Close a dynaform + * + * @param object $A + * @return array + */ + public function close($A) + { + try { + /* + * we are unseting this variable. It's our control about to save the xmlfrom + */ + // unset($_SESSION['submitAction']); + $file = G::decrypt($A, URL_KEY); + //return(array('response'=>PATH_DYNAFORM . $file . '.xml')); + /* Delete the temporal copy */ + $tmp = self::_getTmpData(); + $xmlFile = PATH_DYNAFORM . $file . '.xml'; + $htmlFile = PATH_DYNAFORM . $file . '.html'; + //return(array('response'=>$tmp['useTmpCopy'])); + if (isset($tmp['useTmpCopy'])) { + //return(array('response'=>PATH_DYNAFORM . $file . '.xml')); + if ($file !== DynaformEditor::_getFilename($file)) { + // return(array('response'=>PATH_DYNAFORM . $file . '.xml')); + if (file_exists($xmlFile)) { + unlink($xmlFile); + } + if (file_exists($htmlFile)) { + unlink($htmlFile); + } + } + } + return 0; + } catch (Exception $e) { + return (array) $e; + } + } + + /** + * Checks if a dynaform was changed + * + * @param file $A + * @param string $DYN_UID + * @return array + */ + public function is_modified($A, $DYN_UID) + { + $file = G::decrypt($A, URL_KEY); + try { + /* Compare Properties */ + $dynaform = new Dynaform(); + $dynaform->load($DYN_UID); + $form = new Form($file, PATH_DYNAFORM, SYS_LANG, true); + $sp = array('A' => $A, 'DYN_UID' => $dynaform->getDynUid(), 'PRO_UID' => $dynaform->getProUid(), 'DYN_TITLE' => $dynaform->getDynTitle(), 'DYN_TYPE' => $dynaform->getDynType(), 'DYN_DESCRIPTION' => $dynaform->getDynDescription(), 'WIDTH' => $form->width, 'ENABLETEMPLATE' => $form->enableTemplate, 'MODE' => $form->mode + ); + $P = self::get_properties($A, $DYN_UID); + if (!isset($P['DYN_TITLE'])) { + $P['DYN_TITLE'] = $sp['DYN_TITLE']; + } + if (!isset($P['DYN_TYPE'])) { + $P['DYN_TYPE'] = $sp['DYN_TYPE']; + } + if (!isset($P['DYN_DESCRIPTION'])) { + $P['DYN_DESCRIPTION'] = $sp['DYN_DESCRIPTION']; + } + if (!isset($P['WIDTH'])) { + $P['WIDTH'] = $sp['WIDTH']; + } + if (!isset($P['ENABLETEMPLATE'])) { + $P['ENABLETEMPLATE'] = $sp['ENABLETEMPLATE']; + } + if (!isset($P['MODE'])) { + $P['MODE'] = $sp['MODE']; + } + $modPro = ($sp['DYN_TITLE'] != $P['DYN_TITLE']) || ($sp['DYN_TYPE'] != $P['DYN_TYPE']) || ($sp['DYN_DESCRIPTION'] != $P['DYN_DESCRIPTION']); + /* || + ($sp['WIDTH']!=$P['WIDTH']) || + ($sp['ENABLETEMPLATE']!=$P['ENABLETEMPLATE']) || + ($sp['MODE']!=$P['MODE']) */ + /* Compare copies */ + $fileOrigen = DynaformEditor::_getFilename($file); + $copy = implode('', file(PATH_DYNAFORM . $file . '.xml')); + $origen = implode('', file(PATH_DYNAFORM . $fileOrigen . '.xml')); + $copyHTML = file_exists(PATH_DYNAFORM . $file . '.html') ? implode('', file(PATH_DYNAFORM . $file . '.html')) : false; + $origenHTML = file_exists(PATH_DYNAFORM . $fileOrigen . '.html') ? implode('', file(PATH_DYNAFORM . $fileOrigen . '.html')) : false; + $modFile = ($copy !== $origen) || ($origenHTML && ($copyHTML !== $origenHTML)); + //Return + //return array("*message"=>sprintf("%s, (%s= %s %s):", $modPro?"1":"0" , $modFile?"1":"0", ($copy!==$origen)?"1":"0" , ($origenHTML && ($copyHTML!==$origenHTML))?"1":"0" )); + //die("c'est fini"); + return $modPro || $modFile; + } catch (Exception $e) { + return (array) $e; + } + } + /* + Functionality: Funcion que convierte objecto en array + Parameters : Object $object que queremos convertir + Return: Array + */ + public function convertObjectToArray($object){ + if( !is_object( $object ) && !is_array( $object ) ){ + return $object; + } + if( is_object( $object ) ){ + $object = get_object_vars( $object ); + } + return array_map( 'objectToArray', $object ); + } +} diff --git a/workflow/engine/classes/EnterpriseClass.php b/workflow/engine/classes/EnterpriseClass.php index 8ca368274..9138391fc 100644 --- a/workflow/engine/classes/EnterpriseClass.php +++ b/workflow/engine/classes/EnterpriseClass.php @@ -1,15 +1,6 @@ sFriendlyName, $plugin->sPluginFolder, $plugin->sDescription, $plugin->sSetupPage, $plugin->iVersion ); + $detail = new PluginDetail( $sNamespace, $sClassName, $sFilename, $plugin->sFriendlyName, $plugin->sPluginFolder, $plugin->sDescription, $plugin->sSetupPage, $plugin->iVersion ); if (isset( $plugin->aWorkspaces )) { $detail->aWorkspaces = $plugin->aWorkspaces; @@ -1207,7 +1207,7 @@ class PMPluginRegistry //Found a License if (class_exists( 'pmLicenseManager' )) { $sSerializedFile = PATH_DATA_SITE . 'lmn.singleton'; - $pmLicenseManagerO = & pmLicenseManager::getSingleton(); + $pmLicenseManagerO = & PmLicenseManager::getSingleton(); if (file_exists( $sSerializedFile )) { $pmLicenseManagerO->unSerializeInstance( file_get_contents( $sSerializedFile ) ); } diff --git a/workflow/engine/classes/PluginDetail.php b/workflow/engine/classes/PluginDetail.php index 1e2611c81..2de918444 100644 --- a/workflow/engine/classes/PluginDetail.php +++ b/workflow/engine/classes/PluginDetail.php @@ -1,45 +1,17 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - */ - -use ProcessMaker\Plugins\PluginRegistry; - /** * * @package workflow.engine.classes */ +//@todo: Pending until class.plugin.php is solved. require_once 'class.plugin.php'; - - /** * * @package workflow.engine.classes - */class pluginDetail + */class PluginDetail { public $sNamespace; public $sClassName; @@ -67,7 +39,7 @@ require_once 'class.plugin.php'; * @param integer $iVersion * @return void */ - public function __construct ($sNamespace, $sClassName, $sFilename, $sFriendlyName = '', $sPluginFolder = '', $sDescription = '', $sSetupPage = '', $iVersion = 0) + public function __construct($sNamespace, $sClassName, $sFilename, $sFriendlyName = '', $sPluginFolder = '', $sDescription = '', $sSetupPage = '', $iVersion = 0) { $this->sNamespace = $sNamespace; $this->sClassName = $sClassName; diff --git a/workflow/engine/classes/PmDynaform.php b/workflow/engine/classes/PmDynaform.php index c103ba8d2..f2c5a3b9b 100644 --- a/workflow/engine/classes/PmDynaform.php +++ b/workflow/engine/classes/PmDynaform.php @@ -1,20 +1,10 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ /** * Phing Class Wrapper * - * @author Erik Amaru Ortiz */ - -include_once 'phing/Phing.php'; -set_include_path( PATH_THIRDPARTY . 'propel-generator/classes/' . PATH_SEPARATOR . get_include_path() ); - -if (! class_exists( 'Phing' )) { - throw new Exception( 'Fatal Error: Phing is not loaded!' ); -} - - -class pmPhing extends Phing +class PmPhing extends Phing { - - public function getPhingVersion () + public function getPhingVersion() { return 'pmPhing Ver 1.0'; } diff --git a/workflow/engine/classes/PmTable.php b/workflow/engine/classes/PmTable.php index ac7d60d87..e0c592910 100644 --- a/workflow/engine/classes/PmTable.php +++ b/workflow/engine/classes/PmTable.php @@ -914,7 +914,7 @@ class PmTable Phing::startup(); Phing::setProperty('phing.home', getenv('PHING_HOME')); - $m = new pmPhing(); + $m = new PmPhing(); $m->execute($args); $m->runBuild(); } diff --git a/workflow/engine/classes/PopupMenu.php b/workflow/engine/classes/PopupMenu.php index 9c0112862..ac59410b0 100644 --- a/workflow/engine/classes/PopupMenu.php +++ b/workflow/engine/classes/PopupMenu.php @@ -37,7 +37,7 @@ class PopupMenu extends form $label = str_replace( "\n", ' ', $label ); $pmXmlNode = new Xml_Node( $f, 'complete', '', array ('label' => $label,'type' => 'popupOption','launch' => $tableId . '.showHideField("' . $f . '")' ) ); - $this->fields[$f] = new XmlForm_Field_popupOption( $pmXmlNode ); + $this->fields[$f] = new XmlForm_Field_PopupOption( $pmXmlNode ); $this->values[$f] = ''; } } diff --git a/workflow/engine/classes/WorkspaceTools.php b/workflow/engine/classes/WorkspaceTools.php index 7f8fbfcdf..d57cb47b8 100644 --- a/workflow/engine/classes/WorkspaceTools.php +++ b/workflow/engine/classes/WorkspaceTools.php @@ -1985,7 +1985,7 @@ class WorkspaceTools $licensedFeatures = & PMLicensedFeatures::getSingleton(); /*----------------------------------********---------------------------------*/ if ($licensedFeatures->verifyfeature('95OY24wcXpEMzIyRmlNSnF0STNFSHJzMG9wYTJKekpLNmY2ZmRCeGtuZk5oUDloaUNhUGVjTDJBPT0=')) { - enterpriseClass::setHashPassword($response); + EnterpriseClass::setHashPassword($response); } else { return false; } diff --git a/workflow/engine/classes/XMLDB.php b/workflow/engine/classes/XMLDB.php index a2d6598af..fd5d04290 100644 --- a/workflow/engine/classes/XMLDB.php +++ b/workflow/engine/classes/XMLDB.php @@ -1,50 +1,10 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - /** * XMLDB * - * ProcessMaker Open Source Edition - * - * @copyright (C) 2004 - 2008 Colosa Inc.23 - * @package workflow.engine.ProcessMaker - * */ - -/** - * XMLDB - * - * ProcessMaker Open Source Edition - * - * @copyright (C) 2004 - 2008 Colosa Inc.23 - * @package workflow.engine.ProcessMaker - * - */class XMLDB +class XMLDB { /** diff --git a/workflow/engine/classes/XMLResult.php b/workflow/engine/classes/XMLResult.php index 9f65f8470..76a21904a 100644 --- a/workflow/engine/classes/XMLResult.php +++ b/workflow/engine/classes/XMLResult.php @@ -1,50 +1,11 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - -/** - * XMLDB - * - * ProcessMaker Open Source Edition - * - * @copyright (C) 2004 - 2008 Colosa Inc.23 - * @package workflow.engine.ProcessMaker - * - */ - /** * XMLResult * - * ProcessMaker Open Source Edition - * - * @copyright (C) 2004 - 2008 Colosa Inc.23 * @package workflow.engine.ProcessMaker - * - */class XMLResult + */ +class XMLResult { var $result = array (); var $cursor = 0; diff --git a/workflow/engine/classes/XmlForm_Field_CheckBoxTable.php b/workflow/engine/classes/XmlForm_Field_CheckBoxTable.php index 49078702f..efe824f42 100644 --- a/workflow/engine/classes/XmlForm_Field_CheckBoxTable.php +++ b/workflow/engine/classes/XmlForm_Field_CheckBoxTable.php @@ -1,36 +1,10 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - * @package workflow.engine.classes - **/ - - /** * Class XmlForm_Field_CheckBoxTable - */class XmlForm_Field_CheckBoxTable extends XmlForm_Field_Checkbox + * + */ +class XmlForm_Field_CheckBoxTable extends XmlForm_Field_Checkbox { /** @@ -42,11 +16,10 @@ * @param eter string owner * @return string */ - public function render ($value = null, $owner = null) + public function render($value = null, $owner = null) { - //$optionName = $owner->values['USR_UID']; $optionName = $value; - $onclick = (($this->onclick) ? ' onclick="' . G::replaceDataField( $this->onclick, $owner->values ) . '" ' : ''); + $onclick = (($this->onclick) ? ' onclick="' . G::replaceDataField($this->onclick, $owner->values) . '" ' : ''); $html = ' '; return $html; } diff --git a/workflow/engine/classes/XmlForm_Field_Hours.php b/workflow/engine/classes/XmlForm_Field_Hours.php index dd47dbd8d..ab5355c9f 100644 --- a/workflow/engine/classes/XmlForm_Field_Hours.php +++ b/workflow/engine/classes/XmlForm_Field_Hours.php @@ -1,36 +1,10 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - * @package workflow.engine.classes - **/ - - /** * Class XmlForm_Field_hours - */class XmlForm_Field_hours extends XmlForm_Field_SimpleText + * + */ +class XmlForm_Field_Hours extends XmlForm_Field_SimpleText { public $size = 15; public $maxLength = 64; @@ -45,7 +19,7 @@ public $readOnly = false; public $sqlConnection = 0; public $sql = ''; - public $sqlOption = array (); + public $sqlOption = array(); //Atributes only for grids public $formula = ''; public $function = ''; @@ -63,21 +37,21 @@ * @param eter string owner * @return string */ - public function render ($value = null, $owner = null) + public function render($value = null, $owner = null) { if ($this->strTo === 'UPPER') { - $value = strtoupper( $value ); + $value = strtoupper($value); } if ($this->strTo === 'LOWER') { - $value = strtolower( $value ); + $value = strtolower($value); } //if ($this->strTo==='CAPITALIZE') $value = strtocapitalize($value); - $onkeypress = G::replaceDataField( $this->onkeypress, $owner->values ); + $onkeypress = G::replaceDataField($this->onkeypress, $owner->values); if ($this->replaceTags == 1) { - $value = G::replaceDataField( $value, $owner->values ); + $value = G::replaceDataField($value, $owner->values); } if ($this->showVars == 1) { - $this->process = G::replaceDataField( $this->process, $owner->values ); + $this->process = G::replaceDataField($this->process, $owner->values); //$sShowVars = ' ' . $this->symbol . ''; $sShowVars = ' '; } else { @@ -85,14 +59,14 @@ } if ($this->mode === 'edit') { if ($this->readOnly) { - return 'htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '\' readOnly="readOnly" style="' . htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>' . $sShowVars; + return 'htmlentities($value, ENT_COMPAT, 'utf-8') . '\' readOnly="readOnly" style="' . htmlentities($this->style, ENT_COMPAT, 'utf-8') . '" onkeypress="' . htmlentities($onkeypress, ENT_COMPAT, 'utf-8') . '"/>' . $sShowVars; } else { - return 'htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '\' style="' . htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>' . $sShowVars; + return 'htmlentities($value, ENT_COMPAT, 'utf-8') . '\' style="' . htmlentities($this->style, ENT_COMPAT, 'utf-8') . '" onkeypress="' . htmlentities($onkeypress, ENT_COMPAT, 'utf-8') . '"/>' . $sShowVars; } } elseif ($this->mode === 'view') { - return 'htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '\' style="display:none;' . htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>' . $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ); + return 'htmlentities($value, ENT_COMPAT, 'utf-8') . '\' style="display:none;' . htmlentities($this->style, ENT_COMPAT, 'utf-8') . '" onkeypress="' . htmlentities($onkeypress, ENT_COMPAT, 'utf-8') . '"/>' . $this->htmlentities($value, ENT_COMPAT, 'utf-8'); } else { - return $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ); + return $this->htmlentities($value, ENT_COMPAT, 'utf-8'); } } @@ -105,16 +79,16 @@ * @param eter string owner * @return string */ - public function renderGrid ($values = array(),$owner) + public function renderGrid($values = array(), $owner) { - $result = array (); + $result = array(); $r = 1; foreach ($values as $v) { if ($this->replaceTags == 1) { - $v = G::replaceDataField( $v, $owner->values ); + $v = G::replaceDataField($v, $owner->values); } if ($this->showVars == 1) { - $this->process = G::replaceDataField( $this->process, $owner->values ); + $this->process = G::replaceDataField($this->process, $owner->values); //$sShowVars = ' ' . $this->symbol . ''; $sShowVars = ' '; } else { @@ -122,14 +96,14 @@ } if ($this->mode === 'edit') { if ($this->readOnly) { - $result[] = '' . $sShowVars; + $result[] = '' . $sShowVars; } else { - $result[] = '' . $sShowVars; + $result[] = '' . $sShowVars; } } elseif ($this->mode === 'view') { - $result[] = '

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

'; + $result[] = '

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

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

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

'; + $result[] = '

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

'; } $r ++; } @@ -143,7 +117,7 @@ * @param eter string $element * @return string */ - public function attachEvents ($element) + public function attachEvents($element) { return "myForm.aElements[i] = new G_Text(myForm, $element,'{$this->name}'); myForm.aElements[i].setAttributes(" . $this->getAttributes() . ");"; diff --git a/workflow/engine/classes/XmlForm_Field_PopupOption.php b/workflow/engine/classes/XmlForm_Field_PopupOption.php index 929bc6dab..40a57afe6 100644 --- a/workflow/engine/classes/XmlForm_Field_PopupOption.php +++ b/workflow/engine/classes/XmlForm_Field_PopupOption.php @@ -1,50 +1,22 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - -/** - * PopupMenu - PopupMenu /** * XmlForm_Field_popupOption - XmlForm_Field_popupOption class * * @package workflow.engine.ProcessMaker - * @copyright COLOSA - */class XmlForm_Field_popupOption extends XmlForm_Field + */ +class XmlForm_Field_PopupOption extends XmlForm_Field { - var $launch = ''; + public $launch = ''; /** * Get Events * * @return string */ - function getEvents () + public function getEvents() { - $script = '{name:"' . $this->name . '",text:"' . addcslashes( $this->label, '\\"' ) . '", launch:leimnud.closure({Function:function(target){' . $this->launch . '}, args:target})}'; + $script = '{name:"' . $this->name . '",text:"' . addcslashes($this->label, '\\"') . '", launch:leimnud.closure({Function:function(target){' . $this->launch . '}, args:target})}'; return $script; } } diff --git a/workflow/engine/classes/class.pmFunctions.php b/workflow/engine/classes/class.pmFunctions.php index bc3ce5f7d..1e391e2f0 100644 --- a/workflow/engine/classes/class.pmFunctions.php +++ b/workflow/engine/classes/class.pmFunctions.php @@ -2387,7 +2387,7 @@ function PMFgetLabelOption ($PROCESS, $DYNAFORM_UID, $FIELD_NAME, $FIELD_SELECTE { $data = array(); $data["CURRENT_DYNAFORM"] = $DYNAFORM_UID; - $dynaform = new pmDynaform($data); + $dynaform = new PmDynaform($data); if ($dynaform->isResponsive()) { $json = $dynaform->searchFieldByName($DYNAFORM_UID, $FIELD_NAME); $options = $json->options + $json->optionsSql; @@ -3127,7 +3127,7 @@ function PMFDynaFormFields($dynUid, $appUid = false, $delIndex = 0) } $data["CURRENT_DYNAFORM"] = $dynUid; - $dynaform = new pmDynaform(\ProcessMaker\Util\DateTime::convertUtcToTimeZone($data)); + $dynaform = new PmDynaform(\ProcessMaker\Util\DateTime::convertUtcToTimeZone($data)); $dynaform->onPropertyRead = function(&$json, $key, $value) { if (isset($json->data) && !isset($json->value)) { $json->value = $json->data->value; diff --git a/workflow/engine/classes/model/AddonsManager.php b/workflow/engine/classes/model/AddonsManager.php index 114dfa9c1..cdde1ae5d 100644 --- a/workflow/engine/classes/model/AddonsManager.php +++ b/workflow/engine/classes/model/AddonsManager.php @@ -222,7 +222,7 @@ class AddonsManager extends BaseAddonsManager } /////// - $licenseManager = &pmLicenseManager::getSingleton(); + $licenseManager = &PmLicenseManager::getSingleton(); $activeLicense = $licenseManager->getActiveLicense(); $data = $data . "Content-Disposition: form-data; name=\"licenseFile\"; filename=\"" . $licenseManager->file . "\"\n"; diff --git a/workflow/engine/classes/model/AddonsStore.php b/workflow/engine/classes/model/AddonsStore.php index 0ab5dba2d..54f4120f1 100644 --- a/workflow/engine/classes/model/AddonsStore.php +++ b/workflow/engine/classes/model/AddonsStore.php @@ -34,7 +34,7 @@ class AddonsStore extends BaseAddonsStore public static function checkLicenseStore() { //getting the licenseManager.... - $licenseManager = &pmLicenseManager::getSingleton(); + $licenseManager = &PmLicenseManager::getSingleton(); if (isset($licenseManager->id)) { //Remove any license store that is not the active license @@ -71,7 +71,7 @@ class AddonsStore extends BaseAddonsStore AddonsStore::checkLicenseStore(); - $licenseManager = &pmLicenseManager::getSingleton(); //Getting the licenseManager + $licenseManager = &PmLicenseManager::getSingleton(); //Getting the licenseManager $result["store_errors"] = array(); list($stores, $errors) = AddonsStore::updateAll(false, $type); @@ -183,7 +183,7 @@ class AddonsStore extends BaseAddonsStore AddonsStore::checkLicenseStore(); - $licenseManager = &pmLicenseManager::getSingleton(); //Getting the licenseManager + $licenseManager = &PmLicenseManager::getSingleton(); //Getting the licenseManager $result["store_errors"] = array(); list($stores, $errors) = AddonsStore::updateAll(false); @@ -350,7 +350,7 @@ class AddonsStore extends BaseAddonsStore $aPluginsPP = unserialize(trim(file_get_contents(PATH_DATA_SITE . 'ee'))); } - $pmLicenseManagerO = &pmLicenseManager::getSingleton(); + $pmLicenseManagerO = &PmLicenseManager::getSingleton(); $localPlugins = array(); if ($type == 'plugin') { diff --git a/workflow/engine/config/paths.php b/workflow/engine/config/paths.php index 3a1b86dde..39b150708 100644 --- a/workflow/engine/config/paths.php +++ b/workflow/engine/config/paths.php @@ -142,3 +142,4 @@ define('PML_UPLOAD_URL', PML_SERVER . '/syspmLibrary/en/green/services/uploadProcess'); define('PML_DOWNLOAD_URL', PML_SERVER . '/syspmLibrary/en/green/services/download'); + G::defineConstants(); diff --git a/workflow/engine/controllers/adminProxy.php b/workflow/engine/controllers/adminProxy.php index 80b11394b..c746a8fba 100644 --- a/workflow/engine/controllers/adminProxy.php +++ b/workflow/engine/controllers/adminProxy.php @@ -1386,7 +1386,7 @@ class adminProxy extends HttpProxyController $oServerConf = &serverConf::getSingleton(); $pluginRegistry = PluginRegistry::loadSingleton(); - $licenseManager = &pmLicenseManager::getSingleton(); + $licenseManager = &PmLicenseManager::getSingleton(); //License Information: $activeLicense = $licenseManager->getActiveLicense(); diff --git a/workflow/engine/controllers/main.php b/workflow/engine/controllers/main.php index 7df672d54..c8563ec4e 100644 --- a/workflow/engine/controllers/main.php +++ b/workflow/engine/controllers/main.php @@ -46,7 +46,7 @@ class Main extends Controller $expireInLabel = ''; require_once ("classes" . PATH_SEP . "class.pmLicenseManager.php"); - $pmLicenseManager = &pmLicenseManager::getSingleton(); + $pmLicenseManager = &PmLicenseManager::getSingleton(); $expireIn = $pmLicenseManager->getExpireIn(); $expireInLabel = $pmLicenseManager->getExpireInLabel(); diff --git a/workflow/engine/controllers/pmTablesProxy.php b/workflow/engine/controllers/pmTablesProxy.php index e013502ec..973c08420 100644 --- a/workflow/engine/controllers/pmTablesProxy.php +++ b/workflow/engine/controllers/pmTablesProxy.php @@ -1365,7 +1365,7 @@ class pmTablesProxy extends HttpProxyController $arrayDynaFormData = $dynaForm->getDynaFormRecordByPk($dynaFormUid, [], false); if ($arrayDynaFormData !== false) { - $arrayGrid = pmDynaform::getGridsAndFields($arrayDynaFormData['DYN_CONTENT']); + $arrayGrid = PmDynaform::getGridsAndFields($arrayDynaFormData['DYN_CONTENT']); if ($arrayGrid !== false && isset($arrayGrid[$gridId])) { $grid = $arrayGrid[$gridId]; @@ -1545,7 +1545,7 @@ class pmTablesProxy extends HttpProxyController $record = $rsCriteria->getRow(); if ($flagIsBpmn) { - $arrayGrid = pmDynaform::getGridsAndFields($record['DYN_CONTENT']); + $arrayGrid = PmDynaform::getGridsAndFields($record['DYN_CONTENT']); if ($arrayGrid !== false) { foreach ($arrayGrid as $value) { diff --git a/workflow/engine/menus/setup.php b/workflow/engine/menus/setup.php index 902690193..e057714f4 100644 --- a/workflow/engine/menus/setup.php +++ b/workflow/engine/menus/setup.php @@ -255,7 +255,7 @@ if (!file_exists(PATH_DATA_SITE . "plugin.singleton")) { $enterprise->enable(); $enterprise->setup(); } -$pmLicenseManagerO = &pmLicenseManager::getSingleton(); +$pmLicenseManagerO = &PmLicenseManager::getSingleton(); $licenseStatusInfo = $pmLicenseManagerO->getCurrentLicenseStatus(); $licStatusMsg = null; diff --git a/workflow/engine/methods/cases/ajaxListener.php b/workflow/engine/methods/cases/ajaxListener.php index e5708129f..c8402914e 100644 --- a/workflow/engine/methods/cases/ajaxListener.php +++ b/workflow/engine/methods/cases/ajaxListener.php @@ -978,7 +978,7 @@ class Ajax $FieldsPmDynaform = $Fields; $FieldsPmDynaform["PRO_UID"] = $_SESSION['PROCESS']; $FieldsPmDynaform["CURRENT_DYNAFORM"] = $_REQUEST['DYN_UID']; - $a = new pmDynaform($FieldsPmDynaform); + $a = new PmDynaform($FieldsPmDynaform); if ($a->isResponsive()) { $a->printView(); } else { diff --git a/workflow/engine/methods/cases/caseConsolidated.php b/workflow/engine/methods/cases/caseConsolidated.php index 3b61d2f25..07e5aea99 100644 --- a/workflow/engine/methods/cases/caseConsolidated.php +++ b/workflow/engine/methods/cases/caseConsolidated.php @@ -127,7 +127,7 @@ if ($sStatus == "1" && $sDynUid != "") { if ($isBPMN) { - $pmDyna = new pmDynaform(array()); + $pmDyna = new PmDynaform(array()); $pmDyna->fields["CURRENT_DYNAFORM"] = $sDynUid; $dataDyna = $pmDyna->getDynaform(); $json = G::json_decode($dataDyna["DYN_CONTENT"]); diff --git a/workflow/engine/methods/cases/casesHistoryDynaformPage_Ajax.php b/workflow/engine/methods/cases/casesHistoryDynaformPage_Ajax.php index e6e0b9232..8a1f11255 100644 --- a/workflow/engine/methods/cases/casesHistoryDynaformPage_Ajax.php +++ b/workflow/engine/methods/cases/casesHistoryDynaformPage_Ajax.php @@ -390,7 +390,7 @@ if ($actionAjax == 'dynaformChangeLogViewHistory') { $FieldsPmDynaform = $Fields; $FieldsPmDynaform["PRO_UID"] = $_SESSION['PROCESS']; $FieldsPmDynaform["CURRENT_DYNAFORM"] = $_GET['DYN_UID']; - $a = new pmDynaform(\ProcessMaker\Util\DateTime::convertUtcToTimeZone($FieldsPmDynaform)); + $a = new PmDynaform(\ProcessMaker\Util\DateTime::convertUtcToTimeZone($FieldsPmDynaform)); if ($a->isResponsive()) { $a->printView(); } else { @@ -479,7 +479,7 @@ if ($actionAjax == 'historyDynaformGridPreview') { $FieldsPmDynaform = $Fields; $FieldsPmDynaform["CURRENT_DYNAFORM"] = $_GET['DYN_UID']; - $a = new pmDynaform(\ProcessMaker\Util\DateTime::convertUtcToTimeZone($FieldsPmDynaform)); + $a = new PmDynaform(\ProcessMaker\Util\DateTime::convertUtcToTimeZone($FieldsPmDynaform)); if ($a->isResponsive()) { $a->printView(); } else { diff --git a/workflow/engine/methods/cases/cases_SaveData.php b/workflow/engine/methods/cases/cases_SaveData.php index b8fe5b4ba..59ee9031c 100644 --- a/workflow/engine/methods/cases/cases_SaveData.php +++ b/workflow/engine/methods/cases/cases_SaveData.php @@ -141,7 +141,7 @@ try { $dataFields = $Fields["APP_DATA"]; $dataFields["CURRENT_DYNAFORM"] = $_GET['UID']; - $oPmDynaform = new pmDynaform($dataFields); + $oPmDynaform = new PmDynaform($dataFields); $pmdynaform = $oPmDynaform->validatePost($pmdynaform); $Fields["APP_DATA"] = array_merge( $Fields["APP_DATA"], $pmdynaform ); diff --git a/workflow/engine/methods/cases/cases_Step.php b/workflow/engine/methods/cases/cases_Step.php index 7b296b7e5..3762ddfe3 100644 --- a/workflow/engine/methods/cases/cases_Step.php +++ b/workflow/engine/methods/cases/cases_Step.php @@ -341,7 +341,7 @@ try { $FieldsPmDynaform["STEP_MODE"] = $oStep->getStepMode(); $FieldsPmDynaform["PRO_SHOW_MESSAGE"] = $noShowTitle; $FieldsPmDynaform["TRIGGER_DEBUG"] = $_SESSION['TRIGGER_DEBUG']['ISSET']; - $a = new pmDynaform(\ProcessMaker\Util\DateTime::convertUtcToTimeZone($FieldsPmDynaform)); + $a = new PmDynaform(\ProcessMaker\Util\DateTime::convertUtcToTimeZone($FieldsPmDynaform)); if ($a->isResponsive()) { $a->printEdit(); } else { diff --git a/workflow/engine/methods/cases/cases_StepToRevise.php b/workflow/engine/methods/cases/cases_StepToRevise.php index 4c94f1672..df72f5b7c 100644 --- a/workflow/engine/methods/cases/cases_StepToRevise.php +++ b/workflow/engine/methods/cases/cases_StepToRevise.php @@ -149,7 +149,7 @@ if ($_GET['DYN_UID'] != '') { $FieldsPmDynaform = $Fields; $FieldsPmDynaform["PRO_UID"] = $_SESSION['PROCESS']; $FieldsPmDynaform["CURRENT_DYNAFORM"] = $_GET['DYN_UID']; - $a = new pmDynaform($FieldsPmDynaform); + $a = new PmDynaform($FieldsPmDynaform); if ($a->isResponsive()) { $a->printEditSupervisor(); }else{ diff --git a/workflow/engine/methods/cases/pmDynaform.php b/workflow/engine/methods/cases/pmDynaform.php index 2563062f2..598b1f6e1 100644 --- a/workflow/engine/methods/cases/pmDynaform.php +++ b/workflow/engine/methods/cases/pmDynaform.php @@ -2,6 +2,6 @@ $DYN_UID = $_GET["dyn_uid"]; $_SESSION['PROCESS'] = $_GET["prj_uid"]; -$a = new pmDynaform(array("CURRENT_DYNAFORM" => $DYN_UID)); +$a = new PmDynaform(array("CURRENT_DYNAFORM" => $DYN_UID)); $a->lang = null; $a->printPmDynaform(); diff --git a/workflow/engine/methods/cases/summary.php b/workflow/engine/methods/cases/summary.php index 9e2a1ba43..1a843ea22 100644 --- a/workflow/engine/methods/cases/summary.php +++ b/workflow/engine/methods/cases/summary.php @@ -70,7 +70,7 @@ try { if ($result->next()) { $FieldsPmDynaform = $applicationFields; $FieldsPmDynaform["CURRENT_DYNAFORM"] = $_REQUEST['DYN_UID']; - $a = new pmDynaform(\ProcessMaker\Util\DateTime::convertUtcToTimeZone($FieldsPmDynaform)); + $a = new PmDynaform(\ProcessMaker\Util\DateTime::convertUtcToTimeZone($FieldsPmDynaform)); $a->printView(); } if (file_exists( PATH_DYNAFORM . $applicationFields['PRO_UID'] . PATH_SEP . $_REQUEST['DYN_UID'] . '.xml' )) { diff --git a/workflow/engine/methods/dynaforms/dynaforms_Ajax.php b/workflow/engine/methods/dynaforms/dynaforms_Ajax.php index aee6ffcaa..a20026434 100644 --- a/workflow/engine/methods/dynaforms/dynaforms_Ajax.php +++ b/workflow/engine/methods/dynaforms/dynaforms_Ajax.php @@ -36,4 +36,4 @@ if (! isset( $_DBArray )) { $_DBArray = array (); } -$oDynaformEditorAjax = new dynaformEditorAjax( $_POST ); \ No newline at end of file +$oDynaformEditorAjax = new DynaformEditorAjax( $_POST ); \ No newline at end of file diff --git a/workflow/engine/methods/dynaforms/dynaforms_Editor.php b/workflow/engine/methods/dynaforms/dynaforms_Editor.php index 6021f5d7e..dc9a4d0f6 100644 --- a/workflow/engine/methods/dynaforms/dynaforms_Editor.php +++ b/workflow/engine/methods/dynaforms/dynaforms_Editor.php @@ -80,7 +80,7 @@ if (isset( $_GET['bpmn'] ) && $_GET['bpmn'] == '1') { $_SESSION['dynaform_editor'] = 'processmap'; } -$editor = new dynaformEditor( $_POST ); +$editor = new DynaformEditor( $_POST ); $editor->file = $dynaform->getDynFilename(); $editor->home = PATH_DYNAFORM; $editor->title = $dynaform->getDynTitle(); diff --git a/workflow/engine/methods/dynaforms/fields_Save.php b/workflow/engine/methods/dynaforms/fields_Save.php index 3374708be..c7d874028 100644 --- a/workflow/engine/methods/dynaforms/fields_Save.php +++ b/workflow/engine/methods/dynaforms/fields_Save.php @@ -282,7 +282,7 @@ $_SESSION['_DBArray'] = $_DBArray; // Additions to javascript if (isset($sType) && $sType === 'javascript') { $sCode = urlencode($pmeCode); - $editor = new dynaformEditorAjax($_POST); + $editor = new DynaformEditorAjax($_POST); $editor->set_javascript($A, $fieldName, $sCode); } diff --git a/workflow/engine/methods/enterprise/addonsStore.php b/workflow/engine/methods/enterprise/addonsStore.php index 9d2f75024..a2fcceb25 100644 --- a/workflow/engine/methods/enterprise/addonsStore.php +++ b/workflow/engine/methods/enterprise/addonsStore.php @@ -2,7 +2,7 @@ AddonsStore::checkLicenseStore(); -$licenseManager = &pmLicenseManager::getSingleton(); +$licenseManager = &PmLicenseManager::getSingleton(); $oHeadPublisher = &headPublisher::getSingleton(); if (isset($licenseManager->date) && is_array($licenseManager->date)) { diff --git a/workflow/engine/methods/enterprise/addonsStoreAction.php b/workflow/engine/methods/enterprise/addonsStoreAction.php index 4ed707c40..851b849cf 100644 --- a/workflow/engine/methods/enterprise/addonsStoreAction.php +++ b/workflow/engine/methods/enterprise/addonsStoreAction.php @@ -51,12 +51,12 @@ try { $dir = PATH_DATA_SITE; G::uploadFile($aInfoLoadFile["tmp_name"], $dir, $aInfoLoadFile["name"]); //reading the file that was uploaded - $oPmLicenseManager = &pmLicenseManager::getSingleton(); + $oPmLicenseManager = &PmLicenseManager::getSingleton(); $response = $oPmLicenseManager->installLicense($dir . $aInfoLoadFile["name"]); /////// //This command also find the following file "AddonsStore.php" - $licenseManager = &pmLicenseManager::getSingleton(); + $licenseManager = &PmLicenseManager::getSingleton(); preg_match("/^license_(.*).dat$/", $licenseManager->file, $matches); $realId = urlencode($matches[1]); @@ -210,7 +210,7 @@ try { } /////// - $licenseManager = &pmLicenseManager::getSingleton(); + $licenseManager = &PmLicenseManager::getSingleton(); $server = $licenseManager->server; $workspace = (isset($licenseManager->workspace)) ? $licenseManager->workspace : 'pmLicenseSrv'; $url = "http://$server/sys".$workspace."/en/green/services/rest"; diff --git a/workflow/engine/methods/enterprise/enterprise.php b/workflow/engine/methods/enterprise/enterprise.php index 17343b26a..e4add20c7 100644 --- a/workflow/engine/methods/enterprise/enterprise.php +++ b/workflow/engine/methods/enterprise/enterprise.php @@ -133,7 +133,7 @@ class enterprisePlugin extends PMPlugin require_once (PATH_CORE . 'classes/model/AddonsStore.php'); AddonsStore::checkLicenseStore(); - $licenseManager = &pmLicenseManager::getSingleton(); + $licenseManager = &PmLicenseManager::getSingleton(); AddonsStore::updateAll(false); } diff --git a/workflow/engine/methods/enterprise/processMakerAjax.php b/workflow/engine/methods/enterprise/processMakerAjax.php index d7ecf83fb..d7c492222 100644 --- a/workflow/engine/methods/enterprise/processMakerAjax.php +++ b/workflow/engine/methods/enterprise/processMakerAjax.php @@ -116,7 +116,7 @@ switch ($option) { } /////// - $licenseManager = &pmLicenseManager::getSingleton(); + $licenseManager = &PmLicenseManager::getSingleton(); $server = isset($licenseManager->server) ? $licenseManager->server : ''; $workspace = (isset($licenseManager->workspace)) ? $licenseManager->workspace : 'pmLicenseSrv'; @@ -292,7 +292,7 @@ switch ($option) { } /////// - $licenseManager = &pmLicenseManager::getSingleton(); + $licenseManager = &PmLicenseManager::getSingleton(); $server = (isset($licenseManager->server)) ? $licenseManager->server : ''; $workspace = (isset($licenseManager->workspace)) ? $licenseManager->workspace : 'pmLicenseSrv'; diff --git a/workflow/engine/methods/login/authentication.php b/workflow/engine/methods/login/authentication.php index e445cf4c2..95457899d 100644 --- a/workflow/engine/methods/login/authentication.php +++ b/workflow/engine/methods/login/authentication.php @@ -180,7 +180,7 @@ try { if ($oPluginRegistry->existsTrigger ( PM_LOGIN )) { $oPluginRegistry->executeTriggers ( PM_LOGIN , $loginInfo ); } - enterpriseClass::enterpriseSystemUpdate($loginInfo); + EnterpriseClass::enterpriseSystemUpdate($loginInfo); $_SESSION['USER_LOGGED'] = $uid; $_SESSION['USR_USERNAME'] = $usr; } else { diff --git a/workflow/engine/methods/login/licenseUpdate.php b/workflow/engine/methods/login/licenseUpdate.php index 26e4dcdab..c3b0cbe0c 100644 --- a/workflow/engine/methods/login/licenseUpdate.php +++ b/workflow/engine/methods/login/licenseUpdate.php @@ -15,11 +15,11 @@ if ($aux['extension'] != 'dat') { G::uploadFile($aInfoLoadFile["tmp_name"], $dir, $aInfoLoadFile["name"]); //reading the file that was uploaded - $licenseManager =& pmLicenseManager::getSingleton(); + $licenseManager =& PmLicenseManager::getSingleton(); $response = $licenseManager->installLicense($dir . $aInfoLoadFile["name"], false, false); if ($response) { - $licenseManager = new pmLicenseManager(); + $licenseManager = new PmLicenseManager(); preg_match("/^license_(.*).dat$/", $licenseManager->file, $matches); $realId = urlencode($matches[1]); $workspace = (isset($licenseManager->workspace)) ? $licenseManager->workspace : 'pmLicenseSrv'; diff --git a/workflow/engine/methods/login/login.php b/workflow/engine/methods/login/login.php index b8f568d49..bda6134c5 100644 --- a/workflow/engine/methods/login/login.php +++ b/workflow/engine/methods/login/login.php @@ -208,7 +208,7 @@ $_SESSION['NW_PASSWORD2'] = $pass1; /*----------------------------------********---------------------------------*/ -$licenseManager =& pmLicenseManager::getSingleton(); +$licenseManager =& PmLicenseManager::getSingleton(); if (in_array(G::encryptOld($licenseManager->result), array('38afd7ae34bd5e3e6fc170d8b09178a3', 'ba2b45bdc11e2a4a6e86aab2ac693cbb'))) { $G_PUBLISH = new Publisher(); $version = explode('.', trim(file_get_contents(PATH_GULLIVER . 'VERSION'))); diff --git a/workflow/engine/methods/services/ActionsByEmailDataForm.php b/workflow/engine/methods/services/ActionsByEmailDataForm.php index 0656eb5fc..3e54a488c 100644 --- a/workflow/engine/methods/services/ActionsByEmailDataForm.php +++ b/workflow/engine/methods/services/ActionsByEmailDataForm.php @@ -56,7 +56,7 @@ if (isset($_GET['BROWSER_TIME_ZONE_OFFSET'])) { $record['APP_DATA'] = $caseFields['APP_DATA']; if (is_null($caseFields['DEL_FINISH_DATE'])) { - $a = new pmDynaform($record); + $a = new PmDynaform($record); $a->printABE($action,$record); } else { diff --git a/workflow/engine/methods/services/sessionPersists.php b/workflow/engine/methods/services/sessionPersists.php index 3a3128080..7b05bed07 100644 --- a/workflow/engine/methods/services/sessionPersists.php +++ b/workflow/engine/methods/services/sessionPersists.php @@ -15,7 +15,7 @@ if (isset($_REQUEST['dynaformEditorParams'])) { $dynaform = new Dynaform(); $dynaform->load($_REQUEST['DYN_UID']); - $editor = new dynaformEditor(array()); + $editor = new DynaformEditor(array()); $editor->file = $dynaform->getDynFilename(); $editor->home = PATH_DYNAFORM; $editor->title = $dynaform->getDynTitle(); diff --git a/workflow/engine/methods/setup/pluginsImportFile.php b/workflow/engine/methods/setup/pluginsImportFile.php index fcd0ca935..96f19c4a7 100644 --- a/workflow/engine/methods/setup/pluginsImportFile.php +++ b/workflow/engine/methods/setup/pluginsImportFile.php @@ -105,12 +105,12 @@ try { require_once ('classes/model/AddonsStore.php'); AddonsStore::checkLicenseStore(); - $licenseManager = &pmLicenseManager::getSingleton(); + $licenseManager = &PmLicenseManager::getSingleton(); AddonsStore::updateAll(false); $message = G::loadTranslation( 'ID_ENTERPRISE_INSTALLED') . ' ' . G::loadTranslation( 'ID_LOG_AGAIN'); G::SendMessageText($message, "INFO"); - $licenseManager = &pmLicenseManager::getSingleton(); + $licenseManager = &PmLicenseManager::getSingleton(); die(''); } } @@ -179,12 +179,12 @@ try { require_once ('classes/model/AddonsStore.php'); AddonsStore::checkLicenseStore(); - $licenseManager = &pmLicenseManager::getSingleton(); + $licenseManager = &PmLicenseManager::getSingleton(); AddonsStore::updateAll(false); $message = G::loadTranslation( 'ID_ENTERPRISE_INSTALLED') . ' ' . G::loadTranslation( 'ID_LOG_AGAIN'); G::SendMessageText($message, "INFO"); - $licenseManager = &pmLicenseManager::getSingleton(); + $licenseManager = &PmLicenseManager::getSingleton(); die(''); } } diff --git a/workflow/engine/methods/tracker/tracker_Show.php b/workflow/engine/methods/tracker/tracker_Show.php index 15f12500a..294f91280 100644 --- a/workflow/engine/methods/tracker/tracker_Show.php +++ b/workflow/engine/methods/tracker/tracker_Show.php @@ -63,7 +63,7 @@ switch ($_GET['CTO_TYPE_OBJ']) { $Fields["PRO_UID"] = $_SESSION["PROCESS"]; $Fields["CURRENT_DYNAFORM"] = $_GET["CTO_UID_OBJ"]; - $pmDynaForm = new pmDynaform($Fields); + $pmDynaForm = new PmDynaform($Fields); if ($pmDynaForm->isResponsive()) { $pmDynaForm->printTracker(); diff --git a/workflow/engine/skinEngine/skinEngine.php b/workflow/engine/skinEngine/skinEngine.php index cd6769ca5..772bf6dad 100644 --- a/workflow/engine/skinEngine/skinEngine.php +++ b/workflow/engine/skinEngine/skinEngine.php @@ -701,7 +701,7 @@ class SkinEngine $freeOfChargeText = ""; if (! defined('SKIP_FREE_OF_CHARGE_TEXT')) $freeOfChargeText = "Supplied free of charge with no support, certification, warranty, maintenance nor indemnity by ProcessMaker and its Certified Partners."; - if(file_exists(PATH_CLASSES."class.pmLicenseManager.php")) $freeOfChargeText=""; + if(file_exists(PATH_CLASSES."PmLicenseManager.php")) $freeOfChargeText=""; $fileFooter = PATH_SKINS . SYS_SKIN . PATH_SEP . 'footer.html'; if (file_exists($fileFooter)) { @@ -757,7 +757,7 @@ class SkinEngine } if (defined('SYS_SYS')) { - $pmLicenseManagerO = &pmLicenseManager::getSingleton(); + $pmLicenseManagerO = &PmLicenseManager::getSingleton(); $expireIn = $pmLicenseManagerO->getExpireIn(); $expireInLabel = $pmLicenseManagerO->getExpireInLabel(); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/ActionsByEmail.php b/workflow/engine/src/ProcessMaker/BusinessModel/ActionsByEmail.php index da74ca677..4d920c23f 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/ActionsByEmail.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/ActionsByEmail.php @@ -3,6 +3,7 @@ namespace ProcessMaker\BusinessModel; use ProcessMaker\Plugins\PluginRegistry; +use PmDynaform; /** * Description of ActionsByEmailService @@ -579,7 +580,7 @@ class ActionsByEmail $configuration = $resultD->getRow(); $field = new \stdClass(); - $obj = new \pmDynaform($configuration); + $obj = new PmDynaform($configuration); if ($dataRes['ABE_RES_DATA'] !== '') { $value = unserialize($dataRes['ABE_RES_DATA']); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php b/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php index 7f821129f..b6be36577 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php @@ -10,6 +10,7 @@ use Exception; use WsBase; use RBAC; use Applications; +use PmDynaform; class Cases { @@ -1632,7 +1633,7 @@ class Cases if (isset($field['type'])) { if ($field['type'] != 'form') { foreach ($field as &$val) { - if (is_string($val) && in_array(substr($val, 0, 2), \pmDynaform::$prefixs)) { + if (is_string($val) && in_array(substr($val, 0, 2), PmDynaform::$prefixs)) { $val = substr($val, 2); } } @@ -1695,7 +1696,7 @@ class Cases if (!is_null($dynaFormUid)) { $data["CURRENT_DYNAFORM"] = $dynaFormUid; - $pmDynaForm = new \pmDynaform($data); + $pmDynaForm = new PmDynaform($data); $arrayDynaFormData = $pmDynaForm->getDynaform(); $arrayDynContent = \G::json_decode($arrayDynaFormData['DYN_CONTENT']); $pmDynaForm->jsonr($arrayDynContent); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Consolidated.php b/workflow/engine/src/ProcessMaker/BusinessModel/Consolidated.php index 10790d076..35355357c 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Consolidated.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Consolidated.php @@ -1,13 +1,14 @@ @@ -468,7 +469,7 @@ class Consolidated $dataTask = $oDyna->load($dyn_uid); if ($dataTask['DYN_VERSION'] > 0) { $_SESSION['PROCESS'] = $pro_uid; - $pmDyna = new \pmDynaform(array('APP_DATA' => array(), "CURRENT_DYNAFORM" => $dyn_uid)); + $pmDyna = new PmDynaform(array('APP_DATA' => array(), "CURRENT_DYNAFORM" => $dyn_uid)); $json = G::json_decode($dataTask["DYN_CONTENT"]); $pmDyna->jsonr($json); $fieldsDyna = $json->items[0]->items; diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/InputDocument.php b/workflow/engine/src/ProcessMaker/BusinessModel/InputDocument.php index 9634740c2..62122e104 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/InputDocument.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/InputDocument.php @@ -1,6 +1,8 @@ update($arrayData); - $pmDynaform = new \pmDynaform(); + $pmDynaform = new PmDynaform(); $pmDynaform->synchronizeInputDocument($processUid, $arrayData); //Return diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Light.php b/workflow/engine/src/ProcessMaker/BusinessModel/Light.php index 3fa3b303e..0ea5c7ad7 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Light.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Light.php @@ -8,6 +8,7 @@ use UsersPeer; use AppDelegationPeer; use AppDelayPeer; use ProcessMaker\Util\DateTime; +use PmLicenseManager; class Light { @@ -779,7 +780,7 @@ class Light /*----------------------------------********---------------------------------*/ - $licenseManager =& \pmLicenseManager::getSingleton(); + $licenseManager =& PmLicenseManager::getSingleton(); if (in_array(md5($licenseManager->result), array('38afd7ae34bd5e3e6fc170d8b09178a3', 'ba2b45bdc11e2a4a6e86aab2ac693cbb'))) { $G_PUBLISH = new \Publisher(); $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/licenseExpired', '', array(), 'licenseUpdate'); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Light/Tracker.php b/workflow/engine/src/ProcessMaker/BusinessModel/Light/Tracker.php index 66860e131..152aeb161 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Light/Tracker.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Light/Tracker.php @@ -2,6 +2,7 @@ namespace ProcessMaker\BusinessModel\Light; +use PmDynaform; class Tracker { @@ -266,7 +267,7 @@ class Tracker $Fields["PRO_UID"] = $pro_uid; $Fields["CURRENT_DYNAFORM"] = $obj_uid; - $pmDynaForm = new \pmDynaform($Fields); + $pmDynaForm = new PmDynaform($Fields); // if ($pmDynaForm->isResponsive()) { // $pmDynaForm->printTracker(); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php b/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php index a8cb0d838..abc80d5ef 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php @@ -4,6 +4,7 @@ namespace ProcessMaker\BusinessModel; use G; use Exception; use AdditionalTables; +use PmDynaform; class Variable { @@ -194,7 +195,7 @@ class Variable "VAR_ACCEPTED_VALUES" => $variable->getVarAcceptedValues() ); - $pmDynaform = new \pmDynaform(); + $pmDynaform = new PmDynaform(); $pmDynaform->synchronizeVariable($processUid, $newVariable, $oldVariable); } else { @@ -236,7 +237,7 @@ class Variable $this->throwExceptionIfVariableIsAssociatedAditionalTable($variableUid); $variable = $this->getVariable($processUid, $variableUid); - $pmDynaform = new \pmDynaform(); + $pmDynaform = new PmDynaform(); $isUsed = $pmDynaform->isUsed($processUid, $variable); if ($isUsed !== false) { $titleDynaform=$pmDynaform->getDynaformTitle($isUsed); @@ -783,7 +784,7 @@ class Variable //This value is required to be able to query the database. $_SESSION["PROCESS"] = $proUid; //The pmdynaform class is instantiated - $pmDynaform = new \pmDynaform(array("APP_DATA" => $params)); + $pmDynaform = new PmDynaform(array("APP_DATA" => $params)); //Get control from dynaform. //The parameters: queryFilter, queryStart, queryLimit, are only necessary diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Light.php b/workflow/engine/src/ProcessMaker/Services/Api/Light.php index 77784985c..afb607a32 100644 --- a/workflow/engine/src/ProcessMaker/Services/Api/Light.php +++ b/workflow/engine/src/ProcessMaker/Services/Api/Light.php @@ -2,12 +2,13 @@ namespace ProcessMaker\Services\Api; -use \G; -use \ProcessMaker\Project\Adapter; -use \ProcessMaker\Services\Api; -use \Luracast\Restler\RestException; -use \ProcessMaker\BusinessModel\Validator; -use \ProcessMaker\Util\DateTime; +use G; +use ProcessMaker\Project\Adapter; +use ProcessMaker\Services\Api; +use Luracast\Restler\RestException; +use ProcessMaker\BusinessModel\Validator; +use ProcessMaker\Util\DateTime; +use PmDynaform; /** * @@ -867,7 +868,7 @@ class Light extends Api $response = $process->getDynaForms($prj_uid); $result = $this->parserDataDynaForm($response); - $pmDynaForm = new \pmDynaform(); + $pmDynaForm = new PmDynaform(); foreach ($result as $k => $form) { $result[$k]['formContent'] = (isset($form['formContent']) && $form['formContent'] != null)?json_decode($form['formContent']):""; $pmDynaForm->jsonr($result[$k]['formContent']); @@ -1009,7 +1010,7 @@ class Light extends Api $caseVariables = DateTime::convertUtcToTimeZone($caseVariables); } - $pmDynaform = new \pmDynaform(array("APP_DATA" => $caseVariables, "CURRENT_DYNAFORM" => $dyn_uid)); + $pmDynaform = new PmDynaform(array("APP_DATA" => $caseVariables, "CURRENT_DYNAFORM" => $dyn_uid)); $pmDynaform->jsonr($result['formContent']); return $result; } catch (\Exception $e) { @@ -1033,7 +1034,7 @@ class Light extends Api $result = $this->parserDataDynaForm($response); $result['formContent'] = (isset($result['formContent']) && $result['formContent'] != null) ? \G::json_decode($result['formContent']) : ""; - $pmDynaForm = new \pmDynaform(["CURRENT_DYNAFORM" => $dyn_uid]); + $pmDynaForm = new PmDynaform(["CURRENT_DYNAFORM" => $dyn_uid]); $pmDynaForm->jsonr($result['formContent']); return $result; } catch (\Exception $e) { @@ -1057,7 +1058,7 @@ class Light extends Api $return = array(); foreach ($request_data['formId'] as $dyn_uid) { $response = $dynaForm->getDynaForm($dyn_uid); - $pmDynaForm = new \pmDynaform(array("CURRENT_DYNAFORM" => $dyn_uid)); + $pmDynaForm = new PmDynaform(array("CURRENT_DYNAFORM" => $dyn_uid)); $result = $this->parserDataDynaForm($response); $result['formContent'] = (isset($result['formContent']) && $result['formContent'] != null)?json_decode($result['formContent']):""; $pmDynaForm->jsonr($result['formContent']); diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Project/DynaForm.php b/workflow/engine/src/ProcessMaker/Services/Api/Project/DynaForm.php index b544d7b4c..cd9dff8d6 100644 --- a/workflow/engine/src/ProcessMaker/Services/Api/Project/DynaForm.php +++ b/workflow/engine/src/ProcessMaker/Services/Api/Project/DynaForm.php @@ -1,9 +1,10 @@ downloadLanguage($dyn_uid, $lang); } catch (\Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); @@ -145,7 +146,7 @@ class DynaForm extends Api { try { - $pmDynaform = new \pmDynaform(); + $pmDynaform = new PmDynaform(); $pmDynaform->uploadLanguage($dyn_uid); } catch (\Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); @@ -162,7 +163,7 @@ class DynaForm extends Api { try { - $pmDynaform = new \pmDynaform(); + $pmDynaform = new PmDynaform(); $pmDynaform->deleteLanguage($dyn_uid, $lang); } catch (\Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); @@ -179,7 +180,7 @@ class DynaForm extends Api { try { - $pmDynaform = new \pmDynaform(); + $pmDynaform = new PmDynaform(); return $pmDynaform->listLanguage($dyn_uid); } catch (\Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); diff --git a/workflow/public_html/sysGeneric.php b/workflow/public_html/sysGeneric.php index 37608bb78..e770cb5b7 100644 --- a/workflow/public_html/sysGeneric.php +++ b/workflow/public_html/sysGeneric.php @@ -283,6 +283,8 @@ define( 'PML_WSDL_URL', PML_SERVER . '/syspmLibrary/en/green/services/wsdl' ); define( 'PML_UPLOAD_URL', PML_SERVER . '/syspmLibrary/en/green/services/uploadProcess' ); define( 'PML_DOWNLOAD_URL', PML_SERVER . '/syspmLibrary/en/green/services/download' ); +G::defineConstants(); + $config = Bootstrap::getSystemConfiguration(); // starting session