Ejemplo n.º 1
0
    function display($data = array(), $tpl = null, $tplContainer = null, $cache = null)
    {
        global $ST;
        $this->setClientId();
        $this->setFirstReferer();
        $this->setRefId();
        if (!$tpl) {
            $tpl = $this->tplComponent;
        }
        if (!$tplContainer) {
            $tplContainer = $this->getTplContainer();
        }
        $this->refreshContainer();
        /* ceo */
        $rs = $ST->select("SELECT * FROM sc_ceo_meta\r\n\t\t\t WHERE \r\n\t\t\t \t(url='" . SQL::slashes($_SERVER['REQUEST_URI']) . "' AND rule='=') \r\n\t\t\t \tOR ('" . SQL::slashes($_SERVER['REQUEST_URI']) . "' LIKE CONCAT(url,'%') AND rule!='=' ) \r\n\t\t\t ORDER BY LENGTH(url) DESC LIMIT 1");
        /* ceo */
        $this->setCeo(array('url' => $_SERVER['REQUEST_URI']));
        if ($rs->next()) {
            $this->setCeo($rs->getRow());
            if ($this->getCeo('title')) {
                $this->setTitle($this->getCeo('title'));
            }
            if ($this->getCeo('header')) {
                $this->setHeader($this->getCeo('header'));
            }
            if ($this->getCeo('description')) {
                $this->setDescription($this->getCeo('description'));
            }
            if ($this->getCeo('keywords')) {
                $this->setKeywords($this->getCeo('keywords'));
            }
        }
        if (Cfg::get('STAMP')) {
            Img::$stamp = true;
        }
        $rnd = $this->render($data, $tpl);
        $out = $this->render($data, $tplContainer, $rnd);
        $t = microtime(true);
        if (preg_match_all('/\\{%(.+)%\\}/U', $out, $res) && $res) {
            $vals = array();
            foreach ($res[1] as $id => $key) {
                //07.09.2011 Возможность создавать содержимое по названию
                $tmp = '';
                if ($this->isAdmin()) {
                    $tmp = '<a href="/admin/content/?act=edit&name=' . trim($key) . '" class="coin-text-edit" title="Редактировать"></a>' . $res[0][$id];
                }
                $vals[trim($key)] = $tmp;
            }
            foreach ($this->cacheSelect("SELECT * FROM sc_content WHERE c_name IN('" . implode("','", array_keys($vals)) . "')", 0) as $row) {
                $res = $row['c_text'];
                if ($this->isAdmin()) {
                    $res = '<a href="/admin/content/?act=edit&name=' . $row['c_name'] . '" class="coin-text-edit" title="Редактировать"></a>' . $res;
                }
                $vals[$row['c_name']] = $res;
            }
            $out = preg_replace('/\\{%(.+)%\\}/Ue', '$vals[trim("\\1")]', $out);
            //_replace($keys[$rs->get('c_name')],$res,$out);
        }
        $this->visitLog();
        //Вывод
        ob_start();
        ob_implicit_flush(0);
        echo $out;
        global $begin_time, $query_count, $query_time, $query_report, $cache_time;
        $t = microtime(true) - $begin_time;
        ?>
<!-- <?php 
        echo $t;
        ?>
 --><!-- <?php 
        echo $query_count;
        ?>
 <?php 
        echo $query_time;
        ?>
 --><!-- <?php 
        echo $t - $query_time;
        ?>
 <?php 
        echo $cache_time;
        ?>
--><?php 
        ?>
<!-- <?php 
        echo isset($_GET['debug']) && $_GET['debug'] == 'true' ? $query_report : '';
        ?>
 --><?php 
        GzDocOut(3, isset($_GET['debug']) && $_GET['debug'] == 'true');
        $this->updateAdvView();
    }