Файл: my/lenta.php
Строк: 163
<?php
define('GCMS',true);
define('ROOT','../');
require_once (ROOT.'system/power.php');
if ($aut) {
switch ($do) {
case '1':
$diz -> head('Лента событий');
$diz -> title('Лента событий');
$count = $db -> dbcount('COUNT(*)','lenta','`where`='.$ya['id'].'');
if($count>0) {
$num = isset($ya['num']) ? $ya['num'] : 10;
$total = intval(($count - 1) / $num) + 1;
if (!isset($_GET['page']) || !is_numeric($_GET['page']) || $_GET['page'] < 1 )
{
$page = 1;
} elseif($_GET['page'] > $total)
{ $page = $total;
} else $page = (int)$_GET['page'];
$start = $page * $num - $num;
$array = $db -> query("Select * FROM `lenta` WHERE `where`='".$ya['id']."' ORDER BY `id` desc LIMIT ".$start.",".$num);
while ($lenta = $array -> fetch_assoc()) {
if($ya['lenta']<$lenta['time'])$time='<span class="chet"/>'.$func -> times(date('d m Y в H:i',$lenta['time'])).'</span>';
else $time=$func -> times(date('d m Y в H:i',$lenta['time']));
echo '<div class="fon"><table>
<tr valign="top">
<td height="0" width="26">
'.$func->avatar($lenta['uid']).'</td>
<td>
'.$func -> user($lenta['uid']).'<br/>
'.$func->tags($func->lenta_tag($lenta['text'])).'<br/>
'.$time.'</td></tr></table></div>';
$db -> query("UPDATE `users` SET `lenta`='".time()."' WHERE `id` = '".$ya['id']."'");
}
$act = './?do=1';
echo ''.$func -> pagenav($act,$page,$total).'';
}else echo '<div class="fon"/>Событий пока нет</div>';
echo '<div class="levo"><a href="?" class="levo_tuch">'.$diz -> img('back.png').' Лента Событий</a></div>';
break;
case '2':
$diz -> head('Лента событий');
$diz -> title('Лента событий');
$count = $db -> dbcount('COUNT(*)','lenta','`where`='.$ya['id'].' and `type`=1');
if($count>0) {
$num = isset($ya['num']) ? $ya['num'] : 10;
$total = intval(($count - 1) / $num) + 1;
if (!isset($_GET['page']) || !is_numeric($_GET['page']) || $_GET['page'] < 1 )
{
$page = 1;
} elseif($_GET['page'] > $total)
{ $page = $total;
} else $page = (int)$_GET['page'];
$start = $page * $num - $num;
$array = $db -> query("Select * FROM `lenta` WHERE `where`='".$ya['id']."' and `type`=1 ORDER BY `id` desc LIMIT ".$start.",".$num);
while ($lenta = $array -> fetch_assoc()) {
if($ya['lenta']<$lenta['time'])$time='<span class="chet"/>'.$func -> times(date('d m Y в H:i',$lenta['time'])).'</span>';
else $time=$func -> times(date('d m Y в H:i',$lenta['time']));
//если это человек
if($lenta['type']==1 or $lenta['type']==2){
echo '<div class="fon"><table>
<tr valign="top">
<td height="0" width="26">
'.$func->avatar($lenta['uid']).'</td>
<td>
'.$func -> user($lenta['uid']).'<br/>
'.$func->tags($func->lenta_tag($lenta['text'])).'<br/>
'.$time.'</td>
</tr></table></div>';
}
$db -> query("UPDATE `users` SET `lenta`='".time()."' WHERE `id` = '".$ya['id']."'");
}
$act = './?do=2';
echo ''.$func -> pagenav($act,$page,$total).'';
}else echo '<div class="fon"/>Событий пока нет</div>';
echo '<div class="levo"><a href="?" class="levo_tuch">'.$diz -> img('back.png').' Лента Событий</a></div>';
break;
case '3':
$diz -> head('Лента событий');
$diz -> title('Лента событий');
$count = $db -> dbcount('COUNT(*)','lenta','`where`='.$ya['id'].' and `type`=2');
if($count>0) {
$num = isset($ya['num']) ? $ya['num'] : 10;
$total = intval(($count - 1) / $num) + 1;
if (!isset($_GET['page']) || !is_numeric($_GET['page']) || $_GET['page'] < 1 )
{
$page = 1;
} elseif($_GET['page'] > $total)
{ $page = $total;
} else $page = (int)$_GET['page'];
$start = $page * $num - $num;
$array = $db -> query("Select * FROM `lenta` WHERE `where`='".$ya['id']."' and `type`=2 ORDER BY `id` desc LIMIT ".$start.",".$num);
while ($lenta = $array -> fetch_assoc()) {
if($ya['lenta']<$lenta['time'])$time='<span class="chet"/>'.$func -> times(date('d m Y в H:i',$lenta['time'])).'</span>';
else $time=$func -> times(date('d m Y в H:i',$lenta['time']));
echo '<div class="fon"><table>
<tr valign="top">
<td height="0" width="26">
'.$func->avatar($lenta['uid']).'</td>
<td>
'.$func -> user($lenta['uid']).'<br/>
'.$func->tags($func->lenta_tag($lenta['text'])).'<br/>
'.$time.'</td>
</tr></table></div>';
$db -> query("UPDATE `users` SET `lenta`='".time()."' WHERE `id` = '".$ya['id']."'");
}
$act = './?do=3';
echo ''.$func -> pagenav($act,$page,$total).'';
}else echo '<div class="fon"/>Событий пока нет</div>';
echo '<div class="levo"><a href="?" class="levo_tuch">'.$diz -> img('back.png').' Лента Событий</a></div>';
break;
default:
$diz -> head('Лента событий');
$diz -> title('Лента событий');
$sob1 = $db -> dbcount('COUNT(`id`)','lenta',"`time`>".$ya['lenta']." and `where`='$ya[id]'");
$sob2 = $db -> dbcount('COUNT(`id`)','lenta',"`time`>".$ya['lenta']." and `where`='$ya[id]' and `type`=1");
$sob3 = $db -> dbcount('COUNT(`id`)','lenta',"`time`>".$ya['lenta']." and `where`='$ya[id]' and `type`=2");
echo '<div class="menu"><a href="?do=1" class="menutuch">Все <span class="count"/>'.$sob1.'</span></a></div>
<div class="menu"><a href="?do=2" class="menutuch">События <span class="count"/>'.$sob2.'</span></a></div>
<div class="menu"><a href="?do=3" class="menutuch">Люди <span class="count"/>'.$sob3.'</span></a></div>';
}
echo '<div class="levo"><a href="./" class="levo_tuch">'.$diz -> img('back.png').' Личный кабинет</a></div>';
echo '<div class="levo"><a href="/index.php" class="levo_tuch">'.$diz -> img('home.png').' На главную</a></div>';
#####Копирайт#######
$diz -> out($msg);
}else header('location: '.ROOT.'aut.php');
?>