Файл: vsime.com/lenta/inc/act_more.php
Строк: 249
<?
$lenta = mysqli_fetch_array(mysqli_query($dbi, "SELECT * FROM `lenta` WHERE `id` = '".intval($_GET['id'])."' AND `id_user` = '$user[id]'"));
if ($lenta == NULL)
{
$title .= ' - Ошибка!';
ex_head();
$error[] = 'Запись не найдена.';
show_errors();
ex_foot();
}
$ank = profile($lenta['id_ank']);
$where = array();
$no_in_list = array();
$lenta_stday_time = mktime(0,0,0, date('m', $lenta['time']), date('d', $lenta['time']), date('Y', $lenta['time']));
$lenta_ntday_time = $lenta_stday_time+(3600*24);
if ($lenta['type']=='diary')
{
$diary = mysqli_fetch_array(mysqli_query($dbi, "SELECT * FROM `diary` WHERE `id` = '$lenta[id_object]'"));
if(($diary['access']=='all' || $diary['access']=='friends' && is_friend($ank['id'], $user['id']) || $diary['access']=='pass') || isset($moderate_diary))$where[] = $lenta['id'];
}
if ($lenta['type']=='topic')
{
$topic = mysqli_fetch_array(mysqli_query($dbi, "SELECT * FROM `forum` WHERE `id` = '$lenta[id_object]' AND `type` = 'topic'"));
$where[] = $lenta['id'];
}
if ($lenta['type']=='file')
{
$files_lenta[$lenta['id']] = array();
$file = mysqli_fetch_array(mysqli_query($dbi, "SELECT * FROM `files` WHERE `id` = '$lenta[id_object]'"));
$no_hack = 1;
$_GET['id'] = $ank['id'];
$dir = dir_files_info($file['id_dir']);
if (!dir_files_access($dir, NULL, 1))$no_in_list[] = $post['id'];
$query_files = mysqli_query($dbi, "SELECT * FROM `lenta` WHERE `id_object2` = '$dir[id]' AND `type` = 'file' AND `id_user` = '$user[id]' AND `id_ank` = '$ank[id]' AND (`time` > '$lenta_stday_time' OR `time` = '$lenta_stday_time') AND (`time` < '$lenta_ntday_time' OR `time` = '$lenta_ntday_time') ORDER BY `time` DESC");
while ($lenta_files = mysqli_fetch_array($query_files))
{
$files_lenta[$lenta['id']][] = $lenta_files['id'];
$no_ilist[$lenta_files['id']] = 0;
}
$where[] = $lenta['id'];
}
if ($lenta['type']=='foto')
{
$fotos_lenta[$lenta['id']] = array();
$foto = mysqli_fetch_array(mysqli_query($dbi, "SELECT * FROM `foto` WHERE `id` = '$lenta[id_object]'"));
$no_hack = 1;
$_GET['id'] = $ank['id'];
$dir = dir_fotos_info($foto['id_dir']);
if (!dir_fotos_access($dir, NULL, 1))$no_in_list[] = $post['id'];
$query_fotos = mysqli_query($dbi, "SELECT * FROM `lenta` WHERE `id_object2` = '$dir[id]' AND `type` = 'foto' AND `id_user` = '$user[id]' AND `id_ank` = '$ank[id]' AND (`time` > '$lenta_stday_time' OR `time` = '$lenta_stday_time') AND (`time` < '$lenta_ntday_time' OR `time` = '$lenta_ntday_time') ORDER BY `time` DESC");
while ($lenta_fotos = mysqli_fetch_array($query_fotos))
{
$fotos_lenta[$lenta['id']][] = $lenta_fotos['id'];
$no_ilist[$lenta_fotos['id']] = 0;
}
$where[] = $lenta['id'];
}
if (count($no_in_list)>0)
{
$no_in_list = implode("' AND `id` != '", $no_in_list);
$no_in_list = " AND `id` != '$no_in_list'";
}
else $no_in_list = NULL;
if (count($where)>0)
{
$where = implode("' OR `id` = '", $where);
if ($where!=NULL)$where = " AND (`id` = '$where')";
}
else $where = NULL;
if ($where == NULL || $no_in_list!=NULL)
{
$title .= ' - Ошибка!';
ex_head();
$error[] = 'Запись не найдена.';
show_errors();
ex_foot();
}
$title .= ' - Подробнее';
ex_head();
echo "<div class='list'>n";
if ($lenta['type'] == 'diary')
{
$diary = mysqli_fetch_array(mysqli_query($dbi, "SELECT * FROM `diary` WHERE `id` = '$lenta[id_object]'"));
$count_komms = mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `diary_komm` WHERE `id_diary` = '$diary[id]'"));
echo "<div class='left'>n";
show_avatar($ank['id'], 'small');
echo "</div>n";
echo "<div class='overfl_hid'>n";
echo "<span class='right'>".($lenta['trash']==0?"<a href='?act=delete&id=$lenta[id]'>$config[code_delete]":"<a href='?act=restore&id=$post[id]'>$config[code_restore]</a>")."</span>n";
echo profile_icon($ank['id']).profile_nick($ank['id']);
echo " создал запись <a href='/diary/?act=diary&id=$diary[id]'>".($diary['name']!=NULL?hsc($diary['name']):str_cut($diary['text'], 5, 50))."</a><br />n";
echo output_text(str_cut($diary['text'], 20, 200), $ank['id']);;
echo "<br />n";
echo image_ww('/i/site/message.png')." <a href='/diary/?act=diary&id=$diary[id]#komms'>Обсудить".($count_komms!=0?" ($count_komms)":null)."</a><br/>n";
echo "</div>n";
}
if ($lenta['type'] == 'topic')
{
$topic = mysqli_fetch_array(mysqli_query($dbi, "SELECT * FROM `forum` WHERE `id` = '$lenta[id_object]' AND `type` = 'topic'"));
$topic['link'] = "/forum/?act=topic&id=$topic[id]";
if ($topic['id_comm'])$topic['link'] = "/comm/?act=forum&id=$topic[id_comm]&cat_show=$topic[id_cat]&topic_show=$topic[id]";
echo "<div class='overfl_hid'>n";
echo "<span class='right'>".($lenta['trash']==0?"<a href='?act=delete&id=$lenta[id]'>$config[code_delete]":"<a href='?act=restore&id=$post[id]'>$config[code_restore]</a>")."</span>n";
echo profile_icon($ank['id']).profile_nick($ank['id']);
echo " создал тему <a href='$topic[link]'>".hsc($topic['name'])."</a><br />n";
echo output_text(str_cut($topic['msg'], 20, 200), $ank['id']);
echo "</div>n";
}
if ($lenta['type']=='file')
{
$file = mysqli_fetch_array(mysqli_query($dbi, "SELECT * FROM `files` WHERE `id` = '$lenta[id_object]'"));
$no_hack = 1;
$_GET['id'] = $ank['id'];
$dir = dir_files_info($file['id_dir']);
echo "<div class='overfl_hid'>n";
echo "<span class='right'>".($lenta['trash']==0?"<a href='?act=delete&id=$lenta[id]'>$config[code_delete]":"<a href='?act=restore&id=$post[id]'>$config[code_restore]</a>")."</span>n";
echo profile_icon($ank['id']).profile_nick($ank['id']);
echo " добавил файл в <a href='/files/?dir=$dir[id]&id=$ank[id]'>".hsc($dir['name'])."</a><br />n";
//print_r($files_lenta[$lenta['id']]);
$num_item = 0;
//print_r($files_lenta[$lenta['id']]);
foreach ($files_lenta[$lenta['id']] AS $key => $file_id)
{
$num_item++;
$lenta = mysqli_fetch_array(mysqli_query($dbi, "SELECT * FROM `lenta` WHERE `id` = '$file_id'"));
$file = mysqli_fetch_array(mysqli_query($dbi, "SELECT * FROM `files` WHERE `id` = '$lenta[id_object]'"));
if (ffs_screen($file['id'], 'file', WapWeb_show(48, 96), WapWeb_show(48, 96)))
{
if (isset($last_item) && $last_item == 'no_screen')echo "<br />n";
echo "<a href='/files/?file=$file[id]'>".ffs_screen($file['id'], 'file', WapWeb_show(48, 96), WapWeb_show(48, 96))."</a>n";
$last_item = 'screen';
} else {
if (isset($last_item))echo "<br />n";
echo "<b class='none'>·</b> <a href='/files/?file=$file[id]'>".hsc($file['name'].'.'.$file['ras'])."</a>n";
$last_item = 'no_screen';
}
}
if (isset($last_item))unset($last_item);
echo "</div>n";
}
if ($lenta['type']=='foto')
{
$foto = mysqli_fetch_array(mysqli_query($dbi, "SELECT * FROM `foto` WHERE `id` = '$lenta[id_object]'"));
$no_hack = 1;
$_GET['id'] = $ank['id'];
$dir = dir_fotos_info($foto['id_dir']);
echo "<div class='overfl_hid'>n";
echo "<span class='right'>".($lenta['trash']==0?"<a href='?act=delete&id=$lenta[id]'>$config[code_delete]":"<a href='?act=restore&id=$post[id]'>$config[code_restore]</a>")."</a></span>n";
echo profile_icon($ank['id']).profile_nick($ank['id']);
echo " добавил фото в <a href='/fotos/?dir=$dir[id]&id=$ank[id]'>".hsc($dir['name'])."</a><br />n";
//print_r($files_lenta[$lenta['id']]);
$num_item = 0;
//print_r($files_lenta[$lenta['id']]);
foreach ($fotos_lenta[$lenta['id']] AS $key => $foto_id)
{
$num_item++;
$lenta = mysqli_fetch_array(mysqli_query($dbi, "SELECT * FROM `lenta` WHERE `id` = '$foto_id'"));
$foto = mysqli_fetch_array(mysqli_query($dbi, "SELECT * FROM `foto` WHERE `id` = '$lenta[id_object]'"));
if (ffs_screen($foto['id'], 'foto', WapWeb_show(48, 96), WapWeb_show(48, 96)))
{
if (isset($last_item) && $last_item == 'no_screen')echo "<br />n";
echo "<a href='/fotos/?foto=$foto[id]'>".ffs_screen($foto['id'], 'foto', WapWeb_show(48, 96), WapWeb_show(48, 96))."</a>n";
$last_item = 'screen';
} else {
if (isset($last_item))echo "<br />n";
echo "<b class='none'>·</b> <a href='/fotos/?foto=$foto[id]'>".hsc($foto['name'].'.'.$foto['ras'])."</a>n";
$last_item = 'no_screen';
}
}
if (isset($last_item))unset($last_item);
echo "</div>n";
}
echo "<div class='clear'></div>n";
echo "</div>n";
echo "<div class='foot'>n";
echo image_back()." <a href='/lenta".($lenta['trash']==1?"/?act=trash":NULL)."'>Назад</a>n";
echo "</div>n";
ex_foot();
?>