Ejemplo n.º 1
0
 protected function setUp()
 {
     global $adb, $phpUnitLeadId;
     ${"GLOBALS"}["vqinqhvudy"] = "sql";
     ${"GLOBALS"}["omirinrsle"] = "sql";
     ${${"GLOBALS"}["omirinrsle"]} = "SELECT leadid FROM\n                    vtiger_leaddetails\n                     LEFT JOIN vtiger_crmentity ON(vtiger_crmentity.crmid = vtiger_leaddetails.leadid)\n                WHERE firstname = 'PHPUNIT' AND lastname = 'PHPUNIT' AND deleted = 0";
     ${${"GLOBALS"}["dlfzmzsoafs"]} = $adb->query(${${"GLOBALS"}["vqinqhvudy"]});
     if ($adb->num_rows(${${"GLOBALS"}["dlfzmzsoafs"]}) > 0) {
         $pcbcvlo = "result";
         ${${"GLOBALS"}["odcnybklnoz"]} = $adb->query_result(${$pcbcvlo}, 0, "leadid");
     } else {
         $zgdgywgjnie = "document";
         ${"GLOBALS"}["fbjylokbk"] = "result";
         ${$zgdgywgjnie} = CRMEntity::getInstance("Leads");
         $document->column_fields["firstname"] = "PHPUNIT";
         $document->column_fields["lastname"] = "PHPUNIT";
         $qxhkyg = "sql";
         $document->column_fields["annualrevenue"] = "1000";
         $document->column_fields["cf_654"] = 1;
         $document->column_fields["assigned_user_id"] = 1;
         $elbiflyj = "sql";
         $document->save("Leads");
         ${$elbiflyj} = "SELECT leadid FROM\n                                vtiger_leaddetails\n                                 LEFT JOIN vtiger_crmentity ON(vtiger_crmentity.crmid = vtiger_leaddetails.leadid)\n                            WHERE firstname = 'PHPUNIT' AND lastname = 'PHPUNIT' AND deleted = 0";
         $adb->query(${$qxhkyg});
         ${${"GLOBALS"}["odcnybklnoz"]} = $adb->query_result(${${"GLOBALS"}["fbjylokbk"]}, 0, "leadid");
     }
     VTEntity::setUser(VtUtils::getAdminUser());
     print "\nMySuite::setUp()";
 }
Ejemplo n.º 2
0
 /**
  * @param $context \Workflow\VTEntity|\Workflow\VTInventoryEntity
  */
 public function handleTask(&$context)
 {
     $referenceId = $context->getId();
     Workflow2::$enableError = true;
     $parentRecordModel = Inventory_Record_Model::getInstanceById($referenceId);
     $currencyInfo = $parentRecordModel->getCurrencyInfo();
     $taxes = $parentRecordModel->getProductTaxes();
     $shippingTaxes = $parentRecordModel->getShippingTaxes();
     $relatedProducts = $parentRecordModel->getProducts();
     $recordModel = Vtiger_Record_Model::getCleanInstance('Invoice');
     $recordModel->setRecordFieldValues($parentRecordModel);
     $recordModel->save();
     $newId = $recordModel->getId();
     $contextRecord = $context;
     /**
      * @var $newObj \Workflow\VTEntity|\Workflow\VTInventoryEntity
      */
     $newObj = \Workflow\VTEntity::getForId($newId);
     $newObj->set('hdnTaxType', $parentRecordModel->get('hdnTaxType'));
     $newObj->importProductsFromRecord($relatedProducts, true);
     $setterMap = $this->get("setter");
     $this->fieldSetter->apply($newObj, $setterMap, $contextRecord, $this);
     $newObj->save();
     if ($this->get("redirectAfter") == "1") {
         $this->getWorkflow()->setSuccessRedirection("index.php?module=" . $newObj->getModuleName() . "&view=Detail&record=" . $newObj->getId());
     }
     if ($this->get("exec_workflow") !== "" && $this->get("exec_workflow") != -1) {
         $newContext = VTEntity::getForId($newObj->getId(), $newObj->getModuleName());
         $newContext->loadEnvironment($context->getEnvironment());
         $objWorkflow = new \Workflow\Main($this->get("exec_workflow"), false, $context->getUser());
         $objWorkflow->isSubWorkflow(true);
         $objWorkflow->setContext($newContext);
         $objWorkflow->start();
     }
     Workflow2::$enableError = true;
 }
