settings = unserialize($set['news']);
$this->newscount = $this->newscount() . $this->lastnewscount();
$this->news = $this->news();
}
// Запрос свежих новостей на Главную
private function news() {
global $realtime;
if ($this->settings['view'] > 0) {
$reqtime = $realtime - ($this->settings['days'] * 86400);
$req = mysql_query("SELECT * FROM `news` WHERE `time` > '" . $reqtime . "' ORDER BY `time` DESC LIMIT " . $this->settings['quantity']);
if (mysql_num_rows($req) > 0) {
$news = '
';
switch ($this->settings['view']) {
case 2 :
$news .= '
' . $res['name'] . '';
break;
case 3 :
$news .= $text;
break;
default :
$news .= '
' . $res['name'] . '' . $text;
}
// Ссылка на каменты
if (!empty ($res['kom']) && $this->settings['view'] != 2 && $this->settings['kom'] == 1) {
$mes = mysql_query("SELECT COUNT(*) FROM `forum` WHERE `type` = 'm' AND `refid` = '" . $res['kom'] . "'");
$komm = mysql_result($mes, 0) - 1;
if ($komm >= 0)
$news .= '
Обсудить (' . $komm . ')';
}
$news .= '
';
++$i;
}
return $news;
}
else {
return false;
}
}
}
// Счетчик всех новостей
private function newscount() {
$req = mysql_query("SELECT COUNT(*) FROM `news`");
$res = mysql_result($req, 0);
return ($res > 0 ? $res : '0');
}
// Счетчик свежих новостей
private function lastnewscount() {
global $realtime;
$ltime = $realtime - (86400 * 3);
$req = mysql_query("SELECT COUNT(*) FROM `news` WHERE `time` > '" . $ltime . "'");
$res = mysql_result($req, 0);
return ($res > 0 ? '/