Файл: adultscript-2.0.3-pro/files/mobile/components/kb.php
Строк: 52
<?php
class VComponent_mobile_kb extends VMobile
{
public function __construct()
{
parent::__construct();
}
public function render()
{
if (!VModule::enabled('news')) {
$this->notfound();
}
$segment = VUri::request(1);
$components = array('search' => 1);
if (isset($components[$segment])) {
$component = $segment;
} else {
if ($segment == '') {
$component = 'view';
} else {
$component = (ctype_digit($segment)) ? 'article' : 'category';
}
}
$component_class = 'VComponent_mobile_kb_'.$component;
try {
require BASE_DIR.'/mobile/components/kb_'.$component.'.php';
$obj = new $component_class();
$obj->render();
} catch (Exception $e) {
throw new VException($e);
}
}
protected function get_kb_categories()
{
if (!$categories = $this->cache->get('kb_categories', 86400)) {
$this->db->query("SELECT cat_id, name, slug, total_articles
FROM #__kb_categories
ORDER BY pos ASC");
if ($this->db->affected_rows()) {
$categories = $this->db->fetch_rows();
$this->cache->store('kb_categories', $categories, 86400);
} else {
$categories = array();
}
}
return $categories;
}
}