File size: 8.44Kb
<?
/*
* Author - Tw1nGo
* VK - https://vk.com/tw1ngo93
*/
include_once $_SERVER['DOCUMENT_ROOT'] . '/sys/inc/home.php';
include_once H.'sys/inc/start.php';
include_once H.'sys/inc/compress.php';
include_once H.'sys/inc/sess.php';
include_once H.'sys/inc/settings.php';
include_once H.'sys/inc/db_connect.php';
include_once H.'sys/inc/ipua.php';
include_once H.'sys/inc/fnc.php';
include_once H.'sys/inc/user.php';
only_reg();
$config = array(
'q' => array(
'type' => array(
'По Вашему запросу ничего не найдено',
'По Вашему запросу ничего не найдено',
'По Вашему запросу ничего не найдено'
),
'text' => (isset($_GET['q']) ? implode(' ', explode('+', text($_GET['q']))) : false)
),
);
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
if(!empty($_POST['q']) && !preg_match("#(^\ )#ui", $_POST['q']) && !preg_match("#(^\')#ui", $_POST['q']))
{
$_POST['q'] = implode('+', explode(' ', my_esc($_POST['q'])));
exit(header('Location: ?q='.$_POST['q'].'&type=2'));
}
else
exit(header('Location: /support'));
}
$t = (isset($_GET['type']) && is_numeric($_GET['type']) && (int)$_GET['type'] <= 2? (int)$_GET['type'] : 0);
if (isset($_GET['question_id']) && isset($_GET['category_id'])){
$post = mysql_fetch_assoc(mysql_query("SELECT * FROM `support_v` WHERE `id` = '" . intval($_GET['question_id']) . "' LIMIT 1"));
$cat = mysql_fetch_assoc(mysql_query("SELECT * FROM `support` WHERE `id` = '" . $post['id_help'] . "' LIMIT 1"));
if (!$post)
{
$_SESSION['message'] = 'Нет такого вопроса.';
header("Location: ?");
exit;
}
$set['title'] = 'Помощь';
include_once '../sys/inc/thead.php';
if($config['q']['text']){
shapka_VK(true, '/support', 'Поиск');
}
else{
shapka_VK(true, '/support?category_id='.$cat['id'].'', 'Вопрос');
}
?>
<div class="pcont fit_box">
<?
uvedom();
err();
?>
<div class="head_panel">
<div class="hp_block"><form action="/support" class="qsearch" method="POST">
<table class="row_table"><tbody><tr>
<td class="row_table_main_column">
<div class="qs_field_wrap">
<div class="iwrap"><input class="textfield qs_textfield" name="q" value="<?= $config['q']['text'] ?>" autocomplete="off" id="ma_search_field" placeholder="Опишите Вашу проблему.." type="text"></div>
</div>
</td>
<td class="row_table_last_column"><input class="button qs_button al_tab" value="Искать" type="submit"></td>
</tr></tbody></table>
</form></div>
</div>
<div class="upanel">
<div id="fq_search_items" class="items bl_cont">
<div class="faq_item faq_opened">
<div class="faq_title_wrap faq_fat"><div class="faq_title">
<img class="i_icon" src="/files/images/blank.gif" width="16" height="16">
<div class="faq_label"><?= text($post['title'])?></div>
</div></div>
<div class="faq_body faq_fat">
<div class="faq_cont">
<div class="faq_answer"><?= output_text($post['msg'])?></div>
</div>
</div>
</div>
</div></div>
</div>
<?
}
elseif (isset($_GET['category_id'])){
// Просмотр раздела
$cat = mysql_fetch_assoc(mysql_query("SELECT * FROM `support` WHERE `id` = '" . intval($_GET['category_id']) . "' LIMIT 1"));
if (!$cat)
{
$_SESSION['message'] = 'Нет такого раздела.';
header("Location: ?");
exit;
}
$set['title'] = 'Помощь';
include_once '../sys/inc/thead.php';
if($config['q']['text']){
shapka_VK(true, '/support', 'Поиск');
}
else{
shapka_VK(true, '/support', ''.text($cat['title']).'');
}
?>
<div class="pcont fit_box">
<?
uvedom();
err();
?>
<div class="head_panel">
<div class="hp_block"><form action="/support" class="qsearch" method="POST">
<table class="row_table"><tbody><tr>
<td class="row_table_main_column">
<div class="qs_field_wrap">
<div class="iwrap"><input class="textfield qs_textfield" name="q" value="<?= $config['q']['text'] ?>" autocomplete="off" id="ma_search_field" placeholder="Опишите Вашу проблему.." type="text"></div>
</div>
</td>
<td class="row_table_last_column"><input class="button qs_button al_tab" value="Искать" type="submit"></td>
</tr></tbody></table>
</form></div>
</div>
<div class="upanel">
<div id="fq_search_items" class="items bl_cont">
<style>.golosa {display: none;}.golosa2 {display: block;}</style>
<?
if($config['q']['text']){
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `support_v` WHERE `title` like '%".$config['q']['text']."%'"),0);
$q = mysql_query("SELECT * FROM `support_v` WHERE `title` like '%".$config['q']['text']."%' ORDER BY `id` DESC");
}
else{
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `support_v` WHERE `id_help` = '$cat[id]'"),0);
$q = mysql_query("SELECT * FROM `support_v` WHERE `id_help` = '$cat[id]' ORDER BY `id` DESC");
}
if ($k_post == 0){
?>
<div class="service_msg_box">
<div class="service_msg service_msg_null">Список вопросов пуст.</div>
</div>
<?
}
else{
while ($post = mysql_fetch_assoc($q)){
?>
<div class="faq_item">
<a onclick="votes(<?= $post['id']?>); return false;" class="faq_title_wrap faq_fat" href="?category_id=<?= $post['id_help']?>&question_id=<?= $post['id']?>">
<div class="faq_title">
<img class="i_icon" src="/files/images/blank.gif" width="16" height="16">
<div class="faq_label"><?= text($post['title'])?></div>
</div>
</a>
<div class="faq_body faq_fat" id="votes_<?= $post['id']?>">
<div class="faq_cont">
<div class="faq_answer"><?= output_text($post['msg'])?></div>
<div class="faq_rate_wrap golosa2" id="rate_wrap<?= $post['id']?>">
<div class="faq_rate_header">Это решает Вашу проблему?</div>
<div>
<a class="button gray_button" onclick="votes_golos(<?= $post['id']?>); return false;">Да</a>
<a class="button gray_button" onclick="votes_golos(<?= $post['id']?>); return false;">Нет</a>
</div>
</div>
<div id="rate_wrap_x<?= $post['id']?>" class="faqrate_item faqrate_message_item golosa">
<div class="message_item_cont">Спасибо за Ваш голос!
<a onclick="votes_cancel(<?= $post['id']?>); return false;">Отмена</a>
</div>
</div>
</div>
</div>
</div>
<?
}
}
?>
</div></div>
</div>
<?
}
else{
$set['title'] = 'Помощь';
include_once H.'sys/inc/thead.php';
if($config['q']['text']){
shapka_VK(true, '/support', 'Поиск');
}
else{
shapka_VK(false, '', 'Помощь');
}
?>
<div class="pcont fit_box">
<?
uvedom();
?>
<div class="head_panel">
<div class="hp_block"><form action="/support" class="qsearch" method="POST">
<table class="row_table"><tbody><tr>
<td class="row_table_main_column">
<div class="qs_field_wrap">
<div class="iwrap"><input class="textfield qs_textfield" name="q" value="<?= $config['q']['text'] ?>" autocomplete="off" id="ma_search_field" placeholder="Опишите Вашу проблему.." type="text"></div>
</div>
</td>
<td class="row_table_last_column"><input class="button qs_button al_tab" value="Искать" type="submit"></td>
</tr></tbody></table>
</form></div>
</div>
<div class="upanel"><div id="fq_search_items" class="items bl_cont">
<?
if($config['q']['text']){
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `support_v` WHERE `title` like '%".$config['q']['text']."%'"),0);
$q = mysql_query("SELECT * FROM `support_v` WHERE `title` like '%".$config['q']['text']."%' ORDER BY `id` DESC");
}
else{
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `support`"),0);
$q = mysql_query("SELECT * FROM `support` ORDER BY `id` DESC");
}
if ($k_post == 0){
?>
<div class="service_msg_box">
<div class="service_msg service_msg_null">Раздел помощи пуст.</div>
</div>
<?
}
else{
while ($post = mysql_fetch_assoc($q)){
if($config['q']['text']){
?>
<div class="faq_item">
<a class="faq_title_wrap faq_fat" href="?category_id=<?= $post['id_help']?>&question_id=<?= $post['id']?>">
<div class="faq_title">
<img class="i_icon" src="/files/images/blank.gif" width="16" height="16">
<div class="faq_label"><?= text($post['title'])?></div>
</div>
</a>
</div>
<?
}
else{
?>
<a class="faq_cat_item faq_fat" href="/support?category_id=<?= $post['id']?>">
<div class="faq_body">
<div class="body_icon "><?= text($post['title'])?></div>
</div>
</a>
<?
}
}
}
?>
</div></div>
</div>
<?
}
include_once H.'sys/inc/tfoot.php';
?>