usercp.php

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

PHP
1,953 行
字号
 		{ 			if ( intval($id) ) 			{ 				$temp_users[] = $id; 			} 		} 		 		if ( count($temp_users) ) 		{ 			$this->ipsclass->DB->simple_construct( array( 'select' => 'id, name, members_display_name, mgroup, posts',														  'from'   => 'members',														  'where'  => "id IN (".implode(",",$temp_users).")"												 )      );								 			$this->ipsclass->DB->simple_exec();		 			while ( $m = $this->ipsclass->DB->fetch_row() ) 			{ 				$m['g_title'] = $this->ipsclass->cache['group_cache'][ $m['mgroup'] ]['g_title']; 				$m['prefix']  = $this->ipsclass->cache['group_cache'][ $m['mgroup'] ]['prefix']; 				$m['suffix']  = $this->ipsclass->cache['group_cache'][ $m['mgroup'] ]['suffix']; 				 				if ( $this->ipsclass->vars['cannot_ignore_groups'] )				{					if ( strstr( $this->ipsclass->vars['cannot_ignore_groups'], ','.$m['mgroup'].',' ) )					{						continue;					} 				} 				 				$final_users[ $m['id'] ] = $m; 			} 		} 		 		$this->output .= $this->ipsclass->compiled_templates['skin_ucp']->iu_start(); 		 		foreach( $final_users as $id => $member ) 		{ 			$this->output .= $this->ipsclass->compiled_templates['skin_ucp']->iu_populated_row($member); 		} 		 		$this->output .= $this->ipsclass->compiled_templates['skin_ucp']->iu_add_new(); 		 	} 	 	 	/*-------------------------------------------------------------------------*/ 	// Photo: 	// 	// Change / Add / Edit Users Photo 	/*-------------------------------------------------------------------------*/ 	 	function photo() 	{		$this->page_title = $this->ipsclass->lang['t_welcome']; 		$this->nav        = array( "<a href='".$this->ipsclass->base_url."act=UserCP&amp;CODE=00'>".$this->ipsclass->lang['t_title']."</a>" ); 		 		if ( $this->ipsclass->member['g_photo_max_vars'] == "" or $this->ipsclass->member['g_photo_max_vars'] == "::" ) 		{ 			// Nothing set up yet... 			 			$this->output .= $this->ipsclass->compiled_templates['skin_ucp']->dead_section(); 			return; 		} 		 		//----------------------------------------- 		// SET DIMENSIONS 		//----------------------------------------- 		 		list($p_max, $p_width, $p_height) = explode( ":", $this->ipsclass->member['g_photo_max_vars'] ); 		 		if ( $p_max ) 		{ 			$this->ipsclass->lang['pph_max']  = sprintf( $this->ipsclass->lang['pph_max'], $p_max ); 			$this->ipsclass->lang['pph_max'] .= sprintf( $this->ipsclass->lang['pph_max2'], $p_width, $p_height ); 		} 		else 		{ 			$this->ipsclass->lang['pph_max'] = sprintf( $this->ipsclass->lang['pph_max2'], $p_width, $p_height ); 		} 		 		list($p_w, $p_h) = explode( ",", $this->ipsclass->member['photo_dimensions'] ); 		 		$cur_photo = $this->ipsclass->lang['pph_none']; 		$cur_type  = ""; 		$url_photo = ""; 		 		$width  = ( $p_w ) ? "width='$p_w'"  : ""; 		$height = ( $p_h ) ? "height='$p_h'" : ""; 		 		$show_size = str_replace( ",", " X ", $this->ipsclass->member['photo_dimensions'] ); 		 		if( $show_size ) 		{	 		$show_size = "(".$show_size.")"; 		} 		 		//----------------------------------------- 		// TYPE? 		//----------------------------------------- 		 		if ( $this->ipsclass->member['photo_type'] == 'upload' ) 		{ 			$cur_type  = $this->ipsclass->lang['pph_t_upload']; 			$cur_photo = "<img src=\"".$this->ipsclass->vars['upload_url']."/".$this->ipsclass->member['photo_location']."\" $width $height alt='Photo' />"; 		} 		else if ( $this->ipsclass->member['photo_type'] == 'url' ) 		{ 			$cur_type  = $this->ipsclass->lang['pph_t_url']; 			$cur_photo = "<img src=\"".$this->ipsclass->member['photo_location']."\" $width $height alt='Photo' />"; 			$url_photo = $this->ipsclass->member['photo_location']; 		} 		 		//----------------------------------------- 		// SHOW THE FORM 		//----------------------------------------- 		 		$this->output .= $this->ipsclass->compiled_templates['skin_ucp']->photo_page($cur_photo, $cur_type, $url_photo, $show_size, $this->md5_check); 		 		if ($p_max) 		{ 			$this->output = str_replace( "<!--IPB.UPLOAD-->", $this->ipsclass->compiled_templates['skin_ucp']->photo_page_upload( 500000 ), $this->output ); 		} 		 		$size_html = $this->ipsclass->vars['disable_ipbsize'] ? $this->ipsclass->compiled_templates['skin_ucp']->photo_page_mansize() : $this->ipsclass->compiled_templates['skin_ucp']->photo_page_autosize(); 		 		$this->output = str_replace( "<!--IPB.SIZE-->", $size_html, $this->output ); 		 	} 	 	 	/*-------------------------------------------------------------------------*/ 	// Forum tracker 	// 	// What, you need a definition with that title? 	// What are you doing poking around in the code for anyway? 	/*-------------------------------------------------------------------------*/ 	 	function remove_forum_tracker() 	{		$ids = array(); 		 		foreach ($this->ipsclass->input as $key => $value) 		{ 			if ( preg_match( "/^id-(\d+)$/", $key, $match ) ) 			{ 				if ($this->ipsclass->input[$match[0]]) 				{ 					$ids[] = $match[1]; 				} 			} 		} 		 		$allowed = array( 'none', 'immediate', 'delayed', 'daily', 'weekly' ); 		 		//----------------------------------------- 		// what we doing? 		//----------------------------------------- 		 		if ( count($ids) > 0 ) 		{ 			if ( $this->ipsclass->input['trackchoice'] == 'unsubscribe' ) 			{ 				$this->ipsclass->DB->simple_exec_query( array( 'delete' => 'forum_tracker', 'where' => "member_id={$this->ipsclass->member['id']} and forum_id IN (".implode( ",", $ids ).")" ) ); 			} 			else if ( in_array( $this->ipsclass->input['trackchoice'], $allowed ) ) 			{ 				$this->ipsclass->DB->do_update( 'forum_tracker', array( 'forum_track_type' => $this->ipsclass->input['trackchoice'] ), "member_id={$this->ipsclass->member['id']} and forum_id IN (".implode( ",", $ids ).")" ); 			} 		} 			 	    $this->ipsclass->boink_it($this->ipsclass->base_url."act=UserCP&CODE=50"); 		 	} 	 	function forum_tracker() 	{		//----------------------------------------- 		// Remap... 		//----------------------------------------- 		 		$remap = array( 'none'      => 'subs_none_title',						'immediate' => 'subs_immediate',						'delayed'   => 'subs_delayed',						'daily'     => 'subs_daily',						'weekly'    => 'subs_weekly'					  );					   		$this->output .= $this->ipsclass->compiled_templates['skin_ucp']->forum_subs_header(); 		 		//----------------------------------------- 		// Query the DB for the subby toppy-ics - at the same time 		// we get the forum and topic info, 'cos we rule. 		//----------------------------------------- 		 		$this->ipsclass->DB->cache_add_query( 'ucp_get_forum_tracker', array( 'mid' => $this->ipsclass->member['id'] ) );		$this->ipsclass->DB->cache_exec_query();		 		if ( $this->ipsclass->DB->get_num_rows() ) 		{ 			while( $forum = $this->ipsclass->DB->fetch_row() ) 			{ 				//----------------------------------------- 				// Got perms to see this forum? 				//----------------------------------------- 				 				if ( ! $this->ipsclass->forums->forum_by_id[ $forum['id'] ] ) 				{ 					continue; 				} 				 				$forum['folder_icon'] = $this->ipsclass->forums->forums_new_posts($forum); 				 				$forum['last_post'] = $this->ipsclass->get_date($forum['last_post'], 'LONG');										$forum['last_topic'] = $this->ipsclass->lang['f_none']; 				 				$forum['last_title'] = str_replace( "&#33;" , "!", $forum['last_title'] );				$forum['last_title'] = str_replace( "&quot;", "\"", $forum['last_title'] );									if ( strlen($forum['last_title']) > 30 )				{					$forum['last_title'] = $this->ipsclass->utf8_trim(substr($forum['last_title'],0,27)) . "...";					$forum['last_title'] = preg_replace( '/&(#(\d+;?)?)?\.\.\.$/', '...', $forum['last_title'] );				}								if ($forum['password'] != "")				{					$forum['last_topic'] = $this->ipsclass->lang['f_none'];				}				else				{					$forum['last_topic'] = "<a href='{$this->ipsclass->base_url}showtopic={$forum['last_id']}&view=getlastpost'>{$forum['last_title']}</a>";				}			 											if ( isset($forum['last_poster_name']))				{					$forum['last_poster'] = $forum['last_poster_id'] ? "<a href='{$this->ipsclass->base_url}showuser={$forum['last_poster_id']}'>{$forum['last_poster_name']}</a>"																	 : $forum['last_poster_name'];				}				else				{					$forum['last_poster'] = $this->ipsclass->lang['f_none'];				}								$this->output .= $this->ipsclass->compiled_templates['skin_ucp']->forum_subs_row($forum, $remap[ $forum['forum_track_type'] ]);			}					}		else		{			$this->output .= $this->ipsclass->compiled_templates['skin_ucp']->forum_subs_none();		}				$this->output .= $this->ipsclass->compiled_templates['skin_ucp']->forum_subs_end(); 				$this->page_title = $this->ipsclass->lang['t_welcome']; 		$this->nav        = array( "<a href='".$this->ipsclass->base_url."act=UserCP&amp;CODE=00'>".$this->ipsclass->lang['t_title']."</a>" ); 		 	} 	 	 	/*-------------------------------------------------------------------------*/ 	// pass change: 	// 	// Change the users password. 	/*-------------------------------------------------------------------------*/ 	 	function pass_change() 	{ 		//-----------------------------------------    	// Do we have another URL that one needs    	// to visit to register?    	//-----------------------------------------    	    	$this->login_method = $this->ipsclass->DB->build_and_exec_query( array( 'select' => '*', 'from' => 'login_methods', 'where' => 'login_enabled=1' ) );    	    	if ( $this->login_method['login_maintain_url'] )    	{    		$this->ipsclass->boink_it( $this->login_method['login_maintain_url'] );    		exit();    	}    			$this->output    .= $this->ipsclass->compiled_templates['skin_ucp']->pass_change(); 		$this->page_title = $this->ipsclass->lang['t_welcome']; 		$this->nav        = array( "<a href='".$this->ipsclass->base_url."act=UserCP&amp;CODE=00'>".$this->ipsclass->lang['t_title']."</a>" ); 		 	} 	 	/*-------------------------------------------------------------------------*/ 	// PASSWORD CHAGE COMPLETE 	/*-------------------------------------------------------------------------*/ 	 	function do_pass_change() 	{		if ( $_POST['current_pass'] == "" or empty($_POST['current_pass']) ) 		{ 			$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'complete_form' ) ); 		} 		 		//----------------------------------------- 		// Check and trim 		//----------------------------------------- 		 		$cur_pass = trim($this->ipsclass->input['current_pass']); 		$new_pass = trim($this->ipsclass->input['new_pass_1']); 		$chk_pass = trim($this->ipsclass->input['new_pass_2']); 		 		if ( ( empty($new_pass) ) or ( empty($chk_pass) ) ) 		{ 			$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'complete_form' ) ); 		} 		 		if ($new_pass != $chk_pass) 		{ 			$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'pass_no_match' ) ); 		} 		 		//----------------------------------------- 		// Check password... 		//----------------------------------------- 		 		$this->ipsclass->converge->converge_load_member($this->ipsclass->member['email']); 		 		if ( $this->ipsclass->converge->converge_authenticate_member( md5($cur_pass) ) != TRUE )		{			$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'wrong_pass' ) );		} 		 		//----------------------------------------- 		// Create new password... 		//----------------------------------------- 		 		$md5_pass = md5($new_pass); 		 		//----------------------------------------- 		// Update the DB 		//----------------------------------------- 		 		$this->ipsclass->converge->converge_update_password( $md5_pass, $this->ipsclass->member['email'] ); 		 		//----------------------------------------- 		// Update members log in key... 		//----------------------------------------- 		 		$key  = $this->ipsclass->converge->generate_auto_log_in_key(); 		$this->ipsclass->DB->do_update( 'members', array( 'member_login_key' => $key ), 'id='.$this->ipsclass->member['id'] ); 		 		//----------------------------------------- 		// Use sync module? 		//----------------------------------------- 		 		if ( USE_MODULES == 1 )		{			$this->modules->register_class($this);    		$this->modules->on_pass_change($this->ipsclass->member['id'], $new_pass);   		} 		 		//----------------------------------------- 		// Redirect... 		//----------------------------------------- 		 		$this->ipsclass->print->redirect_screen( $this->ipsclass->lang['pass_redirect'], 'act=UserCP&CODE=00' ); 	} 	 	 	/*-------------------------------------------------------------------------*/ 	// email change: 	// 	// Change the users email address 	/*-------------------------------------------------------------------------*/ 	 	function email_change($msg="") 	{ 		//-----------------------------------------    	// Do we have another URL that one needs    	// to visit to register?    	//-----------------------------------------    	    	$this->login_method = $this->ipsclass->DB->build_and_exec_query( array( 'select' => '*', 'from' => 'login_methods', 'where' => 'login_enabled=1' ) );    	    	if ( $this->login_method['login_maintain_url'] )    	{    		$this->ipsclass->boink_it( $this->login_method['login_maintain_url'] );    		exit();    	}    			$txt = $this->ipsc

⌨️ 快捷键说明

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