profile.php

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

PHP
967
字号
				{					if ($row['macro_value'] != "")					{						$html = str_replace( "<{".$row['macro_value']."}>", $row['macro_replace'], $html );					}				}			}						//-----------------------------------------			// Images			//-----------------------------------------						$html = str_replace( "<#IMG_DIR#>", $this->ipsclass->skin['_imagedir'], $html );			    		if ( ! $this->ipsclass->vars['ipb_img_url'] )			{				$this->ipsclass->vars['ipb_img_url'] = preg_replace( "#/$#", "", $this->ipsclass->vars['board_url'] ) . '/';			}						$html = preg_replace( "#img\s+?src=[\"']style_(images|avatars|emoticons)(.+?)[\"'](.+?)?".">#is", "img src=\"".$this->ipsclass->vars['ipb_img_url']."style_\\1\\2\"\\3>", $html );    		    		//-----------------------------------------    		// Download    		//-----------------------------------------    					@header("Content-type: unknown/unknown");			@header("Content-Disposition: attachment; filename={$member['members_display_name']}.html");			print $html;			exit();    	}    	else    	{			$html  = $this->ipsclass->compiled_templates['skin_profile']->show_card( $member['members_display_name'], $photo, $info );						$this->ipsclass->print->pop_up_window( $this->ipsclass->lang['photo_title'], $html );    	}    } 	 	/*-------------------------------------------------------------------------*/ 	// VIEW PHOTO: 	/*-------------------------------------------------------------------------*/ 	 	function show_photo() 	{		$info = array(); 		 		if ($this->ipsclass->member['g_mem_info'] != 1) 		{ 			$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_permission' ) );    	} 		 		//-----------------------------------------    	// Check input..    	//-----------------------------------------    	    	$id = intval($this->ipsclass->input['MID']);    	    	if ( empty($id) )    	{    		$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'incorrect_use' ) );    	}    	    	$this->load_photo($id);    	    	if ( $this->has_photo == TRUE )    	{    		$photo = $this->ipsclass->compiled_templates['skin_profile']->get_photo( $this->show_photo, $this->show_width, $this->show_height );    	}    	else    	{    		$photo = "<{NO_PHOTO}>";    	}    	    	$html  = $this->ipsclass->compiled_templates['skin_profile']->show_photo( $this->photo_member['members_display_name'], $photo );    	    	$this->ipsclass->print->pop_up_window( $this->ipsclass->lang['photo_title'], $html );    }        /*-------------------------------------------------------------------------*/ 	// FUNC: RETURN PHOTO 	/*-------------------------------------------------------------------------*/        function load_photo($id, $member=array())    {		$this->show_photo  = "";    	$this->show_height = "";    	$this->show_width  = "";    	    	if ( ! isset( $member['photo_type'] ) )    	{			$this->ipsclass->DB->cache_add_query( 'profile_get_all', array( 'mid' => $id ) );    	    		$this->ipsclass->DB->cache_exec_query();						$this->photo_member = $this->ipsclass->DB->fetch_row();    	}    	else    	{    		$this->photo_member = $member;    	}    	    	if ( $this->photo_member['photo_type'] and $this->photo_member['photo_location'] )    	{    		$this->has_photo = TRUE;    		    		list( $show_width, $show_height ) = explode( ",", $this->photo_member['photo_dimensions'] );    		    		if ($this->photo_member['photo_type'] == 'url')    		{    			$this->show_photo = $this->photo_member['photo_location'];    		}    		else    		{    			$this->show_photo = $this->ipsclass->vars['upload_url']."/".$this->photo_member['photo_location'];    		}    		    		if ( $show_width > 0 )    		{    			$this->show_width = "width='$show_width'";    		}    		    		if ( $show_height > 0 )    		{    			$this->show_height = "height='$show_height'";    		}    	}    }     	/*-------------------------------------------------------------------------*/ 	// VIEW MAIN PROFILE: 	/*-------------------------------------------------------------------------*/ 	 	function view_profile() 	{		$this->ipsclass->load_template('skin_topic'); 		 		$info = array(); 		 		if ($this->ipsclass->member['g_mem_info'] != 1) 		{ 			$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_permission' ) );    	} 		 		//-----------------------------------------    	// Check input..    	//-----------------------------------------    	    	$id = intval($this->ipsclass->input['MID']);    	    	if ( ! $id )    	{    		$this->ipsclass->boink_it( $this->ipsclass->base_url );    	}    	    	//-----------------------------------------    	// Get all member information    	//-----------------------------------------    	    	$this->ipsclass->DB->cache_add_query( 'profile_get_all', array( 'mid' => $id ) );    	    	$this->ipsclass->DB->cache_exec_query();    	    	$member = $this->ipsclass->DB->fetch_row();    	    	if ( empty( $member['id'] ) )    	{    		$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'incorrect_use' ) );    	}    	    	//-----------------------------------------    	// Most posted forum    	//-----------------------------------------    	    	$forum_ids = array('0');    	    	foreach( $this->ipsclass->forums->forum_by_id as $i => $r )    	{    		if ( $this->ipsclass->check_perms($r['read_perms']) == TRUE )    		{    			$forum_ids[] = $r['id'];    		}    	}    	    	$this->ipsclass->DB->cache_add_query( 'profile_get_favourite', array( 'mid' => $member['id'], 'fid_array' => $forum_ids ) );    	    	$this->ipsclass->DB->cache_exec_query();    	    	$favourite   = $this->ipsclass->DB->fetch_row();    	    	//-----------------------------------------    	// Post count stats    	//-----------------------------------------    	    	$percent = 0;    	    	$this->ipsclass->DB->simple_construct( array( 'select' => 'COUNT(*) as total_posts',													  'from'   => 'posts',													  'where'  => "author_id={$member['id']}" ) );		$this->ipsclass->DB->simple_exec();		    	$total_posts = $this->ipsclass->DB->fetch_row();    	    	$board_posts = $this->ipsclass->cache['stats']['total_topics'] + $this->ipsclass->cache['stats']['total_replies'];    	    	if ($total_posts['total_posts'] > 0)    	{    		$percent = round( $favourite['f_posts'] / $total_posts['total_posts'] * 100 );    	}    	    	if ($member['posts'] and $board_posts)    	{    		$info['posts_day'] = round( $member['posts'] / (((time() - $member['joined']) / 86400)), 1);    		$info['total_pct'] = sprintf( '%.2f', ( $member['posts'] / $board_posts * 100 ) );    	}    	    	if ($info['posts_day'] > $member['posts'])    	{    		$info['posts_day'] = $member['posts'];    	}    	    	//-----------------------------------------    	// Pips / Icon    	//-----------------------------------------    	    	$pips = 0;				foreach($this->ipsclass->cache['ranks'] as $k => $v)		{			if ($member['posts'] >= $v['POSTS'])			{				if (!$member['title'])				{					$member['title'] = $this->ipsclass->cache['ranks'][ $k ]['TITLE'];				}								$pips = $v['PIPS'];				break;			}		}				if ($this->ipsclass->cache['group_cache'][ $member['mgroup'] ]['g_icon'])		{			$member['member_rank_img'] = $this->ipsclass->compiled_templates['skin_topic']->member_rank_img($this->ipsclass->cache['group_cache'][ $member['mgroup'] ]['g_icon']);		}		else if ($pips)		{			if ( is_numeric( $pips ) )			{				for ($i = 1; $i <= $pips; ++$i)				{					$member['member_rank_img'] .= "<{A_STAR}>";				}			}			else			{				$member['member_rank_img'] = $this->ipsclass->compiled_templates['skin_topic']->member_rank_img('style_images/<#IMG_DIR#>/folder_team_icons/'.$pips);			}		}    	    	//-----------------------------------------    	// More info...    	//-----------------------------------------    	    	$info['posts']       = $member['posts'] ? $member['posts'] : 0;    	$info['name']        = $member['members_display_name'];    	$info['mid']         = $member['id'];    	$info['fav_forum']   = $this->ipsclass->cache['forum_cache'][ $favourite['forum_id'] ]['name'];    	$info['fav_id']      = $favourite['forum_id'];    	$info['fav_posts']   = $favourite['f_posts'];    	$info['percent']     = $percent;    	$info['group_title'] = $this->ipsclass->cache['group_cache'][ $member['mgroup'] ]['g_title'];    	$info['board_posts'] = $board_posts;    	$info['joined']      = $this->ipsclass->get_date( $member['joined'], 'JOINED' );    	$info['last_active'] = $this->ipsclass->get_date( $member['last_activity'], 'SHORT' );    	    	$info['member_title'] = $member['title']     ? $member['title']      : $this->ipsclass->lang['no_info'];    	    	$info['aim_name']             = $member['aim_name']   ? $member['aim_name']   : $this->ipsclass->lang['no_info'];    	$info['icq_number']           = $member['icq_number'] ? $member['icq_number'] : $this->ipsclass->lang['no_info'];    	$info['yahoo']                = $member['yahoo']      ? $member['yahoo']      : $this->ipsclass->lang['no_info'];    	$info['location']             = $member['location']   ? $member['location']   : $this->ipsclass->lang['no_info'];    	$info['interests']            = $member['interests']  ? $member['interests']  : $this->ipsclass->lang['no_info'];    	$info['msn_name']             = $member['msnname']    ? $member['msnname']    : $this->ipsclass->lang['no_info'];    	$info['member_rank_img']      = $member['member_rank_img'];    	$info['has_blog']             = $member['has_blog'];    	$info['members_display_name'] = $member['members_display_name'];    	    	//-----------------------------------------		// Online, offline?		//-----------------------------------------				$cut_off = ($this->ipsclass->vars['au_cutoff'] != "") ? $this->ipsclass->vars['au_cutoff'] * 60 : 900;		$time_limit    = time() - $cut_off;				$info['online_status_indicator'] = '<{PB_USER_OFFLINE}>';		$info['online_extra']            = '('.$this->ipsclass->lang['online_offline'].')';				list( $be_anon, $loggedin ) = explode( '&', $member['login_anonymous'] );				$bypass_anon = 0;				if ( ($this->ipsclass->member['mgroup'] == $this->ipsclass->vars['admin_group']) and ($this->ipsclass->vars['disable_admin_anon'] != 1) )		{			$bypass_anon = 1;		}				//-----------------------------------------		// DO it		//-----------------------------------------				if ( ( $member['last_visit'] > $time_limit or $member['last_activity'] > $time_limit ) AND $loggedin == 1 AND ( $be_anon != 1 OR $bypass_anon == 1 ) )		{			$info['online_status_indicator'] = '<{PB_USER_ONLINE}>';						//-----------------------------------------			// Where?			//-----------------------------------------						$where = "";						//-----------------------------------------			// Module?			//-----------------------------------------

⌨️ 快捷键说明

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