| [ Index ] |
|
Code source de XOOPS 2.0.17.1 |
1 <?php 2 // $Id: main.php 2 2005-11-02 18:23:29Z skalpa $ 3 // ------------------------------------------------------------------------ // 4 // XOOPS - PHP Content Management System // 5 // Copyright (c) 2000 XOOPS.org // 6 // <http://www.xoops.org/> // 7 // ------------------------------------------------------------------------ // 8 // This program is free software; you can redistribute it and/or modify // 9 // it under the terms of the GNU General Public License as published by // 10 // the Free Software Foundation; either version 2 of the License, or // 11 // (at your option) any later version. // 12 // // 13 // You may not change or alter any portion of this comment or credits // 14 // of supporting developers from this source code or any supporting // 15 // source code which is considered copyrighted (c) material of the // 16 // original comment or credit authors. // 17 // // 18 // This program is distributed in the hope that it will be useful, // 19 // but WITHOUT ANY WARRANTY; without even the implied warranty of // 20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // 21 // GNU General Public License for more details. // 22 // // 23 // You should have received a copy of the GNU General Public License // 24 // along with this program; if not, write to the Free Software // 25 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // 26 // ------------------------------------------------------------------------ // 27 // Author: Kazumi Ono (AKA onokazu) // 28 // URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ // 29 // Project: The XOOPS Project // 30 // ------------------------------------------------------------------------- // 31 32 33 if ( !is_object($xoopsUser) || !is_object($xoopsModule) || !$xoopsUser->isAdmin($xoopsModule->getVar('mid')) ) { 34 exit("Access Denied"); 35 } else { 36 $op = 'list'; 37 if (isset($_GET['op'])) { 38 $op = trim($_GET['op']); 39 } 40 switch ($op) { 41 case 'list': 42 include_once XOOPS_ROOT_PATH.'/include/comment_constants.php'; 43 include_once XOOPS_ROOT_PATH.'/language/'.$xoopsConfig['language'].'/comment.php'; 44 $limit_array = array(10, 20, 50, 100); 45 $status_array = array(XOOPS_COMMENT_PENDING => _CM_PENDING, XOOPS_COMMENT_ACTIVE => _CM_ACTIVE, XOOPS_COMMENT_HIDDEN => _CM_HIDDEN); 46 $status_array2 = array(XOOPS_COMMENT_PENDING => '<span style="text-decoration: none; font-weight: bold; color: #00ff00;">'._CM_PENDING.'</span>', XOOPS_COMMENT_ACTIVE => '<span style="text-decoration: none; font-weight: bold; color: #ff0000;">'._CM_ACTIVE.'</span>', XOOPS_COMMENT_HIDDEN => '<span style="text-decoration: none; font-weight: bold; color: #0000ff;">'._CM_HIDDEN.'</span>'); 47 $start = 0; 48 $limit = 0; 49 $otherorder = 'DESC'; 50 $comments = array(); 51 $status = (!isset($_GET['status']) || !in_array(intval($_GET['status']), array_keys($status_array))) ? 0 : intval($_GET['status']); 52 $module = !isset($_GET['module']) ? 0 : intval($_GET['module']); 53 $module_handler =& xoops_gethandler('module'); 54 $module_array =& $module_handler->getList(new Criteria('hascomments', 1)); 55 $comment_handler =& xoops_gethandler('comment'); 56 $criteria = new CriteriaCompo(); 57 if ($status > 0) { 58 $criteria->add(new Criteria('com_status', $status)); 59 } 60 if ($module > 0) { 61 $criteria->add(new Criteria('com_modid', $module)); 62 } 63 $total = $comment_handler->getCount($criteria); 64 if ($total > 0) { 65 $start = isset($_GET['start']) ? intval($_GET['start']) : 0; 66 $limit = isset($_GET['limit']) ? intval($_GET['limit']) : 0; 67 if (!in_array($limit, $limit_array)) { 68 $limit = 50; 69 } 70 $sort = (!isset($_GET['sort']) || !in_array($_GET['sort'], array('com_modid', 'com_status', 'com_created', 'com_uid', 'com_ip', 'com_title'))) ? 'com_id' : $_GET['sort']; 71 if (!isset($_GET['order']) || $_GET['order'] != 'ASC') { 72 $order = 'DESC'; 73 $otherorder = 'ASC'; 74 } else { 75 $order = 'ASC'; 76 $otherorder = 'DESC'; 77 } 78 $criteria->setSort($sort); 79 $criteria->setOrder($order); 80 $criteria->setLimit($limit); 81 $criteria->setStart($start); 82 $comments =& $comment_handler->getObjects($criteria, true); 83 } 84 $form = '<form action="admin.php" method="get">'; 85 $form .= '<select name="module">'; 86 $module_array[0] = _MD_AM_ALLMODS; 87 foreach ($module_array as $k => $v) { 88 $sel = ''; 89 if ($k == $module) { 90 $sel = ' selected="selected"'; 91 } 92 $form .= '<option value="'.$k.'"'.$sel.'>'.$v.'</option>'; 93 } 94 $form .= '</select> <select name="status">'; 95 $status_array[0] = _MD_AM_ALLSTATUS; 96 foreach ($status_array as $k => $v) { 97 $sel = ''; 98 if (isset($status) && $k == $status) { 99 $sel = ' selected="selected"'; 100 } 101 $form .= '<option value="'.$k.'"'.$sel.'>'.$v.'</option>'; 102 } 103 $form .= '</select> <select name="limit">'; 104 foreach ($limit_array as $k) { 105 $sel = ''; 106 if (isset($limit) && $k == $limit) { 107 $sel = ' selected="selected"'; 108 } 109 $form .= '<option value="'.$k.'"'.$sel.'>'.$k.'</option>'; 110 } 111 $form .= '</select> <input type="hidden" name="fct" value="comments" /><input type="submit" value="'._GO.'" name="selsubmit" /></form>'; 112 113 xoops_cp_header(); 114 echo '<h4 style="text-align:left">'._MD_AM_COMMMAN.'</h4>'; 115 echo $form; 116 echo '<table width="100%" class="outer" cellspacing="1"><tr><th colspan="8">'._MD_AM_LISTCOMM.'</th></tr><tr align="center"><td class="head"> </td><td class="head" align="left"><a href="admin.php?fct=comments&op=list&sort=com_title&order='.$otherorder.'&module='.$module.'&status='.$status.'&start='.$start.'&limit='.$limit.'">'._CM_TITLE.'</a></td><td class="head"><a href="admin.php?fct=comments&op=list&sort=com_created&order='.$otherorder.'&module='.$module.'&status='.$status.'&start='.$start.'&limit='.$limit.'">'._CM_POSTED.'</a></td><td class="head"><a href="admin.php?fct=comments&op=list&sort=com_uid&order='.$otherorder.'&module='.$module.'&status='.$status.'&start='.$start.'&limit='.$limit.'">'._CM_POSTER.'</a></td><td class="head"><a href="admin.php?fct=comments&op=list&sort=com_ip&order='.$otherorder.'&module='.$module.'&status='.$status.'&start='.$start.'&limit='.$limit.'">IP</a></td><td class="head"><a href="admin.php?fct=comments&op=list&sort=com_modid&order='.$otherorder.'&module='.$module.'&status='.$status.'&start='.$start.'&limit='.$limit.'">'._MD_AM_MODULE.'</a></td><td class="head"><a href="admin.php?fct=comments&op=list&sort=com_status&order='.$otherorder.'&module='.$module.'&status='.$status.'&start='.$start.'&limit='.$limit.'">'._CM_STATUS.'</a></td><td class="head"> </td></tr>'; 117 $class = 'even'; 118 foreach (array_keys($comments) as $i) { 119 $class = ($class == 'odd') ? 'even' : 'odd'; 120 $poster_uname = $xoopsConfig['anonymous']; 121 if ($comments[$i]->getVar('com_uid') > 0) { 122 $poster =& $member_handler->getUser($comments[$i]->getVar('com_uid')); 123 if (is_object($poster)) { 124 $poster_uname = '<a href="'.XOOPS_URL.'/userinfo.php?uid='.$comments[$i]->getVar('com_uid').'">'.$poster->getVar('uname').'</a>'; 125 } 126 } 127 $icon = $comments[$i]->getVar('com_icon'); 128 $icon = empty( $icon ) ? '/images/icons/no_posticon.gif' : ( '/images/subject/' . htmlspecialchars( $icon, ENT_QUOTES ) ); 129 $icon = '<img src="' . XOOPS_URL . $icon . '" alt="" />'; 130 131 echo '<tr align="center"><td class="'.$class.'">'.$icon.'</td><td class="'.$class.'" align="left"><a href="admin.php?fct=comments&op=jump&com_id='.$i.'">'. $comments[$i]->getVar('com_title').'</a></td><td class="'.$class.'">'.formatTimestamp($comments[$i]->getVar('com_created'), 'm').'</td><td class="'.$class.'">'.$poster_uname.'</td><td class="'.$class.'">'.$comments[$i]->getVar('com_ip').'</td><td class="'.$class.'">'.$module_array[$comments[$i]->getVar('com_modid')].'</td><td class="'.$class.'">'.$status_array2[$comments[$i]->getVar('com_status')].'</td><td class="'.$class.'" align="right"><a href="admin/comments/comment_edit.php?com_id='.$i.'">'._EDIT.'</a> <a href="admin/comments/comment_delete.php?com_id='.$i.'">'._DELETE.'</a></td></tr>'; 132 } 133 echo '</table>'; 134 echo '<table style="width: 100%; border: 0; margin: 3px; padding: 3px;"><tr><td>'.sprintf(_MD_AM_COMFOUND, '<b>'.$total.'</b>'); 135 if ($total > $limit) { 136 include_once XOOPS_ROOT_PATH.'/class/pagenav.php'; 137 $nav = new XoopsPageNav($total, $limit, $start, 'start', 'fct=comments&op=list&limit='.$limit.'&sort='.$sort.'&order='.$order.'&module='.$module); 138 echo '</td><td align="right">'.$nav->renderNav(); 139 } 140 echo '</td></tr></table>'; 141 xoops_cp_footer(); 142 break; 143 144 case 'jump': 145 $com_id = (isset($_GET['com_id'])) ? intval($_GET['com_id']) : 0; 146 if ($com_id > 0) { 147 $comment_handler =& xoops_gethandler('comment'); 148 $comment =& $comment_handler->get($com_id); 149 if (is_object($comment)) { 150 $module_handler =& xoops_gethandler('module'); 151 $module =& $module_handler->get($comment->getVar('com_modid')); 152 $comment_config = $module->getInfo('comments'); 153 header('Location: '.XOOPS_URL.'/modules/'.$module->getVar('dirname').'/'.$comment_config['pageName'].'?'.$comment_config['itemName'].'='.$comment->getVar('com_itemid').'&com_id='.$comment->getVar('com_id').'&com_rootid='.$comment->getVar('com_rootid').'&com_mode=thread&'.str_replace('&', '&', $comment->getVar('com_exparams')).'#comment'.$comment->getVar('com_id')); 154 exit(); 155 } 156 } 157 redirect_header('admin.php?fct=comments', 1); 158 break; 159 160 default: 161 break; 162 } 163 164 } 165 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Sun Nov 25 11:44:32 2007 | par Balluche grâce à PHPXref 0.7 |
|