public function init()
 {
     $this->addPreset("Attachments", "files", array('module' => $this->getModuleName()));
     /* Insert here source code to execute the task */
     $additionalPath = $this->getAdditionalPath('c_googlecloudprint');
     global $currentBlockID;
     $currentBlockID = $this->getBlockId();
     $urlconfig = $redirectConfig = $offlineAccessConfig = array();
     require_once $additionalPath . "/Config.php";
     require_once $additionalPath . "/GoogleCloudPrint.php";
     $tokenFilename = $additionalPath . "token/tokenSession3_" . $currentBlockID;
     $this->gcp = new GoogleCloudPrint();
     if (!empty($_REQUEST["code"])) {
         $code = $_REQUEST['code'];
         $authConfig['code'] = $code;
         $responseObj = $this->gcp->getAccessToken($urlconfig['accesstoken_url'], $authConfig);
         file_put_contents($tokenFilename, serialize(array('accessToken' => $responseObj)));
         echo '<script type="text/javascript">window.location.href="index.php?module=Workflow2&parent=Settings&view=TaskConfig&taskid=' . $this->getBlockId() . '&done=1";</script>';
         exit;
     }
     if (file_exists($tokenFilename)) {
         $sessionToken = unserialize(file_get_contents($tokenFilename));
         if (!empty($sessionToken['accessToken']->refresh_token)) {
             $refreshTokenConfig['refresh_token'] = $sessionToken['accessToken']->refresh_token;
             $accessToken = $this->gcp->getAccessTokenByRefreshToken($urlconfig['refreshtoken_url'], http_build_query($refreshTokenConfig));
             if (empty($accessToken)) {
                 $accessToken = $sessionToken['accessToken']->access_token;
             } else {
                 $sessionToken['accessToken']->access_token = $accessToken;
                 file_put_contents($tokenFilename, serialize($sessionToken));
             }
             $this->gcp->setAuthToken($accessToken);
         } else {
             $this->gcp->setAuthToken($sessionToken['accessToken']->access_token);
         }
     } else {
         $sessionToken = "";
     }
     if (empty($sessionToken)) {
         if (function_exists('csrf_get_tokens')) {
             $csrf = "<input type='hidden' name='" . $GLOBALS['csrf']['input-name'] . "' value='" . csrf_get_tokens() . "' />";
         } else {
             $csrf = '';
         }
         echo '<script type="text/javascript">window.open("' . $urlconfig['authorization_url'] . "?" . http_build_query(array_merge($redirectConfig, $offlineAccessConfig)) . '");</script>';
         echo '<div style="text-align:center;margin:40px 0;">', getTranslatedString('Because of Login Restrictions, you need to do the Login and Authorization within the PopUp and copy the Code you get in this Textfield.', 'Settings:Workflow2');
         echo '<form method="POST" action="#">' . $csrf . '<br/><input type="text" style="width:400px;" name="code"><br/><input type="submit" class="btn  btn-primary" name="submit" value="Submit the Code & Unlock Google Calendar Access" /> </form>';
         exit;
     }
 }
 public function init()
 {
     $this->additionallyDir = $directory = vglobal('root_directory') . 'modules/Workflow2/extends/additionally/googlecal/';
     global $currentBlockID;
     $currentBlockID = $this->getBlockId();
     require_once $this->additionallyDir . "/google-api-php-client/autoload.php";
     $callback = 'urn:ietf:wg:oauth:2.0:oob';
     $client = new \Google_Client();
     $client->setAccessType('offline');
     $client->setApplicationName("VtigerCRM_WorkflowDesigner");
     $client->setClientId('165426828888-7982si8gvbtvgid01nf7lkiolt0bs3vt.apps.googleusercontent.com');
     $client->setClientSecret('R1M9RkVUbxc7XGRLUWld376n');
     $client->setRedirectUri($callback);
     $client->setScopes(array('https://www.googleapis.com/auth/calendar'));
     $tokenFilename = $this->additionallyDir . "token/tokenSession3_" . $currentBlockID;
     if (!empty($_POST["code"])) {
         $client->authenticate($_POST['code']);
         $googleToken = $client->getAccessToken();
         file_put_contents($tokenFilename, serialize(array('accessToken' => $googleToken)));
         echo '<script type="text/javascript">window.location.href="index.php?module=Workflow2&parent=Settings&view=TaskConfig&taskid=' . $this->getBlockId() . '&done=1";</script>';
         exit;
     }
     if (file_exists($tokenFilename)) {
         $sessionToken = unserialize(file_get_contents($tokenFilename));
     } else {
         $sessionToken = "";
     }
     if (empty($sessionToken['accessToken'])) {
         $sessionToken = null;
     }
     if (empty($sessionToken)) {
         if (function_exists('csrf_get_tokens')) {
             $csrf = "<input type='hidden' name='" . $GLOBALS['csrf']['input-name'] . "' value='" . csrf_get_tokens() . "' />";
         } else {
             $csrf = '';
         }
         $authUrl = $client->createAuthUrl();
         echo '<script type="text/javascript">window.open("' . $authUrl . '");</script>';
         echo '<div style="text-align:center;margin:40px 0;">', getTranslatedString('Because of Login Restrictions, you need to do the Login and Authorization within the PopUp and copy the Code you get in this Textfield.', 'Settings:Workflow2');
         echo '<form method="POST" action="#">' . $csrf . '<br/><input type="text" style="width:400px;" name="code"><br/><input type="submit" class="btn  btn-primary" name="submit" value="Submit the Code & Unlock Google Calendar Access" /> </form>';
         exit;
     }
     $client->setAccessToken($sessionToken['accessToken']);
     $this->service = new Google_Service_Calendar($client);
     $this->client = $client;
 }
