📄 usercp_functions.php
字号:
$w = $this_dims[0];
$h = $this_dims[1];
}
}
else
{
$w = $aw < $w ? $aw : $w;
$h = $ah < $h ? $ah : $h;
}
$real_dims = $w."x".$h;
}
else if ( preg_match( "/^upload:/", $this->class->member['avatar'] ) )
{
$real_choice = $this->class->member['avatar'];
$w = $ibforums->input['Avatar_width'];
$h = $ibforums->input['Avatar_height'];
list( $aw, $ah ) = explode( "x", $ibforums->vars['avatar_dims'] );
if ( !$w || $w == "" || !$h || $h == "" )
{
$this_dims = @getimagesize( $ibforums->vars['upload_url']."/".$real_name );
if ( $aw < $this_dims[0] || $ah < $this_dims[1] )
{
if ( $this_dims[1] < $this_dims[0] )
{
$multiplier = $aw / $this_dims[0];
$this_dims[0] = $aw;
$this_dims[1] = ceil( $this_dims[1] * $multiplier );
$w = $this_dims[0];
$h = $this_dims[1];
}
else if ( $this_dims[0] < $this_dims[1] )
{
$multiplier = $ah / $this_dims[1];
$this_dims[0] = ceil( $this_dims[0] * $multiplier );
$this_dims[1] = $ah;
$w = $this_dims[0];
$h = $this_dims[1];
}
else
{
$w = $aw;
$h = $ah;
}
}
else if ( !$this_dims[0] || $this_dims[0] == "" || !$this_dims[1] || $this_dims[1] == "" )
{
$w = $aw;
$h = $ah;
}
else
{
$w = $this_dims[0];
$h = $this_dims[1];
}
}
else
{
$w = $aw < $w ? $aw : $w;
$h = $ah < $h ? $ah : $h;
}
$real_dims = $w."x".$h;
}
else
{
$std->error( array( "LEVEL" => 1, "MSG" => "no_avatar_selected" ) );
}
}
else
{
if ( !preg_match( "/^http:\\/\\//i", $ibforums->input['url_avatar'] ) )
{
$std->error( array( "LEVEL" => 1, "MSG" => "avatar_invalid_url" ) );
}
$ext = explode( "|", $ibforums->vars['avatar_ext'] );
$checked = 0;
$av_ext = preg_replace( "/^.*\\.(\\S+)\$/", "\\1", $ibforums->input['url_avatar'] );
foreach ( $ext as $v )
{
if ( strtolower( $v ) == strtolower( $av_ext ) )
{
$checked = 1;
}
}
if ( $checked != 1 )
{
$std->error( array( "LEVEL" => 1, "MSG" => "avatar_invalid_ext" ) );
}
$w = $ibforums->input['Avatar_width'];
$h = $ibforums->input['Avatar_height'];
list( $aw, $ah ) = explode( "x", $ibforums->vars['avatar_dims'] );
if ( !$w || $w == "" || !$h || $h == "" )
{
$this_dims = @getimagesize( $ibforums->input['url_avatar'] );
if ( $aw < $this_dims[0] || $ah < $this_dims[1] )
{
if ( $this_dims[1] < $this_dims[0] )
{
$multiplier = $aw / $this_dims[0];
$this_dims[0] = $aw;
$this_dims[1] = ceil( $this_dims[1] * $multiplier );
$w = $this_dims[0];
$h = $this_dims[1];
}
else if ( $this_dims[0] < $this_dims[1] )
{
$multiplier = $ah / $this_dims[1];
$this_dims[0] = ceil( $this_dims[0] * $multiplier );
$this_dims[1] = $ah;
$w = $this_dims[0];
$h = $this_dims[1];
}
else
{
$w = $aw;
$h = $ah;
}
}
else if ( !$this_dims[0] || $this_dims[0] == "" || !$this_dims[1] || $this_dims[1] == "" )
{
$w = $aw;
$h = $ah;
}
else
{
$w = $this_dims[0];
$h = $this_dims[1];
}
}
else
{
$w = $aw < $w ? $aw : $w;
$h = $ah < $h ? $ah : $h;
}
$real_dims = $w."x".$h;
$real_choice = $ibforums->input['url_avatar'];
if ( preg_match( "/^upload:/", $this->class->member['avatar'] ) )
{
$remove_file = preg_replace( "/^upload:/", "", $this->class->member['avatar'] );
@unlink( $ibforums->vars['upload_dir']."/".$remove_file );
}
}
}
else
{
if ( preg_match( "/^upload:/", $this->class->member['avatar'] ) )
{
$remove_file = preg_replace( "/^upload:/", "", $this->class->member['avatar'] );
@unlink( $ibforums->vars['upload_dir']."/".$remove_file );
}
$real_choice = "noavatar";
}
}
$DB->query( "UPDATE ibf_members SET avatar='{$real_choice}', avatar_size='{$real_dims}' WHERE id='".$this->class->member['id']."'" );
$redirect = "";
if ( $HTTP_POST_VARS['cat'] )
{
$redirect .= "&cat=".$HTTP_POST_VARS['cat'];
}
if ( $HTTP_POST_VARS['p'] )
{
$redirect .= "&p=".$HTTP_POST_VARS['p'];
}
$print->redirect_screen( "头像已经更新", "act=UserCP&CODE=24".$redirect );
}
function do_profile( )
{
global $ibforums;
global $DB;
global $std;
global $print;
global $HTTP_POST_VARS;
if ( $HTTP_POST_VARS['act'] == "" )
{
$std->error( array( "LEVEL" => 1, "MSG" => "complete_form" ) );
}
$custom_fields = array( );
$DB->query( "SELECT * from ibf_pfields_data WHERE fedit=1" );
while ( $row = $DB->fetch_row( ) )
{
if ( $row['freq'] == 1 && $HTTP_POST_VARS["field_".$row['fid']] == "" )
{
$std->error( array( "LEVEL" => 1, "MSG" => "complete_form" ) );
}
if ( 0 < $row['fmaxinput'] && $row['fmaxinput'] < strlen( $HTTP_POST_VARS["field_".$row['fid']] ) )
{
$std->error( array(
"LEVEL" => 1,
"MSG" => "cf_to_long",
"EXTRA" => $row['ftitle']
) );
}
$custom_fields["field_".$row['fid']] = str_replace( "<br>", "\n", $ibforums->input["field_".$row['fid']] );
}
if ( $ibforums->vars['max_interest_length'] < strlen( $HTTP_POST_VARS['Interests'] ) && $ibforums->vars['max_interest_length'] )
{
$std->error( array( "LEVEL" => 1, "MSG" => "int_too_long" ) );
}
if ( $ibforums->vars['max_location_length'] < strlen( $HTTP_POST_VARS['Location'] ) && $ibforums->vars['max_location_length'] )
{
$std->error( array( "LEVEL" => 1, "MSG" => "loc_too_long" ) );
}
if ( 150 < strlen( $HTTP_POST_VARS['WebSite'] ) )
{
$std->error( array( "LEVEL" => 1, "MSG" => "web_too_long" ) );
}
if ( 150 < strlen( $HTTP_POST_VARS['Photo'] ) )
{
$std->error( array( "LEVEL" => 1, "MSG" => "photo_too_long" ) );
}
if ( $HTTP_POST_VARS['ICQNumber'] && !preg_match( "/^(?:\\d+)\$/", $HTTP_POST_VARS['ICQNumber'] ) )
{
$std->error( array( "LEVEL" => 1, "MSG" => "not_icq_number" ) );
}
if ( empty( $ibforums->vars['allow_dynamic_img'] ) && preg_match( "/[?&;]/", $HTTP_POST_VARS['Photo'] ) )
{
$std->error( array( "LEVEL" => 1, "MSG" => "not_url_photo" ) );
}
$c_cnt = 0;
foreach ( array( "day", "month", "year" ) as $v )
{
if ( !empty( $ibforums->input[$v] ) )
{
++$c_cnt;
}
}
if ( 0 < $c_cnt && $c_cnt != 3 )
{
$std->error( array( "LEVEL" => 1, "MSG" => "calendar_not_all" ) );
}
if ( !preg_match( "#^http://#", $ibforums->input['WebSite'] ) )
{
$ibforums->input['WebSite'] = "http://".$ibforums->input['WebSite'];
}
$set = array(
"website" => $ibforums->input['WebSite'],
"icq_number" => $ibforums->input['ICQNumber'],
"aim_name" => $ibforums->input['AOLName'],
"yahoo" => $ibforums->input['YahooName'],
"msnname" => $ibforums->input['MSNName'],
"location" => $ibforums->input['Location'],
"interests" => $ibforums->input['Interests'],
"bday_day" => $ibforums->input['day'],
"bday_month" => $ibforums->input['month'],
"bday_year" => $ibforums->input['year']
);
if ( isset( $ibforums->input['member_title'] ) && $ibforums->vars['post_titlechange'] && $ibforums->vars['post_titlechange'] < $this->class->member['posts'] )
{
$set['title'] = $ibforums->input['member_title'];
}
$set_string = $DB->compile_db_update_string( $set );
$DB->query( "UPDATE ibf_members SET {$set_string} WHERE id='".$this->class->member['id']."'" );
if ( 0 < count( $custom_fields ) )
{
$DB->query( "SELECT member_id FROM ibf_pfields_content WHERE member_id='".$ibforums->member['id']."'" );
$test = $DB->fetch_row( );
if ( $test['member_id'] )
{
$db_string = $DB->compile_db_update_string( $custom_fields );
$DB->query( "UPDATE ibf_pfields_content SET {$db_string} WHERE member_id='".$ibforums->member['id']."'" );
}
else
{
$custom_fields['member_id'] = $ibforums->member['id'];
$db_string = $DB->compile_db_insert_string( $custom_fields );
$DB->query( "INSERT INTO ibf_pfields_content (".$db_string['FIELD_NAMES'].") VALUES(".$db_string['FIELD_VALUES'].")" );
}
}
$print->redirect_screen( $ibforums->lang['profile_edited'], "act=UserCP&CODE=01" );
}
function do_signature( )
{
global $ibforums;
global $DB;
global $std;
global $print;
global $HTTP_POST_VARS;
if ( $HTTP_POST_VARS['act'] == "" )
{
$std->error( array( "LEVEL" => 1, "MSG" => "complete_form" ) );
}
if ( $ibforums->vars['max_sig_length'] < strlen( $HTTP_POST_VARS['Post'] ) && $ibforums->vars['max_sig_length'] )
{
$std->error( array( "LEVEL" => 1, "MSG" => "sig_too_long" ) );
}
$ibforums->input['Post'] = $this->class->parser->convert( array(
"TEXT" => $ibforums->input['Post'],
"SMILIES" => 0,
"CODE" => $ibforums->vars['sig_allow_ibc'],
"HTML" => $ibforums->vars['sig_allow_html'],
"SIGNATURE" => 1
) );
if ( $this->class->parser->error != "" )
{
$std->error( array(
"LEVEL" => 1,
"MSG" => $this->class->parser->error
) );
}
$ibforums->input['Post'] = preg_replace( "/'/", "\\'", $ibforums->input['Post'] );
$DB->query( "UPDATE ibf_members SET signature='".$ibforums->input['Post']."' WHERE id ='".$this->class->member['id']."'" );
$std->boink_it( $this->class->base_url."&act=UserCP&CODE=22" );
exit( );
}
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -