2004-04-25 03:25:41 +02:00
< ? php
2004-10-19 05:03:06 +02:00
require_once ( 'admin.php' );
2004-04-25 03:25:41 +02:00
2004-12-12 21:41:19 +01:00
$title = 'Profile' ;
2004-08-23 01:24:50 +02:00
$parent_file = 'profile.php' ;
2003-05-22 14:12:53 +02:00
2004-12-12 21:41:19 +01:00
$wpvarstoreset = array ( 'action' , 'profile' , 'user' );
2003-12-18 10:36:13 +01:00
for ( $i = 0 ; $i < count ( $wpvarstoreset ); $i += 1 ) {
$wpvar = $wpvarstoreset [ $i ];
if ( ! isset ( $$wpvar )) {
2004-04-21 00:56:47 +02:00
if ( empty ( $_POST [ " $wpvar " ])) {
if ( empty ( $_GET [ " $wpvar " ])) {
2003-12-18 10:36:13 +01:00
$$wpvar = '' ;
2003-05-22 14:12:53 +02:00
} else {
2004-04-21 00:56:47 +02:00
$$wpvar = $_GET [ " $wpvar " ];
2003-05-22 14:12:53 +02:00
}
} else {
2004-04-21 00:56:47 +02:00
$$wpvar = $_POST [ " $wpvar " ];
2003-05-22 14:12:53 +02:00
}
}
}
2003-06-13 00:47:45 +02:00
require_once ( '../wp-config.php' );
2004-12-14 04:00:55 +01:00
auth_redirect ();
2003-05-22 14:12:53 +02:00
switch ( $action ) {
2003-06-01 08:45:53 +02:00
case 'update' :
2003-05-22 14:12:53 +02:00
get_currentuserinfo ();
/* checking the nickname has been typed */
2004-04-21 00:56:47 +02:00
if ( empty ( $_POST [ " newuser_nickname " ])) {
2005-03-13 18:06:18 +01:00
die ( __ ( " <strong>ERROR</strong>: please enter your nickname (can be the same as your username) " ));
2003-05-22 14:12:53 +02:00
return false ;
}
/* if the ICQ UIN has been entered, check to see if it has only numbers */
2004-04-21 00:56:47 +02:00
if ( ! empty ( $_POST [ " newuser_icq " ])) {
if (( ereg ( " ^[0-9]+ $ " , $_POST [ " newuser_icq " ])) == false ) {
2004-04-25 03:25:41 +02:00
die ( __ ( " <strong>ERROR</strong>: your ICQ UIN can only be a number, no letters allowed " ));
2003-05-22 14:12:53 +02:00
return false ;
}
}
/* checking e-mail address */
2004-04-21 00:56:47 +02:00
if ( empty ( $_POST [ " newuser_email " ])) {
2004-04-25 03:25:41 +02:00
die ( __ ( " <strong>ERROR</strong>: please type your e-mail address " ));
2003-05-22 14:12:53 +02:00
return false ;
2004-04-21 00:56:47 +02:00
} else if ( ! is_email ( $_POST [ " newuser_email " ])) {
2004-06-13 18:14:58 +02:00
die ( __ ( " <strong>ERROR</strong>: the e-mail address isn't correct " ));
2003-05-22 14:12:53 +02:00
return false ;
}
2005-03-09 23:49:42 +01:00
$pass1 = $_POST [ " pass1 " ];
$pass2 = $_POST [ " pass2 " ];
do_action ( 'check_passwords' , array ( $user_login , & $pass1 , & $pass2 ));
if ( '' == $pass1 ) {
2005-03-13 18:29:33 +01:00
if ( '' != $pass2 )
2004-04-25 03:25:41 +02:00
die ( __ ( " <strong>ERROR</strong>: you typed your new password only once. Go back to type it twice. " ));
2003-05-22 14:12:53 +02:00
$updatepassword = " " ;
} else {
2005-03-09 23:49:42 +01:00
if ( '' == $pass2 )
2004-04-25 03:25:41 +02:00
die ( __ ( " <strong>ERROR</strong>: you typed your new password only once. Go back to type it twice. " ));
2005-03-09 23:49:42 +01:00
if ( $pass1 != $pass2 )
2004-04-25 03:25:41 +02:00
die ( __ ( " <strong>ERROR</strong>: you typed two different passwords. Go back to correct that. " ));
2005-03-09 23:49:42 +01:00
$newuser_pass = $pass1 ;
2004-02-09 10:56:57 +01:00
$updatepassword = " user_pass=MD5(' $newuser_pass '), " ;
2005-01-20 05:56:24 +01:00
wp_clearcookie ();
wp_setcookie ( $user_login , $newuser_pass );
2003-05-22 14:12:53 +02:00
}
2004-12-12 21:41:19 +01:00
$newuser_firstname = wp_specialchars ( $_POST [ 'newuser_firstname' ]);
$newuser_lastname = wp_specialchars ( $_POST [ 'newuser_lastname' ]);
2004-11-19 08:23:37 +01:00
$newuser_nickname = $_POST [ 'newuser_nickname' ];
2005-03-09 23:49:42 +01:00
$newuser_nicename = sanitize_title ( $newuser_nickname );
2004-12-12 21:41:19 +01:00
$newuser_icq = wp_specialchars ( $_POST [ 'newuser_icq' ]);
$newuser_aim = wp_specialchars ( $_POST [ 'newuser_aim' ]);
$newuser_msn = wp_specialchars ( $_POST [ 'newuser_msn' ]);
$newuser_yim = wp_specialchars ( $_POST [ 'newuser_yim' ]);
$newuser_email = wp_specialchars ( $_POST [ 'newuser_email' ]);
2004-12-13 17:31:06 +01:00
$newuser_url = wp_specialchars ( $_POST [ 'newuser_url' ]);
2004-06-14 16:58:10 +02:00
$newuser_url = preg_match ( '/^(https?|ftps?|mailto|news|gopher):/is' , $newuser_url ) ? $newuser_url : 'http://' . $newuser_url ;
2004-12-12 21:41:19 +01:00
$newuser_idmode = wp_specialchars ( $_POST [ 'newuser_idmode' ]);
2004-06-18 02:22:09 +02:00
$user_description = $_POST [ 'user_description' ];
2004-01-01 01:55:31 +01:00
2005-06-13 01:14:52 +02:00
$result = $wpdb -> query ( " UPDATE $wpdb->users SET $updatepassword user_email=' $newuser_email ', user_url=' $newuser_url ', user_nicename = ' $newuser_nicename ' WHERE ID = $user_ID " );
update_user_meta ( $user_ID , 'first_name' , $newuser_firstname );
update_user_meta ( $user_ID , 'last_name' , $newuser_lastname );
update_user_meta ( $user_ID , 'nickname' , $newuser_nickname );
update_user_meta ( $user_ID , 'description' , $user_description );
update_user_meta ( $user_ID , 'icq' , $newuser_icq );
update_user_meta ( $user_ID , 'aim' , $newuser_aim );
update_user_meta ( $user_ID , 'msn' , $newuser_msn );
update_user_meta ( $user_ID , 'yim' , $newuser_yim );
2004-11-19 08:23:37 +01:00
2005-06-11 01:33:58 +02:00
do_action ( 'profile_update' , $user_ID );
2005-03-13 17:36:09 +01:00
wp_redirect ( 'profile.php?updated=true' );
2003-05-22 14:12:53 +02:00
break ;
case 'IErightclick' :
2004-09-05 02:24:28 +02:00
$bookmarklet_height = 550 ;
2003-05-22 14:12:53 +02:00
?>
< div class = " menutop " >& nbsp ; IE one - click bookmarklet </ div >
< table width = " 100% " cellpadding = " 20 " >
< tr >< td >
< p > To have a one - click bookmarklet , just copy and paste this < br /> into a new text file :</ p >
< ? php
2004-03-01 07:13:32 +01:00
$regedit = " REGEDIT4 \r \n [HKEY_CURRENT_USER \ Software \ Microsoft \ Internet Explorer \ MenuExt \ Post To &WP : " . get_settings ( 'blogname' ) . " ] \r \n @= \" javascript:doc=external.menuArguments.document;Q=doc.selection.createRange().text;void(btw=window.open(' " . get_settings ( 'siteurl' ) . " /wp-admin/bookmarklet.php?text='+escape(Q)+' " . $bookmarklet_tbpb . " &popupurl='+escape(doc.location.href)+'&popuptitle='+escape(doc.title),'bookmarklet','scrollbars=no,width=480,height= " . $bookmarklet_height . " ,left=100,top=150,status=yes'));btw.focus(); \" \r \n \" contexts \" =hex:31 \" " ;
2003-05-22 14:12:53 +02:00
?>
< pre style = " margin: 20px; background-color: #cccccc; border: 1px dashed #333333; padding: 5px; font-size: 12px; " >< ? php echo $regedit ; ?> </pre>
2003-05-24 00:43:58 +02:00
< p > Save it as wordpress . reg , and double - click on this file in an Explorer < br />
2003-05-22 14:12:53 +02:00
window . Answer Yes to the question , and restart Internet Explorer .< br />< br />
That ' s it , you can now right - click in an IE window and select < br />
2003-05-24 00:43:58 +02:00
'Post to WP' to make the bookmarklet appear . : ) </ p >
2003-05-22 14:12:53 +02:00
< p align = " center " >
2004-02-01 12:03:43 +01:00
< form >
2003-05-22 14:12:53 +02:00
< input class = " search " type = " button " value = " 1 " name = " Close this window " />
2004-02-01 12:03:43 +01:00
</ form >
2003-05-22 14:12:53 +02:00
</ p >
</ td ></ tr >
</ table >
< ? php
break ;
default :
2004-12-24 21:55:36 +01:00
$parent_file = 'profile.php' ;
2004-01-01 01:55:31 +01:00
include_once ( 'admin-header.php' );
2003-05-22 14:12:53 +02:00
$profiledata = get_userdata ( $user_ID );
2004-09-05 02:24:28 +02:00
$bookmarklet_height = 440 ;
2003-05-22 14:12:53 +02:00
2004-08-23 01:24:50 +02:00
if ( isset ( $updated )) { ?>
2004-04-19 10:09:27 +02:00
< div class = " updated " >
2004-04-25 03:25:41 +02:00
< p >< strong >< ? php _e ( 'Profile updated.' ) ?> </strong></p>
2004-01-01 01:55:31 +01:00
</ div >
< ? php } ?>
< div class = " wrap " >
2004-05-19 09:09:32 +02:00
< h2 >< ? php _e ( 'Profile' ); ?> </h2>
2003-12-11 01:22:36 +01:00
< form name = " profile " id = " profile " action = " profile.php " method = " post " >
2004-02-01 12:03:43 +01:00
< p >
2003-06-01 08:45:53 +02:00
< input type = " hidden " name = " action " value = " update " />
< input type = " hidden " name = " checkuser_id " value = " <?php echo $user_ID ?> " />
</ p >
2004-05-19 09:09:32 +02:00
2005-01-31 07:38:12 +01:00
< table width = " 99% " border = " 0 " cellspacing = " 2 " cellpadding = " 3 " class = " editform " >
2004-05-19 09:05:40 +02:00
< tr >
2005-03-13 18:06:18 +01:00
< th width = " 33% " scope = " row " >< ? php _e ( 'Username:' ) ?> </th>
2004-08-23 01:24:50 +02:00
< td width = " 67% " >< ? php echo $profiledata -> user_login ; ?> </td>
2004-05-19 09:09:32 +02:00
</ tr >
< tr >
< th scope = " row " >< ? php _e ( 'Level:' ) ?> </th>
< td >< ? php echo $profiledata -> user_level ; ?> </td>
</ tr >
< tr >
< th scope = " row " >< ? php _e ( 'Posts:' ) ?> </th>
< td > < ? php
$posts = get_usernumposts ( $user_ID );
echo $posts ;
?> </td>
</ tr >
2004-01-01 01:55:31 +01:00
< tr >
2004-05-19 09:09:32 +02:00
< th scope = " row " >< ? php _e ( 'First name:' ) ?> </th>
< td >< input type = " text " name = " newuser_firstname " id = " newuser_firstname " value = " <?php echo $profiledata->user_firstname ?> " /></ td >
2004-01-01 01:55:31 +01:00
</ tr >
< tr >
2004-04-25 03:25:41 +02:00
< th scope = " row " >< ? php _e ( 'Last name:' ) ?> </th>
2004-01-01 01:55:31 +01:00
< td >< input type = " text " name = " newuser_lastname " id = " newuser_lastname2 " value = " <?php echo $profiledata->user_lastname ?> " /></ td >
</ tr >
< tr >
2004-04-25 03:25:41 +02:00
< th scope = " row " >< ? php _e ( 'Nickname:' ) ?> </th>
2004-01-01 01:55:31 +01:00
< td >< input type = " text " name = " newuser_nickname " id = " newuser_nickname2 " value = " <?php echo $profiledata->user_nickname ?> " /></ td >
</ tr >
2005-01-31 07:38:12 +01:00
< tr >
< th scope = " row " >< ? php _e ( 'How to display name:' ) ?> </th>
< td >< select name = " newuser_idmode " >
< option value = " nickname " < ? php
if ( $profiledata -> user_idmode == 'nickname' )
echo ' selected="selected"' ; ?> ><?php echo $profiledata->user_nickname ?></option>
< option value = " login " < ? php
if ( $profiledata -> user_idmode == " login " )
echo ' selected="selected"' ; ?> ><?php echo $profiledata->user_login ?></option>
< ? php if ( ! empty ( $profiledata -> user_firstname ) ) : ?>
< option value = " firstname " < ? php
if ( $profiledata -> user_idmode == " firstname " )
echo ' selected="selected"' ; ?> ><?php echo $profiledata->user_firstname ?></option>
< ? php endif ; ?>
< ? php if ( ! empty ( $profiledata -> user_lastname ) ) : ?>
< option value = " lastname " < ? php
if ( $profiledata -> user_idmode == " lastname " )
echo ' selected="selected"' ; ?> ><?php echo $profiledata->user_lastname ?></option>
< ? php endif ; ?>
< ? php if ( ! empty ( $profiledata -> user_firstname ) && ! empty ( $profiledata -> user_lastname ) ) : ?>
< option value = " namefl " < ? php
if ( $profiledata -> user_idmode == " namefl " )
echo ' selected="selected"' ; ?> ><?php echo $profiledata->user_firstname." ".$profiledata->user_lastname ?></option>
< ? php endif ; ?>
< ? php if ( ! empty ( $profiledata -> user_firstname ) && ! empty ( $profiledata -> user_lastname ) ) : ?>
< option value = " namelf " < ? php
if ( $profiledata -> user_idmode == " namelf " )
echo ' selected="selected"' ; ?> ><?php echo $profiledata->user_lastname." ".$profiledata->user_firstname ?></option>
< ? php endif ; ?>
</ select > </ td >
</ tr >
2004-01-01 01:55:31 +01:00
< tr >
2004-06-13 18:14:58 +02:00
< th scope = " row " >< ? php _e ( 'E-mail:' ) ?> </th>
2004-01-01 01:55:31 +01:00
< td >< input type = " text " name = " newuser_email " id = " newuser_email2 " value = " <?php echo $profiledata->user_email ?> " /></ td >
</ tr >
< tr >
2004-04-25 03:25:41 +02:00
< th scope = " row " >< ? php _e ( 'Website:' ) ?> </th>
2004-01-01 01:55:31 +01:00
< td >< input type = " text " name = " newuser_url " id = " newuser_url2 " value = " <?php echo $profiledata->user_url ?> " /></ td >
</ tr >
< tr >
2004-04-25 03:25:41 +02:00
< th scope = " row " >< ? php _e ( 'ICQ:' ) ?> </th>
2004-01-01 01:55:31 +01:00
< td >< input type = " text " name = " newuser_icq " id = " newuser_icq2 " value = " <?php if ( $profiledata->user_icq > 0) { echo $profiledata->user_icq ; } ?> " /></ td >
</ tr >
< tr >
2004-04-25 03:25:41 +02:00
< th scope = " row " >< ? php _e ( 'AIM:' ) ?> </th>
2004-01-01 01:55:31 +01:00
< td >< input type = " text " name = " newuser_aim " id = " newuser_aim2 " value = " <?php echo $profiledata->user_aim ?> " /></ td >
</ tr >
< tr >
2004-04-25 03:25:41 +02:00
< th scope = " row " >< ? php _e ( 'MSN IM:' ) ?> </th>
2004-01-01 01:55:31 +01:00
< td >< input type = " text " name = " newuser_msn " id = " newuser_msn2 " value = " <?php echo $profiledata->user_msn ?> " /></ td >
</ tr >
< tr >
2004-04-25 03:25:41 +02:00
< th scope = " row " >< ? php _e ( 'Yahoo IM:' ) ?> </th>
2004-01-01 01:55:31 +01:00
< td > < input type = " text " name = " newuser_yim " id = " newuser_yim2 " value = " <?php echo $profiledata->user_yim ?> " /> </ td >
</ tr >
< tr >
2005-01-31 07:38:12 +01:00
< th scope = " row " >< ? php _e ( 'Profile:' ) ?> </th>
< td >< textarea name = " user_description " rows = " 5 " id = " textarea2 " style = " width: 99%; " >< ? php echo $profiledata -> user_description ?> </textarea></td>
2004-01-01 01:55:31 +01:00
</ tr >
2005-03-09 23:49:42 +01:00
< ? php
$show_password_fields = apply_filters ( 'show_password_fields' , true );
if ( $show_password_fields ) :
?>
2004-01-01 01:55:31 +01:00
< tr >
2004-04-25 03:25:41 +02:00
< th scope = " row " >< ? php _e ( 'New <strong>Password</strong> (Leave blank to stay the same.)' ) ?> </th>
2004-01-01 01:55:31 +01:00
< td >< input type = " password " name = " pass1 " size = " 16 " value = " " />
2004-06-11 20:23:12 +02:00
< br />
2004-01-01 01:55:31 +01:00
< input type = " password " name = " pass2 " size = " 16 " value = " " /></ td >
</ tr >
2005-03-09 23:49:42 +01:00
< ? php endif ; ?>
2004-01-01 01:55:31 +01:00
</ table >
2004-04-15 11:15:56 +02:00
< p class = " submit " >
2004-05-08 03:15:03 +02:00
< input type = " submit " value = " <?php _e('Update Profile »') ?> " name = " submit " />
2004-04-15 11:15:56 +02:00
</ p >
2004-02-01 12:03:43 +01:00
</ form >
2004-01-01 01:55:31 +01:00
</ div >
2004-06-11 20:23:12 +02:00
2004-02-01 12:03:43 +01:00
< ? php if ( $is_gecko && $profiledata -> user_level != 0 ) { ?>
2004-01-01 01:55:31 +01:00
< div class = " wrap " >
2004-08-01 10:04:39 +02:00
< script type = " text/javascript " >
2004-06-11 20:23:12 +02:00
//<![CDATA[
2003-05-22 14:12:53 +02:00
function addPanel ()
{
if (( typeof window . sidebar == " object " ) && ( typeof window . sidebar . addPanel == " function " ))
2004-03-01 07:13:32 +01:00
window . sidebar . addPanel ( " WordPress Post: <?php echo get_settings('blogname'); ?> " , " <?php echo get_settings('siteurl'); ?>/wp-admin/sidebar.php " , " " );
2003-05-22 14:12:53 +02:00
else
2004-04-25 03:25:41 +02:00
alert ( < ? php __ ( " 'No Sidebar found! You must use Mozilla 0.9.4 or later!' " ) ?> );
2003-05-22 14:12:53 +02:00
}
2004-06-11 20:23:12 +02:00
//]]>
2003-05-22 14:12:53 +02:00
</ script >
2004-05-23 19:24:38 +02:00
< strong >< ? php _e ( 'SideBar' ) ?> </strong><br />
2004-12-16 00:09:46 +01:00
< ? php _e ( 'Add the <a href="#" onclick="addPanel()">WordPress Sidebar</a>!' ) ?>
2003-06-01 08:45:53 +02:00
< ? php } elseif (( $is_winIE ) || ( $is_macIE )) { ?>
2004-05-23 19:24:38 +02:00
< strong >< ? php _e ( 'SideBar' ) ?> </strong><br />
< ? php __ ( 'Add this link to your favorites:' ) ?> <br />
< a href = " javascript:Q='';if(top.frames.length==0)Q=document.selection.createRange().text;void(_search=open('<?php echo get_settings('siteurl');
?> /wp-admin/sidebar.php?text='+escape(Q)+'&popupurl='+escape(location.href)+'&popuptitle='+escape(document.title),'_search'))"><?php _e('WordPress Sidebar') ?></a>.
2004-01-01 01:55:31 +01:00
</ div >
< ? php } ?>
2004-06-11 20:23:12 +02:00
</ div >
2003-05-22 14:12:53 +02:00
< ? php
break ;
}
/* </Profile | My Profile> */
2004-02-09 10:56:57 +01:00
include ( 'admin-footer.php' );
2004-04-25 03:25:41 +02:00
?>