plugins/SpecialUserPrefs.php
changeset 31 dc8741857bde
parent 0 902822492a68
child 32 4d87aad3c4c0
equal deleted inserted replaced
30:7e8fd44b36b0 31:dc8741857bde
   401     case "Profile":
   401     case "Profile":
   402       if ( isset($_POST['submit']) )
   402       if ( isset($_POST['submit']) )
   403       {
   403       {
   404         $real_name = htmlspecialchars($_POST['real_name']);
   404         $real_name = htmlspecialchars($_POST['real_name']);
   405         $real_name = $db->escape($real_name);
   405         $real_name = $db->escape($real_name);
       
   406         
       
   407         $imaddr_aim = htmlspecialchars($_POST['imaddr_aim']);
       
   408         $imaddr_aim = $db->escape($imaddr_aim);
       
   409         
       
   410         $imaddr_msn = htmlspecialchars($_POST['imaddr_msn']);
       
   411         $imaddr_msn = $db->escape($imaddr_msn);
       
   412         
       
   413         $imaddr_yahoo = htmlspecialchars($_POST['imaddr_yahoo']);
       
   414         $imaddr_yahoo = $db->escape($imaddr_yahoo);
       
   415         
       
   416         $imaddr_xmpp = htmlspecialchars($_POST['imaddr_xmpp']);
       
   417         $imaddr_xmpp = $db->escape($imaddr_xmpp);
       
   418         
       
   419         $homepage = htmlspecialchars($_POST['homepage']);
       
   420         $homepage = $db->escape($homepage);
       
   421         
       
   422         $location = htmlspecialchars($_POST['location']);
       
   423         $location = $db->escape($location);
       
   424         
       
   425         $occupation = htmlspecialchars($_POST['occupation']);
       
   426         $occupation = $db->escape($occupation);
       
   427         
       
   428         $hobbies = htmlspecialchars($_POST['hobbies']);
       
   429         $hobbies = $db->escape($hobbies);
       
   430         
       
   431         $email_public = ( isset($_POST['email_public']) ) ? '1' : '0';
       
   432         
       
   433         $session->real_name = $real_name;
       
   434         
       
   435         if ( !preg_match('/@([a-z0-9-]+)(\.([a-z0-9-\.]+))?/', $imaddr_msn) )
       
   436         {
       
   437           $imaddr_msn = "$imaddr_msn@hotmail.com";
       
   438         }
       
   439         
       
   440         if ( substr($homepage, 0, 7) != 'http://' )
       
   441         {
       
   442           $homepage = "http://$homepage";
       
   443         }
       
   444         
       
   445         if ( !preg_match('/^http:\/\/([a-z0-9-.]+)([A-z0-9@#\$%\&:;<>,\.\?=\+\(\)\[\]_\/\\\\]*?)$/i', $homepage) )
       
   446         {
       
   447           $homepage = '';
       
   448         }
       
   449         
       
   450         $session->user_extra['user_aim'] = $imaddr_aim;
       
   451         $session->user_extra['user_msn'] = $imaddr_msn;
       
   452         $session->user_extra['user_xmpp'] = $imaddr_xmpp;
       
   453         $session->user_extra['user_yahoo'] = $imaddr_yahoo;
       
   454         $session->user_extra['user_homepage'] = $homepage;
       
   455         $session->user_extra['user_location'] = $location;
       
   456         $session->user_extra['user_job'] = $occupation;
       
   457         $session->user_extra['user_hobbies'] = $hobbies;
       
   458         $session->user_extra['email_public'] = intval($email_public);
       
   459         
   406         $q = $db->sql_query('UPDATE '.table_prefix."users SET real_name='$real_name' WHERE user_id=$session->user_id;");
   460         $q = $db->sql_query('UPDATE '.table_prefix."users SET real_name='$real_name' WHERE user_id=$session->user_id;");
       
   461         if ( !$q )
       
   462           $db->_die();
       
   463         
       
   464         $q = $db->sql_query('UPDATE '.table_prefix."users_extra SET user_aim='$imaddr_aim',user_yahoo='$imaddr_yahoo',user_msn='$imaddr_msn',
       
   465                                user_xmpp='$imaddr_xmpp',user_homepage='$homepage',user_location='$location',user_job='$occupation',
       
   466                                user_hobbies='$hobbies',email_public=$email_public
       
   467                                WHERE user_id=$session->user_id;");
       
   468         
   407         if ( !$q )
   469         if ( !$q )
   408           $db->_die();
   470           $db->_die();
   409         
   471         
   410         echo '<div class="info-box" style="margin: 0 0 10px 0;">Your profile has been updated.</div>';
   472         echo '<div class="info-box" style="margin: 0 0 10px 0;">Your profile has been updated.</div>';
   411       }
   473       }
   426           <tr>
   488           <tr>
   427             <td class="row2">Change theme:</td>
   489             <td class="row2">Change theme:</td>
   428             <td class="row1">If you don't like the look of the site, need a visual break, or are just curious, we might have some different themes for you to try out! <a href="<?php echo makeUrlNS('Special', 'ChangeStyle/' . $paths->page); ?>" onclick="ajaxChangeStyle(); return false;">Change my theme...</a></td>
   490             <td class="row1">If you don't like the look of the site, need a visual break, or are just curious, we might have some different themes for you to try out! <a href="<?php echo makeUrlNS('Special', 'ChangeStyle/' . $paths->page); ?>" onclick="ajaxChangeStyle(); return false;">Change my theme...</a></td>
   429           </tr>
   491           </tr>
   430           <tr>
   492           <tr>
   431             <td colspan="2" class="row3"><small>More is coming soon - planned fields include AOL, WLM, Yahoo, and XMPP messenger fields, allow public display of e-mail address, allow private messages from users not on your buddy list, homepage, occupation, and location.</small></td>
   493             <th class="subhead" colspan="2">
       
   494               Instant messenger contact information
       
   495             </th>
       
   496           <tr>
       
   497             <td class="row2" style="width: 50%;">AIM handle:</td>
       
   498             <td class="row1" style="width: 50%;"><input type="text" name="imaddr_aim" value="<?php echo $session->user_extra['user_aim']; ?>" size="30" /></td>
       
   499           </tr>
       
   500           <tr>
       
   501             <td class="row2" style="width: 50%;"><acronym title="Windows&trade; Live Messenger">WLM</acronym> handle:<br /><small>If you don't specify the domain (@whatever.com), "@hotmail.com" will be assumed.</small></td>
       
   502             <td class="row1" style="width: 50%;"><input type="text" name="imaddr_msn" value="<?php echo $session->user_extra['user_msn']; ?>" size="30" /></td>
       
   503           </tr>
       
   504           <tr>
       
   505             <td class="row2" style="width: 50%;">Yahoo! IM handle:</td>
       
   506             <td class="row1" style="width: 50%;"><input type="text" name="imaddr_yahoo" value="<?php echo $session->user_extra['user_yahoo']; ?>" size="30" /></td>
       
   507           </tr>
       
   508           <tr>
       
   509             <td class="row2" style="width: 50%;">Jabber/XMPP handle:</td>
       
   510             <td class="row1" style="width: 50%;"><input type="text" name="imaddr_xmpp" value="<?php echo $session->user_extra['user_xmpp']; ?>" size="30" /></td>
       
   511           </tr>
       
   512           <tr>
       
   513             <th class="subhead" colspan="2">
       
   514               Extra contact information
       
   515             </th>
       
   516           </tr>
       
   517           <tr>
       
   518             <td class="row2" style="width: 50%;">Your homepage:<br /><small>Please remember the http:// prefix.</small></td>
       
   519             <td class="row1" style="width: 50%;"><input type="text" name="homepage" value="<?php echo $session->user_extra['user_homepage']; ?>" size="30" /></td>
       
   520           </tr>
       
   521           <tr>
       
   522             <td class="row2" style="width: 50%;">Your location:</td>
       
   523             <td class="row1" style="width: 50%;"><input type="text" name="location" value="<?php echo $session->user_extra['user_location']; ?>" size="30" /></td>
       
   524           </tr>
       
   525           <tr>
       
   526             <td class="row2" style="width: 50%;">Your job:</td>
       
   527             <td class="row1" style="width: 50%;"><input type="text" name="occupation" value="<?php echo $session->user_extra['user_job']; ?>" size="30" /></td>
       
   528           </tr>
       
   529           <tr>
       
   530             <td class="row2" style="width: 50%;">Your hobbies:</td>
       
   531             <td class="row1" style="width: 50%;"><input type="text" name="hobbies" value="<?php echo $session->user_extra['user_hobbies']; ?>" size="30" /></td>
       
   532           </tr>
       
   533           <tr>
       
   534             <td class="row2" style="width: 50%;"><label for="chk_email_public">E-mail address is public</label><br /><small>If this is checked, your e-mail address will be displayed on your user page. To protect your address from spambots, your e-mail address will be encrypted.</small></td>
       
   535             <td class="row1" style="width: 50%;"><input type="checkbox" id="chk_email_public" name="email_public" value="<?php if ($session->user_extra['email_public'] == 1) echo 'checked="checked"'; ?>" size="30" /></td>
   432           </tr>
   536           </tr>
   433           <tr>
   537           <tr>
   434             <th class="subhead" colspan="2">
   538             <th class="subhead" colspan="2">
   435               <input type="submit" name="submit" value="Save profile" />
   539               <input type="submit" name="submit" value="Save profile" />
   436             </th>
   540             </th>