Файл: my/lenta.php
Строк: 294
<?php
define('GCMS',true);
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="levo"><a href="?do=clear" class="levo_tuch">'.$diz -> img('r.png').' Очистить ленту</a></div>';
if($do!='set_read' and $do!='clear' and $sob1>0)echo '<div class="levo"><a href="?do=set_read" 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()) {
$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',$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']).' '.$func -> online($lenta['uid']).'<br/>
'.$func->tags($func->lenta_tag(text_to_emoji($lenta['text']))).'<br/>';
///////////
$count_dinamyc = $db -> dbcount('COUNT(`id`)','files',"`what`='dinamyc_stena".$lenta['from']."'");
if($count_dinamyc>0){
$for4 = $db -> query("SELECT `id`,`name`,`url`,`format` FROM `files` where `what`='dinamyc_stena".$lenta['from']."' order by `time`,`format` desc");
while ($ass = $for4 -> fetch_assoc()) {
if($ass['format']=='mp3')echo '<span class="date">'.$ass['name'].'</span>'.$func->player(ROOT.'downloads/other/'.$ass['url'],3).'<br/>';
if($ass['format']!='mp3'){
if(file_exists(ROOT.'downloads/other/'.$ass['url']))$photo_url=ROOT.'downloads/other/'.$ass['url']; else $photo_url=ROOT.'downloads/foto/'.$ass['url'];
echo '<a href="'.$photo_url.'">
<img style="padding:5px;" src="/system/resize.php?img='.$photo_url.'&width=124&height=124&i=0"/></a><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"/>Событий пока нет</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()) {
$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',$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']).' '.$func -> online($lenta['uid']).'<br/>
'.$func->tags($func->lenta_tag(text_to_emoji($lenta['text']))).'<br/>';
///////////
$count_dinamyc = $db -> dbcount('COUNT(`id`)','files',"`what`='dinamyc_stena".$lenta['from']."'");
if($count_dinamyc>0){
$for4 = $db -> query("SELECT `id`,`name`,`url`,`format` FROM `files` where `what`='dinamyc_stena".$lenta['from']."' order by `time`,`format` desc");
while ($ass = $for4 -> fetch_assoc()) {
if($ass['format']=='mp3')echo '<span class="date">'.$ass['name'].'</span>'.$func->player(ROOT.'downloads/other/'.$ass['url'],3).'<br/>';
if($ass['format']!='mp3'){
if(file_exists(ROOT.'downloads/other/'.$ass['url']))$photo_url=ROOT.'downloads/other/'.$ass['url']; else $photo_url=ROOT.'downloads/foto/'.$ass['url'];
echo '<a href="'.$photo_url.'">
<img style="padding:5px;" src="/system/resize.php?img='.$photo_url.'&width=124&height=124&i=0"/></a><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">Событий пока нет</div>';
break;
///очистка
case 'clear':
if($sob_all>0){
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>';
}else header('Location: ?');
break;
///всё как прочитанное
case 'set_read':
if($sob_all>0){
if (!isset($_GET['true'])) {
echo '<div class="fon">Вы действительно желаете пометить всё как прочитанное?</div>';
echo '<div class="dialog">
<a class="dialog_m" href="?do=set_read&true">Да</a>
<a class="dialog_m" href="?">Нет</a>
</div>';
} else {
$db -> query("UPDATE `lenta` SET `status`='0' WHERE `where` = '".$ya['id']."' and `status`='1'");
header('location: lenta.php');
}
echo '<div class="levo"><a href="?" class="levo_tuch">'.$diz -> img('back.png').' Лента Событий</a></div>';
}else header('Location: ?');
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()) {
$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',$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']).' '.$func -> online($lenta['uid']).'<br/>
'.$func->tags($func->lenta_tag(text_to_emoji($lenta['text']))).'<br/>';
///////////
$count_dinamyc = $db -> dbcount('COUNT(`id`)','files',"`what`='dinamyc_stena".$lenta['from']."'");
if($count_dinamyc>0){
$for4 = $db -> query("SELECT `id`,`name`,`url`,`format` FROM `files` where `what`='dinamyc_stena".$lenta['from']."' order by `time`,`format` desc");
while ($ass = $for4 -> fetch_assoc()) {
if($ass['format']=='mp3')echo '<span class="date">'.$ass['name'].'</span>'.$func->player(ROOT.'downloads/other/'.$ass['url'],3).'<br/>';
if($ass['format']!='mp3'){
if(file_exists(ROOT.'downloads/other/'.$ass['url']))$photo_url=ROOT.'downloads/other/'.$ass['url']; else $photo_url=ROOT.'downloads/foto/'.$ass['url'];
echo '<a href="'.$photo_url.'">
<img style="padding:5px;" src="/system/resize.php?img='.$photo_url.'&width=124&height=124&i=0"/></a><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">Событий пока нет</div>';
}
echo '<div class="levo"><a href="./" class="levo_tuch">'.$diz -> img('back.png').' Личный кабинет</a></div>';
echo '<div class="levo"><a href="'.ROOT.'" class="levo_tuch">'.$diz -> img('home.png').' На главную</a></div>';
#####Копирайт#######
$diz -> out($msg);
}else header('location: '.ROOT.'aut.php');
?>