[ Index ] |
|
Code source de e107 0.7.8 |
1 <?php 2 /* 3 + ----------------------------------------------------------------------------+ 4 | e107 website system 5 | 6 | ©Steve Dunstan 2001-2002 7 | http://e107.org 8 | jalist@e107.org 9 | 10 | Released under the terms and conditions of the 11 | GNU General Public License (http://gnu.org). 12 | 13 | $Source: /cvsroot/e107/e107_0.7/e107_admin/modcomment.php,v $ 14 | $Revision: 1.16 $ 15 | $Date: 2006/02/24 18:36:35 $ 16 | $Author: whoisrich $ 17 +----------------------------------------------------------------------------+ 18 */ 19 require_once ("../class2.php"); 20 if (!getperms("B")) { 21 header("location:".e_BASE."index.php"); 22 exit; 23 } 24 require_once ("auth.php"); 25 require_once(e_HANDLER."comment_class.php"); 26 $cobj = new comment; 27 global $tp; 28 29 $tmp = explode(".", e_QUERY); 30 $table = $tmp[0]; 31 $id = intval($tmp[1]); 32 $editid = intval($tmp[2]); 33 $type = $cobj -> getCommentType($table); 34 35 if (isset($_POST['moderate'])) { 36 if (isset($_POST['comment_comment'])) { 37 $sql->db_Update("comments", "comment_comment='".$tp -> todb($_POST['comment_comment'])."' WHERE comment_id='$editid' "); 38 header("location: ".e_ADMIN."modcomment.php?{$table}.{$id}"); exit; 39 } 40 if (isset($_POST['comment_lock']) && $_POST['comment_lock'] == "1" && $_POST['comment_lock'] != $_POST['current_lock']) { 41 $sql->db_Update("comments", "comment_lock='1' WHERE comment_item_id='$id' "); 42 } 43 if ((!isset($_POST['comment_lock']) || $_POST['comment_lock'] == "0") && $_POST['comment_lock'] != $_POST['current_lock']) { 44 $sql->db_Update("comments", "comment_lock='0' WHERE comment_item_id='$id' "); 45 } 46 if (is_array($_POST['comment_blocked'])) { 47 while (list ($key, $cid) = each ($_POST['comment_blocked'])) { 48 $sql->db_Update("comments", "comment_blocked='1' WHERE comment_id='$cid' "); 49 } 50 } 51 if (is_array($_POST['comment_unblocked'])) { 52 while (list ($key, $cid) = each ($_POST['comment_unblocked'])) { 53 $sql->db_Update("comments", "comment_blocked='0' WHERE comment_id='$cid' "); 54 } 55 } 56 if (is_array($_POST['comment_delete'])) { 57 while (list ($key, $cid) = each ($_POST['comment_delete'])) { 58 if ($sql->db_Select("comments", "*", "comment_id='$cid' ")) { 59 $row = $sql->db_Fetch(); 60 delete_children($row, $cid); 61 } 62 } 63 } 64 $e107cache->clear("comment"); 65 $e107cache->clear("news"); 66 $e107cache->clear($table); 67 $message = MDCLAN_1; 68 } 69 70 if (isset($message)) { 71 $ns->tablerender("", "<div style='text-align:center'><b>".$message."</b></div>"); 72 } 73 74 $text = " 75 <div style='text-align:center'> 76 <form method='post' action='".e_SELF."?".e_QUERY."'> 77 <table class='fborder' style='".ADMIN_WIDTH."'>"; 78 79 if ($editid) 80 { 81 if (!$sql->db_Select("comments", "*", "comment_id=$editid")) { 82 $text .= "<tr><td class='forumheader3' style='text-align:center'>".MDCLAN_2.".</td></tr>"; 83 } 84 else 85 { 86 $row = $sql->db_Fetch(); 87 $text .= "<tr><td><textarea class='tbox' name='comment_comment' cols='1' rows='15' style='width:100%;'>".$row['comment_comment']."</textarea></td></tr>"; 88 $text .= "<tr><td colspan='5' class='forumheader' style='text-align:center'><input class='button' type='submit' name='moderate' value='".MDCLAN_8."' /></td></tr>"; 89 } 90 91 $text .= "</table></form></div>"; 92 $ns->tablerender(MDCLAN_8, $text); 93 require_once ("footer.php"); exit; 94 } 95 96 if (!$sql->db_Select("comments", "*", "(comment_type='".$type."' OR comment_type='".$table."') AND comment_item_id=$id")) { 97 $text .= "<tr><td class='forumheader3' style='text-align:center'>".MDCLAN_2.".</td></tr>"; 98 } else { 99 $con = new convert; 100 101 $commentArray = $sql -> db_getList(); 102 $total_comments = count($commentArray); 103 104 $comments = ""; 105 foreach($commentArray as $row) 106 { 107 $comment_lock = $row['comment_lock']; 108 $total_blocked += $row['comment_blocked']; 109 $datestamp = $con->convert_date($row['comment_datestamp'], "short"); 110 $comment_author_id = substr($row['comment_author'], 0, strpos($row['comment_author'], ".")); 111 if ($comment_author_id) { 112 $sql->db_Select("user", "*", "user_id='$comment_author_id' "); 113 $rowu = $sql->db_Fetch(); 114 $comment_nick = "<a href='".e_BASE."user.php?id.".$rowu['user_id']."'>".$rowu['user_name']."</a>"; 115 $comment_str = MDCLAN_3." #".$rowu['user_id']; 116 } else { 117 $comment_str = MDCLAN_4; 118 $comment_nick = preg_replace("#[0-9]+\.#", "", $row['comment_author']); 119 } 120 $row['comment_comment'] = $tp->toHTML($row['comment_comment'], TRUE, ""); 121 122 $comments .= " 123 <tr> 124 <td class='forumheader3' style='width:5%; text-align:center;'>".($row['comment_blocked'] ? "<img src='".e_IMAGE."admin_images/blocked.png' />" : " ")."</td> 125 <td class='forumheader3' style='width:15%;'>".$datestamp."</td> 126 <td class='forumheader3' style='width:15%;'><b>".$comment_nick."</b><br />".$comment_str."</td> 127 <td class='forumheader3' style='width:40%;'>".$row['comment_comment']."</td> 128 <td class='forumheader3' style='width:25%;'> 129 <a href='".e_ADMIN."modcomment.php?{$table}.{$id}.".$row['comment_id']."'><img src='".e_IMAGE."admin_images/edit_16.png' alt='".LAN_EDIT."' title='".LAN_EDIT."' style='border:none' /></a>" 130 ." ".($row['comment_blocked'] ? "<input type='checkbox' name='comment_unblocked[]' value='".$row['comment_id']."' /> ".MDCLAN_5."" : "<input type='checkbox' name='comment_blocked[]' value='".$row['comment_id']."' /> ".MDCLAN_6."") 131 ." <input type='checkbox' name='comment_delete[]' value='".$row['comment_id']."' /> ".LAN_DELETE." 132 </td> 133 </tr>"; 134 } 135 $text .= " 136 <tr><td colspan='5' class='fcaption'>".MDCLAN_10."</td></tr> 137 <tr> 138 <td class='forumheader3' style='text-align:right' colspan='4'>".MDCLAN_14.":</td> 139 <td style='width:25%;' class='forumheader3'> 140 <input type='radio' name='comment_lock' value='0' ".(!$comment_lock ? " checked='checked'" : "")." /> ".MDCLAN_15." 141 <input type='radio' name='comment_lock' value='1' ".($comment_lock ? " checked='checked'" : "")." /> ".MDCLAN_16." 142 <input type='hidden' name='current_lock' value='".$comment_lock."' /> 143 </td> 144 </tr> 145 <tr><td colspan='5' class='fcaption'>comments (".$total_comments." ".($total_comments == "1" ? MDCLAN_11 : MDCLAN_12).", ".$total_blocked." ".MDCLAN_13.")</td></tr> 146 ".$comments." 147 <tr><td colspan='5' class='forumheader' style='text-align:center'>".MDCLAN_9."</td></tr> 148 <tr><td colspan='5' class='forumheader' style='text-align:center'><input class='button' type='submit' name='moderate' value='".MDCLAN_8."' /></td></tr> 149 "; 150 } 151 $text .= "</table></form></div>"; 152 153 $ns->tablerender(MDCLAN_8, $text); 154 155 require_once ("footer.php"); 156 157 function delete_children($row, $cid) { 158 global $sql, $sql2, $table; 159 160 $tmp = explode(".", $row['comment_author']); 161 $u_id = $tmp[0]; 162 if ($u_id >= 1) { 163 $sql->db_Update("user", "user_comments=user_comments-1 WHERE user_id='$u_id'"); 164 } 165 if($table == "news"){ 166 $sql->db_Update("news", "news_comment_total=news_comment_total-1 WHERE news_id='".$row['comment_item_id']."'"); 167 } 168 if ($sql2->db_Select("comments", "*", "comment_pid='".$row['comment_id']."'")) { 169 while ($row2 = $sql2->db_Fetch()) { 170 delete_children($row2, $row2['comment_id']); 171 } 172 } 173 $c_del[] = $cid; 174 while (list ($key, $cid) = each ($c_del)) { 175 $sql->db_Delete("comments", "comment_id='$cid'"); 176 } 177 } 178 179 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Apr 1 01:23:32 2007 | par Balluche grâce à PHPXref 0.7 |