[ Index ]

PHP Cross Reference of phpwcms V1.4.3 _r380 (23.11.09)

title

Body

[close]

/include/inc_tmpl/ -> admin.listuser.tmpl.php (source)

   1  <?php
   2  /*************************************************************************************
   3     Copyright notice
   4     
   5     (c) 2002-2009 Oliver Georgi (oliver@phpwcms.de) // All rights reserved.
   6   
   7     This script is part of PHPWCMS. The PHPWCMS web content management system is
   8     free software; you can redistribute it and/or modify it under the terms of
   9     the GNU General Public License as published by the Free Software Foundation;
  10     either version 2 of the License, or (at your option) any later version.
  11    
  12     The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
  13     A copy is found in the textfile GPL.txt and important notices to the license 
  14     from the author is found in LICENSE.txt distributed with these scripts.
  15    
  16     This script is distributed in the hope that it will be useful, but WITHOUT ANY 
  17     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  18     PARTICULAR PURPOSE.  See the GNU General Public License for more details.
  19   
  20     This copyright notice MUST APPEAR in all copies of the script!
  21  *************************************************************************************/
  22  
  23  // ----------------------------------------------------------------
  24  // obligate check for phpwcms constants
  25  if (!defined('PHPWCMS_ROOT')) {
  26     die("You Cannot Access This Script Directly, Have a Nice Day.");
  27  }
  28  // ----------------------------------------------------------------
  29  
  30  
  31  // create paginating for users
  32  if(isset($_GET['c'])) {
  33      $_SESSION['list_user_count'] = (trim($_GET['c']) == 'all') ? '99999' : intval($_GET['c']);
  34  }
  35  if(isset($_GET['page'])) {
  36      $_SESSION['list_user_page'] = intval($_GET['page']);
  37  }
  38  
  39  
  40  // set default values for paginating
  41  if(empty($_SESSION['list_user_count'])) {
  42      $_SESSION['list_user_count'] = 25;
  43  }
  44  
  45  $_userInfo = array();
  46  
  47  
  48  // get filter and paginating form values
  49  if(isset($_POST['do_pagination'])) {
  50  
  51      $_SESSION['list_admin']        = empty($_POST['showadmin']) ? 0 : 1;
  52      $_SESSION['list_befe']        = empty($_POST['showbefe']) ? 0 : 1;
  53      $_SESSION['list_norm']        = empty($_POST['shownorm']) ? 0 : 1;
  54      $_SESSION['list_fe']        = empty($_POST['showfe']) ? 0 : 1;
  55      
  56      $_SESSION['list_user_page']    = intval($_POST['page']);
  57      $_SESSION['filter_results']    = clean_slweg($_POST['filter']);
  58      if(empty($_SESSION['filter_results'])) {
  59          unset($_SESSION['filter_results']);
  60      } else {
  61          $_SESSION['filter_results']    = convertStringToArray($_SESSION['filter_results'], ' ');
  62      }
  63  }
  64  
  65  if(empty($_SESSION['list_user_page'])) {
  66      $_SESSION['list_user_page'] = 1;
  67  }
  68  
  69  $_userInfo['list_admin']    = isset($_SESSION['list_admin']) ? $_SESSION['list_admin'] : 0;
  70  $_userInfo['list_befe']        = isset($_SESSION['list_befe']) ? $_SESSION['list_befe'] : 0;
  71  $_userInfo['list_norm']        = isset($_SESSION['list_norm']) ? $_SESSION['list_norm'] : 0;
  72  $_userInfo['list_fe']        = isset($_SESSION['list_fe']) ? $_SESSION['list_fe'] : 0;
  73  
  74  $_userInfo['list']            = array();
  75  // if admin user should be listed
  76  $_userInfo['where_query']     = ' WHERE usr_aktiv != 9';
  77  if($_userInfo['list_admin']) {
  78  $_userInfo['where_query']    .= ' AND usr_admin=1';
  79  }
  80  if($_userInfo['list_befe']) {
  81      $_userInfo['list'][]    = ' usr_fe=2 ';
  82  }
  83  if($_userInfo['list_norm']) {
  84      $_userInfo['list'][]    = ' usr_fe=1 ';
  85  }
  86  if($_userInfo['list_fe']) {
  87      $_userInfo['list'][]    = ' usr_fe=0 ';
  88  }
  89  $_userInfo['list']            = trim(implode('OR', $_userInfo['list']));
  90  if($_userInfo['list']) {
  91      $_userInfo['where_query'] .= ' AND ('.$_userInfo['list'].')';
  92  }
  93  if(isset($_SESSION['filter_results']) && count($_SESSION['filter_results'])) {
  94      
  95      $_userInfo['filter_array'] = array();
  96  
  97      foreach($_SESSION['filter_results'] as $_userInfo['filter']) {
  98          //usr_name, usr_login, usr_email
  99          $_userInfo['filter_array'][] = "CONCAT(usr_name, usr_login, usr_email) LIKE '%".aporeplace($_userInfo['filter'])."%'";
 100      }
 101      if(count($_userInfo['filter_array'])) {
 102      
 103          $_userInfo['where_query'] .= ' AND ('.implode('OR', $_userInfo['filter_array']).')';
 104      
 105      }
 106  
 107  }
 108  
 109  // paginating values
 110  $_userInfo['count_total'] = _dbQuery("SELECT COUNT(*) FROM ".DB_PREPEND."phpwcms_user ".$_userInfo['where_query'], 'COUNT');
 111  $_userInfo['pages_total'] = ceil($_userInfo['count_total'] / $_SESSION['list_user_count']);
 112  if($_SESSION['list_user_page'] > $_userInfo['pages_total']) {
 113      $_SESSION['list_user_page'] = empty($_userInfo['pages_total']) ? 1 : $_userInfo['pages_total'];
 114  }
 115  
 116  ?><table width="538" border="0" cellpadding="0" cellspacing="0" summary="">
 117          <tr><td colspan="3" class="title"><?php echo $BL['be_admin_usr_ltitle'] ?></td></tr>
 118          <tr><td colspan="3"><img src="img/leer.gif" alt="" width="1" height="5"></td></tr>        
 119          <tr><td colspan="3"><form action="phpwcms.php?do=admin" method="post" name="paginate" id="paginate"><input type="hidden" name="do_pagination" value="1" />
 120      <table width="100%" border="0" cellpadding="0" cellspacing="0" class="paginate" summary="">
 121          <tr>
 122              <td><table border="0" cellpadding="0" cellspacing="0" summary="">
 123                  <tr>
 124                      
 125                      <td><input type="checkbox" name="showadmin" id="showadmin" value="1" onclick="this.form.submit();"<?php is_checked(1, $_userInfo['list_admin'], 1) ?> /></td>
 126                      <td><label for="showadmin"><img src="img/usricon/usr_admin.gif" alt="" /></label></td>
 127                      <td><input type="checkbox" name="showbefe" id="showbefe" value="1" onclick="this.form.submit();"<?php is_checked(1, $_userInfo['list_befe'], 1) ?> /></td>
 128                      <td><label for="showbefe"><img src="img/usricon/usr_befe.gif" alt="" /></label></td>
 129                      <td><input type="checkbox" name="shownorm" id="shownorm" value="1" onclick="this.form.submit();"<?php is_checked(1, $_userInfo['list_norm'], 1) ?> /></td>
 130                      <td><label for="shownorm"><img src="img/usricon/usr_norm.gif" alt="" /></label></td>
 131                      <td><input type="checkbox" name="showfe" id="showfe" value="1" onclick="this.form.submit();"<?php is_checked(1, $_userInfo['list_fe'], 1) ?> /></td>
 132                      <td><label for="showfe"><img src="img/usricon/usr_16.gif" alt="" /></label></td>
 133                      
 134  <?php 
 135  if($_userInfo['pages_total'] > 1) {
 136  
 137      echo '<td class="chatlist">|&nbsp;</td>';
 138      echo '<td>';
 139      if($_SESSION['list_user_page'] > 1) {
 140          echo '<a href="phpwcms.php?do=admin&amp;page='.($_SESSION['list_user_page']-1).'">';
 141          echo '<img src="img/famfamfam/action_back.gif" alt="" border="0" /></a>';
 142      } else {
 143          echo '<img src="img/famfamfam/action_back.gif" alt="" border="0" class="inactive" />';
 144      }
 145      echo '</td>';
 146      echo '<td><input type="text" name="page" id="page" maxlength="4" size="4" value="'.$_SESSION['list_user_page'];
 147      echo '"  class="textinput" style="margin:0 3px 0 5px;width:30px;font-weight:bold;" /></td>';
 148      echo '<td class="chatlist">/'.$_userInfo['pages_total'].'&nbsp;</td>';
 149      echo '<td>';
 150      if($_SESSION['list_user_page'] < $_userInfo['pages_total']) {
 151          echo '<a href="phpwcms.php?do=admin&amp;page='.($_SESSION['list_user_page']+1).'">';
 152          echo '<img src="img/famfamfam/action_forward.gif" alt="" border="0" /></a>';
 153      } else {
 154          echo '<img src="img/famfamfam/action_forward.gif" alt="" border="0" class="inactive" />';
 155      }
 156      echo '</td><td class="chatlist">&nbsp;|&nbsp;</td>';
 157  
 158  } else {
 159  
 160      echo '<td class="chatlist">|&nbsp;<input type="hidden" name="page" id="page" value="1" /></td>';
 161  
 162  }
 163  ?>    
 164  
 165      <td><input type="text" name="filter" id="filter" size="10" value="<?php 
 166      
 167      if(isset($_SESSION['filter_results']) && count($_SESSION['filter_results']) ) {
 168          echo html_specialchars(implode(' ', $_SESSION['filter_results']));
 169      }
 170      
 171      ?>" class="textinput" style="margin:0 2px 0 0;width:110px;text-align:left;" title="filter results by username, name or email" /></td>
 172      <td><input type="image" name="gofilter" src="img/famfamfam/action_go.gif" /></td>
 173              </table></td>
 174              <td class="chatlist" align="right">
 175                  <a href="phpwcms.php?do=admin&amp;c=10">10</a>
 176                  <a href="phpwcms.php?do=admin&amp;c=25">25</a>
 177                  <a href="phpwcms.php?do=admin&amp;c=50">50</a>
 178                  <a href="phpwcms.php?do=admin&amp;c=100">100</a>
 179                  <a href="phpwcms.php?do=admin&amp;c=250">250</a>
 180                  <a href="phpwcms.php?do=admin&amp;c=all"><?php echo $BL['be_ftptakeover_all'] ?></a>
 181              </td>
 182  
 183          </tr>
 184      </table>
 185      </form></td></tr>
 186          
 187          <tr><td colspan="3"><img src="img/leer.gif" alt="" width="1" height="3"></td></tr>
 188          
 189          <tr><td colspan="3" bgcolor="#92A1AF"><img src="img/leer.gif" alt="" width="1" height="1"></td></tr>
 190          <?php
 191      $bg_color1 = "#FFFFFF";
 192      $bg_color2 = "#F3F5F8";
 193      $zaehler = 0;
 194      if(!isset($new_user_id)) $new_user_id = 0;
 195      //Liste aller User erzeugen
 196      $sql  = "SELECT * FROM ".DB_PREPEND."phpwcms_user ".$_userInfo['where_query'].' ';
 197      $sql .= "ORDER BY usr_aktiv DESC, usr_fe DESC, usr_admin DESC, usr_name ASC ";
 198      $sql .= "LIMIT ".(($_SESSION['list_user_page']-1) * $_SESSION['list_user_count']).','.$_SESSION['list_user_count'];
 199      if($result = mysql_query($sql, $db)) {
 200          while($userlist = mysql_fetch_assoc($result)) {
 201              $bg_color = ($zaehler % 2) ? $bg_color2 : $bg_color1;
 202              if($userlist["usr_id"] == $new_user_id) {
 203                  $bg_color = "#FFCC00";
 204              }
 205              $goto = "phpwcms.php?do=admin&amp;s=2&amp;u=".$userlist["usr_id"];
 206  ?>
 207          <tr><td colspan="3"><img src="img/leer.gif" alt="" width="1" height="1"></td></tr>
 208          <tr bgcolor="<?php echo  $bg_color ?>" onmouseover="bgColor='#DBFF48'" onmouseout="bgColor='<?php echo  $bg_color ?>'">
 209            <td width="19" align="center"><img src="img/usricon/usr_<?php
 210          
 211          if($userlist["usr_aktiv"] == 1) { 
 212                if(!$userlist["usr_admin"]) {
 213                  switch($userlist["usr_fe"]) {
 214                      case 0:    echo '16'; break;
 215                      case 1: echo 'norm'; break;
 216                      case 2: echo 'befe'; break;
 217                  }
 218              } else {
 219                  echo "admin";
 220              }
 221          } else {
 222              echo "inaktiv";
 223          } 
 224            
 225            ?>.gif" alt="" width="19" height="16" border="0"></td>
 226            <td width="458" <?php if($userlist["usr_aktiv"]==1) {echo "class=\"dir\"";} else {echo "class=\"inaktiv\"";} ?>><a href="<?php echo $goto ?>"><?php 
 227            
 228      if($userlist["usr_name"]) {
 229          $userlist["usr_name"] = html_specialchars($userlist["usr_name"]." (".$userlist["usr_login"].")");
 230      } else {
 231          $userlist["usr_name"] = html_specialchars($userlist["usr_login"]);
 232      }
 233      echo $userlist["usr_name"];
 234            
 235            ?></a></td>
 236            <td width="61" align="right"><a href="include/inc_act/act_user.php?aktiv=<?php 
 237                echo $userlist["usr_id"].":";
 238              if($userlist["usr_aktiv"]) {
 239                  echo "0";
 240              } else {
 241                  echo "1";
 242              } 
 243              ?>"><img src="img/button/<?php 
 244              if(!$userlist["usr_aktiv"]) echo "in";
 245              ?>aktiv_mini.gif" alt="" width="14" height="15" border="0"></a><a href="<?php echo $goto ?>"><img src="img/button/edit.gif" alt="" width="24" height="15" border="0" title="<?php echo $BL['be_admin_usr_editusr'].": ".html_specialchars($userlist["usr_login"]) ?>"></a><a href="include/inc_act/act_user.php?del=<?php 
 246            echo urlencode($userlist["usr_id"].":".$userlist["usr_email"]);
 247            ?>" onclick="return confirm('Delete user <?php echo js_singlequote($userlist["usr_name"]) ?>');"><img src="img/button/del_message_final.gif" alt="" width="22" height="15" border="0" title="<?php echo $BL['be_admin_usr_ldel']." ".html_specialchars($userlist["usr_login"]) ?>"></a></td>
 248          </tr>
 249          <?php
 250                  $zaehler++;
 251              }
 252              mysql_free_result($result);
 253          } //Ende Schleife Anzeige User
 254          
 255          if($zaehler) {
 256              echo '<tr><td colspan="3"><img src="img/leer.gif" alt="" width="1" height="1"></td></tr>';
 257              echo '<tr><td colspan="3" bgcolor="#92A1AF"><img src="img/leer.gif" alt="" width="1" height="1"></td></tr>';
 258          }
 259          
 260          ?>
 261          <tr> 
 262            <td><img src="img/leer.gif" alt="" width="19" height="5"></td>
 263            <td><img src="img/leer.gif" alt="" width="458" height="1"></td>
 264            <td><img src="img/leer.gif" alt="" width="61" height="1"></td>
 265          </tr>
 266          <tr> 
 267            <td colspan="3"><table width="538" border="0" cellpadding="0" cellspacing="0" summary="">
 268                <tr>
 269                  <td><form action="phpwcms.php?do=admin&amp;s=1" method="post"><input type="submit" value="<?php echo $BL['be_admin_usr_create'] ?>" class="button10" title="<?php echo $BL['be_admin_usr_create'] ?>"></form></td>
 270                  <td>&nbsp;&nbsp;</td>
 271                  <td align="right"><img src="img/symbols/userlegende1.gif" alt="" width="225" height="13"></td>
 272                </tr>
 273              </table></td>
 274          </tr>
 275          <tr><td colspan="3"><img src="img/leer.gif" alt="" width="1" height="7"></td></tr>
 276  </table>


Generated: Wed Dec 30 05:55:15 2009 Cross-referenced by PHPXref 0.7