Пример #1
0
 public function handleTask(&$context)
 {
     $context->save();
     if (!wfIsCli()) {
         $settings = $this->getWorkflow()->getSettings();
         $title = $this->getTitle();
         if (empty($title)) {
             $title = "no title";
         }
         echo "" . sprintf(getTranslatedString("TXT_EXIT_INFO", "Workflow2"), $settings["title"], $title) . "";
         exit;
     } else {
         return false;
     }
 }
Пример #2
0
 public static function error_handler($errno = "", $errstr = "", $errfile = "", $errline = "")
 {
     $zxslshktqz = "html";
     ${"GLOBALS"}["xboekqcqm"] = "errno";
     ${"GLOBALS"}["mfgxjg"] = "html";
     ${"GLOBALS"}["glxgfbgigzku"] = "html";
     $uedscllpsvlr = "typestr";
     $thmqjfmfpw = "typestr";
     ${"GLOBALS"}["dkqevjsalgi"] = "errno";
     ${"GLOBALS"}["juewps"] = "typestr";
     global $current_user;
     ${"GLOBALS"}["nlobacmlu"] = "html";
     if (error_reporting() == 0) {
     }
     if (${${"GLOBALS"}["dkqevjsalgi"]} === 8) {
         return;
     }
     ${"GLOBALS"}["tpuuspn"] = "errstr";
     if (is_object(${${"GLOBALS"}["twoweeievgm"]})) {
         ${"GLOBALS"}["pxzbxjo"] = "errfile";
         $tpchwbjnrtz = "errstr";
         ${${"GLOBALS"}["jsvfdsfh"]} = $errno->getLine();
         ${${"GLOBALS"}["pxzbxjo"]} = $errno->getFile();
         $rlyjxlj = "errno";
         ${$tpchwbjnrtz} = $errno->getMessage();
         ${${"GLOBALS"}["gqqzlivz"]} = $errno->getTrace();
         ${$rlyjxlj} = E_ERROR;
     }
     ${"GLOBALS"}["lqwwegyxqvq"] = "errno";
     ${"GLOBALS"}["wwhducoegfhj"] = "errline";
     ${"GLOBALS"}["oonyfhjc"] = "typestr";
     ${"GLOBALS"}["ikskblbjdyqm"] = "typestr";
     ${${"GLOBALS"}["nnxpesshwam"]} = \PearDatabase::getInstance();
     if (!empty($adb->database->_connectionID->error)) {
         $drfqzsarfm = "errstr";
         ${$drfqzsarfm} .= "<br/><br/>" . $adb->database->_connectionID->error;
         ${${"GLOBALS"}["pmliottx"]} .= serialize(${${"GLOBALS"}["nnxpesshwam"]});
     }
     ${"GLOBALS"}["mxrwfqjv"] = "currentBlockObj";
     ${"GLOBALS"}["epitxtaom"] = "html";
     ${"GLOBALS"}["kqrcfjwiiaaf"] = "html";
     if (Workflow2::${${"GLOBALS"}["lyksdalu"]} == false) {
         return false;
     }
     $boxfsxrhhy = "html";
     switch (${${"GLOBALS"}["twoweeievgm"]}) {
         case "REFERENCE_INVALID":
         case "MANDATORY_FIELDS_MISSING":
         case "ACCESS_DENIED":
             ${${"GLOBALS"}["lywuyikoio"]} = ${${"GLOBALS"}["twoweeievgm"]};
             break;
         case E_ERROR:
             ${${"GLOBALS"}["lywuyikoio"]} = "E_ERROR";
             break;
         case E_PARSE:
             ${${"GLOBALS"}["lywuyikoio"]} = "E_PARSE";
             break;
         case E_CORE_ERROR:
             ${${"GLOBALS"}["lywuyikoio"]} = "E_CORE_ERROR";
             break;
         case E_CORE_WARNING:
             ${${"GLOBALS"}["lywuyikoio"]} = "E_CORE_WARNING";
             break;
         case E_COMPILE_ERROR:
             ${${"GLOBALS"}["juewps"]} = "E_COMPILE_ERROR";
             break;
         case E_CORE_WARNING:
             ${$uedscllpsvlr} = "E_COMPILE_WARNING";
             break;
         case E_USER_ERROR:
             ${${"GLOBALS"}["ikskblbjdyqm"]} = "E_USER_ERROR";
             break;
         case E_USER_WARNING:
             ${${"GLOBALS"}["oonyfhjc"]} = "E_USER_WARNING";
             break;
         case E_RECOVERABLE_ERROR:
             ${${"GLOBALS"}["lywuyikoio"]} = "E_RECOVERABLE_ERROR";
             break;
         case E_EXPRESSION_ERROR:
             ${$thmqjfmfpw} = "E_EXPRESSION_ERROR";
             break;
         case E_NONBREAK_ERROR:
             ${${"GLOBALS"}["lywuyikoio"]} = "E_NONBREAK_ERROR";
             break;
         default:
             return true;
     }
     ${${"GLOBALS"}["mfgxjg"]} = "<html>";
     ${${"GLOBALS"}["glxgfbgigzku"]} .= "<body style='font-family:Arial;'>";
     ${$zxslshktqz} .= "<h2>Workflow2 Error occurred [" . Workflow2::VERSION . "]</h2>";
     ${${"GLOBALS"}["bcgwqrfkwi"]} .= "<table style='font-size:14px;font-family:Courier;'>";
     ${$boxfsxrhhy} .= "<tr><td width=100>ERROR:</td><td><strong>" . ${${"GLOBALS"}["lywuyikoio"]} . "</strong></td></tr>";
     ${${"GLOBALS"}["epitxtaom"]} .= "<tr><td>LOCATION:</td><td><em>" . ${${"GLOBALS"}["nkwnskowfm"]} . " [" . ${${"GLOBALS"}["wwhducoegfhj"]} . "]</td></tr>";
     ${${"GLOBALS"}["nlobacmlu"]} .= "<tr><td>Last Block:</td><td><em>" . Workflow2::${${"GLOBALS"}["gzmpicl"]} . "</td></tr>";
     if (is_object(Workflow2::${${"GLOBALS"}["mxrwfqjv"]})) {
         $xoibeexo = "wfId";
         $iupfnkgskt = "currentBlock";
         $heerhomdboi = "currentBlock";
         ${"GLOBALS"}["dspzbdt"] = "wfId";
         ${${"GLOBALS"}["dspzbdt"]} = Workflow2::$currentBlockObj->getWorkflowId();
         ${${"GLOBALS"}["bcgwqrfkwi"]} .= "<tr><td>Current Block:</td><td><a href='" . vglobal("site_URL") . "/index.php?module=Workflow2&view=Config&parent=Settings&workflow=" . ${$xoibeexo} . "'>WF " . Workflow2::$currentBlockObj->getWorkflowId() . "</a> - <a href='" . vglobal("site_URL") . "/index.php?module=Workflow2&parent=Settings&view=TaskConfig&taskid=" . Workflow2::${$heerhomdboi} . "'><em>Block " . Workflow2::${$iupfnkgskt} . "</a></td></tr>";
     } else {
         $yxnhgamlo = "currentBlock";
         ${${"GLOBALS"}["bcgwqrfkwi"]} .= "<tr><td>Current Block:</td><td><a href='" . vglobal("site_URL") . "/index.php?module=Workflow2&parent=Settings&view=TaskConfig&taskid=" . Workflow2::${$yxnhgamlo} . "'><em>Block " . Workflow2::${${"GLOBALS"}["hjepztr"]} . "</a></td></tr>";
     }
     ${${"GLOBALS"}["bcgwqrfkwi"]} .= "</table>";
     ${${"GLOBALS"}["bcgwqrfkwi"]} .= "<br>";
     ${${"GLOBALS"}["kqrcfjwiiaaf"]} .= ${${"GLOBALS"}["tpuuspn"]};
     if ($current_user->is_admin == "on") {
         ${${"GLOBALS"}["bcgwqrfkwi"]} .= "<br><br><pre>" . substr(print_r(isset(${${"GLOBALS"}["gqqzlivz"]}) ? ${${"GLOBALS"}["gqqzlivz"]} : debug_backtrace(), true), 0, 10000) . "</pre>";
     }
     ${${"GLOBALS"}["bcgwqrfkwi"]} .= "</body>";
     ${${"GLOBALS"}["bcgwqrfkwi"]} .= "</html>";
     if (${${"GLOBALS"}["xboekqcqm"]} != E_NONBREAK_ERROR) {
         echo "<br><br><strong>The Systemadministrator has been notified!</strong>";
         if (php_sapi_name() == "cli" && empty($_SERVER["REMOTE_ADDR"])) {
             $wztouxewoxg = "html";
             echo strip_tags(str_replace("</tr>", "\n", ${$wztouxewoxg}));
         } else {
             echo ${${"GLOBALS"}["bcgwqrfkwi"]};
         }
     }
     if (is_object(self::${${"GLOBALS"}["tbqjwgajpr"]})) {
         ${"GLOBALS"}["hgcpks"] = "sql";
         $ltrvirquaxf = "typestr";
         ${"GLOBALS"}["rullypv"] = "errstr";
         ${${"GLOBALS"}["hgcpks"]} = "INSERT INTO vtiger_wf_errorlog SET block_id = " . intval(Workflow2::${${"GLOBALS"}["hjepztr"]}) . ", text = ?, workflow_id = ?";
         global $adb;
         $adb->pquery(${${"GLOBALS"}["wpvlkaycsb"]}, array(${$ltrvirquaxf} . " # " . ${${"GLOBALS"}["rullypv"]}, self::$currentBlockObj->getWorkflowId()));
     }
     set_include_path(dirname(__FILE__) . "/../../" . PATH_SEPARATOR . get_include_path());
     if (defined("ERROR_HANDLER")) {
         if (constant("ERROR_HANDLER") == "email") {
             $uctwsbxmn = "errorMail";
             ${$uctwsbxmn} = constant("ERROR_HANDLER_VALUE");
             ${"GLOBALS"}["zvrlosxm"] = "errorMail";
             if (empty(${${"GLOBALS"}["zvrlosxm"]})) {
                 ${${"GLOBALS"}["vlxqookbyem"]} = \Users::getActiveAdminUser();
                 ${${"GLOBALS"}["dhlyfml"]} = $adminUser->column_fields["email1"];
             }
         } elseif (constant("ERROR_HANDLER") == "file") {
             ${"GLOBALS"}["knmrkjltmi"] = "currentBlock";
             error_log(${${"GLOBALS"}["pmliottx"]} . " # - # Block: " . Workflow2::${${"GLOBALS"}["knmrkjltmi"]} . " # -\n", 3, constant("ERROR_HANDLER_VALUE"));
         }
     }
     if (!defined("WF_DEMO_MODE") || constant("WF_DEMO_MODE") != true) {
         ${"GLOBALS"}["wxiehnwe"] = "errorMail";
         require_once "modules/Emails/mail.php";
         $xfidny = "to_email";
         if (!class_exists("Workflow_PHPMailer")) {
             require_once "modules/Workflow2/phpmailer/class.phpmailer.php";
         }
         ${"GLOBALS"}["rwxevbhvzdl"] = "errorMail";
         ${$xfidny} = trim(${${"GLOBALS"}["wxiehnwe"]}, ",");
         $jhhssnhww = "html";
         ${${"GLOBALS"}["buscjzx"]} = array();
         if (strpos(${${"GLOBALS"}["chwolsutzxsr"]}, ";") !== false) {
             $wikeps = "mails";
             ${$wikeps} = explode(";", ${${"GLOBALS"}["chwolsutzxsr"]});
             $oiuuxhhtyoh = "address";
             $npqvob = "mails";
             foreach (${$npqvob} as ${$oiuuxhhtyoh}) {
                 $lixdtmhjtqhr = "to";
                 ${$lixdtmhjtqhr}[] = ${${"GLOBALS"}["tqpkvmfwbj"]};
             }
         } else {
             $xywinhspgvrz = "to_email";
             ${${"GLOBALS"}["buscjzx"]}[] = ${$xywinhspgvrz};
         }
         send_mail("Workflow2", ${${"GLOBALS"}["chwolsutzxsr"]}, "Workflow Designer", ${${"GLOBALS"}["rwxevbhvzdl"]}, "Workflow2 Error occurred", ${$jhhssnhww});
     }
     if (wfIsCli()) {
         return true;
     }
     if (${${"GLOBALS"}["lqwwegyxqvq"]} != E_NONBREAK_ERROR) {
         exit;
     }
     return true;
 }
