plugins/SpecialUserPrefs.php
changeset 541 acb7e23b6ffa
parent 536 218a627eb53e
child 555 ac4c6a7f01d8
equal deleted inserted replaced
540:1e4b759da336 541:acb7e23b6ffa
   540         $session->user_extra['user_location'] = $location;
   540         $session->user_extra['user_location'] = $location;
   541         $session->user_extra['user_job'] = $occupation;
   541         $session->user_extra['user_job'] = $occupation;
   542         $session->user_extra['user_hobbies'] = $hobbies;
   542         $session->user_extra['user_hobbies'] = $hobbies;
   543         $session->user_extra['email_public'] = intval($email_public);
   543         $session->user_extra['email_public'] = intval($email_public);
   544         
   544         
   545         $q = $db->sql_query('UPDATE '.table_prefix."users SET real_name='$real_name', user_timezone = $tz_local WHERE user_id=$session->user_id;");
   545         // user title
       
   546         $user_title_col = '';
       
   547         if ( $session->get_permissions('custom_user_title') && isset($_POST['user_title']) )
       
   548         {
       
   549           $user_title = trim($_POST['user_title']);
       
   550           if ( empty($user_title) )
       
   551           {
       
   552             $colval = 'NULL';
       
   553             $session->user_title = null;
       
   554           }
       
   555           else
       
   556           {
       
   557             $colval = "'" . $db->escape($user_title) . "'";
       
   558             $session->user_title = $user_title;
       
   559           }
       
   560           $user_title_col = ", user_title = $colval";
       
   561         }
       
   562         
       
   563         $q = $db->sql_query('UPDATE '.table_prefix."users SET real_name='$real_name', user_timezone = $tz_local{$user_title_col} WHERE user_id=$session->user_id;");
   546         if ( !$q )
   564         if ( !$q )
   547           $db->_die();
   565           $db->_die();
   548         
   566         
   549         $q = $db->sql_query('UPDATE '.table_prefix."users_extra SET user_aim='$imaddr_aim',user_yahoo='$imaddr_yahoo',user_msn='$imaddr_msn',
   567         $q = $db->sql_query('UPDATE '.table_prefix."users_extra SET user_aim='$imaddr_aim',user_yahoo='$imaddr_yahoo',user_msn='$imaddr_msn',
   550                                user_xmpp='$imaddr_xmpp',user_homepage='$homepage',user_location='$location',user_job='$occupation',
   568                                user_xmpp='$imaddr_xmpp',user_homepage='$homepage',user_location='$location',user_job='$occupation',
   578         else
   596         else
   579         {
   597         {
   580           $db->free_result();
   598           $db->free_result();
   581         }
   599         }
   582         
   600         
       
   601         generate_ranks_cache();
       
   602         
   583         echo '<div class="info-box" style="margin: 0 0 10px 0;">' . $lang->get('usercp_publicinfo_msg_save_success') . '</div>';
   603         echo '<div class="info-box" style="margin: 0 0 10px 0;">' . $lang->get('usercp_publicinfo_msg_save_success') . '</div>';
   584       }
   604       }
   585       
   605       
   586       $lang_box = '<select name="lang_id">';
   606       $lang_box = '<select name="lang_id">';
   587       $q = $db->sql_query('SELECT lang_id, lang_name_native FROM ' . table_prefix . "language;");
   607       $q = $db->sql_query('SELECT lang_id, lang_name_native FROM ' . table_prefix . "language;");
   642           </tr>
   662           </tr>
   643           <tr>
   663           <tr>
   644             <td class="row2"><?php echo $lang->get('usercp_publicinfo_field_timezone'); ?><br /><small><?php echo $lang->get('usercp_publicinfo_field_timezone_hint'); ?></small></td>
   664             <td class="row2"><?php echo $lang->get('usercp_publicinfo_field_timezone'); ?><br /><small><?php echo $lang->get('usercp_publicinfo_field_timezone_hint'); ?></small></td>
   645             <td class="row1"><?php echo $tz_select; ?></td>
   665             <td class="row1"><?php echo $tz_select; ?></td>
   646           </tr>
   666           </tr>
       
   667           <?php
       
   668           if ( $session->get_permissions('custom_user_title') ):
       
   669           ?>
       
   670             <tr>
       
   671               <td class="row2">
       
   672                 <?php echo $lang->get('usercp_publicinfo_field_usertitle_title'); ?><br />
       
   673                 <small><?php echo $lang->get('usercp_publicinfo_field_usertitle_hint'); ?></small>
       
   674               </td>
       
   675               <td class="row1">
       
   676                 <input type="text" name="user_title" value="<?php echo htmlspecialchars($session->user_title); ?>" />
       
   677               </td>
       
   678             </tr>
       
   679           <?php
       
   680           endif;
       
   681           ?>
   647           <tr>
   682           <tr>
   648             <th class="subhead" colspan="2">
   683             <th class="subhead" colspan="2">
   649               <?php echo $lang->get('usercp_publicinfo_th_im'); ?>
   684               <?php echo $lang->get('usercp_publicinfo_th_im'); ?>
   650             </th>
   685             </th>
   651           <tr>
   686           <tr>