[ 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_handlers/forum_mod.php,v $ 14 | $Revision: 1.7 $ 15 | $Date: 2007/01/17 20:46:54 $ 16 | $Author: e107steved $ 17 +----------------------------------------------------------------------------+ 18 */ 19 20 if (!defined('e107_INIT')) { exit; } 21 22 function forum_thread_moderate($p) { 23 global $sql; 24 25 foreach($p as $key => $val) { 26 if (preg_match("#(.*?)_(\d+)_x#", $key, $matches)) { 27 $act = $matches[1]; 28 $id = $matches[2]; 29 30 switch($act) { 31 case 'lock' : 32 $sql->db_Update("forum_t", "thread_active='0' WHERE thread_id='".intval($id)."' "); 33 return FORLAN_CLOSE; 34 break; 35 36 case 'unlock' : 37 $sql->db_Update("forum_t", "thread_active='1' WHERE thread_id='".intval($id)."' "); 38 return FORLAN_OPEN; 39 break; 40 41 case 'stick' : 42 $sql->db_Update("forum_t", "thread_s='1' WHERE thread_id='".intval($id)."' "); 43 return FORLAN_STICK; 44 break; 45 46 case 'unstick' : 47 $sql->db_Update("forum_t", "thread_s='0' WHERE thread_id='".intval($id)."' "); 48 return FORLAN_UNSTICK; 49 break; 50 51 case 'delete' : 52 return forum_delete_thread($id); 53 break; 54 55 } 56 } 57 } 58 } 59 60 function forum_delete_thread($thread_id) { 61 global $sql; 62 $sql->db_Select("forum_t", "*", "thread_id='".intval($thread_id)."' "); 63 $row = $sql->db_Fetch(); 64 extract($row); 65 if ($thread_parent) { 66 // is post a reply? 67 $sql->db_Delete("forum_t", "thread_id = '".intval($thread_id)."' "); 68 // delete reply only 69 $sql->db_Update("forum", "forum_replies=forum_replies-1 WHERE forum_id='{$thread_forum_id}'"); 70 // dec reply count by 1 71 72 $sql->db_Select("forum_t", "*", "thread_id = ".intval($thread_id)); 73 $row = $sql->db_Fetch(); 74 extract($row); 75 $replies = $sql->db_Count("forum_t", "(*)", "WHERE thread_parent='".$thread_parent."'"); 76 $pref['forum_postspage'] = ($pref['forum_postspage'] ? $pref['forum_postspage'] : 10); 77 78 $pages = 0; 79 if ($replies) { 80 $pages = ((ceil($replies / $pref['forum_postspage']) -1) * $pref['forum_postspage']); 81 } 82 83 $url = e_BASE."forum_viewtopic.php?".$thread_parent.($pages ? ".$pages" : ""); 84 // set return url 85 return FORLAN_26; 86 } else { 87 // post is thread 88 $sql->db_Delete("poll", "poll_datestamp='".intval($thread_id)."'"); 89 // delete poll if there is one 90 $count = $sql->db_Delete("forum_t", "thread_parent='".intval($thread_id)."'"); 91 // delete replies and grab how many there were 92 $sql->db_Delete("forum_t", "thread_id='".intval($thread_id)."'"); 93 // delete the post itself 94 $sql->db_Update("forum", "forum_threads=forum_threads-1, forum_replies = forum_replies - {$count} WHERE forum_id = '{$thread_forum_id}'"); 95 // update thread/reply counts 96 $url = e_BASE."forum_viewforum.php?".$forum_id; 97 // set return url 98 return FORLAN_6.($count ? ", ".$count." ".FORLAN_7."." : "."); 99 } 100 } 101 ?>
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 |