Файл: albom/index.php
Строк: 161
<?
define('ROOT','../');
define('GCMS',true);
require_once (ROOT.'system/power.php');
$diz -> head('Фотоальбомы');
$diz -> title('Фотоальбомы');
$type = $db -> query("SELECT `id`,`login` FROM `users` WHERE `id` = '$id'");
if ($type -> num_rows > 0) $the = $type -> fetch_assoc(); else $the = false;
if($type -> num_rows > 0){
if ($aut == true && $id==$ya['id']) {
$m_al = $db -> dbcount('count(`id`)','albom_pav',"`user` = '".$ya['id']."'");
echo '<div class="levo"><a href="/albom/func.php?mode=newal" class="levo_tuch">'.$diz -> img('albom/new.png').' Создать фотоальбом</a></div>';
echo '<div class="levo"><a href="/albom/upload.php" class="levo_tuch">'.$diz -> img('albom/new_foto.png').' Добавить фотографию</a></div>';
}
if(isset($id) && $id!=$ya['id']){
echo '<div class="levo"><a href="'.ROOT.'id'.$id.'" class="levo_tuch">'.$func->avatar($the['id'],18,18,1).' '.$func->famname($id,0).'</a></div>';
}
$diz -> head("Фотоальбомы $the[login]");
switch($mode) {
case 'comes':
if($func->ignor($ya['id'],$id)==false){
$count_sql = $db -> query("SELECT COUNT(`id`) as `count` FROM `comes` where `idwh` IN (SELECT `id` FROM `files` where `user`='".$id."' and `what`='foto') and `where`='albom'")->fetch_assoc();
$count=$count_sql['count'];
echo '<div class="but_razdel">
<a class="button_razdel" href="/albom/index.php?id='.$id.'">Фотографии</a>
<a class="button_razdel" href="/albom/index.php?mode=albom&id='.$id.'">Альбомы</a>
<div class="button_razdel"><b>Комментарии</b></div>';
echo'</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 = (int)$_GET['page'];
$start = $page * $num - $num;
////------------------/////
$for = $db -> query("SELECT * FROM `comes` where `idwh` IN (SELECT `id` FROM `files` where `user`='".$id."' and `what`='foto') and `where`='albom' order by `time` DESC LIMIT ".$start.",".$num);
while ($assoc = $for -> fetch_assoc()) {
$foto = $db -> query("SELECT `url` FROM `files` where `id`='".$assoc['idwh']."'")->fetch_assoc();
echo '<a href="/photo'.$assoc['idwh'].'" class="mail">
<table><tr valign="top"><td><img src="'.ROOT.'system/resize.php?img='.ROOT.'downloads/foto/'.$foto['url'].'&width=48&height=55&i=0&fix=1"/></td>
<td style="padding-left:5px;">'.$func->famname($assoc['user']).' '.$func -> times(date('d m Y в H:i',$assoc['time'])).'</br>
'.$func->tags(text_to_emoji($assoc['text'])).'</td>
</tr></table></a>';
}
$act = '/albom/index.php?mode=comes&id='.$id.'';
echo $func -> next_prev($act,$page,$total);
} else echo '<div class="fon"/>К фотографиям '.$func->famname($the['id']).' ещё нет комментариев.</div>';
}else header('Location: /albom/?id='.$id);
break;
case 'albom':
$count = $db -> dbcount('COUNT(`id`)','albom_pav',"`user` = '".$id."'");
echo '<div class="but_razdel">
<a class="button_razdel" href="/albom/index.php?id='.$id.'">Фотографии</a>
<div class="button_razdel"><b>Альбомы</b></div>';
if($func->ignor($ya['id'],$id)==false)echo'<a class="button_razdel" href="/albom/index.php?mode=comes&id='.$id.'">Комментарии</a>';
echo'</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 = (int)$_GET['page'];
$start = $page * $num - $num;
$for = $db -> query("SELECT * FROM `albom_pav` WHERE `user` = '".$id."' ORDER BY `time` DESC LIMIT ".$start.",".$num);
while ($assoc = $for -> fetch_assoc()) {
$st = $db -> dbcount('COUNT(*)','files','`where`='.$assoc['id'].' and `what`="foto"');
if($assoc['obl']!=0){
$foto_pav = $db -> query("SELECT `url` FROM `files` where `what`='foto' and `id`='".$assoc['obl']."'")->fetch_assoc();
$foto = '<img src="'.ROOT.'system/resize.php?img='.ROOT.'downloads/foto/'.$foto_pav['url'].'&width=56&height=55&i=0&fix=1"/>';
}
else $foto=$diz -> img('noava.png');
echo '<div class="menu"><a href="/albom/albom'.$assoc['id'].'" class="menutuch"/>
<table width=100%>
<tr valign="top">
<td width=2%>
'.$foto.'</td>
<td>'.$assoc['name'].'<br/>
Фотографий: '.$st.'</td></tr></table></a></div>';
}
$act = '/albom/index.php?mode=albom&id='.$id.'';
echo $func -> next_prev($act,$page,$total);
} else echo '<div class="fon"/>У '.$func->famname($the['id']).' ещё нет фотоальбомов</div>';
break;
default:
echo '<div class="but_razdel">
<div class="button_razdel"><b>Фотографии</b></div>
<a class="button_razdel" href="/albom/index.php?mode=albom&id='.$id.'">Альбомы</a>';
if($func->ignor($ya['id'],$id)==false)echo'<a class="button_razdel" href="/albom/index.php?mode=comes&id='.$id.'">Комментарии</a>';
echo'</div>';
////-------------------/////
$count = $db -> dbcount('COUNT(`id`)','files',"`user` = '".$id."' and `what`='foto'");
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;
////------------------/////
$for = $db -> query("SELECT `id`,`name`,`url` FROM `files` where `user`='$id' and `what`='foto' order by `time` DESC LIMIT ".$start.",".$num);
while ($assoc = $for -> fetch_assoc()) {
$nst2 = $db -> dbcount('COUNT(*)','comes',"`idwh` = '".$assoc['id']."' and `where`='albom'");
if ($nst2==0)$nst2=NULL;
else $nst2='<span class="chet">+'.$nst2.'</span>';
$kom = $db -> dbcount('COUNT(`id`)','comes',"`idwh` = '".$assoc['id']."' and `where`='albom'");
$foto = ''.ROOT.'downloads/foto/'.$assoc['url'];
$like = $db -> dbcount('COUNT(`id`)','reit',"`where`='files' and `komy`='".$assoc['id']."'");
$like=$func->kol($like);
echo '<div class="menu"><a href="/photo'.$assoc['id'].'" class="menutuch"/>
<table width=100%>
<tr valign="top">
<td width=2%><img src="/system/resize.php?img='.$foto.'&width=48&height=48&i=0"/></td>
<td>'.$assoc['name'].'<br/>
<span class="date"/>'.$diz -> img('comes.png').' Комментарии: <span class="count"/>'.$kom.''.$nst2.'</span></span><br/>
'.$diz -> img('like.png').'<span class="date"/> Нравится '.$like.'</span></td></tr></table></a></div>';
}
$act = '/albom/index.php?id='.$id;
echo $func -> next_prev($act,$page,$total);
} else echo '<div class="fon">У '.$func->famname($the['id']).' фотографий пока нет.</div>';
}
} else header('location: /albom/id'.$ya['id']);
echo '<div class="levo"><a href="/my/" 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);
?>