[ Index ]
 

Code source de PHP NUKE 7.9

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/admin/modules/ -> comments.php (source)

   1  <?PHP
   2  
   3  /************************************************************************/
   4  /* PHP-NUKE: Web Portal System                                          */
   5  /* ===========================                                          */
   6  /*                                                                      */
   7  /* Copyright (c) 2005 by Francisco Burzi                                */
   8  /* http://phpnuke.org                                                   */
   9  /*                                                                      */
  10  /* This program is free software. You can redistribute it and/or modify */
  11  /* it under the terms of the GNU General Public License as published by */
  12  /* the Free Software Foundation; either version 2 of the License.       */
  13  /************************************************************************/
  14  
  15  if (!defined('ADMIN_FILE')) {
  16      die ("Access Denied");
  17  }
  18  
  19  global $prefix, $db, $admin_file;
  20  $aid = substr("$aid", 0,25);
  21  $row = $db->sql_fetchrow($db->sql_query("SELECT radminsuper FROM " . $prefix . "_authors WHERE aid='$aid'"));
  22  if ($row['radminsuper'] == 1) {
  23  
  24      /*********************************************************/
  25      /* Comments Delete Function                              */
  26      /*********************************************************/
  27  
  28      /* Thanks to Oleg [Dark Pastor] Martos from http://www.rolemancer.ru */
  29      /* to code the comments childs deletion function!                    */
  30  
  31  	function removeSubComments($tid) {
  32          global $prefix, $db;
  33          $tid = intval($tid);
  34          $result = $db->sql_query("SELECT tid from " . $prefix . "_comments where pid='$tid'");
  35          $numrows = $db->sql_numrows($result);
  36          if($numrows>0) {
  37              while ($row = $db->sql_fetchrow($result)) {
  38                  $stid = intval($row['tid']);
  39                  removeSubComments($stid);
  40                  $stid = intval($stid);
  41                  $db->sql_query("delete from " . $prefix . "_comments where tid='$stid'");
  42              }
  43          }
  44          $db->sql_query("delete from " . $prefix . "_comments where tid='$tid'");
  45      }
  46  
  47  	function removeComment ($tid, $sid, $ok=0) {
  48          global $ultramode, $prefix, $db, $admin_file;
  49          if($ok) {
  50              $tid = intval($tid);
  51              $result = $db->sql_query("SELECT date from " . $prefix . "_comments where pid='$tid'");
  52              $numresults = $db->sql_numrows($result);
  53              $sid = intval($sid);
  54              $db->sql_query("update " . $prefix . "_stories set comments=comments-1-'$numresults' where sid='$sid'");
  55              /* Call recursive delete function to delete the comment and all its childs */
  56              removeSubComments($tid);
  57              if ($ultramode) {
  58                  ultramode();
  59              }
  60              Header("Location: modules.php?name=News&file=article&sid=$sid");
  61          } else {
  62              include ("header.php");
  63              GraphicAdmin();
  64              OpenTable();
  65              echo "<center><font class=\"title\"><b>" . _REMOVECOMMENTS . "</b></font></center>";
  66              CloseTable();
  67              echo "<br>";
  68              OpenTable();
  69              echo "<center>" . _SURETODELCOMMENTS . "";
  70              echo "<br><br>[ <a href=\"javascript:history.go(-1)\">" . _NO . "</a> | <a href=\"".$admin_file.".php?op=RemoveComment&tid=$tid&sid=$sid&ok=1\">" . _YES . "</a> ]</center>";
  71              CloseTable();
  72              include ("footer.php");
  73          }
  74      }
  75  
  76  	function removePollSubComments($tid) {
  77          global $prefix, $db;
  78          $tid = intval($tid);
  79          $result = $db->sql_query("SELECT tid, pollID from " . $prefix . "_pollcomments where pid='$tid'");
  80          $numrows = $db->sql_numrows($result);
  81          if($numrows>0) {
  82              while ($row = $db->sql_fetchrow($result)) {
  83                  $stid = intval($row['tid']);
  84                  removePollSubComments($stid);
  85                  $db->sql_query("delete from " . $prefix . "_pollcomments where tid='$stid'");
  86                  $db->sql_query("update " . $prefix . "_poll_desc set comments=comments-1 where pollID='".intval($row['pollID'])."'");
  87              }
  88          }
  89          $db->sql_query("delete from " . $prefix . "_pollcomments where tid='$tid'");
  90          $db->sql_query("update " . $prefix . "_poll_desc set comments=comments-1 where pollID='".intval($row['pollID'])."'");
  91      }
  92  
  93  	function RemovePollComment ($tid, $pollID, $ok=0) {
  94          global $admin_file, $prefix, $db;
  95          if($ok) {
  96              $db->sql_query("update " . $prefix . "_poll_desc set comments=comments-1 where pollID='".intval($pollID)."'");
  97              removePollSubComments($tid);
  98              Header("Location: modules.php?name=Surveys&op=results&pollID=$pollID");
  99          } else {
 100              include ("header.php");
 101              GraphicAdmin();
 102              OpenTable();
 103              echo "<center><font class=\"title\"><b>" . _REMOVECOMMENTS . "</b></font></center>";
 104              CloseTable();
 105              echo "<br>";
 106              OpenTable();
 107              echo "<center>" . _SURETODELCOMMENTS . "";
 108              echo "<br><br>[ <a href=\"javascript:history.go(-1)\">" . _NO . "</a> | <a href=\"".$admin_file.".php?op=RemovePollComment&tid=$tid&pollID=$pollID&ok=1\">" . _YES . "</a> ]</center>";
 109              CloseTable();
 110              include ("footer.php");
 111          }
 112      }
 113  
 114      switch ($op) {
 115  
 116          case "RemoveComment":
 117          removeComment ($tid, $sid, $ok);
 118          break;
 119  
 120          case "removeSubComments":
 121          removeSubComments($tid);
 122          break;
 123  
 124          case "removePollSubComments":
 125          removePollSubComments($tid);
 126          break;
 127  
 128          case "RemovePollComment":
 129          RemovePollComment($tid, $pollID, $ok);
 130          break;
 131  
 132      }
 133  
 134  } else {
 135      echo "Access Denied";
 136  }
 137  ?>


Généré le : Sun Apr 1 11:11:59 2007 par Balluche grâce à PHPXref 0.7