[ Index ] |
|
Code source de CMS made simple 1.0.5 |
1 <?php 2 #CMS - CMS Made Simple 3 #(c)2004 by Ted Kulp (wishy@users.sf.net) 4 #This project's homepage is: http://cmsmadesimple.sf.net 5 # 6 #This program is free software; you can redistribute it and/or modify 7 #it under the terms of the GNU General Public License as published by 8 #the Free Software Foundation; either version 2 of the License, or 9 #(at your option) any later version. 10 # 11 #This program is distributed in the hope that it will be useful, 12 #but WITHOUT ANY WARRANTY; without even the implied warranty of 13 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 #GNU General Public License for more details. 15 #You should have received a copy of the GNU General Public License 16 #along with this program; if not, write to the Free Software 17 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 # 19 #$Id: listusers.php 3601 2006-12-20 21:04:54Z calguy1000 $ 20 21 $CMS_ADMIN_PAGE=1; 22 23 require_once ("../include.php"); 24 require_once ("../lib/classes/class.user.inc.php"); 25 26 check_login(); 27 28 include_once ("header.php"); 29 global $gCms; 30 $db =& $gCms->GetDb(); 31 32 if (isset($_GET["message"])) { 33 $message = preg_replace('/\</','',$_GET['message']); 34 echo '<div class="pagemcontainer"><p class="pagemessage">'.$message.'</p></div>'; 35 } 36 37 38 if (isset($_GET["toggleactive"])) 39 { 40 if($_GET["toggleactive"]==1) { 41 $error .= "<li>".lang('errorupdatinguser')."</li>"; 42 } else { 43 global $gCms; 44 $userops =& $gCms->GetUserOperations(); 45 $thisuser =& $userops->LoadUserByID($_GET["toggleactive"]); 46 47 if($thisuser) { 48 49 //modify users, is this enough? 50 $userid = get_userid(); 51 $permission = check_permission($userid, 'Modify Users'); 52 53 $result = false; 54 if($permission) 55 { 56 57 $thisuser->active == 1 ? $thisuser->active = 0 : $thisuser->active=1; 58 59 #Perform the edituser_pre callback 60 foreach($gCms->modules as $key=>$value) 61 { 62 if ($gCms->modules[$key]['installed'] == true && 63 $gCms->modules[$key]['active'] == true) 64 { 65 $gCms->modules[$key]['object']->EditUserPre($thisuser); 66 } 67 } 68 69 $result = $thisuser->save(); 70 71 } 72 73 if ($result) 74 { 75 audit($user_id, $thisuser->username, 'Edited User'); 76 #Perform the edituser_post callback 77 foreach($gCms->modules as $key=>$value) 78 { 79 if ($gCms->modules[$key]['installed'] == true && 80 $gCms->modules[$key]['active'] == true) 81 { 82 $gCms->modules[$key]['object']->EditUserPost($thisuser); 83 } 84 } 85 } else { 86 $error .= "<li>".lang('errorupdatinguser')."</li>"; 87 } 88 } 89 } 90 } 91 92 if (FALSE == empty($error)) { 93 echo $themeObject->ShowErrors('<ul class="error">'.$error.'</ul>'); 94 } 95 96 97 ?> 98 99 <div class="pagecontainer"> 100 <div class="pageoverflow"> 101 102 <?php 103 104 $userid = get_userid(); 105 $edit = check_permission($userid, 'Modify Users'); 106 $remove = check_permission($userid, 'Remove Users'); 107 108 $query = "SELECT user_id, username, active FROM ".cms_db_prefix()."users ORDER BY user_id"; 109 $result = $db->Execute($query); 110 111 global $gCms; 112 $userops =& $gCms->GetUserOperations(); 113 $userlist =& $userops->LoadUsers(); 114 115 $page = 1; 116 if (isset($_GET['page'])) $page = $_GET['page']; 117 $limit = 20; 118 if (count($userlist) > $limit) 119 { 120 echo "<p class=\"pageshowrows\">".pagination($page, count($userlist), $limit)."</p>"; 121 } 122 echo $themeObject->ShowHeader('currentusers').'</div>'; 123 if ($userlist && count($userlist) > 0){ 124 echo "<table cellspacing=\"0\" class=\"pagetable\">\n"; 125 echo '<thead>'; 126 echo "<tr>\n"; 127 echo "<th class=\"pagew70\">".lang('username')."</th>\n"; 128 echo "<th class=\"pagepos\">".lang('active')."</th>\n"; 129 echo "<th class=\"pageicon\"> </th>\n"; 130 if ($remove) 131 echo "<th class=\"pageicon\"> </th>\n"; 132 echo "</tr>\n"; 133 echo '</thead>'; 134 echo '<tbody>'; 135 136 $currow = "row1"; 137 // construct true/false button images 138 $image_true = $themeObject->DisplayImage('icons/system/true.gif', lang('true'),'','','systemicon'); 139 $image_false = $themeObject->DisplayImage('icons/system/false.gif', lang('false'),'','','systemicon'); 140 141 $counter=0; 142 foreach ($userlist as $oneuser){ 143 if ($counter < $page*$limit && $counter >= ($page*$limit)-$limit) { 144 echo "<tr class=\"$currow\" onmouseover=\"this.className='".$currow.'hover'."';\" onmouseout=\"this.className='".$currow."';\">\n"; 145 echo "<td><a href=\"edituser.php?user_id=".$oneuser->id."\">".$oneuser->username."</a></td>\n"; 146 echo "<td class=\"pagepos\"><a href=\"listusers.php?toggleactive=".$oneuser->id."\">".($oneuser->active == 1?$image_true:$image_false)."</a></td>\n"; 147 if ($edit || $userid == $oneuser->id) 148 { 149 echo "<td><a href=\"edituser.php?user_id=".$oneuser->id."\">"; 150 echo $themeObject->DisplayImage('icons/system/edit.gif', lang('edit'),'','','systemicon'); 151 echo "</a></td>\n"; 152 } 153 else 154 { 155 echo "<td> </td>\n"; 156 } 157 if ($remove && $oneuser->id != 1) 158 { 159 echo "<td><a href=\"deleteuser.php?user_id=".$oneuser->id."\" onclick=\"return confirm('".lang('deleteconfirm')."');\">"; 160 echo $themeObject->DisplayImage('icons/system/delete.gif', lang('delete'),'','','systemicon'); 161 echo "</a></td>\n"; 162 } 163 echo "</tr>\n"; 164 165 ($currow=="row1"?$currow="row2":$currow="row1"); 166 } 167 $counter++; 168 } 169 170 echo '</tbody>'; 171 echo "</table>\n"; 172 173 } 174 175 if (check_permission($userid, 'Add Users')) { 176 ?> 177 <div class="pageoptions"> 178 <p class="pageoptions"> 179 <a href="adduser.php"> 180 <?php 181 echo $themeObject->DisplayImage('icons/system/newobject.gif', lang('adduser'),'','','systemicon').'</a>'; 182 echo ' <a class="pageoptions" href="adduser.php">'.lang("adduser"); 183 ?> 184 </a> 185 </p> 186 </div> 187 </div> 188 189 <p class="pageback"><a class="pageback" href="<?php echo $themeObject->BackUrl(); ?>">« <?php echo lang('back')?></a></p> 190 191 <?php 192 } 193 194 include_once ("footer.php"); 195 196 # vim:ts=4 sw=4 noet 197 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Tue Apr 3 18:50:37 2007 | par Balluche grâce à PHPXref 0.7 |