Exemplo n.º 1
0
        $comments_show = 'y';
        if (!$tikilib->user_has_voted($user, 'comment' . $_REQUEST["comments_threadId"])) {
            $commentslib->vote_comment($_REQUEST["comments_threadId"], $user, $_REQUEST["comments_vote"]);
            $tikilib->register_user_vote($user, 'comment' . $_REQUEST["comments_threadId"]);
        }
        $_REQUEST["comments_threadId"] = 0;
        $smarty->assign('comments_threadId', 0);
    }
}
if ($tiki_p_remove_comments == 'y' && (!isset($forum_mode) || $forum_mode == 'n') || isset($forum_mode) && $forum_mode == 'y' && $tiki_p_admin_forum == 'y') {
    if (isset($_REQUEST["comments_remove"]) && isset($_REQUEST["comments_threadId"])) {
        $area = 'delcomment';
        if ($prefs['feature_ticketlib2'] != 'y' or isset($_POST['daconfirm']) and isset($_SESSION["ticket_{$area}"])) {
            key_check($area);
            $comments_show = 'y';
            $commentslib->remove_comment($_REQUEST["comments_threadId"]);
            $_REQUEST["comments_threadId"] = 0;
            $smarty->assign('comments_threadId', 0);
        } else {
            key_get($area);
        }
    }
}
if ($_REQUEST["comments_threadId"] > 0) {
    $comment_info = $commentslib->get_comment($_REQUEST["comments_threadId"]);
    $smarty->assign('comment_title', $comment_info["title"]);
    $smarty->assign('comment_rating', $comment_info["comment_rating"]);
    $smarty->assign('comment_data', $comment_info["data"]);
} elseif ($_REQUEST["comments_reply_threadId"] > 0) {
    // Replies to comments.
    $comment_info = $commentslib->get_comment($_REQUEST["comments_reply_threadId"]);
Exemplo n.º 2
0
	}

	if ($prefs['feature_forum_topics_archiving'] && isset($_REQUEST['archive']) && isset($_REQUEST['comments_parentId'])) {
		check_ticket('view-forum');
		if ($_REQUEST['archive'] == 'y') {
			$commentslib->archive_thread($_REQUEST['comments_parentId']);
		} elseif ($_REQUEST['archive'] == 'n') {
			$commentslib->unarchive_thread($_REQUEST['comments_parentId']);
		}
	}
	
	if (isset($_REQUEST['delsel_x']) && isset($_REQUEST['forumtopic']) && is_array($_REQUEST['forumtopic'])) {
		$access->check_authenticity();
		foreach ($_REQUEST['forumtopic'] as $topicId) {
			if (is_numeric($topicId)) {
				$commentslib->remove_comment($topicId);
			}
		}
		$commentslib->forum_prune($_REQUEST['forumId']);
	}

}

$smarty->assign_by_ref('forum_info', $forum_info);
$comments_per_page = $forum_info['topicsPerPage'];
$thread_sort_mode = $forum_info['topicOrdering'];
$comments_vars = array('forumId');

$comments_prefix_var = 'forum:';
$comments_object_var = 'forumId';
Exemplo n.º 3
0
 function remove_object($type, $id)
 {
     global $categlib, $dbTiki;
     if (!is_object($categlib)) {
         require_once "lib/categories/categlib.php";
     }
     global $objectlib;
     require_once 'lib/objectlib.php';
     $categlib->uncategorize_object($type, $id);
     // Now remove comments
     $query = "select * from `tiki_comments` where `object`=?  and `objectType`=?";
     $result = $this->query($query, array($id, $type));
     if ($result) {
         include_once "lib/commentslib.php";
         $commentslib = new Comments($dbTiki);
     }
     while ($res = $result->fetchRow()) {
         $commentslib->remove_comment($res['threadId']);
     }
     // Remove individual permissions for this object if they exist
     $object = $type . $id;
     $query = "delete from `users_objectpermissions` where `objectId`=? and `objectType`=?";
     $result = $this->query($query, array(md5($object), $type));
     // remove links from this object to pages
     $linkhandle = "objectlink:{$type}:{$id}";
     $query = "delete from `tiki_links` where `fromPage` = ?";
     $result = $this->query($query, array($linkhandle));
     // remove object
     $objectlib->delete_object($type, $id);
     return true;
 }
	$smarty->assign('mass_ban_ip', $_REQUEST['mass_ban_ip']);
	$info['mode'] = 'mass_ban_ip';
	$info['title'] = tr('Multiple IP Banning');
	$info['message'] = tr('Access from your localization was forbidden due to excessive spamming.');
	$info['date_to'] = $tikilib->now + 365 * 24 * 3600;
	$banId_list = explode('|', $_REQUEST['mass_ban_ip']);
	// Handle case when coming from tiki-list_comments with a list of IPs to ban and also delete the related comments
	if ( !empty($_REQUEST['mass_remove']) ) {
		$access->check_authenticity(tra('Delete comments then set banning rules'));
	}
	foreach ($banId_list as $id) {
		$ban_comment=$commentslib->get_comment($id);
		$ban_comments_list[$ban_comment['user_ip']][$id]['userName'] = $ban_comment['userName'];
		$ban_comments_list[$ban_comment['user_ip']][$id]['title'] = $ban_comment['title'];
		if ( !empty($_REQUEST['mass_remove']) ) {
			$commentslib->remove_comment($id);
		}
	}
	$smarty->assign_by_ref('ban_comments_list', $ban_comments_list);
}

