[ Index ]

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

title

Body

[close]

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


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