diff --git a/gulliver/system/class.g.php b/gulliver/system/class.g.php index ac0cea33c..71d903ee5 100644 --- a/gulliver/system/class.g.php +++ b/gulliver/system/class.g.php @@ -2832,7 +2832,7 @@ class G * @param string $array_i * @return array */ - public function array_merge_2(&$array, &$array_i) + public static function array_merge_2(&$array, &$array_i) { foreach ($array_i as $k => $v) { if (is_array($v)) { diff --git a/gulliver/system/class.wysiwygEditor.php b/gulliver/system/class.wysiwygEditor.php index 77f0fdcdc..0236cbdbc 100644 --- a/gulliver/system/class.wysiwygEditor.php +++ b/gulliver/system/class.wysiwygEditor.php @@ -56,8 +56,11 @@ class XmlFormFieldWYSIWYGEditor extends XmlFormField * @return string * */ - public function render($value, $owner = null) + public function render($value = null, $owner = null) { + if ($value === null) { + $value = ''; + } $value = ($value == '') ? '
' : $value; $html = ""; diff --git a/gulliver/system/class.xmlform.php b/gulliver/system/class.xmlform.php index 261aaddce..23a0b7059 100644 --- a/gulliver/system/class.xmlform.php +++ b/gulliver/system/class.xmlform.php @@ -384,8 +384,11 @@ class XmlFormField * @param string values * @return string */ - public function renderGrid($values = array(), $owner = null, $onlyValue = false, $therow = -1) + public function renderGrid($values = null, $owner = null, $onlyValue = false, $therow = -1) { + if ($values === null) { + $values = []; + } $result = []; $r = 1; foreach ($values as $v) { diff --git a/thirdparty/phing/ProjectComponent.php b/thirdparty/phing/ProjectComponent.php index d8fc751e7..f85bad05f 100644 --- a/thirdparty/phing/ProjectComponent.php +++ b/thirdparty/phing/ProjectComponent.php @@ -44,7 +44,7 @@ abstract class ProjectComponent { * @param object The reference to the current project * @access public */ - function setProject($project) { + function setProject(Project $project) { $this->project = $project; } diff --git a/thirdparty/phing/types/Mapper.php b/thirdparty/phing/types/Mapper.php index a84d246e5..cbf9b4600 100644 --- a/thirdparty/phing/types/Mapper.php +++ b/thirdparty/phing/types/Mapper.php @@ -134,7 +134,7 @@ class Mapper extends DataType { * * You must not set any other attribute if you make it a reference. */ - function setRefid($r) { + function setRefid(Reference $r) { if ($this->type !== null || $this->from !== null || $this->to !== null) { throw DataType::tooManyAttributes(); } diff --git a/workflow/engine/classes/Configurations.php b/workflow/engine/classes/Configurations.php index b7b798749..2e1e49dae 100644 --- a/workflow/engine/classes/Configurations.php +++ b/workflow/engine/classes/Configurations.php @@ -18,7 +18,7 @@ class Configurations // extends Configuration * * @return void */ - public function Configurations() + public function __construct() { $this->Configuration = new Configuration(); } diff --git a/workflow/engine/classes/Derivation.php b/workflow/engine/classes/Derivation.php index f166e25b6..6214b8928 100644 --- a/workflow/engine/classes/Derivation.php +++ b/workflow/engine/classes/Derivation.php @@ -1740,22 +1740,33 @@ class Derivation return $aGrp; } - function checkReplacedByUser ($user) + /** + * Review the replaced by configuration + * + * @param string $user + * + * @return string + * @throws Exception + */ + function checkReplacedByUser($user) { - if (is_string( $user )) { - $userInstance = UsersPeer::retrieveByPK( $user ); + if (is_string($user)) { + $userInstance = UsersPeer::retrieveByPK($user); } else { $userInstance = $user; } - if (! is_object( $userInstance )) { - throw new Exception( "The user with the UID '$user' doesn't exist." ); + if (!is_object($userInstance)) { + if (!is_string($user)) { + $user = gettype($user); + } + throw new Exception("The user with the UID '" . $user . "' doesn't exist."); } if ($userInstance->getUsrStatus() == 'ACTIVE') { return $userInstance->getUsrUid(); } else { - $userReplace = trim( $userInstance->getUsrReplacedBy() ); + $userReplace = trim($userInstance->getUsrReplacedBy()); if ($userReplace != '') { - return $this->checkReplacedByUser( UsersPeer::retrieveByPK( $userReplace ) ); + return $this->checkReplacedByUser(UsersPeer::retrieveByPK($userReplace)); } else { return ''; } diff --git a/workflow/engine/classes/ProcessMap.php b/workflow/engine/classes/ProcessMap.php index 9746caae0..86662b68d 100644 --- a/workflow/engine/classes/ProcessMap.php +++ b/workflow/engine/classes/ProcessMap.php @@ -2003,7 +2003,7 @@ class ProcessMap $oDataset = InputDocumentPeer::doSelectRS($oCriteria, Propel::getDbConnection('workflow_ro')); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); - $inputDocArray = ""; + $inputDocArray = []; $inputDocArray[] = array('INP_DOC_UID' => 'char', 'PRO_UID' => 'char', 'INP_DOC_TITLE' => 'char', 'INP_DOC_DESCRIPTION' => 'char' ); while ($aRow = $oDataset->getRow()) { if (($aRow['INP_DOC_TITLE'] == null) || ($aRow['INP_DOC_TITLE'] == "")) { @@ -2071,11 +2071,11 @@ class ProcessMap $oDataset = TriggersPeer::doSelectRS($oCriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); - $triggersArray = ""; + $triggersArray = []; $triggersArray[] = array('TRI_UID' => 'char', 'PRO_UID' => 'char', 'TRI_TITLE' => 'char', 'TRI_DESCRIPTION' => 'char'); while ($aRow = $oDataset->getRow()) { if (($aRow['TRI_TITLE'] == null) || ($aRow['TRI_TITLE'] == "")) { - // There is no transaltion for this Trigger name, try to get/regenerate the label + // There is no translation for this Trigger name, try to get/regenerate the label $triggerO = new Triggers(); $triggerObj = $triggerO->load($aRow['TRI_UID']); $aRow['TRI_TITLE'] = $triggerObj['TRI_TITLE']; diff --git a/workflow/engine/classes/PropelTable.php b/workflow/engine/classes/PropelTable.php index 9d2c270f8..08da868cc 100644 --- a/workflow/engine/classes/PropelTable.php +++ b/workflow/engine/classes/PropelTable.php @@ -261,7 +261,8 @@ class PropelTable $totalWidth = 0; foreach ($this->fields as $r => $rval) { if ($this->style[$r]['showInTable'] != '0') { - $totalWidth += $this->style[$r]['colWidth']; + $colWidth = empty($this->style[$r]['colWidth']) ? 0 : $this->style[$r]['colWidth']; + $totalWidth += $colWidth; } } $this->totalWidth = $totalWidth; @@ -327,7 +328,8 @@ class PropelTable $this->tpl->assign("width", $this->style[$r]['colWidth']); } if (isset($this->style[$r]['colWidth'])) { - $this->tpl->assign("widthPercent", ($this->style[$r]['colWidth'] * 100 / $this->totalWidth) . "%"); + $colWidth = empty($this->style[$r]['colWidth']) ? 1 : $this->style[$r]['colWidth']; + $this->tpl->assign("widthPercent", ($colWidth * 100 / $this->totalWidth) . "%"); //Hook for special skin with RTL languajes } if (defined('SYS_LANG_DIRECTION') && SYS_LANG_DIRECTION == 'R') { diff --git a/workflow/engine/classes/XmlFormFieldTextPm.php b/workflow/engine/classes/XmlFormFieldTextPm.php index 20ca0d411..f3c5fcd99 100644 --- a/workflow/engine/classes/XmlFormFieldTextPm.php +++ b/workflow/engine/classes/XmlFormFieldTextPm.php @@ -75,7 +75,7 @@ class XmlFormFieldTextPm extends XmlFormFieldSimpleText * @param eter string owner * @return string */ - public function renderGrid($values = array(), $owner) + public function renderGrid($values = array(), $owner = null, $paramDummy3 = null, $paramDummy4 = null) { $result = array(); $r = 1; diff --git a/workflow/engine/classes/XmlFormFieldTextareaPm.php b/workflow/engine/classes/XmlFormFieldTextareaPm.php index 25b94be5c..75e42e1ca 100644 --- a/workflow/engine/classes/XmlFormFieldTextareaPm.php +++ b/workflow/engine/classes/XmlFormFieldTextareaPm.php @@ -23,7 +23,7 @@ class XmlFormFieldTextareaPm extends XmlFormField * @param eter string owner * @return string */ - public function render($value = null, $owner) + public function render($value = null, $owner = null) { if ($this->showVars == 1) { $this->process = G::replaceDataField($this->process, $owner->values); @@ -53,8 +53,11 @@ class XmlFormFieldTextareaPm extends XmlFormField * @param eter string owner * @return string */ - public function renderGrid($owner, $values = null) + public function renderGrid($owner = null, $values = null, $onlyValue = false, $therow = -1) { + if ($values === null) { + $values = []; + } $result = array(); $r = 1; foreach ($values as $v) { diff --git a/workflow/engine/classes/model/AppAssignSelfServiceValue.php b/workflow/engine/classes/model/AppAssignSelfServiceValue.php index e5e41f4a7..a2c48430c 100644 --- a/workflow/engine/classes/model/AppAssignSelfServiceValue.php +++ b/workflow/engine/classes/model/AppAssignSelfServiceValue.php @@ -10,7 +10,7 @@ class AppAssignSelfServiceValue extends BaseAppAssignSelfServiceValue * * return void */ - public function create($applicationUid, $delIndex, array $arrayData, $dataVariable) + public function create($applicationUid, $delIndex, array $arrayData, $dataVariable = []) { try { $cnn = Propel::getConnection(AppAssignSelfServiceValuePeer::DATABASE_NAME); diff --git a/workflow/engine/classes/model/Language.php b/workflow/engine/classes/model/Language.php index 1785e8759..e0457eddc 100644 --- a/workflow/engine/classes/model/Language.php +++ b/workflow/engine/classes/model/Language.php @@ -571,7 +571,8 @@ class Language extends BaseLanguage $buildhash = file_get_contents($buildhash); $michelangeloFE = PATH_HTML . "lib/js"; - $pathFileMafe = array_pop(glob($michelangeloFE . '/' . '*' . $buildhash . '*', GLOB_BRACE)); + $array = glob($michelangeloFE . '/' . '*' . $buildhash . '*', GLOB_BRACE); + $pathFileMafe = array_pop($array); if (file_exists($pathFileMafe) && is_readable($pathFileMafe)) { $labels = self::readLabelsDirectory($pathFileMafe, true); } diff --git a/workflow/engine/controllers/InstallerModule.php b/workflow/engine/controllers/InstallerModule.php index fb569e0a9..f50aace55 100644 --- a/workflow/engine/controllers/InstallerModule.php +++ b/workflow/engine/controllers/InstallerModule.php @@ -798,7 +798,7 @@ class InstallerModule extends Controller // CREATE databases wf_workflow DB::connection(self::CONNECTION_TEST_INSTALL) - ->statement("CREATE DATABASE IF NOT EXISTS $wf"); + ->statement("CREATE DATABASE IF NOT EXISTS $wf DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci"); self::setNewConnection(self::CONNECTION_INSTALL, $db_hostname, $db_username, $db_password, $wf, $db_port); @@ -926,7 +926,7 @@ class InstallerModule extends Controller ->update([ 'USR_USERNAME' => $adminUsername, 'USR_LASTNAME' => $adminUsername, - 'USR_PASSWORD' => Bootstrap::hashPassword($adminPassword, Bootstrap::hashBcrypt) + 'USR_PASSWORD' => G::encryptHash($adminPassword) ]); DB::connection(self::CONNECTION_INSTALL) @@ -935,7 +935,7 @@ class InstallerModule extends Controller ->update([ 'USR_USERNAME' => $adminUsername, 'USR_LASTNAME' => $adminUsername, - 'USR_PASSWORD' => Bootstrap::hashPassword($adminPassword, Bootstrap::hashBcrypt) + 'USR_PASSWORD' => G::encryptHash($adminPassword) ]); // Write the paths_installed.php file (contains all the information configured so far) if (!file_exists(FILE_PATHS_INSTALLED)) { diff --git a/workflow/engine/methods/authSources/authSourcesSynchronizeAjax.php b/workflow/engine/methods/authSources/authSourcesSynchronizeAjax.php index 886190c3d..50179b154 100644 --- a/workflow/engine/methods/authSources/authSourcesSynchronizeAjax.php +++ b/workflow/engine/methods/authSources/authSourcesSynchronizeAjax.php @@ -450,7 +450,7 @@ function custom_ldap_explode_dn($dn) unset($result["count"]); foreach ($result as $key => $value) { - $result[$key] = addcslashes(preg_replace("/\\\([0-9A-Fa-f]{2})/", function ($m) { + $result[$key] = addcslashes(preg_replace_callback("/\\\([0-9A-Fa-f]{2})/", function ($m) { return chr(hexdec($m[1])); }, $value), '<>,"'); } diff --git a/workflow/engine/methods/groups/groups_Ajax.php b/workflow/engine/methods/groups/groups_Ajax.php index 4b227b6dd..30801d56f 100644 --- a/workflow/engine/methods/groups/groups_Ajax.php +++ b/workflow/engine/methods/groups/groups_Ajax.php @@ -160,7 +160,8 @@ switch ($_POST['action']) { $start = isset($_REQUEST['start']) ? $_REQUEST['start'] : 0; $limit = isset($_REQUEST['limit']) ? $_REQUEST['limit'] : $limit_size; $filter = isset($_REQUEST['textFilter']) ? $_REQUEST['textFilter'] : ''; - $groupUid = $inputFilter->quoteSmart($_REQUEST['gUID'], Propel::getConnection("workflow")->getResource()); + $connection = Propel::getConnection("workflow")->getResource(); + $groupUid = $inputFilter->quoteSmart($_REQUEST['gUID'], $connection); $groupUsers = new GroupUser(); $type = $_POST['action'] === 'assignedMembers' ? 'USERS' : 'AVAILABLE-USERS'; diff --git a/workflow/engine/methods/processes/consolidated.php b/workflow/engine/methods/processes/consolidated.php index ac7840550..e5ef62ea5 100644 --- a/workflow/engine/methods/processes/consolidated.php +++ b/workflow/engine/methods/processes/consolidated.php @@ -2,7 +2,7 @@ class AdditionalTablesConsolidated extends AdditionalTables { - public function createPropelClasses($sTableName, $sClassName, $aFields, $sAddTabUid) + public function createPropelClasses($sTableName, $sClassName, $aFields, $sAddTabUid, $connection = 'workflow') { try { $aTypes = array('VARCHAR' => 'string', diff --git a/workflow/engine/methods/processes/processes_Import_Ajax.php b/workflow/engine/methods/processes/processes_Import_Ajax.php index d4e7d84a1..870db04eb 100644 --- a/workflow/engine/methods/processes/processes_Import_Ajax.php +++ b/workflow/engine/methods/processes/processes_Import_Ajax.php @@ -388,8 +388,9 @@ if ($action == "uploadFileNewProcess") { $allowedExtensions = array ($processFileType ); $allowedExtensions = array ('pm'); - if (! in_array( end( explode( ".", $_FILES['PROCESS_FILENAME']['name'] ) ), $allowedExtensions )) { - throw new Exception( G::LoadTranslation( "ID_FILE_UPLOAD_INCORRECT_EXTENSION" ) ); + $explode = explode(".", $_FILES['PROCESS_FILENAME']['name']); + if (!in_array(end($explode), $allowedExtensions)) { + throw new Exception(G::LoadTranslation("ID_FILE_UPLOAD_INCORRECT_EXTENSION")); } } diff --git a/workflow/engine/methods/triggers/triggers_Delete.php b/workflow/engine/methods/triggers/triggers_Delete.php index bfc1f4def..1d9fce998 100644 --- a/workflow/engine/methods/triggers/triggers_Delete.php +++ b/workflow/engine/methods/triggers/triggers_Delete.php @@ -35,6 +35,7 @@ try { $oStepTrigger = new StepTrigger(); $oStepTrigger->removeTrigger( $_POST['TRI_UID'] ); + $result = new stdClass(); $result->success = true; $result->msg = G::LoadTranslation( 'ID_TRIGGERS_REMOVED' ); diff --git a/workflow/engine/src/ProcessMaker/Core/Installer.php b/workflow/engine/src/ProcessMaker/Core/Installer.php index 896de30b4..cd7ef9806 100644 --- a/workflow/engine/src/ProcessMaker/Core/Installer.php +++ b/workflow/engine/src/ProcessMaker/Core/Installer.php @@ -513,7 +513,7 @@ class Installer ->where('USR_UID', '00000000000000000000000000000001') ->update([ 'USR_USERNAME' => $this->options['admin']['username'], - 'USR_PASSWORD' => Bootstrap::hashPassword($this->options['admin']['password'], Bootstrap::hashBcrypt) + 'USR_PASSWORD' => G::encryptHash($this->options['admin']['password']) ]); DB::connection(self::CONNECTION_INSTALL) @@ -521,7 +521,7 @@ class Installer ->where('USR_UID', '00000000000000000000000000000001') ->update([ 'USR_USERNAME' => $this->options['admin']['username'], - 'USR_PASSWORD' => Bootstrap::hashPassword($this->options['admin']['password'], Bootstrap::hashBcrypt) + 'USR_PASSWORD' => G::encryptHash($this->options['admin']['password']) ]); }