本文整理汇总了PHP中G::encrypt方法的典型用法代码示例。如果您正苦于以下问题:PHP G::encrypt方法的具体用法?PHP G::encrypt怎么用?PHP G::encrypt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类G
的用法示例。
在下文中一共展示了G::encrypt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateOutputDocument
/**
* 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;
}
}
示例2: Form
* 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);
示例3: sendActionsByEmail
//.........这里部分代码省略.........
$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'];
示例4: DbSource
$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) {
示例5: updateAuthSource
/**
* 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);
}
示例6: RenderContent0
/**
* It Renders content according to Part['Type']
*
* @author Fernando Ontiveros Lira <fernando@colosa.com>
*
* @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));
//.........这里部分代码省略.........
示例7: Form
$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);
}
示例8: Configuration
* 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'] = 'hash:' . $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');
示例9: md5
?>
" /> <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;
示例10: saveTableData
/**
* Save Data for PmTable
* @var string $pmt_uid. Uid for PmTable
* @var string $pmt_data. Data for rows of PmTable
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @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;
}
示例11: update
/**
* 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"] = "hash:" . $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;
}
}
示例12: define
* 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 = 'login/login' );
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");
示例13: unset
/* 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 */
示例14:
$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);
示例15: encryptThepassw
/**
* Function encryptThepassw
* @author krlos Pacha C. <carlos@colosa.com>
* @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;
}