Файл: adultscript-2.0.3-pro/files/modules/static/static.php
Строк: 33
<?php
defined('_VALID') or die('Restricted Access!');
class VModule_static
{
public function __construct()
{
}
public function render()
{
$name = VUri::request(1);
if (!VUri::match('static/'.$name.'/')) {
VModule::load('404', true);
}
$db = VF::factory('database');
$cache = VF::factory('cache');
$cached = (VAuth::loggedin()) ? FALSE : TRUE;
$cache_id = 'static_'.$name;
$expire = (24*7*3600);
if (!$static = $cache->get($cache_id)) {
$db->query("SELECT name, title, content, meta_title, meta_desc, meta_keys
FROM #__static
WHERE name = '".$db->escape($name)."'
LIMIT 1");
if ($db->affected_rows()) {
$static = $db->fetch_assoc();
$cache->store($cache_id, $static, 0);
} else {
VModule::load('404', true);
}
} else {
$db->query("UPDATE #__static
SET hits = hits+1
WHERE name = '".$db->escape($name)."'
LIMIT 1");
if ($cached) {
VResponse::check_expires($expire);
}
}
$tpl = VF::factory('template');
$tpl->menu = 'home';
$tpl->submenu = '';
$tpl->meta_title = ($static['meta_title'] != '')
? $static['meta_title']
: $tpl->cfg['site_name'];
$tpl->meta_desc = $static['meta_desc'];
$tpl->meta_keys = $static['meta_keys'];
$tpl->canonical = BASE_URL.'/static/'.$name.'/';
$tpl->canonicalm = MOBILE_URL.'/static/'.$name.'/';
$tpl->title = $static['title'];
$tpl->content = $static['content'];
$tpl->load(array('header', 'static', 'footer'));
$tpl->display($cached, $expire);
}
}
?>