Пример #3
0
 public function handleExecutionStack()
 {
     ${"GLOBALS"}["vvdwifv"] = "sql";
     $ysboqcvvmqn = "sql";
     $yefjmqvhk = "result";
     global $adb;
     while (!$this->isEmptyExecutionStack()) {
         $vuwbyhrzj = "task";
         ${"GLOBALS"}["kifmpg"] = "sql";
         ${"GLOBALS"}["ufxsnqd"] = "currentBlockObj";
         $dbjqipfn = "sql";
         $vogwmjujihl = "return";
         ${$vuwbyhrzj} = $this->popExecutionStack();
         ${"GLOBALS"}["xqmksmwa"] = "currentBlock";
         ${"GLOBALS"}["nttgkbbdy"] = "start";
         $this->_execID = $task->getExecId();
         $bkfdycqd = "return";
         if (wfIsCli()) {
             echo "Start Block WF " . $this->_workflowID . " - " . $task->getBlockId() . "\n";
         }
         $task->setWorkflowId($this->_workflowID);
         ${${"GLOBALS"}["nttgkbbdy"]} = microtime(true);
         $this->_runCounter++;
         Workflow2::log($this->_context->getWsId(), $this->_workflowID, $task->getBlockId(), "  Start Block");
         Workflow2::${${"GLOBALS"}["xqmksmwa"]} = $task->getBlockId();
         $xqytwvo = "prevTask";
         Workflow2::${${"GLOBALS"}["ufxsnqd"]} = ${${"GLOBALS"}["xvljlxgvcmv"]};
         ${$bkfdycqd} = $task->handleTask($this->_context);
         if ($this->_context->getId() != $this->_origContextID) {
             ${"GLOBALS"}["iyyhcrfps"] = "task";
             throw new \Exception("A task [ID" . $task->getBlockId() . "] manipulate the Workflow Context Record. This is a bug. Please report and attach: [ERR13," . $this->_context->getId() . "," . $this->_origContextID . "," . get_class(${${"GLOBALS"}["iyyhcrfps"]}) . "]!");
         }
         Workflow2::${${"GLOBALS"}["crlzdxnru"]} = $task->getBlockId();
         Workflow2::log($this->_context->getWsId(), $this->_workflowID, $task->getBlockId(), "  Finish Block");
         ${${"GLOBALS"}["rkikzcpnm"]} = $task->getStat();
         if (!empty(${${"GLOBALS"}["rkikzcpnm"]})) {
             ${${"GLOBALS"}["qyhcfvm"]} = gzcompress(serialize(${${"GLOBALS"}["rkikzcpnm"]}), 4);
         } else {
             ${"GLOBALS"}["hehckanlbyo"] = "statBlob";
             ${${"GLOBALS"}["hehckanlbyo"]} = "";
         }
         ${${"GLOBALS"}["axeidqrnp"]} = $task->getPrevTask();
         ${$dbjqipfn} = "INSERT INTO vtiger_wf_log SET durationms = ?, execID = ?, blockID = ?, workflow_id = ?, timestamp = NOW(), lastBlockID = ?, crmid = ?, lastBlockOutput = ?, `data` = ?";
         $adb->pquery(${${"GLOBALS"}["kifmpg"]}, array((microtime(true) - ${${"GLOBALS"}["skvipzgj"]}) * 1000, $task->getExecId(), $task->getBlockId(), $this->_workflowID, ${$xqytwvo} != false ? $prevTask->getBlockId() : $task->getBlockId(), $this->_context->getId(), $task->getPrevOutput(), ${${"GLOBALS"}["qyhcfvm"]}));
         if (${$vogwmjujihl} !== false) {
             $whxsmcdtqed = "return";
             $xnsoymy = "return";
             ${"GLOBALS"}["yqvlat"] = "return";
             ${"GLOBALS"}["pvclrbbyo"] = "return";
             $vzqmrtbjeduk = "return";
             if (empty(${${"GLOBALS"}["pkdopgvbw"]})) {
                 ${${"GLOBALS"}["yqvlat"]} = false;
             }
             if (!is_array(${${"GLOBALS"}["pkdopgvbw"]}) && ${$whxsmcdtqed} !== false) {
                 ${$xnsoymy} = array(${${"GLOBALS"}["pvclrbbyo"]});
             }
             if (isset($_COOKIE["stefanDebug"]) && $_COOKIE["stefanDebug"] >= "1") {
                 ${"GLOBALS"}["jfpyigb"] = "return";
                 echo "Result:";
                 var_dump(${${"GLOBALS"}["jfpyigb"]});
                 echo "<br>";
             }
             if (!empty(${$vzqmrtbjeduk}["delay"])) {
                 $rvecnbracqp = "return";
                 ${"GLOBALS"}["slmjepijkss"] = "return";
                 $nxgntcyeqxsw = "return";
                 Queue::addEntry(${${"GLOBALS"}["xvljlxgvcmv"]}, $this->_user, $this->_context, ${${"GLOBALS"}["slmjepijkss"]}["checkmode"], ${$nxgntcyeqxsw}["delay"], !empty(${${"GLOBALS"}["pkdopgvbw"]}["locked"]) ? 1 : 0, !empty(${$rvecnbracqp}["field"]) ? ${${"GLOBALS"}["pkdopgvbw"]}["field"] : false);
                 continue;
             }
             if ($this->_runCounter < 150) {
                 $anxjxoorxli = "return";
                 ${"GLOBALS"}["vejlujbsbrts"] = "nextTasks";
                 ${${"GLOBALS"}["fkglgqgrnv"]} = $task->getNextTasks(${$anxjxoorxli});
                 ${${"GLOBALS"}["fkglgqgrnv"]} = array_reverse(${${"GLOBALS"}["vejlujbsbrts"]});
                 foreach (${${"GLOBALS"}["fkglgqgrnv"]} as ${${"GLOBALS"}["dnhhev"]}) {
                     $ssztcc = "nextTask";
                     $this->pushExecutionStack(${$ssztcc});
                 }
             }
         }
     }
     ${${"GLOBALS"}["vvdwifv"]} = "SELECT id FROM vtiger_wf_queue WHERE execID = '" . $this->_execID . "'";
     ${$yefjmqvhk} = $adb->query(${$ysboqcvvmqn}, true);
     if ($adb->num_rows(${${"GLOBALS"}["jegtsurybn"]}) == 0) {
         $this->_context->unlinkTempFiles($this->_execID);
     }
     $this->_context->save();
     restore_error_handler();
 }