Файл: panel/spam.php
Строк: 88
<?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();
if (privilegy('spam') == FALSE) {
header("Location: ".HOME."/panel/");
exit();
}
head('Spam tizimi');
switch ($select) {
default:
echo DIV_BLOCK . '<b>Bo`limni tanlang:</b>' . CLOSE_DIV;
$dialog = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".SPAM." WHERE `type` = ? ", array('mail'));
echo DIV_LI . '<a href="'.HOME.'/panel/spam/dialog/">Suhbatlar</a>'.($dialog > 0 ? ' <b>[' . $dialog .']</b>' : NULL) . CLOSE_DIV;
break;
case 'dialog':
$all = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".SPAM." WHERE `type` = ? ", array('mail'));
if (empty($all)) {
echo DIV_BLOCK . 'Ro`yhat bo`sh' . CLOSE_DIV;
} else {
if (!empty($_POST['send'])) {
$post_id = abs(num($_POST['post_id']));
$post = DB::$dbs->queryFetch("SELECT * FROM ".SPAM." WHERE `id` = ? ",array($post_id));
if (empty($post)) {
DIV_BLOCK . 'Habarlar topilmadi' . CLOSE_DIV;
} else {
switch ($_POST['dey']) {
case 1:
/* Удаляем сообщение */
DB::$dbs->query("DELETE FROM ".DIALOG_MSG." WHERE `id` = ? ",array($post['post_id']));
DB::$dbs->query("DELETE FROM ".SPAM." WHERE `id` = ? ",array($post['id']));
echo DIV_BLOCK . 'Habarlar o`chirilgan' . CLOSE_DIV;
break;
case 2:
/* Удалить сообщение и все похожие */
DB::$dbs->query("DELETE FROM ".DIALOG_MSG." WHERE `msg` LIKE '%".$post['msg']."%' && `user` = ? ",array($post['spam_user']));
DB::$dbs->query("DELETE FROM ".SPAM." WHERE `id` = ? ",array($post['id']));
echo DIV_BLOCK . 'Habar o`chirildi' . CLOSE_DIV;
break;
case 3:
/* Удалить все сообщение от нарушителя */
DB::$dbs->query("DELETE FROM ".DIALOG_MSG." WHERE `user` = ? ",array($post['spam_user']));
DB::$dbs->query("DELETE FROM ".SPAM." WHERE `id` = ? ",array($post['id']));
echo DIV_BLOCK . 'Habar o`chirildi' . CLOSE_DIV;
break;
case 4:
/* Разблокировать сообщение */
DB::$dbs->query("UPDATE ".DIALOG_MSG." SET `spam` = ? WHERE `id` = ? ",array('', $post['post_id']));
DB::$dbs->query("DELETE FROM ".SPAM." WHERE `id` = ? ",array($post['id']));
echo DIV_BLOCK . 'Habarlar blokdan chiqarildi' . CLOSE_DIV;
break;
case 5:
/* Разблокировать сообщение и все похожие */
DB::$dbs->query("UPDATE ".DIALOG_MSG." SET `spam` = ? WHERE `id` = ? && `msg` LIKE '%".$post['msg']."%'",array('', $post['post_id']));
DB::$dbs->query("DELETE FROM ".SPAM." WHERE `id` = ? ",array($post['id']));
echo DIV_BLOCK . 'Habar blokdan chiqarildi' . CLOSE_DIV;
break;
case 6:
/* Заблокировать нарушителя */
DB::$dbs->query("INSERT INTO ".BANN." (`user_id`, `moder`, `time_bann`, `prich`, `time`) VALUES (?, ?, ?, ?, ?)", array($post['spam_user'], $user['user_id'], (time() + 99999999), 'Рассылка спама.', time()));
DB::$dbs->query("DELETE FROM ".SPAM." WHERE `id` = ? ",array($post['id']));
echo DIV_BLOCK . 'Foydalanuvchi muvaffaqiyatli bloklandi' . CLOSE_DIV;
break;
case 7:
/* Удалить нарушителя */
DB::$dbs->query("DELETE FROM ".USERS." WHERE `user_id` = ? ",array($post['spam_user']));
DB::$dbs->query("DELETE FROM ".SPAM." WHERE `id` = ? ",array($post['id']));
echo DIV_BLOCK . 'Foydalanuvchi muvaffaqiyatli o`chirildi' . CLOSE_DIV;
break;
case 8:
/* Удалить нарушителя + удалить все от него */
# Удаление фотоальбомов/Фотографий
$sql = DB::$dbs->query("SELECT * FROM ".ALBUMS." WHERE `user_id` = ?", array($post['spam_user']));
while($album = $sql -> fetch()) {
$sql2 = DB::$dbs->query("SELECT * FROM ".ALBUMS_PHOTOS." WHERE `album_id` = ?", array($album['id']));
while($photo = $sql2 -> fetch()) {
@unlink('../album/'.$photo['url']);
}
DB::$dbs->query("DELETE FROM ".ALBUMS_PHOTOS." WHERE `album_id` = ? ",array($album['id']));
}
DB::$dbs->query("DELETE FROM ".ALBUMS." WHERE `user_id` = ? ",array($post['spam_user']));
# Чистка черного списка
DB::$dbs->query("DELETE FROM ".BLACKUSERS." WHERE `user_id` = ? ",array($post['spam_user']));
# Чистка в блоге
DB::$dbs->query("DELETE FROM ".BLOG." WHERE `user_id` = ? ",array($post['spam_user']));
DB::$dbs->query("DELETE FROM ".BLOG_COMM." WHERE `user_id` = ? ",array($post['spam_user']));
# Чистка сообщений в чате
DB::$dbs->query("DELETE FROM ".CHAT_MSG." WHERE `user_id` = ? ",array($post['spam_user']));
# Чистка сообщений в диалоге
DB::$dbs->query("DELETE FROM ".DIALOG_MSG." WHERE `user` = ? ",array($post['spam_user']));
# Удаление тем на форуме
DB::$dbs->query("DELETE FROM ".FORUMS_THEME." WHERE `user_id` = ? ",array($post['spam_user']));
# Чистка сообщений на форуме
DB::$dbs->query("DELETE FROM ".FORUMS_POST." WHERE `user_id` = ? ",array($post['spam_user']));
# Чистка сообщений в беседке
DB::$dbs->query("DELETE FROM ".GUESTBOOK." WHERE `user_id` = ? ",array($post['spam_user']));
# Чистка сообщений в личных гостевых
DB::$dbs->query("DELETE FROM ".GUEST." WHERE `autor_id` = ? ",array($post['spam_user']));
# Удаление пользователя
DB::$dbs->query("DELETE FROM ".USERS." WHERE `user_id` = ? ",array($post['spam_user']));
DB::$dbs->query("DELETE FROM ".SPAM." WHERE `id` = ? ",array($post['id']));
echo DIV_BLOCK . 'Muvaffaqiyatli qilindi!' . CLOSE_DIV;
break;
case 9:
/* Удаление уведомления */
DB::$dbs->query("DELETE FROM ".SPAM." WHERE `id` = ? ",array($post['id']));
echo DIV_BLOCK . 'Bildirishnoma muvaffaqiyatli o`chirildi' . CLOSE_DIV;
break;
default:
echo DIV_BLOCK . 'Notanish operatsiya' . CLOSE_DIV;
break;
}
}
}
$n = new Navigator($all,5,'');
$sql = DB::$dbs->query("SELECT * FROM ".SPAM." WHERE `type` = ? ORDER BY `id` DESC LIMIT {$n->start()}, 5", array('mail'));
while($post = $sql -> fetch()){
echo DIV_BLOCK;
echo '<b>Habarga arz qilish:</b><br />' . text($post['msg']) . '<br /><br />'
. '<b>Bildirdi:</b> ' . user_choice($post['user_id'], 'link') . '<br />'
. '<b>Qoidabuzar:</b> ' . user_choice($post['spam_user'], 'link') . '<br />'
. '<b>Sana:</b> ' . vrem($post['time']) . '<br /><br />'
. '<form action="#" method="POST">'
. '<select name="dey">'
. '<option value="0">Amalni tanlang</option>'
. '<option value="1">Habarni o`chirish</option>'
. '<option value="2">Habarni va shunga o`hshashlarni o`chirish</option>'
. '<option value="3">Qoidabuzarning hamma habarlarini o`chirish</option>'
. '<option value="4">Habarni blokdan chiqarish</option>'
. '<option value="5">Habarni va shunga o`hshashlarni blokdan chiqarish</option>'
. '<option value="6">Qoidabuzarni bloklash</option>'
. '<option value="7">Qoidabuzarni o`chirish</option>'
. '<option value="8">Qoidabuzarni o`chirish + undagi hammasini o`chirish</option>'
. '<option value="9">Bildirishnomani o`chirish</option>'
. '</select><br />'
. '<input type="hidden" name="post_id" value="'.$post['id'].'"/>'
. '<input type="submit" name="send" value="Davomi" />'
. '</form>';
echo CLOSE_DIV;
}
echo $n->navi();
}
break;
}
echo DIV_GO . '<a href="'.HOME.'/">Bosh sahifa</a> / <a href="'.HOME.'/panel/">Boshqaruv paneli</a> / <b>Spam tizimi</b>' . CLOSE_DIV;
require_once('../core/stop.php');
?>