/**
 * Rewrites <form> to add CSRF tokens to them.
*/
function csrf_ob_handler($buffer, $flags)
{
    // to check if the page is *actually* HTML.
    static $is_html = false;
    if (!$is_html) {
        if (stripos($buffer, '<html') !== false) {
            $is_html = true;
        } else {
            return $buffer;
        }
    }
    $tokens = csrf_get_tokens();
    $name = $GLOBALS['csrf']['input-name'];
    $input = "<input type='hidden' name='{$name}' value=\"{$tokens}\"/>";
    $buffer = preg_replace('#(<form[^>]*method\\s*=\\s*["\']post["\'][^>]*>)#i', '$1' . $input, $buffer);
    return $buffer;
}
Example #4
0
 public function pay($iid, $returnURL = "order/index.php")
 {
     global $db;
     require_once "paypal/paypal.class.php";
     $paypal = new paypal_class();
     $query = $db->query("SELECT * FROM `<PRE>invoices` WHERE `id` = '{$iid}'");
     $array = $db->fetch_array($query);
     if ($_SESSION['cuser'] == $array['uid']) {
         $paypal->paypal_url = 'https://www.paypal.com/cgi-bin/webscr';
         $paypal->add_field('business', $db->config('paypalemail'));
         $paypal->add_field('return', $db->config('url') . "client/index.php?page=invoices&invoiceID=" . $iid . "&paypalcsrf=" . csrf_get_tokens());
         $paypal->add_field('cancel_return', $db->config('url') . "client/index.php?page=invoices&invoiceID=" . $iid . "&paypalcsrf=" . rawurlencode(csrf_get_tokens()));
         $paypal->add_field('notify_url', $db->config('url') . "client/index.php?page=invoices&invoiceID=" . $iid . "&paypalcsrf=" . rawurlencode(csrf_get_tokens()));
         $paypal->add_field('item_name', $db->config('name') . ': ' . $array['notes']);
         $paypal->add_field('amount', $array['amount']);
         $paypal->add_field('currency_code', $db->config("currency"));
         $paypal->submit_paypal_post();
         // submit the fields to paypal
     } else {
         echo "You don't seem to be the person who owns that invoice!";
     }
 }
