2003-05-22 08:12:53 -04:00
< ? php $title = " Profile " ;
/* <Profile | My Profile> */
function add_magic_quotes ( $array ) {
foreach ( $array as $k => $v ) {
if ( is_array ( $v )) {
$array [ $k ] = add_magic_quotes ( $v );
} else {
$array [ $k ] = addslashes ( $v );
}
}
return $array ;
}
if ( ! get_magic_quotes_gpc ()) {
$HTTP_GET_VARS = add_magic_quotes ( $HTTP_GET_VARS );
$HTTP_POST_VARS = add_magic_quotes ( $HTTP_POST_VARS );
$HTTP_COOKIE_VARS = add_magic_quotes ( $HTTP_COOKIE_VARS );
}
2003-12-18 04:36:13 -05:00
$wpvarstoreset = array ( 'action' , 'standalone' , 'redirect' , 'profile' , 'user' );
for ( $i = 0 ; $i < count ( $wpvarstoreset ); $i += 1 ) {
$wpvar = $wpvarstoreset [ $i ];
if ( ! isset ( $$wpvar )) {
if ( empty ( $HTTP_POST_VARS [ " $wpvar " ])) {
if ( empty ( $HTTP_GET_VARS [ " $wpvar " ])) {
$$wpvar = '' ;
2003-05-22 08:12:53 -04:00
} else {
2003-12-18 04:36:13 -05:00
$$wpvar = $HTTP_GET_VARS [ " $wpvar " ];
2003-05-22 08:12:53 -04:00
}
} else {
2003-12-18 04:36:13 -05:00
$$wpvar = $HTTP_POST_VARS [ " $wpvar " ];
2003-05-22 08:12:53 -04:00
}
}
}
2003-06-12 18:47:45 -04:00
require_once ( '../wp-config.php' );
2003-12-31 19:55:31 -05:00
require_once ( 'auth.php' );
2003-05-22 08:12:53 -04:00
switch ( $action ) {
2003-06-01 02:45:53 -04:00
case 'update' :
2003-05-22 08:12:53 -04:00
get_currentuserinfo ();
/* checking the nickname has been typed */
if ( empty ( $HTTP_POST_VARS [ " newuser_nickname " ])) {
die ( " <strong>ERROR</strong>: please enter your nickname (can be the same as your login) " );
return false ;
}
/* if the ICQ UIN has been entered, check to see if it has only numbers */
if ( ! empty ( $HTTP_POST_VARS [ " newuser_icq " ])) {
if (( ereg ( " ^[0-9]+ $ " , $HTTP_POST_VARS [ " newuser_icq " ])) == false ) {
die ( " <strong>ERROR</strong>: your ICQ UIN can only be a number, no letters allowed " );
return false ;
}
}
/* checking e-mail address */
if ( empty ( $HTTP_POST_VARS [ " newuser_email " ])) {
die ( " <strong>ERROR</strong>: please type your e-mail address " );
return false ;
} else if ( ! is_email ( $HTTP_POST_VARS [ " newuser_email " ])) {
die ( " <strong>ERROR</strong>: the email address isn't correct " );
return false ;
}
if ( $HTTP_POST_VARS [ " pass1 " ] == " " ) {
if ( $HTTP_POST_VARS [ " pass2 " ] != " " )
die ( " <strong>ERROR</strong>: you typed your new password only once. Go back to type it twice. " );
$updatepassword = " " ;
} else {
if ( $HTTP_POST_VARS [ " pass2 " ] == " " )
die ( " <strong>ERROR</strong>: you typed your new password only once. Go back to type it twice. " );
if ( $HTTP_POST_VARS [ " pass1 " ] != $HTTP_POST_VARS [ " pass2 " ])
die ( " <strong>ERROR</strong>: you typed two different passwords. Go back to correct that. " );
$newuser_pass = $HTTP_POST_VARS [ " pass1 " ];
$updatepassword = " user_pass=' $newuser_pass ', " ;
2003-10-20 16:53:13 -04:00
setcookie ( " wordpresspass_ " . $cookiehash , md5 ( $newuser_pass ), time () + 31536000 );
2003-05-22 08:12:53 -04:00
}
2003-12-31 19:55:31 -05:00
$newuser_firstname = addslashes ( stripslashes ( $HTTP_POST_VARS [ 'newuser_firstname' ]));
$newuser_lastname = addslashes ( stripslashes ( $HTTP_POST_VARS [ 'newuser_lastname' ]));
$newuser_nickname = addslashes ( stripslashes ( $HTTP_POST_VARS [ 'newuser_nickname' ]));
$newuser_icq = addslashes ( stripslashes ( $HTTP_POST_VARS [ 'newuser_icq' ]));
$newuser_aim = addslashes ( stripslashes ( $HTTP_POST_VARS [ 'newuser_aim' ]));
$newuser_msn = addslashes ( stripslashes ( $HTTP_POST_VARS [ 'newuser_msn' ]));
$newuser_yim = addslashes ( stripslashes ( $HTTP_POST_VARS [ 'newuser_yim' ]));
$newuser_email = addslashes ( stripslashes ( $HTTP_POST_VARS [ 'newuser_email' ]));
$newuser_url = addslashes ( stripslashes ( $HTTP_POST_VARS [ 'newuser_url' ]));
$newuser_idmode = addslashes ( stripslashes ( $HTTP_POST_VARS [ 'newuser_idmode' ]));
$user_description = addslashes ( stripslashes ( $HTTP_POST_VARS [ 'user_description' ]));
$query = " UPDATE $tableusers SET user_firstname=' $newuser_firstname ', $updatepassword user_lastname=' $newuser_lastname ', user_nickname=' $newuser_nickname ', user_icq=' $newuser_icq ', user_email=' $newuser_email ', user_url=' $newuser_url ', user_aim=' $newuser_aim ', user_msn=' $newuser_msn ', user_yim=' $newuser_yim ', user_idmode=' $newuser_idmode ', user_description = ' $user_description ' WHERE ID = $user_ID " ;
2003-06-01 02:45:53 -04:00
$result = $wpdb -> query ( $query );
if ( ! $result ) {
2003-07-30 19:44:08 -04:00
die ( " <strong>ERROR</strong>: couldn't update your profile... please contact the <a href= \" mailto: $admin_email\ " > webmaster </ a > !< br />< br /> $query < br />< br /> " );
2003-05-22 08:12:53 -04:00
}
2003-12-31 19:55:31 -05:00
header ( 'Location: profile.php?updated=true' );
2003-05-22 08:12:53 -04:00
break ;
2003-06-01 02:45:53 -04:00
case 'viewprofile' :
2003-05-22 08:12:53 -04:00
2003-06-01 04:05:56 -04:00
$profiledata = get_userdata ( $user );
2003-10-20 16:53:13 -04:00
if ( $HTTP_COOKIE_VARS [ 'wordpressuser_' . $cookiehash ] == $profiledata -> user_login )
2003-12-10 19:22:36 -05:00
header ( 'Location: profile.php' );
2003-05-22 08:12:53 -04:00
2003-12-31 19:55:31 -05:00
include_once ( 'admin-header.php' );
2003-05-22 08:12:53 -04:00
?>
2003-06-01 04:05:56 -04:00
< h2 > View Profile & #8220;
< ? php
2003-06-01 02:45:53 -04:00
switch ( $profiledata -> user_idmode ) {
case 'nickname' :
$r = $profiledata -> user_nickname ;
2003-05-22 08:12:53 -04:00
break ;
2003-06-01 02:45:53 -04:00
case 'login' :
$r = $profiledata -> user_login ;
2003-05-22 08:12:53 -04:00
break ;
2003-06-01 02:45:53 -04:00
case 'firstname' :
$r = $profiledata -> user_firstname ;
2003-05-22 08:12:53 -04:00
break ;
2003-06-01 02:45:53 -04:00
case 'lastname' :
$r = $profiledata -> user_lastname ;
2003-05-22 08:12:53 -04:00
break ;
2003-06-01 02:45:53 -04:00
case 'namefl' :
$r = $profiledata -> user_firstname . ' ' . $profiledata -> user_lastname ;
2003-05-22 08:12:53 -04:00
break ;
2003-06-01 02:45:53 -04:00
case 'namelf' :
$r = $profiledata -> user_lastname . ' ' . $profiledata -> user_firstname ;
2003-05-22 08:12:53 -04:00
break ;
}
echo $r ;
?>
2003-06-01 04:05:56 -04:00
& #8221;</h2>
< div id = " profile " >
< p >
< strong > Login </ strong > < ? php echo $profiledata -> user_login ?>
| < strong > User #</strong> <?php echo $profiledata->ID ?> | <strong>Level</strong>
< ? php echo $profiledata -> user_level ?> | <strong>Posts</strong>
< ? php
$posts = get_usernumposts ( $user );
echo $posts ;
?>
</ p >
< p > < strong > First :</ strong > < ? php echo $profiledata -> user_firstname ?> </p>
< p > < strong > Last :</ strong > < ? php echo $profiledata -> user_lastname ?> </p>
< p > < strong > Nickname :</ strong > < ? php echo $profiledata -> user_nickname ?> </p>
< p > < strong > Email :</ strong > < ? php echo make_clickable ( $profiledata -> user_email ) ?>
</ p >
< p > < strong > URL :</ strong > < ? php echo $profiledata -> user_url ?> </p>
< p > < strong > ICQ :</ strong >
< ? php if ( $profiledata -> user_icq > 0 ) { echo make_clickable ( " icq: " . $profiledata -> user_icq ); } ?>
</ p >
2003-06-19 15:22:21 -04:00
< p > < strong > AIM :</ strong > < ? php echo " <a href='aim:goim?screenname= " . str_replace ( ' ' , '+' , $profiledata -> user_aim ) . " &message=Howdy'> $profiledata->user_aim </a> " ; ?>
2003-06-01 04:05:56 -04:00
</ p >
< p > < strong > MSN IM :</ strong > < ? php echo $profiledata -> user_msn ?> </p>
< p > < strong > Yahoo IM :</ strong > < ? php echo $profiledata -> user_yim ?> </p>
</ div >
2003-05-22 08:12:53 -04:00
< ? php
break ;
case 'IErightclick' :
$bookmarklet_tbpb = ( $use_trackback ) ? '&trackback=1' : '' ;
$bookmarklet_tbpb .= ( $use_pingback ) ? '&pingback=1' : '' ;
2003-06-11 08:38:51 -04:00
$bookmarklet_height = ( $use_trackback ) ? 590 : 550 ;
2003-05-22 08:12:53 -04: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
2003-12-15 20:58:39 -05:00
$regedit = " REGEDIT4 \r \n [HKEY_CURRENT_USER \ Software \ Microsoft \ Internet Explorer \ MenuExt \ Post To &WP : " . $blogname . " ] \r \n @= \" javascript:doc=external.menuArguments.document;Q=doc.selection.createRange().text;void(btw=window.open(' " . $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 08:12:53 -04:00
?>
< pre style = " margin: 20px; background-color: #cccccc; border: 1px dashed #333333; padding: 5px; font-size: 12px; " >< ? php echo $regedit ; ?> </pre>
2003-05-23 18:43:58 -04:00
< p > Save it as wordpress . reg , and double - click on this file in an Explorer < br />
2003-05-22 08:12:53 -04: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-23 18:43:58 -04:00
'Post to WP' to make the bookmarklet appear . : ) </ p >
2003-05-22 08:12:53 -04:00
< p align = " center " >
< form >
< input class = " search " type = " button " value = " 1 " name = " Close this window " />
</ form >
</ p >
</ td ></ tr >
</ table >
< ? php
break ;
default :
2003-12-31 19:55:31 -05:00
include_once ( 'admin-header.php' );
2003-05-22 08:12:53 -04:00
$profiledata = get_userdata ( $user_ID );
$bookmarklet_tbpb = ( $use_trackback ) ? '&trackback=1' : '' ;
$bookmarklet_tbpb .= ( $use_pingback ) ? '&pingback=1' : '' ;
2003-06-11 08:38:51 -04:00
$bookmarklet_height = ( $use_trackback ) ? 480 : 440 ;
2003-05-22 08:12:53 -04:00
?>
2003-12-31 19:55:31 -05:00
< ? php if ( $updated ) { ?>
< div class = " wrap " >
< p >< strong > Profile updated .</ strong ></ p >
</ div >
< ? php } ?>
< div class = " wrap " >
2003-12-10 19:22:36 -05:00
< form name = " profile " id = " profile " action = " profile.php " method = " post " >
2003-06-01 02:45:53 -04:00
< h2 > Edit Your Profile </ h2 >
< p >
< input type = " hidden " name = " action " value = " update " />
< input type = " hidden " name = " checkuser_id " value = " <?php echo $user_ID ?> " />
</ p >
< p >< strong > User ID :</ strong > < ? php echo $profiledata -> ID ?> | <strong>Level:</strong>
< ? php echo $profiledata -> user_level ?> | <strong>Posts:</strong>
< ? php
$posts = get_usernumposts ( $user_ID );
2003-05-22 08:12:53 -04:00
echo $posts ;
?>
2003-06-01 02:45:53 -04:00
| < strong > Login :</ strong > < ? php echo $profiledata -> user_login ?> </p>
2003-12-31 19:55:31 -05:00
< style type = " text/css " media = " screen " >
th { text - align : right ; }
</ style >
< table width = " 99% " border = " 0 " cellspacing = " 2 " cellpadding = " 3 " >
< tr >
< th width = " 15% " scope = " row " > First :</ th >
< td >< input type = " text " name = " newuser_firstname " id = " newuser_firstname " value = " <?php echo $profiledata->user_firstname ?> " /></ td >
</ tr >
< tr >
< th scope = " row " > Last :</ th >
< td >< input type = " text " name = " newuser_lastname " id = " newuser_lastname2 " value = " <?php echo $profiledata->user_lastname ?> " /></ td >
</ tr >
< tr >
< th scope = " row " > Description :</ th >
< td >< textarea name = " user_description " rows = " 5 " id = " textarea2 " style = " width: 99%; " >< ? php echo $profiledata -> user_description ?> </textarea></td>
</ tr >
< tr >
< th scope = " row " > Nickname :</ th >
< td >< input type = " text " name = " newuser_nickname " id = " newuser_nickname2 " value = " <?php echo $profiledata->user_nickname ?> " /></ td >
</ tr >
< tr >
< th scope = " row " > Email :</ th >
< td >< input type = " text " name = " newuser_email " id = " newuser_email2 " value = " <?php echo $profiledata->user_email ?> " /></ td >
</ tr >
< tr >
< th scope = " row " > URI :</ th >
< td >< input type = " text " name = " newuser_url " id = " newuser_url2 " value = " <?php echo $profiledata->user_url ?> " /></ td >
</ tr >
< tr >
< th scope = " row " > ICQ :</ th >
< td >< input type = " text " name = " newuser_icq " id = " newuser_icq2 " value = " <?php if ( $profiledata->user_icq > 0) { echo $profiledata->user_icq ; } ?> " /></ td >
</ tr >
< tr >
< th scope = " row " > AIM :</ th >
< td >< input type = " text " name = " newuser_aim " id = " newuser_aim2 " value = " <?php echo $profiledata->user_aim ?> " /></ td >
</ tr >
< tr >
< th scope = " row " > MSN IM : </ th >
< td >< input type = " text " name = " newuser_msn " id = " newuser_msn2 " value = " <?php echo $profiledata->user_msn ?> " /></ td >
</ tr >
< tr >
< th scope = " row " > Yahoo IM : </ th >
< td > < input type = " text " name = " newuser_yim " id = " newuser_yim2 " value = " <?php echo $profiledata->user_yim ?> " /> </ td >
</ tr >
< tr >
< th scope = " row " > Identity on blog : </ th >
< td >< select name = " newuser_idmode " >
< option value = " nickname " < ? php
2003-06-01 02:45:53 -04:00
if ( $profiledata -> user_idmode == 'nickname' )
echo " selected " ; ?> ><?php echo $profiledata->user_nickname ?></option>
2003-12-31 19:55:31 -05:00
< option value = " login " < ? php
2003-06-01 02:45:53 -04:00
if ( $profiledata -> user_idmode == " login " )
echo " selected " ; ?> ><?php echo $profiledata->user_login ?></option>
2003-12-31 19:55:31 -05:00
< option value = " firstname " < ? php
2003-06-01 02:45:53 -04:00
if ( $profiledata -> user_idmode == " firstname " )
echo " selected " ; ?> ><?php echo $profiledata->user_firstname ?></option>
2003-12-31 19:55:31 -05:00
< option value = " lastname " < ? php
2003-06-01 02:45:53 -04:00
if ( $profiledata -> user_idmode == " lastname " )
echo " selected " ; ?> ><?php echo $profiledata->user_lastname ?></option>
2003-12-31 19:55:31 -05:00
< option value = " namefl " < ? php
2003-06-01 02:45:53 -04:00
if ( $profiledata -> user_idmode == " namefl " )
echo " selected " ; ?> ><?php echo $profiledata->user_firstname." ".$profiledata->user_lastname ?></option>
2003-12-31 19:55:31 -05:00
< option value = " namelf " < ? php
2003-06-01 02:45:53 -04:00
if ( $profiledata -> user_idmode == " namelf " )
echo " selected " ; ?> ><?php echo $profiledata->user_lastname." ".$profiledata->user_firstname ?></option>
2003-12-31 19:55:31 -05:00
</ select > </ td >
</ tr >
< tr >
< th scope = " row " > New < strong > Password </ strong > ( Leave blank to stay the same . ) </ th >
< td >< input type = " password " name = " pass1 " size = " 16 " value = " " />
< input type = " password " name = " pass2 " size = " 16 " value = " " /></ td >
</ tr >
</ table >
< p style = " text-align: center; " >
< input class = " search " type = " submit " value = " Update " name = " submit " /></ p >
</ div >
</ form >
</ div >
< ? php if ( $is_gecko ) { ?>
< div class = " wrap " >
2003-06-01 02:45:53 -04:00
< script language = " JavaScript " type = " text/javascript " >
2003-05-22 08:12:53 -04:00
function addPanel ()
{
if (( typeof window . sidebar == " object " ) && ( typeof window . sidebar . addPanel == " function " ))
2003-12-10 19:22:36 -05:00
window . sidebar . addPanel ( " WordPress Post: <?php echo $blogname ?> " , " <?php echo $siteurl ?>/wp-admin/sidebar.php " , " " );
2003-05-22 08:12:53 -04:00
else
alert ( 'No Sidebar found! You must use Mozilla 0.9.4 or later!' );
}
</ script >
2003-06-01 02:45:53 -04:00
< strong > SideBar </ strong >< br />
Add the < a href = " # " onclick = " addPanel() " > WordPress Sidebar </ a >!
< ? php } elseif (( $is_winIE ) || ( $is_macIE )) { ?>
< strong > SideBar </ strong >< br />
Add this link to your favorites :< br />
2003-12-10 19:22:36 -05:00
< a href = " javascript:Q='';if(top.frames.length==0)Q=document.selection.createRange().text;void(_search=open('<?php echo $siteurl ?>/wp-admin/sidebar.php?text='+escape(Q)+'&popupurl='+escape(location.href)+'&popuptitle='+escape(document.title),'_search')) " > WordPress
2003-06-01 02:45:53 -04:00
Sidebar </ a >.
2003-12-31 19:55:31 -05:00
</ div >
< ? php } ?>
2003-05-22 08:12:53 -04:00
< ? php
break ;
}
/* </Profile | My Profile> */
2003-12-10 19:22:36 -05:00
include ( 'admin-footer.php' ) ?>