Файл: moduls/forum/edit_theme.php
Строк: 84
<?php
/**
* @package Prime Social
* @link http://primesocial.ru
* @copyright Copyright (C) 2016 Prime Social
* @author BoB | http://primesocial.ru/about
*/
require_once('../../core/start.php');
check_auth();
$theme = DB::$dbs->queryFetch("SELECT * FROM ".FORUMS_THEME." WHERE `id` = ? ", array(abs(num($_GET['theme']))));
if (empty($theme)) {
head('Mavzu topilmadi');
echo DIV_ERROR . 'Xatolik!' . CLOSE_DIV;
echo DIV_GO . '<a href="'.HOME.'/">Bosh sahifa</a> / <a href="'.HOME.'/forum/">Forum</a> / <b>Mavzu topilmadi</b>' . CLOSE_DIV;
require_once('../../core/stop.php');
exit();
}
if ($theme['status'] == 1) {
head('Mavzu yopilgan');
echo DIV_ERROR . 'Xatolik!' . CLOSE_DIV;
echo DIV_GO . '<a href="'.HOME.'/">Bosh sahifa</a> / <a href="'.HOME.'/forum/">Forum</a> / <b>Mavzu yopilgan</b>' . CLOSE_DIV;
require_once('../../core/stop.php');
exit();
}
if ($theme['user_id'] != $user['user_id'] && !privilegy('forum_moder')) {
header("Location: ".HOME."");
}
head('Mavzuni tahrirlash: ' . $theme['name']);
if ($_POST['edit']) {
$name = html($_POST['name']);
$uvedom = abs(num($_POST['uvedom']));
$vote = html($_POST['vote']);
$vote_1 = html($_POST['vote_1']);
$vote_2 = html($_POST['vote_2']);
$vote_3 = html($_POST['vote_3']);
$vote_4 = html($_POST['vote_4']);
$vote_5 = html($_POST['vote_5']);
$vote_6 = html($_POST['vote_6']);
$vote_7 = html($_POST['vote_7']);
$vote_8 = html($_POST['vote_8']);
$vote_9 = html($_POST['vote_9']);
$vote_10 = html($_POST['vote_10']);
if (empty($name)) {
$err = 'Mavzu nomini kiriting.<br />';
}
if (strlen($name) < 8) {
$err .= 'Mavzu nomi juda qisa. [min. 8 belgi]<br />';
}
if (!empty($vote) && strlen($vote) < 20) {
$err .= 'So`rovnoma nomi juda qisqa. [min. 10 belgi]<br />';
}
if (!empty($vote) && (empty($vote_1) || empty($vote_2))) {
$err .= 'So`rovnomaning asosiy variantlarini to`ldiring';
}
if (empty($err)) {
DB::$dbs->query("UPDATE ".FORUM_THEME." SET `name` = ?, `uvedom` = ?, `vote` = ?, `vote_1` = ?, `vote_2` = ?, `vote_3` = ?, `vote_4` = ?, `vote_5` = ?, `vote_6` = ?, `vote_7` = ?, `vote_8` = ?, `vote_9` = ?, `vote_10` = ? WHERE `id` = ? ",
array($name, $uvedom, $vote, $vote_1, $vote_2, $vote_3, $vote_4, $vote_5, $vote_6, $vote_7, $vote_8, $vote_9, $vote_10, $theme['id']));
header("Location: ".HOME."/forum/".$theme['forum_id']."/".$theme['forumc_id']."/".$theme['id']."/");
} else {
echo DIV_ERROR . $err . CLOSE_DIV;
}
}
echo DIV_BLOCK;
echo '<form action="#" enctype="multipart/form-data" method="POST">';
echo '<b>Mavzu nomi:</b> [min. 8]<br /><input type="text" name="name" value="'.$theme['name'].'" /><br /><br />';
echo 'Qoldirilgan habarlar haqida ogohlantirish: <input type="checkbox" name="uvedom" value="1" '.($theme['uvedom'] ? 'checked' : NULL).' /><br /><br />';
echo '</div><div class="bline">So`rovnoma</div><div class="white">';
echo '<b>Nomi:</b> [min. 10]<br /><input type="text" name="vote" value="'.$theme['vote'].'"/><br />';
echo '<b>Javob variantlari:</b><br /> <span style="font-size:11px;color:#999;">Kamida 2 ta maydoncha to`ldirilishi shart</span><br /><br />';
echo '<b>1.</b><input type="text" name="vote_1" value="'.$theme['vote_1'].'" /><br />';
echo '<b>2.</b><input type="text" name="vote_2" value="'.$theme['vote_2'].'" /><br />';
echo '<b>3.</b><input type="text" name="vote_3" value="'.$theme['vote_3'].'" /><br />';
echo '<b>4.</b><input type="text" name="vote_4" value="'.$theme['vote_4'].'" /><br />';
echo '<b>5.</b><input type="text" name="vote_5" value="'.$theme['vote_5'].'" /><br />';
echo '<b>6.</b><input type="text" name="vote_6" value="'.$theme['vote_6'].'" /><br />';
echo '<b>7.</b><input type="text" name="vote_7" value="'.$theme['vote_7'].'" /><br />';
echo '<b>8.</b><input type="text" name="vote_8" value="'.$theme['vote_8'].'" /><br />';
echo '<b>9.</b><input type="text" name="vote_9" value="'.$theme['vote_9'].'" /><br />';
echo '<b>10.</b><input type="text" name="vote_10" value="'.$theme['vote_10'].'" /><br /><br />';
echo '<input type="submit" name="edit" value="O`zgartirish" /><br />';
echo '</form>';
echo CLOSE_DIV;
$forum = DB::$dbs->queryFetch("SELECT * FROM ".FORUMS." WHERE `id` = ? ", array($theme['forum_id']));
$forumc = DB::$dbs->queryFetch("SELECT * FROM ".FORUMS_CAT." WHERE `id` = ? ", array($theme['forumc_id']));
echo DIV_GO . '<a href="'.HOME.'/">Bosh sahifa</a> / <a href="'.HOME.'/forum/">Forum</a> / <a href="'.HOME.'/forum/'.$forum['id'].'/">'.$forum['name'].'</a> / <a href="'.HOME.'/forum/'.$forum['id'].'/'.$forumc['id'].'/">'.$forumc['name'].'</a> / <a href="'.HOME.'/forum/'.$forum['id'].'/'.$forumc['id'].'/'.$theme['id'].'/">'.$theme['name'].'</a> / <b>Mavzuni tahrirlash</b>' . CLOSE_DIV;
require_once('../../core/stop.php');
?>