예제 #1
0
 /**
  * Получает список режимов отображения
  * Текущий помечается как current
  *
  * @param string $template TPL шаблон
  *
  * @return mixed
  */
 public function getMobileModesList($template = "default")
 {
     $isMobile = (bool) system_is_mobile();
     $modes = array("is_mobile" => 1, "is_desktop" => 0);
     $items = array();
     foreach ($modes as $mode => $value) {
         $itemArray = array("@name" => $mode, "@link" => '/content/setMobileMode/' . ($value ? 0 : 1));
         if ($value == $isMobile) {
             $itemArray["@status"] = "active";
             $items[] = def_module::renderTemplate("content/mobile/" . $template, $mode, $itemArray);
         } else {
             $items[] = def_module::parseTemplate("", $itemArray);
         }
     }
     return def_module::renderTemplate("content/mobile/" . $template, "modes", array("subnodes:items" => $items));
 }
예제 #2
0
 protected function loadInfo($vf1965a857bc285d26fe22023aa5ab50d = false)
 {
     $v2245023265ae4cf87d02c8b6ba991139 = mainConfiguration::getInstance();
     if ($vf1965a857bc285d26fe22023aa5ab50d === false) {
         $vac5c74b64b4b8352ef2f181affb5ac2a = "SELECT id, name, filename, type, title, domain_id, lang_id, is_default FROM cms3_templates WHERE id = '{$this->id}'";
         $result = l_mysql_query($vac5c74b64b4b8352ef2f181affb5ac2a);
         $vf1965a857bc285d26fe22023aa5ab50d = mysql_fetch_row($result);
     }
     if (list($vb80bb7740288fda1f201890375a60c8f, $vb068931cc450442b63f5b3d276ea4297, $v435ed7e9f07f740abf511a62c00eef6e, $v599dcce2998a6b40b1e38e8c6006cb0a, $vd5d3db1765287eef77d7927cc956f50a, $v662cbf1253ac7d8750ed9190c52163e5, $v78e6dd7a49f5b0cb2106a3a434dd5c86, $vf62baf4c4ead98d50d516eca0ac5a746) = $vf1965a857bc285d26fe22023aa5ab50d) {
         $this->name = $vb068931cc450442b63f5b3d276ea4297;
         $this->filename = $v435ed7e9f07f740abf511a62c00eef6e;
         $this->type = $v599dcce2998a6b40b1e38e8c6006cb0a;
         $this->title = $vd5d3db1765287eef77d7927cc956f50a;
         $this->domain_id = (int) $v662cbf1253ac7d8750ed9190c52163e5;
         $this->lang_id = (int) $v78e6dd7a49f5b0cb2106a3a434dd5c86;
         $this->is_default = (bool) $vf62baf4c4ead98d50d516eca0ac5a746;
         if (!empty($this->filename)) {
             $v076ccfd7e9875932f89de6676f4c73d8 = pathinfo($this->filename, PATHINFO_EXTENSION);
             if (!strlen($this->type)) {
                 if (strtolower($v076ccfd7e9875932f89de6676f4c73d8) == 'xsl') {
                     $this->type = 'xslt';
                 } elseif (strtolower($v076ccfd7e9875932f89de6676f4c73d8) == 'tpl') {
                     $this->type = 'tpls';
                 } else {
                     $this->type = strlen($v076ccfd7e9875932f89de6676f4c73d8) ? $v076ccfd7e9875932f89de6676f4c73d8 : 'xslt';
                 }
             }
             if ($this->type == 'xslt') {
                 $this->templatesDirectory = $va44b3818d66f01cde4647f3ad2e3cb06 = $v2245023265ae4cf87d02c8b6ba991139->includeParam('templates.xsl');
             } elseif ($this->type == 'tpls') {
                 $this->templatesDirectory = $v2245023265ae4cf87d02c8b6ba991139->includeParam('templates.tpl');
                 $va44b3818d66f01cde4647f3ad2e3cb06 = $this->templatesDirectory . "content/";
             } else {
                 $this->templatesDirectory = $va44b3818d66f01cde4647f3ad2e3cb06 = $v2245023265ae4cf87d02c8b6ba991139->includeParam('templates.' . $this->type) . "/";
             }
             if (strlen($this->name)) {
                 $this->resourcesDirectory = CURRENT_WORKING_DIR . '/templates/' . $this->name . '/';
                 $va44b3818d66f01cde4647f3ad2e3cb06 = $this->templatesDirectory = $this->resourcesDirectory . $this->type . '/';
                 if ($this->type == 'tpls') {
                     $va44b3818d66f01cde4647f3ad2e3cb06 = $this->templatesDirectory . "content/";
                 }
             }
             if (system_is_mobile() && is_file($va44b3818d66f01cde4647f3ad2e3cb06 . 'mobile/' . $this->filename)) {
                 $this->filePath = $va44b3818d66f01cde4647f3ad2e3cb06 . 'mobile/' . $this->filename;
             } else {
                 $this->filePath = $va44b3818d66f01cde4647f3ad2e3cb06 . $this->filename;
             }
         }
         return true;
     } else {
         return false;
     }
 }
