Files
forum/Sources/Ignore.php
2012-01-29 22:01:07 +04:00

50 lines
1.6 KiB
PHP

<?php
/******************************************************************************
* Ignore.php *
******************************************************************************/
if (!defined('SMF'))
die('Hacking attempt...');
function ignore()
{
global $topic, $txt, $db_prefix, $context, $scripturl, $sourcedir, $ID_MEMBER, $mongodb;
// We need at least a topic... go away if you don't have one.
if (empty($topic))
fatal_lang_error(472, false);
foreach (array('member', 'msg') as $var) isset($_GET[$var]) ? $_GET[$var] = (int) $_GET[$var] : $_GET[$var] = 0;
$ignoree_id = $_GET['member'];
$msg = $_GET['msg'];
if ($ID_MEMBER > 0 && $ignoree_id > 0)
$mongodb->rock->ignorelists->update(
array ('user' => (int) $ID_MEMBER),
array ('$addToSet' => array ('ignores' => $ignoree_id)),
array ('upsert' => true));
// Back to the topic!
redirectexit('topic=' . $topic . '.msg'.$msg."#msg".$msg);
}
function unignore()
{
global $topic, $txt, $db_prefix, $context, $scripturl, $sourcedir, $ID_MEMBER, $mongodb;
// We need at least a topic... go away if you don't have one.
if (empty($topic))
fatal_lang_error(472, false);
foreach (array('member', 'msg') as $var) isset($_GET[$var]) ? $_GET[$var] = (int) $_GET[$var] : $_GET[$var] = 0;
$ignoree_id = $_GET['member'];
$msg = $_GET['msg'];
if ($ID_MEMBER > 0 && $ignoree_id > 0)
$mongodb->rock->ignorelists->update(
array ('user' => (int) $ID_MEMBER),
array ('$pull' => array ('ignores' => $ignoree_id)));
// Back to the topic!
redirectexit('topic=' . $topic . '.msg'.$msg."#msg".$msg);
}