Файл: my/stensa.php
Строк: 89
<?
define('GCMS',true);
define('ROOT','../');
require_once (ROOT.'system/power.php');
$sql = $db -> query("SELECT * FROM `users` WHERE `id` = '".$id."' LIMIT 1");
if ($sql -> num_rows > 0) {
$user = $sql -> fetch_assoc();
$diz -> head($func->famname($id,0),$func->famname($id,0),$func->famname($id,0));
$diz -> title($func->famname($id,0));
///
if($ya['id']!=$user['id']){
$g = $db -> dbcount('COUNT(`id`)','reit',"`komy` = '".$user['id']."' and `kto`='".$ya['id']."' and `where`='guest'");
$gu = $db -> query("SELECT * FROM `reit` WHERE `komy` = '".$user['id']."' and `kto`='".$ya['id']."' and `where`='guest' LIMIT 1")-> fetch_assoc();
if((strftime("%d.%m.%Y",$gu['time']) == date("d.m.Y")) and $g>0){
$db -> query("UPDATE `reit` SET `time`='".time()."',`rei`='1' WHERE `id` = '".(int)$gu['id']."'");
}else{
$db -> query("INSERT INTO `reit` SET `kto`='$ya[id]', `komy` = '".(int)$user['id']."',`rei`='1', `where` = 'guest',`time` = '".time()."'");
}
}
//
if($func->ignor($ya['id'],$user['id'])==false and $nastr['stena']==1){
$count = $db -> dbcount('COUNT(`id`)','comes',"`idwh` = '".$id."' and `where`='stena'");
echo '<div class="new"><b>Стена:</b> '.$func->GetName($count,'Запись','Записи','Записей').'</div>';
if($aut){
if(($user['stenazap']==0)or($user['stenazap']==1 and $func->friends($user['id'],$ya['id'])==true)or($user['id']==$ya['id'])){
echo '<div class="podmenu"><form action="'.ROOT.'my/stena.php?id='.$id.'&mode=write_us" method="post">
<textarea cols="'.$ya['width'].'" rows="'.$ya['height'].'" name="text"></textarea><br/>
<input type="submit" value="Написать"/></form></div>';
}
}
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 = intval(abs($_GET['page']));
$start = $page * $num - $num;
////------------------/////
$for = $db -> query("SELECT * FROM `comes` where `idwh` = '".$id."' and `where`='stena' order by `time` DESC LIMIT ".$start.",".$num);
while ($assoc = $for -> fetch_assoc()) {
echo '<div class="fon">
<table><tr valign="top"><td>'.$func->avatar($assoc['user']).'</td>
<td style="padding-left:5px;">'.$func->famname($assoc['user']).' <span class= "date">'.$func -> times(date('d m Y в H:i',$assoc['time'])).'</span><br/><br/>
'.$func -> tags($func -> smiles($assoc['text'])).'</td>
</tr></table></div>';
$comes = $db -> dbcount('COUNT(`id`)','comes',"`where`='comes_stena' and `idwh`='".$assoc['id']."'");
echo '<div class="zap">
<a class="zap_b" href="'.ROOT.'post'.$assoc['id'].'">'.$diz -> img('guest.png','Комментарии').' '.$func->kol($comes).'</a>';
if ($ya['level'] > 1 or $assoc['user']==$ya['id'])echo'<a class="zap_b" href="/my/stena.php?id='.$id.'&sid='.$assoc['id'].'&mode=del_zp&page='.$page.'">Удалить</a>';
$like = $db -> dbcount('COUNT(`id`)','reit',"`where`='comes' and `komy`='".$assoc['id']."'");
if($like>0)$like=$like=$func->kol($like); else $like=null;
echo'<a onclick="like_ok(like'.$assoc['id'].');" id="like'.$assoc['id'].'" data-id="'.$assoc['id'].'" data-ya="'.$ya['id'].'" data-mode="comes" class="zap_b">'.$diz -> img('like.png').' <span class="count_like">'.$like.'</span></a></div></div>';
}
$act = '/my/user.php?id='.$id;
echo $func -> next_prev($act,$page,$total);
}else echo '<div class="fon"/>Стена пока пуста.</div>';
////------------------/////
}
} else {
$diz -> head('Ошибка');
$diz -> title('Ошибка');
echo '<div class="fon">Пользователя с данным ID не существует или он был удалён!</div>';
echo '<div class="levo"><a href="'.ROOT.'index.php" class="levo_tuch">'.$diz -> img('home.png').' На главную</a></div>';
}
#####Копирайт#######
$diz -> out($msg);
?>