예제 #3
0
 /**
  * @static
  * Загружает шаблоны, используя шаблонизатор в зависимости от режима работы макросов, возвращает запрошенные блоки
  *
  * @param string $filePath - путь к источнику шаблонов
  * @return array
  */
 public static function loadTemplates($filePath = "")
 {
     $args = func_get_args();
     $templater = self::isXSLTResultMode() ? 'umiTemplaterXSLT' : 'umiTemplaterTPL';
     if (!self::isXSLTResultMode() && !is_file($filePath)) {
         $cmsController = cmsController::getInstance();
         // получаем полный путь к tpl-шаблону
         $defaultLang = langsCollection::getInstance()->getDefaultLang();
         $currentLang = $cmsController->getCurrentLang();
         $resourcesDir = $cmsController->getResourcesDirectory();
         $langPrefix = '';
         if ($defaultLang && $currentLang && $defaultLang->getId() != $currentLang->getId()) {
             $langPrefix = $currentLang->getPrefix();
         }
         if (substr($filePath, -4) === '.tpl') {
             $filePath = substr($filePath, 0, -4);
         }
         $files = array();
         if (system_is_mobile()) {
             $pathArray = explode('/', $filePath);
             $mobileFilePath = '/mobile/' . array_pop($pathArray);
             $mobileFilePath = implode('/', $pathArray) . $mobileFilePath;
             if (strlen($langPrefix)) {
                 $files[] = $mobileFilePath . '.' . $langPrefix;
             }
             $files[] = $mobileFilePath;
         }
         if (strlen($langPrefix)) {
             $files[] = $filePath . '.' . $langPrefix;
         }
         $files[] = $filePath;
         $dir = rtrim($resourcesDir ? $resourcesDir : CURRENT_WORKING_DIR, '/') . '/tpls/';
         foreach ($files as $filePath) {
             $filePath = $dir . $filePath . '.tpl';
             if (is_file($filePath)) {
                 break;
             }
         }
         $args[0] = $filePath;
     }
     $result = call_user_func_array(array($templater, 'getTemplates'), $args);
     return $result;
 }
