[ Index ]
 

Code source de e107 0.7.8

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/e107_admin/ -> administrator.php (source)

   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/administrator.php,v $
  14  |     $Revision: 1.33 $
  15  |     $Date: 2006/11/10 15:59:14 $
  16  |     $Author: mcfly_e107 $
  17  +----------------------------------------------------------------------------+
  18  */
  19  require_once ('../class2.php');
  20  if (!getperms('3'))
  21  {
  22      header('location:'.e_BASE.'index.php');
  23      exit;
  24  }
  25  $e_sub_cat = 'admin';
  26  require_once ('auth.php');
  27  
  28  if (e_QUERY)
  29  {
  30      $tmp = explode(".", e_QUERY);
  31      $action = $tmp[0];
  32      $sub_action = $tmp[1];
  33      unset($tmp);
  34  }
  35  
  36  if (isset($_POST['update_admin']))
  37  {
  38      $sql->db_Select("user", "*", "user_id='".$_POST['a_id']."' ");
  39      $row = $sql->db_Fetch();
  40      $a_name = $row['user_name'];
  41  
  42      $perm = "";
  43  
  44      foreach($_POST['perms'] as $value)
  45      {
  46        if ($value == "0")
  47        {
  48          if (!getperms('0')) { $value = ""; break; }
  49  
  50          $perm = "0."; break;
  51        }
  52  
  53        if ($value)
  54        {
  55          $perm .= $value.".";
  56        }
  57      }
  58  
  59      admin_update($sql -> db_Update("user", "user_perms='$perm' WHERE user_name='$a_name' "), 'update', ADMSLAN_56." ".$_POST['ad_name']." ".ADMSLAN_2."<br />");
  60      unset($ad_name, $a_perms);
  61  }
  62  
  63  if ($_POST['edit_admin'] || $action == "edit")
  64  {
  65      $edid = array_keys($_POST['edit_admin']);
  66      $theid = ($edid[0]) ? $edid[0] : $sub_action;
  67      $sql->db_Select("user", "*", "user_id=".$theid);
  68      $row = $sql->db_Fetch();
  69  
  70      if ($a_perms == "0")
  71      {
  72          $text = "<div style='text-align:center'>$ad_name ".ADMSLAN_3."
  73          <br /><br />
  74          <a href='administrator.php'>".ADMSLAN_4."</a></div>";
  75          $ns->tablerender(LAN_ERROR, $text);
  76          require_once ("footer.php");
  77          exit;
  78      }
  79  }
  80  
  81  if (isset($_POST['del_admin']))
  82  {
  83      $delid = array_keys($_POST['del_admin']);
  84      $sql->db_Select("user", "*", "user_id= ".$delid[0]);
  85      $row = $sql->db_Fetch();
  86  
  87      if ($row['user_id'] == 1)
  88      {
  89          $text = "<div style='text-align:center'>".$row['user_name']." ".ADMSLAN_6."
  90          <br /><br />
  91          <a href='administrator.php'>".ADMSLAN_4."</a>";
  92          $ns->tablerender(ADMSLAN_5, $text);
  93          require_once ("footer.php");
  94          exit;
  95      }
  96  
  97      admin_update($sql -> db_Update("user", "user_admin=0, user_perms='' WHERE user_id= ".$delid[0]), 'update', ADMSLAN_61, LAN_DELETED_FAILED);
  98  }
  99  
 100  if($_POST['edit_admin'] || $action == "edit"){
 101      edit_administrator($row);
 102  }else{
 103     show_admins();
 104  }
 105  
 106  function show_admins(){
 107      global $sql,$tp,$ns,$pref;
 108  
 109      $sql->db_Select("user", "*", "user_admin='1'");
 110  
 111      $text = "<div style='text-align:center'><div style='padding: 1px; ".ADMIN_WIDTH."; margin-left: auto; margin-right: auto;'>
 112      <form action='".e_SELF."' method='post' id='del_administrator'>
 113      <div>
 114      <input type='hidden' name='del_administrator_confirm' id='del_administrator_confirm' value='1' />
 115      <table class='fborder' style='width:99%'>
 116      <tr>
 117      <td style='width:5%' class='fcaption'>ID</td>
 118      <td style='width:20%' class='fcaption'>".ADMSLAN_56."</td>
 119      <td style='width:65%' class='fcaption'>".ADMSLAN_18."</td>
 120      <td style='width:10%' class='fcaption'>".LAN_OPTIONS."</td>
 121      </tr>";
 122  
 123      while ($row = $sql->db_Fetch())
 124      {
 125  
 126          $text .= "<tr>
 127          <td style='width:5%' class='forumheader3'>".$row['user_id']."</td>
 128          <td style='width:20%' class='forumheader3'><a href='".e_BASE."user.php?id.".$row['user_id']."'>".$row['user_name']."</a></td>
 129          <td style='width:65%' class='forumheader3'>";
 130  
 131          $permtxt = "";
 132          $text .= renderperms($row['user_perms'],$row['user_id'],"words");
 133             $text .= "</td>
 134  
 135          <td style='width:10%; text-align:center' class='forumheader3'>";
 136          if($row['user_id'] != "1")
 137          {
 138              $text .= "
 139              <input type='image' name='edit_admin[{$row['user_id']}]' value='edit' src='".e_IMAGE."admin_images/edit_16.png' title='".LAN_EDIT."' />
 140              <input type='image' name='del_admin[{$row['user_id']}]' value='del' src='".e_IMAGE."admin_images/delete_16.png' onclick=\"return jsconfirm('".$tp->toJS(ADMSLAN_59."? [".$row['user_name']."]")."') \"  title='".ADMSLAN_59."' style='border:0px' />";
 141          }
 142          $text .= "&nbsp;</td>
 143  
 144          </tr>";
 145      }
 146  
 147      $text .= "</table></div>\n</form></div>\n</div>";
 148  
 149      $ns->tablerender(ADMSLAN_13, $text);
 150  
 151  }
 152  
 153  
 154  
 155  
 156  function edit_administrator($row){
 157      global $sql,$tp,$ns,$pref;
 158      $lanlist = explode(",",e_LANLIST);
 159  
 160      $a_id = $row['user_id'];
 161      $ad_name = $row['user_name'];
 162      $a_perms = $row['user_perms'];
 163  
 164      $text = "<div style='text-align:center'>
 165      <form method='post' action='".e_SELF."' id='myform' >
 166      <table style='".ADMIN_WIDTH."' class='fborder'>
 167      <tr>
 168      <td style='width:25%' class='forumheader3'>".ADMSLAN_16.": </td>
 169      <td style='width:75%' class='forumheader3'>
 170      ";
 171  
 172      $text .= $ad_name;
 173      $text .= "<input type='hidden' name='ad_name' size='60' value='$ad_name' />";
 174  
 175      $text .= "
 176      </td>
 177      </tr>";
 178  
 179      $text .="
 180      <tr>
 181      <td style='width:25%;vertical-align:top' class='forumheader3'>".ADMSLAN_18.": <br /></td>
 182      <td style='width:75%' class='forumheader3'>";
 183  
 184      $text .= checkb("1", $a_perms).ADMSLAN_19."<br />";            // Alter site preferences
 185      $text .= checkb("2", $a_perms).ADMSLAN_20."<br />";            // Alter Menus
 186      $text .= checkb("3", $a_perms).ADMSLAN_21."<br />";            // Modify administrator permissions
 187      $text .= checkb("4", $a_perms).ADMSLAN_22."<br />";            // Moderate users/bans etc
 188      $text .= checkb("5", $a_perms).ADMSLAN_23."<br />";            // create/edit custom pages/menus
 189      $text .= checkb("Q", $a_perms).ADMSLAN_24."<br />";            // Manage download categories
 190      $text .= checkb("6", $a_perms).ADMSLAN_25."<br />";            // Upload /manage files
 191      $text .= checkb("Y", $a_perms).ADMSLAN_67."<br />";            // file inspector
 192      $text .= checkb("O", $a_perms).ADMSLAN_68."<br />";            // notify
 193      $text .= checkb("7", $a_perms).ADMSLAN_26."<br />";            // Oversee news categories
 194      $text .= checkb("8", $a_perms).ADMSLAN_27."<br />";            // Oversee link categories
 195      $text .= checkb("C", $a_perms).ADMSLAN_64."<br />";            // Clear Cache - Previously moderate chatbox
 196      $text .= checkb("9", $a_perms).ADMSLAN_28."<br />";            // Take site down for maintenance
 197      $text .= checkb("W", $a_perms).ADMSLAN_65."<br /><br />";    // Configure mail settings and mailout
 198  
 199      $text .= checkb("D", $a_perms).ADMSLAN_29."<br />";            // Manage banners
 200      $text .= checkb("E", $a_perms).ADMSLAN_30."<br />";            // Configure news feed headlines
 201      $text .= checkb("F", $a_perms).ADMSLAN_31."<br />";            // Configure emoticons
 202      $text .= checkb("G", $a_perms).ADMSLAN_32."<br />";            // Configure front page content
 203      $text .= checkb("S", $a_perms).ADMSLAN_33."<br />";            // Configure log/stats
 204      $text .= checkb("T", $a_perms).ADMSLAN_34."<br />";            // Configure meta tags
 205      $text .= checkb("V", $a_perms).ADMSLAN_35."<br />";            // Configure public file uploads
 206      $text .= checkb("X", $a_perms).ADMSLAN_66."<br />";            // Configure Search
 207      $text .= checkb("A", $a_perms).ADMSLAN_36."<br />";            // Configure Image Settings (Previously Moderate forums - NOW PLUGIN)
 208      $text .= checkb("B", $a_perms).ADMSLAN_37."<br />";            // Moderate comments
 209      $text .= checkb("H", $a_perms).ADMSLAN_39."<br />";            // Post news
 210      $text .= checkb("I", $a_perms).ADMSLAN_40."<br />";            // Post links
 211  //    $text .= checkb("J", $a_perms).ADMSLAN_41."<br />";                    // Post articles   - NOW PLUGIN
 212  //    $text .= checkb("K", $a_perms).ADMSLAN_42."<br />";                    // Post reviews    - NOW PLUGIN
 213  //    $text .= checkb("L", $a_perms).ADMSLAN_43."<br />";                    // Post content pages - NOW PLUGIN
 214      $text .= checkb("R", $a_perms).ADMSLAN_44."<br />";            // Post downloads
 215      $text .= checkb("U", $a_perms).ADMSLAN_45."<br />";            // Post polls
 216      $text .= checkb("M", $a_perms).ADMSLAN_46."<br />";            // Welcome message
 217      $text .= checkb("N", $a_perms).ADMSLAN_47."<br /><br />";    // Moderate submitted news
 218  
 219      $text .= "<br /><div class='fcaption'>".ADLAN_CL_7."</div><br />";
 220      $text .= checkb("Z", $a_perms).ADMSLAN_62."<br /><br />";    // Plugin Manager
 221  
 222      $sql->db_Select("plugin", "*", "plugin_installflag='1'");
 223      while ($row = $sql->db_Fetch())
 224      {
 225          $text .= checkb("P".$row['plugin_id'], $a_perms).LAN_PLUGIN." - ".$row['plugin_name']."<br />";
 226      }
 227  
 228  // Language Rights.. --------------
 229      if($pref['multilanguage'])
 230      {
 231          sort($lanlist);
 232          $text .= "<br /><div class='fcaption'>".ADLAN_132."</div><br />\n";
 233          $text .= checkb($pref['sitelanguage'], $a_perms).$pref['sitelanguage']."<br />\n";
 234          foreach($lanlist as $langval)
 235          {
 236              $langname = $langval;
 237              $langval = ($langval == $pref['sitelanguage']) ? "" : $langval;
 238              if ($langval)
 239                 {
 240                  $text .= checkb($langval, $a_perms).$langval."<br />\n";
 241              }
 242          }
 243      }
 244      // -------------------------
 245  
 246      if (getperms('0'))
 247      {
 248          $text .= "<br /><br /><div class='fcaption'>".ADMSLAN_58."</div><br />";
 249          $text .= checkb("0", $a_perms).ADMSLAN_58."<br />";
 250      }
 251  
 252      $text .= "<br /><br />
 253      <a href='".e_SELF."?checkall=1' onclick=\"setCheckboxes('myform', true, 'perms[]'); return false;\">".ADMSLAN_49."</a> -
 254      <a href='".e_SELF."' onclick=\"setCheckboxes('myform', false, 'perms[]'); return false;\">".ADMSLAN_51."</a><br />
 255      <br />
 256      </td>
 257      </tr>";
 258  
 259      $text .= "<tr style='vertical-align:top'>
 260      <td colspan='2' style='text-align:center' class='forumheader'>";
 261  
 262      $text .= "<input class='button' type='submit' name='update_admin' value='".ADMSLAN_52."' />
 263      <input type='hidden' name='a_id' value='$a_id' />";
 264  
 265      $text .= "</td>
 266      </tr>
 267      </table>
 268      </form>
 269      </div>";
 270  
 271      $text .= "<div style='text-align:center'><br /><a href='".e_SELF."'>".ADMSLAN_70."</a></div>";
 272      $ns->tablerender(ADMSLAN_52, $text);
 273  }
 274  
 275  
 276  
 277  require_once ("footer.php");
 278  
 279  
 280  
 281  
 282  
 283  
 284  function checkb($arg, $perms)
 285  {
 286      if (getperms($arg, $perms))
 287      {
 288          $par = "<input type='checkbox' name='perms[]' value='$arg' checked='checked' />\n";
 289      }
 290      else
 291      {
 292          $par = "<input type='checkbox' name='perms[]' value='$arg' />\n";
 293      }
 294      return $par;
 295  }
 296  
 297  
 298  function renderperms($perm,$id){
 299      global $pref,$sql,$pt;
 300      if($perm == "0"){
 301             return ADMSLAN_58;
 302      }
 303      $sql2 = new db;
 304      $lanlist = explode(",",e_LANLIST);
 305  
 306  
 307      if(!$pt){
 308          $pt["1"] = ADMSLAN_19;
 309          $pt["2"] = ADMSLAN_20;
 310          $pt["3"] = ADMSLAN_21;
 311          $pt["4"] = ADMSLAN_22;    // Moderate users/bans etc
 312          $pt["5"] = ADMSLAN_23;    // create/edit custom pages/menus
 313          $pt["Q"] = ADMSLAN_24;    // Manage download categories
 314          $pt["6"] = ADMSLAN_25;    // Upload /manage files
 315          $pt["Y"] = ADMSLAN_67;    // file inspector
 316          $pt["O"] = ADMSLAN_68;    // notify
 317          $pt["7"] = ADMSLAN_26;
 318          $pt["8"] = ADMSLAN_27;
 319          $pt["C"] = ADMSLAN_64;
 320          $pt["9"] = ADMSLAN_28;
 321          $pt["W"] = ADMSLAN_65;
 322          $pt["D"] = ADMSLAN_29;
 323          $pt["E"] = ADMSLAN_30;
 324          $pt["F"] = ADMSLAN_31;
 325          $pt["G"] = ADMSLAN_32;
 326          $pt["S"] = ADMSLAN_33;
 327          $pt["T"] = ADMSLAN_34;
 328          $pt["V"] = ADMSLAN_35;
 329          $pt["X"] = ADMSLAN_66;
 330          $pt["A"] = ADMSLAN_36;    // Configure Image Settings
 331          $pt["B"] = ADMSLAN_37;
 332          $pt["H"] = ADMSLAN_39;
 333          $pt["I"] = ADMSLAN_40;
 334          $pt["L"] = ADMSLAN_43;
 335          $pt["R"] = ADMSLAN_44;
 336          $pt["U"] = ADMSLAN_45;
 337          $pt["M"] = ADMSLAN_46;
 338          $pt["N"] = ADMSLAN_47;
 339          $pt["Z"] = ADMSLAN_62;
 340          
 341  
 342    //        foreach($lanlist as $lan){
 343    //          $pt[$lan] = $lan;
 344    //        }
 345  
 346          $sql2->db_Select("plugin", "*", "plugin_installflag='1'");
 347          while ($row2 = $sql2->db_Fetch()){
 348              $pt[("P".$row2['plugin_id'])] = LAN_PLUGIN." - ".$row2['plugin_name'];
 349          }
 350      }
 351  
 352      $tmp = explode(".", $perm);
 353          $langperm = "";
 354          foreach($tmp as $pms){
 355              if(in_array($pms, $lanlist)){
 356                  $langperm .= $pms."&nbsp;";
 357              }else{
 358                  $permtxt[] = $pms;
 359                  if($pt[$pms]){
 360                         $ptext[] = $pt[$pms];
 361                  }
 362              }
 363          }
 364  
 365      $ret = implode(" ",$permtxt);
 366      if($pref['multilanguage']){
 367          $ret .= ",&nbsp;". $langperm;
 368      }
 369  
 370      $text = "<div onclick=\"expandit('id_$id')\" style='cursor:pointer' title='".ADMSLAN_71."'>$ret</div>
 371      <div id='id_$id' style='display:none'><br />".implode("<br />",$ptext)."</div>";
 372      return $text;
 373  
 374  
 375  }
 376  
 377  ?>


Généré le : Sun Apr 1 01:23:32 2007 par Balluche grâce à PHPXref 0.7