/** * Update a output document for a project * @param string $sProcessUID * @param array $outputDocumentData * @param string $sOutputDocumentUID * @param int $sFlag * * @access public */ public function updateOutputDocument($sProcessUID, $outputDocumentData, $sFlag, $sOutputDocumentUID = '') { $oConnection = \Propel::getConnection(\OutputDocumentPeer::DATABASE_NAME); $pemission = $outputDocumentData['out_doc_pdf_security_permissions']; $pemission = explode("|", $pemission); foreach ($pemission as $row) { if ($row == "print" || $row == "modify" || $row == "copy" || $row == "forms" || $row == "") { $outputDocumentData['out_doc_pdf_security_permissions'] = $outputDocumentData['out_doc_pdf_security_permissions']; } else { throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('out_doc_pdf_security_permissions'))); } } try { $oOutputDocument = \OutputDocumentPeer::retrieveByPK($sOutputDocumentUID); if (!is_null($oOutputDocument)) { if (isset($outputDocumentData['out_doc_pdf_security_open_password']) && $outputDocumentData['out_doc_pdf_security_open_password'] != "") { $outputDocumentData['out_doc_pdf_security_open_password'] = \G::encrypt($outputDocumentData['out_doc_pdf_security_open_password'], $sOutputDocumentUID); $outputDocumentData['out_doc_pdf_security_owner_password'] = \G::encrypt($outputDocumentData['out_doc_pdf_security_owner_password'], $sOutputDocumentUID); } else { unset($outputDocumentData['out_doc_pdf_security_open_password']); unset($outputDocumentData['out_doc_pdf_security_owner_password']); } $outputDocumentData = array_change_key_case($outputDocumentData, CASE_UPPER); $oOutputDocument->fromArray($outputDocumentData, \BasePeer::TYPE_FIELDNAME); if ($oOutputDocument->validate()) { $oConnection->begin(); if (isset($outputDocumentData['OUT_DOC_TITLE'])) { $uid = $this->titleExists($sProcessUID, $outputDocumentData["OUT_DOC_TITLE"]); if ($uid != '') { if ($uid != $sOutputDocumentUID && $sFlag == 0) { throw new \Exception(\G::LoadTranslation("ID_OUTPUT_NOT_SAVE")); } } $oOutputDocument->setOutDocTitle($outputDocumentData['OUT_DOC_TITLE']); } if (isset($outputDocumentData['OUT_DOC_DESCRIPTION'])) { $oOutputDocument->setOutDocDescription($outputDocumentData['OUT_DOC_DESCRIPTION']); } if (isset($outputDocumentData['OUT_DOC_FILENAME'])) { $oOutputDocument->setOutDocFilename($outputDocumentData['OUT_DOC_FILENAME']); } if (isset($outputDocumentData['OUT_DOC_TEMPLATE'])) { $outputDocumentData['OUT_DOC_TEMPLATE'] = stripslashes($outputDocumentData['OUT_DOC_TEMPLATE']); $outputDocumentData['OUT_DOC_TEMPLATE'] = str_replace("@amp@", "&", $outputDocumentData['OUT_DOC_TEMPLATE']); $oOutputDocument->setOutDocTemplate($outputDocumentData['OUT_DOC_TEMPLATE']); } $oOutputDocument->save(); $oConnection->commit(); } else { $sMessage = ''; $aValidationFailures = $oOutputDocument->getValidationFailures(); foreach ($aValidationFailures as $oValidationFailure) { $sMessage .= $oValidationFailure->getMessage(); } throw new \Exception(\G::LoadTranslation("ID_REGISTRY_CANNOT_BE_UPDATED") . $sMessage); } } else { throw new \Exception(\G::LoadTranslation("ID_ROW_DOES_NOT_EXIST")); } } catch (\Exception $e) { throw $e; } }
* myInfo_Ajax.php * * ProcessMaker Open Source Edition * Copyright (C) 2004 - 2008 Colosa Inc.23 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. * */ if (($RBAC_Response = $RBAC->userCanAccess("PM_LOGIN")) != 1) { return $RBAC_Response; } G::LoadClass("xmlMenu"); $form = new Form('myInfo/myInfoAEdit.xml', PATH_XMLFORM); $form->action = urlencode(G::encrypt('', URL_KEY)); $form->ajaxServer = urlencode(G::encrypt(SYS_URI . '/gulliver/defaultAjax', URL_KEY)); $template = PATH_CORE . 'templates/xmlform.html'; print $G_FORM->render($template, $scriptCode);
public function sendActionsByEmail($data) { try { // Validations try { if (!is_object($data)) { throw new Exception('The parameter $data is null.'); } if (!isset($data->TAS_UID)) { throw new Exception('The parameter $data->TAS_UID is null.'); } if (!isset($data->APP_UID)) { throw new Exception('The parameter $data->APP_UID is null.'); } if (!isset($data->DEL_INDEX)) { throw new Exception('The parameter $data->DEL_INDEX is null.'); } if (!isset($data->USR_UID)) { throw new Exception('The parameter $data->USR_UID is null.'); } if ($data->TAS_UID == '') { throw new Exception('The parameter $data->TAS_UID is empty.'); } if ($data->APP_UID == '') { throw new Exception('The parameter $data->APP_UID is empty.'); } if ($data->DEL_INDEX == '') { throw new Exception('The parameter $data->DEL_INDEX is empty.'); } if ($data->USR_UID == '') { throw new Exception('The parameter $data->USR_UID is empty.'); } } catch(Exception $e) { echo $e->getMessage().' Please contact to your system administrator.'; die; } G::LoadClass('pmFunctions'); $emailSetup = getEmailConfiguration(); if (!empty($emailSetup)) { require_once 'classes/model/AbeConfiguration.php'; G::LoadClass('case'); $cases = new Cases(); $caseFields = $cases->loadCase($data->APP_UID); $criteria = new Criteria(); $criteria->addSelectColumn(AbeConfigurationPeer::ABE_UID); $criteria->addSelectColumn(AbeConfigurationPeer::PRO_UID); $criteria->addSelectColumn(AbeConfigurationPeer::ABE_TYPE); $criteria->addSelectColumn(AbeConfigurationPeer::TAS_UID); $criteria->addSelectColumn(AbeConfigurationPeer::ABE_TEMPLATE); $criteria->addSelectColumn(AbeConfigurationPeer::ABE_DYN_TYPE); $criteria->addSelectColumn(AbeConfigurationPeer::DYN_UID); $criteria->addSelectColumn(AbeConfigurationPeer::ABE_EMAIL_FIELD); $criteria->addSelectColumn(AbeConfigurationPeer::ABE_ACTION_FIELD); $criteria->addSelectColumn(AbeConfigurationPeer::ABE_SUBJECT_FIELD); $criteria->addSelectColumn(DynaformPeer::DYN_CONTENT); $criteria->addJoin( AbeConfigurationPeer::DYN_UID, DynaformPeer::DYN_UID, Criteria::LEFT_JOIN ); $criteria->add(AbeConfigurationPeer::PRO_UID, $caseFields['PRO_UID']); $criteria->add(AbeConfigurationPeer::TAS_UID, $data->TAS_UID); $result = AbeConfigurationPeer::doSelectRS($criteria); $result->setFetchmode(ResultSet::FETCHMODE_ASSOC); $result->next(); if ($configuration = $result->getRow()) { $configuration['ABE_EMAIL_FIELD'] = str_replace('@@', '', $configuration['ABE_EMAIL_FIELD']); if ($configuration['ABE_EMAIL_FIELD'] != '' && isset($caseFields['APP_DATA'][$configuration['ABE_EMAIL_FIELD']])) { $email = trim($caseFields['APP_DATA'][$configuration['ABE_EMAIL_FIELD']]); } else { require_once 'classes/model/Users.php'; $userInstance = new Users(); $userInfo = $userInstance->getAllInformation($data->USR_UID); $email = $userInfo['mail']; } if ($email != '') { $subject = G::replaceDataField( $configuration['ABE_SUBJECT_FIELD'], $caseFields['APP_DATA'] ); if($subject == ''){ $subject = $caseFields['APP_TITLE']; } // Create require_once 'classes/model/AbeRequests.php'; $abeRequest = array(); $abeRequest['ABE_REQ_UID'] = ''; $abeRequest['ABE_UID'] = $configuration['ABE_UID']; $abeRequest['APP_UID'] = $data->APP_UID; $abeRequest['DEL_INDEX'] = $data->DEL_INDEX; $abeRequest['ABE_REQ_SENT_TO'] = $email; $abeRequest['ABE_REQ_SUBJECT'] = $subject; $abeRequest['ABE_REQ_BODY'] = ''; $abeRequest['ABE_REQ_ANSWERED'] = 0; $abeRequest['ABE_REQ_STATUS'] = 'PENDING'; try { $abeRequestsInstance = new AbeRequests(); $abeRequest['ABE_REQ_UID'] = $abeRequestsInstance->createOrUpdate($abeRequest); } catch (Exception $error) { throw $error; } if ($configuration['ABE_TYPE'] != '') { // Email $_SESSION['CURRENT_DYN_UID'] = $configuration['DYN_UID']; $scriptCode = ''; // foreach ($dynaform->fields as $fieldName => $field) { // if ($field->type == 'submit') { // unset($dynaform->fields[$fieldName]); // } // } $__ABE__ = ''; $link = (G::is_https() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/ActionsByEmail'; switch ($configuration['ABE_TYPE']) { case 'LINK': // $__ABE__ .= $dynaform->render(PATH_FEATURES . 'actionsByEmail/xmlform.html', $scriptCode) . '<br />'; $__ABE__ .= '<a href="' . $link . 'DataForm?APP_UID=' . G::encrypt($data->APP_UID, URL_KEY) . '&DEL_INDEX=' . G::encrypt($data->DEL_INDEX, URL_KEY) . '&DYN_UID=' . G::encrypt($configuration['DYN_UID'], URL_KEY) . '&ABER=' . G::encrypt($abeRequest['ABE_REQ_UID'], URL_KEY) . '" target="_blank">Please complete this form</a>'; break; // coment case 'FIELD': $variableService = new \ProcessMaker\Services\Api\Project\Variable(); $variables = $variableService->doGetVariables($caseFields['PRO_UID']); $field = new stdClass(); $field->label = 'Test'; $field->type = 'dropdown'; $field->options = array(); $actionField = str_replace('@@', '', $configuration['ABE_ACTION_FIELD']); $dynaform = $configuration['DYN_UID']; $variables = G::json_decode($configuration['DYN_CONTENT'], true); if(isset($variables['items'][0]['items'])){ $fields = $variables['items'][0]['items']; foreach ($fields as $key => $value) { foreach($value as $var){ G::pr($var); if(isset($var['variable'])){ if ($var['variable'] == $actionField) { $field->label = $var['label']; $field->type = $var['type']; $values = $var['options']; foreach ($values as $val){ $field->options[$val['value']] = $val['value']; } } } } } } G::LoadClass('pmDynaform'); $obj = new pmDynaform($configuration['DYN_UID']); $configuration['CURRENT_DYNAFORM'] = $configuration['DYN_UID']; $file = $obj->printPmDynaformAbe($configuration); $__ABE__ .= $file; $__ABE__ .= '<strong>' . $field->label . '</strong><br /><table align="left" border="0"><tr>'; switch ($field->type) { case 'dropdown': case 'radiogroup': $index = 1; $__ABE__.='<br /><td><table align="left" cellpadding="2"><tr>'; foreach ($field->options as $optValue => $optName) { $__ABE__ .= '<td align="center"><a style="text-decoration: none; color: #000; background-color: #E5E5E5; '; $__ABE__ .= 'filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#EFEFEF, endColorstr=#BCBCBC); '; $__ABE__ .= 'background-image: -webkit-gradient(linear, left top, left bottom, from(#EFEFEF), #BCBCBC); '; $__ABE__ .= 'background-image: -webkit-linear-gradient(top, #EFEFEF, #BCBCBC); '; $__ABE__ .= 'background-image: -moz-linear-gradient(top, #EFEFEF, #BCBCBC); background-image: -ms-linear-gradient(top, #EFEFEF, #BCBCBC); '; $__ABE__ .= 'background-image: -o-linear-gradient(top, #EFEFEF, #BCBCBC); border: 1px solid #AAAAAA; '; $__ABE__ .= 'border-radius: 4px; -moz-border-radius: 4px; -webkit-border-radius: 4px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); '; $__ABE__ .= 'font-family: Arial,serif; font-size: 9pt; font-weight: 400; line-height: 14px; margin: 2px 0; padding: 2px 7px; '; $__ABE__ .= 'text-decoration: none; text-transform: capitalize;" href="' .urldecode(urlencode($link)). '?ACTION='.G::encrypt('processABE', URL_KEY).'&APP_UID='; $__ABE__ .= G::encrypt($data->APP_UID, URL_KEY) . '&DEL_INDEX=' . G::encrypt($data->DEL_INDEX, URL_KEY); $__ABE__ .= '&FIELD=' . G::encrypt($actionField, URL_KEY) . '&VALUE=' . G::encrypt($optValue, URL_KEY); $__ABE__ .= '&ABER=' . G::encrypt($abeRequest['ABE_REQ_UID'], URL_KEY) . '" target="_blank" >' . $optName; $__ABE__ .= '</a></td>' . (($index % 5 == 0) ? '</tr><tr>' : ' '); $index++; } $__ABE__.='</tr></table></td>'; break; case 'yesno': $__ABE__ .= '<td align="center"><a href="' . $link . 'dataField?APP_UID=' . urlencode(G::encrypt($data->APP_UID, URL_KEY)) . '&DEL_INDEX=' . urlencode(G::encrypt($data->DEL_INDEX, URL_KEY)). '&FIELD=' . urlencode(G::encrypt($actionField, URL_KEY)) . '&VALUE=' . urlencode(G::encrypt(1, URL_KEY)) . '&ABER=' . urlencode(G::encrypt($abeRequest['ABE_REQ_UID'], URL_KEY)) . '" target="_blank">' . G::LoadTranslation('ID_YES_VALUE') . '</a></td>'; $__ABE__ .= '<td align="center"><a href="' . $link . 'dataField?APP_UID=' . urlencode(G::encrypt($data->APP_UID, URL_KEY)) . '&DEL_INDEX=' . urlencode(G::encrypt($data->DEL_INDEX, URL_KEY)) . '&FIELD=' . urlencode(G::encrypt($actionField, URL_KEY)) . '&VALUE=' . urlencode(G::encrypt(0, URL_KEY)) . '&ABER=' . urlencode(G::encrypt($abeRequest['ABE_REQ_UID'], URL_KEY)) . '" target="_blank">' . G::LoadTranslation('ID_NO_VALUE') . '</a></td>'; break; case 'checkbox': $__ABE__ .= '<td align="center"><a href="' . $link . 'dataField?APP_UID=' . G::encrypt($data->APP_UID, URL_KEY) . '&DEL_INDEX=' . G::encrypt($data->DEL_INDEX, URL_KEY) . '&FIELD=' . G::encrypt($actionField, URL_KEY) . '&VALUE=' . G::encrypt($field->value, URL_KEY) . '&ABER=' . G::encrypt($abeRequest['ABE_REQ_UID'], URL_KEY) . '" target="_blank">Check</a></td>'; $__ABE__ .= '<td align="center"><a href="' . $link . 'dataField?APP_UID=' . G::encrypt($data->APP_UID, URL_KEY) . '&DEL_INDEX=' . G::encrypt($data->DEL_INDEX, URL_KEY) . '&FIELD=' . G::encrypt($actionField, URL_KEY) . '&VALUE=' . G::encrypt($field->value, URL_KEY) . '&ABER=' . G::encrypt($abeRequest['ABE_REQ_UID'], URL_KEY) . '" target="_blank">Uncheck</a></td>'; break; } $__ABE__ .= '</tr></table>'; break; } $__ABE__ = preg_replace('/\<img src=\"\/js\/maborak\/core\/images\/(.+?)\>/', '' , $__ABE__); $__ABE__ = preg_replace('/\<input\b[^>]*\/>/', '' , $__ABE__); $__ABE__ = preg_replace('/<select\b[^>]*>(.*?)<\/select>/is', "", $__ABE__); $__ABE__ = preg_replace('/align=\"center\"/', '' , $__ABE__); $__ABE__ = preg_replace('/class="tableGrid_view" /', 'class="tableGrid_view" width="100%" ', $__ABE__); $caseFields['APP_DATA']['__ABE__'] = $__ABE__; G::LoadClass("Users"); $user = new Users(); $userDetails = $user->loadDetails($data->PREVIOUS_USR_UID); $emailFrom = $userDetails["USR_EMAIL"]; G::LoadClass('wsBase'); $wsBaseInstance = new wsBase(); $result = $wsBaseInstance->sendMessage($data->APP_UID, $emailFrom, $email, '', '', $subject, $configuration['ABE_TEMPLATE'], $caseFields['APP_DATA'], ''); $abeRequest['ABE_REQ_STATUS'] = ($result->status_code == 0 ? 'SENT' : 'ERROR'); $body = ''; $messageSent = executeQuery('SELECT `APP_MSG_BODY` FROM `APP_MESSAGE` ORDER BY `APP_MSG_SEND_DATE` DESC LIMIT 1'); if (!empty($messageSent) && is_array($messageSent)) { $body = $messageSent[1]['APP_MSG_BODY']; } $abeRequest['ABE_REQ_BODY'] = $body; // Update try { $abeRequestsInstance = new AbeRequests(); $abeRequestsInstance->createOrUpdate($abeRequest); } catch (Exception $error) { throw $error; } } } } } } catch (Exception $error) { throw $error; } }
$oDBSource = new DbSource(); $oContent = new Content(); if (strpos($_POST['server'], "\\")) { $_POST['port'] = 'none'; } $aData = array('DBS_UID' => $_POST['dbs_uid'], 'PRO_UID' => $_SESSION['PROCESS'], 'DBS_TYPE' => $_POST['type'], 'DBS_SERVER' => $_POST['server'], 'DBS_DATABASE_NAME' => $_POST['db_name'], 'DBS_USERNAME' => $_POST['user'], 'DBS_PASSWORD' => ($_POST['passwd'] == 'none' ? "" : G::encrypt($_POST['passwd'], $_POST['db_name'])) . "_2NnV3ujj3w", 'DBS_PORT' => $_POST['port'] == 'none' ? "" : $_POST['port'], 'DBS_ENCODE' => $_POST['enc']); $oDBSource->update($aData); $oContent->addContent('DBS_DESCRIPTION', '', $_POST['dbs_uid'], SYS_LANG, $_POST['desc']); break; case 'saveConnection': $oDBSource = new DbSource(); $oContent = new Content(); if (strpos($_POST['server'], "\\")) { $_POST['port'] = 'none'; } $aData = array('PRO_UID' => $_SESSION['PROCESS'], 'DBS_TYPE' => $_POST['type'], 'DBS_SERVER' => $_POST['server'], 'DBS_DATABASE_NAME' => $_POST['db_name'], 'DBS_USERNAME' => $_POST['user'], 'DBS_PASSWORD' => ($_POST['passwd'] == 'none' ? "" : G::encrypt($_POST['passwd'], $_POST['db_name'])) . "_2NnV3ujj3w", 'DBS_PORT' => $_POST['port'] == 'none' ? "" : $_POST['port'], 'DBS_ENCODE' => $_POST['enc']); $newid = $oDBSource->create($aData); $sDelimiter = DBAdapter::getStringDelimiter(); $oContent->addContent('DBS_DESCRIPTION', '', $newid, SYS_LANG, $_POST['desc']); break; case 'deleteDbConnection': try { $oDBSource = new DbSource(); $oContent = new Content(); $DBS_UID = $_POST['dbs_uid']; $PRO_UID = $_SESSION['PROCESS']; $oDBSource->remove($DBS_UID, $PRO_UID); $oContent->removeContent('DBS_DESCRIPTION', "", $DBS_UID); $result->success = true; $result->msg = G::LoadTranslation('ID_DBCONNECTION_REMOVED'); } catch (Exception $e) {
/** * this function updates an authentication source * Authentication Sources * * @access public * * @param array $aData * @return $this->authSourcesObj->create */ public function updateAuthSource($aData) { $aData['AUTH_SOURCE_PASSWORD'] = G::encrypt($aData['AUTH_SOURCE_PASSWORD'], $aData['AUTH_SOURCE_SERVER_NAME']) . "_2NnV3ujj3w"; $this->authSourcesObj->update($aData); }
/** * It Renders content according to Part['Type'] * * @author Fernando Ontiveros Lira <*****@*****.**> * * @param intPos = 0 * @return void * */ public function RenderContent0($intPos = 0, $showXMLFormName = false) { global $G_FORM; global $G_TABLE; global $G_TMP_TARGET; global $G_OP_MENU; global $G_IMAGE_FILENAME; global $G_IMAGE_PARTS; global $_SESSION; //Changed from $HTTP_SESSION_VARS global $G_OBJGRAPH; //For graphLayout component $this->intPos = $intPos; $Part = $this->Parts[$intPos]; $this->publishType = $Part['Type']; switch ($this->publishType) { case 'externalContent': $G_CONTENT = new Content(); if ($Part['Content'] != "") { $G_CONTENT = G::LoadContent($Part['Content']); } G::LoadTemplateExternal($Part['Template']); break; case 'image': $G_IMAGE_FILENAME = $Part['File']; $G_IMAGE_PARTS = $Part['Data']; break; case 'appform': global $APP_FORM; $G_FORM = $APP_FORM; break; case 'xmlform': case 'dynaform': global $G_FORM; if ($Part['AbsolutePath']) { $sPath = $Part['AbsolutePath']; } else { if ($this->publishType == 'xmlform') { $sPath = PATH_XMLFORM; } else { $sPath = PATH_DYNAFORM; } } //if the xmlform file doesn't exists, then try with the plugins folders if (!is_file($sPath . $Part['File'] . '.xml')) { $aux = explode(PATH_SEP, $Part['File']); //check if G_PLUGIN_CLASS is defined, because publisher can be called without an environment if (count($aux) > 2) { //Subfolders $filename = array_pop($aux); $aux0 = implode(PATH_SEP, $aux); $aux = array(); $aux[0] = $aux0; $aux[1] = $filename; } if (count($aux) == 2 && defined('G_PLUGIN_CLASS')) { $oPluginRegistry =& PMPluginRegistry::getSingleton(); if ($response = $oPluginRegistry->isRegisteredFolder($aux[0])) { if ($response !== true) { $sPath = PATH_PLUGINS . $response . PATH_SEP; } else { $sPath = PATH_PLUGINS; } } } } if (!class_exists($Part['Template']) || $Part['Template'] === 'xmlform') { $G_FORM = new Form($Part['File'], $sPath, SYS_LANG, false); } else { eval('$G_FORM = new ' . $Part['Template'] . ' ( $Part[\'File\'] , "' . $sPath . '");'); } if ($this->publishType == 'dynaform' && ($Part['Template'] == 'xmlform' || $Part['Template'] == 'xmlform_preview')) { $dynaformShow = isset($G_FORM->printdynaform) && $G_FORM->printdynaform ? 'gulliver/dynaforms_OptionsPrint' : 'gulliver/dynaforms_Options'; $G_FORM->fields = G::array_merges(array('__DYNAFORM_OPTIONS' => new XmlForm_Field_XmlMenu(new Xml_Node('__DYNAFORM_OPTIONS', 'complete', '', array('type' => 'xmlmenu', 'xmlfile' => $dynaformShow, 'parentFormId' => $G_FORM->id)), SYS_LANG, PATH_XMLFORM, $G_FORM)), $G_FORM->fields); } //Needed to make ajax calls //The action in the form tag. if (defined('ENABLE_ENCRYPT') && ENABLE_ENCRYPT == 'yes') { $G_FORM->action = urlencode(G::encrypt($Part['Target'], URL_KEY)); } else { $G_FORM->action = $Part['Target']; } if (!(isset($Part['ajaxServer']) && $Part['ajaxServer'] !== '')) { if ($this->publishType == 'dynaform') { $Part['ajaxServer'] = '../gulliver/defaultAjaxDynaform'; } else { $Part['ajaxServer'] = '../gulliver/defaultAjax'; } } if (defined('ENABLE_ENCRYPT') && ENABLE_ENCRYPT == 'yes') { $G_FORM->ajaxServer = urlencode(G::encrypt($Part['ajaxServer'], URL_KEY)); } else { $G_FORM->ajaxServer = $Part['ajaxServer']; } $G_FORM->setValues($Part['Data']); $G_FORM->setValues(array('G_FORM_ID' => $G_FORM->id)); //Asegurese de que no entre cuando $Part['Template']=="grid" //de hecho soo deberia usarse cuando $Part['Template']=="xmlform" if ($this->publishType == 'dynaform' && $Part['Template'] == "xmlform" || $Part['Template'] == "xmlform") { $G_FORM->values = G::array_merges(array('__DYNAFORM_OPTIONS' => isset($Part['Data']['__DYNAFORM_OPTIONS']) ? $Part['Data']['__DYNAFORM_OPTIONS'] : ''), $G_FORM->values); if (isset($G_FORM->nextstepsave)) { switch ($G_FORM->nextstepsave) { // this condition validates if the next step link is configured to Save and Go the next step or show a prompt case 'save': // Save and Next only if there are no required fields can submit the form. $G_FORM->values['__DYNAFORM_OPTIONS']['NEXT_ACTION'] = 'if (document.getElementById("' . $G_FORM->id . '")&&validateForm(document.getElementById(\'DynaformRequiredFields\').value)) {document.getElementById("' . $G_FORM->id . '").submit();}return false;'; break; case 'prompt': // Show Prompt only if there are no required fields can submit the form. $G_FORM->values['__DYNAFORM_OPTIONS']['NEXT_ACTION'] = 'if (document.getElementById("' . $G_FORM->id . '")&&validateForm(document.getElementById(\'DynaformRequiredFields\').value)) {if(dynaFormChanged(document.getElementsByTagName(\'form\').item(0))) {new leimnud.module.app.confirm().make({label:"@G::LoadTranslation(ID_DYNAFORM_SAVE_CHANGES)", action:function(){document.getElementById("' . $G_FORM->id . '").submit();}.extend(this), cancel:function(){window.location = getField("DYN_FORWARD").href;}.extend(this)});return false;} else {window.location = getField("DYN_FORWARD").href;return false;}}return false;'; break; } } } if (isset($_SESSION)) { $_SESSION[$G_FORM->id] = $G_FORM->values; } // by default load the core template if ($Part['Template'] == 'xmlform_preview') { $Part['Template'] = 'xmlform'; } $template = PATH_CORE . 'templates/' . $Part['Template'] . '.html'; //erik: new feature, now templates such as xmlform.html can be personalized via skins if (defined('SYS_SKIN') && strtolower(SYS_SKIN) != 'classic') { // First, verify if the template exists on Custom skins path if (is_file(PATH_CUSTOM_SKINS . SYS_SKIN . PATH_SEP . $Part['Template'] . '.html')) { $template = PATH_CUSTOM_SKINS . SYS_SKIN . PATH_SEP . $Part['Template'] . '.html'; //Second, verify if the template exists on base skins path } elseif (is_file(G::ExpandPath("skinEngine") . SYS_SKIN . PATH_SEP . $Part['Template'] . '.html')) { $template = G::ExpandPath("skinEngine") . SYS_SKIN . PATH_SEP . $Part['Template'] . '.html'; } } //end new feature if ($Part['Template'] == 'grid') { print '<form class="formDefault">'; } $scriptCode = ''; if ($this->localMode != '') { // @# las modification by erik in 09/06/2008 $G_FORM->mode = $this->localMode; } print $G_FORM->render($template, $scriptCode); if ($Part['Template'] == 'grid') { print '</form>'; } $oHeadPublisher =& headPublisher::getSingleton(); $oHeadPublisher->addScriptFile($G_FORM->scriptURL); $oHeadPublisher->addScriptCode($scriptCode); /** * We've implemented the conditional show hide fields.. * * @author Erik A. Ortiz <*****@*****.**> * @date Fri Feb 19, 2009 */ if ($this->publishType == 'dynaform') { if (isset($_SESSION['CURRENT_DYN_UID']) || isset($_SESSION['CONDITION_DYN_UID'])) { require_once "classes/model/FieldCondition.php"; $oFieldCondition = new FieldCondition(); //This dynaform has show/hide field conditions if (isset($_SESSION['CURRENT_DYN_UID']) && $_SESSION['CURRENT_DYN_UID'] != '') { $ConditionalShowHideRoutines = $oFieldCondition->getConditionScript($_SESSION["CURRENT_DYN_UID"]); //lsl } else { if (isset($_SESSION['CONDITION_DYN_UID']) && $_SESSION['CONDITION_DYN_UID'] != '') { $ConditionalShowHideRoutines = $oFieldCondition->getConditionScript($_SESSION["CONDITION_DYN_UID"]); //lsl } } } } if (isset($ConditionalShowHideRoutines) && $ConditionalShowHideRoutines) { G::evalJScript($ConditionalShowHideRoutines); } break; case 'pagedtable': global $G_FORM; //if the xmlform file doesn't exists, then try with the plugins folders $sPath = PATH_XMLFORM; if (!is_file($sPath . $Part['File'])) { $aux = explode(PATH_SEP, $Part['File']); if (count($aux) == 2) { $oPluginRegistry =& PMPluginRegistry::getSingleton(); if ($oPluginRegistry->isRegisteredFolder($aux[0])) { $sPath = PATH_PLUGINS; // . $aux[0] . PATH_SEP ; } } } $G_FORM = new Form($Part['File'], $sPath, SYS_LANG, true); if (defined('ENABLE_ENCRYPT') && ENABLE_ENCRYPT == 'yes') { $G_FORM->ajaxServer = urlencode(G::encrypt($Part['ajaxServer'], URL_KEY)); } else { $G_FORM->ajaxServer = $Part['ajaxServer']; } $G_FORM->setValues($Part['Data']); if (isset($_SESSION)) { $_SESSION[$G_FORM->id] = $G_FORM->values; } G::LoadSystem('pagedTable'); $oTable = new pagedTable(); $oTable->template = 'templates/' . $Part['Template'] . '.html'; $G_FORM->xmlform = ''; $G_FORM->xmlform->fileXml = $G_FORM->fileName; $G_FORM->xmlform->home = $G_FORM->home; $G_FORM->xmlform->tree->attribute = $G_FORM->tree->attributes; $G_FORM->values = array_merge($G_FORM->values, $Part['Data']); $oTable->setupFromXmlform($G_FORM); if (isset($Part['ajaxServer']) && $Part['ajaxServer'] !== '') { $oTable->ajaxServer = $Part['ajaxServer']; } /* Start Block: Load user configuration for the pagedTable */ G::LoadClass('configuration'); $objUID = $Part['File']; $conf = new Configurations(); $conf->loadConfig($oTable, 'pagedTable', $objUID, '', isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : '', ''); $oTable->__OBJ_UID = $objUID; /* End Block */ /* Start Block: PagedTable Right Click */ G::LoadClass('popupMenu'); $pm = new popupMenu('gulliver/pagedTable_PopupMenu'); $pm->name = $oTable->id; $fields = array_keys($oTable->fields); foreach ($fields as $f) { switch (strtolower($oTable->fields[$f]['Type'])) { case 'javascript': case 'button': case 'private': case 'hidden': case 'cellmark': break; 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->values[$f] = ''; } } $sc = ''; $pm->values['PAGED_TABLE_ID'] = $oTable->id; print $pm->render(PATH_CORE . 'templates/popupMenu.html', $sc); /* End Block */ $oTable->renderTable(); /* Start Block: Load PagedTable Right Click */ print '<script type="text/javascript">'; print $sc; print 'loadPopupMenu_' . $oTable->id . '();'; print '</script>'; /* End Block */ break; case 'propeltable': global $G_FORM; //if the xmlform file doesn't exists, then try with the plugins folders if ($Part['AbsolutePath']) { $sPath = ''; } else { $sPath = PATH_XMLFORM; } if (!is_file($sPath . $Part['File'])) { $aux = explode(PATH_SEP, $Part['File']); //search in PLUGINS folder, probably the file is in plugin if (count($aux) == 2) { $oPluginRegistry =& PMPluginRegistry::getSingleton(); if ($oPluginRegistry->isRegisteredFolder($aux[0])) { $sPath = PATH_PLUGINS; // . $aux[0] . PATH_SEP ; } } //search in PATH_DYNAFORM folder if (!is_file($sPath . PATH_SEP . $Part['File'] . '.xml')) { $sPath = PATH_DYNAFORM; } } //PATH_DATA_PUBLIC ??? if (!file_exists($sPath . PATH_SEP . $Part['File'] . '.xml') && defined('PATH_DATA_PUBLIC')) { $sPath = PATH_DATA_PUBLIC; } $G_FORM = new Form($Part['File'], $sPath, SYS_LANG, true); if (defined('ENABLE_ENCRYPT') && ENABLE_ENCRYPT == 'yes') { $G_FORM->ajaxServer = urlencode(G::encrypt($Part['ajaxServer'], URL_KEY)); } else { $G_FORM->ajaxServer = $Part['ajaxServer']; } if (isset($_SESSION)) { $_SESSION[$G_FORM->id] = $G_FORM->values; } G::LoadClass('propelTable'); $oTable = new propelTable(); $oTable->template = $Part['Template']; $oTable->criteria = $Part['Content']; if (isset($Part['ajaxServer']) && $Part['ajaxServer'] !== '') { $oTable->ajaxServer = $Part['ajaxServer']; } if (!isset($G_FORM->xmlform)) { $G_FORM->xmlform = new stdclass(); } $G_FORM->xmlform->fileXml = $G_FORM->fileName; $G_FORM->xmlform->home = $G_FORM->home; if (!isset($G_FORM->xmlform->tree)) { $G_FORM->xmlform->tree = new stdclass(); } $G_FORM->xmlform->tree->attribute = $G_FORM->tree->attributes; if (is_array($Part['Data'])) { $G_FORM->values = array_merge($G_FORM->values, $Part['Data']); } $oTable->setupFromXmlform($G_FORM); /* Start Block: Load user configuration for the pagedTable */ G::LoadClass('configuration'); $objUID = $Part['File']; $conf = new Configurations($oTable); $conf->loadConfig($oTable, 'pagedTable', $objUID, '', isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : '', ''); $oTable->__OBJ_UID = $objUID; //$oTable->__OBJ_UID = ''; /* End Block */ /* Start Block: PagedTable Right Click */ G::LoadClass('popupMenu'); $pm = new popupMenu('gulliver/pagedTable_PopupMenu'); $sc = $pm->renderPopup($oTable->id, $oTable->fields); /* End Block */ //krumo ( $Part ); if ($this->ROWS_PER_PAGE) { $oTable->rowsPerPage = $this->ROWS_PER_PAGE; } try { if (is_array($Part['Data'])) { $oTable->renderTable('', $Part['Data']); } else { $oTable->renderTable(); } print $sc; } catch (Exception $e) { $aMessage['MESSAGE'] = $e->getMessage(); $this->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage); } break; case 'panel-init': global $mainPanelScript; global $panelName; global $tabCount; //G::LoadThirdParty( 'pear/json', 'class.json' ); //$json = new Services_JSON(); $tabCount = 0; $panelName = $Part['Template']; $data = $Part['File']; if (!is_array($data)) { $data = array(); } $data = G::array_merges(array('title' => '', 'style' => array(), 'left' => 'getAbsoluteLeft(mycontent)', 'top' => 'getAbsoluteTop(mycontent)', 'width' => 700, 'height' => 600, 'drag' => true, 'close' => true, 'modal' => true, 'roll' => false, 'resize' => false, 'tabWidth' => 120, 'tabStep' => 3, 'blinkToFront' => true, 'tabSpace' => 10), $data); $mainPanelScript = 'var ' . $panelName . '={},' . $panelName . 'Tabs=[];' . 'leimnud.event.add(window,"load",function(){' . $panelName . ' = new leimnud.module.panel();' . 'var mycontent=document.getElementById("' . $this->publisherId . '[' . $intPos . ']");' . $panelName . '.options={' . 'size:{w:' . $data['width'] . ',h:' . $data['height'] . '},' . 'position:{x:' . $data['left'] . ',y:' . $data['top'] . '},' . 'title:"' . addcslashes($data['title'], '\\"') . '",' . 'theme:"processmaker",' . 'statusBar:true,' . 'headerBar:true,' . 'control:{' . ' close:' . ($data['close'] ? 'true' : 'false') . ',' . ' roll:' . ($data['roll'] ? 'true' : 'false') . ',' . ' drag:' . ($data['drag'] ? 'true' : 'false') . ',' . ' resize:' . ($data['resize'] ? 'true' : 'false') . '},' . 'fx:{' . ' drag:' . ($data['drag'] ? 'true' : 'false') . ',' . ' modal:' . ($data['modal'] ? 'true' : 'false') . ',' . ' blinkToFront:' . ($data['blinkToFront'] ? 'true' : 'false') . '}' . '};' . $panelName . '.setStyle=' . Bootstrap::json_encode($data['style']) . ';' . $panelName . '.tab={' . 'width:' . ($data['tabWidth'] + $data['tabSpace']) . ',' . 'optWidth:' . $data['tabWidth'] . ',' . 'step :' . $data['tabStep'] . ',' . 'options:[]' . '};'; print ' '; break; case 'panel-tab': global $tabCount; global $mainPanelScript; global $panelName; $onChange = $Part['Content']; $beforeChange = $Part['Data']; if (SYS_LANG == 'es') { $mainPanelScript = str_replace("120", "150", $mainPanelScript); } else { $mainPanelScript = str_replace("150", "120", $mainPanelScript); } $mainPanelScript .= $panelName . 'Tabs[' . $tabCount . ']=' . 'document.getElementById("' . $Part['File'] . '");' . $panelName . '.tab.options[' . $panelName . '.tab.options.length]=' . '{' . 'title :"' . addcslashes($Part['Template'], '\\"') . '",' . 'noClear :true,' . 'content :function(){' . ($beforeChange != '' ? 'if (typeof(' . $beforeChange . ')!=="undefined") {' . $beforeChange . '();}' : '') . $panelName . 'Clear();' . $panelName . 'Tabs[' . $tabCount . '].style.display="";' . ($onChange != '' ? 'if (typeof(' . $onChange . ')!=="undefined") {' . $onChange . '();}' : '') . '}.extend(' . $panelName . '),' . 'selected:' . ($tabCount == 0 ? 'true' : 'false') . '};'; $tabCount++; break; case 'panel-close': global $mainPanelScript; global $panelName; global $tabCount; $mainPanelScript .= $panelName . '.make();'; $mainPanelScript .= 'for(var r=0;r<' . $tabCount . ';r++)' . 'if (' . $panelName . 'Tabs[r])' . $panelName . '.addContent(' . $panelName . 'Tabs[r]);'; $mainPanelScript .= '});'; $mainPanelScript .= 'function ' . $panelName . 'Clear(){'; $mainPanelScript .= 'for(var r=0;r<' . $tabCount . ';r++)' . 'if (' . $panelName . 'Tabs[r])' . $panelName . 'Tabs[r].style.display="none";}'; $oHeadPublisher =& headPublisher::getSingleton(); $oHeadPublisher->addScriptCode($mainPanelScript); break; case 'blank': print ' '; break; case 'varform': global $G_FORM; $G_FORM = new Form(); G::LoadSystem("varform"); $xml = new varForm(); //$xml->parseFile ( ); $xml->renderForm($G_FORM, $Part['File']); $G_FORM->Values = $Part['Data']; $G_FORM->SetUp($Part['Target']); $G_FORM->width = 500; break; case 'table': $G_TMP_TARGET = $Part['Target']; $G_TABLE = G::LoadRawTable($Part['File'], $this->dbc, $Part['Data']); break; case 'menu': $G_TMP_TARGET = $Part['Target']; $G_OP_MENU = new Menu(); $G_OP_MENU->Load($Part['File']); break; case 'smarty': //To do: Please check it 26/06/07 $template = new Smarty(); $template->compile_dir = PATH_SMARTY_C; $template->cache_dir = PATH_SMARTY_CACHE; $template->config_dir = PATH_THIRDPARTY . 'smarty/configs'; $template->caching = false; $dataArray = $Part['Data']; // verify if there are templates folders registered, template and method folders are the same $folderTemplate = explode('/', $Part['Template']); $oPluginRegistry =& PMPluginRegistry::getSingleton(); if ($oPluginRegistry->isRegisteredFolder($folderTemplate[0])) { $template->templateFile = PATH_PLUGINS . $Part['Template'] . '.html'; } else { $template->templateFile = PATH_TPL . $Part['Template'] . '.html'; } // last change to load the template, maybe absolute path was given if (!is_file($template->templateFile)) { $template->templateFile = strpos($Part['Template'], '.html') !== false ? $Part['Template'] : $Part['Template'] . '.html'; } //assign the variables and use the template $template $template->assign($dataArray); print $template->fetch($template->templateFile); break; case 'template': //To do: Please check it 26/06/07 if (gettype($Part['Data']) == 'array') { G::LoadSystem('template'); //template phpBB $template = new Template(); $template->set_filenames(array('body' => $Part['Template'] . '.html')); $dataArray = $Part['Data']; if (is_array($dataArray)) { foreach ($dataArray as $key => $val) { if (is_array($val)) { foreach ($val as $key_val => $val_array) { $template->assign_block_vars($key, $val_array); } } else { $template->assign_vars(array($key => $val)); } } } $template->pparse('body'); } if (gettype($Part['Data']) == 'object' && strtolower(get_class($Part['Data'])) == 'templatepower') { $Part['Data']->printToScreen(); } return; break; case 'view': case 'content': //check if G_PLUGIN_CLASS is defined, because publisher can be called without an environment $aux = explode(PATH_SEP, $Part['Template']); if (count($aux) == 2 && defined('G_PLUGIN_CLASS')) { //if the template doesn't exists, then try it with the plugins folders, after the normal Template $userTemplate = G::ExpandPath('templates') . $Part['Template']; $globalTemplate = PATH_TEMPLATE . $Part['Template']; if (!is_file($userTemplate) && !is_file($globalTemplate)) { $oPluginRegistry =& PMPluginRegistry::getSingleton(); if ($oPluginRegistry->isRegisteredFolder($aux[0])) { $pluginTemplate = PATH_PLUGINS . $Part['Template'] . '.php'; include $pluginTemplate; } } } break; case 'graphLayout': //Added by JHL to render GraphLayout component $G_OBJGRAPH = $Part['Data']; $G_TMP_TARGET = $Part['Target']; $G_TMP_FILE = $Part['File']; break; } //krumo( $Part['Template'] ); //check if this LoadTemplate is used, byOnti 12th Aug 2008 G::LoadTemplate($Part['Template']); $G_TABLE = null; }
$aData = $_POST['form']; } else { $aData = $_POST; } //For Extjs (Since we are not using form in ExtJS) if (isset($aData['OUT_DOC_TITLE']) && $aData['OUT_DOC_TITLE'] != '') { $oForm = new Form('outputdocs/outputdocs_Properties', PATH_XMLFORM); $aData = $oForm->validatePost(); if (isset($aData['OUT_DOC_PDF_SECURITY_ENABLED']) && $aData['OUT_DOC_PDF_SECURITY_ENABLED'] == "0") { $aData['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] = ""; $aData['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'] = ""; $aData['OUT_DOC_PDF_SECURITY_PERMISSIONS'] = ""; } if (isset($aData['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD']) && $aData['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] != "") { $aData['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] = G::encrypt($aData['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'], $aData['OUT_DOC_UID']); $aData['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'] = G::encrypt($aData['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'], $aData['OUT_DOC_UID']); } } if ($aData['OUT_DOC_UID'] == '') { if (isset($aData['OUT_DOC_TYPE']) && $aData['OUT_DOC_TYPE'] == 'JRXML') { $dynaformUid = $aData['DYN_UID']; $outDocUid = $oOutputDocument->create($aData); G::LoadClass('javaBridgePM'); $jbpm = new JavaBridgePM(); print $jbpm->generateJrxmlFromDynaform($outDocUid, $dynaformUid, 'classic'); } else { $outDocUid = $oOutputDocument->create($aData); } } else { $oOutputDocument->update($aData); }
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * */ require_once 'classes/model/Configuration.php'; $oConfiguration = new Configuration(); $aFields['MESS_ENABLED'] = isset($_POST['form']['MESS_ENABLED']) ? $_POST['form']['MESS_ENABLED'] : ''; $aFields['MESS_ENGINE'] = isset($_POST['form']['MESS_ENABLED']) ? $_POST['form']['MESS_ENGINE'] : ''; $aFields['MESS_SERVER'] = isset($_POST['form']['MESS_ENABLED']) ? trim($_POST['form']['MESS_SERVER']) : ''; $aFields['MESS_RAUTH'] = isset($_POST['form']['MESS_ENABLED']) ? isset($_POST['form']['MESS_RAUTH']) ? $_POST['form']['MESS_RAUTH'] : '' : ''; $aFields['MESS_PORT'] = isset($_POST['form']['MESS_ENABLED']) ? $_POST['form']['MESS_PORT'] : ''; $aFields['MESS_ACCOUNT'] = isset($_POST['form']['MESS_ENABLED']) ? $_POST['form']['MESS_ACCOUNT'] : ''; $aFields['MESS_PASSWORD'] = isset($_POST['form']['MESS_ENABLED']) ? $_POST['form']['MESS_PASSWORD'] : ''; $aFields['MESS_PASSWORD_HIDDEN'] = isset($_POST['form']['MESS_ENABLED']) ? $_POST['form']['MESS_PASSWORD_HIDDEN'] : ''; if ($aFields['MESS_PASSWORD_HIDDEN'] != '') { $aFields['MESS_PASSWORD'] = $aFields['MESS_PASSWORD_HIDDEN']; } $aFields['MESS_PASSWORD_HIDDEN'] = ''; $aPasswd = G::decrypt($aFields['MESS_PASSWORD'], 'EMAILENCRYPT'); if (strpos($aPasswd, 'hash:') !== true && $aFields['MESS_PASSWORD'] != '') { // for plain text $aFields['MESS_PASSWORD'] = '******' . $aFields['MESS_PASSWORD']; $aFields['MESS_PASSWORD'] = G::encrypt($aFields['MESS_PASSWORD'], 'EMAILENCRYPT'); } $aFields['MESS_BACKGROUND'] = isset($_POST['form']['MESS_ENABLED']) ? isset($_POST['form']['MESS_BACKGROUND']) ? $_POST['form']['MESS_BACKGROUND'] : '' : ''; $aFields['MESS_EXECUTE_EVERY'] = isset($_POST['form']['MESS_ENABLED']) ? $_POST['form']['MESS_EXECUTE_EVERY'] : ''; $aFields['MESS_SEND_MAX'] = isset($_POST['form']['MESS_ENABLED']) ? $_POST['form']['MESS_SEND_MAX'] : ''; $aFields['SMTPSecure'] = isset($_POST['form']['MESS_ENABLED']) ? $_POST['form']['SMTPSecure'] : ''; $aFields['MESS_TRY_SEND_INMEDIATLY'] = isset($_POST['form']['MESS_ENABLED']) ? isset($_POST['form']['MESS_TRY_SEND_INMEDIATLY']) ? $_POST['form']['MESS_TRY_SEND_INMEDIATLY'] : '' : ''; $oConfiguration->update(array('CFG_UID' => 'Emails', 'OBJ_UID' => '', 'CFG_VALUE' => serialize($aFields), 'PRO_UID' => '', 'USR_UID' => '', 'APP_UID' => '')); G::SendTemporalMessage('ID_CHANGES_SAVED', 'TMP-INFO', 'label', 4, '100%'); G::header('location: emails');
?> " /> <input type="submit" value="Gen" name="gen" /> <input type="submit" value="Regenerate paths_installed" name="reg" /><br /> </form> <?php if (isset($_GET['gen'])) { $sh = md5(filemtime(PATH_GULLIVER . "/class.g.php")); $h = G::encrypt($_GET['srv'] . $sh . $_GET['usr'] . $sh . $_GET['pass'] . $sh . 1, $sh); echo "HASH_INSTALLATION<br/>"; echo "<textarea cols=120>{$h}</textarea><br/>"; echo "SYSTEM_HASH<br/>"; echo "<textarea cols=120>{$sh}</textarea>"; } elseif (isset($_GET['reg'])) { $sh = md5(filemtime(PATH_GULLIVER . "/class.g.php")); $h = G::encrypt($_GET['srv'] . $sh . $_GET['usr'] . $sh . $_GET['pass'] . $sh . 1, $sh); echo "HASH_INSTALLATION<br/>"; echo "<textarea cols=120>{$h}</textarea><br/>"; echo "SYSTEM_HASH<br/>"; echo "<textarea cols=120>{$sh}</textarea>"; $s = "<?php\n\ndefine( 'PATH_DATA', '/shared/workflow_data/' );\ndefine( 'PATH_C', PATH_DATA . 'compiled/' );\ndefine( 'HASH_INSTALLATION', '{$h}' );\ndefine( 'SYSTEM_HASH', '{$sh}' );"; echo '<br/>'; if (file_exists(FILE_PATHS_INSTALLED)) { if (@copy(FILE_PATHS_INSTALLED, FILE_PATHS_INSTALLED . '.backup')) { echo 'Backup file was created ' . FILE_PATHS_INSTALLED . '.backup<br>'; } @unlink(FILE_PATHS_INSTALLED); if (($size = file_put_contents(FILE_PATHS_INSTALLED, $s)) !== false) { echo 'The file ' . FILE_PATHS_INSTALLED . ' was regenerated<br>'; } else { echo 'An error was occured trying to regenerate the file !' . FILE_PATHS_INSTALLED;
/** * Save Data for PmTable * @var string $pmt_uid. Uid for PmTable * @var string $pmt_data. Data for rows of PmTable * * @author Brayan Pereyra (Cochalo) <*****@*****.**> * @copyright Colosa - Bolivia * * @return array */ public function saveTableData($pmt_uid, $pmt_data) { $pmt_uid = $this->validateTabUid($pmt_uid, false); $rows = $pmt_data; $additionalTables = new AdditionalTables(); $table = $additionalTables->load($pmt_uid, true); $primaryKeys = $additionalTables->getPrimaryKeys(); $className = $table['ADD_TAB_CLASS_NAME']; $classPeerName = $className . 'Peer'; $row = (array) $rows; $row = array_merge(array_change_key_case($row, CASE_LOWER), array_change_key_case($row, CASE_UPPER)); $toSave = false; if (!file_exists(PATH_WORKSPACE . 'classes/' . $className . '.php')) { throw new Exception('Create::' . G::loadTranslation('ID_PMTABLE_CLASS_DOESNT_EXIST', $className)); } require_once PATH_WORKSPACE . 'classes/' . $className . '.php'; eval('$obj = new ' . $className . '();'); eval('$con = Propel::getConnection(' . $classPeerName . '::DATABASE_NAME);'); $obj->fromArray($row, \BasePeer::TYPE_FIELDNAME); if ($obj->validate()) { $affectedRows = $obj->save(); if ($affectedRows == 0) { throw new \Exception("The value of key column is required"); } $toSave = true; $primaryKeysValues = array(); foreach ($primaryKeys as $primaryKey) { $method = 'get' . AdditionalTables::getPHPName($primaryKey['FLD_NAME']); $primaryKeysValues[] = $obj->{$method}(); } } else { $msg = ''; foreach ($obj->getValidationFailures() as $objValidationFailure) { $msg .= $objValidationFailure->getMessage() . "\n"; } throw new \Exception(G::LoadTranslation('ID_ERROR_TRYING_INSERT') . '"' . $table['ADD_TAB_NAME'] . "\"\n" . $msg); } $index = G::encrypt(implode(',', $primaryKeysValues), 'pmtable'); $rep = $this->getTableData($pmt_uid); return $rep; }
/** * Update Email Server * * @param string $emailServerUid Unique id of Group * @param array $arrayData Data * * return array Return data of the Email Server updated */ public function update($emailServerUid, $arrayData) { try { //Verify data $process = new \ProcessMaker\BusinessModel\Process(); $validator = new \ProcessMaker\BusinessModel\Validator(); $validator->throwExceptionIfDataIsNotArray($arrayData, "\$arrayData"); $validator->throwExceptionIfDataIsEmpty($arrayData, "\$arrayData"); //Set data $arrayData = array_change_key_case($arrayData, CASE_UPPER); //Verify data $this->throwExceptionIfNotExistsEmailServer($emailServerUid, $this->arrayFieldNameForException["emailServerUid"]); $this->throwExceptionIfDataIsInvalid($emailServerUid, $arrayData); //Update $cnn = \Propel::getConnection("workflow"); try { $emailServer = \EmailServerPeer::retrieveByPK($emailServerUid); $passwd = $arrayData["MESS_PASSWORD"]; $passwdDec = \G::decrypt($passwd, "EMAILENCRYPT"); $auxPass = explode("hash:", $passwdDec); if (count($auxPass) > 1) { if (count($auxPass) == 2) { $passwd = $auxPass[1]; } else { array_shift($auxPass); $passwd = implode("", $auxPass); } } $arrayData["MESS_PASSWORD"] = $passwd; if ($arrayData["MESS_PASSWORD"] != "") { $arrayData["MESS_PASSWORD"] = "******" . $arrayData["MESS_PASSWORD"]; $arrayData["MESS_PASSWORD"] = \G::encrypt($arrayData["MESS_PASSWORD"], "EMAILENCRYPT"); } $emailServer->fromArray($arrayData, \BasePeer::TYPE_FIELDNAME); if ($emailServer->validate()) { $cnn->begin(); $result = $emailServer->save(); $cnn->commit(); if (isset($arrayData["MESS_DEFAULT"]) && (int) $arrayData["MESS_DEFAULT"] == 1) { $this->setEmailServerDefaultByUid($emailServerUid); } //Return if (!$this->formatFieldNameInUppercase) { $arrayData = array_change_key_case($arrayData, CASE_LOWER); } return $arrayData; } else { $msg = ""; foreach ($emailServer->getValidationFailures() as $validationFailure) { $msg = $msg . ($msg != "" ? "\n" : "") . $validationFailure->getMessage(); } throw new \Exception(\G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . ($msg != "" ? "\n" . $msg : "")); } } catch (\Exception $e) { $cnn->rollback(); throw $e; } } catch (\Exception $e) { throw $e; } }
* This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. */ if (($RBAC_Response = $RBAC->userCanAccess("PM_FACTORY")) != 1) { return $RBAC_Response; } //G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = '******' ); G::LoadClass('dynaFormField'); $G_MAIN_MENU = 'processmaker'; $G_SUB_MENU = 'processes'; $G_ID_MENU_SELECTED = 'PROCESSES'; $G_ID_SUB_MENU_SELECTED = 'FIELDS'; $PRO_UID = '746B734DC23311'; $file = $PRO_UID . '/' . 'myInfo'; define('DB_XMLDB_HOST', PATH_DYNAFORM . $file . '.xml'); define('DB_XMLDB_USER', ''); define('DB_XMLDB_PASS', ''); define('DB_XMLDB_NAME', ''); define('DB_XMLDB_TYPE', 'myxml'); $G_PUBLISH = new Publisher(); $Parameters = array('SYS_LANG' => SYS_LANG, 'URL' => G::encrypt($file, URL_KEY)); $G_PUBLISH->AddContent('pagedtable', 'paged-table', 'dynaforms/fields_List', '', $Parameters, '', 'dynaforms_PagedTableAjax'); G::RenderPage("publish");
/* End Comment */ //Removes any other CURRENT_DYNAFORM that could be pending because of a page refresh or a failure unset($_SESSION['CURRENT_DYNAFORM']); define('DB_XMLDB_HOST', PATH_DYNAFORM . $file . '.xml'); define('DB_XMLDB_USER', ''); define('DB_XMLDB_PASS', ''); define('DB_XMLDB_NAME', ''); define('DB_XMLDB_TYPE', 'myxml'); $title = $process->Fields['PRO_TITLE'] . ' : ' . $dynaform->Fields['DYN_TITLE']; $Parameters = array('SYS_LANG' => SYS_LANG, 'URL' => G::encrypt($file, URL_KEY), 'DYN_UID' => $dynaform->Fields['DYN_UID'], 'DYNAFORM_NAME' => $title); $openDoc = new Xml_Document(); $openDoc->parseXmlFile(PATH_DYNAFORM . $file . '.xml'); $XmlEditor = array('URL' => G::encrypt($file, URL_KEY), 'XML' => $openDoc->getXml()); $form = new Form($file, PATH_DYNAFORM, SYS_LANG, true); $HtmlEditor = array('URL' => G::encrypt($file, URL_KEY), 'HTML' => $form->printTemplate($form->template, $script)); $JSEditor = array('URL' => G::encrypt($file, URL_KEY), 'HTML' => $form->printTemplate($form->template, $script)); /* Block : Loads the Editor configuration */ $defaultConfig = array('Editor' => array('left' => '0', 'top' => '0', 'width' => 'document.body.clientWidth-4', 'height' => 'document.body.clientHeight-2'), 'Toolbar' => array('left' => 'document.body.clientWidth-2-toolbar.clientWidth-24-3+7', 'top' => '52'), 'FieldsList' => array('left' => '4+toolbar.clientWidth+24', 'top' => 'getAbsoluteTop(document.getElementById("dynaformEditor[0]"))', 'width' => 268 - 24, 'height' => 400)); /*$configuration = new Configuration($dbc); $configuration->load( array('CFG_UID'=>'DynaformEditor') ); if ($configuration->is_new) { $config = $defaultConfig; $configuration->Fields['CFG_UID']='DynaformEditor'; $configuration->Fields['CFG_VALUE']=serialize( $config ); //$configuration->Save(); } else { $config = unserialize( $configuration->Fields['CFG_VALUE'] ); $config = G::array_merges( $defaultConfig , $config ); }*/ $config = $defaultConfig; /* End Block */
$t->is($obj->fatalErrorHandler('Fatal error'), 'Fatal error', 'fatalErrorHandler()'); $like = '<table cellpadding=1 cellspacing=0 border=0 bgcolor=#808080 width=250><tr><td ><table cellpadding=2 cellspacing=0 border=0 bgcolor=white width=100%><tr bgcolor=#d04040><td colspan=2 nowrap><font color=#ffffaa><code> ERROR CAUGHT check log file</code></font></td></tr><tr ><td colspan=2 nowrap><font color=black><code>IP address: </code></font></td></tr> </table></td></tr></table>'; $t->is($obj->fatalErrorHandler('error</b>:abc<br>'), $like, 'fatalErrorHandler()'); $t->can_ok($obj, 'customErrorHandler', 'customErrorHandler()'); G::customErrorHandler(G_DB_ERROR, "message error", "filename", 10, "context"); $t->can_ok($obj, 'showErrorSource', 'showErrorSource()'); $t->can_ok($obj, 'customErrorLog', 'customErrorLog()'); $t->can_ok($obj, 'verboseError', 'verboseError()'); $t->can_ok($obj, 'encrypt', 'encrypt()'); $k = URL_KEY; $t->is(G::encrypt("/sysOpenSource", $k), 'Ytap33°jmZ7D46bf2Jo', 'encrypt only workspace'); $t->is(G::encrypt("/sysOpenSource/", $k), 'Ytap33°jmZ7D46bf2Jpo', 'encrypt terminal slash'); $t->is(G::encrypt("/sysOpenSource/en", $k), 'Ytap33°jmZ7D46bf2Jpo158', 'encrypt two levels'); $t->is(G::encrypt("/sysOpenSource/en/test/login/login", $k), 'Ytap33°jmZ7D46bf2Jpo15+cp8ij4F°fo5fZ4mDZ5Jyi4A', 'encrypt normal page'); $t->is(G::encrypt("/sysOpenSource/en/test/login/login/demo", $k), 'Ytap33°jmZ7D46bf2Jpo15+cp8ij4F°fo5fZ4mDZ5Jyi4GDRmNCf', 'encrypt additional level'); $t->is(G::encrypt("/sysOpenSource/en/test/login/login?a=1&b=2", $k), 'Ytap33°jmZ7D46bf2Jpo15+cp8ij4F°fo5fZ4mDZ5Jyi4HDOcJRWzm2l', 'encrypt normal query string'); $t->todo('encrypt query string plus pipe'); $t->todo("encrypt query string plus pipe"); $t->can_ok($obj, 'decrypt', 'decrypt()'); $t->is(G::decrypt('Ytap33°jmZ7D46bf2Jo', $k), "/sysOpenSource", 'decrypt only workspace'); $t->is(G::decrypt('Ytap33°jmZ7D46bf2Jpo', $k), "/sysOpenSource/", 'decrypt terminal slash'); $t->is(G::decrypt('Ytap33°jmZ7D46bf2Jpo158', $k), "/sysOpenSource/en", 'decrypt two levels'); $t->is(G::decrypt('Ytap33°jmZ7D46bf2Jpo15+cp8ij4F°fo5fZ4mDZ5Jyi4A', $k), "/sysOpenSource/en/test/login/login", 'decrypt normal page'); $t->is(G::decrypt('Ytap33°jmZ7D46bf2Jpo15+cp8ij4F°fo5fZ4mDZ5Jyi4GDRmNCf', $k), "/sysOpenSource/en/test/login/login/demo", 'decrypt additional level'); $t->is(G::decrypt('Ytap33°jmZ7D46bf2Jpo15+cp8ij4F°fo5fZ4mDZ5Jyi4HDOcJRWzm2l', $k), "/sysOpenSource/en/test/login/login?a=1&b=2", 'decrypt normal query string'); $t->todo('decrypt query string plus pipe'); $t->can_ok($obj, 'lookup', 'lookup()'); $t->is(G::lookup('optimusprime.colosa.net'), "192.168.1.22", 'lookup any address'); $t->can_ok($obj, 'mk_dir', 'mk_dir()'); $newDir = '/tmp/test/directory'; $r = G::verifyPath($newDir);
/** * Function encryptThepassw * @author krlos Pacha C. <*****@*****.**> * @access public * @param string proUid * @return void */ public function encryptThepassw($proUid) { $oDBSource = new DbSource(); $c = new Criteria(); $c->clearSelectColumns(); $c->addSelectColumn(DbSourcePeer::DBS_UID); $c->addSelectColumn(DbSourcePeer::DBS_DATABASE_NAME); $c->addSelectColumn(DbSourcePeer::DBS_PASSWORD); $c->add(DbSourcePeer::PRO_UID, $proUid); $result = DbSourcePeer::doSelectRS($c); $result->next(); $row = $result->getRow(); while ($row = $result->getRow()) { if ($row[2] != '') { $aPass = explode('_', $row[2]); if (count($aPass) == 1) { $passEncrypt = G::encrypt($row[2], $row[1]); $passEncrypt .= "_2NnV3ujj3w"; $c2 = new Criteria('workflow'); $c2->add(DbSourcePeer::DBS_PASSWORD, $passEncrypt); $c3 = new Criteria('workflow'); $c3->add(DbSourcePeer::DBS_UID, $row[0]); BasePeer::doUpdate($c3, $c2, Propel::getConnection('workflow')); } } $result->next(); } return 1; }
<?php /** * evaluates the dynaform type and other parameters in order to * render the correct toolbar in each case * * @author gustavo cruz gustavo-at-colosa.com * @param POST */ G::LoadClass('toolBar'); global $G_PUBLISH; $script = ''; $G_PUBLISH = new Publisher(); $Parameters = array('SYS_LANG' => SYS_LANG, 'URL' => G::encrypt($_POST['FILE'], URL_KEY), 'DYN_UID' => $_POST['DYN_UID'], 'PRO_UID' => $_POST['PRO_UID'], 'DYNAFORM_NAME' => $_POST['DYN_TITLE'], 'FILE' => $_POST['FILE']); //$Parameters = ""; if ($_POST['TOOLBAR'] == "grid") { $G_PUBLISH->AddContent('xmlform', 'toolbar', 'dynaforms/fields_ToolbarGrid', 'display:none', $Parameters, '', ''); } else { $G_PUBLISH->AddContent('xmlform', 'toolbar', 'dynaforms/fields_Toolbar', 'display:none', $Parameters, '', ''); } G::RenderPage('publish', 'raw');
/** * @covers G::encrypt * @todo Implement testEncrypt(). */ public function testEncrypt() { $encryptPassword = '******'; $encryptResponse = G::encrypt('password', 'key'); $this->assertEquals($encryptResponse, $encryptPassword); }
$col = $G_TABLE->Columns[$intPos]; $order = !($col["Type"] == "image" || $col["Type"] == "jsimglink"); $tpl->newBlock("headers"); $tpl->assign("width", $col["Width"] > 0 ? " style=\"width:" . $col["Width"] . ";\"" : ''); $tpl->assign("header", $G_TABLE->Labels[$intPos]); if ($G_TABLE->_ordered == true && $order) { $res = "<th "; if ($col["Width"] > 0) { $res .= " style=\"width:" . $col["Width"] . ";\""; } $res .= ">"; $res .= "<a href=\""; $res .= (ENABLE_ENCRYPT == 'yes' ? str_replace(G::encrypt('sys' . SYS_SYS, URL_KEY), SYS_SYS, G::encryptUrl(urldecode(SYS_CURRENT_URI), URL_KEY)) : SYS_CURRENT_URI) . "?order=" . $G_TABLE->Columns[$intPos]['Name'] . "&page=" . $pa . "&label=true"; $res .= "\">" . $G_TABLE->Labels[$intPos] . "</a>"; $res .= "</th>\n"; $tpl->assign("href", (ENABLE_ENCRYPT == 'yes' ? str_replace(G::encrypt('sys' . SYS_SYS, URL_KEY), SYS_SYS, G::encryptUrl(urldecode(SYS_CURRENT_URI), URL_KEY)) : SYS_CURRENT_URI) . "?order=" . $G_TABLE->Columns[$intPos]['Name'] . "&page=" . $pa . "&label=true"); $Fields['headers'][] = $header; } else { $tpl->assign("href", ''); $res = "<th "; if ($col["Width"] > 0) { $res .= " style=\"width:" . $col["Width"] . ";\""; } $res .= ">"; $res .= $G_TABLE->Labels[$intPos] . "</th>\n"; } } //end grid titles if ($G_TABLE->rows_per_page == '') { $G_TABLE->rows_per_page = 25; }
} $oDBSource->update($aData); $oContent->addContent('DBS_DESCRIPTION', '', $_POST['dbs_uid'], SYS_LANG, $_POST['desc']); break; case 'saveConnection': $oDBSource = new DbSource(); $oContent = new Content(); if (strpos($_POST['server'], "\\")) { $_POST['port'] = 'none'; } $flagTns = $_POST["type"] == "oracle" && $_POST["connectionType"] == "TNS" ? 1 : 0; if ($flagTns == 0) { $_POST["connectionType"] = "NORMAL"; $aData = array("PRO_UID" => $_SESSION["PROCESS"], "DBS_TYPE" => $_POST["type"], "DBS_SERVER" => $_POST["server"], "DBS_DATABASE_NAME" => $_POST["db_name"], "DBS_USERNAME" => $_POST["user"], "DBS_PASSWORD" => ($_POST["passwd"] == "none" ? "" : G::encrypt($_POST["passwd"], $_POST["db_name"])) . "_2NnV3ujj3w", "DBS_PORT" => $_POST["port"] == "none" ? "" : $_POST["port"], "DBS_ENCODE" => $_POST["enc"], "DBS_CONNECTION_TYPE" => $_POST["connectionType"], "DBS_TNS" => ""); } else { $aData = array("PRO_UID" => $_SESSION["PROCESS"], "DBS_TYPE" => $_POST["type"], "DBS_SERVER" => "", "DBS_DATABASE_NAME" => "", "DBS_USERNAME" => $_POST["user"], "DBS_PASSWORD" => ($_POST["passwd"] == "none" ? "" : G::encrypt($_POST["passwd"], $_POST["tns"])) . "_2NnV3ujj3w", "DBS_PORT" => "", "DBS_ENCODE" => "", "DBS_CONNECTION_TYPE" => $_POST["connectionType"], "DBS_TNS" => $_POST["tns"]); } $newid = $oDBSource->create($aData); $sDelimiter = DBAdapter::getStringDelimiter(); $oContent->addContent('DBS_DESCRIPTION', '', $newid, SYS_LANG, $_POST['desc']); break; case 'deleteDbConnection': try { $oDBSource = new DbSource(); $oContent = new Content(); $DBS_UID = $_POST['dbs_uid']; $PRO_UID = $_SESSION['PROCESS']; $oDBSource->remove($DBS_UID, $PRO_UID); $oContent->removeContent('DBS_DESCRIPTION', "", $DBS_UID); $result->success = true; $result->msg = G::LoadTranslation('ID_DBCONNECTION_REMOVED');
} $logger->log("Installation arguments\n" . neat_r(array($installArgs))); if (isset($report)) { $logger->log("Installation report\n" . neat_r(array($report))); } else { $logger->log("** Installation crashed **"); } if (is_string($installError)) { $logger->log("Error message: {$installError}"); } if ($installError) { $logger->log("Installation ending with errors"); die; } $sh = md5(filemtime(PATH_GULLIVER . "/class.g.php")); $h = G::encrypt($dataClient->mysqlH . $sh . $dataClient->mysqlU . $sh . $dataClient->mysqlP . $sh . $inst->cc_status, $sh); $db_text = "<?php\n" . "define( 'PATH_DATA', '" . $dir_data . "' );\n" . "define( 'PATH_C', '" . $dir_compiled . "' );\n" . "define( 'HASH_INSTALLATION','" . $h . "' );\n" . "define( 'SYSTEM_HASH','" . $sh . "' );\n" . "?>"; $fp = fopen(FILE_PATHS_INSTALLED, "w"); fputs($fp, $db_text, strlen($db_text)); fclose($fp); /* Update languages */ $update = file_get_contents("http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . "/sysworkflow/en/classic/tools/updateTranslation"); $logger->log("Update language => " . (!$update ? $update : "OK")); /* Heartbeat Enable/Disable */ if (!isset($dataClient->heartbeatEnabled)) { $dataClient->heartbeatEnabled = true; } $update = file_get_contents("http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . "/sysworkflow/en/classic/install/heartbeatStatus?status=" . $dataClient->heartbeatEnabled); $logger->log("Heartbeat Status => " . str_replace("<br>", "\n", $update)); /* Autoinstall Process */ $update = file_get_contents("http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . "/sysworkflow/en/classic/install/autoinstallProcesses");
$hidden_items_tmp = $hidden_items; $hidden_items = array(); foreach ($hidden_items_tmp as $hItem) { $tmp = explode("@", $hItem); $hidden_items[] = $tmp[1]; } $hidden_items_tmp = implode(',', $hidden_items); } } if ($has_hidden_items) { $hStr = ''; foreach ($hidden_items as $hItem) { $hStr .= "hideRowById('{$hItem}'); "; } //echo 'something todo'; //print_r($hidden_items); $msg = " @! Autogenerated by Processmaker weboot; Do not modify this content, this is autogenerated alway when dynaform is updated "; if ($o->nodeExists('___pm_boot_strap___')) { $o->remove('___pm_boot_strap___'); } $metaEncrypt = G::encrypt($hidden_items_tmp, 'dynafieldsHandler'); $o->add('___pm_boot_strap___', array('type' => 'javascript', "meta" => $metaEncrypt), "/*{$msg}*/ {$hStr}"); echo $metaEncrypt; } else { //we must to remove the boot strap node; $o->remove('___pm_boot_strap___'); } break; default: echo 'no request param.'; }
/** * Save Data for DataBaseConnection * @var string $pro_uid. Uid for Process * @var string $dataDataBaseConnection. Data for DataBaseConnection * @var string $create. Create o Update DataBaseConnection * @var string $sDataBaseConnectionUid. Uid for DataBaseConnection * * @author Brayan Pereyra (Cochalo) <*****@*****.**> * @copyright Colosa - Bolivia * * @return array */ public function saveDataBaseConnection($pro_uid = '', $dataDBConnection = array(), $create = false) { $pro_uid = $this->validateProUid($pro_uid); if (!$create) { $dbs_uid = $dataDBConnection['dbs_uid']; $dbs_uid = $this->validateDbsUid($dbs_uid, $pro_uid); } G::LoadClass('dbConnections'); $oDBSource = new DbSource(); $oContent = new \Content(); $dataDBConnection = array_change_key_case($dataDBConnection, CASE_UPPER); $flagTns = $dataDBConnection["DBS_TYPE"] == "oracle" && $dataDBConnection["DBS_CONNECTION_TYPE"] == "TNS" ? 1 : 0; $dataDBConnection['PRO_UID'] = $pro_uid; if (isset($dataDBConnection['DBS_TYPE'])) { $typesExists = array(); $dbServices = $this->getDbEngines(); foreach ($dbServices as $value) { $typesExists[] = $value['id']; } if (!in_array($dataDBConnection['DBS_TYPE'], $typesExists)) { throw new \Exception(\G::LoadTranslation("ID_DBC_TYPE_INVALID", array($dataDBConnection['DBS_TYPE']))); } } if (isset($dataDBConnection["DBS_SERVER"]) && $dataDBConnection["DBS_SERVER"] == "" && $flagTns == 0) { throw new \Exception(\G::LoadTranslation("ID_DBC_SERVER_INVALID", array($dataDBConnection['DBS_SERVER']))); } if (isset($dataDBConnection["DBS_DATABASE_NAME"]) && $dataDBConnection["DBS_DATABASE_NAME"] == "" && $flagTns == 0) { throw new \Exception(\G::LoadTranslation("ID_DBC_DBNAME_INVALID", array($dataDBConnection['DBS_DATABASE_NAME']))); } if (isset($dataDBConnection['DBS_PORT']) && ($dataDBConnection['DBS_PORT'] == '' || $dataDBConnection['DBS_PORT'] == 0)) { if ($flagTns == 0) { throw new \Exception(\G::LoadTranslation("ID_DBC_PORT_INVALID", array($dataDBConnection["DBS_PORT"]))); } } if (isset($dataDBConnection["DBS_TNS"]) && $dataDBConnection["DBS_TNS"] == "" && $flagTns == 1) { throw new \Exception(\G::LoadTranslation("ID_DBC_TNS_NOT_EXIST", array($dataDBConnection["DBS_TNS"]))); } if (isset($dataDBConnection['DBS_ENCODE'])) { $encodesExists = array(); $dbs = new dbConnections(); $dbEncodes = $dbs->getEncondeList($dataDBConnection['DBS_TYPE']); foreach ($dbEncodes as $value) { $encodesExists[] = $value['0']; } if (!in_array($dataDBConnection['DBS_ENCODE'], $encodesExists)) { throw new \Exception(\G::LoadTranslation("ID_DBC_ENCODE_INVALID", array($dataDBConnection['DBS_ENCODE']))); } } $passOrigin = ''; if (isset($dataDBConnection['DBS_PASSWORD'])) { $passOrigin = $dataDBConnection['DBS_PASSWORD']; if ($dataDBConnection['DBS_PASSWORD'] == 'none') { $dataDBConnection['DBS_PASSWORD'] = ''; } else { if ($flagTns == 0) { $pass = \G::encrypt($dataDBConnection["DBS_PASSWORD"], $dataDBConnection["DBS_DATABASE_NAME"]) . "_2NnV3ujj3w"; } else { $pass = \G::encrypt($dataDBConnection["DBS_PASSWORD"], $dataDBConnection["DBS_TNS"]) . "_2NnV3ujj3w"; } $dataDBConnection['DBS_PASSWORD'] = $pass; } } if ($flagTns == 0) { $dataDBConnection["DBS_CONNECTION_TYPE"] = "NORMAL"; $dataDBConnection["DBS_TNS"] = ""; } else { $dataDBConnection["DBS_SERVER"] = ""; $dataDBConnection["DBS_DATABASE_NAME"] = ""; $dataDBConnection["DBS_PORT"] = 0; } if ($create) { unset($dataDBConnection['DBS_UID']); // TEST CONNECTION $dataTest = array_merge($dataDBConnection, array('DBS_PASSWORD' => $passOrigin)); $resTest = $this->testConnection($dataTest); if (!$resTest['resp']) { throw new \Exception($resTest['message']); } $newDBConnectionUid = $oDBSource->create($dataDBConnection); $oContent->addContent('DBS_DESCRIPTION', '', $newDBConnectionUid, SYS_LANG, $dataDBConnection['DBS_DESCRIPTION']); $newDataDBConnection = $this->getDataBaseConnection($pro_uid, $newDBConnectionUid); $newDataDBConnection = array_change_key_case($newDataDBConnection, CASE_LOWER); return $newDataDBConnection; } else { // TEST CONNECTION $allData = $this->getDataBaseConnection($pro_uid, $dataDBConnection['DBS_UID']); $dataTest = array_merge($allData, $dataDBConnection, array('DBS_PASSWORD' => $passOrigin)); $resTest = $this->testConnection($dataTest); if (!$resTest['resp']) { throw new \Exception($resTest['message']); } $oDBSource->update($dataDBConnection); if (isset($dataDBConnection['DBS_DESCRIPTION'])) { $oContent->addContent('DBS_DESCRIPTION', '', $dataDBConnection['DBS_UID'], SYS_LANG, $dataDBConnection['DBS_DESCRIPTION']); } } return array(); }
$confParams = array('LANG' => $lang, 'STATUS' => 'active'); $conf->aConfig = $confParams; $conf->saveConfig('APP_CACHE_VIEW_ENGINE', '', '', ''); $response = new StdClass(); $result->success = true; $result->msg = "Completed successfully"; echo G::json_encode($result); } catch (Exception $e) { $confParams = array('lang' => $lang, 'status' => 'failed'); $appCacheViewEngine = $oServerConf->setProperty('APP_CACHE_VIEW_ENGINE', $confParams); echo '{success: false, msg:"' . $e->getMessage() . '"}'; } break; case 'recreate-root': $sh = md5(filemtime(PATH_GULLIVER . "/class.g.php")); $h = G::encrypt($_POST['host'] . $sh . $_POST['user'] . $sh . $_POST['password'] . $sh . 1, $sh); $insertStatements = "define ( 'HASH_INSTALLATION','{$h}' ); \ndefine ( 'SYSTEM_HASH', '{$sh}' ); \n"; $lines = array(); $content = ''; $filename = PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths_installed.php'; $lines = file($filename); $count = 1; foreach ($lines as $line_num => $line) { $pos = strpos($line, "define"); if ($pos !== false && $count < 3) { $content = $content . $line; $count++; } } $content = "<?php \n" . $content . "\n" . $insertStatements . "\n"; if (file_put_contents($filename, $content) != false) {
/** * getting Save email configuration * @autor Alvaro <*****@*****.**> */ public function saveConfiguration() { require_once 'classes/model/Configuration.php'; try { $oConfiguration = new Configuration(); $aFields['MESS_PASSWORD'] = $_POST['passwd']; if ($_POST['passwdHide'] != '') { $aFields['MESS_PASSWORD'] = $_POST['passwdHide']; } $aFields['MESS_PASSWORD_HIDDEN'] = ''; $passwd = $aFields['MESS_PASSWORD']; $passwdDec = G::decrypt($passwd, 'EMAILENCRYPT'); $auxPass = explode('hash:', $passwdDec); if (count($auxPass) > 1) { if (count($auxPass) == 2) { $passwd = $auxPass[1]; } else { array_shift($auxPass); $passwd = implode('', $auxPass); } } $aFields['MESS_PASSWORD'] = $passwd; if ($aFields['MESS_PASSWORD'] != '') { $aFields['MESS_PASSWORD'] = '******' . $aFields['MESS_PASSWORD']; $aFields['MESS_PASSWORD'] = G::encrypt($aFields['MESS_PASSWORD'], 'EMAILENCRYPT'); } $aFields['MESS_ENABLED'] = isset($_POST['EnableEmailNotifications']) ? $_POST['EnableEmailNotifications'] : ''; $aFields['MESS_ENABLED'] = $aFields['MESS_ENABLED'] == 'true' ? '1' : $aFields['MESS_ENABLED']; $aFields['MESS_ENGINE'] = $_POST['EmailEngine']; $aFields['MESS_SERVER'] = trim($_POST['server']); $aFields['MESS_RAUTH'] = isset($_POST['req_auth']) ? $_POST['req_auth'] : ''; $aFields['MESS_RAUTH'] = $aFields['MESS_RAUTH'] == 'true' ? '1' : $aFields['MESS_RAUTH']; $aFields['MESS_PORT'] = $_POST['port']; $aFields['MESS_ACCOUNT'] = $_POST['from']; $aFields['MESS_BACKGROUND'] = ''; //isset($_POST['background']) ? $_POST['background'] : ''; $aFields['MESS_EXECUTE_EVERY'] = ''; //$_POST['form']['MESS_EXECUTE_EVERY']; $aFields['MESS_SEND_MAX'] = ''; //$_POST['form']['MESS_SEND_MAX']; $aFields['SMTPSecure'] = $_POST['UseSecureCon']; $aFields['SMTPSecure'] = $aFields['SMTPSecure'] == 'No' ? 'none' : $aFields['SMTPSecure']; $aFields['MAIL_TO'] = $_POST['eMailto']; $aFields['MESS_TRY_SEND_INMEDIATLY'] = $_POST['SendaTestMail']; //isset($_POST['form']['MESS_TRY_SEND_INMEDIATLY']) ? $_POST['form']['MESS_TRY_SEND_INMEDIATLY'] : ''; $aFields['MESS_TRY_SEND_INMEDIATLY'] = $aFields['MESS_TRY_SEND_INMEDIATLY'] == 'true' ? '1' : $aFields['MESS_TRY_SEND_INMEDIATLY']; $CfgUid = 'Emails'; $ObjUid = ''; $ProUid = ''; $UsrUid = ''; $AppUid = ''; if ($oConfiguration->exists($CfgUid, $ObjUid, $ProUid, $UsrUid, $AppUid)) { $oConfiguration->update(array('CFG_UID' => 'Emails', 'OBJ_UID' => '', 'CFG_VALUE' => serialize($aFields), 'PRO_UID' => '', 'USR_UID' => '', 'APP_UID' => '')); $this->success = 'true'; $this->msg = 'Saved'; } else { $oConfiguration->create(array('CFG_UID' => 'Emails', 'OBJ_UID' => '', 'CFG_VALUE' => serialize($aFields), 'PRO_UID' => '', 'USR_UID' => '', 'APP_UID' => '')); $this->success = 'true'; $this->msg = 'Saved'; } } catch (Exception $e) { $this->success = false; $this->msg = $e->getMessage(); } }
/** * Prints the DynaformEditor * * @return void */ public function _render() { global $G_PUBLISH; $script = ''; /* Start Block: Load (Create if doesn't exist) the xmlform */ $Parameters = array('SYS_LANG' => SYS_LANG, 'URL' => G::encrypt($this->file, URL_KEY), 'DYN_UID' => $this->dyn_uid, 'PRO_UID' => $this->pro_uid, 'DYNAFORM_NAME' => $this->dyn_title, 'FILE' => $this->file, 'DYN_EDITOR' => $this->dyn_editor); $_SESSION['Current_Dynafom']['Parameters'] = $Parameters; $XmlEditor = array('URL' => G::encrypt($this->file, URL_KEY), 'XML' => ''); $JSEditor = array('URL' => G::encrypt($this->file, URL_KEY)); $A = G::encrypt($this->file, URL_KEY); try { $openDoc = new Xml_Document(); $fileName = $this->home . $this->file . '.xml'; if (file_exists($fileName)) { $openDoc->parseXmlFile($fileName); } else { $this->_createDefaultXmlForm($fileName); $openDoc->parseXmlFile($fileName); } //$form = new Form( $this->file , $this->home, SYS_LANG, true ); $Properties = dynaformEditorAjax::get_properties($A, $this->dyn_uid); /* Start Block: Prepare the XMLDB connection */ define('DB_XMLDB_HOST', PATH_DYNAFORM . $this->file . '.xml'); define('DB_XMLDB_USER', ''); define('DB_XMLDB_PASS', ''); define('DB_XMLDB_NAME', ''); define('DB_XMLDB_TYPE', 'myxml'); /* Start Block: Prepare the dynaformEditor */ $G_PUBLISH = new Publisher(); $sName = 'dynaformEditor'; $G_PUBLISH->publisherId = $sName; $oHeadPublisher =& headPublisher::getSingleton(); $oHeadPublisher->setTitle(G::LoadTranslation('ID_DYNAFORM_EDITOR') . ' - ' . $Properties['DYN_TITLE']); $G_PUBLISH->AddContent('blank'); $this->panelConf['title'] = ''; $G_PUBLISH->AddContent('panel-init', 'mainPanel', $this->panelConf); if ($Properties['DYN_TYPE'] == 'xmlform') { $G_PUBLISH->AddContent('xmlform', 'toolbar', 'dynaforms/fields_Toolbar', 'display:none', $Parameters, '', ''); } else { $G_PUBLISH->AddContent('xmlform', 'toolbar', 'dynaforms/fields_ToolbarGrid', 'display:none', $Parameters, '', ''); } $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_Editor', 'display:none', $Parameters, '', ''); $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_XmlEditor', 'display:none', $XmlEditor, '', ''); $G_PUBLISH->AddContent('blank'); $i = 0; $aFields = array(); $aFields[] = array('XMLNODE_NAME' => 'char', 'TYPE' => 'char', 'UP' => 'char', 'DOWN' => 'char'); $oSession = new DBSession(new DBConnection(PATH_DYNAFORM . $this->file . '.xml', '', '', '', 'myxml')); $oDataset = $oSession->Execute('SELECT * FROM dynaForm WHERE NOT( XMLNODE_NAME = "" ) AND TYPE <> "pmconnection"'); $iMaximun = $oDataset->count(); while ($aRow = $oDataset->Read()) { $aFields[] = array('XMLNODE_NAME' => $aRow['XMLNODE_NAME'], 'TYPE' => $aRow['TYPE'], 'UP' => $i > 0 ? G::LoadTranslation('ID_UP') : '', 'DOWN' => $i < $iMaximun - 1 ? G::LoadTranslation('ID_DOWN') : '', 'row__' => $i + 1); $i++; break; } global $_DBArray; $_DBArray['fields'] = $aFields; $_SESSION['_DBArray'] = $_DBArray; G::LoadClass('ArrayPeer'); $oCriteria = new Criteria('dbarray'); $oCriteria->setDBArrayTable('fields'); /** * *@Erik-> this is deprecated,. * (unuseful) $G_PUBLISH->AddContent('propeltable', 'paged-table', 'dynaforms/fields_List', $oCriteria, $Parameters, '', SYS_URI.'dynaforms/dynaforms_PagedTableAjax');** */ $G_PUBLISH->AddContent('blank'); $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_JSEditor', 'display:none', $JSEditor, '', ''); } catch (Exception $e) { } $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_Properties', 'display:none', $Properties, '', ''); //for showHide tab option @Neyek $G_PUBLISH->AddContent('blank'); $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_PREVIEW"), $sName . '[3]', 'dynaformEditor.changeToPreview', 'dynaformEditor.saveCurrentView'); $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_XML"), $sName . '[4]', 'dynaformEditor.changeToXmlCode', 'dynaformEditor.saveCurrentView'); if ($Properties['DYN_TYPE'] != 'grid') { $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_HTML"), $sName . '[5]', 'dynaformEditor.changeToHtmlCode', 'dynaformEditor.saveCurrentView'); } $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_FIELDS_LIST"), $sName . '[6]', 'dynaformEditor.changeToFieldsList', 'dynaformEditor.saveCurrentView'); if ($Properties["DYN_TYPE"] != "grid") { $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_JAVASCRIPTS"), $sName . '[7]', 'dynaformEditor.changeToJavascripts', 'dynaformEditor.saveCurrentView'); } $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_PROPERTIES"), $sName . '[8]', 'dynaformEditor.changeToProperties', 'dynaformEditor.saveCurrentView'); //for showHide tab option @Neyek if ($Properties["DYN_TYPE"] != "grid") { $G_PUBLISH->AddContent("panel-tab", G::LoadTranslation("ID_CONDITIONS_EDITOR"), $sName . "[9]", "dynaformEditor.changeToShowHide", "dynaformEditor.saveShowHide"); } $G_PUBLISH->AddContent('panel-close'); $oHeadPublisher->addScriptFile("/js/maborak/core/maborak.loader.js", 2); $oHeadPublisher->addScriptFile('/jscore/dynaformEditor/core/dynaformEditor.js'); //$oHeadPublisher->addScriptFile('/js/dveditor/core/dveditor.js'); //$oHeadPublisher->addScriptFile('/codepress/codepress.js',1); $oHeadPublisher->addScriptFile('/js/codemirrorOld/js/codemirror.js', 1); $oHeadPublisher->addScriptFile('/js/grid/core/grid.js'); $oHeadPublisher->addScriptCode(' var DYNAFORM_URL="' . $Parameters['URL'] . '"; leimnud.event.add(window,"load",function(){ loadEditor(); }); '); $oHeadPublisher->addScriptCode(' var jsMeta;var __usernameLogged__ = "' . (isset($_SESSION['USR_USERNAME']) ? $_SESSION['USR_USERNAME'] : '') . '";var SYS_LANG = "' . SYS_LANG . '";var __DYN_UID__ = "' . $this->dyn_uid . '";'); $oHeadPublisher->addScriptCode('var dynaformEditorParams = \'' . serialize($Parameters) . '\';'); G::RenderPage("publish", 'blank'); }
/** * Show dynaform's title * * @author Fernando Ontiveros Lira <*****@*****.**> * @access public * @param $pa * @param $intPos * @param $strClass * @return void */ function RenderTitle($pa, $intPos = 1, $strClass = "tblHeader") { if (!defined('ENABLE_ENCRYPT')) { define('ENABLE_ENCRYPT', 'no'); } global $HTTP_SESSION_VARS; $col = $this->Columns[$intPos]; $order = !($col["Type"] == "image"); if ($this->_ordered == true && $order) { $res = "<th class=\"{$strClass}\" align=\"left\" height=\"25\""; if ($col["Width"] > 0) { $res .= " width=\"" . $col["Width"] . "\""; } $res .= ">"; //$res .= "<a class=\"" . $strClass . "Link\" href=\""; $res .= "<a class=\"" . $strClass . "\" href=\""; $res .= (ENABLE_ENCRYPT == 'yes' ? str_replace(G::encrypt('sys' . SYS_SYS, URL_KEY), SYS_SYS, G::encryptUrl(urldecode(SYS_CURRENT_URI), URL_KEY)) : SYS_CURRENT_URI) . "?order=" . $this->Columns[$intPos]['Name'] . "&page=" . $pa . "&label=true"; //$res .= $_SERVER['REDIRECT_URL'] . "?order=" . $this->Columns[$intPos]['Name']."&page=".$pa."&label=true"; $res .= "\">" . $this->Labels[$intPos] . "</a>"; $res .= "</th>\n"; //echo $res;die; } else { $res = "<th class=\"{$strClass}\" align=\"left\" height=\"25\""; if ($col["Width"] > 0) { $res .= " width=\"" . $col["Width"] . "\""; } $res .= ">"; $res .= $this->Labels[$intPos] . "</th>\n"; } return $res; }
/** * create pm tables record * * @param string $httpData->rows */ public function dataCreate($httpData, $codification = 'json') { if ($codification == 'base64') { $rows = unserialize(base64_decode($httpData->rows)); } else { $rows = G::json_decode($httpData->rows); } try { require_once 'classes/model/AdditionalTables.php'; $additionalTables = new AdditionalTables(); $table = $additionalTables->load($httpData->id, true); $primaryKeys = $additionalTables->getPrimaryKeys(); $this->className = $table['ADD_TAB_CLASS_NAME']; $this->classPeerName = $this->className . 'Peer'; $row = (array) $rows; $row = array_merge(array_change_key_case($row, CASE_LOWER), array_change_key_case($row, CASE_UPPER)); $toSave = false; if (!file_exists(PATH_WORKSPACE . 'classes/' . $this->className . '.php')) { throw new Exception('Create::' . G::loadTranslation('ID_PMTABLE_CLASS_DOESNT_EXIST', $this->className)); } require_once PATH_WORKSPACE . 'classes/' . $this->className . '.php'; eval('$obj = new ' . $this->className . '();'); if (count($row) > 0) { eval('$con = Propel::getConnection(' . $this->classPeerName . '::DATABASE_NAME);'); $obj->fromArray($row, BasePeer::TYPE_FIELDNAME); if ($obj->validate()) { $obj->save(); $toSave = true; $primaryKeysValues = array(); foreach ($primaryKeys as $primaryKey) { $method = 'get' . AdditionalTables::getPHPName($primaryKey['FLD_NAME']); $primaryKeysValues[] = $obj->{$method}(); } } else { $msg = ''; foreach ($obj->getValidationFailures() as $objValidationFailure) { $msg .= $objValidationFailure->getMessage() . "\n"; } throw new Exception(G::LoadTranslation('ID_ERROR_TRYING_INSERT') . '"' . $table['ADD_TAB_NAME'] . "\"\n" . $msg); } $index = G::encrypt(implode(',', $primaryKeysValues), 'pmtable'); } else { $toSave = false; } if ($toSave) { $result->success = true; $result->message = G::LoadTranslation('ID_RECORD_SAVED_SUCCESFULLY'); $result->rows = $obj->toArray(BasePeer::TYPE_FIELDNAME); $result->rows['__index__'] = $index; } else { $result->success = false; $result->rows = array(); $result->message = '$$'; } } catch (Exception $e) { $result->success = false; $result->rows = array(); $result->message = $e->getMessage(); } return $result; }
public function createMSSQLWorkspace () { G::LoadSystem('inputfilter'); $filter = new InputFilter(); ini_set( 'max_execution_time', '0' ); $info = new stdClass(); $info->result = false; $info->message = ''; $db_hostname = trim( $_REQUEST['db_hostname'] ); $db_hostname = $filter->validateInput($db_hostname); $db_port = trim( $_REQUEST['db_port'] ); $db_port = $filter->validateInput($db_port); $db_username = trim( $_REQUEST['db_username'] ); $db_username = $filter->validateInput($db_username); $db_password = trim( $_REQUEST['db_password'] ); $db_password = $filter->validateInput($db_password); $wf = trim( $_REQUEST['wfDatabase'] ); $rb = trim( $_REQUEST['wfDatabase'] ); $rp = trim( $_REQUEST['wfDatabase'] ); $workspace = trim( $_REQUEST['workspace'] ); $pathConfig = trim( $_REQUEST['pathConfig'] ); $pathLanguages = trim( $_REQUEST['pathLanguages'] ); $pathPlugins = trim( $_REQUEST['pathPlugins'] ); $pathShared = trim( $_REQUEST['pathShared'] ); $pathXmlforms = trim( $_REQUEST['pathXmlforms'] ); $adminPassword = trim( $_REQUEST['adminPassword'] ); $adminUsername = trim( $_REQUEST['adminUsername'] ); $deleteDB = ($_REQUEST['deleteDB'] == 'true'); if (substr( $pathShared, - 1 ) != '/') { $pathShared .= '/'; } $this->installLog( '-------------------------------------------' ); $this->installLog( G::LoadTranslation('ID_CREATING_WORKSPACE', SYS_LANG, Array($workspace) ) ); try { $db_host = ($db_port != '' && $db_port != 1433) ? $db_hostname . ':' . $db_port : $db_hostname; $db_host = $filter->validateInput($db_host); $db_username = $filter->validateInput($db_username); $db_password = $filter->validateInput($db_password); $this->link = @mssql_connect( $db_host, $db_username, $db_password ); $this->installLog( G::LoadTranslation('ID_CONNECT_TO_SERVER', SYS_LANG, Array( $db_hostname, $db_port, $db_username )) ); $this->mssqlQuery( 'USE [master]' ); // DROP databases wf_workflow, rb_workflow and rp_workflow if ($deleteDB) { $q = sprintf( "IF EXISTS (SELECT name FROM sys.databases WHERE name='%s' ) DROP DATABASE %s", $wf, $wf ); $this->mssqlQuery( $q ); } // CREATE databases wf_workflow, rb_workflow and rp_workflow $q = sprintf( "IF NOT EXISTS (SELECT * FROM sys.databases WHERE name='%s' ) CREATE DATABASE %s", $wf, $wf ); $this->mssqlQuery( $q ); //CREATE users and GRANT Privileges $wfPass = G::generate_password( 12 ); $this->setGrantPrivilegesMSSQL( $wf, $wfPass, $wf ); //Generate the db.php file and folders $path_site = $pathShared . "/sites/" . $workspace . "/"; $db_file = $path_site . "db.php"; mkdir( $path_site, 0777, true ); @mkdir( $path_site . "files/", 0777, true ); @mkdir( $path_site . "mailTemplates/", 0777, true ); @mkdir( $path_site . "public/", 0777, true ); @mkdir( $path_site . "reports/", 0777, true ); @mkdir( $path_site . "xmlForms", 0777, true ); $dbText = "<?php\n"; $dbText .= sprintf( "// Processmaker configuration\n" ); $dbText .= sprintf( " define ('DB_ADAPTER', '%s' );\n", 'mssql' ); $dbText .= sprintf( " define ('DB_HOST', '%s' );\n", $db_host ); $dbText .= sprintf( " define ('DB_NAME', '%s' );\n", $wf ); $dbText .= sprintf( " define ('DB_USER', '%s' );\n", $wf ); $dbText .= sprintf( " define ('DB_PASS', '%s' );\n", $wfPass ); $dbText .= sprintf( " define ('DB_RBAC_HOST', '%s' );\n", $db_host ); $dbText .= sprintf( " define ('DB_RBAC_NAME', '%s' );\n", $wf ); $dbText .= sprintf( " define ('DB_RBAC_USER', '%s' );\n", $wf ); $dbText .= sprintf( " define ('DB_RBAC_PASS', '%s' );\n", $wfPass ); $dbText .= sprintf( " define ('DB_REPORT_HOST', '%s' );\n", $db_host ); $dbText .= sprintf( " define ('DB_REPORT_NAME', '%s' );\n", $wf ); $dbText .= sprintf( " define ('DB_REPORT_USER', '%s' );\n", $wf ); $dbText .= sprintf( " define ('DB_REPORT_PASS', '%s' );\n", $wfPass ); if (defined('PARTNER_FLAG') || isset($_REQUEST['PARTNER_FLAG'])) { $dbText .= "\n"; $dbText .= " define ('PARTNER_FLAG', " . ((defined('PARTNER_FLAG')) ? PARTNER_FLAG : ((isset($_REQUEST['PARTNER_FLAG'])) ? $_REQUEST['PARTNER_FLAG']:'false')) . ");\n"; if ($this->systemName != '') { $dbText .= " define ('SYSTEM_NAME', '" . $this->systemName . "');\n"; } } $this->installLog( G::LoadTranslation('ID_CREATING', SYS_LANG, Array($db_file) )); file_put_contents( $db_file, $dbText ); // Generate the databases.php file $databases_file = $path_site . 'databases.php'; $dbData = sprintf( "\$dbAdapter = '%s';\n", 'mssql' ); $dbData .= sprintf( "\$dbHost = '%s';\n", $db_host ); $dbData .= sprintf( "\$dbName = '%s';\n", $wf ); $dbData .= sprintf( "\$dbUser = '******';\n", $wf ); $dbData .= sprintf( "\$dbPass = '******';\n", $wfPass ); $dbData .= sprintf( "\$dbRbacHost = '%s';\n", $db_host ); $dbData .= sprintf( "\$dbRbacName = '%s';\n", $wf ); $dbData .= sprintf( "\$dbRbacUser = '******';\n", $wf ); $dbData .= sprintf( "\$dbRbacPass = '******';\n", $wfPass ); $dbData .= sprintf( "\$dbReportHost = '%s';\n", $db_host ); $dbData .= sprintf( "\$dbReportName = '%s';\n", $wf ); $dbData .= sprintf( "\$dbReportUser = '******';\n", $wf ); $dbData .= sprintf( "\$dbReportPass = '******';\n", $wfPass ); $databasesText = str_replace( '{dbData}', $dbData, @file_get_contents( PATH_HOME . 'engine/templates/installer/databases.tpl' ) ); $this->installLog( G::LoadTranslation('ID_CREATING', SYS_LANG, Array($databases_file) )); file_put_contents( $databases_file, $databasesText ); //execute scripts to create and populates databases $query = sprintf( "USE %s;", $wf ); $this->mssqlQuery( $query ); $this->mssqlFileQuery( PATH_RBAC_HOME . 'engine/data/mssql/schema.sql' ); $this->mssqlFileQuery( PATH_RBAC_HOME . 'engine/data/mssql/insert.sql' ); $query = sprintf( "USE %s;", $wf ); $this->mssqlQuery( $query ); $this->mssqlFileQuery( PATH_HOME . 'engine/data/mssql/schema.sql' ); $this->mssqlFileQuery( PATH_HOME . 'engine/data/mssql/insert.sql' ); // Create the triggers if (file_exists( PATH_HOME . 'engine/plugins/enterprise/data/triggerAppDelegationInsert.sql' ) && file_exists( PATH_HOME . 'engine/plugins/enterprise/data/triggerAppDelegationUpdate.sql' ) && file_exists( PATH_HOME . 'engine/plugins/enterprise/data/triggerApplicationUpdate.sql' ) && file_exists( PATH_HOME . 'engine/plugins/enterprise/data/triggerApplicationDelete.sql' ) && file_exists( PATH_HOME . 'engine/plugins/enterprise/data/triggerContentUpdate.sql' )) { $this->mssqlQuery( @file_get_contents( PATH_HOME . 'engine/plugins/enterprise/data/triggerAppDelegationInsert.sql' ) ); $this->mssqlQuery( @file_get_contents( PATH_HOME . 'engine/plugins/enterprise/data/triggerAppDelegationUpdate.sql' ) ); $this->mssqlQuery( @file_get_contents( PATH_HOME . 'engine/plugins/enterprise/data/triggerApplicationUpdate.sql' ) ); $this->mssqlQuery( @file_get_contents( PATH_HOME . 'engine/plugins/enterprise/data/triggerApplicationDelete.sql' ) ); $this->mysqlQuery(@file_get_contents(PATH_HOME . "engine/methods/setup/setupSchemas/triggerSubApplicationInsert.sql")); $this->mssqlQuery( @file_get_contents( PATH_HOME . 'engine/plugins/enterprise/data/triggerContentUpdate.sql' ) ); $this->mssqlQuery( "INSERT INTO CONFIGURATION ( CFG_UID, CFG_VALUE ) VALUES ( 'APP_CACHE_VIEW_ENGINE', '" . addslashes( serialize( array ('LANG' => 'en','STATUS' => 'active' ) ) ) . "' )" ); $this->mssqlQuery("INSERT INTO EMAIL_SERVER(MESS_UID, MESS_ENGINE) VALUES('" . \ProcessMaker\Util\Common::generateUID() . "','MAIL')"); } //change admin user $query = sprintf( "USE %s;", $wf ); $this->mssqlQuery( $query ); $query = sprintf( "UPDATE USERS SET USR_USERNAME = '******', USR_PASSWORD = '******' WHERE USR_UID = '00000000000000000000000000000001' ", $adminUsername, G::encryptOld( $adminPassword ) ); $this->mssqlQuery( $query ); $query = sprintf( "USE %s;", $wf ); $this->mssqlQuery( $query ); $query = sprintf( "UPDATE RBAC_USERS SET USR_USERNAME = '******', USR_PASSWORD = '******' WHERE USR_UID = '00000000000000000000000000000001' ", $adminUsername, G::encryptOld( $adminPassword ) ); $this->mssqlQuery( $query ); // Write the paths_installed.php file (contains all the information configured so far) if (! file_exists( FILE_PATHS_INSTALLED )) { $sh = G::encryptOld( filemtime( PATH_GULLIVER . '/class.g.php' ) ); $h = G::encrypt( $db_hostname . $sh . $db_username . $sh . $db_password . '1', $sh ); $dbText = "<?php\n"; $dbText .= sprintf( " define ('PATH_DATA', '%s' );\n", $pathShared ); $dbText .= sprintf( " define ('PATH_C', '%s' );\n", $pathShared . 'compiled/' ); $dbText .= sprintf( " define ('HASH_INSTALLATION', '%s' );\n", $h ); $dbText .= sprintf( " define ('SYSTEM_HASH', '%s' );\n", $sh ); $this->installLog( G::LoadTranslation('ID_CREATING', SYS_LANG, Array(FILE_PATHS_INSTALLED) )); file_put_contents( FILE_PATHS_INSTALLED, $dbText ); } $this->installLog( G::LoadTranslation('ID_INSTALL_SUCESS') ); $info->result = true; $info->message = G::LoadTranslation('ID_INSTALL_SUCESS'); $info->url = '/sys' . $_REQUEST['workspace'] . '/en/neoclassic/login/login'; $info->messageFinish = G::LoadTranslation('ID_PROCESSMAKER_SUCCESS_INSTALLED', SYS_LANG, Array($workspace));; } catch (Exception $e) { $info->result = false; $info->message = $e->getMessage(); } return $info; }
/** * * @author Fernando Ontiveros Lira <*****@*****.**> * @access public * @param string $permission * @param string $urlNoAccess * @return void */ public function forceLogin($permission = "", $urlNoAccess = "") { global $RBAC; if (isset($_SESSION['USER_LOGGED']) && $_SESSION['USER_LOGGED'] == '') { $sys = ENABLE_ENCRYPT == 'yes' ? SYS_SYS : "sys" . SYS_SYS; $lang = ENABLE_ENCRYPT == 'yes' ? G::encrypt(urldecode(SYS_LANG), URL_KEY) : SYS_LANG; $skin = ENABLE_ENCRYPT == 'yes' ? G::encrypt(urldecode(SYS_SKIN), URL_KEY) : SYS_SKIN; $login = ENABLE_ENCRYPT == 'yes' ? G::encrypt(urldecode('login'), URL_KEY) : 'login'; $loginhtml = ENABLE_ENCRYPT == 'yes' ? G::encrypt(urldecode('login.html'), URL_KEY) : 'login.html'; $direction = "/{$sys}/{$lang}/{$skin}/{$login}/{$loginhtml}"; die; } $Connection = new DBConnection(); $ses = new DBSession($Connection); $stQry = "SELECT LOG_STATUS FROM LOGIN WHERE LOG_SID = '" . session_id() . "'"; $dset = $ses->Execute($stQry); $row = $dset->read(); $sessionPc = defined('SESSION_PC') ? SESSION_PC : ''; $sessionBrowser = defined('SESSION_BROWSER') ? SESSION_BROWSER : ''; if ($sessionPc == "1" or $sessionBrowser == "1") { if ($row['LOG_STATUS'] == 'X') { $sys = ENABLE_ENCRYPT == 'yes' ? SYS_SYS : "sys" . SYS_SYS; $lang = ENABLE_ENCRYPT == 'yes' ? G::encrypt(urldecode(SYS_LANG), URL_KEY) : SYS_LANG; $skin = ENABLE_ENCRYPT == 'yes' ? G::encrypt(urldecode(SYS_SKIN), URL_KEY) : SYS_SKIN; $login = ENABLE_ENCRYPT == 'yes' ? G::encrypt(urldecode('login'), URL_KEY) : 'login'; $loginhtml = ENABLE_ENCRYPT == 'yes' ? G::encrypt(urldecode('login.html'), URL_KEY) : 'login.html'; $direction = "/{$sys}/{$lang}/{$skin}/{$login}/{$loginhtml}"; G::SendMessageXml('ID_CLOSE_SESSION', "warning"); header("location: {$direction}"); die; return; } } if (defined('SIN_COMPATIBILIDAD_RBAC') and SIN_COMPATIBILIDAD_RBAC == 1) { return; } if ($permission == "") { return; } if (is_array($permission)) { $aux = $permission; } else { $aux[0] = $permission; } $sw = 0; for ($i = 0; $i < count($aux); $i++) { $res = $RBAC->userCanAccess($aux[$i]); if ($res == 1) { $sw = 1; } } if ($sw == 0 && $urlNoAccess != "") { $aux = explode('/', $urlNoAccess); $sys = ENABLE_ENCRYPT == 'yes' ? SYS_SYS : "/sys" . SYS_LANG; $lang = ENABLE_ENCRYPT == 'yes' ? G::encrypt(urldecode(SYS_LANG), URL_KEY) : SYS_LANG; $skin = ENABLE_ENCRYPT == 'yes' ? G::encrypt(urldecode(SYS_SKIN), URL_KEY) : SYS_SKIN; $login = ENABLE_ENCRYPT == 'yes' ? G::encrypt(urldecode($aux[0]), URL_KEY) : $aux[0]; $loginhtml = ENABLE_ENCRYPT == 'yes' ? G::encrypt(urldecode($aux[1]), URL_KEY) : $aux[1]; //header ("location: /$sys/$lang/$skin/$login/$loginhtml"); header("location: /fluid/mNE/o9A/mNGm1aLiop3V4qU/dtij4J°gmaLPwKDU3qNn2qXanw"); die; } if ($sw == 0) { header("location: /fluid/mNE/o9A/mNGm1aLiop3V4qU/dtij4J°gmaLPwKDU3qNn2qXanw"); die; } }
public function createMSSQLWorkspace() { ini_set('max_execution_time', '0'); $info->result = false; $info->message = ''; $db_hostname = trim($_REQUEST['db_hostname']); $db_port = trim($_REQUEST['db_port']); $db_username = trim($_REQUEST['db_username']); $db_password = trim($_REQUEST['db_password']); $wf = trim($_REQUEST['wfDatabase']); $rb = trim($_REQUEST['rbDatabase']); $rp = trim($_REQUEST['rpDatabase']); $workspace = trim($_REQUEST['workspace']); $pathConfig = trim($_REQUEST['pathConfig']); $pathLanguages = trim($_REQUEST['pathLanguages']); $pathPlugins = trim($_REQUEST['pathPlugins']); $pathShared = trim($_REQUEST['pathShared']); $pathXmlforms = trim($_REQUEST['pathXmlforms']); $adminPassword = trim($_REQUEST['adminPassword']); $adminUsername = trim($_REQUEST['adminUsername']); $deleteDB = $_REQUEST['deleteDB'] == 'true'; if (substr($pathShared, -1) != '/') { $pathShared .= '/'; } $this->installLog('-------------------------------------------'); $this->installLog(sprintf("Creating workspace '%s' ", $workspace)); try { $db_host = $db_port != '' && $db_port != 1433 ? $db_hostname . ':' . $db_port : $db_hostname; $this->link = @mssql_connect($db_host, $db_username, $db_password); $this->installLog(sprintf("Connected to server %s:%d using user: '******' ", $db_hostname, $db_port, $db_username)); $this->mssqlQuery('USE [master]'); // DROP databases wf_workflow, rb_workflow and rp_workflow if ($deleteDB) { $q = sprintf("IF EXISTS (SELECT name FROM sys.databases WHERE name='%s' ) DROP DATABASE %s", $wf, $wf); $this->mssqlQuery($q); $q = sprintf("IF EXISTS (SELECT name FROM sys.databases WHERE name='%s' ) DROP DATABASE %s", $rb, $rb); $this->mssqlQuery($q); $q = sprintf("IF EXISTS (SELECT name FROM sys.databases WHERE name='%s' ) DROP DATABASE %s", $rp, $rp); $this->mssqlQuery($q); } // CREATE databases wf_workflow, rb_workflow and rp_workflow $q = sprintf("IF NOT EXISTS (SELECT * FROM sys.databases WHERE name='%s' ) CREATE DATABASE %s", $wf, $wf); $this->mssqlQuery($q); $q = sprintf("IF NOT EXISTS (SELECT * FROM sys.databases WHERE name='%s' ) CREATE DATABASE %s", $rb, $rb); $this->mssqlQuery($q); $q = sprintf("IF NOT EXISTS (SELECT * FROM sys.databases WHERE name='%s' ) CREATE DATABASE %s", $rp, $rp); $this->mssqlQuery($q); //CREATE users and GRANT Privileges $wfPass = G::generate_password(12); $rbPass = G::generate_password(12); $rpPass = G::generate_password(12); $this->setGrantPrivilegesMSSQL($wf, $wfPass, $wf); $this->setGrantPrivilegesMSSQL($rb, $rbPass, $rb); $this->setGrantPrivilegesMSSQL($rp, $rpPass, $rp); //Generate the db.php file and folders $path_site = $pathShared . "/sites/" . $workspace . "/"; $db_file = $path_site . "db.php"; mkdir($path_site, 0777, true); @mkdir($path_site . "files/", 0777, true); @mkdir($path_site . "mailTemplates/", 0777, true); @mkdir($path_site . "public/", 0777, true); @mkdir($path_site . "reports/", 0777, true); @mkdir($path_site . "xmlForms", 0777, true); $dbText = "<?php\n"; $dbText .= sprintf("// Processmaker configuration\n"); $dbText .= sprintf(" define ('DB_ADAPTER', '%s' );\n", 'mssql'); $dbText .= sprintf(" define ('DB_HOST', '%s' );\n", $db_host); $dbText .= sprintf(" define ('DB_NAME', '%s' );\n", $wf); $dbText .= sprintf(" define ('DB_USER', '%s' );\n", $wf); $dbText .= sprintf(" define ('DB_PASS', '%s' );\n", $wfPass); $dbText .= sprintf(" define ('DB_RBAC_HOST', '%s' );\n", $db_host); $dbText .= sprintf(" define ('DB_RBAC_NAME', '%s' );\n", $rb); $dbText .= sprintf(" define ('DB_RBAC_USER', '%s' );\n", $rb); $dbText .= sprintf(" define ('DB_RBAC_PASS', '%s' );\n", $rbPass); $dbText .= sprintf(" define ('DB_REPORT_HOST', '%s' );\n", $db_host); $dbText .= sprintf(" define ('DB_REPORT_NAME', '%s' );\n", $rp); $dbText .= sprintf(" define ('DB_REPORT_USER', '%s' );\n", $rp); $dbText .= sprintf(" define ('DB_REPORT_PASS', '%s' );\n", $rpPass); $this->installLog("Creating: " . $db_file); file_put_contents($db_file, $dbText); // Generate the databases.php file $databases_file = $path_site . 'databases.php'; $dbData = sprintf("\$dbAdapter = '%s';\n", 'mssql'); $dbData .= sprintf("\$dbHost = '%s';\n", $db_host); $dbData .= sprintf("\$dbName = '%s';\n", $wf); $dbData .= sprintf("\$dbUser = '******';\n", $wf); $dbData .= sprintf("\$dbPass = '******';\n", $wfPass); $dbData .= sprintf("\$dbRbacHost = '%s';\n", $db_host); $dbData .= sprintf("\$dbRbacName = '%s';\n", $rb); $dbData .= sprintf("\$dbRbacUser = '******';\n", $rb); $dbData .= sprintf("\$dbRbacPass = '******';\n", $rbPass); $dbData .= sprintf("\$dbReportHost = '%s';\n", $db_host); $dbData .= sprintf("\$dbReportName = '%s';\n", $rp); $dbData .= sprintf("\$dbReportUser = '******';\n", $rp); $dbData .= sprintf("\$dbReportPass = '******';\n", $rpPass); $databasesText = str_replace('{dbData}', $dbData, @file_get_contents(PATH_HOME . 'engine/templates/installer/databases.tpl')); $this->installLog('Creating: ' . $databases_file); file_put_contents($databases_file, $databasesText); //execute scripts to create and populates databases $query = sprintf("USE %s;", $rb); $this->mssqlQuery($query); $this->mssqlFileQuery(PATH_RBAC_HOME . 'engine/data/mssql/schema.sql'); $this->mssqlFileQuery(PATH_RBAC_HOME . 'engine/data/mssql/insert.sql'); $query = sprintf("USE %s;", $wf); $this->mssqlQuery($query); $this->mssqlFileQuery(PATH_HOME . 'engine/data/mssql/schema.sql'); $this->mssqlFileQuery(PATH_HOME . 'engine/data/mssql/insert.sql'); // Create the triggers if (file_exists(PATH_HOME . 'engine/plugins/enterprise/data/triggerAppDelegationInsert.sql') && file_exists(PATH_HOME . 'engine/plugins/enterprise/data/triggerAppDelegationUpdate.sql') && file_exists(PATH_HOME . 'engine/plugins/enterprise/data/triggerApplicationUpdate.sql') && file_exists(PATH_HOME . 'engine/plugins/enterprise/data/triggerApplicationDelete.sql') && file_exists(PATH_HOME . 'engine/plugins/enterprise/data/triggerContentUpdate.sql')) { $this->mssqlQuery(@file_get_contents(PATH_HOME . 'engine/plugins/enterprise/data/triggerAppDelegationInsert.sql')); $this->mssqlQuery(@file_get_contents(PATH_HOME . 'engine/plugins/enterprise/data/triggerAppDelegationUpdate.sql')); $this->mssqlQuery(@file_get_contents(PATH_HOME . 'engine/plugins/enterprise/data/triggerApplicationUpdate.sql')); $this->mssqlQuery(@file_get_contents(PATH_HOME . 'engine/plugins/enterprise/data/triggerApplicationDelete.sql')); $this->mssqlQuery(@file_get_contents(PATH_HOME . 'engine/plugins/enterprise/data/triggerContentUpdate.sql')); $this->mssqlQuery("INSERT INTO CONFIGURATION (\n CFG_UID,\n CFG_VALUE\n )\n VALUES (\n 'APP_CACHE_VIEW_ENGINE',\n '" . addslashes(serialize(array('LANG' => 'en', 'STATUS' => 'active'))) . "'\n )"); } //change admin user $query = sprintf("USE %s;", $wf); $this->mssqlQuery($query); $query = sprintf("UPDATE USERS SET USR_USERNAME = '******', USR_PASSWORD = '******' WHERE USR_UID = '00000000000000000000000000000001' ", $adminUsername, md5($adminPassword)); $this->mssqlQuery($query); $query = sprintf("USE %s;", $rb); $this->mssqlQuery($query); $query = sprintf("UPDATE USERS SET USR_USERNAME = '******', USR_PASSWORD = '******' WHERE USR_UID = '00000000000000000000000000000001' ", $adminUsername, md5($adminPassword)); $this->mssqlQuery($query); // Write the paths_installed.php file (contains all the information configured so far) if (!file_exists(FILE_PATHS_INSTALLED)) { $sh = md5(filemtime(PATH_GULLIVER . '/class.g.php')); $h = G::encrypt($db_hostname . $sh . $db_username . $sh . $db_password . '1', $sh); $dbText = "<?php\n"; $dbText .= sprintf(" define ('PATH_DATA', '%s' );\n", $pathShared); $dbText .= sprintf(" define ('PATH_C', '%s' );\n", $pathShared . 'compiled/'); $dbText .= sprintf(" define ('HASH_INSTALLATION', '%s' );\n", $h); $dbText .= sprintf(" define ('SYSTEM_HASH', '%s' );\n", $sh); $this->installLog("Creating: " . FILE_PATHS_INSTALLED); file_put_contents(FILE_PATHS_INSTALLED, $dbText); } $this->installLog("Install completed Succesfully"); $info->result = true; $info->message = 'Succesfully'; $info->url = '/sys' . $_REQUEST['workspace'] . '/en/classic/main/login'; } catch (Exception $e) { $info->result = false; $info->message = $e->getMessage(); } return $info; }