Файл: my/lenta.php
Строк: 190
<?php
define('GCMS',true);
define('ROOT','../');
require_once (ROOT.'system/power.php');
if ($aut) {
$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");
if($sob1>0) $sob1='+'.$sob1; else $sob1=null;
if($sob2>0) $sob2='+'.$sob2; else $sob2=null;
if($sob3>0) $sob3='+'.$sob3; else $sob3=null;
if($do!='clear')echo '<div class="levo"><a href="?do=clear" class="levo_tuch">'.$diz -> img('r.png').' Очистить ленту</a></div>';
switch ($do) {
case '2':
echo '<div class="but_razdel">
<a class="button_razdel" href="?">Все <span class="chet"/>'.$sob1.'</span></a>
<span class="button_razdel"><b>События <span class="chet"/>'.$sob2.'</b></span></span>
<a class="button_razdel" href="?do=3">Люди <span class="chet"/>'.$sob3.'</span></a>
</div>';
$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 -> famname($lenta['uid']).'<br/><br/>
'.$func->tags($func->lenta_tag($lenta['text'])).'<br/><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>';
break;
case '3':
echo '<div class="but_razdel">
<a class="button_razdel" href="?">Все <span class="chet"/>'.$sob1.'</span></a>
<a class="button_razdel" href="?do=2">События <span class="chet"/>'.$sob2.'</span></a>
<span class="button_razdel"><b>Люди <span class="chet"/>'.$sob3.'</b></span></span>
</div>';
$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 -> famname($lenta['uid']).'<br/><br/>
'.$func->tags($func->lenta_tag($lenta['text'])).'<br/><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>';
break;
case 'clear':
if (!isset($_GET['true'])) {
echo '<div class="fon">Вы точно желаете очистить вашу ленту событий?</div>';
echo '<div class="dialog">
<a class="dialog_m" href="?do=clear&true">Да</a>
<a class="dialog_m" href="?">Нет</a>
</div>';
} else {
$db -> query("DELETE FROM `lenta` WHERE `where`='$ya[id]'");
header('location: lenta.php');
}
echo '<div class="levo"><a href="?" class="levo_tuch">'.$diz -> img('back.png').' Лента Событий</a></div>';
break;
default:
echo '<div class="but_razdel">
<span class="button_razdel"><b>Все <span class="chet"/>'.$sob1.'</b></span></span>
<a class="button_razdel" href="?do=2">События <span class="chet"/>'.$sob2.'</span></a>
<a class="button_razdel" href="?do=3">Люди <span class="chet"/>'.$sob3.'</span></a>
</div>';
$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 -> famname($lenta['uid']).'<br/><br/>
'.$func->tags($func->lenta_tag($lenta['text'])).'<br/><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>';
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');
?>