// Handle case when coming from tiki-admin_actionlog with a list of IPs to ban
if (!empty($_REQUEST['mass_ban_ip_actionlog'])) {
	check_ticket('admin-banning');
	include_once ('lib/logs/logslib.php');
	$actionslib = new LogsLib;
	$smarty->assign('mass_ban_ip', $_REQUEST['mass_ban_ip_actionlog']);
	$info['mode'] = 'mass_ban_ip';
	$info['title'] = tr('Multiple IP Banning');
	$info['message'] = tr('Access from your localization was forbidden due to excessive spamming.');
	$info['date_to'] = $tikilib->now + 365 * 24 * 3600;
        $list_types[$type] = 'y';
        $_REQUEST['types'][] = $type;
    }
}
$smarty->assign('list_types', $list_types);
$smarty->assign('types', $_REQUEST['types']);
if (in_array('blog', $_REQUEST['types']) && !in_array('post', $_REQUEST['types']) && $prefs['feature_blogposts_comments'] == 'y') {
    $_REQUEST['types'][] = 'post';
}
if (isset($_REQUEST['remove'])) {
    check_ticket('list_comments');
    $area = 'removecomment';
    if ($prefs['feature_ticketlib2'] != 'y' or isset($_POST['daconfirm']) and isset($_SESSION["ticket_{$area}"])) {
        key_check($area);
        foreach ($_REQUEST["checked"] as $remove) {
            $commentslib->remove_comment($remove);
        }
    } elseif ($prefs['feature_ticketlib2'] == 'y') {
        $ch = "";
        foreach ($_REQUEST['checked'] as $c) {
            $ch .= "&checked[]=" . urlencode($c);
        }
        foreach ($_REQUEST['types'] as $c) {
            $ch .= "&types[]=" . urlencode($c);
        }
        if (isset($_REQUEST['find'])) {
            $ch .= '&find=' . $_REQUEST['find'];
        }
        if (isset($_REQUEST['sort_mode'])) {
            $ch .= '&sort_mode=' . $_REQUEST['sort_mode'];
        }
    $smarty->assign('next_topic', false);
}
if (count($threads)) {
    $prev_thread = $threads[0];
    $smarty->assign('prev_topic', $prev_thread['threadId']);
} else {
    $smarty->assign('prev_topic', false);
}
//$end_time = microtime(true);
//print "TIME3: ".($end_time - $start_time)."\n";
if ($tiki_p_admin_forum == 'y') {
    if (isset($_REQUEST['delsel'])) {
        if (isset($_REQUEST['forumthread'])) {
            check_ticket('view-forum');
            foreach (array_values($_REQUEST['forumthread']) as $thread) {
                $commentslib->remove_comment($thread);
                $commentslib->register_remove_post($_REQUEST['forumId'], $_REQUEST['comments_parentId']);
            }
        }
    }
    if (isset($_REQUEST['remove_attachment'])) {
        $area = 'delforumattach';
        if ($prefs['feature_ticketlib2'] != 'y' or isset($_POST['daconfirm']) and isset($_SESSION["ticket_{$area}"])) {
            key_check($area);
            $commentslib->remove_thread_attachment($_REQUEST['remove_attachment']);
        } else {
            key_get($area);
        }
    }
    if (isset($_REQUEST['movesel'])) {
        if (isset($_REQUEST['forumthread'])) {