home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2005 April
/
PCWorld_2005-04_cd.bin
/
akce
/
web
/
unitednuke
/
unitednuke.exe
/
html
/
admin
/
modules
/
comments.php
< prev
next >
Wrap
PHP Script
|
2004-08-23
|
10KB
|
277 lines
<?PHP
/************************************************************************/
/* PHP-NUKE: Web Portal System */
/* =========================== */
/* */
/* Copyright (c) 2002 by Francisco Burzi */
/* 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. */
/************************************************************************/
if (!eregi("admin.php", $_SERVER['PHP_SELF'])) { die ("Access Denied"); }
global $prefix, $db;
$aid = substr(trim($aid), 0,25);
$row = $db->sql_fetchrow($db->sql_query("SELECT radminsuper FROM ".$prefix."_authors WHERE aid='$aid'"));
if ($row['radminsuper'] == 1) {
//vlozi copyrightove informace
function un_comments_copyright() {
echo "<table border=\"0\" align=\"right\" valign=\"top\"><tr><td align=\"right\">Copyright (c) 2004 <a href=\"mailto:united-nuke@openland.cz\">Jiri Stavinoha</a></td></tr></table>";
}
//zakladnφ menu
function un_comments_remover_main() {
include("header.php");
GraphicAdmin();
title(""._COMMENTS_TITLE."");
OpenTable();
echo "<form action=\"admin.php\" method=\"post\"\n";
echo "<table border=\"0\" align=\"center\" cellspacing=\"5\">\n";
echo "<tr><td align=\"right\">"._COMMENTS_INSERTIP."</td><td align=\"left\">\n";
echo "<input type=\"text\" name=\"poster_ip\" size=\"16\">\n";
echo "<input type=\"hidden\" name=\"op\" value=\"CommentsRemoverViewList\">\n";
echo "<input type=\"submit\" value=\""._COMMENTS_DISPLAYCOMMENTS."\">\n";
echo "</td></tr>\n";
echo "</form>\n";
echo "</table>\n";
CloseTable();
un_comments_copyright();
include("footer.php");
}
//zobrazeni prispevku
function un_comments_remover_view_list($poster_ip) {
global $db, $prefix, $anonymous;
include("header.php");
GraphicAdmin();
title(""._COMMENTS_TITLE."");
$result = $db->sql_query("SELECT subject, comment, tid, sid, name, date FROM ".$prefix."_comments WHERE host_name='$poster_ip' ORDER BY date DESC");
if ($db->sql_numrows($result) == 0) {
OpenTable();
echo "<center>"._COMMENTS_NOCOMMENTS."</center>";
CloseTable();
} else {
OpenTable();
echo "<center>"._COMMENTS_COMMENTSWITHIP." $poster_ip "._COMMENTS_BYTIMEINSERT."</center>";
CloseTable();
echo "<br>";
OpenTable();
while ($row = $db->sql_fetchrow($result)) {
$subject = $row['subject'];
$comment = $row['comment'];
$tid = intval($row['tid']);
$sid = intval($row['sid']);
$name = $row['name'];
$date = $row['date'];
if ($name == $anonymous OR $name == "") {
$from_poster = $anonymous;
} else {
$from_poster = "<a href=\"modules.php?name=Your_Account&op=userinfo&username=$name\" target=\"_blank\">$name</a>";
}
echo "<table bgcolor=\"$bgcolor1\" border=\"0\" cellpadding=\"8\" cellspacing=\"1\" width=\"100%\">\n";
echo "<tbody><tr>\n";
echo " <td>\n";
echo " <table border=\"0\" width=\"99%\">\n";
echo " <tbody><tr bgcolor=\"$bgcolor1\">\n";
echo " <td width=\"500\">\n";
echo " <b>$subject</b> <font class=\"content\"><br>"._BY." $from_poster "._ON." ".formatTimestamp($date)."</font>\n";
echo " </td>\n";
echo " </tr><tr>\n";
echo " <td>$comment</td>\n";
echo " </tr></tbody>\n";
echo " </table>\n";
echo "<font class=\"content\">[ <a href=\"admin.php?op=RemoveComment&tid=$tid&sid=$sid\" target=\"_blank\">"._DELETE."</a> ]</font>\n";
echo " </td>\n";
echo "</tr></tbody>\n";
echo "</table>";
}
CloseTable();
echo "<br>";
OpenTable();
echo "<form action=\"admin.php\" method=\"post\"\n";
echo "<table border=\"0\" align=\"center\" cellspacing=\"5\">\n";
echo "<tr><td align=\"center\">\n";
echo "<input type=\"hidden\" name=\"ok\" value=\"0\">\n";
echo "<input type=\"hidden\" name=\"poster_ip\" value=\"$poster_ip\">\n";
echo "<input type=\"hidden\" name=\"op\" value=\"CommentsRemoverremoveAll\">\n";
echo "<input type=\"submit\" value=\""._COMMENTS_DELETEALLSELECTEDCOMMENTS."\">\n";
echo "</td></tr>\n";
echo "</form>\n";
echo "</table>\n";
CloseTable();
}
un_comments_copyright();
include("footer.php");
}
function un_comments_removerremove_all($poster_ip, $ok) {
global $db, $prefix;
include("header.php");
GraphicAdmin();
title(""._COMMENTS_TITLE."");
if ($ok) {
$result = $db->sql_query("SELECT tid, sid FROM ".$prefix."_comments WHERE host_name='$poster_ip'");
if ($db->sql_numrows($result) == 0) {
OpenTable();
echo "<center>"._COMMENTS_NOCOMMENTSWITHIP." $poster_ip "._COMMENTS_COMMENTSNOTFOUND."</center>";
CloseTable();
} else {
while ($row = $db->sql_fetchrow($result)) {
$tid = intval($row['tid']);
$sid = intval($row['sid']);
removeComment ($tid, $sid, 1, 1);
}
Header("Location: admin.php?op=CommentsRemoverMain");
}
} else {
OpenTable();
echo "<center>"._COMMENTS_AREYOUSUREDELETEALLSELECTED."<br><br>[ <a href=\"javascript:history.go(-1)\">"._NO."</a> | <a href=\"admin.php?op=CommentsRemoverremoveAll&poster_ip=$poster_ip&ok=1\">"._YES."</a> ]</center>\n";
CloseTable();
}
un_comments_copyright();
include("footer.php");
}
/*********************************************************/
/* Comments Delete Function */
/*********************************************************/
/* Thanks to Oleg [Dark Pastor] Martos from http://www.rolemancer.ru */
/* to code the comments childs deletion function! */
function removeSubComments($tid) {
global $prefix, $db;
$tid = intval($tid);
$result = $db->sql_query("SELECT tid from ".$prefix."_comments where pid='$tid'");
$numrows = $db->sql_numrows($result);
if($numrows>0) {
while ($row = $db->sql_fetchrow($result)) {
$stid = intval($row['tid']);
removeSubComments($stid);
$stid = intval($stid);
$db->sql_query("delete from ".$prefix."_comments where tid='$stid'");
}
}
$db->sql_query("delete from ".$prefix."_comments where tid='$tid'");
}
function removeComment ($tid, $sid, $ok=0, $un_all = 0) {
global $ultramode, $prefix, $db;
if($ok) {
$tid = intval($tid);
$result = $db->sql_query("SELECT date from ".$prefix."_comments where pid='$tid'");
$numresults = $db->sql_numrows($result);
$row = $db->sql_fetchrow($result);
$sid = intval($sid);
$db->sql_query("update ".$prefix."_stories set comments=comments-1-'$numresults' where sid='$sid'");
/* Call recursive delete function to delete the comment and all its childs */
removeSubComments($tid);
if ($ultramode) {
ultramode();
}
if ($un_all == 0) {
Header("Location: modules.php?name=News&file=article&sid=$sid");
}
} else {
include("header.php");
GraphicAdmin();
OpenTable();
echo "<center><font class=\"title\"><b>"._REMOVECOMMENTS."</b></font></center>";
CloseTable();
echo "<br>";
OpenTable();
echo "<center>"._SURETODELCOMMENTS."";
echo "<br><br>[ <a href=\"javascript:history.go(-1)\">"._NO."</a> | <a href=\"admin.php?op=RemoveComment&tid=$tid&sid=$sid&ok=1\">"._YES."</a> ]</center>";
CloseTable();
include("footer.php");
}
}
function removePollSubComments($tid) {
global $prefix, $db;
$tid = intval($tid);
$result = $db->sql_query("SELECT tid from ".$prefix."_pollcomments where pid='$tid'");
$numrows = $db->sql_numrows($result);
if($numrows>0) {
while ($row = $db->sql_fetchrow($result)) {
$stid = intval($row['tid']);
removePollSubComments($stid);
$db->sql_query("delete from ".$prefix."_pollcomments where tid='$stid'");
}
}
$db->sql_query("delete from ".$prefix."_pollcomments where tid='$tid'");
}
function RemovePollComment ($tid, $pollID, $ok=0) {
if($ok) {
removePollSubComments($tid);
Header("Location: modules.php?name=Surveys&op=results&pollID=$pollID");
} else {
include("header.php");
GraphicAdmin();
OpenTable();
echo "<center><font class=\"title\"><b>"._REMOVECOMMENTS."</b></font></center>";
CloseTable();
echo "<br>";
OpenTable();
echo "<center>"._SURETODELCOMMENTS."";
echo "<br><br>[ <a href=\"javascript:history.go(-1)\">"._NO."</a> | <a href=\"admin.php?op=RemovePollComment&tid=$tid&pollID=$pollID&ok=1\">"._YES."</a> ]</center>";
CloseTable();
include("footer.php");
}
}
switch ($op) {
case "RemoveComment":
removeComment ($tid, $sid, $ok);
break;
case "removeSubComments":
removeSubComments($tid);
break;
case "removePollSubComments":
removePollSubComments($tid);
break;
case "RemovePollComment":
RemovePollComment($tid, $pollID, $ok);
break;
case "CommentsRemoverMain":
un_comments_remover_main();
break;
case "CommentsRemoverViewList":
un_comments_remover_view_list($poster_ip);
break;
case "CommentsRemoverremoveAll":
un_comments_removerremove_all($poster_ip, $ok);
break;
}
} else {
echo "Access Denied";
}
?>