View file system/inc/classes/menu_widget.class.php

File size: 4.06Kb
<?

class menu_widget {

public function count($post) {
    return include_once H. 'system/counts/'.$post;                
    }

    public function shouts() {
            global $menu_widget;
        $shouts = mysql_query("SELECT * FROM `shouts` WHERE `time` > '".(time()-86400)."'ORDER BY `id` DESC LIMIT ".$menu_widget['shouts']."");
		if(mysql_num_rows($shouts) > 0) {
            while($shout = mysql_fetch_array($shouts)) {
                $user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '".$shout['user_id']."'"));
                echo '<div class="posts_gl">
                    <table cellspacing="0" callpadding="0" width="100%"><tr>
                    <td class="name" colspan="10"><strong><a href="'.DIR_SHCMS.'change_view.php?id='.$user['id'].'">'.$user['login'].'</a></strong>
			        <span class="maintime">'.DateClass::make_date($shout['time']).'</span><br/>'.processing($shout['text']).'</td></tr></table>
                    </div>';
            }
		}else {
		 echo ' <div class="posts_gl">         
                <table  cellspacing="0" callpadding="0" width="100%">
                  <tr><td class="icons"><img src="/template/icon/empty.png" alt="" /> </td>
                    <td class="name">Новых сообщений в мини-чате нет!</td>
                  </tr></table></div>';
		
		}	
    }

    public function uncos() {
	global $menu_widget;
        $uncos_ = mysql_query("SELECT * FROM `uncos` WHERE `time` > '".(time()-86400)."'ORDER BY `id` DESC LIMIT ".$menu_widget['uncos']."");
		if(mysql_num_rows($uncos_) > 0) {
            while($uncos = mysql_fetch_array($uncos_)) {
                echo '<div class="posts_gl">
                    <table cellspacing="0" callpadding="0" width="100%"><tr>
					<td class="icons"><img src="/template/icon/news.png" alt="" /> </td>
                    <td class="name" colspan="10"><a href="/uncos/categories.php?act=more&id='.$uncos['id'].'">'.$uncos['title'].'</a>
			        <span class="maintime">'.DateClass::make_date($uncos['time']).'</span></td></tr></table>
                    </div>';
            }
		}else {
		 echo ' <div class="posts_gl">         
                <table  cellspacing="0" callpadding="0" width="100%">
                  <tr><td class="icons"><img src="/template/icon/empty.png" alt="" /> </td>
                    <td class="name">Новых новостей нет!</td>
                  </tr></table></div>';
		
		}	
    }
    public function  new_them() {
	global $menu_widget;
        $new_them = mysql_query("SELECT * FROM `forum_them` WHERE `time` >".(time()-86400)." ORDER BY `time` DESC LIMIT ".$menu_widget['new_them']."");
		if(mysql_num_rows($new_them) > 0) {
            while($new_themes = mysql_fetch_array($new_them)) {
			            $razd = mysql_fetch_array(mysql_query("SELECT * FROM `forum_razd` WHERE `id` = '$new_themes[id_razd]' "));
            $cat = mysql_fetch_array(mysql_query("SELECT * FROM `forum_cat` WHERE `id` = '$new_themes[id_cat]'"));
            $count = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_mess` WHERE `id_them` = '$new_themes[id]'"),0);
                echo '<div class="posts_gl">
                    <table cellspacing="0" callpadding="0" width="100%"><tr>
					<td class="icons"><img src=/forum/icon/icon_them/them.gif alt="" /> </td>
                    <td class="name" colspan="10"><a href="/forum/message.php?id='.$new_themes['id'].'"><b>'.$new_themes['name'].'</b></a>
					<span class="maintime">'.DateClass::make_date($new_themes['time']).'</span><br/><span class="maintime"><b>Ответов: '.$count.'</b></span>
				   </td></tr></table>
                    </div>';
            }
		}else {
		 echo ' <div class="posts_gl">         
                <table  cellspacing="0" callpadding="0" width="100%">
                  <tr><td class="icons"><img src="/template/icon/empty.png" alt="" /> </td>
                    <td class="name">Новых тем на форуме не найдено!</td>
                  </tr></table></div>';
		
		}	
    }	
}





?>