Location: PHPKode > projects > Uchome and Discuz > source/task/profile.php
<?php
/*
	[UCenter Home] (C) 2007-2008 Comsenz Inc.
	$Id: profile.php 13217 2009-08-21 06:57:53Z liguode $
*/

if(!defined('IN_UCHOME')) {
	exit('Access Denied');
}

//ÅжÏÓû§ÊÇ·ñÈ«²¿ÉèÖÃÁ˸öÈË×ÊÁÏ
$nones = array();
$profile_lang = array(
	'name' => 'Name',
	'sex' => 'Gender',
	'birthyear' => 'Birth(year)',
	'birthmonth' => 'Birth(month)',
	'birthday' => 'Birth(day)',
	'blood' => 'Blood Type',
	'marry' => 'Marital Status',
	'birthprovince' => 'HomeTown (province/state)',
	'birthcity' => 'HomwTown (city)',
	'resideprovince' => 'Current Province/state',
	'residecity' => 'Current City'
);
foreach (array('name','sex','birthyear','birthmonth','birthday','marry','birthprovince','birthcity','resideprovince','residecity') as $key) {
	$value = trim($space[$key]);
	if(empty($value)) {
		$nones[] = $profile_lang[$key];
	}
}
//Õ¾³¤À©Õ¹
@include_once(S_ROOT.'./data/data_profilefield.php');
foreach ($_SGLOBAL['profilefield'] as $field => $value) {
	if($value['required'] && empty($space['field_'.$field])) {
		$nones[] = $value['title'];
	}
}

if(empty($nones)) {

	$task['done'] = 1;//ÈÎÎñÍê³É
	
	//×Ô¶¯ÕÒºÃÓÑ
	$findmaxnum = 10;
	$space['friends'][] = $space['uid'];
	$nouids = implode(',', $space['friends']);

	//¾ÓסµØºÃÓÑ
	$residelist = array();
	$warr = array();
	$warr[] = "sf.resideprovince='".addslashes($space['resideprovince'])."'";
	$warr[] = "sf.residecity='".addslashes($space['residecity'])."'";
	$query = $_SGLOBAL['db']->query("SELECT s.uid,s.username,s.name,s.namestatus FROM ".tname('spacefield')." sf
		LEFT JOIN ".tname('space')." s ON s.uid=sf.uid
		WHERE ".implode(' AND ', $warr)." AND sf.uid NOT IN ($nouids)
		LIMIT 0,$findmaxnum");
	while ($value = $_SGLOBAL['db']->fetch_array($query)) {
		realname_set($value['uid'], $value['username'], $value['name'], $value['namestatus']);
		$residelist[] = $value;
	}

	//ÐÔ±ðºÃÓÑ
	$sexlist = array();
	$warr = array();
	if(empty($space['marry']) || $space['marry'] < 2) {//µ¥Éí
		$warr[] = "sf.marry='1'";//µ¥Éí
	}
	if(empty($space['sex']) || $space['sex'] < 2) {//ÄÐÉú
		$warr[] = "sf.sex='2'";//Å®Éú
	} else {
		$warr[] = "sf.sex='1'";//ÄÐÉú
	}
	$query = $_SGLOBAL['db']->query("SELECT s.uid,s.username,s.name,s.namestatus FROM ".tname('spacefield')." sf
		LEFT JOIN ".tname('space')." s ON s.uid=sf.uid
		WHERE ".implode(' AND ', $warr)." AND sf.uid NOT IN ($nouids)
		LIMIT 0,$findmaxnum");
	while ($value = $_SGLOBAL['db']->fetch_array($query)) {
		realname_set($value['uid'], $value['username'], $value['name'], $value['namestatus']);
		$sexlist[] = $value;
	}
	
	realname_get();
	
	if($residelist) {
		$task['result'] .= '<p>We found some members near you, Might be you know add them :</p>';
		$task['result'] .= '<ul class="avatar_list">';
		foreach ($residelist as $key => $value) {
			$task['result'] .= '<li>
				<div class="avatar48"><a href="space.php?uid='.$value['uid'].'" target="_blank">'.avatar($value['uid'], 'small').'</a></div>
				<p><a href="space.php?uid='.$value['uid'].'" target="_blank">'.$_SN[$value['uid']].'</a></p>
				<p><a href="cp.php?ac=friend&op=add&uid='.$value['uid'].'" id="a_reside_friend_'.$key.'" onclick="ajaxmenu(event, this.id, 1)">¼ÓΪºÃÓÑ</a></p>
				</li>';
		}
		$task['result'] .= '</ul>';
	}
	if($sexlist) {
		$task['result'] .= '<p>We found hot boy/girl for you, add them to your friend list now:</p>';
		$task['result'] .= '<ul class="avatar_list">';
		foreach ($sexlist as $key => $value) {
			$task['result'] .= '<li>
				<div class="avatar48"><a href="space.php?uid='.$value['uid'].'" target="_blank">'.avatar($value['uid'], 'small').'</a></div>
				<p><a href="space.php?uid='.$value['uid'].'" target="_blank">'.$_SN[$value['uid']].'</a></p>
				<p><a href="cp.php?ac=friend&op=add&uid='.$value['uid'].'" id="a_sex_friend_'.$key.'" onclick="ajaxmenu(event, this.id, 1)">¼ÓΪºÃÓÑ</a></p>
				</li>';
		}
		$task['result'] .= '</ul>';
	}

} else {

	//ÈÎÎñÍê³ÉÏòµ¼
	$task['guide'] = '
		<strong>Äú»¹ÓÐÒÔϸöÈË×ÊÁÏÏîÐèÒª²¹³äÍêÕû£º</strong><br>
		<span style="color:red;">'.implode('<br>', $nones).'</span><br><br>
		<strong>Please follow below step to complete this activity:</strong>
		<ul>
		<li><a href="cp.php?ac=profile" target="_blank">д°¿Ú´ò¿ª¸öÈË×ÊÁÏÉèÖÃÒ³Ãæ</a>£»</li>
		<li>Update your profile will open in new window</li>
		</ul>';

}

?>
Return current item: Uchome and Discuz