Файл: my/lenta.php
Строк: 247
<?
define('ROOT','../');
require_once (ROOT.'system/power.php');
if ($aut) {
$diz -> head('События');
$diz -> title('События');
$sob_all = $db -> dbcount('COUNT(`id`)','lenta',"`where`='$ya[id]'");
$sob1 = $db -> dbcount('COUNT(`id`)','lenta',"`status`=1 and `where`='$ya[id]'");
$sob2 = $db -> dbcount('COUNT(`id`)','lenta',"`status`=1 and `where`='$ya[id]' and `type`=1");
$sob3 = $db -> dbcount('COUNT(`id`)','lenta',"`status`=1 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' and $do!='set_read' and $sob_all>0)echo '<div class="menu"><a href="?do=clear" class="menutuch">'.$diz -> icon('r.png').' '.language('Очистить ленту').'</a></div>';
if($do!='set_read' and $do!='clear' and $sob1>0)echo '<div class="menu"><a href="?do=set_read" class="menutuch">'.$diz -> icon('r.png').' '.language('Пометить всё как прочитанное').'</a></div>';
switch ($do) {
///события
case '2':
echo '<div class="but_razdel">
<a class="button_razdel" href="?" style="width:33%">'.language('Все').' <span class="chet">'.$sob1.'</span></a>
<span class="button_razdel" style="width:33%"><b>'.language('События').' <span class="chet">'.$sob2.'</b></span></span>
<a class="button_razdel" href="?do=3" style="width:33%">'.language('Люди').' <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()) {
$db -> query("UPDATE `lenta` SET `status`='0' WHERE `id` = '".$lenta['id']."' and `status`='1'");
if($lenta['status']==1)$time='<span class="chet">'.$func -> times(date('d m Y H:i',ustime($ya['gmt'],$lenta['time']))).'</span>';else $time=$func -> times(date('d m Y H:i',ustime($ya['gmt'],$lenta['time'])));
//если это человек
if($lenta['type']==1 or $lenta['type']==2){
echo '<div class="fon"><table>
<tr valign="top">
<td height="0" width="26">
'.$fuser->avatar($lenta['uid']).'</td>
<td>
'.$fuser -> famname($lenta['uid']).' '.$fuser -> online($lenta['uid']).'<br/>
'.$func->tags($fuser->lenta_tag(language($lenta['text']))).'<br/>';
if($lenta['url']!=null)echo '</td></tr></table></div><div class="zap"><a class="zap_b" href="'.ROOT.$lenta['url'].'">'.$time.'</a></div>';
else echo '</td></tr></table></div><div class="zap"><span class="zap_b">'.$time.'</span></div>';
}
}
$act = '?do=2';
echo $func -> pagenav($act,$page,$total);
}else echo '<div class="fon">'.language('Список пуст').'</div>';
break;
///люди
case '3':
echo '<div class="but_razdel">
<a class="button_razdel" href="?" style="width:33%">'.language('Все').' <span class="chet">'.$sob1.'</span></a>
<a class="button_razdel" href="?do=2" style="width:33%">'.language('События').' <span class="chet">'.$sob2.'</span></a>
<span class="button_razdel" style="width:33%"><b>'.language('Люди').' <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()) {
$db -> query("UPDATE `lenta` SET `status`='0' WHERE `id` = '".$lenta['id']."' and `status`='1'");
if($lenta['status']==1)$time='<span class="chet">'.$func -> times(date('d m Y H:i',ustime($ya['gmt'],$lenta['time']))).'</span>';else $time=$func -> times(date('d m Y H:i',ustime($ya['gmt'],$lenta['time'])));
echo '<div class="fon"><table>
<tr valign="top">
<td height="0" width="26">
'.$fuser->avatar($lenta['uid']).'</td>
<td>
'.$fuser -> famname($lenta['uid']).' '.$fuser -> online($lenta['uid']).'<br/>
'.$func->tags($fuser->lenta_tag(language($lenta['text']))).'<br/>';
if($lenta['url']!=null)echo '</td></tr></table></div><div class="zap"><a class="zap_b" href="'.ROOT.$lenta['url'].'">'.$time.'</a></div>';
else echo '</td></tr></table></div><div class="zap"><span class="zap_b">'.$time.'</span></div>';
}
$act = '?do=3';
echo $func -> pagenav($act,$page,$total);
}else echo '<div class="fon">'.language('Список пуст').'</div>';
break;
///очистка
case 'clear':
if($sob_all>0){
if (!isset($_GET['true'])) {
echo '<div class="fon">'.language('Вы подтверждаете это действие').'?</div>';
echo '<div class="dialog">
<a class="dialog_m" href="?do=clear&true">'.language('Да').'</a>
<a class="dialog_m" href="?">'.language('Нет').'</a>
</div>';
} else {
$db -> query("DELETE FROM `lenta` WHERE `where`='$ya[id]'");
header('location: ?');
}
}else header('Location: ?');
break;
///всё как прочитанное
case 'set_read':
if($sob_all>0){
if (!isset($_GET['true'])) {
echo '<div class="fon">'.language('Вы подтверждаете это действие').'?</div>';
echo '<div class="dialog">
<a class="dialog_m" href="?do=set_read&true">'.language('Да').'</a>
<a class="dialog_m" href="?">'.language('Нет').'</a>
</div>';
} else {
$db -> query("UPDATE `lenta` SET `status`='0' WHERE `where` = '".$ya['id']."' and `status`='1'");
header('location: ?');
}
}else header('Location: ?');
break;
///все
default:
echo '<div class="but_razdel">
<span class="button_razdel" style="width:33%"><b>'.language('Все').' <span class="chet">'.$sob1.'</b></span></span>
<a class="button_razdel" href="?do=2" style="width:33%">'.language('События').' <span class="chet">'.$sob2.'</span></a>
<a class="button_razdel" href="?do=3" style="width:33%">'.language('Люди').' <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()) {
$db -> query("UPDATE `lenta` SET `status`='0' WHERE `id` = '".$lenta['id']."' and `status`='1'");
if($lenta['status']==1)$time='<span class="chet">'.$func -> times(date('d m Y H:i',ustime($ya['gmt'],$lenta['time']))).'</span>';else $time=$func -> times(date('d m Y H:i',ustime($ya['gmt'],$lenta['time'])));
echo '<div class="fon"><table>
<tr valign="top">
<td height="0" width="26">
'.$fuser->avatar($lenta['uid']).'</td>
<td>
'.$fuser -> famname($lenta['uid']).' '.$fuser -> online($lenta['uid']).'<br/>
'.$func->tags($fuser->lenta_tag(language($lenta['text']))).'<br/>';
if($lenta['url']!=null)echo '</td></tr></table></div><div class="zap"><a class="zap_b" href="'.ROOT.$lenta['url'].'">'.$time.'</a></div>';
else echo '</td></tr></table></div><div class="zap"><span class="zap_b">'.$time.'</span></div>';
}
$act = '?do=1';
echo $func -> pagenav($act,$page,$total);
}else echo '<div class="fon">'.language('Список пуст').'</div>';
}
echo '<div class="levo"><a href="./" class="levo_tuch">'.$diz -> icon('back.png').' '.language('Мой кабинет').'</a></div>';
echo '<div class="levo"><a href="'.ROOT.'" class="levo_tuch">'.$diz -> icon('home.png').' '.language('На главную').'</a></div>';
#####Копирайт#######
$diz -> out($msg);
}else header('location: '.ROOT.'aut.php');
?>