Files
IPB/upload/sources/action_public/profile.php
T
2025-12-19 00:21:15 -08:00

969 lines
32 KiB
PHP

<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board 2.1.7
| =============================================
| by Matthew Mecham
| (c) 2001 - 2005 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| http://www.ibresource.ru/products/invisionpowerboard/
| Time: Tuesday 18th of July 2006 05:56:00 PM
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
| Licence Info: http://www.invisionboard.com/?license
| http://www.ibresource.ru/license
+---------------------------------------------------------------------------
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
+---------------------------------------------------------------------------
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
+---------------------------------------------------------------------------
| > $Date: 2006-03-06 14:58:13 +0000 (Mon, 06 Mar 2006) $
| > $Revision: 161 $
| > $Author: bfarber $
+---------------------------------------------------------------------------
|
| > User Profile functions
| > Module written by Matt Mecham
| > Date started: 28th February 2002
|
| > Module Version Number: 1.0.0
| > DBA Checked: Thu 20 May 2004
| > Quality Checked: Wed 15 Sept. 2004
+--------------------------------------------------------------------------
*/
/**
* Public Action Class: Profile
*
* @package InvisionPowerBoard
* @subpackage Public-Action
* @author Matt Mecham
* @copyright Invision Power Services, Inc.
* @version 2.1
*/
if ( ! defined( 'IN_IPB' ) )
{
/**
* Error checking
*/
print "<h1>Íåêîððåêòíûé àäðåñ</h1>Âû íå èìååòå äîñòóïà ê ýòîìó ôàéëó íàïðÿìóþ. Åñëè âû íåäàâíî îáíîâëÿëè ôîðóì, âû äîëæíû îáíîâèòü âñå ñîîòâåòñòâóþùèå ôàéëû.";
exit();
}
/**
* Public Action Class: Profile
*
* @package InvisionPowerBoard
* @subpackage Public-Action
* @author Matt Mecham
* @version 2.1
*/
class profile
{
var $output = "";
var $page_title = "";
var $nav = array();
var $html = "";
var $member = array();
var $m_group = array();
var $jump_html = "";
var $parser = "";
var $links = array();
var $bio = "";
var $notes = "";
var $size = "m";
var $show_photo = "";
var $show_width = "";
var $show_height = "";
var $show_name = "";
var $photo_member = "";
var $has_photo = FALSE;
var $lib;
function auto_run()
{
//-----------------------------------------
// Load and config the post parser
//-----------------------------------------
require_once( ROOT_PATH."sources/handlers/han_parse_bbcode.php" );
$this->parser = new parse_bbcode();
$this->parser->ipsclass = $this->ipsclass;
$this->parser->allow_update_caches = 1;
$this->parser->bypass_badwords = intval($this->ipsclass->member['g_bypass_badwords']);
//-----------------------------------------
// Require the HTML and language modules
//-----------------------------------------
$this->ipsclass->load_language('lang_profile');
$this->ipsclass->load_template('skin_profile');
$this->ipsclass->base_url_nosess = "{$this->ipsclass->vars['board_url']}/index.{$this->ipsclass->vars['php_ext']}";
//-----------------------------------------
// What to do?
//-----------------------------------------
switch($this->ipsclass->input['CODE'])
{
case '03':
$this->view_profile();
break;
case 'showphoto':
$this->show_photo();
break;
case 'showcard':
$this->show_card();
break;
case 'show-display-names':
$this->show_display_names();
break;
//-----------------------------------------
default:
$this->view_profile();
break;
}
// If we have any HTML to print, do so...
$this->ipsclass->print->add_output("$this->output");
$this->ipsclass->print->do_output( array( 'TITLE' => $this->page_title, 'JS' => 1, NAV => $this->nav ) );
}
/*-------------------------------------------------------------------------*/
// VIEW CONTACT CARD:
/*-------------------------------------------------------------------------*/
/**
* Display member display name change history
*
* Prints a pop-up window of the member's display name
* history
*
* @return void
* @since IPB 2.1.0.2005-7-5
*/
function show_display_names()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$id = intval( $this->ipsclass->input['id'] );
$member = array();
$html = "";
$content = "";
//-----------------------------------------
// Display name feature on?
//-----------------------------------------
if ( ! $this->ipsclass->vars['auth_allow_dnames'] )
{
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_permission' ) );
}
//-----------------------------------------
// Permission check
//-----------------------------------------
if ( $this->ipsclass->member['g_mem_info'] != 1 )
{
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_permission' ) );
}
if ( ! $id )
{
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'incorrect_use' ) );
}
//-----------------------------------------
// Get member info
//-----------------------------------------
$this->ipsclass->DB->cache_add_query( 'generic_get_all_member', array( 'mid' => $id ) );
$this->ipsclass->DB->cache_exec_query();
$member = $this->ipsclass->DB->fetch_row();
//-----------------------------------------
// Get Dname history
//-----------------------------------------
$this->ipsclass->DB->build_query( array( 'select' => 'd.*',
'from' => array( 'dnames_change' => 'd' ),
'where' => 'dname_member_id='.$id,
'add_join' => array( 0 => array( 'select' => 'm.members_display_name',
'from' => array( 'members' => 'm' ),
'where' => 'm.id=d.dname_member_id',
'type' => 'inner' ) ),
'order' => 'dname_date DESC' ) );
$this->ipsclass->DB->exec_query();
while( $row = $this->ipsclass->DB->fetch_row() )
{
//-----------------------------------------
// Format some info
//-----------------------------------------
$date = $this->ipsclass->get_date( $row['dname_date'], 'SHORT' );
//-----------------------------------------
// Compile HTML
//-----------------------------------------
$content .= $this->ipsclass->compiled_templates['skin_profile']->dname_content_row( $row['dname_previous'], $row['dname_current'], $date );
}
//-----------------------------------------
// No changes? Add in a default row
//-----------------------------------------
if ( ! $content )
{
$content .= $this->ipsclass->compiled_templates['skin_profile']->dname_content_row( '--', $member['members_display_name'], $this->ipsclass->get_date( $member['joined'], 'SHORT' ) );
}
//-----------------------------------------
// Print the pop-up window
//-----------------------------------------
$html = $this->ipsclass->compiled_templates['skin_profile']->dname_wrapper( $member['members_display_name'], $content );
$this->ipsclass->print->pop_up_window( $this->ipsclass->lang['dname_title'], $html );
}
/*-------------------------------------------------------------------------*/
// VIEW CONTACT CARD:
/*-------------------------------------------------------------------------*/
function show_card()
{
$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->ipsclass->DB->cache_add_query( 'generic_get_all_member', array( 'mid' => $id ) );
$this->ipsclass->DB->cache_exec_query();
$member = $this->ipsclass->DB->fetch_row();
$member['website'] = $member['website'] == 'http://' ? '' : $member['website'];
$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['website'] = $member['website'] ? "<a href='{$member['website']}' target='_blank'>{$member['website']}</a>" : $this->ipsclass->lang['no_info'];
$info['mid'] = $member['id'];
$info['has_blog'] = $member['has_blog'];
$info['has_gallery'] = $member['has_gallery'];
if (!$member['hide_email'])
{
$info['email'] = "<a href='javascript:redirect_to(\"&amp;act=Mail&amp;CODE=00&amp;MID={$member['id']}\",1);'>{$this->ipsclass->lang['click_here']}</a>";
}
else
{
$info['email'] = $this->ipsclass->lang['private'];
}
$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}>";
}
if ($this->ipsclass->input['download'] == 1)
{
$photo = str_replace( "<{NO_PHOTO}>", $this->ipsclass->lang['no_photo_avail'], $photo );
$html = $this->ipsclass->compiled_templates['skin_profile']->show_card_download( $member['members_display_name'], $photo, $info );
$html = str_replace( "<!--CSS-->", $this->ipsclass->skin['_css'], $html );
//-----------------------------------------
// Macros
//-----------------------------------------
$macros = unserialize(stripslashes($this->ipsclass->skin['_macro']));
if ( is_array( $macros ) )
{
foreach( $macros as $i => $row )
{
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['has_gallery'] = $member['has_gallery'];
$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?
//-----------------------------------------
if ( strstr( $member['sesslocation'], 'mod:' ) )
{
$module = str_replace( 'mod:', '', $member['sesslocation'] );
$filename = ROOT_PATH.'sources/components_location/'.$this->ipsclass->txt_alphanumerical_clean( $module ).'.php';
if ( file_exists( $filename ) )
{
$real_loc = $member['location'];
$member['location'] = $member['sesslocation'];
require_once( $filename );
$toload = 'components_location_'.$module;
$loader = new $toload;
$loader->ipsclass =& $this->ipsclass;
$tmp = $loader->parse_online_entries( array( 1 => $member ) );
if ( is_array( $tmp ) and count( $tmp ) )
{
$where = "<a href='{$tmp[1]['_url']}'>{$tmp[1]['_text']}</a>";
}
$member['location'] = $real_loc;
}
}
else if ( $member['location_1_type'] == 'topic' AND $member['location_1_id'] )
{
$topic = $this->ipsclass->DB->simple_exec_query( array( 'select' => '*', 'from' => 'topics', 'where' => 'tid='.$member['location_1_id'] ) );
if ( $topic['tid'] )
{
if ( ! $this->ipsclass->forums->forums_quick_check_access( $member['location_2_id'] ) )
{
$where = $this->ipsclass->lang['wol_topic'].': '."<a href='{$this->ipsclass->base_url}showtopic={$topic['tid']}'>{$topic['title']}</a>";
}
}
}
else if ( $member['location_2_type'] == 'forum' AND $member['location_2_id'] )
{
if ( ! $this->ipsclass->forums->forums_quick_check_access( $member['location_2_id'] ) )
{
$where = $this->ipsclass->lang['wol_forum'].' '.$this->ipsclass->cache['forum_cache'][ $member['location_2_id'] ]['name'];
}
}
else if ( strstr( strtolower($member['sesslocation']), 'usercp' ) or strstr( strtolower($member['sesslocation']), 'msg' ) )
{
$where = $this->ipsclass->lang['wol_ucp'];
}
else if ( strstr( strtolower($member['sesslocation']), 'profile' ) )
{
$where = $this->ipsclass->lang['wol_profile'];
}
else if ( strstr( strtolower($member['sesslocation']), 'search' ) )
{
$where = $this->ipsclass->lang['wol_search'];
}
if ( ! $where )
{
$where = $this->ipsclass->lang['wol_index'];
}
$info['online_extra'] = '('.$where.')';
}
//-----------------------------------------
// Time...
//-----------------------------------------
$this->ipsclass->vars['time_adjust'] = $this->ipsclass->vars['time_adjust'] == "" ? 0 : $this->ipsclass->vars['time_adjust'];
if ($member['dst_in_use'] == 1)
{
$member['time_offset'] += 1;
}
$info['local_time'] = $member['time_offset'] != "" ? gmdate( $this->ipsclass->vars['clock_long'], time() + ($member['time_offset']*3600) + ($this->ipsclass->vars['time_adjust'] * 60) ) : $this->ipsclass->lang['no_info'];
$info['avatar'] = $this->ipsclass->get_avatar( $member['avatar_location'] , 1, $member['avatar_size'], $member['avatar_type'] );
//-----------------------------------------
// Siggy
//-----------------------------------------
$info['signature'] = $member['signature'];
$this->parser->parse_html = intval($this->ipsclass->vars['sig_allow_html']);
$this->parser->parse_nl2br = 1;
$info['signature'] = $this->parser->pre_display_parse($info['signature']);
//-----------------------------------------
// site
//-----------------------------------------
if ( $member['website'] and preg_match( "/^http:\/\/\S+$/", $member['website'] ) )
{
$info['homepage'] = "<a href='{$member['website']}' target='_blank'>{$member['website']}</a>";
}
else
{
$info['homepage'] = $this->ipsclass->lang['no_info'];
}
//-----------------------------------------
// Birthday
//-----------------------------------------
if ($member['bday_month'])
{
$info['birthday'] = $member['bday_day']." ".$this->ipsclass->lang[ 'M_'.$member['bday_month'] ]." ".$member['bday_year'];
}
else
{
$info['birthday'] = $this->ipsclass->lang['no_info'];
}
//-----------------------------------------
// Email
//-----------------------------------------
if ( ! $member['hide_email'] )
{
$info['email'] = "<a href='{$this->ipsclass->base_url}act=Mail&amp;CODE=00&amp;MID={$member['id']}'>{$this->ipsclass->lang['email']}</a>";
}
else
{
$info['email'] = $this->ipsclass->lang['private'];
}
//-----------------------------------------
// Get photo and show profile:
//-----------------------------------------
$this->load_photo( $member['id'], $member );
if ( $this->has_photo == TRUE )
{
$info['photo'] = $this->ipsclass->compiled_templates['skin_profile']->get_photo( $this->show_photo, $this->show_width, $this->show_height );
}
else
{
$info['photo'] = "";
}
$info['base_url'] = $this->ipsclass->base_url;
$info['posts'] = $this->ipsclass->do_number_format($info['posts']);
//-----------------------------------------
// Output
//-----------------------------------------
$this->output .= $this->ipsclass->compiled_templates['skin_profile']->show_profile( $info, $this->ipsclass->return_md5_check() );
//-----------------------------------------
// Is this our profile?
//-----------------------------------------
if ($member['id'] == $this->ipsclass->member['id'])
{
$this->output = preg_replace( "/<!--MEM OPTIONS-->/", $this->ipsclass->compiled_templates['skin_profile']->user_edit($info), $this->output );
}
//-----------------------------------------
// Get custom profile information
//-----------------------------------------
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 = $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_view();
foreach( $fields->out_fields as $id => $data )
{
if ( ! $data )
{
$data = $this->ipsclass->lang['no_info'];
}
$custom_out .= $this->ipsclass->compiled_templates['skin_profile']->custom_field( $fields->field_names[ $id ], nl2br($data) );
}
if ($custom_out != "")
{
$this->output = str_replace( "<!--{CUSTOM.FIELDS}-->", $custom_out, $this->output );
}
else
{
$this->output = str_replace( "<!--{CUSTOM.FIELDS}-->", $this->ipsclass->compiled_templates['skin_profile']->no_custom_information(), $this->output );
}
//-----------------------------------------
// Warning stuff!!
//-----------------------------------------
$pass = 0;
$mod = 0;
if ( $this->ipsclass->vars['warn_on'] and ( ! stristr( ','.$this->ipsclass->vars['warn_protected'].',', ','.$member['mgroup'].',' ) ) )
{
if ($this->ipsclass->member['id'])
{
if ( $this->ipsclass->member['g_is_supmod'] == 1 )
{
$pass = 1;
$mod = 1;
}
if ( $pass == 0 and ( $this->ipsclass->vars['warn_show_own'] and ( $member['id'] == $this->ipsclass->member['id'] ) ) )
{
$pass = 1;
}
if ( $pass == 1 )
{
// Work out which image to show.
if ( ! $this->ipsclass->vars['warn_show_rating'] )
{
if ( $member['warn_level'] < 1 )
{
$member['warn_img'] = '<{WARN_0}>';
}
else if ( $member['warn_level'] >= $this->ipsclass->vars['warn_max'] )
{
$member['warn_img'] = '<{WARN_5}>';
$member['warn_percent'] = 100;
}
else
{
$member['warn_percent'] = $member['warn_level'] ? sprintf( "%.0f", ( ($member['warn_level'] / $this->ipsclass->vars['warn_max']) * 100) ) : 0;
if ( $member['warn_percent'] > 100 )
{
$member['warn_percent'] = 100;
}
if ( $member['warn_percent'] >= 81 )
{
$member['warn_img'] = '<{WARN_5}>';
}
else if ( $member['warn_percent'] >= 61 )
{
$member['warn_img'] = '<{WARN_4}>';
}
else if ( $member['warn_percent'] >= 41 )
{
$member['warn_img'] = '<{WARN_3}>';
}
else if ( $member['warn_percent'] >= 21 )
{
$member['warn_img'] = '<{WARN_2}>';
}
else if ( $member['warn_percent'] >= 1 )
{
$member['warn_img'] = '<{WARN_1}>';
}
else
{
$member['warn_img'] = '<{WARN_0}>';
}
}
if ( $member['warn_percent'] < 1 )
{
$member['warn_percent'] = 0;
}
if ( $mod == 1 )
{
$this->output = str_replace( "<!--{WARN_LEVEL}-->", $this->ipsclass->compiled_templates['skin_profile']->warn_level($member['id'], $member['warn_img'], $member['warn_percent']), $this->output );
}
else
{
$this->output = str_replace( "<!--{WARN_LEVEL}-->", $this->ipsclass->compiled_templates['skin_profile']->warn_level_no_mod($member['id'], $member['warn_img'], $member['warn_percent']), $this->output );
}
}
else
{
// Rating mode:
if ( $mod == 1 )
{
$this->output = str_replace( "<!--{WARN_LEVEL}-->", $this->ipsclass->compiled_templates['skin_profile']->warn_level_rating($member['id'], $member['warn_level'], $this->ipsclass->vars['warn_min'], $this->ipsclass->vars['warn_max']), $this->output );
}
else
{
$this->output = str_replace( "<!--{WARN_LEVEL}-->", $this->ipsclass->compiled_templates['skin_profile']->warn_level_rating_no_mod($member['id'], $member['warn_level'], $this->ipsclass->vars['warn_min'], $this->ipsclass->vars['warn_max']), $this->output );
}
}
}
}
}
$this->page_title = $this->ipsclass->lang['page_title'];
$this->nav = array( $this->ipsclass->lang['page_title'] );
}
}
?>