$fdata .= $f->fgets(); } $buffer[(int) substr(str_replace($dir, "", $file), 0, 3)] = $fdata; } } $output = JSMin::minify(implode(";\n", $buffer)); header("Content-type: application/x-javascript; charset: UTF-8"); $forceGz = filter_input(INPUT_GET, 'gz', FILTER_SANITIZE_STRING); $forcePlain = filter_input(INPUT_GET, 'plain', FILTER_SANITIZE_STRING); $encoding = checkCanGzip(); if ($forceGz) { header("Content-Encoding: {$encoding}"); echo gzDocOut($output); } elseif ($forcePlain) { echo $output; } else { if ($encoding) { header("Content-Encoding: {$encoding}"); echo GzDocOut($output); } else { //echo $output; //Sobreescribimos el fichero con los posibles cambios file_put_contents("../js/js.js", $output); //versionamos el fichero en el index para forzar la actualización de las caches de los navegadores $index = "../index.html"; $contents = file_get_contents($index, true); $contents = preg_replace('/"js.js.js.v=.*"/i', '"js/js.js?v=' . date("YmdHi") . '"', $contents); file_put_contents($index, $contents); } } //*/
public function pageEnd($show_info = false) { global $setting; for ($i = count($this->func_end) - 1; $i >= 0; $i--) { call_user_func($this->func_end[$i]); } $setting['info']['query_count'] = $GLOBALS['db']->Close(); if ($GLOBALS['db']->GetError($err_info) && isset($GLOBALS['op_mode'])) { ob_clean(); echo showInfo($setting['language']['admin_database_error'] . '<ol style="text-align:left;font-weight:normal;"><li>' . implode('</li><li>', $err_info) . '</li></ol>', 0); } if (!empty($GLOBALS['goto_url']) && ob_get_length() == 0) { header("location: " . $GLOBALS['goto_url']); } else { GzDocOut($setting['gen']['gzip_level'], $show_info); } unset($GLOBALS['db'], $GLOBALS['req'], $GLOBALS['setting'], $this); exit; }
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(); }
function display($data = array(), $tpl = null) { if (!$tpl) { $tpl = $this->tplComponent; } $this->refreshContainer(); $out = $this->render($data, $this->tplContainer, $this->render($data, $tpl)); //Вывод ob_start(); ob_implicit_flush(0); echo $out; global $begin_time, $query_count, $query_time, $query_report; $t = microtime(true) - $begin_time; ?> <!-- <?php echo $t; ?> --><!-- <?php echo $query_count; ?> <?php echo $query_time; ?> --><!-- <?php echo $t - $query_time; ?> --><?php ?> <!-- <?php echo isset($_GET['debug']) && $_GET['debug'] == 'true' ? $query_report : ''; ?> --><?php GzDocOut(3, isset($_GET['debug']) && $_GET['debug'] == 'true'); }