?>
<div id="mainlevel">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<?php 
$tab_array = array();
$tab_array[] = array(gettext("Settings "), false, "/pkg_edit.php?xml=imspector.xml&id=0");
$tab_array[] = array(gettext("Replacements "), false, "/pkg_edit.php?xml=imspector_replacements.xml&id=0");
$tab_array[] = array(gettext("Access Lists "), false, "/pkg.php?xml=imspector_acls.xml");
$tab_array[] = array(gettext("Log "), true, "/imspector_logs.php");
$tab_array[] = array(gettext("Sync "), false, "/pkg_edit.php?xml=imspector_sync.xml&id=0");
display_top_tabs($tab_array);
?>
</table>

<?php 
$csrf_token = csrf_get_tokens();
$zz = <<<EOD
<script type="text/javascript">
var section = 'none';
var moveit = 1;
var the_timeout;

function xmlhttpPost()
{
\tvar xmlHttpReq = false;
\tvar self = this;

\tif (window.XMLHttpRequest)
\t\tself.xmlHttpReq = new XMLHttpRequest();
\telse if (window.ActiveXObject)
\t\tself.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
Example #6
0
/**
 * Rewrites <form> on the fly to add CSRF tokens to them. This can also
 * inject our JavaScript library.
 */
function csrf_ob_handler($buffer, $flags)
{
    // Even though the user told us to rewrite, we should do a quick heuristic
    // to check if the page is *actually* HTML. We don't begin rewriting until
    // we hit the first <html tag.
    static $is_html = false;
    if (!$is_html) {
        // not HTML until proven otherwise
        if (stripos($buffer, '<html') !== false) {
            $is_html = true;
        } else {
            return $buffer;
        }
    }
    $tokens = csrf_get_tokens();
    $name = $GLOBALS['csrf']['input-name'];
    $endslash = $GLOBALS['csrf']['xhtml'] ? ' /' : '';
    $input = "<input type='hidden' name='{$name}' value=\"{$tokens}\"{$endslash}>";
    $buffer = preg_replace('#(<form[^>]*method\\s*=\\s*["\']post["\'][^>]*>)#i', '$1' . $input, $buffer);
    if ($GLOBALS['csrf']['frame-breaker']) {
        $buffer = str_ireplace('</head>', '<script type="text/javascript">if (top != self) {top.location.href = self.location.href;}</script></head>', $buffer);
    }
    if ($js = $GLOBALS['csrf']['rewrite-js']) {
        $buffer = str_ireplace('</head>', '<script type="text/javascript">' . 'var csrfMagicToken = "' . $tokens . '";' . 'var csrfMagicName = "' . $name . '";</script>' . '<script src="' . $js . '" type="text/javascript"></script></head>', $buffer);
        $script = '<script type="text/javascript">CsrfMagic.end();</script>';
        $buffer = str_ireplace('</body>', $script . '</body>', $buffer, $count);
        if (!$count) {
            $buffer .= $script;
        }
    }
    return $buffer;
}
Example #7
0
/**
 * Rewrites <form> on the fly to add CSRF tokens to them. This can also
 * inject our JavaScript library.
 */
function csrf_ob_handler($buffer, $flags)
{
    // Even though the user told us to rewrite, we should do a quick heuristic
    // to check if the page is *actually* HTML. We don't begin rewriting until
    // we hit the first <html tag.
    static $is_html = false;
    static $is_partial = false;
    if (!$is_html) {
        // not HTML until proven otherwise
        if (stripos($buffer, '<html') !== false) {
            $is_html = true;
        } else {
            // Customized to take the partial HTML with form
            $is_html = true;
            $is_partial = true;
            // Determine based on content type.
            $headers = headers_list();
            foreach ($headers as $header) {
                if ($is_html) {
                    break;
                } else {
                    if (stripos('Content-type', $header) !== false && stripos('/html', $header) === false) {
                        $is_html = false;
                    }
                }
            }
            if (!$is_html) {
                return $buffer;
            }
        }
    }
    $count = 1;
    $tokens = csrf_get_tokens();
    $name = $GLOBALS['csrf']['input-name'];
    $endslash = $GLOBALS['csrf']['xhtml'] ? ' /' : '';
    $input = "<input type='hidden' name='{$name}' value=\"{$tokens}\"{$endslash}>";
    $buffer = preg_replace('#(<form[^>]*method\\s*=\\s*["\']post["\'][^>]*>)#i', '$1' . $input, $buffer);
    if ($GLOBALS['csrf']['frame-breaker'] && !$is_partial) {
        $buffer = preg_replace('/<\\/head>/', '<script type="text/javascript">if (top != self) {top.location.href = self.location.href;}</script></head>', $buffer, $count);
    }
    if (($js = $GLOBALS['csrf']['rewrite-js']) && !$is_partial) {
        global $dbconfig;
        if (empty($dbconfig) || empty($dbconfig['db_name']) || $dbconfig['db_name'] == '_DBC_TYPE_') {
            $buffer = preg_replace('/<\\/head>/', '<script type="text/javascript">' . 'var csrfMagicToken = "' . $tokens . '";' . 'var csrfMagicName = "' . $name . '";</script>' . '<script src="../' . $js . '" type="text/javascript"></script></head>', $buffer, $count);
        } else {
            $buffer = preg_replace('/<\\/head>/', '<script type="text/javascript">' . 'var csrfMagicToken = "' . $tokens . '";' . 'var csrfMagicName = "' . $name . '";</script>' . '<script src="' . $js . '" type="text/javascript"></script></head>', $buffer, $count);
        }
        $script = '<script type="text/javascript">CsrfMagic.end();</script>';
        $buffer = preg_replace('/<\\/body>/', $script . '</body>', $buffer, $count);
        if (!$count) {
            $buffer .= $script;
        }
    }
    return $buffer;
}
Example #8
0
 public function getTaskform($params)
 {
     $fusvsib = "data";
     $slsjcwqgj = "params";
     $lbmupegfmk = "task_mod_strings";
     global $adb, $current_user;
     global $current_language;
     $ofmwlum = "csrf";
     $pdsmlpy = "taskContent";
     ${"GLOBALS"}["vuzwoqqfj"] = "viewer";
     ${"GLOBALS"}["iyjrxk"] = "viewer";
     ${"GLOBALS"}["uyakhlsy"] = "preset";
     $gbsfusbeyp = "row";
     if (empty(${$slsjcwqgj})) {
         ${${"GLOBALS"}["szkcvek"]} = array();
     }
     $tiryighhra = "index";
     ${"GLOBALS"}["lohlrtoow"] = "return";
     ${"GLOBALS"}["dzfhiuidr"] = "moduleModel";
     ${${"GLOBALS"}["iyjrxk"]} = $this->getView();
     ${${"GLOBALS"}["dzfhiuidr"]} = \Vtiger_Module_Model::getInstance("Workflow2");
     ${"GLOBALS"}["hzgfwfbwmo"] = "return";
     $viewer->assign("CURRENT_VERSION", $moduleModel->version);
     ${${"GLOBALS"}["hzgfwfbwmo"]} = $this->_beforeGetTaskform(${${"GLOBALS"}["vuzwoqqfj"]});
     $uswrzkeeyvu = "taskContent";
     if (false === ${${"GLOBALS"}["lohlrtoow"]}) {
         return;
     }
     $viewer->assign("current_user", $current_user->column_fields);
     foreach ($this->_presets as ${$tiryighhra} => ${${"GLOBALS"}["uyakhlsy"]}) {
         if (isset($this->_presetObj["preset_" . ${${"GLOBALS"}["ugekeupolkiq"]}])) {
             $this->_inlineJs .= $this->_presetObj["preset_" . ${${"GLOBALS"}["ugekeupolkiq"]}]->getInlineJS();
         }
     }
     $viewer->assign("additionalInlineJS", $this->_inlineJs);
     ${${"GLOBALS"}["lbujtjnghu"]} = \Workflow\VtUtils::query("SELECT file, type, module, handlerClass, helpUrl, repo_id FROM vtiger_wf_types WHERE type = '" . $this->_data["type"] . "'");
     ${$fusvsib} = $adb->fetch_array(${$gbsfusbeyp});
     ${${"GLOBALS"}["dqtgpfxr"]} = ${${"GLOBALS"}["iyxcwkakcj"]}["module"];
     if (function_exists("csrf_get_tokens")) {
         ${"GLOBALS"}["fdcotztf"] = "csrf";
         $rjvvorupq = "csrf";
         ${${"GLOBALS"}["fdcotztf"]} = "<input type='hidden' name='" . $GLOBALS["csrf"]["input-name"] . "' value='" . csrf_get_tokens() . "' />";
         $viewer->assign("csrf", ${$rjvvorupq});
     } else {
         $viewer->assign("csrf", "");
     }
     if (empty($this->_templateFile)) {
         ${"GLOBALS"}["gsigtvfunh"] = "data";
         if (!empty(${${"GLOBALS"}["gsigtvfunh"]}["file"])) {
             $ryyjvdeqxbt = "file";
             ${$ryyjvdeqxbt} = str_replace(".php", ".tpl", ${${"GLOBALS"}["iyxcwkakcj"]}["file"]);
         } else {
             ${${"GLOBALS"}["fwmdwnoxcku"]} = "taskforms/WfTask" . ucfirst(strtolower($this->_data["type"])) . ".tpl";
         }
     } else {
         ${${"GLOBALS"}["fwmdwnoxcku"]} = "taskforms/" . $this->_templateFile;
     }
     ${${"GLOBALS"}["xirkfqufvrh"]} = Vtiger_Language_Handler::getModuleStringsFromFile(${${"GLOBALS"}["ytjqnvmu"]}, "Settings:" . ${${"GLOBALS"}["iyxcwkakcj"]}["module"]);
     if (empty(${${"GLOBALS"}["xirkfqufvrh"]})) {
         ${"GLOBALS"}["bgyhhrwdjdxd"] = "data";
         ${${"GLOBALS"}["xirkfqufvrh"]} = Vtiger_Language_Handler::getModuleStringsFromFile("en_us", "Settings:" . ${${"GLOBALS"}["bgyhhrwdjdxd"]}["module"]);
     }
     $viewer->assign("MOD", ${$lbmupegfmk}["languageStrings"]);
     if (!empty($this->_envSettings)) {
         ${"GLOBALS"}["oikrferga"] = "index";
         foreach ($this->_envSettings as ${${"GLOBALS"}["oikrferga"]} => ${${"GLOBALS"}["tukklljq"]}) {
             $sdlxwmtscvc = "index";
             if (is_int(${$sdlxwmtscvc})) {
                 ${"GLOBALS"}["wkthullrc"] = "label";
                 ${${"GLOBALS"}["xchbkwcnzq"]}[${${"GLOBALS"}["tukklljq"]}] = ${${"GLOBALS"}["wkthullrc"]};
             } else {
                 $thjrgsqttqnk = "index";
                 ${"GLOBALS"}["kimyorlvikh"] = "envSettings";
                 ${${"GLOBALS"}["kimyorlvikh"]}[${$thjrgsqttqnk}] = ${${"GLOBALS"}["tukklljq"]};
             }
         }
     } else {
         ${${"GLOBALS"}["xchbkwcnzq"]} = array();
     }
     $viewer->assign("envSettings", ${${"GLOBALS"}["xchbkwcnzq"]});
     $viewer->assign("task", $this->_settings);
     $viewer->assign("workflowID", $this->getWorkflowId());
     if (!empty(${${"GLOBALS"}["iyxcwkakcj"]}["repo_id"])) {
         ${"GLOBALS"}["mplcepr"] = "result";
         ${${"GLOBALS"}["ulkocil"]} = "SELECT support_url FROM vtiger_wf_repository WHERE id = \"" . ${${"GLOBALS"}["iyxcwkakcj"]}["repo_id"] . "\"";
         $ncwbmo = "result";
         $eukyagzvjcf = "supportUrl";
         ${${"GLOBALS"}["mplcepr"]} = $adb->query(${${"GLOBALS"}["ulkocil"]}, false);
         if (empty(${$ncwbmo})) {
             ob_start();
             ${${"GLOBALS"}["ukemnszxrvp"]} = new \Workflow2();
             $obj->checkDB();
             ob_end_clean();
             ${${"GLOBALS"}["ulkocil"]} = "SELECT support_url FROM vtiger_wf_repository WHERE id = \"" . ${${"GLOBALS"}["iyxcwkakcj"]}["repo_id"] . "\"";
             ${${"GLOBALS"}["anynhuhj"]} = $adb->query(${${"GLOBALS"}["ulkocil"]}, false);
         }
         ${$eukyagzvjcf} = $adb->query_result(${${"GLOBALS"}["anynhuhj"]}, 0, "support_url");
         if (!empty(${${"GLOBALS"}["hvklwftaujq"]})) {
             ${"GLOBALS"}["dcadlffwmrub"] = "supportUrl";
             ${"GLOBALS"}["zwxufvqj"] = "supportUrl";
             $scxbivp = "supportUrl";
             ${$scxbivp} = str_replace("{{task}}", ${${"GLOBALS"}["iyxcwkakcj"]}["type"], ${${"GLOBALS"}["zwxufvqj"]});
             $viewer->assign("helpUrl", ${${"GLOBALS"}["dcadlffwmrub"]});
         } else {
             $viewer->assign("helpUrl", ${${"GLOBALS"}["iyxcwkakcj"]}["helpurl"]);
         }
     } else {
         ${"GLOBALS"}["vzrlsqhzsuey"] = "data";
         $viewer->assign("helpUrl", ${${"GLOBALS"}["vzrlsqhzsuey"]}["helpurl"]);
     }
     if (!isset(${${"GLOBALS"}["szkcvek"]}["hint"]) || !is_array(${${"GLOBALS"}["szkcvek"]}["hint"])) {
         ${"GLOBALS"}["qvzgvmhptrr"] = "params";
         ${${"GLOBALS"}["qvzgvmhptrr"]}["hint"] = array();
     }
     ${"GLOBALS"}["gykpmvj"] = "taskContent";
     $viewer->assign("hint", array_merge(${${"GLOBALS"}["szkcvek"]}["hint"], $this->_configHint));
     if ($this->_ConfigTemplate !== false) {
         if ($this->_internalConfiguration == false) {
             if ($viewer->template_exists("modules/Settings/" . ${${"GLOBALS"}["iyxcwkakcj"]}["module"] . "/" . ${${"GLOBALS"}["fwmdwnoxcku"]})) {
                 $geisitf = "taskContent";
                 ${$geisitf} = $viewer->fetch("modules/Settings/" . ${${"GLOBALS"}["iyxcwkakcj"]}["module"] . "/" . ${${"GLOBALS"}["fwmdwnoxcku"]});
             } elseif ($viewer->template_exists("modules/" . ${${"GLOBALS"}["iyxcwkakcj"]}["module"] . "/" . ${${"GLOBALS"}["fwmdwnoxcku"]})) {
                 $wyfbabmb = "data";
                 ${${"GLOBALS"}["lrlnsogidkl"]} = $viewer->fetch("modules/" . ${$wyfbabmb}["module"] . "/" . ${${"GLOBALS"}["fwmdwnoxcku"]});
             } else {
                 ${"GLOBALS"}["bsjykq"] = "taskContent";
                 ${${"GLOBALS"}["bsjykq"]} = "<p style='text-align:center;font-weight:bold;'>" . getTranslatedString("LBL_NO_CONFIG_FORM", "Settings:Workflow2") . " [" . ${${"GLOBALS"}["fwmdwnoxcku"]} . "]</p>";
             }
         } else {
             ${${"GLOBALS"}["lrlnsogidkl"]} = $viewer->fetch("modules/Settings/Workflow2/WfTaskInternalConfig.tpl");
         }
     } else {
         ${"GLOBALS"}["oinngvmrmth"] = "taskContent";
         ${${"GLOBALS"}["oinngvmrmth"]} = "<p style='text-align:center;font-weight:bold;'>" . getTranslatedString("LBL_NO_CONFIG_FORM", "Workflow2") . "</p>";
     }
     ${"GLOBALS"}["ivarmfpl"] = "index";
     ${${"GLOBALS"}["gykpmvj"]} = preg_replace("/<form(.*)>/", "<form \$1>" . ${$ofmwlum}, ${$uswrzkeeyvu});
     ${${"GLOBALS"}["efsbcmg"]} = $this->_jsFiles;
     if (empty($this->_javascriptFile)) {
         ${"GLOBALS"}["srqqcntc"] = "data";
         ${${"GLOBALS"}["efsbcmg"]}[] = "WfTask" . ucfirst(strtolower(str_replace("WfTask", "", ${${"GLOBALS"}["srqqcntc"]}["handlerclass"]))) . ".js";
     } else {
         if (is_array($this->_javascriptFile)) {
             $ukfwizohoy = "jsFile";
             ${${"GLOBALS"}["efsbcmg"]} = array_merge(${$ukfwizohoy}, $this->_javascriptFile);
         } else {
             ${${"GLOBALS"}["efsbcmg"]}[] = $this->_javascriptFile;
         }
     }
     foreach ($this->_presets as ${${"GLOBALS"}["ivarmfpl"]} => ${${"GLOBALS"}["iffnbmo"]}) {
         ${"GLOBALS"}["hbsivfvid"] = "index";
         if (isset($this->_presetObj["preset_" . ${${"GLOBALS"}["hbsivfvid"]}])) {
             ${"GLOBALS"}["jfhsjrsl"] = "jsFile";
             $dfkruedeex = "jsFile";
             ${${"GLOBALS"}["jfhsjrsl"]} = array_merge(${$dfkruedeex}, $this->_presetObj["preset_" . ${${"GLOBALS"}["ugekeupolkiq"]}]->getJSFiles());
         }
     }
     foreach (${${"GLOBALS"}["efsbcmg"]} as ${${"GLOBALS"}["fwmdwnoxcku"]}) {
         ${"GLOBALS"}["hfgkcb"] = "file";
         if (substr(${${"GLOBALS"}["hfgkcb"]}, 0, 6) == "WfTask") {
             ${${"GLOBALS"}["iqxhrpnh"]} = "modules/" . ${${"GLOBALS"}["iyxcwkakcj"]}["module"] . "/tasks/";
         } else {
             $msojgcw = "data";
             ${${"GLOBALS"}["iqxhrpnh"]} = "modules/" . ${$msojgcw}["module"] . "/views/resources/js/";
         }
         if (substr(${${"GLOBALS"}["fwmdwnoxcku"]}, 0, 1) == "~") {
             if (file_exists(substr(${${"GLOBALS"}["fwmdwnoxcku"]}, 1))) {
                 ${"GLOBALS"}["wsvpiqfhb"] = "taskContent";
                 ${"GLOBALS"}["wdftdgjn"] = "file";
                 $vmocrt = "taskContent";
                 ${$vmocrt} = ${${"GLOBALS"}["wsvpiqfhb"]} . "<script type='text/javascript' src='" . substr(${${"GLOBALS"}["wdftdgjn"]}, 1) . "?v=" . $moduleModel->version . "'></script>";
             }
         } else {
             $hbbtpy = "file";
             ${"GLOBALS"}["sqkljdvvztjs"] = "path";
             if (file_exists(${${"GLOBALS"}["sqkljdvvztjs"]} . ${$hbbtpy})) {
                 $fxponrs = "taskContent";
                 ${"GLOBALS"}["ifpcuimz"] = "path";
                 ${$fxponrs} = ${${"GLOBALS"}["lrlnsogidkl"]} . "<script type='text/javascript' src='" . ${${"GLOBALS"}["ifpcuimz"]} . ${${"GLOBALS"}["fwmdwnoxcku"]} . "?v=" . $moduleModel->version . "'></script>";
             }
         }
     }
     $viewer->assign("CONTENT", ${${"GLOBALS"}["lrlnsogidkl"]});
     ${$pdsmlpy} = $viewer->fetch("modules/Settings/Workflow2/TaskConfig.tpl");
     return ${${"GLOBALS"}["lrlnsogidkl"]};
 }
Example #9
0
 public static function createToken($mode = 'POST')
 {
     // for backward compatibility...
     if (is_string($mode) && strtolower($mode) == 'post' || $mode === true) {
         return '';
     }
     // We return an empty string here, just to keep WB modules happy.
     // The CSRF protection will be added automatically to the Backend,
     // so there's no need to do it this way.
     $path = CAT_Helper_Directory::sanitizePath(CAT_PATH . '/modules/lib_csrfmagic/csrf-magic.php');
     if (file_exists($path)) {
         if (!function_exists('csrf_get_tokens')) {
             include_once $path;
         }
         return csrf_get_tokens();
     } else {
         // no token without csrf-magic!
         return NULL;
     }
 }
Example #10
0
        break;
    case 'administration':
        $type_name = $backend->lang()->translate('Administration');
        break;
    case 'snippet':
        $type_name = $backend->lang()->translate('Code-Snippet');
        break;
    case 'library':
        $type_name = $backend->lang()->translate('Library');
        break;
    default:
        $type_name = $backend->lang()->translate('Unknown');
}
$addon['function'] = $type_name;
// Check if the module is installable or upgradeable
$addon['INSTALL'] = file_exists(CAT_PATH . '/' . $addon['type'] . 's/' . $addon['directory'] . '/install.php') ? true : false;
$addon['UPGRADE'] = file_exists(CAT_PATH . '/' . $addon['type'] . 's/' . $addon['directory'] . '/upgrade.php') ? true : false;
// add some more details
$addon = array_merge($addon, array('installed' => $addon['installed'] != '' ? CAT_Helper_DateTime::getDate($addon['installed']) : NULL, 'upgraded' => $addon['upgraded'] != '' ? CAT_Helper_DateTime::getDate($addon['upgraded']) : NULL, 'is_installed' => CAT_Helper_Addons::isModuleInstalled($addon['directory'], NULL, $addon['type']), 'is_removable' => $addon['removable'] == 'N' ? false : true, 'link' => $link));
$tpl_data['token_name'] = $GLOBALS['csrf']['input-name'];
$tpl_data['token'] = csrf_get_tokens();
$result = true;
$message = NULL;
$output = $parser->get('backend_addons_index_details', array_merge($tpl_data, array('addon' => $addon)));
if (!$output || $output == '') {
    $result = false;
    $message = 'Unable to load settings sub page';
}
$ajax = array('message' => $message, 'success' => $result, 'content' => $output);
print json_encode($ajax);
exit;