VERDAN,
Да легко)) (+/-)
static function library()
{
//$file = ROOTPATH . 'files/cache/count_library.dat';
//if (file_exists($file) && filemtime($file) > (time() - 3200)) {
// $res = unserialize(file_get_contents($file));
// $total = $res['total'];
// $new = $res['new'];
// $mod = $res['mod'];
//} else {
$cnt = DB::getInstance()->getAssoc(DB::getInstance()->query("SELECT (
SELECT COUNT(*) FROM `library_texts` WHERE `premod` = '1') AS `total`, (
SELECT COUNT(*) FROM `library_texts` WHERE `time` > '" . (time() - 259200) . "' AND `premod` = '1') AS `new`, (
SELECT COUNT(*) FROM `library_texts` WHERE `premod` = '0') AS `mod`"));
//$total = DB::getInstance()->getCount(DB::getInstance()->query("SELECT COUNT(*) FROM `library_texts` WHERE `premod` = '1'"), 0);
//$new = DB::getInstance()->getCount(DB::getInstance()->query("SELECT COUNT(*) FROM `library_texts` WHERE `time` > '" . (time() - 259200) . "' AND `premod` = '1'"), 0);
//$mod = DB::getInstance()->getCount(DB::getInstance()->query("SELECT COUNT(*) FROM `library_texts` WHERE `premod` = '0'"), 0);
//file_put_contents($file, serialize(array('total' => $total, 'new' => $new, 'mod' => $mod)));
//}
if ($cnt['new']) $cnt['total'] .= ' / <span class="red"><a href="' . core::$system_set['homeurl'] . '/library/index.php?act=new">+' . $cnt['new'] . '</a></span>';
if ((core::$user_rights == 5 || core::$user_rights >= 6) && $cnt['mod']) {
$cnt['total'] .= ' / <span class="red"><a href="' . core::$system_set['homeurl'] . '/library/index.php?act=premod">M:' . $cnt['mod'] . '</a></span>';
}
return $cnt['total'];
}