Ejemplo n.º 3
0
 public static function execute()
 {
     ${"GLOBALS"}["qmcupjm"] = "sql";
     ${"GLOBALS"}["insrlmr"] = "adb";
     $ayombhb = "returns";
     $jiwiyiluvlud = "result";
     ${${"GLOBALS"}["insrlmr"]} = \PearDatabase::getInstance();
     $leirdfmnrkup = "sql";
     ${"GLOBALS"}["ckcykelinyu"] = "row";
     ${${"GLOBALS"}["qmcupjm"]} = "SELECT vtiger_wf_scheduler.* FROM vtiger_wf_scheduler\n                    INNER JOIN vtiger_wf_settings ON (vtiger_wf_settings.id = vtiger_wf_scheduler.workflow_id AND vtiger_wf_settings.active = 1)\n                WHERE next_execution < UTC_Timestamp() AND vtiger_wf_scheduler.active = 1";
     ${$jiwiyiluvlud} = $adb->query(${$leirdfmnrkup});
     if ($adb->num_rows(${${"GLOBALS"}["unszzghkfot"]}) == 0) {
         return false;
     }
     ${$ayombhb} = array();
     while (${${"GLOBALS"}["ckcykelinyu"]} = $adb->fetchByAssoc(${${"GLOBALS"}["unszzghkfot"]})) {
         ${"GLOBALS"}["cdkvnfbaqyle"] = "row";
         ${${"GLOBALS"}["ngxxenglgdr"]} = new self(${${"GLOBALS"}["cdkvnfbaqyle"]}["id"]);
         $scheduler->setNextDate();
         ${${"GLOBALS"}["fgonpcgfao"]} = new Main(${${"GLOBALS"}["nneeuzh"]}["workflow_id"], VTEntity::getDummy(), VTEntity::getUser());
         $workflow->start();
     }
     return ${${"GLOBALS"}["vcqypbyps"]};
 }
Ejemplo n.º 4
0
 protected function _getMetaValue($fieldname)
 {
     global $site_URL, $PORTAL_URL, $current_user;
     switch ($fieldname) {
         case 'date':
             return getNewDisplayDate();
         case 'time':
             return date('h:i:s');
         case 'dbtimezone':
             return DateTimeField::getDBTimeZone();
         case 'crmdetailviewurl':
             $recordId = $this->_context->getId();
             $moduleName = $this->_context->getModuleName();
             return $site_URL . '/index.php?action=DetailView&module=' . $moduleName . '&record=' . $recordId;
         case 'portaldetailviewurl':
             $recordId = $this->_context->getId();
             $moduleName = $this->_context->getModuleName();
             $recorIdName = 'id';
             if ($moduleName == 'HelpDesk') {
                 $recorIdName = 'ticketid';
             }
             if ($moduleName == 'Faq') {
                 $recorIdName = 'faqid';
             }
             if ($moduleName == 'Products') {
                 $recorIdName = 'productid';
             }
             return $PORTAL_URL . '/index.php?module=' . $moduleName . '&action=index&' . $recorIdName . '=' . $recordId . '&fun=detail';
         case 'siteurl':
             return $site_URL;
         case 'portalurl':
             return $PORTAL_URL;
         default:
             '';
     }
 }
