func_usercp.php

来自「sabreipb 2.1.6 utf-8中文版本!」· PHP 代码 · 共 1,800 行 · 第 1/4 页

PHP
1,800 行
字号
				$im['img_height'] = $h > $p_height ? $p_height : $h;			}						//-----------------------------------------			// Remove any uploaded images..			//-----------------------------------------						$this->bash_uploaded_avatars($this->ipsclass->member['id']);						$real_choice = $this->ipsclass->input['url_avatar'];			$real_dims   = $im['img_width'].'x'.$im['img_height'];			$real_type   = 'url';		}				//-----------------------------------------		// Update the DB		//-----------------------------------------				$this->ipsclass->DB->do_update( 'member_extra', array( 'avatar_location' => $real_choice, 'avatar_size' => $real_dims, 'avatar_type' => $real_type ), 'id='.$this->ipsclass->member['id'] );				$this->ipsclass->print->redirect_screen( $this->ipsclass->lang['av_c_up'], "act=UserCP&CODE=24" );		}			function do_profile()	{		//-----------------------------------------		// Check for bad entry		//-----------------------------------------				if ($_POST['act'] == "")		{			$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'complete_form' ) );		}				//-----------------------------------------        // Nawty, Nawty!        //-----------------------------------------                if ($this->ipsclass->input['auth_key'] != $this->class->md5_check )		{			$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'del_post') );		}				//-----------------------------------------		// Custom profile field stuff		//-----------------------------------------				require_once( ROOT_PATH.'sources/classes/class_custom_fields.php' );    	$fields = new custom_fields( $this->ipsclass->DB );    	    	$fields->member_id   = $this->ipsclass->member['id'];    	$fields->mem_data_id = $this->ipsclass->member['id'];    	$fields->cache_data  = $this->ipsclass->cache['profilefields'];    	$fields->admin       = intval($this->ipsclass->member['g_access_cp']);    	$fields->supmod      = intval($this->ipsclass->member['g_is_supmod']);    	    	$fields->init_data();    	$fields->parse_to_save();				//-----------------------------------------		// Check...		//-----------------------------------------				if ( count( $fields->error_fields['empty'] ) )		{			$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'complete_form', 'EXTRA' => $fields->error_fields['empty'][0]['pf_title'] ) );		}				if ( count( $fields->error_fields['invalid'] ) )		{			$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'complete_form', 'EXTRA' => $fields->error_fields['invalid'][0]['pf_title'] ) );		}				if ( count( $fields->error_fields['toobig'] ) )		{			$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'cf_to_long', 'EXTRA' => $fields->error_fields['toobig'][0]['pf_title'] ) );		}				//-----------------------------------------				if ( (strlen($_POST['Interests']) > $this->ipsclass->vars['max_interest_length']) and ($this->ipsclass->vars['max_interest_length']) )		{			$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'int_too_long' ) );		}		//-----------------------------------------		if ( (strlen($_POST['Location']) > $this->ipsclass->vars['max_location_length']) and ($this->ipsclass->vars['max_location_length']) )		{			$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'loc_too_long' ) );		}		//-----------------------------------------		if (strlen($_POST['WebSite']) > 150)		{			$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'web_too_long' ) );		}		//-----------------------------------------		if (strlen($_POST['Photo']) > 150) 		{			$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'photo_too_long' ) );		}		//-----------------------------------------		if ( ($_POST['ICQNumber']) && ( ! preg_match( "/^[\d\-]+$/", $_POST['ICQNumber'] ) ) )		{			$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'not_icq_number' ) );		}						//-----------------------------------------		// make sure that either we entered		// all calendar fields, or we left them		// all blank		//-----------------------------------------				$c_cnt = 0;				foreach ( array('day','month','year') as $v )		{			if (!empty($this->ipsclass->input[$v]))			{				$c_cnt++;			}		}				if ( ($c_cnt > 0) and ($c_cnt != 3) )		{			$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'calendar_not_all' ) );		}				if ( ! preg_match( "#^http://#", $this->ipsclass->input['WebSite'] ) )		{			$this->ipsclass->input['WebSite'] = 'http://'.$this->ipsclass->input['WebSite'];		}				//-----------------------------------------		// Start off our array		//-----------------------------------------				$set = array(  					   'bday_day'    => $this->ipsclass->input['day'],					   'bday_month'  => $this->ipsclass->input['month'],					   'bday_year'   => $this->ipsclass->input['year'],					);							$bet = array(  'website'     => $this->ipsclass->input['WebSite'],					   'icq_number'  => $this->ipsclass->input['ICQNumber'],					   'aim_name'    => $this->ipsclass->input['AOLName'],					   'yahoo'       => $this->ipsclass->input['YahooName'],					   'msnname'     => $this->ipsclass->input['MSNName'],					   'location'    => $this->ipsclass->input['Location'],					   'interests'   => $this->ipsclass->input['Interests'],					);				//-----------------------------------------		// check to see if we can enter a member title		// and if one is entered, update it.		//-----------------------------------------				if ( (isset($this->ipsclass->input['member_title'])) and ( isset($this->ipsclass->vars['post_titlechange']) ) and ( $this->ipsclass->member['posts'] >= $this->ipsclass->vars['post_titlechange']) )		{			$set['title'] = $this->ipsclass->input['member_title'];		}				//-----------------------------------------		// Update the DB		//-----------------------------------------				$this->ipsclass->DB->force_data_type = array( 'title' => 'string' );				$this->ipsclass->DB->do_update( 'members'     , $set, 'id='.$this->ipsclass->member['id'] );				$this->ipsclass->DB->force_data_type = array( 'icq_number' => 'string' );				$this->ipsclass->DB->do_update( 'member_extra', $bet, 'id='.$this->ipsclass->member['id'] );				//-----------------------------------------		// Save the profile stuffy wuffy		//-----------------------------------------				if ( count( $fields->out_fields ) )		{			//-----------------------------------------			// Do we already have an entry in			// the content table?			//-----------------------------------------						$test = $this->ipsclass->DB->simple_exec_query( array( 'select' => 'member_id', 'from' => 'pfields_content', 'where' => 'member_id='.$this->ipsclass->member['id'] ) );						if ( $test['member_id'] )			{				//-----------------------------------------				// We have it, so simply update				//-----------------------------------------								$this->ipsclass->DB->do_update( 'pfields_content', $fields->out_fields, 'member_id='.$this->ipsclass->member['id'] );			}			else			{				$fields->out_fields['member_id'] = $this->ipsclass->member['id'];								$this->ipsclass->DB->do_insert( 'pfields_content', $fields->out_fields );			}		}				//----------------------------------------- 		// Use sync module? 		//----------------------------------------- 		 		if ( USE_MODULES == 1 )		{			$bet['id'] = $this->ipsclass->member['id'];			$bet['name'] = $this->ipsclass->member['members_display_name'];			$this->class->modules->register_class($this);    		$this->class->modules->on_profile_update($bet, $custom_fields);   		}				// Return us!				$this->ipsclass->print->redirect_screen( $this->ipsclass->lang['profile_edited'], "act=UserCP&CODE=01" );	}		/*-------------------------------------------------------------------------*/	// SIGNATURE: SAVE	/*-------------------------------------------------------------------------*/		function do_signature()	{		//-----------------------------------------		// Check length		//-----------------------------------------				if ( (strlen($_POST['Post']) > $this->ipsclass->vars['max_sig_length']) and ($this->ipsclass->vars['max_sig_length']) )		{			$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'sig_too_long' ) );		}				//-----------------------------------------		// Check key		//-----------------------------------------				if ( $_POST['key'] != $this->ipsclass->return_md5_check() )		{			$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'del_post' ) );		}				//-----------------------------------------		// Remove board tags		//-----------------------------------------				$this->ipsclass->input['Post'] = $this->ipsclass->remove_tags( $this->ipsclass->input['Post'] );				//-----------------------------------------		// Post process the editor		// Now we have safe HTML and bbcode		//-----------------------------------------				$this->ipsclass->input['Post'] = $this->class->han_editor->process_raw_post( 'Post' );				//-----------------------------------------		// Parse post		//-----------------------------------------				$this->class->parser->parse_smilies   = 0;		$this->class->parser->parse_html      = intval($this->ipsclass->vars['sig_allow_html']);		$this->class->parser->parse_bbcode    = intval($this->ipsclass->vars['sig_allow_ibc']);		$this->ipsclass->input['Post']        = $this->class->parser->pre_db_parse( $this->ipsclass->input['Post'] );				if ($this->class->parser->error != "")		{			$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => $this->class->parser->error) );		}				//-----------------------------------------		// Write it to the DB.		//-----------------------------------------				if ( $mem = $this->ipsclass->DB->simple_exec_query( array( 'select' => 'id', 'from' => 'member_extra', 'where' => 'id='.$this->ipsclass->member['id'] ) ) )		{			$this->ipsclass->DB->do_update( 'member_extra', array( 'signature' => $this->ipsclass->input['Post'] ), 'id='.$this->ipsclass->member['id'] );		}		else		{			$this->ipsclass->DB->do_insert( 'member_extra', array( 'id' => $this->ipsclass->member['id'], 'signature' => $this->ipsclass->input['Post'] ) );		}						//-----------------------------------------		// Member sync?		//-----------------------------------------				if ( USE_MODULES == 1 ) 		{  			$this->class->modules->register_class($this);     		$this->class->modules->on_signature_update($this->ipsclass->member, $this->ipsclass->input['Post']);    	}				//-----------------------------------------		// Buh BYE:		//-----------------------------------------				$this->ipsclass->boink_it($this->ipsclass->base_url."act=UserCP&CODE=22");	}		/*-------------------------------------------------------------------------*/	// ADD IGNORE USERS	/*-------------------------------------------------------------------------*/		function ignore_user_add()	{		$temp_users = array();				//----------------------------------------- 		// Stored as userid,userid,userid 		//----------------------------------------- 		 		$ignored_users = explode( ',', $this->ipsclass->member['ignored_users'] ); 		 		foreach( $ignored_users as $id ) 		{ 			if ( intval($id) ) 			{ 				$temp_users[] = $id; 			} 		} 	 		$final_string = ",".implode( ',', $temp_users ).","; 		 		$final_string = preg_replace( "/,{2,}/", ",", str_replace( " ", "", $final_string ) ); 		 		$lookup_meh_pants = array(); 		 		if ( $this->ipsclass->input['newbox_1'] ) 		{ 			$lookup_meh_pants[] = "'".strtolower(str_replace( '|', '|', $this->ipsclass->input['newbox_1']))."'"; 		} 		if ( $this->ipsclass->input['newbox_2'] ) 		{ 			$lookup_meh_pants[] = "'".strtolower(str_replace( '|', '|', $this->ipsclass->input['newbox_2']))."'"; 		} 		if ( $this->ipsclass->input['newbox_3'] ) 		{ 			$lookup_meh_pants[] = "'".strtolower(str_replace( '|', '|', $this->ipsclass->input['newbox_3']))."'"; 		}				if ( count($lookup_meh_pants) )		{			//-----------------------------------------			// See if we have any MEMBRES IN THE DB			//-----------------------------------------						$this->ipsclass->DB->simple_construct( array( 'select' => 'id, name, mgroup', 'from' => 'members', 'where' => "LOWER(members_display_name) IN (".implode(",", $lookup_meh_pants ).")" ) );			$this->ipsclass->DB->simple_exec();						while( $s = $this->ipsclass->DB->fetch_row() )			{				if ( strstr( $this->ipsclass->vars['cannot_ignore_groups'], ','.$s['mgroup'].',' ) )				{					continue;				}								if ( strstr( $final_string, ','.$s['id'].',') )				{					continue;				}									if ( $s['id'] != $this->ipsclass->member['id'] )				{					$members[ $s['name'] ] = $s['id'];				}			}						if ( count($members ) )			{				foreach( $members as $name => $id )				{					foreach( array( 1,2,3 ) as $hehe )					{						if ( strtolower($name) == strtolower($this->ipsclass->input[ 'newbox_'.$hehe ]) )						{							$this->ipsclass->input[ 'newbox_'.$hehe ] = "";						}					}										$final_string .= $id.",";				}								$this->ipsclass->DB->do_update( 'members', array( 'ignored_users' => $final_string ), 'id='.$this->ipsclass->member['id'] );			}						$cant_find = array();						foreach( array( 1,2,3 ) as $hehe )			{				if ( $this->ipsclass->input[ 'newbox_'.$hehe ] != "" )				{					$cant_find[] = $this->ipsclass->input[ 'newbox_'.$hehe ];				}			}						if ( count($cant_find) )			{				$this->ipsclass->member['ignored_users'] = $final_string;								$this->class->ignore_user_splash( sprintf( $this->ipsclass->lang['mi5_cantfind'], implode( ",", $cant_find ) ) );				return;			}		}				$this->ipsclass->member['ignored_users'] = $final_string;				$this->class->ignore_user_splash();		return;	}			function ignore_user_remove()	{		$temp_users = array();				//----------------------------------------- 		// Stored as userid,userid,userid 		//----------------------------------------- 		 		$ignored_users = explode( ',', $this->ipsclass->member['ignored_users'] ); 		 		foreach( $ignored_users as $id ) 		{ 			if ( intval($id) and ( $id != $this->ipsclass->input['id'] ) ) 			{ 				$temp_users[] = $id; 			} 		} 		 		$final_string = ",".implode( ',', $temp_users ).","; 		 		$final_string = preg_replace( "/,{2,}/", ",", str_replace( " ", "", $final_string ) ); 		 		$this->ipsclass->DB->do_update( 'members', array( 'ignored_users' => $final_string ), 'id='.$this->ipsclass->member['id'] ); 		 		$this->ipsclass->member['ignored_users'] = $final_string; 				$this->class->ignore_user_splash();		return true;			}}?>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?