[ Index ]

PHP Cross Reference of phpwcms V1.4.7 _r403 (01.11.10)

title

Body

[close]

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

   1  <?php
   2  /*************************************************************************************
   3     Copyright notice
   4     
   5     (c) 2002-2010 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  if(isset($_GET["u"]) && intval($_GET["u"])) {
  32      if(empty($_POST["form_aktion"]) || $_POST["form_aktion"] != "edit_account") {
  33          $new_user_id = intval($_GET["u"]);
  34          $sql = "SELECT * FROM ".DB_PREPEND."phpwcms_user WHERE usr_id=".$new_user_id." AND usr_aktiv<>9;";
  35          if($result = mysql_query($sql, $db) or die("error")) {
  36              if($row = mysql_fetch_array($result)) {
  37                  $new_login = $row["usr_login"];
  38                  $new_email = $row["usr_email"];
  39                  $new_name = $row["usr_name"];
  40                  $set_user_aktiv = $row["usr_aktiv"];
  41                  $set_user_admin = $row["usr_admin"];
  42                  $set_user_fe    = $row["usr_fe"];
  43                  $send_verification = 0;            
  44                  $new_password = '';    
  45              }
  46          }
  47      }
  48      if(isset($_POST["form_aktion"]) && $_POST["form_aktion"] == "edit_account") {
  49          //Create Account Daten verarbeiten
  50          $new_user_id = intval($_POST["form_uid"]);
  51          $new_login = clean_slweg($_POST["form_newloginname"]);
  52          $new_password = clean_slweg($_POST["form_newpassword"]);
  53          $new_email = clean_slweg($_POST["form_newemail"]);
  54          $new_name = clean_slweg($_POST["form_newrealname"]);
  55          $set_user_aktiv = isset($_POST["form_active"]) ? 1 : 0;
  56          $set_user_admin = isset($_POST["form_admin"]) ? 1 : 0;
  57          $set_user_fe = isset($_POST["form_feuser"]) ? intval($_POST["form_feuser"]) : 0;
  58          if($set_user_admin) {
  59              $set_user_fe = 2;
  60          }
  61          $send_verification = isset($_POST["verification_email"]) ? 1 : 0;
  62          $user_err = '';
  63          if(isEmpty($new_login)) {
  64              $user_err = $BL['be_admin_usr_err2']."\n";
  65          } else {
  66              $sql = "SELECT usr_id, COUNT(*) AS anzahl FROM ".DB_PREPEND."phpwcms_user WHERE usr_login='".aporeplace($new_login)."' GROUP BY usr_id;";
  67              if($result = mysql_query($sql, $db)) {
  68                  if($check_anzahl = mysql_fetch_array($result)) {
  69                      if($check_anzahl["usr_id"] != $new_user_id && $check_anzahl["anzahl"]) $user_err .= $BL['be_admin_usr_err1']."\n";
  70                  }
  71              }
  72          }
  73          if(!is_valid_email($new_email)) $user_err .= $BL['be_admin_usr_err4']."\n";
  74          if(empty($user_err)) { //Insert new User
  75              $upd_password = ($new_password) ? "usr_pass='".aporeplace(md5($new_password))."', " : "";
  76              //$upd_password = ($new_password) ? "usr_pass=PASSWORD('".aporeplace($new_password)."'), " : "";
  77              $sql =    "UPDATE ".DB_PREPEND."phpwcms_user SET ".
  78                      "usr_login='".aporeplace($new_login)."', ".$upd_password.
  79                      "usr_email='".aporeplace($new_email)."', ".
  80                      "usr_admin='".$set_user_admin."', ".
  81                      "usr_aktiv='".$set_user_aktiv."', ".
  82                      "usr_name='".aporeplace($new_name)."', ".
  83                      "usr_wysiwyg='".$GLOBALS['phpwcms']['wysiwyg_editor']."', ".
  84                      "usr_fe='".$set_user_fe."' ".
  85                      "WHERE usr_id=".$new_user_id.";";                                
  86              if($result = mysql_query($sql, $db) or die("error")) {
  87                  $user_ok = 1;
  88                  $new_user_id = NULL;
  89                  if($send_verification) {
  90                      $emailbody = str_replace('{LOGIN}',            $new_login, $BL['be_admin_usr_emailbody']);
  91                      $emailbody = str_replace('{PASSWORD}',        (($new_password) ? $new_password : $BL['be_admin_usr_passnochange']), $emailbody);
  92                      $emailbody = str_replace('{SITE}',            PHPWCMS_URL, $emailbody);
  93                      $emailbody = str_replace('{LOGIN_PAGE}',    PHPWCMS_URL.get_login_file(), $emailbody);
  94  
  95                      sendEmail(    array(
  96                          'recipient'    => $new_email,
  97                          'toName'    => $new_name,
  98                          'subject'    => $BL['be_admin_usr_mailsubject'],
  99                          'isHTML'    => 0,
 100                          'text'        => $emailbody,
 101                          'from'        => $phpwcms["admin_email"],
 102                          'sender'    => $phpwcms["admin_email"]
 103                          ));
 104                  }
 105              }                    
 106          }                
 107      }
 108              
 109      if(empty($user_ok)) {
 110          
 111  ?><form action="phpwcms.php?do=admin&amp;s=2&amp;u=<?php echo $new_user_id ?>" method="post" name="edituser"><table border="0" cellpadding="0" cellspacing="0" summary="">
 112          
 113            <tr><td colspan="2" class="title"><?php echo $BL['be_admin_usr_etitle'] ?></td></tr>
 114            <tr> 
 115              <td><img src="img/leer.gif" alt="" width="105" height="1"></td>
 116              <td><img src="img/leer.gif" alt="" width="1" height="7"></td>
 117            </tr>
 118            <?php
 119            if(!empty($user_err)) {
 120            ?>
 121            <tr valign="top">
 122              <td align="right"><strong style="color:#FF3300"><?php echo $BL['be_admin_usr_err'] ?>:</strong>&nbsp;</td>
 123              <td><strong style="color:#FF3300"><?php echo nl2br(chop($user_err)) ?></strong></td>
 124            </tr>
 125            <tr valign="top"><td colspan="2" align="right" class="chatlist"><img src="img/leer.gif" alt="" width="1" height="7"></td></tr>
 126            <?php
 127            } //Ende Fehler New User
 128            ?>
 129            <tr> 
 130              <td align="right" class="chatlist"><?php echo $BL["login_username"]  ?>:&nbsp;</td>
 131              <td><input name="form_newloginname" type="text" id="form_newloginname" style="font-family: Verdana, Arial, Helvetica, sans-serif; width:250px; font-size: 11px; font-weight: bold;" value="<?php echo $new_login ?>" size="30" maxlength="30"></td>
 132            </tr>
 133            <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="1"></td></tr>
 134            <tr> 
 135              <td align="right" class="chatlist"><?php echo $BL["login_userpass"] ?>:&nbsp;</td>
 136              <td><input name="form_newpassword" type="text" id="form_newpassword" style="font-family: Verdana, Arial, Helvetica, sans-serif; width:250px; font-size: 11px; font-weight: bold;" value="<?php echo $new_password ?>" size="30" maxlength="20"></td>
 137            </tr>
 138            <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="1"></td></tr>
 139            <tr> 
 140              <td align="right" class="chatlist"><?php echo $BL['be_profile_label_email'] ?>:&nbsp;</td>
 141              <td><input name="form_newemail" type="text" id="form_newemail" style="font-family: Verdana, Arial, Helvetica, sans-serif; width:250px; font-size: 11px; font-weight: bold;" value="<?php echo $new_email ?>" size="30" maxlength="150"></td>
 142            </tr>
 143            <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="1"></td></tr>
 144            <tr> 
 145              <td align="right" class="chatlist"><?php echo $BL['be_admin_usr_realname'] ?>:&nbsp;</td>
 146              <td><input name="form_newrealname" type="text" id="form_newrealname" style="font-family: Verdana, Arial, Helvetica, sans-serif; width:250px; font-size: 11px; font-weight: bold;" value="<?php echo $new_name ?>" size="30" maxlength="80"></td>
 147            </tr>
 148  
 149            <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="6"></td></tr>
 150            <tr> 
 151              <td align="right" class="chatlist"><?php echo $BL['be_admin_usr_issection']  ?>:&nbsp;</td>
 152              <td><table border="0" cellpadding="0" cellspacing="0" bgcolor="#E7E8EB" summary="">
 153                  <tr> 
 154                    <td><input name="form_feuser" type="radio" id="form_feuser0" value="0"<?php is_checked($set_user_fe, 0); ?>></td>
 155                    <td><label for="form_feuser0"><?php echo $BL['be_admin_usr_ifsection0'] ?></label>&nbsp;&nbsp;</td>
 156                    <td><input name="form_feuser" type="radio" id="form_feuser1" value="1"<?php is_checked($set_user_fe, 1); ?>></td>
 157                    <td><label for="form_feuser1"><?php echo $BL['be_admin_usr_ifsection1'] ?></label>&nbsp;&nbsp;</td>
 158                    <td><input name="form_feuser" type="radio" id="form_feuser2" value="2"<?php is_checked($set_user_fe, 2); ?>></td>
 159                    <td><label for="form_feuser2"><?php echo $BL['be_admin_usr_ifsection2'] ?></label></td>
 160                    <td><img src="img/leer.gif" alt="" width="4" height="21"></td>
 161                  </tr>
 162                </table></td>
 163            </tr>    
 164  
 165            <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="6"></td></tr>
 166            <tr> 
 167              <td align="right" class="chatlist"><?php echo $BL['be_admin_usr_setactive'] ?>:&nbsp;</td>
 168              <td><table border="0" cellpadding="0" cellspacing="0" summary="">
 169                  <tr> 
 170                    <td><input name="form_active" type="checkbox" id="form_active" value="1"<?php is_checked($set_user_aktiv, 1); ?>></td>
 171                    <td><label for="form_active"><?php echo $BL['be_admin_usr_iflogin'] ?></label></td>
 172                  </tr>
 173                </table></td>
 174            </tr>
 175    
 176            <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="1"></td></tr>
 177            <tr> 
 178              <td align="right" class="chatlist" style="color:#FF0000"><?php echo $BL['be_admin_usr_isadmin'] ?>:&nbsp;</td>
 179              <td><table border="0" cellpadding="0" cellspacing="0" summary="">
 180                  <tr> 
 181                    <td><input name="form_admin" type="checkbox" id="form_admin" value="1"<?php is_checked(1, $set_user_admin); ?>></td>
 182                    <td><label for="form_admin"><?php echo $BL['be_admin_usr_ifadmin'] ?> <strong style="color:#FF0000">!!!</strong></label></td>
 183                  </tr>
 184                </table></td>
 185            </tr>
 186            <tr> 
 187              <td align="right" class="chatlist"><?php echo $BL['be_admin_usr_verify'] ?>:&nbsp;</td>
 188              <td><table border="0" cellpadding="0" cellspacing="0" summary="">
 189                  <tr><td colspan="3"><img src="img/leer.gif" alt="" width="1" height="6"></td></tr>
 190                  <tr bgcolor="#E7E8EB"> 
 191                    <td><input name="verification_email" type="checkbox" id="verification_email" value="1"<?php is_checked(1, $send_verification); ?>></td>
 192                    <td><label for="verification_email"><?php echo $BL['be_admin_usr_sendemail'] ?></label></td>
 193                    <td><img src="img/leer.gif" alt="" width="4" height="21"></td>
 194                  </tr>
 195                  <tr><td colspan="3"><img src="img/leer.gif" alt="" width="1" height="6"></td></tr>
 196                </table></td>
 197            </tr>
 198            <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="6"><input name="form_aktion" type="hidden" value="edit_account"><input name="form_uid" type="hidden" value="<?php echo $new_user_id ?>"></td></tr>
 199            <tr> 
 200              <td>&nbsp;</td>
 201              <td><input name="Submit" type="submit" class="button10" value="<?php echo $BL['be_admin_usr_ebutton'] ?>"></td>
 202            </tr>
 203            <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="15"></td></tr>
 204         
 205        </table></form><img src="img/lines/l538_70.gif" alt="" width="538" height="1"><br /><img src="img/leer.gif" alt="" width="1" height="5"><?php
 206       } else {
 207          echo "<script language=\"JavaScript\" type=\"text/JavaScript\">\n<!--\n";
 208          echo "timer=setTimeout(\"self.location.href='phpwcms.php?do=admin'\", 0);\n";
 209          echo "//-->\n</script>\n";
 210      }
 211  }    
 212  //Dialog New User bis hierher
 213  ?>


Generated: Tue Nov 16 22:51:00 2010 Cross-referenced by PHPXref 0.7