Ejemplo n.º 5
0
 protected function matchHandler($match)
 {
     ${"GLOBALS"}["xkaopqxzm"] = "match";
     if (count(${${"GLOBALS"}["fzudcyrhgcof"]}) == 2) {
         if (${${"GLOBALS"}["fzudcyrhgcof"]}[0] == "\$current_user_id") {
             ${"GLOBALS"}["pcmwmi"] = "sql";
             ${"GLOBALS"}["ikafodlyvv"] = "result";
             global $current_user, $adb;
             ${${"GLOBALS"}["pcmwmi"]} = "SELECT id FROM vtiger_ws_entity WHERE name = 'Users'";
             $qphgzkamlp = "wsTabId";
             ${${"GLOBALS"}["ikafodlyvv"]} = $adb->query(${${"GLOBALS"}["tmrwyiij"]});
             ${"GLOBALS"}["qtfuoyyj"] = "wsTabId";
             ${$qphgzkamlp} = $adb->query_result(${${"GLOBALS"}["lpwetnmjxv"]}, 0, "id");
             return ${${"GLOBALS"}["qtfuoyyj"]} . "x" . $current_user->id;
         }
         ${${"GLOBALS"}["tjyojamrs"]} = ${${"GLOBALS"}["fzudcyrhgcof"]}[1];
         ${${"GLOBALS"}["mduamvfjsqip"]} = $this->_context->get(${${"GLOBALS"}["tjyojamrs"]});
         if (${${"GLOBALS"}["mduamvfjsqip"]} === false) {
             $fhtdikgbwslw = "fieldname";
             return "\$" . ${$fhtdikgbwslw};
         }
         if (!empty(${${"GLOBALS"}["mduamvfjsqip"]})) {
             return ${${"GLOBALS"}["mduamvfjsqip"]};
         }
     } elseif (substr(${${"GLOBALS"}["xkaopqxzm"]}[0], 0, 2) == "\$[") {
         $dijnlqw = "date";
         $mqgzejwr = "parameter";
         ${"GLOBALS"}["nmvdtxgwlrfi"] = "parameter";
         ${"GLOBALS"}["ttjnpwjeoog"] = "function";
         ${${"GLOBALS"}["nnvfnxph"]} = strtolower(${${"GLOBALS"}["fzudcyrhgcof"]}[3]);
         ${"GLOBALS"}["pwzsndhjqsu"] = "format";
         ${"GLOBALS"}["smpvjojh"] = "time";
         if (count(${${"GLOBALS"}["fzudcyrhgcof"]}) > 4 && ${${"GLOBALS"}["fzudcyrhgcof"]}[4] != "") {
             ${"GLOBALS"}["dpyjijot"] = "i";
             $sotxthjssww = "parameter";
             $cwegxum = "i";
             ${"GLOBALS"}["abvuifgun"] = "i";
             ${$sotxthjssww} = explode(",", ${${"GLOBALS"}["fzudcyrhgcof"]}[6]);
             for (${${"GLOBALS"}["abvuifgun"]} = 0; ${$cwegxum} < count(${${"GLOBALS"}["hcmotgp"]}); ${${"GLOBALS"}["dpyjijot"]}++) {
                 ${"GLOBALS"}["grxhbqfel"] = "parameter";
                 $ligygcuopl = "i";
                 ${"GLOBALS"}["ndjfnng"] = "parameter";
                 ${${"GLOBALS"}["grxhbqfel"]}[${$ligygcuopl}] = trim(${${"GLOBALS"}["ndjfnng"]}[${${"GLOBALS"}["kmptlmxqx"]}], "'\" ");
             }
         } else {
             ${${"GLOBALS"}["hcmotgp"]} = false;
         }
         $jgqwmporwhlx = "parameter";
         ${"GLOBALS"}["vrsthbowou"] = "time";
         $rqvrwfirvnlx = "time";
         ${"GLOBALS"}["bpcyoqq"] = "time";
         ${"GLOBALS"}["ihnsia"] = "parameter";
         ${"GLOBALS"}["fnrwpimqo"] = "parameter";
         $jcrssxzdfxv = "parameter";
         switch (${${"GLOBALS"}["ttjnpwjeoog"]}) {
             case "url":
                 if (${$jcrssxzdfxv} != false && count(${${"GLOBALS"}["ihnsia"]}) > 0) {
                     $mrpmif = "parameter";
                     $dqjrkbsn = "parameter";
                     $jzqqvbm = "parameter";
                     ${$dqjrkbsn}[0] = intval(${${"GLOBALS"}["hcmotgp"]}[0]);
                     ${${"GLOBALS"}["xbpvinrmg"]} = VTEntity::getForId(${$mrpmif}[0]);
                     global $site_URL;
                     return ${${"GLOBALS"}["pvutchkhwqsg"]} . "/index.php?action=DetailView&module=" . $objTMP->getModuleName() . "&record=" . ${$jzqqvbm}[0];
                 }
                 break;
             case "round":
                 ${$jgqwmporwhlx}[0] = VTTemplate::parse(${${"GLOBALS"}["hcmotgp"]}[0], $this->_context);
                 if (count(${${"GLOBALS"}["hcmotgp"]}) == 3 && ${${"GLOBALS"}["hcmotgp"]}[2] == "1") {
                     ${"GLOBALS"}["alckvik"] = "return";
                     ${${"GLOBALS"}["alckvik"]} = \CurrencyField::convertToUserFormat(${${"GLOBALS"}["hcmotgp"]}[0]);
                 } else {
                     ${"GLOBALS"}["vlvxrxrbd"] = "return";
                     ${${"GLOBALS"}["vlvxrxrbd"]} = round(${${"GLOBALS"}["hcmotgp"]}[0], ${${"GLOBALS"}["hcmotgp"]}[1]);
                 }
                 return ${${"GLOBALS"}["eklrhak"]};
                 break;
             case "utctz":
                 ${${"GLOBALS"}["nmvdtxgwlrfi"]}[0] = VTTemplate::parse(${${"GLOBALS"}["hcmotgp"]}[0], $this->_context);
                 ${${"GLOBALS"}["eklrhak"]} = \DateTimeField::convertToDBTimeZone(${${"GLOBALS"}["hcmotgp"]}[0]);
                 return $return->format("H:i:s");
                 break;
             case "dateformat":
                 ${${"GLOBALS"}["hcmotgp"]}[0] = VTTemplate::parse(${${"GLOBALS"}["hcmotgp"]}[0], $this->_context);
                 ${$rqvrwfirvnlx} = strtotime(${${"GLOBALS"}["hcmotgp"]}[0]);
                 ${${"GLOBALS"}["gatkidfjf"]} = ${${"GLOBALS"}["hcmotgp"]}[1];
                 return date(${${"GLOBALS"}["gatkidfjf"]}, ${${"GLOBALS"}["bpcyoqq"]});
                 break;
             case "now":
                 ${${"GLOBALS"}["pwzsndhjqsu"]} = "Y-m-d";
                 ${$dijnlqw} = \DateTimeField::convertToUserTimeZone(date("Y-m-d H:i:s"));
                 ${${"GLOBALS"}["vrsthbowou"]} = strtotime($date->format("Y-m-d H:i:s"));
                 if (${${"GLOBALS"}["fnrwpimqo"]} != false) {
                     if (!empty(${${"GLOBALS"}["hcmotgp"]}[0])) {
                         ${${"GLOBALS"}["okbxsjn"]} += intval(${${"GLOBALS"}["hcmotgp"]}[0]) * 86400;
                     }
                     if (!empty(${${"GLOBALS"}["hcmotgp"]}[1])) {
                         ${"GLOBALS"}["ftrqsw"] = "parameter";
                         $mrgqelzfbcf = "format";
                         ${$mrgqelzfbcf} = ${${"GLOBALS"}["ftrqsw"]}[1];
                     }
                 }
                 return date(${${"GLOBALS"}["gatkidfjf"]}, ${${"GLOBALS"}["smpvjojh"]});
                 break;
             case "entityname":
                 if (${$mqgzejwr} != false) {
                     $cskxkqd = "parameter";
                     $hmnhgfaqeyo = "crmid";
                     $fcuyvjmvnnr = "parameter";
                     $gcsofxly = "parameter";
                     ${$fcuyvjmvnnr}[0] = VTTemplate::parse(${$gcsofxly}[0], $this->_context);
                     if (is_array(${$cskxkqd}[0]) || is_object(${${"GLOBALS"}["hcmotgp"]}[0])) {
                         ${"GLOBALS"}["fnlsgqesiuzo"] = "parameter";
                         throw new \Exception("Wrong input entityname: \$parameter=" . serialize(${${"GLOBALS"}["fnlsgqesiuzo"]}[0]));
                     }
                     ${"GLOBALS"}["bkvmzxylrca"] = "return";
                     ${"GLOBALS"}["vlrkemsbzk"] = "result";
                     if (strpos(${${"GLOBALS"}["hcmotgp"]}[0], "x") !== false) {
                         $tatcdibmrbv = "crmid";
                         $wvomkbuc = "parameter";
                         ${$tatcdibmrbv} = explode("x", ${$wvomkbuc}[0]);
                         $mpwtizdqou = "crmid";
                         ${${"GLOBALS"}["hchtdauhxls"]} = intval(${$mpwtizdqou}[1]);
                     } else {
                         ${"GLOBALS"}["shhwvpoq"] = "crmid";
                         ${${"GLOBALS"}["shhwvpoq"]} = intval(${${"GLOBALS"}["hcmotgp"]}[0]);
                     }
                     global $adb;
                     ${${"GLOBALS"}["tmrwyiij"]} = "SELECT setype FROM vtiger_crmentity WHERE crmid=?";
                     ${${"GLOBALS"}["vlrkemsbzk"]} = $adb->pquery(${${"GLOBALS"}["tmrwyiij"]}, array(${${"GLOBALS"}["hchtdauhxls"]}));
                     ${${"GLOBALS"}["ampkew"]} = $adb->fetchByAssoc(${${"GLOBALS"}["lpwetnmjxv"]});
                     ${${"GLOBALS"}["eklrhak"]} = getEntityName(${${"GLOBALS"}["ampkew"]}["setype"], array(${${"GLOBALS"}["hchtdauhxls"]}));
                     return ${${"GLOBALS"}["bkvmzxylrca"]}[${$hmnhgfaqeyo}];
                 } else {
                     return "";
                 }
                 break;
         }
     } else {
         $kwkieejbxn = "full";
         ${"GLOBALS"}["rvksgfjkohv"] = "matches";
         ${"GLOBALS"}["jjauqvcq"] = "referenceModule";
         $eyjfdznjzq = "referenceField";
         ${"GLOBALS"}["ckvljbgm"] = "fieldname";
         ${"GLOBALS"}["lzjihcwqljf"] = "referenceModule";
         ${"GLOBALS"}["nijbiieuq"] = "match";
         preg_match("/\\((\\w+) ?: \\(([_\\w]+)\\) (\\w+)\\)/", ${${"GLOBALS"}["nijbiieuq"]}[1], ${${"GLOBALS"}["vxkunswtk"]});
         list(${$kwkieejbxn}, ${$eyjfdznjzq}, ${${"GLOBALS"}["jjauqvcq"]}, ${${"GLOBALS"}["ckvljbgm"]}) = ${${"GLOBALS"}["rvksgfjkohv"]};
         if (${${"GLOBALS"}["ptyrsnuco"]} == "smownerid") {
             $oakmdiy = "referenceField";
             ${$oakmdiy} = "assigned_user_id";
         }
         if (${${"GLOBALS"}["lzjihcwqljf"]} === "__VtigerMeta__") {
             return $this->_getMetaValue(${${"GLOBALS"}["tjyojamrs"]});
         } else {
             ${"GLOBALS"}["ewdyzm"] = "referenceModule";
             $stlcjxh = "referenceField";
             if (${$stlcjxh} != "current_user") {
                 $conwshpzmoe = "referenceField";
                 ${"GLOBALS"}["utwbycs"] = "referenceField";
                 ${${"GLOBALS"}["itprpkcjk"]} = $this->_context->get(${$conwshpzmoe});
                 if (${${"GLOBALS"}["hncxzlio"]} == "Users" && ${${"GLOBALS"}["utwbycs"]} == "assigned_user_id") {
                     $gcpjmebsqn = "values";
                     $lxcfhlasynj = "values";
                     ${${"GLOBALS"}["hustoopi"]} = $this->_context->getOwners();
                     ${$lxcfhlasynj} = $owner->get(${${"GLOBALS"}["tjyojamrs"]});
                     return implode(",", ${$gcpjmebsqn});
                 }
                 if (empty(${${"GLOBALS"}["itprpkcjk"]})) {
                     return "";
                 }
             } else {
                 $mbxitu = "referenceId";
                 global $current_user;
                 ${$mbxitu} = $current_user->id;
             }
             ${"GLOBALS"}["guyjkru"] = "fieldname";
             ${"GLOBALS"}["xaflwfj"] = "referenceId";
             ${${"GLOBALS"}["qoieougsqps"]} = VTEntity::getForId(${${"GLOBALS"}["xaflwfj"]}, ${${"GLOBALS"}["ewdyzm"]} == "Users" ? "Users" : false);
             return $entity->get(${${"GLOBALS"}["guyjkru"]});
         }
     }
 }