예제 #4
0
function system_get_tpl($v15d61712450a686a7f365adf4fef581f = 'default')
{
    $v2245023265ae4cf87d02c8b6ba991139 = mainConfiguration::getInstance();
    showWorkTime("system mainconfig init");
    $v594c103f2c6e04c3d8ab059f031e0c1a = cmsController::getInstance();
    showWorkTime("system cmscontroller init");
    $v74c17e3010c33af858d215cfc3552b04 = '';
    $v5b063e275d506f65ebf1b02d926f19a4 = '';
    $v47826cacc65c665212b821e6ff80b9b0 = '';
    if ($v594c103f2c6e04c3d8ab059f031e0c1a->getCurrentMode() == 'admin' && $v15d61712450a686a7f365adf4fef581f == 'current') {
        $v599dcce2998a6b40b1e38e8c6006cb0a = 'xslt';
        $v6f66e878c62db60568a3487869695820 = 'xslAdminTemplater';
        $v5b063e275d506f65ebf1b02d926f19a4 = 'main.xsl';
        $v74c17e3010c33af858d215cfc3552b04 = $v2245023265ae4cf87d02c8b6ba991139->includeParam('templates.skins', array('skin' => system_get_skinName()));
        $v41275a535677f79ff347e01bc530c176 = permissionsCollection::getInstance();
        $v8e44f0089b076e18a718eb9ca3d94674 = $v41275a535677f79ff347e01bc530c176->getUserId();
        $vca02d1555c813b1b1ad637654c0fe111 = $v41275a535677f79ff347e01bc530c176->isAllowedMethod($v8e44f0089b076e18a718eb9ca3d94674, $v594c103f2c6e04c3d8ab059f031e0c1a->getCurrentModule(), $v594c103f2c6e04c3d8ab059f031e0c1a->getCurrentMethod());
        if ((!$v41275a535677f79ff347e01bc530c176->isAdmin() || !$vca02d1555c813b1b1ad637654c0fe111) && file_exists($v74c17e3010c33af858d215cfc3552b04 . 'main_login.xsl')) {
            if ($v41275a535677f79ff347e01bc530c176->isAuth()) {
                $v90f805bfcba6ab75df4ad6da8e6afd9b = "owner_id = {$v8e44f0089b076e18a718eb9ca3d94674}";
                $v8e59688c095c0b0bad04d8476df25db3 = umiObjectsCollection::getInstance()->getObject($v8e44f0089b076e18a718eb9ca3d94674)->getValue('groups');
                foreach ($v8e59688c095c0b0bad04d8476df25db3 as $vf2f5fbe4a9d4cc9a39e7a62a513580e9) {
                    $v90f805bfcba6ab75df4ad6da8e6afd9b .= " or owner_id = {$vf2f5fbe4a9d4cc9a39e7a62a513580e9}";
                }
                $vac5c74b64b4b8352ef2f181affb5ac2a = "SELECT `module` FROM cms_permissions WHERE (" . $v90f805bfcba6ab75df4ad6da8e6afd9b . ") and (method = '' or method is null)";
                $result = l_mysql_query($vac5c74b64b4b8352ef2f181affb5ac2a);
                if (mysql_num_rows($result) !== 0) {
                    $vb1444fb0c07653567ad325aa25d4e37a = regedit::getInstance();
                    while ($vf1965a857bc285d26fe22023aa5ab50d = mysql_fetch_array($result)) {
                        $v22884db148f0ffb0d830ba431102b0b5 = $vf1965a857bc285d26fe22023aa5ab50d[0];
                        $vea9f6aca279138c58f705c8d4cb4b8ce = $vb1444fb0c07653567ad325aa25d4e37a->getVal("//modules/{$v22884db148f0ffb0d830ba431102b0b5}/default_method_admin");
                        if ($v41275a535677f79ff347e01bc530c176->isAllowedMethod($v8e44f0089b076e18a718eb9ca3d94674, $v22884db148f0ffb0d830ba431102b0b5, $vea9f6aca279138c58f705c8d4cb4b8ce)) {
                            def_module::redirect('http://' . $v594c103f2c6e04c3d8ab059f031e0c1a->getCurrentDomain()->getHost() . '/admin/' . $v22884db148f0ffb0d830ba431102b0b5 . '/' . $vea9f6aca279138c58f705c8d4cb4b8ce);
                            break;
                        }
                    }
                }
            }
            $v5b063e275d506f65ebf1b02d926f19a4 = 'main_login.xsl';
        }
        $v47826cacc65c665212b821e6ff80b9b0 = $v74c17e3010c33af858d215cfc3552b04 . $v5b063e275d506f65ebf1b02d926f19a4;
    } else {
        $v4091345e6f9742cda418c2e209b8a18c = templatesCollection::getInstance();
        $v4f2afc9c4099ee1f39c9f551123e54bd = false;
        if ($v74f5356453a69e438e0f58ef93103cc0 = getRequest('template_id')) {
            $v4f2afc9c4099ee1f39c9f551123e54bd = $v4091345e6f9742cda418c2e209b8a18c->getTemplate($v74f5356453a69e438e0f58ef93103cc0);
        }
        if (!$v4f2afc9c4099ee1f39c9f551123e54bd instanceof template) {
            $v4f2afc9c4099ee1f39c9f551123e54bd = $v15d61712450a686a7f365adf4fef581f == 'current' ? $v4091345e6f9742cda418c2e209b8a18c->getCurrentTemplate() : $v4091345e6f9742cda418c2e209b8a18c->getDefaultTemplate();
        }
        if ($v4f2afc9c4099ee1f39c9f551123e54bd instanceof template) {
            $v5b063e275d506f65ebf1b02d926f19a4 = $v4f2afc9c4099ee1f39c9f551123e54bd->getFilename();
            $v918d83c715c19dd93ff49f87e2fae0b3 = $v4f2afc9c4099ee1f39c9f551123e54bd->getName();
            $v599dcce2998a6b40b1e38e8c6006cb0a = $v4f2afc9c4099ee1f39c9f551123e54bd->getType();
            if (!$v599dcce2998a6b40b1e38e8c6006cb0a) {
                switch (array_pop(explode('.', $v5b063e275d506f65ebf1b02d926f19a4))) {
                    case "xsl":
                        $v599dcce2998a6b40b1e38e8c6006cb0a = 'xslt';
                        break;
                    case "tpl":
                        $v599dcce2998a6b40b1e38e8c6006cb0a = 'tpls';
                        break;
                }
            }
            $v0e2d056dfa17731ff69524908f6ad7df = CURRENT_WORKING_DIR . '/templates/' . $v918d83c715c19dd93ff49f87e2fae0b3 . '/' . $v599dcce2998a6b40b1e38e8c6006cb0a . '/';
            switch ($v599dcce2998a6b40b1e38e8c6006cb0a) {
                case "xslt":
                    $v74c17e3010c33af858d215cfc3552b04 = file_exists($v0e2d056dfa17731ff69524908f6ad7df . $v5b063e275d506f65ebf1b02d926f19a4) ? $v0e2d056dfa17731ff69524908f6ad7df : $v2245023265ae4cf87d02c8b6ba991139->includeParam('templates.xsl');
                    $v6f66e878c62db60568a3487869695820 = 'xslTemplater';
                    break;
                case "tpls":
                    $v74c17e3010c33af858d215cfc3552b04 = file_exists($v0e2d056dfa17731ff69524908f6ad7df . 'content/' . $v5b063e275d506f65ebf1b02d926f19a4) ? $v0e2d056dfa17731ff69524908f6ad7df : $v2245023265ae4cf87d02c8b6ba991139->includeParam('templates.tpl');
                    $v6f66e878c62db60568a3487869695820 = 'tplTemplater';
                    break;
                default:
                    $v74c17e3010c33af858d215cfc3552b04 = file_exists($v0e2d056dfa17731ff69524908f6ad7df . $v5b063e275d506f65ebf1b02d926f19a4) ? $v0e2d056dfa17731ff69524908f6ad7df : '';
                    $v6f66e878c62db60568a3487869695820 = file_exists(dirname(__FILE__) . '/' . $v599dcce2998a6b40b1e38e8c6006cb0a . '/' . $v599dcce2998a6b40b1e38e8c6006cb0a . 'Templater.php') ? $v599dcce2998a6b40b1e38e8c6006cb0a . 'Templater' : '';
            }
            if ($v15d61712450a686a7f365adf4fef581f == 'streams') {
                $v6f66e878c62db60568a3487869695820 = 'xslTemplater';
                $v599dcce2998a6b40b1e38e8c6006cb0a = 'xslt';
                $v74c17e3010c33af858d215cfc3552b04 = $v2245023265ae4cf87d02c8b6ba991139->includeParam('templates.xsl');
                $v5b063e275d506f65ebf1b02d926f19a4 = 'sample.xsl';
            }
            if (system_is_mobile() && file_exists($v74c17e3010c33af858d215cfc3552b04 . 'mobile/' . $v5b063e275d506f65ebf1b02d926f19a4)) {
                $v74c17e3010c33af858d215cfc3552b04 = $v74c17e3010c33af858d215cfc3552b04 . 'mobile/';
            }
            $v47826cacc65c665212b821e6ff80b9b0 = $v74c17e3010c33af858d215cfc3552b04 . ($v599dcce2998a6b40b1e38e8c6006cb0a == 'tpls' ? 'content/' : '') . $v5b063e275d506f65ebf1b02d926f19a4;
        } else {
            if ($v15d61712450a686a7f365adf4fef581f == 'default' || $v15d61712450a686a7f365adf4fef581f == 'streams') {
                $v6f66e878c62db60568a3487869695820 = 'xslTemplater';
                $v599dcce2998a6b40b1e38e8c6006cb0a = 'xslt';
                $v74c17e3010c33af858d215cfc3552b04 = $v2245023265ae4cf87d02c8b6ba991139->includeParam('templates.xsl');
                $v47826cacc65c665212b821e6ff80b9b0 = $v2245023265ae4cf87d02c8b6ba991139->includeParam('templates.xsl') . 'sample.xsl';
            } else {
                $v7f2db423a49b305459147332fb01cf87 = outputBuffer::current();
                $v7f2db423a49b305459147332fb01cf87->clear();
                $v7f2db423a49b305459147332fb01cf87->push(file_get_contents(SYS_ERRORS_PATH . 'no_design_template.html'));
                $v7f2db423a49b305459147332fb01cf87->end();
            }
        }
    }
    $v21ffce5b8a6cc8cc6a41448dd69623c9 = array('class_name' => $v6f66e878c62db60568a3487869695820, 'type' => $v599dcce2998a6b40b1e38e8c6006cb0a, 'dir_path' => $v74c17e3010c33af858d215cfc3552b04, 'file_path' => $v47826cacc65c665212b821e6ff80b9b0);
    return $v21ffce5b8a6cc8cc6a41448dd69623c9;
}