Файл: mob-lave.ru/moduls/forum/them.php
Строк: 444
<?php
switch($_GET['act']){
// -------- Удалить тему ----------- //
case 'delete_them':
if(isset($_GET['id_forum']) && isset($_GET['id_razdel']) && isset($_GET['id_them']) && isset($user['id']) && user_access('forum_edit_them') &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_them` WHERE `id` = '".num($_GET['id_them'])."'"),0)==1 &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_razd` WHERE `id` = '".num($_GET['id_forum'])."'"),0)==1 &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_podrazd` WHERE `id` = '".num($_GET['id_razdel'])."'"),0)==1){
$podrazdel = num($_GET['id_razdel']);
$razd = num($_GET['id_forum']);
$themes = num($_GET['id_them']);
$them = mysql_fetch_assoc(mysql_query("SELECT * FROM `$system[perfix]_forum_them` WHERE `id_razd` = '$razd' && `id_podrazd` = '$podrazdel' && `id` = '$themes'"));
if($them['screen1'] != 0) unlink(H.'files/forum/them/'.$razd.$podrazdel.$themes.'1.jpg');
if($them['screen2'] != 0) unlink(H.'files/forum/them/'.$razd.$podrazdel.$themes.'2.jpg');
if($them['screen3'] != 0) unlink(H.'files/forum/them/'.$razd.$podrazdel.$themes.'3.jpg');
mysql_query("DELETE FROM `$system[perfix]_forum_them` WHERE `id` = '$themes' && `id_razd` = '$razd' && `id_podrazd` = '$podrazdel'");
header("Location: /moduls/forum/$razd/$podrazdel/");
$_SESSION['message'] = 'Тема удалена';
exit();
} else {
header("Location: /moduls/forum/$razd/$podrazdel/$themes/");
$_SESSION['err'] = 'Ошибка, нет прав или темы не существует';
exit();
}
break;
case 'del_them':
if(isset($_GET['id_forum']) && isset($_GET['id_razdel']) && isset($_GET['id_them']) && isset($user['id']) && user_access('forum_edit_them') &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_them` WHERE `id` = '".num($_GET['id_them'])."'"),0)==1 &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_razd` WHERE `id` = '".num($_GET['id_forum'])."'"),0)==1 &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_podrazd` WHERE `id` = '".num($_GET['id_razdel'])."'"),0)==1){
$set['title'] = 'Удаление темы';
require H.'core/head.php';
require H.'core/panel.php';
$podrazdel = num($_GET['id_razdel']);
$razd = num($_GET['id_forum']);
$themes = num($_GET['id_them']);
$razdel = mysql_fetch_assoc(mysql_query("SELECT * FROM `$system[perfix]_forum_razd` WHERE `id` = '$razd'"));
$podrazd = mysql_fetch_assoc(mysql_query("SELECT * FROM `$system[perfix]_forum_podrazd` WHERE `id` = '$podrazdel'"));
$them = mysql_fetch_assoc(mysql_query("SELECT * FROM `$system[perfix]_forum_them` WHERE `id_razd` = '$razd' && `id_podrazd` = '$podrazdel' && `id` = '$themes'"));
echo '<div class="navig">'.$home. $z.'<a href="/moduls/forum/">Форум</a>'.$z.'<a href="/moduls/forum/'.$razd.'">'.htmlspecialchars($razdel['title']).'</a>'.$z.'<a href="/moduls/forum/'.$razd.'/'.$podrazdel.'">'.htmlspecialchars($podrazd['title']).'</a>'.$z.'<a href="/moduls/forum/'.$razd.'/'.$podrazdel.'/'.$themes.'">'.htmlspecialchars($them['title']).'</a>'.$z. $set['title'].'</div>';
echo '<div class="mess">Вы действително хотите удалить тему <b>'.htmlspecialchars($them['title']).'</b>?<br /><div id="dark" class="icon-checkmark"></div><a href="/moduls/forum/'.$razd.'/'.$podrazdel.'/'.$themes.'?act=delete_them"> Да</a> | <div id="dark" class="icon-undo2 "></div> <a href="/moduls/forum/'.$razd.'/'.$podrazdel.'/'.$themes.'">Нет</a></div>';
echo '<div class="navig">'.$home. $z.'<a href="/moduls/forum/">Форум</a>'.$z.'<a href="/moduls/forum/'.$razd.'">'.htmlspecialchars($razdel['title']).'</a>'.$z.'<a href="/moduls/forum/'.$razd.'/'.$podrazdel.'">'.htmlspecialchars($podrazd['title']).'</a>'.$z.'<a href="/moduls/forum/'.$razd.'/'.$podrazdel.'/'.$themes.'">'.htmlspecialchars($them['title']).'</a>'.$z. $set['title'].'</div>';
require H.'core/foot.php';
exit();
} else {
header("Location: /moduls/forum/$razd/$podrazdel/$themes/");
$_SESSION['err'] = 'Ошибка, нет прав или темы не существует';
exit();
}
break;
// ----------- Редактирование темы --------- //
case 'edit_themes':
if (isset($_GET['id_forum']) && isset($_GET['id_razdel']) && isset($_GET['id_them']) && isset($user['id']) && user_access('forum_edit_them') &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_them` WHERE `id` = '".num($_GET['id_them'])."'"),0)==1 &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_razd` WHERE `id` = '".num($_GET['id_forum'])."'"),0)==1 &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_podrazd` WHERE `id` = '".num($_GET['id_razdel'])."'"),0)==1){
$podrazdel = num($_GET['id_razdel']);
$razd = num($_GET['id_forum']);
$themes = num($_GET['id_them']);
if(isset($_POST['title']) && isset($_POST['msg'])){
if(isset($_POST['sort'])) $sort = num($_POST['sort']);
else $sort = 0;
if(isset($_POST['close'])) $close = num($_POST['close']);
else $close = 0;
if(isset($_POST['uved']) && $user['id'] == $them['avtor']) $uved = num($_POST['uved']);
else $uved = 0;
$title = check($_POST['title']);
$msg = check($_POST['msg']);
// ----- Скрины ------ //
if(isset($_FILES['file1']) && preg_match('#^.|.jpg|.png$|.gif$|.jpeg$#i',$_FILES['file1']['name']) && filesize($_FILES['file1']['tmp_name'])>0){
$uploaddir = H.'files/forum/them/';
$uploadfile=$uploaddir.$razd.$podrazdel.$themes.'1.jpg';
if(@copy($_FILES['file1']['tmp_name'],$uploadfile)){
@chmod("$uploadfile", 0777);
$screen1 = $razd.$podrazdel.$themes.'1';
}else{
$screen1 = 0;
}
mysql_query("UPDATE `$system[perfix]_forum_them` SET `screen1` = '$screen1' WHERE `id_razd` = '$razd' &&`id_podrazd` = '$podrazdel' &&`id` = '$themes'");
}
if(isset($_FILES['file2']) && preg_match('#^.|.jpg|.png$|.gif$|.jpeg$#i',$_FILES['file2']['name']) && filesize($_FILES['file2']['tmp_name'])>0){
$uploaddir = H.'files/forum/them/';
$uploadfile=$uploaddir.$razd.$podrazdel.$themes.'2.jpg';
if(@copy($_FILES['file2']['tmp_name'],$uploadfile)){
@chmod("$uploadfile", 0777);
$screen2 = $razd.$podrazdel.$themes.'2';
}else{
$screen2 = 0;
}
mysql_query("UPDATE `$system[perfix]_forum_them` SET `screen2` = '$screen2' WHERE `id_razd` = '$razd' &&`id_podrazd` = '$podrazdel' &&`id` = '$themes'");
}
if(isset($_FILES['file3']) && preg_match('#^.|.jpg|.png$|.gif$|.jpeg$#i',$_FILES['file3']['name']) && filesize($_FILES['file3']['tmp_name'])>0){
$uploaddir = H.'files/forum/them/';
$uploadfile=$uploaddir.$razd.$podrazdel.$themes.'3.jpg';
if(@copy($_FILES['file3']['tmp_name'],$uploadfile)){
@chmod("$uploadfile", 0777);
$screen3 = $razd.$podrazdel.$themes.'3';
}else{
$screen3 = 0;
}
mysql_query("UPDATE `$system[perfix]_forum_them` SET `screen3` = '$screen3' WHERE `id_razd` = '$razd' &&`id_podrazd` = '$podrazdel' &&`id` = '$themes'");
}
if (strlen($title) < 2 or strlen($title) > 100) $err = 'Название темы должено быть в пределах 2 - 100 символов';
if (strlen($msg) < 2 or strlen($msg) > 65000) $err = 'Текст темы должен быть в пределах 2 - 65 000 символов';
err();
if(!isset($err)){
mysql_query("UPDATE `$system[perfix]_forum_them` SET `uved` = '$uved', `title` = '$title', `opis` = '$msg', `sort` = '$sort', `close` = '$close' WHERE `id` = '$themes'");
if(isset($_POST['close']) && $_POST['close'] != 0) mysql_query("INSERT INTO `$system[perfix]_forum_komm` (`msg`, `time`, `id_user`, `id_them`) values('[color=#ff0000][b]".$user['login']."[/b] закрыл тему[/color]', '".time()."', '3', '$themes')"); // Комм от системы
if(isset($_POST['sort']) && $_POST['sort'] != 0) mysql_query("INSERT INTO `$system[perfix]_forum_komm` (`msg`, `time`, `id_user`, `id_them`) values('[color=#ff0000][b]".$user['login']."[/b] закрепил тему в ТОП[/color]', '".time()."', '3', '$themes')"); // Комм от системы
header("Location: /moduls/forum/$razd/$podrazdel/$themes/");
$_SESSION['message'] = 'Темв отредактирована';
exit();
} else {
header("Location: /moduls/forum/$razd/$podrazdel/$themes/?act=edit_them");
$_SESSION['err'] = 'Темв не отредактирована';
exit();
}
} else {
header("Location: /moduls/forum/$razd/$podrazdel/$themes/?act=edit_them");
$_SESSION['err'] = 'Введите название и описание';
exit();
}
} else {
header("Location: /moduls/forum/$razd/$podrazdel/$themes/");
$_SESSION['err'] = 'Ошибка, нет прав или темы не существует';
exit();
}
break;
case 'del_screen': // Удл скрин
if (isset($_GET['id_forum']) && isset($_GET['id_razdel']) && isset($_GET['id_them']) && isset($user['id']) && user_access('forum_edit_them') && isset($_GET['id']) && ($_GET['id'] == 1 or $_GET['id'] == 2 or $_GET['id'] == 3) &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_them` WHERE `id` = '".num($_GET['id_them'])."'"),0)==1 &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_razd` WHERE `id` = '".num($_GET['id_forum'])."'"),0)==1 &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_podrazd` WHERE `id` = '".num($_GET['id_razdel'])."'"),0)==1){
$podrazdel = num($_GET['id_razdel']);
$razd = num($_GET['id_forum']);
$themes = num($_GET['id_them']);
if($_GET['id'] == 1){
unlink(H.'files/forum/them/'.$razd.$podrazdel.$themes.'1.jpg');
mysql_query("UPDATE `$system[perfix]_forum_them` SET `screen1` = '0' WHERE `id_razd` = '$razd' &&`id_podrazd` = '$podrazdel' &&`id` = '$themes'");
header("Location: /moduls/forum/$razd/$podrazdel/$themes/?act=edit_them");
$_SESSION['message'] = 'Скрин удален';
exit();
} else {
header("Location: /moduls/forum/$razd/$podrazdel/$themes/?act=edit_them");
$_SESSION['err'] = 'Скрин не удален';
exit();
}
if($_GET['id'] == 2){
unlink(H.'files/forum/them/'.$razd.$podrazdel.$themes.'2.jpg');
mysql_query("UPDATE `$system[perfix]_forum_them` SET `screen2` = '0' WHERE `id_razd` = '$razd' &&`id_podrazd` = '$podrazdel' &&`id` = '$themes'");
header("Location: /moduls/forum/$razd/$podrazdel/$themes/?act=edit_them");
$_SESSION['message'] = 'Скрин удален';
exit();
} else {
header("Location: /moduls/forum/$razd/$podrazdel/$themes/?act=edit_them");
$_SESSION['err'] = 'Скрин не удален';
exit();
}
if($_GET['id'] == 3){
unlink(H.'files/forum/them/'.$razd.$podrazdel.$themes.'3.jpg');
mysql_query("UPDATE `$system[perfix]_forum_them` SET `screen3` = '0' WHERE `id_razd` = '$razd' &&`id_podrazd` = '$podrazdel' &&`id` = '$themes'");
header("Location: /moduls/forum/$razd/$podrazdel/$themes/?act=edit_them");
$_SESSION['message'] = 'Скрин удален';
exit();
} else {
header("Location: /moduls/forum/$razd/$podrazdel/$themes/?act=edit_them");
$_SESSION['err'] = 'Скрин не удален';
exit();
}
} else {
header("Location: /moduls/forum/$razd/$podrazdel/$themes/");
$_SESSION['err'] = 'Ошибка, нет прав или темы не существует';
exit();
}
break;
case 'edit_them':
if (isset($_GET['id_forum']) && isset($_GET['id_razdel']) && isset($_GET['id_them']) && isset($user['id']) && user_access('forum_edit_them') &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_them` WHERE `id` = '".num($_GET['id_them'])."'"),0)==1 &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_razd` WHERE `id` = '".num($_GET['id_forum'])."'"),0)==1 &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_podrazd` WHERE `id` = '".num($_GET['id_razdel'])."'"),0)==1){
$set['title'] = 'Редактирование темы';
require H.'core/head.php';
require H.'core/panel.php';
$podrazdel = num($_GET['id_razdel']);
$razd = num($_GET['id_forum']);
$themes = num($_GET['id_them']);
$razdel = mysql_fetch_assoc(mysql_query("SELECT * FROM `$system[perfix]_forum_razd` WHERE `id` = '$razd'"));
$podrazd = mysql_fetch_assoc(mysql_query("SELECT * FROM `$system[perfix]_forum_podrazd` WHERE `id` = '$podrazdel'"));
$them = mysql_fetch_assoc(mysql_query("SELECT * FROM `$system[perfix]_forum_them` WHERE `id_razd` = '$razd' && `id_podrazd` = '$podrazdel' && `id` = '$themes'"));
echo '<div class="navig">'.$home. $z.'<a href="/moduls/forum/">Форум</a>'.$z.'<a href="/moduls/forum/'.$razd.'">'.htmlspecialchars($razdel['title']).'</a>'.$z.'<a href="/moduls/forum/'.$razd.'/'.$podrazdel.'">'.htmlspecialchars($podrazd['title']).'</a>'.$z.'<a href="/moduls/forum/'.$razd.'/'.$podrazdel.'/'.$themes.'">'.htmlspecialchars($them['title']).'</a>'.$z. $set['title'].'</div>';
echo '<form method="post" enctype="multipart/form-data" action="/moduls/forum/'.$razd.'/'.$podrazdel.'/'.$themes.'?act=edit_themes">
Название темы: (2 - 100)<br/><input type="text" name="title" value="'.htmlspecialchars($them['title']).'"/><br/>
Скрин 1:';
if($them['screen1'] != 0) echo ' <div id="dark" class="icon-cancel"></div> <a href="/moduls/forum/'.$razd.'/'.$podrazdel.'/'.$themes.'/?act=del_screen&id=1">Удалить</a>';
echo '<br /> <input name="file1" type="file" /><br />
Скрин 2:';
if($them['screen2'] != 0) echo ' <div id="dark" class="icon-cancel"></div> <a href="/moduls/forum/'.$razd.'/'.$podrazdel.'/'.$themes.'/?act=del_screen&id=2">Удалить</a>';
echo '<br /> <input name="file2" type="file" /><br />
Скрин 3:';
if($them['screen3'] != 0) echo ' <div id="dark" class="icon-cancel"></div> <a href="/moduls/forum/'.$razd.'/'.$podrazdel.'/'.$themes.'/?act=del_screen&id=3">Удалить</a>';
echo '<br /> <input name="file3" type="file" /><br />';
panel_bb('textarea');
echo '<textarea id="textarea" name="msg">'.htmlspecialchars($them['opis']).'</textarea><br/>
<label><input type="checkbox" name="close"'.($them['close']==1?' checked="checked"':null).' value="1" /> Закрыть тему</label><br/>
Закрепить: (1 - 10)<br/> 0 - Не закреплять<br/><input type="text" name="sort" value="'.num($them['sort']).'" /><br/>';
if($user['id'] == $them['avtor']){
echo 'Получать уведомления?<br />
<input name="uved" type="radio"'.($them['uved']==0?' checked="checked"':null).' value="0" />Да
<input name="uved" type="radio"'.($them['uved']==1?' checked="checked"':null).' value="1" />Нет<br />';
}
echo '<input type="submit" value="Сохранить">
</form>';
echo '<div class="navig">'.$home. $z.'<a href="/moduls/forum/">Форум</a>'.$z.'<a href="/moduls/forum/'.$razd.'">'.htmlspecialchars($razdel['title']).'</a>'.$z.'<a href="/moduls/forum/'.$razd.'/'.$podrazdel.'">'.htmlspecialchars($podrazd['title']).'</a>'.$z.'<a href="/moduls/forum/'.$razd.'/'.$podrazdel.'/'.$themes.'">'.htmlspecialchars($them['title']).'</a>'.$z. $set['title'].'</div>';
require H.'core/foot.php';
exit();
} else {
header("Location: /moduls/forum/$razd/$podrazdel/$themes/");
$_SESSION['err'] = 'Ошибка, нет прав или темы не существует';
exit();
}
break;
// ---------- Перемещение --------- //
case 'per':
if(isset($_GET['id_forum']) && isset($_GET['id_razdel']) && isset($_GET['id_them']) && isset($user['id']) && user_access('forum_edit_them') &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_them` WHERE `id` = '".num($_GET['id_them'])."'"),0)==1 &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_razd` WHERE `id` = '".num($_GET['id_forum'])."'"),0)==1 &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_podrazd` WHERE `id` = '".num($_GET['id_razdel'])."'"),0)==1){
$podrazdel = num($_GET['id_razdel']);
$razd = num($_GET['id_forum']);
$themes = num($_GET['id_them']);
$podrazd = mysql_fetch_assoc(mysql_query("SELECT * FROM `$system[perfix]_forum_podrazd` WHERE `id` = '$podrazdel'"));
$them = mysql_fetch_assoc(mysql_query("SELECT * FROM `$system[perfix]_forum_them` WHERE `id_razd` = '$razd' && `id_podrazd` = '$podrazdel' && `id` = '$themes'"));
if(isset($_POST['per'])){
$razd_new = mysql_fetch_assoc(mysql_query("SELECT * FROM `$system[perfix]_forum_podrazd` WHERE `id` = '".num($_POST['per'])."'"));
$podrazd = mysql_fetch_assoc(mysql_query("SELECT * FROM `$system[perfix]_forum_podrazd` WHERE `id` = '$podrazdel'"));
if($them['screen1'] != 0) $screen1 = $razd_new['id_razd'].num($_POST['per']).$themes.'1';
else $screen1 = 0;
if($them['screen2'] != 0) $screen2 = $razd_new['id_razd'].num($_POST['per']).$themes.'2';
else $screen2 = 0;
if($them['screen3'] != 0) $screen3 = $razd_new['id_razd'].num($_POST['per']).$themes.'3';
else $screen3 = 0;
if($them['screen1'] != 0) rename(H.'files/forum/them/'.$razd.$podrazdel.$themes.'1.jpg', H.'files/forum/them/'.$razd_new['id_razd'].''.num($_POST['per']).''.$themes.'1.jpg');
if($them['screen2'] != 0) rename(H.'files/forum/them/'.$razd.$podrazdel.$themes.'1.jpg', H.'files/forum/them/'.$razd_new['id_razd'].''.num($_POST['per']).''.$themes.'2.jpg');
if($them['screen3'] != 0) rename(H.'files/forum/them/'.$razd.$podrazdel.$themes.'1.jpg', H.'files/forum/them/'.$razd_new['id_razd'].''.num($_POST['per']).''.$themes.'3.jpg');
mysql_query("UPDATE `$system[perfix]_forum_razd` SET `id` = '$razd_new[id_razd]' WHERE `id` = '$razd'");
mysql_query("UPDATE `$system[perfix]_forum_podrazd` SET `id` = '$razd_new[id]', `id_razd` = '$razd_new[id_razd]' WHERE `id` = '$podrazdel'");
mysql_query("UPDATE `$system[perfix]_forum_them` SET `id_razd` = '$razd_new[id_razd]', `id_podrazd` = '".num($_POST['per'])."', `screen1` = '$screen1', `screen2` = '$screen2', `screen3` = '$screen3' WHERE `id_razd` = '$razd' && `id_podrazd` = '$podrazdel' && `id` = '$themes'");
$t = mysql_fetch_assoc(mysql_query("SELECT * FROM `$system[perfix]_forum_them` WHERE `id_razd` = '$razd_new[id_razd]' && `id_podrazd` = '".num($_POST['per'])."' && `id` = '$themes'"));
mysql_query("UPDATE `$system[perfix]_forum_komm` SET `id_them` = '$t[id]' WHERE `id_them` = '$themes'");
mysql_query("UPDATE `$system[perfix]_jurnal` SET `link` = '/moduls/forum/$razd_new[id_razd]/$razd_new[id]/$themes' WHERE `link` = '/moduls/forum/$razd/$podrazdel/$themes'"); // Обн журн
mysql_query("UPDATE `$system[perfix]_lenta` SET `link` = '/moduls/forum/$razd_new[id_razd]/$razd_new[id]/$themes' WHERE `link` = '/moduls/forum/$razd/$podrazdel/$themes'"); // Обн лента
mysql_query("INSERT INTO `$system[perfix]_forum_komm` (`msg`, `time`, `id_user`, `id_them`) values('[color=#ff0000][b]".$user['login']."[/b] переместил тему из раздела [b]".check($podrazd['title'])."[/b] в раздел [b]".check($razd_new['title'])."[/b][/color]', '".time()."', '3', '$themes')"); // Комм от системы
header("Location: /moduls/forum/$razd_new[id_razd]/$razd_new[id]/$themes/");
$_SESSION['message'] = 'Тема перемещена';
} else {
header("Location: /moduls/forum/$razd/$podrazdel/$themes/");
$_SESSION['err'] = 'Тема не перемещена';
exit();
}
} else {
header("Location: /moduls/forum/$razd/$podrazdel/$themes/");
$_SESSION['err'] = 'Ошибка, нет прав или темы не существует';
exit();
}
break;
case 'perem':
if(isset($_GET['id_forum']) && isset($_GET['id_razdel']) && isset($_GET['id_them']) && isset($user['id']) && user_access('forum_edit_them') &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_them` WHERE `id` = '".num($_GET['id_them'])."'"),0)==1 &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_razd` WHERE `id` = '".num($_GET['id_forum'])."'"),0)==1 &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_podrazd` WHERE `id` = '".num($_GET['id_razdel'])."'"),0)==1){
$podrazdel = num($_GET['id_razdel']);
$razd = num($_GET['id_forum']);
$themes = num($_GET['id_them']);
$podrazd = mysql_fetch_assoc(mysql_query("SELECT * FROM `$system[perfix]_forum_podrazd` WHERE `id` = '$podrazdel'"));
$razdel = mysql_fetch_assoc(mysql_query("SELECT * FROM `$system[perfix]_forum_razd` WHERE `id` = '$razd'"));
$them = mysql_fetch_assoc(mysql_query("SELECT * FROM `$system[perfix]_forum_them` WHERE `id_razd` = '$razd' && `id_podrazd` = '$podrazdel' && `id` = '$themes'"));
$set['title'] = 'Перемещение темы';
require H.'core/head.php';
require H.'core/panel.php';
echo '<div class="navig">'.$home. $z.'<a href="/moduls/forum/">Форум</a>'.$z.'<a href="/moduls/forum/'.$razd.'">'.htmlspecialchars($razdel['title']).'</a>'.$z.'<a href="/moduls/forum/'.$razd.'/'.$podrazdel.'">'.htmlspecialchars($podrazd['title']).'</a>'.$z.'<a href="/moduls/forum/'.$razd.'/'.$podrazdel.'/'.$themes.'">'.htmlspecialchars($them['title']).'</a>'.$z. $set['title'].'</div>';
echo '<form method="post" action="/moduls/forum/'.$razd.'/'.$podrazdel.'/'.$themes.'?act=per"><select name="per">';
$raz = mysql_query("SELECT * FROM `$system[perfix]_forum_razd` ORDER BY `sort`");
while($post = mysql_fetch_assoc($raz)){
echo '<optgroup label="'.htmlspecialchars($post['title']).'">';
$podraz = mysql_query("SELECT * FROM `$system[perfix]_forum_podrazd` WHERE `id_razd` = '$post[id]' ORDER BY `sort`");
while($post2 = mysql_fetch_assoc($podraz)){
echo "<option".($podrazdel == $post2['id']?' selected="selected"':null)." value='".$post2['id']."'>" . htmlspecialchars($post2['title']) . "</option>n";
}
}
echo '</select><br />
<input type="submit" value="Переместить"/>
</form>';
echo '<div class="navig">'.$home. $z.'<a href="/moduls/forum/">Форум</a>'.$z.'<a href="/moduls/forum/'.$razd.'">'.htmlspecialchars($razdel['title']).'</a>'.$z.'<a href="/moduls/forum/'.$razd.'/'.$podrazdel.'">'.htmlspecialchars($podrazd['title']).'</a>'.$z.'<a href="/moduls/forum/'.$razd.'/'.$podrazdel.'/'.$themes.'">'.htmlspecialchars($them['title']).'</a>'.$z. $set['title'].'</div>';
require H.'core/foot.php';
exit();
} else {
header("Location: /moduls/forum/$razd/$podrazdel/$themes/");
$_SESSION['err'] = 'Ошибка, нет прав или темы не существует';
exit();
}
break;
// ----------- Ред комм --------- //
case 'edit_mess':
if(isset($user['id']) && isset($_GET['id']) && isset($_GET['id_forum']) && isset($_GET['id_razdel']) && isset($_GET['id_them']) &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_them` WHERE `id` = '".num($_GET['id_them'])."'"),0)==1 &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_razd` WHERE `id` = '".num($_GET['id_forum'])."'"),0)==1 &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_podrazd` WHERE `id` = '".num($_GET['id_razdel'])."'"),0)==1){
$podrazdel = num($_GET['id_razdel']);
$razd = num($_GET['id_forum']);
$themes = num($_GET['id_them']);
$komm = mysql_fetch_assoc(mysql_query("SELECT * FROM `$system[perfix]_forum_komm` WHERE `id_them` = '$themes' ORDER BY `id` DESC"));
if($_GET['id'] > 0 && $komm['id'] >= $_GET['id']){
$id = num($_GET['id']);
if(isset($_POST['msg'])){
$msg = check($_POST['msg']);
if(strlen($msg) < 3 or strlen($msg) > 50000) $err = 'Сообщение должно быть в пределах 3 - 50 000 символов';
if(!isset($err)){
mysql_query("UPDATE `$system[perfix]_forum_komm` SET `msg` = '$msg' WHERE `id_them` = '$themes' && `id` = '".num($_GET['id'])."'");
header("Location: /moduls/forum/$razd/$podrazdel/$themes/");
$_SESSION['message'] = 'Сообщение успешно изменено';
} else {
header("Location: /moduls/forum/$razd/$podrazdel/$themes/?act=edit_komm&id=$id");
$_SESSION['err'] = $err;
exit();
}
} else {
header("Location: /moduls/forum/$razd/$podrazdel/$themes/");
$_SESSION['err'] = 'Сообщение не отредактированно';
exit();
}
} else {
header("Location: /moduls/forum/$razd/$podrazdel/$themes/");
$_SESSION['err'] = 'Сообщение не отредактировано';
exit();
}
} else {
header("Location: /moduls/forum/$razd/$podrazdel/$themes/");
$_SESSION['err'] = 'Ошибка, нет прав или темы не существует';
exit();
}
break;
case 'edit_komm':
if(isset($_GET['id_forum']) && isset($_GET['id_razdel']) && isset($_GET['id_them']) && isset($user['id']) && user_access('forum_edit_komm') && isset($_GET['id']) &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_them` WHERE `id` = '".num($_GET['id_them'])."' && `id_razd` = '".num($_GET['id_forum'])."' && `id_podrazd` = '".num($_GET['id_razdel'])."'"),0) == true &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_razd` WHERE `id` = '".num($_GET['id_forum'])."'"),0)== true &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_podrazd` WHERE `id` = '".num($_GET['id_razdel'])."' && `id_razd` = '".num($_GET['id_forum'])."'"),0) == true){
$podrazdel = num($_GET['id_razdel']);
$razd = num($_GET['id_forum']);
$themes = num($_GET['id_them']);
$razdel = mysql_fetch_assoc(mysql_query("SELECT * FROM `$system[perfix]_forum_razd` WHERE `id` = '$razd'"));
$podrazd = mysql_fetch_assoc(mysql_query("SELECT * FROM `$system[perfix]_forum_podrazd` WHERE `id` = '$podrazdel'"));
$them = mysql_fetch_assoc(mysql_query("SELECT * FROM `$system[perfix]_forum_them` WHERE `id_razd` = '$razd' && `id_podrazd` = '$podrazdel' && `id` = '$themes'"));
$komm = mysql_fetch_assoc(mysql_query("SELECT * FROM `$system[perfix]_forum_komm` WHERE `id_them` = '$themes' ORDER BY `id` DESC"));
if($_GET['id'] > 0 && $komm['id'] >= $_GET['id']){
$id = num($_GET['id']);
$mess = mysql_fetch_assoc(mysql_query("SELECT * FROM `$system[perfix]_forum_komm` WHERE `id_them` = '$themes' && `id` = '$id'"));
$set['title'] = 'Редактирование сообщения';
require H.'core/head.php';
require H.'core/panel.php';
echo '<div class="navig">'.$home. $z.'<a href="/moduls/forum/">Форум</a>'.$z.'<a href="/moduls/forum/'.$razd.'">'.htmlspecialchars($razdel['title']).'</a>'.$z.'<a href="/moduls/forum/'.$razd.'/'.$podrazdel.'">'.htmlspecialchars($podrazd['title']).'</a>'.$z.'<a href="/moduls/forum/'.$razd.'/'.$podrazdel.'/'.$themes.'">'.htmlspecialchars($them['title']).'</a>'.$z. $set['title'].'</div>';
echo '<form method="post" action="/moduls/forum/'.$razd.'/'.$podrazdel.'/'.$themes.'?act=edit_mess&id='.$id.'">';
panel_bb('textarea');
echo '<textarea id="textarea" name="msg">'.text($mess['msg']).'</textarea>
<input type="submit" name="submit" valeu="Сохранить"/> <a href="/moduls/forum/'.$razd.'/'.$podrazdel.'/'.$themes.'">Отмена</a>
</form>';
echo '<div class="navig">'.$home. $z.'<a href="/moduls/forum/">Форум</a>'.$z.'<a href="/moduls/forum/'.$razd.'">'.htmlspecialchars($razdel['title']).'</a>'.$z.'<a href="/moduls/forum/'.$razd.'/'.$podrazdel.'">'.htmlspecialchars($podrazd['title']).'</a>'.$z.'<a href="/moduls/forum/'.$razd.'/'.$podrazdel.'/'.$themes.'">'.htmlspecialchars($them['title']).'</a>'.$z. $set['title'].'</div>';
require H.'core/foot.php';
exit();
} else {
header("Location: /moduls/forum/$razd/$podrazdel/$themes/");
$_SESSION['err'] = 'Сообщение не отредактировано';
exit();
}
} else {
header("Location: /moduls/forum/$razd/$podrazdel/$themes/");
$_SESSION['err'] = 'Ошибка, нет прав или темы не существует';
exit();
}
break;
// ------------ Удалить комм ---------- //
case 'del_komm':
if(isset($_GET['id_forum']) && isset($_GET['id_razdel']) && isset($_GET['id_them']) && isset($user['id']) && user_access('forum_del_komm') && isset($_GET['id']) &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_them` WHERE `id` = '".num($_GET['id_them'])."' && `id_razd` = '".num($_GET['id_forum'])."' && `id_podrazd` = '".num($_GET['id_razdel'])."'"),0) == true &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_razd` WHERE `id` = '".num($_GET['id_forum'])."'"),0)== true &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_podrazd` WHERE `id` = '".num($_GET['id_razdel'])."' && `id_razd` = '".num($_GET['id_forum'])."'"),0) == true){
$podrazdel = num($_GET['id_razdel']);
$razd = num($_GET['id_forum']);
$themes = num($_GET['id_them']);
$komm = mysql_fetch_assoc(mysql_query("SELECT `id` FROM `$system[perfix]_forum_komm` WHERE `id_them` = '$themes' ORDER BY `id` DESC"));
if($_GET['id'] > 0 && $komm['id'] >= $_GET['id']){
$id = num($_GET['id']);
mysql_query("DELETE FROM `$system[perfix]_forum_komm` WHERE `id` = '$id' && `id_them` = '$themes'");
$_SESSION['message'] = 'Сообщение успешно удалено';
header("Location: /moduls/forum/$razd/$podrazdel/$themes/");
exit();
} else {
header("Location: /moduls/forum/$razd/$podrazdel/$themes/");
$_SESSION['err'] = 'Сообщение не удалено';
exit();
}
} else {
header("Location: /moduls/forum/$razd/$podrazdel/$themes/");
$_SESSION['err'] = 'Ошибка, нет прав или темы не существует';
exit();
}
break;
// --------- Ответ на комм ----------- //
case 'msg_otv':
if (isset($_GET['id_forum']) && isset($_GET['id_razdel']) && isset($_GET['id_them']) && isset($user['id']) && $them['close'] == 0 or ($them['close'] == 1 && user_access('forum_komm_close_them')) && isset($_GET['id']) &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_them` WHERE `id` = '".num($_GET['id_them'])."' && `id_razd` = '".num($_GET['id_forum'])."' && `id_podrazd` = '".num($_GET['id_razdel'])."'"),0) == true &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_razd` WHERE `id` = '".num($_GET['id_forum'])."'"),0)== true &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_podrazd` WHERE `id` = '".num($_GET['id_razdel'])."' && `id_razd` = '".num($_GET['id_forum'])."'"),0) == true){
$podrazdel = num($_GET['id_razdel']);
$razd = num($_GET['id_forum']);
$themes = num($_GET['id_them']);
$razdel = mysql_fetch_assoc(mysql_query("SELECT * FROM `$system[perfix]_forum_razd` WHERE `id` = '$razd'"));
$podrazd = mysql_fetch_assoc(mysql_query("SELECT * FROM `$system[perfix]_forum_podrazd` WHERE `id` = '$podrazdel'"));
$them = mysql_fetch_assoc(mysql_query("SELECT * FROM `$system[perfix]_forum_them` WHERE `id_razd` = '$razd' && `id_podrazd` = '$podrazdel' && `id` = '$themes'"));
$komm = mysql_fetch_assoc(mysql_query("SELECT * FROM `$system[perfix]_forum_komm` WHERE `id_them` = '$themes' ORDER BY `id` DESC"));
$avtor = mysql_fetch_assoc(mysql_query("SELECT `id`,`login` FROM `$system[perfix]_users` WHERE `id` = '$komm[id_user]'"));
if($_GET['id'] > 0 && $komm['id'] >= $_GET['id']){
$id = num($_GET['id']);
if(isset($_POST['submit'])){
if(isset($_POST['msg'])) $msg = check($_POST['msg']);
else $err = 'Сообщение не отправлено';
if(strlen($msg) < 3 or strlen($msg) > 50000) $err = 'Сообщение должно быть в пределах 3 - 50 000 символов';
if(!isset($err)){
mysql_query("INSERT INTO `$system[perfix]_jurnal` (`id_ank`, `id_user`, `msg`, `time`, `read`, `razdel`, `link`) values('$user[id]', '$avtor[id]', '".rez_text_jur(text($msg_otv))."', '".time()."', '0', 'Форум', '/moduls/forum/".$razd."/".$podrazdel."/".$themes."')");
mysql_query("INSERT INTO `$system[perfix]_forum_komm` (`msg`, `time`, `id_user`, `otv_user`, `id_them`) values('$msg', '".time()."', '$user[id]', '$avtor[id]', '$them[id]')");
mysql_query("UPDATE `$system[perfix]_forum_them` SET `times` = '".time()."' WHERE `id` = '$themes' && `id_razd` = '$razd' && `id_podrazd` = '$podrazdel'");
$post_them = mysql_fetch_assoc(mysql_query("SELECT `count_post_them` FROM `$system[perfix]_user_ank` WHERE `id_user` = '$user[id]'"));
mysql_query("UPDATE `$system[perfix]_user_ank` SET `count_post_them` = '".($post_them['count_post_them']+1)."' WHERE `id_user` = '$user[id]' LIMIT 1"); // Статистика
header("Location: /moduls/forum/$razd/$podrazdel/$themes/");
$_SESSION['message'] = 'Сообщение успешно добавлено';
} else {
header("Location: /moduls/forum/$razd/$podrazdel/$themes/?act=otvet&id=$id");
$_SESSION['err'] = $err;
exit();
}
} else {
header("Location: /moduls/forum/$razd/$podrazdel/$themes/?act=otvet&id=$id");
$_SESSION['err'] = 'Сообщение не отправлено';
exit();
}
} else {
header("Location: /moduls/forum/$razd/$podrazdel/$themes/");
$_SESSION['err'] = 'Сообщение не отправлено';
exit();
}
} else {
header("Location: /moduls/forum/$razd/$podrazdel/$themes/");
$_SESSION['err'] = 'Ошибка, нет прав или темы не существует';
exit();
}
break;
case 'otvet':
if (isset($_GET['id_forum']) && isset($_GET['id_razdel']) && isset($_GET['id_them']) && isset($user['id']) && $them['close'] == 0 or ($them['close'] == 1 && user_access('forum_komm_close_them')) && isset($_GET['id']) &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_them` WHERE `id` = '".num($_GET['id_them'])."' && `id_razd` = '".num($_GET['id_forum'])."' && `id_podrazd` = '".num($_GET['id_razdel'])."'"),0) == true &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_razd` WHERE `id` = '".num($_GET['id_forum'])."'"),0)== true &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_podrazd` WHERE `id` = '".num($_GET['id_razdel'])."' && `id_razd` = '".num($_GET['id_forum'])."'"),0) == true){
$podrazdel = num($_GET['id_razdel']);
$razd = num($_GET['id_forum']);
$themes = num($_GET['id_them']);
$razdel = mysql_fetch_assoc(mysql_query("SELECT * FROM `$system[perfix]_forum_razd` WHERE `id` = '$razd'"));
$podrazd = mysql_fetch_assoc(mysql_query("SELECT * FROM `$system[perfix]_forum_podrazd` WHERE `id` = '$podrazdel'"));
$them = mysql_fetch_assoc(mysql_query("SELECT * FROM `$system[perfix]_forum_them` WHERE `id_razd` = '$razd' && `id_podrazd` = '$podrazdel' && `id` = '$themes'"));
$komm = mysql_fetch_assoc(mysql_query("SELECT * FROM `$system[perfix]_forum_komm` WHERE `id_them` = '$themes' ORDER BY `id` DESC"));
$avtor = mysql_fetch_assoc(mysql_query("SELECT `id`,`login` FROM `$system[perfix]_users` WHERE `id` = '$komm[id_user]'"));
if($_GET['id'] > 0 && $komm['id'] >= $_GET['id']){
$id = num($_GET['id']);
$mess = mysql_fetch_assoc(mysql_query("SELECT * FROM `$system[perfix]_forum_komm` WHERE `id_them` = '$themes' && `id` = '$id'"));
$set['title'] = 'Ответ на сообщение';
require H.'core/head.php';
require H.'core/panel.php';
echo '<div class="navig">'.$home. $z.'<a href="/moduls/forum/">Форум</a>'.$z.'<a href="/moduls/forum/'.$razd.'">'.htmlspecialchars($razdel['title']).'</a>'.$z.'<a href="/moduls/forum/'.$razd.'/'.$podrazdel.'">'.htmlspecialchars($podrazd['title']).'</a>'.$z.'<a href="/moduls/forum/'.$razd.'/'.$podrazdel.'/'.$themes.'">'.htmlspecialchars($them['title']).'</a>'.$z. $set['title'].'</div>';
echo '<form method="post" action="/moduls/forum/'.$razd.'/'.$podrazdel.'/'.$themes.'?act=msg_otv&id='.$id.'">';
echo 'Ответ на сообщение ';
echo online($avtor['id']);
echo '<a href="/?login='.$avtor['login'].'">'.$avtor['login'].'</a><br/ >';
echo text($mess['msg']).'<br />';
panel_bb('textarea');
echo '<textarea id="textarea" name="msg"></textarea>
<input type="submit" name="submit" valeu="Ответить"/> <a href="/moduls/forum/'.$razd.'/'.$podrazdel.'/'.$themes.'">Отмена</a>
</form>';
echo '<div class="navig">'.$home. $z.'<a href="/moduls/forum/">Форум</a>'.$z.'<a href="/moduls/forum/'.$razd.'">'.htmlspecialchars($razdel['title']).'</a>'.$z.'<a href="/moduls/forum/'.$razd.'/'.$podrazdel.'">'.htmlspecialchars($podrazd['title']).'</a>'.$z.'<a href="/moduls/forum/'.$razd.'/'.$podrazdel.'/'.$themes.'">'.htmlspecialchars($them['title']).'</a>'.$z. $set['title'].'</div>';
require H.'core/foot.php';
exit();
} else {
header("Location: /moduls/forum/$razd/$podrazdel/$themes/");
$_SESSION['err'] = 'Сообщение не отправлено';
exit();
}
}
break;
// ------- Запись комм -------- //
case 'msg':
if (isset($_GET['id_forum']) && isset($_GET['id_razdel']) && isset($_GET['id_them']) && isset($user['id']) && $them['close'] == 0 or ($them['close'] == 1 && user_access('forum_komm_close_them')) &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_them` WHERE `id` = '".num($_GET['id_them'])."' && `id_razd` = '".num($_GET['id_forum'])."' && `id_podrazd` = '".num($_GET['id_razdel'])."'"),0) == true &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_razd` WHERE `id` = '".num($_GET['id_forum'])."'"),0)== true &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_podrazd` WHERE `id` = '".num($_GET['id_razdel'])."' && `id_razd` = '".num($_GET['id_forum'])."'"),0) == true){
$podrazdel = num($_GET['id_razdel']);
$razd = num($_GET['id_forum']);
$themes = num($_GET['id_them']);
if(isset($_POST['msg'])){
$msg = check($_POST['msg']);
$flood = mysql_fetch_assoc(mysql_query("SELECT `msg` FROM `$system[perfix]_forum_komm` WHERE `id_them` = '$themes' ORDER BY `id` DESC LIMIT 1"));
if($msg == $flood['msg']) $err = 'Ваше сообщение повторяет предыдущее';
if(strlen($msg) < 3 or strlen($msg) > 50000) $err = 'Сообщение должено быть в пределах 3 - 50 000 символов';
if(!isset($err)){
mysql_query("INSERT INTO `$system[perfix]_forum_komm` (`msg`, `time`, `id_user`, `id_them`) values('$msg', '".time()."', '$user[id]', '$themes')");
mysql_query("UPDATE `$system[perfix]_users` SET `rating_tmp` = '".($user['rating_tmp']+1)."' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("UPDATE `$system[perfix]_forum_them` SET `times` = '".time()."' WHERE `id` = '$themes' && `id_razd` = '$razd' && `id_podrazd` = '$podrazdel'");
if($user['id'] != $them['avtor'] && $them['uved'] != 1) mysql_query("INSERT INTO `$system[perfix]_jurnal` (`id_ank`, `id_user`, `msg`, `time`, `read`, `razdel`, `link`) values('$user[id]', '$them[avtor]', 'Ваша тема в форуме ".htmlspecialchars($them['title'])."', '".time()."', '0', 'Форум', '/moduls/forum/".$razd."/".$podrazdel."/".$themes."')");
$post_them = mysql_fetch_assoc(mysql_query("SELECT `count_post_them` FROM `$system[perfix]_user_ank` WHERE `id_user` = '$user[id]'"));
mysql_query("UPDATE `$system[perfix]_user_ank` SET `count_post_them` = '".($post_them['count_post_them']+1)."' WHERE `id_user` = '$user[id]' LIMIT 1"); // Статистика
header("Location: /moduls/forum/$razd/$podrazdel/$themes/");
$_SESSION['message'] = 'Сообщение успешно добавлено';
exit();
} else {
header("Location: /moduls/forum/$razd/$podrazdel/$themes/");
$_SESSION['err'] = $err;
exit();
}
} else {
header("Location: /moduls/forum/$razd/$podrazdel/$themes/");
$_SESSION['err'] = 'Сообщение не отправлено';
exit();
}
} else {
header("Location: /moduls/forum/$razd/$podrazdel/$themes/");
$_SESSION['err'] = 'Такой темы нет';
exit();
}
break;
// ----------- Тема ----------- //
default:
if (isset($_GET['id_forum']) && isset($_GET['id_razdel']) && isset($_GET['id_them']) &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_them` WHERE `id` = '".num($_GET['id_them'])."' && `id_razd` = '".num($_GET['id_forum'])."' && `id_podrazd` = '".num($_GET['id_razdel'])."'"),0) == true &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_razd` WHERE `id` = '".num($_GET['id_forum'])."'"),0)== true &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_podrazd` WHERE `id` = '".num($_GET['id_razdel'])."' && `id_razd` = '".num($_GET['id_forum'])."'"),0) == true){
$podrazdel = num($_GET['id_razdel']);
$razd = num($_GET['id_forum']);
$themes = num($_GET['id_them']);
$razdel = mysql_fetch_assoc(mysql_query("SELECT * FROM `$system[perfix]_forum_razd` WHERE `id` = '$razd'"));
$podrazd = mysql_fetch_assoc(mysql_query("SELECT * FROM `$system[perfix]_forum_podrazd` WHERE `id` = '$podrazdel'"));
$them = mysql_fetch_assoc(mysql_query("SELECT * FROM `$system[perfix]_forum_them` WHERE `id_razd` = '$razd' && `id_podrazd` = '$podrazdel' && `id` = '$themes'"));
$avtor = mysql_fetch_assoc(mysql_query("SELECT `id`,`login` FROM `$system[perfix]_users` WHERE `id` = '$them[avtor]'"));
$set['title'] = htmlspecialchars($them['title']);
require H.'core/head.php';
require H.'core/panel.php';
echo '<div class="navig">'.$home. $z.'<a href="/moduls/forum/">Форум</a>'.$z.'<a href="/moduls/forum/'.$razd.'">'.htmlspecialchars($razdel['title']).'</a>'.$z.'<a href="/moduls/forum/'.$razd.'/'.$podrazdel.'">'.htmlspecialchars($podrazd['title']).'</a>'.$z. $set['title'].'</div>';
if($them['close'] == 1) echo '<div class="err">Тема закрыта</div>';
echo '<div class="mess">';
echo '<img src="/design/images/site/font.png" /> <b>'.htmlspecialchars($them['title']).'</b><br />';
echo avatar($avtor['id'], false, 50).online($avtor['id']).' <a href="/?login='.$avtor['login'].'">'.$avtor['login'].'</a>';
echo ' ('.vremja($them['time']).') ';
echo '</div>';
if($them['screen1'] != 0 or $them['screen2'] != 0 or $them['screen3'] != 0) echo '<div class="mess">';
if($them['screen1'] != 0) echo ' <a href="/files/forum/them/'.$razd.$podrazdel.$themes.'1.jpg" title="Скриншот 1"><img src="/files/forum/them/'.$razd.$podrazdel.$themes.'1.jpg" style="max-width:30%"/></a> ';
if($them['screen2'] != 0) echo ' <a href="/files/forum/them/'.$razd.$podrazdel.$themes.'2.jpg" title="Скриншот 2"><img src="/files/forum/them/'.$razd.$podrazdel.$themes.'2.jpg" style="max-width:30%"/></a> ';
if($them['screen3'] != 0) echo ' <a href="/files/forum/them/'.$razd.$podrazdel.$themes.'3.jpg" title="Скриншот 3"><img src="/files/forum/them/'.$razd.$podrazdel.$themes.'3.jpg" style="max-width:30%"/></a> ';
if($them['screen1'] != 0 or $them['screen2'] != 0 or $them['screen3'] != 0)echo '</div>';
echo '<div class="mess">';
echo text($them['opis']);
echo '</div>';
?>
<div class="mess">Рассказать о теме друзьям<br /><script type="text/javascript">(function() {
if (window.pluso)if (typeof window.pluso.start == "function") return;
if (window.ifpluso==undefined) { window.ifpluso = 1;
var d = document, s = d.createElement('script'), g = 'getElementsByTagName';
s.type = 'text/javascript'; s.charset='UTF-8'; s.async = true;
s.src = ('https:' == window.location.protocol ? 'https' : 'http') + '://share.pluso.ru/pluso-like.js';
var h=d[g]('body')[0];
h.appendChild(s);
}})();</script>
<div class="pluso" data-background="transparent" data-options="small,square,line,horizontal,counter,theme=03" data-services="vkontakte,odnoklassniki,facebook,twitter,moimir"></div>
<?
echo '<br />Ссылка темы:<br /><input type="text" value="[url=http://'.$set['site'].'/moduls/forum/'.$razd.'/'.$podrazdel.'/'.$themes.']Форум - '.htmlspecialchars($them['title']).'[/url]" maxlength="512" /></div>';
// ------------------------------- Комментарии ---------------------------------- //
$count = mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_komm` WHERE `id_them` = '$themes'"),0);
if(isset($user['id']) && user_access('forum_edit_them')) echo '<div class="mess" style="text-align:right"><div id="dark" class="icon-pencil"></div><a href="/moduls/forum/'.$razd.'/'.$podrazdel.'/'.$themes.'/?act=edit_them"> Ред</a> |
<div id="dark" class="icon-spinner5"></div><a href="/moduls/forum/'.$razd.'/'.$podrazdel.'/'.$themes.'/?act=perem"> Перем</a> |
<div id="dark" class="icon-cancel"></div><a href="/moduls/forum/'.$razd.'/'.$podrazdel.'/'.$themes.'/?act=del_them"> Удл</a></div>';
echo '<div class="foot">Комментарии ('.$count.')</div>';
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `$system[perfix]_forum_komm` WHERE `id_them` = '$themes'"),0);
$k_page = k_page($k_post,$set['p_str']);
$page = page($k_page);
$start = $set['p_str']*$page-$set['p_str'];
if ($k_post == 0) echo '<div class="menu">Сообщений нет</div>';
$q = mysql_query("SELECT * FROM `$system[perfix]_forum_komm` WHERE `id_them` = '$themes' ORDER BY `id` DESC LIMIT $start, $set[p_str]");
while($post = mysql_fetch_assoc($q)){
$avtor = mysql_fetch_assoc(mysql_query("SELECT `id`,`login` FROM `$system[perfix]_users` WHERE `id` = '".num($post[id_user])."'"));
echo '<div class="mess">';
echo online($avtor['id']).' <a href="/?login='.$avtor['login'].'">'.$avtor['login'].'</a>';
if($post['otv_user'] != 0){
$otvet = mysql_fetch_assoc(mysql_query("SELECT `id`,`login` FROM `$system[perfix]_users` WHERE `id` = '".num($post['otv_user'])."'"));
echo ' Ответил <a href="/?login='.$otvet['login'].'">'.$otvet['login'].'</a>';
}
echo ' ('.vremja($post['time']).')<br />'.text($post['msg']);
if(($user['id'] != $avtor['id'] && isset($user['id']) && $them['close'] == 0 && $avtor['id'] != 3) or ($them['close'] == 1 && user_access('forum_komm_close_them') && $avtor['id'] != 3 && $user['id'] != $avtor['id'])) echo '<br /><div style="float:left"><a href="/moduls/forum/'.$razd.'/'.$podrazdel.'/'.$themes.'/?act=otvet&id='.num($post['id']).'">Ответ</a></div>';
echo '<div style="float:right">';
if(user_access('forum_edit_komm') && isset($user['id']) && $avtor['id'] != 3) echo '<a href="/moduls/forum/'.$razd.'/'.$podrazdel.'/'.$themes.'/?act=edit_komm&id='.num($post['id']).'"><div id="dark" class="icon-pencil"></div></a> | ';
if(user_access('forum_del_komm') && isset($user['id'])) echo '<a href="/moduls/forum/'.$razd.'/'.$podrazdel.'/'.$themes.'/?act=del_komm&id='.num($post['id']).'"><div id="dark" class="icon-cancel"></div></a>';
echo '</div><div style="clear:both"></div></div>';
}
if(isset($user['id']) && $them['close'] == 0 or ($them['close'] == 1 && user_access('forum_komm_close_them'))){
echo '<form method="post" action="/moduls/forum/'.$razd.'/'.$podrazdel.'/'.$themes.'?act=msg"/>';
panel_bb('textarea');
echo '<textarea id="textarea" name="msg" /></textarea><br/>
<input type="submit" value="Написать" />
</form>';
}
if ($k_page>1)str('/moduls/forum/'.$razd.'/'.$podrazdel.'/'.$themes.'/?',$k_page,$page); // Вывод страниц
echo '<div class="navig">'.$home. $z.'<a href="/moduls/forum/">Форум</a>'.$z.'<a href="/moduls/forum/'.$razd.'">'.htmlspecialchars($razdel['title']).'</a>'.$z.'<a href="/moduls/forum/'.$razd.'/'.$podrazdel.'">'.htmlspecialchars($podrazd['title']).'</a>'.$z. $set['title'].'</div>';
require H.'core/foot.php';
exit();
}
}
?>