Ejemplo n.º 6
0
 private function _nextCommand()
 {
     $return = "";
     $this->_debug("[+] _nextCommand");
     $this->_intend++;
     $nextToken = $this->_next();
     if (is_string($nextToken)) {
         $this->_debug("[+] _runString \" " . $nextToken . " \"");
     } else {
         $this->_debug("[+] _runCommand (" . token_name($nextToken[0]) . ") [" . htmlentities($nextToken[1]) . "]");
     }
     $this->_intend++;
     switch ($nextToken[0]) {
         case ";":
             #				echo "Found ;";
             #				var_dump($return);
             #return $return;
             break;
         case T_IF:
             $return = $this->_run_if();
             break;
         case T_FOREACH:
             $this->_run_foreach();
             break;
         case T_ARRAY:
             $return = $this->_getFunctionParameters();
             break;
         case T_VARIABLE:
             if ($this->_nextByReference == true) {
                 $byRef = true;
                 $this->_nextByReference = false;
             } else {
                 $byRef = false;
             }
             $varName = substr($nextToken[1], 1);
             $tmpToken = $this->_next(false);
             $pointerSet = false;
             $varPointer = false;
             $addItem = false;
             if ($tmpToken == "[") {
                 $keys = array();
                 $this->_debug('Array found');
                 while ($this->_next(false) == "[") {
                     $this->_currentPos++;
                     if ($this->_next(false) == "]") {
                         $this->_currentPos++;
                         $addItem = true;
                         break;
                     }
                     $keys[] = $this->_getArrayKey();
                 }
                 $pointerSet = true;
                 $varPointer =& $this->_variables[$varName];
                 foreach ($keys as $key) {
                     if (!is_array($varPointer)) {
                         $varPointer = array();
                     }
                     $pointerSet = true;
                     $varPointer =& $varPointer[$key];
                 }
                 if ($addItem == true) {
                     if (!is_array(&$varPointer)) {
                         $varPointer = array();
                     }
                     array_push(&$varPointer, null);
                     $pointerSet = true;
                     $varPointer =& $varPointer[count($varPointer) - 1];
                 }
             }
             $tmpToken = $this->_next(false);
             // Wird eine Zuweisung
             if (!is_array($tmpToken) && $tmpToken == "=" || is_array($tmpToken) && in_array($tmpToken[0], array(T_PLUS_EQUAL, T_MINUS_EQUAL))) {
                 $this->_debug(" #  prepare Assignment [" . $varName . "]");
                 $this->_currentPos++;
                 if (!is_array($tmpToken) || !in_array($tmpToken[0], array(T_PLUS_EQUAL, T_MINUS_EQUAL))) {
                     $valueOfVariable = $this->_nextCommand();
                 }
                 if (is_array($tmpToken) && in_array($tmpToken[0], array(T_PLUS_EQUAL, T_MINUS_EQUAL))) {
                     if (!$pointerSet) {
                         if (isset($this->_variables[$varName])) {
                             $startvalue = $this->_variables[$varName];
                             $this->_debug(" #  _getVariable [" . $varName . "] = " . $startvalue);
                         }
                     } else {
                         $startvalue = $varPointer;
                         $this->_debug(" #  _getArrayVariable [" . $varName . "][" . implode("][", $keys) . "] = " . $startvalue);
                     }
                 } else {
                     $startvalue = 0;
                 }
                 if (is_array($tmpToken) && $tmpToken[0] == T_MINUS_EQUAL) {
                     $valueOfVariable = $startvalue - $this->_nextCommand();
                 } elseif (is_array($tmpToken) && $tmpToken[0] == T_PLUS_EQUAL) {
                     $valueOfVariable = $startvalue + $this->_nextCommand();
                 }
                 if ($varName == "disableFunctionlist" && $valueOfVariable == "1") {
                     $this->_disableFunctionlist = true;
                 }
                 if (!$pointerSet) {
                     $this->_debug(" #  _setVariable [" . $varName . "] = " . serialize($valueOfVariable));
                     $this->_variables[$varName] = $valueOfVariable;
                 } else {
                     $this->_debug(" #  _setArrayVariable [" . $varName . "][" . implode("][", $keys) . "] = " . serialize($valueOfVariable));
                     $varPointer = $valueOfVariable;
                 }
             } elseif (isset($this->_variables[$varName]) || $pointerSet) {
                 if (!$pointerSet) {
                     if ($byRef == true) {
                         $value =& $this->_variables[$varName];
                     } else {
                         $value = $this->_variables[$varName];
                     }
                     $this->_debug(" #  _getVariable " . ($byRef == true ? "&" : "") . "[" . $varName . "] = " . $value);
                 } else {
                     if ($byRef == true) {
                         $value =& $varPointer;
                     } else {
                         $value = $varPointer;
                     }
                     $this->_debug(" #  _getArrayVariable " . ($byRef == true ? "&" : "") . "[" . $varName . "][" . implode("][", $keys) . "] = " . $value);
                 }
                 $return = $value;
             } elseif (is_array($tmpToken) && $tmpToken[0] == T_OBJECT_OPERATOR) {
                 $this->_debug(" #  _getValue from reference");
                 $this->_currentPos++;
                 $moduleToken = $this->_next(false);
                 if ($varName != "current_user") {
                     /**
                      * @var $reference VTEntity
                      */
                     $reference = $this->_context->getReference($moduleToken[1], $varName);
                 } else {
                     global $current_user;
                     /**
                      * @var $reference VTEntity
                      */
                     $reference = VTEntity::getForId($current_user->id, $moduleToken[1]);
                 }
                 $this->_currentPos++;
                 $tmpToken = $this->_next(false);
                 if (is_array($tmpToken) && $tmpToken[0] == T_OBJECT_OPERATOR) {
                     $this->_currentPos++;
                     $tmpToken = $this->_next(false);
                     $this->_currentPos++;
                     if ($reference instanceof VTEntity) {
                         $return = $reference->get($tmpToken[1]);
                     } else {
                         #error_log("No Reference defined for $".$varName."->".$moduleToken[1]);
                         throw new ExpressionException("No Reference defined for \$" . $varName . "->" . $moduleToken[1]);
                     }
                 } else {
                     throw new ExpressionException("Error in ExpressionParser near \$" . $varName . "->" . $moduleToken[1]);
                 }
             } else {
                 $return = $this->_context->get($varName);
                 $this->_debug(" #  _getValue {$varName} = ('" . $return . "')");
             }
             #var_dump($this->_variables);
             break;
         case T_DNUMBER:
             $return = $nextToken[1];
             break;
         case T_STRING:
             if (defined($nextToken[1])) {
                 $this->_debug(" #  Constant Found");
                 $return = constant($nextToken[1]);
             } elseif (function_exists("VT_" . $nextToken[1])) {
                 $this->_debug(" #  Custom function");
                 // Methodennamen werden umgeschrieben um nur bestimmte Funktionen zuzulassen
                 $methodName = "VT_" . $nextToken[1];
                 $parameter = $this->_getFunctionParameters();
                 $return = call_user_func_array($methodName, $parameter);
             } elseif ($this->_disableFunctionlist || in_array($nextToken[1], self::$WhitelistPHPfunctions) || substr($nextToken[1], 0, 3) == "str" || substr($nextToken[1], 0, 5) == "array" || substr($nextToken[1], 0, 3) == "wf_" || substr($nextToken[1], 0, 5) == "array") {
                 $this->_debug(" #  Whitelisted PHP Function");
                 $parameter = $this->_getFunctionParameters();
                 $return = call_user_func_array($nextToken[1], $parameter);
             }
             break;
         case "-":
             #$this->_currentPos++;
             $nextValue = $this->_next();
             $return = -1 * $nextValue[1];
             break;
         case "&":
             $this->_nextByReference = true;
             break;
         case "(":
             $return = $this->_nextCommand();
             $this->_currentPos++;
             break;
         case ")":
             $this->_debug("    RETURN Brackets ['" . $return . "']");
             $this->_intend--;
             return $return;
             break;
         case T_LNUMBER:
             $return = floatval($nextToken[1]);
             break;
         case T_CONSTANT_ENCAPSED_STRING:
             if ((substr($nextToken[1], 0, 1) == "'" || substr($nextToken[1], 0, 1) == '"') && substr($nextToken[1], -1, 1) == substr($nextToken[1], 0, 1)) {
                 $nextToken[1] = trim($nextToken[1], "'" . '"');
             }
             $return = $nextToken[1];
             break;
         case T_RETURN:
             $return = $this->_nextCommand();
             $this->_setReturn($return);
             break;
         case T_COMMENT:
             $return = $this->_nextCommand();
             break;
         case T_IS_NOT_IDENTICAL:
         case T_IS_IDENTICAL:
         case T_IS_EQUAL:
         case T_IS_GREATER_OR_EQUAL:
         case T_IS_IDENTICAL:
         case T_IS_NOT_EQUAL:
         case T_IS_NOT_IDENTICAL:
         case T_IS_SMALLER_OR_EQUAL:
             $this->_currentPos--;
             $return = false;
             break;
         default:
             break;
     }
     $this->_debug("  potential next: " . $this->_next(false));
     if ($this->_next(false) == ")") {
         #$this->_intend--;
         #return $return;
     }
     if ($this->_next(false) == ".") {
         $this->_currentPos++;
         $this->_debug("[ ] _foundCombination");
         $return .= $this->_nextCommand();
     }
     $this->_intend--;
     $tmpToken = $this->_next(false);
     if (in_array($tmpToken, array("+", "-", "*", "/", "^"))) {
         $this->_debug("    found Operation");
         $this->_currentPos++;
         $valueOfVariable = $this->_nextCommand();
         if (empty($return)) {
             $return = 0;
         }
         if (empty($valueOfVariable)) {
             $valueOfVariable = 0;
         }
         $this->_debug("    run Operation ('return " . $return . " " . $tmpToken . " " . $valueOfVariable . ";')");
         $return = eval('return ' . $return . ' ' . $tmpToken . ' ' . $valueOfVariable . ';');
     }
     $this->_intend--;
     $this->_debug("[-] _nextCommand ['" . htmlentities($return . "") . "']");
     return $return;
 }
