plugins/admin/UserManager.php
changeset 631 f4f4146d8b6c
parent 630 3a8ed301be66
child 660 2f4d90b67735
equal deleted inserted replaced
630:3a8ed301be66 631:f4f4146d8b6c
   119       $homepage = htmlspecialchars($_POST['homepage']);
   119       $homepage = htmlspecialchars($_POST['homepage']);
   120       $location = htmlspecialchars($_POST['location']);
   120       $location = htmlspecialchars($_POST['location']);
   121       $occupation = htmlspecialchars($_POST['occupation']);
   121       $occupation = htmlspecialchars($_POST['occupation']);
   122       $hobbies = htmlspecialchars($_POST['hobbies']);
   122       $hobbies = htmlspecialchars($_POST['hobbies']);
   123       $email_public = ( isset($_POST['email_public']) ) ? '1' : '0';
   123       $email_public = ( isset($_POST['email_public']) ) ? '1' : '0';
       
   124       $user_title = htmlspecialchars($_POST['user_title']);
   124       
   125       
   125       if ( !preg_match('/@([a-z0-9-]+)(\.([a-z0-9-\.]+))?/', $imaddr_msn) && !empty($imaddr_msn) )
   126       if ( !preg_match('/@([a-z0-9-]+)(\.([a-z0-9-\.]+))?/', $imaddr_msn) && !empty($imaddr_msn) )
   126       {
   127       {
   127         $imaddr_msn = "$imaddr_msn@hotmail.com";
   128         $imaddr_msn = "$imaddr_msn@hotmail.com";
   128       }
   129       }
   167           $to_update_users['real_name'] = $real_name;
   168           $to_update_users['real_name'] = $real_name;
   168         }
   169         }
   169         $to_update_users['signature'] = $signature;
   170         $to_update_users['signature'] = $signature;
   170         $to_update_users['user_level'] = $user_level;
   171         $to_update_users['user_level'] = $user_level;
   171         $to_update_users['user_rank'] = $user_rank;
   172         $to_update_users['user_rank'] = $user_rank;
       
   173         $to_update_users['user_title'] = $user_title;
   172         
   174         
   173         if ( isset($_POST['account_active']) )
   175         if ( isset($_POST['account_active']) )
   174         {
   176         {
   175           $to_update_users['account_active'] = "1";
   177           $to_update_users['account_active'] = "1";
   176         }
   178         }
   438       $form->email = $email;
   440       $form->email = $email;
   439       $form->real_name = $real_name;
   441       $form->real_name = $real_name;
   440       $form->signature = $signature;
   442       $form->signature = $signature;
   441       $form->user_level = $user_level;
   443       $form->user_level = $user_level;
   442       $form->user_rank = $user_rank;
   444       $form->user_rank = $user_rank;
       
   445       $form->user_title = $user_title;
   443       $form->im = array(
   446       $form->im = array(
   444           'aim' => $imaddr_aim,
   447           'aim' => $imaddr_aim,
   445           'yahoo' => $imaddr_yahoo,
   448           'yahoo' => $imaddr_yahoo,
   446           'msn' => $imaddr_msn,
   449           'msn' => $imaddr_msn,
   447           'xmpp' => $imaddr_xmpp
   450           'xmpp' => $imaddr_xmpp
   479     else
   482     else
   480     {
   483     {
   481       echo 'No username provided';
   484       echo 'No username provided';
   482       return false;
   485       return false;
   483     }
   486     }
   484     $q = $db->sql_query('SELECT u.user_id AS authoritative_uid, u.username, u.email, u.real_name, u.signature, u.account_active, u.user_level, u.user_rank, u.user_has_avatar, u.avatar_type, u.user_registration_ip, x.* FROM '.table_prefix.'users AS u
   487     $q = $db->sql_query('SELECT u.user_id AS authoritative_uid, u.username, u.email, u.real_name, u.signature, u.account_active, u.user_level, u.user_rank, u.user_title, u.user_has_avatar, u.avatar_type, u.user_registration_ip, x.* FROM '.table_prefix.'users AS u
   485                            LEFT JOIN '.table_prefix.'users_extra AS x
   488                            LEFT JOIN '.table_prefix.'users_extra AS x
   486                              ON ( u.user_id = x.user_id OR x.user_id IS NULL )
   489                              ON ( u.user_id = x.user_id OR x.user_id IS NULL )
   487                            WHERE ( ' . ENANO_SQLFUNC_LOWERCASE . '(u.username) = \'' . $db->escape(strtolower($username)) . '\' OR u.username = \'' . $db->escape($username) . '\' ) AND u.user_id != 1;');
   490                            WHERE ( ' . ENANO_SQLFUNC_LOWERCASE . '(u.username) = \'' . $db->escape(strtolower($username)) . '\' OR u.username = \'' . $db->escape($username) . '\' ) AND u.user_id != 1;');
   488     if ( !$q )
   491     if ( !$q )
   489       $db->_die();
   492       $db->_die();
   502       $form->email     = $row['email'];
   505       $form->email     = $row['email'];
   503       $form->real_name = $row['real_name'];
   506       $form->real_name = $row['real_name'];
   504       $form->signature = $row['signature'];
   507       $form->signature = $row['signature'];
   505       $form->user_level= $row['user_level'];
   508       $form->user_level= $row['user_level'];
   506       $form->user_rank = $row['user_rank'];
   509       $form->user_rank = $row['user_rank'];
       
   510       $form->user_title= $row['user_title'];
   507       $form->account_active = ( $row['account_active'] == 1 );
   511       $form->account_active = ( $row['account_active'] == 1 );
   508       $form->email_public   = ( $row['email_public'] == 1 );
   512       $form->email_public   = ( $row['email_public'] == 1 );
   509       $form->has_avatar     = ( $row['user_has_avatar'] == 1 );
   513       $form->has_avatar     = ( $row['user_has_avatar'] == 1 );
   510       $form->avi_type       = $row['avatar_type'];
   514       $form->avi_type       = $row['avatar_type'];
   511       $form->im = array(
   515       $form->im = array(
   773    * User-specific user rank
   777    * User-specific user rank
   774    * @var int
   778    * @var int
   775    */
   779    */
   776   
   780   
   777   var $user_rank = NULL;
   781   var $user_rank = NULL;
       
   782   
       
   783   /**
       
   784    * User's custom title
       
   785    * @var int
       
   786    */
       
   787   
       
   788   var $user_title = '';
   778   
   789   
   779   /**
   790   /**
   780    * Account activated
   791    * Account activated
   781    * @var bool
   792    * @var bool
   782    */
   793    */
   998                   <td class="row1" style="width: 75%;">
  1009                   <td class="row1" style="width: 75%;">
   999                     {SIGNATURE_FIELD}
  1010                     {SIGNATURE_FIELD}
  1000                   </td>
  1011                   </td>
  1001                 </tr>
  1012                 </tr>
  1002                 
  1013                 
       
  1014                 <tr>
       
  1015                   <td class="row2" style="width: 25%;">
       
  1016                     {lang:acpum_field_usertitle}<br />
       
  1017                     <small>
       
  1018                       {lang:acpum_field_usertitle_hint}
       
  1019                     </small>
       
  1020                   </td>
       
  1021                   <td class="row1" style="width: 75%;">
       
  1022                     <input type="text" name="user_title" value="{USER_TITLE}" />
       
  1023                   </td>
       
  1024                 </tr>
       
  1025                 
       
  1026                 
       
  1027                 
  1003               <!-- / Basic options -->
  1028               <!-- / Basic options -->
  1004               
  1029               
  1005               <!-- Extended options (anything in enano_users_extra) -->
  1030               <!-- Extended options (anything in enano_users_extra) -->
  1006               
  1031               
  1007                 <tr>
  1032                 <tr>
  1299         'PUBLIC_KEY' => $session->rijndael_genkey(),
  1324         'PUBLIC_KEY' => $session->rijndael_genkey(),
  1300         'DH_SUPPORTED' => ( $dh_supported ? 'true' : 'false' ),
  1325         'DH_SUPPORTED' => ( $dh_supported ? 'true' : 'false' ),
  1301         'DH_PUBLIC' => $dh_key_pub,
  1326         'DH_PUBLIC' => $dh_key_pub,
  1302         'REAL_NAME' => $this->real_name,
  1327         'REAL_NAME' => $this->real_name,
  1303         'SIGNATURE_FIELD' => $template->tinymce_textarea('signature', $this->signature, 10, 50),
  1328         'SIGNATURE_FIELD' => $template->tinymce_textarea('signature', $this->signature, 10, 50),
       
  1329         'USER_TITLE' => $this->user_title,
  1304         'USER_LEVEL_MEMBER' => USER_LEVEL_CHPREF,
  1330         'USER_LEVEL_MEMBER' => USER_LEVEL_CHPREF,
  1305         'USER_LEVEL_MOD' => USER_LEVEL_MOD,
  1331         'USER_LEVEL_MOD' => USER_LEVEL_MOD,
  1306         'USER_LEVEL_ADMIN' => USER_LEVEL_ADMIN,
  1332         'USER_LEVEL_ADMIN' => USER_LEVEL_ADMIN,
  1307         'AES_JAVASCRIPT' => $aes_javascript,
  1333         'AES_JAVASCRIPT' => $aes_javascript,
  1308         'IM_AIM' => $im_aim,
  1334         'IM_AIM' => $im_aim,