<?php

@( (bool)FALSE === strpos( $_SERVER['REQUEST_URI'], basename( __FILE__ ) ) ) OR exit( '!! ACCESS DENIED !!' );
error_reporting( _E_VALUE );


/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | myPHPNuke Version 188_8 RC2                                          |
// +----------------------------------------------------------------------+
// | License: GNU/GPL - http://www.gnu.org/copyleft/gpl.html              |
// +----------------------------------------------------------------------+
// | Support: http://myphpnuke.com/                                       |
// +----------------------------------------------------------------------+
// | Author: myPHPNuke Dev Team                                           |
// +----------------------------------------------------------------------+
// | Copyright: © 2001-2004 myPHPNuke Dev Team                            |
// +----------------------------------------------------------------------+
// $Id: comments.php,v 1.3.2.7 2004/08/15 12:58:04 kirilt Exp $




/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2001 by Francisco Burzi (fburzi@ncc.org.ve)            */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/

/*********************************************************/
/* Comments Delete Function                              */
/*********************************************************/

// This function is a big crap. I need to delete all babies comments
// maybe by setting a unique number for each Parent comment?
// Anyone, please help me to do this!

function removeComment ($tid, $sid) {
    global $ultramode, $mpnTables,$phpEx;
    mysql_query("update ".$mpnTables['stories']." set comments=comments-1 where sid='$sid'");
    mysql_query("DELETE FROM ".$mpnTables['comments']." where tid=$tid");
    mysql_query("DELETE FROM ".$mpnTables['comments']." where pid=$tid");
    if ($ultramode) {
    ultramode();
    }

    $_SERVER['F_LIB'] -> redirectRequest( 'article.php?sid=' . $sid );

}

function RemovePollComment ($tid, $pollID) {
    global $mpnTables,$phpEx;
    mysql_query("DELETE FROM ".$mpnTables['pollcomments']." where tid=$tid and pollID=$pollID");
    mysql_query("DELETE FROM ".$mpnTables['pollcomments']." where pid=$tid");

    $_SERVER['F_LIB'] -> redirectRequest( 'article.php?op=results&pollID=' . $pollID );
}

switch ($op)
{
    case "RemoveComment":
        checkAccess( NULL, array( 'article' ), FALSE, FALSE );
        removeComment($tid, $sid);
        break;

    case "RemovePollComment":
        checkAccess( NULL, array( 'survey' ), FALSE, FALSE );
        RemovePollComment($tid, $pollID);
        break;

}

?>