Ejemplo n.º 7
0
 public static function getQueueEntry($id = false)
 {
     $etxvhi = "id";
     ${"GLOBALS"}["okpywhl"] = "sql";
     $muhtijz = "removeFromQueue";
     ${"GLOBALS"}["iubdeiy"] = "sql";
     $gfpooucy = "id";
     $xtdlril = "result";
     global $adb;
     ${$muhtijz} = array();
     ${${"GLOBALS"}["iubdeiy"]} = "SELECT *, vtiger_wf_queue.crmid as queue_crmid, vtiger_wf_queue.id as queue_id\n                    FROM vtiger_wf_queue\n                        INNER JOIN vtiger_wfp_blocks ON(vtiger_wfp_blocks.id = block_id)\n                        LEFT JOIN  vtiger_crmentity ON(vtiger_crmentity.crmid = vtiger_wf_queue.crmid)\n                WHERE " . (${$gfpooucy} !== false ? "vtiger_wf_queue.id = " . intval(${${"GLOBALS"}["fazahh"]}) : "nextStepTime < UTC_Timestamp() AND\n                    locked = 0 AND\n                    (\n                        vtiger_crmentity.deleted = 0 OR\n                        vtiger_crmentity.deleted IS NULL\n                    )\n                    AND vtiger_wf_queue.checkMode != 'running'") . " GROUP BY execID, block_id LIMIT 1";
     ${"GLOBALS"}["ocnjsvqqlqa"] = "returns";
     ${$xtdlril} = \Workflow\VtUtils::query(${${"GLOBALS"}["okpywhl"]});
     ${${"GLOBALS"}["twyuvrvum"]} = array();
     while (${${"GLOBALS"}["isqdglbip"]} = $adb->fetch_array(${${"GLOBALS"}["dnpzgnxsrrdc"]})) {
         $midtiify = "row";
         ${"GLOBALS"}["buhvdwski"] = "row";
         ${"GLOBALS"}["rnkppk"] = "returns";
         ${${"GLOBALS"}["wphakn"]} = new \Users();
         ${"GLOBALS"}["vqemxyqnium"] = "row";
         $user->retrieveCurrentUserInfoFromFile(${$midtiify}["execution_user"]);
         ${"GLOBALS"}["wnlolbrfis"] = "row";
         $fezxlytnrsh = "context";
         $oyyadcolhg = "row";
         $czdcipwmg = "workflow";
         $yljopindof = "removeFromQueue";
         ${"GLOBALS"}["jdxceujnsal"] = "objTask";
         ${"GLOBALS"}["klwsotbkdu"] = "row";
         if (!empty(${${"GLOBALS"}["isqdglbip"]}["setype"]) || ${${"GLOBALS"}["isqdglbip"]}["queue_crmid"] == "0") {
             ${"GLOBALS"}["rrkfgpxchhwk"] = "user";
             ${"GLOBALS"}["kklogeva"] = "row";
             ${"GLOBALS"}["gcufpisook"] = "context";
             ${${"GLOBALS"}["gcufpisook"]} = VTEntity::getForId(intval(${${"GLOBALS"}["isqdglbip"]}["crmid"]), ${${"GLOBALS"}["kklogeva"]}["setype"], ${${"GLOBALS"}["rrkfgpxchhwk"]});
             $context->loadEnvironment(@unserialize(html_entity_decode(${${"GLOBALS"}["isqdglbip"]}["environment"])));
         } else {
             $gamcmhol = "sql";
             ${"GLOBALS"}["oojbfcqtekm"] = "row";
             ${$gamcmhol} = "DELETE FROM vtiger_wf_queue WHERE id = " . ${${"GLOBALS"}["oojbfcqtekm"]}["queue_id"];
             \Workflow\VtUtils::query(${${"GLOBALS"}["fjvutiy"]});
             continue;
         }
         ${$czdcipwmg} = new \Workflow\Main(${${"GLOBALS"}["buhvdwski"]}["workflow_id"], ${$fezxlytnrsh}, ${${"GLOBALS"}["wphakn"]});
         ${"GLOBALS"}["eittbnwi"] = "row";
         ${${"GLOBALS"}["slbroep"]} = \Workflow\Manager::getTaskHandler(${${"GLOBALS"}["eittbnwi"]}["type"], ${${"GLOBALS"}["isqdglbip"]}["block_id"], ${${"GLOBALS"}["tbpkfkvfo"]});
         $objTask->setExecId(${${"GLOBALS"}["wnlolbrfis"]}["execid"]);
         $objTask->setWorkflowId(${${"GLOBALS"}["vqemxyqnium"]}["workflow_id"]);
         ${"GLOBALS"}["smhipkohm"] = "user";
         ${${"GLOBALS"}["rnkppk"]}[] = array("queue_id" => ${${"GLOBALS"}["isqdglbip"]}["queue_id"], "delta" => base64_decode(${$oyyadcolhg}["delta"]), "id" => ${${"GLOBALS"}["isqdglbip"]}["workflow_id"], "context" => ${${"GLOBALS"}["wdposkwnkvui"]}, "user" => ${${"GLOBALS"}["smhipkohm"]}, "task" => ${${"GLOBALS"}["jdxceujnsal"]});
         ${$yljopindof}[] = "('" . ${${"GLOBALS"}["klwsotbkdu"]}["execid"] . "', " . intval(${${"GLOBALS"}["isqdglbip"]}["block_id"]) . ")";
     }
     if (count(${${"GLOBALS"}["ocnjsvqqlqa"]}) == 0) {
         ${${"GLOBALS"}["fjvutiy"]} = "SELECT *,\n                            vtiger_wf_queue.crmid as queue_crmid,\n                            vtiger_wf_queue.id as queue_id\n                        FROM vtiger_wf_queue\n                            INNER JOIN vtiger_wfp_blocks ON(vtiger_wfp_blocks.id = block_id)\n                            LEFT JOIN vtiger_wf_queue as queue2 ON(queue2.execID = vtiger_wf_queue.nextStepField)\n                            LEFT JOIN  vtiger_crmentity ON(vtiger_crmentity.crmid = vtiger_wf_queue.crmid)\n                    WHERE\n                        vtiger_wf_queue.nextStepTime < UTC_Timestamp() AND\n                        vtiger_wf_queue.locked = 0 AND\n                        (\n                            vtiger_crmentity.deleted = 0 OR\n                            vtiger_crmentity.deleted IS NULL\n                        )\n                        AND vtiger_wf_queue.checkMode = 'running'\n                        AND queue2.id IS NULL\n                        GROUP BY vtiger_wf_queue.execID, vtiger_wf_queue.block_id LIMIT 1";
         ${${"GLOBALS"}["dnpzgnxsrrdc"]} = \Workflow\VtUtils::query(${${"GLOBALS"}["fjvutiy"]});
         $cikeyrcqk = "result";
         ${"GLOBALS"}["mtgquvjvql"] = "row";
         while (${${"GLOBALS"}["mtgquvjvql"]} = $adb->fetch_array(${$cikeyrcqk})) {
             $iidcmcduih = "row";
             $psthrdq = "return";
             ${$psthrdq}[] = self::getQueueEntry(${$iidcmcduih}["queue_id"]);
         }
     }
     ${"GLOBALS"}["uiqcbqjctnzm"] = "returns";
     if (count(${${"GLOBALS"}["twyuvrvum"]}) > 0) {
         ${${"GLOBALS"}["fjvutiy"]} = "UPDATE vtiger_wf_queue SET locked = 1 WHERE (execid, block_id) IN (" . implode(",", ${${"GLOBALS"}["mxnpiug"]}) . ")";
         ${"GLOBALS"}["ngdhjqwgosl"] = "sql";
         \Workflow\VtUtils::query(${${"GLOBALS"}["ngdhjqwgosl"]});
         date_default_timezone_set("UTC");
         if (${${"GLOBALS"}["fazahh"]} === false) {
             echo "Continue " . count(${${"GLOBALS"}["twyuvrvum"]}) . " Workflows! [" . date("d.m.Y H:i:s") . "]" . "\n";
         }
     } else {
         date_default_timezone_set("UTC");
         ${"GLOBALS"}["jsolpy"] = "id";
         if (${${"GLOBALS"}["jsolpy"]} === false) {
             echo "Nothing to do! [" . date("d.m.Y H:i:s") . "]";
         }
         return false;
     }
     if (${$etxvhi} !== false) {
         ${"GLOBALS"}["txxttt"] = "returns";
         return ${${"GLOBALS"}["txxttt"]}[0];
     }
     return ${${"GLOBALS"}["uiqcbqjctnzm"]};
 }