Файл: system/classes/stat.php
Строк: 131
<?php
class Stat {
public function __construct() {}
public function last_news() {
global $db;
global $lang;
if($db->query("SELECT * FROM `news`")->rowCount() != 0) {
$last_news_q = $db->query("SELECT * FROM `news` ORDER BY time DESC LIMIT 1");
while($last_news = $last_news_q->fetch()) {
if(($last_news['time']+60*60*8784) > time()) {
echo '<div class="post"><b>'. $last_news['name'].'</b> ['. rtime($last_news['time']) .']<br/>';
if(mb_strlen($last_news['text']) > 140) {
echo mb_substr(output($last_news['text']), 0, 140).'.. <a href="/news/article/'.$last_news['id'].'/">'.$lang->word('read_more').'</a><br/>';
}
else {
echo output($last_news['text']).'<br/>';
}
echo '</div>';
}
}
}
}
public function news() {
global $db;
$all_news = $db->query("SELECT * FROM `news`")->rowCount();
return ' ['.$all_news.']';
}
public function mini_chat() {
global $db;
$mini_chat = $db->query("SELECT * FROM `mini_chat`")->rowCount();
$mini_chat_new_posts = $db->query("SELECT * FROM `mini_chat` WHERE `time` > '". (time()-60*60*24) ."'")->rowCount();
return '['.$mini_chat.'] '.($mini_chat_new_posts > 0 ? '<font color="green">+'.$mini_chat_new_posts.'</font>' : NULL);
}
public function forum() {
global $db;
$topics = $db->query("SELECT * FROM `forum_t`")->rowCount();
$posts = $db->query("SELECT * FROM `forum_pt`")->rowCount();
$new_posts = $db->query("SELECT * FROM `forum_pt` WHERE `time` > '". (time()-60*60*24) ."'")->rowCount();
return "[".$topics."/".$posts."]".($new_posts > 0 ? ' <a href="/forum/new_posts/"><b><font color="white">+'.$new_posts.'</font></b></a>' : NULL);
}
public function share() {
global $db;
$new_files = $db->query("SELECT * FROM `share_files` WHERE `time` > '". (time()-60*60*24) ."'")->rowCount();
$files = $db->query("SELECT * FROM `share_files`")->rowCount();
return '['.$files.']'.($new_files > 0 ? ' <a href="/share/new_files/"><b><font color="white">+'.$new_files.'</font></b></a>' : NULL);
}
public function users() {
global $db;
$users = $db->query("SELECT * FROM `users`")->rowCount();
$new_users = $db->query("SELECT * FROM `users` WHERE `reg_time` > '".(time()-60*60*24)."'")->rowCount();
return "[".$users."]".($new_users>0 ? "<font color='green'>+".$new_users."</font>" : NULL)."";
}
public function mail() {
global $db;
global $user;
$new_mail = $db->query("SELECT * FROM `mail` WHERE `who_id` = '". $user['id'] ."' AND `read` = '0'")->rowCount();
return "".($new_mail>0 ? "/<span class="red">+".$new_mail."</span>" : NULL)."";
}
public function online() {
global $db;
global $lang;
$on_u = $db->query("SELECT * FROM `users` WHERE `time` > '". (time()-600) ."'")->rowCount();
$on_g = $db->query("SELECT * FROM `guests` WHERE `time` > '". (time()-600) ."'")->rowCount();
$on_a = $on_u + $on_g;
return "". $lang->word('online') .": [<a href="/online/">".$on_u."</a> | <a href="/guests/">".$on_g."</a>]n";
}
public function footer() {
global $theme;
global $system;
// PLEASE NOT DELETE //
return '<small><a href="/">© '.$system['copyright'].'</a></small>';
}
public function adsHeader()
{
global $db;
$ah_r = $db->query("SELECT * FROM `ads` WHERE `type` = '1'")->rowCount();
if($ah_r != 0)
{
echo '<div class="block">';
$ah_q = $db->query("SELECT * FROM `ads` WHERE `type` = '1'");
while($ah = $ah_q->fetch())
{
echo "<a href="".($ah['redirect'] == 1 ? '/pages/redirect?url=' : NULL) ."". $ah['link'] ."">» ". output($ah['name']) ."</a><br/>n";
}
echo '</div>';
}
}
public function adsFooter()
{
global $db;
$af_r = $db->query("SELECT * FROM `ads` WHERE `type` = '2'")->rowCount();
if($af_r != 0)
{
echo '<div class="block">';
$af_q = $db->query("SELECT * FROM `ads` WHERE `type` = '2'");
while($af = $af_q->fetch())
{
echo "<a href="".($af['redirect'] == 1 ? '/pages/redirect?url=' : NULL) ."". $af['link'] ."">» ". output($af['name']) ."</a><br/>n";
}
echo '</div>';
}
}
}