-
Notifications
You must be signed in to change notification settings - Fork 0
/
userfriends.php
66 lines (62 loc) · 2.89 KB
/
userfriends.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
/**
* 用户好友列表
*
* 显示一个用户的好友列表
*
* 调用模板:/templates/userfriends.html
*
* @category jieqicms
* @package system
* @copyright Copyright (c) Hangzhou Jieqi Network Technology Co.,Ltd. (http://www.jieqi.com)
* @author $Author: juny $
* @version $Id: userfriends.php 326 2009-02-04 00:26:22Z juny $
*/
define('JIEQI_MODULE_NAME', 'system');
require_once('global.php');
if($_REQUEST['uid']=='self') $_REQUEST['uid']=intval($_SESSION['jieqiUserId']);
if(empty($_REQUEST['uid'])) jieqi_printfail(LANG_ERROR_PARAMETER);
$_REQUEST['uid']=intval($_REQUEST['uid']);
jieqi_getconfigs(JIEQI_MODULE_NAME, 'configs');
if (empty($_REQUEST['page']) || !is_numeric($_REQUEST['page'])) $_REQUEST['page']=1; //页码
include_once(JIEQI_ROOT_PATH.'/header.php');
include_once(JIEQI_ROOT_PATH.'/class/friends.php');
$friends_handler =& JieqiFriendsHandler::getInstance('JieqiFriendsHandler');
$criteria=new CriteriaCompo(new Criteria('myid', $_REQUEST['uid']));
$criteria->setSort('friendsid');
$criteria->setOrder('ASC');
if(!isset($jieqiConfigs['system']['friendspnum'])) $jieqiConfigs['system']['friendspnum']=20;
$criteria->setLimit($jieqiConfigs['system']['friendspnum']);
$criteria->setStart(($_REQUEST['page']-1) * $jieqiConfigs['system']['friendspnum']);
$friends_handler->queryObjects($criteria);
$friendsrows=array();
$k=0;
$ownername='';
while($v = $friends_handler->getObject()){
$friendsrows[$k]['myid']=$v->getVar('myid');
$friendsrows[$k]['myname']=$v->getVar('myname');
if(empty($ownername) && !empty($friendsrows[$k]['myname'])) $ownername=$v->getVar('myname');
$friendsrows[$k]['yourid']=$v->getVar('yourid');
$friendsrows[$k]['yourname']=$v->getVar('yourname');
$friendsrows[$k]['adddate']=date(JIEQI_DATE_FORMAT, $v->getVar('adddate'));
$k++;
}
$jieqiTpl->assign_by_ref('friendsrows', $friendsrows);
$jieqiTpl->assign('owner', $ownername);
$jieqiTpl->assign('ownerid', $_REQUEST['uid']);
$friendsnum=$friends_handler->getCount($criteria);
$jieqiTpl->assign('nowfriends', $friendsnum);
jieqi_getconfigs('system', 'honors');
jieqi_getconfigs(JIEQI_MODULE_NAME, 'right');
$maxfriendsnum=intval($jieqiConfigs['system']['maxfriends']); //默认好友数
$honorid=jieqi_gethonorid($_SESSION['jieqiUserScore'], $jieqiHonors);
if($honorid && isset($jieqiRight['system']['maxfriends']['honors'][$honorid]) && is_numeric($jieqiRight['system']['maxfriends']['honors'][$honorid])) $maxfriendsnum = intval($jieqiRight['system']['maxfriends']['honors'][$honorid]); //根据头衔设置的好友数
$jieqiTpl->assign('maxfriends', $maxfriendsnum);
//处理页面跳转
include_once(JIEQI_ROOT_PATH.'/lib/html/page.php');
$jumppage = new JieqiPage($friendsnum,$jieqiConfigs['system']['friendspnum'],$_REQUEST['page']);
$jieqiTpl->assign('url_jumppage',$jumppage->whole_bar());
$jieqiTpl->setCaching(0);
$jieqiTset['jieqi_contents_template'] = JIEQI_ROOT_PATH.'/templates/userfriends.html';
include_once(JIEQI_ROOT_PATH.'/footer.php');
?>