本文整理汇总了PHP中avatar函数的典型用法代码示例。如果您正苦于以下问题:PHP avatar函数的具体用法?PHP avatar怎么用?PHP avatar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了avatar函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: usesubmit
function usesubmit()
{
global $_G;
$list = $uids = array();
$num = !empty($this->parameters['num']) ? intval($this->parameters['num']) : 10;
$limit = $num + 20;
$giftMagicID = C::t('common_magic')->fetch_by_identifier('gift');
$mid = $giftMagicID['available'] ? intval($giftMagicID['magicid']) : 0;
if ($mid) {
foreach (C::t('common_magiclog')->fetch_all_by_magicid_action_uid($mid, 2, $_G['uid'], 0, $limit) as $value) {
$uids[] = intval($value['uid']);
}
}
if ($uids) {
$counter = 0;
$members = C::t('common_member')->fetch_all($uids);
foreach (C::t('common_member_field_home')->fetch_all($uids) as $uid => $value) {
$value = array_merge($members[$uid], $value);
$info = !empty($value['magicgift']) ? unserialize($value['magicgift']) : array();
if (!empty($info['left']) && (empty($info['receiver']) || !in_array($_G['uid'], $info['receiver']))) {
$value['avatar'] = addcslashes(avatar($uid, 'small'), "'");
$list[$uid] = $value;
$counter++;
if ($counter >= $num) {
break;
}
}
}
}
usemagic($this->magic['magicid'], $this->magic['num']);
updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', 'uid', $_G['uid']);
$op = 'show';
include template('home/magic_detector');
}
开发者ID:tang86,项目名称:discuz-utf8,代码行数:34,代码来源:magic_detector.php
示例2: showlist
/**
* 显示评论列表
*/
public function showlist()
{
global $G, $lang;
$dataid = intval($_GET['dataid']);
$idtype = trim($_GET['idtype']);
if (!$dataid || !$idtype) {
$this->showAppError(-1, 'parameter error', array('dataid' => $dataid, 'idtype' => $idtype));
}
$pagesize = isset($_GET['pagesize']) ? intval($_GET['pagesize']) : 20;
$commentlist = $this->t('comment')->where(array('dataid' => $dataid, 'idtype' => $idtype))->order('cid DESC')->page($G['page'], $pagesize)->select();
if ($commentlist) {
$newlist = array();
foreach ($commentlist as $list) {
$list['dateline'] = @date('Y-m-d H:i', $list['dateline']);
$list['userpic'] = avatar($list['uid']);
$newlist[] = $list;
}
$commentlist = $newlist;
} else {
$commentlist = array();
}
if ($_GET['datatype'] == 'json') {
$this->showAppData($commentlist);
} else {
include template('comment_list', 'app');
}
}
开发者ID:xy113,项目名称:XiangBaLaoServer,代码行数:30,代码来源:class.CommentController.php
示例3: getdata
function getdata($style, $parameter)
{
global $_G, $_lang;
require_once DISCUZ_ROOT . './source/plugin/house/include/config.inc.php';
$array = $list = array();
$where = " GROUP BY member_uid ";
if ($parameter['kind'] == 'new') {
$where .= " ORDER BY post_time DESC ";
} elseif ($parameter['kind'] == 'hot') {
$where .= " ORDER BY post_view DESC ";
}
$sql = "SELECT *,count(post_id) as count FROM " . DB::table("house_post") . $where . " LIMIT " . $parameter['items'];
$query = DB::query($sql);
while ($tem = DB::fetch($query)) {
$fields['id'] = $tem['post_id'];
$fields['url'] = $house_config['root'] . "?mod=view&post_id=" . $tem['post_id'];
$fields['title'] = $tem['post_title'];
$fields['text'] = $tem['post_text'];
$fields['img'] = avatar($tem['member_uid'], "big");
$fields['uid'] = $tem['member_uid'];
$fields['username'] = $tem['member_title'];
$fields['time'] = date($parameter['dateformat'], $tem['post_time']);
$fields['view'] = $tem['post_view'];
$fields['count'] = $tem['count'];
$picflag = !empty($fields['img']) ? 1 : 0;
$list[] = array('id' => $fields['id'], 'idtype' => 'id', 'title' => $fields['title'], 'url' => $fields['url'], 'pic' => $fields['img'], 'picflag' => $picflag, 'summary' => $fields['text'], 'fields' => $fields);
}
return array('html' => '', 'data' => $list);
}
开发者ID:edmundwong,项目名称:V604,代码行数:29,代码来源:block_housebroker.php
示例4: usesubmit
function usesubmit()
{
global $_G;
$id = intval($_GET['id']);
$idtype = $_GET['idtype'];
$blog = magic_check_idtype($id, $idtype);
$num = 10;
$list = $ids = $note_inserts = array();
$fusername = dimplode($_POST['fusername']);
if ($fusername) {
$query = C::t('home_friend')->fetch_all_by_uid_username($_G['uid'], $_POST['fusername'], 0, $num);
$note = lang('spacecp', 'magic_call', array('url' => "home.php?mod=space&uid={$_G['uid']}&do=blog&id={$id}"));
foreach ($query as $value) {
$ids[] = $value['fuid'];
$value['avatar'] = str_replace("'", "\\'", avatar($value[fuid], 'small'));
$list[] = $value;
$note_inserts[] = array('uid' => $value['fuid'], 'type' => $name, 'new' => 1, 'authorid' => $_G['uid'], 'author' => $_G['username'], 'note' => $note, 'dateline' => $_G['timestamp']);
}
}
if (empty($ids)) {
showmessage('magicuse_has_no_valid_friend');
}
foreach ($note_inserts as $note_insert) {
C::t('home_notification')->insert($note_insert);
}
C::t('common_member')->increase($ids, array('newprompt' => 1));
usemagic($this->magic['magicid'], $this->magic['num']);
updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', $idtype, $id);
$op = 'show';
include template('home/magic_call');
}
开发者ID:MCHacker,项目名称:discuz-docker,代码行数:31,代码来源:magic_call.php
示例5: getdata
function getdata($style, $parameter)
{
global $_G;
$parameter = $this->cookparameter($parameter);
$uids = isset($parameter['uids']) && !in_array(0, (array) $parameter['uids']) ? $parameter['uids'] : '';
$startrow = isset($parameter['startrow']) ? intval($parameter['startrow']) : 0;
$items = isset($parameter['items']) ? intval($parameter['items']) : 10;
$titlelength = intval($parameter['titlelength']);
$orderby = isset($parameter['orderby']) && in_array($parameter['orderby'], array('dateline', 'replynum')) ? $parameter['orderby'] : 'dateline';
$bannedids = !empty($parameter['bannedids']) ? explode(',', $parameter['bannedids']) : array();
$datalist = $list = array();
$wheres = array();
if ($uids) {
$wheres[] = 'uid IN (' . dimplode($uids) . ')';
}
if ($bannedids) {
$wheres[] = 'doid NOT IN (' . dimplode($bannedids) . ')';
}
$wheres[] = " status = '0'";
$wheresql = $wheres ? implode(' AND ', $wheres) : '1';
$query = DB::query("SELECT * FROM " . DB::table('home_doing') . " WHERE {$wheresql} ORDER BY {$orderby} DESC LIMIT {$startrow},{$items}");
while ($data = DB::fetch($query)) {
$datalist = array('id' => $data['doid'], 'idtype' => 'doid', 'title' => cutstr(strip_tags($data['message']), $titlelength, ''), 'url' => 'home.php?mod=space&uid=' . $data['uid'] . '&do=doing&doid=' . $data['doid'], 'pic' => '', 'summary' => '', 'fields' => array('fulltitle' => strip_tags($data['message']), 'uid' => $data['uid'], 'username' => $data['username'], 'avatar' => avatar($data['uid'], 'small', true, false, false, $_G['setting']['ucenterurl']), 'avatar_middle' => avatar($data['uid'], 'middle', true, false, false, $_G['setting']['ucenterurl']), 'avatar_big' => avatar($data['uid'], 'big', true, false, false, $_G['setting']['ucenterurl']), 'dateline' => $data['dateline'], 'replynum' => $data['replynum']));
if ($titlelength) {
$datalist['title'] = cutstr(strip_tags($data['message']), $titlelength);
} else {
$datalist['title'] = strip_tags($data['message'], '<img>');
}
$list[] = $datalist;
}
return array('html' => '', 'data' => $list);
}
开发者ID:pan289091315,项目名称:Discuz,代码行数:32,代码来源:block_doing.php
示例6: usesubmit
function usesubmit()
{
global $_G;
$list = $uids = array();
$num = !empty($this->parameters['num']) ? intval($this->parameters['num']) : 10;
$limit = $num + 20;
loadcache('magics');
$mid = !empty($_G['magics']['gift']) ? intval($_G['magics']['gift']['magicid']) : 0;
if ($mid) {
$query = DB::query('SELECT * FROM ' . DB::table('common_magiclog') . " WHERE magicid = '{$mid}' AND action='2' AND uid != '{$_G['uid']}' ORDER BY dateline DESC LIMIT 0,{$limit}");
while ($value = DB::fetch($query)) {
$uids[] = intval($value['uid']);
}
}
if ($uids) {
$counter = 0;
$query = DB::query('SELECT m.username, mfh.uid, mfh.magicgift FROM ' . DB::table('common_member') . " m LEFT JOIN " . DB::table('common_member_field_home') . " mfh USING(uid) WHERE m.uid IN (" . dimplode($uids) . ")");
while ($value = DB::fetch($query)) {
$info = !empty($value['magicgift']) ? unserialize($value['magicgift']) : array();
if (!empty($info['left']) && (empty($info['receiver']) || !in_array($_G['uid'], $info['receiver']))) {
$value['avatar'] = addcslashes(avatar($value['uid'], 'small'), "'");
$list[$value['uid']] = $value;
$counter++;
if ($counter >= $num) {
break;
}
}
}
}
usemagic($this->magic['magicid'], $this->magic['num']);
updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', 'uid', $_G['uid']);
$op = 'show';
include template('home/magic_detector');
}
开发者ID:dalinhuang,项目名称:hlwbbsvincent,代码行数:34,代码来源:magic_detector.php
示例7: index
public function index()
{
if ($this->uri->segment(2)) {
redirect('/');
}
if ($this->session->userdata('logged_in')) {
define('INGAME', TRUE);
$this->output->enable_profiler($this->config->item('debug'));
$this->lang->load('ingame');
$user = $this->user->data($this->session->userdata('user_id'));
$country = $this->user->data($user->country, 'countries');
date_default_timezone_set($user->timezone);
$panel['avatar'] = avatar($user, $this->lang->lang());
$panel['user'] = $user;
$panel['exp_prcnt'] = exp_percent($user);
$panel['l18n'] = l18n($this->lang->lang());
$panel['currency'] = $country->currency;
$head['help'] = lang('ingame.help');
$head['menu'] = $this->load->view('menu_ingame', '', TRUE);
$head['panel'] = $this->load->view('panel', $panel, TRUE);
$data['user'] = $user;
$data['head'] = $this->load->view('head', $head, TRUE);
$data['footer'] = $this->load->view('footer', '', TRUE);
$data['country'] = $country;
$this->load->view('ingame', $data);
} else {
$this->output->enable_profiler($this->config->item('debug'));
$this->lang->load('login');
$head['menu'] = $this->load->view('menu_outgame', '', TRUE);
$data['head'] = $this->load->view('head', $head, TRUE);
$data['footer'] = $this->load->view('footer', '', TRUE);
$this->load->view('login', $data);
}
}
开发者ID:Razican,项目名称:MegaPublik,代码行数:34,代码来源:main.php
示例8: register
/**
* 新用户注册
*/
public function register()
{
global $G;
$username = htmlspecialchars(trim($_GET['username']));
$mobile = trim($_GET['mobile']);
$password = trim($_GET['password']);
if (!$username) {
$this->showAppError(-1, '用户名输入错误', array('username' => $username));
}
if ($this->_verifyUsername($username)) {
$this->showAppError(-2, '用户名已被人使用', array('username' => $username));
}
if (!ismobile($mobile)) {
$this->showAppError(-3, '手机号输入错误', array('mobile' => $mobile));
}
if ($this->_verifyMobile($mobile)) {
$this->showAppError(-4, '手机号已被注册', array('mobile' => $mobile));
}
if (strlen($password) < 6) {
$this->showAppError(-5, '密码输入错误', array('password' => $password));
}
$member = new Member();
$returns = $member->register($username, $password, $mobile, 'mobile');
if ($member->uid > 0) {
$returns['userpic'] = avatar($member->uid);
$this->showAppData($returns);
} else {
$this->showAppError(-6, '注册失败', array('info' => 'system error'));
}
}
开发者ID:xy113,项目名称:XiangBaLaoServer,代码行数:33,代码来源:class.MemberController.php
示例9: run
public function run()
{
global $_FANWE;
$root = array();
$root['return'] = 1;
$share_id = (int) $_FANWE['requestData']['share_id'];
$page = (int) $_FANWE['requestData']['page'];
$page = max(1, $page);
$sql_count = "SELECT COUNT(DISTINCT comment_id) FROM " . FDB::table("share_comment") . " WHERE share_id = " . $share_id;
$total = FDB::resultFirst($sql_count);
$page_size = PAGE_SIZE;
$page_total = ceil($total / $page_size);
if ($page > $page_total) {
$page = $page_total;
}
$limit = ($page - 1) * $page_size . "," . $page_size;
$sql = 'SELECT c.*,u.user_name,u.server_code FROM ' . FDB::table('share_comment') . ' AS c
INNER JOIN ' . FDB::table('user') . ' AS u ON u.uid = c.uid
WHERE c.share_id = ' . $share_id . ' ORDER BY c.comment_id DESC LIMIT ' . $limit;
$res = FDB::query($sql);
$list = array();
while ($item = FDB::fetch($res)) {
$item['user_avatar'] = avatar($item['uid'], 'm', $item['server_code'], 1, true);
$item['time'] = getBeforeTimelag($item['create_time']);
m_express(&$item, $item['content']);
$list[] = $item;
}
$root['item'] = $list;
$root['page'] = array("page" => $page, "page_total" => $page_total);
m_display($root);
}
开发者ID:BGCX261,项目名称:zhubao-tupu-svn-to-git,代码行数:31,代码来源:commentlist.mapi.php
示例10: output
public function output()
{
global $_G;
if (true === BigAppConf::$debug) {
$_G['trace'][] = __CLASS__ . '::' . __FUNCTION__;
}
loadcache('forums');
foreach ($GLOBALS['data']['hot']['threadlist'] as $tid => &$thread) {
if (!isset($_G['cache']['stamps'][$thread['icon']]['url'])) {
$thread['icon'] = -1;
}
$thread['forum_name'] = $_G['cache']['forums'][$thread['fid']]['name'];
}
//echo json_encode($GLOBALS['data']['hot']['threadlist']);
//die(0);
unset($thread);
$GLOBALS['data']['hot']['threadlist'] = bigapp_core::getvalues($GLOBALS['data']['hot']['threadlist'], array('/^\\d+$/'), array('tid', 'attachment', 'avatar', 'subject', 'author', 'views', 'replies', 'forum_name', 'authorid', 'dateline'));
if (is_null($GLOBALS['data']['hot']['threadlist']) || !is_array($GLOBALS['data']['hot']['threadlist'])) {
$GLOBALS['data']['hot']['threadlist'] = array();
}
foreach ($GLOBALS['data']['hot']['threadlist'] as $tid => $thread) {
$GLOBALS['data']['hot']['threadlist'][$tid]['avatar'] = avatar($thread['authorid'], 'big', true);
$GLOBALS['data']['hot']['threadlist'][$tid]['dateline'] = str_replace(' ', '', $GLOBALS['data']['hot']['threadlist'][$tid]['dateline']);
}
/////////////////////////////////////////////////////////////////
BigAppAPI::_getDetails($GLOBALS['data']['hot']['threadlist']);
/////////////////////////////////////////////////////////////////
$variable = array('data' => array_values($GLOBALS['data']['hot']['threadlist']), 'perpage' => $GLOBALS['perpage']);
bigapp_core::result(bigapp_core::variable($variable));
}
开发者ID:Mushan3420,项目名称:BigApp-PHP7,代码行数:30,代码来源:hotthread.php
示例11: usesubmit
function usesubmit()
{
global $_G;
$id = intval($_G['gp_id']);
$idtype = $_G['gp_idtype'];
$blog = magic_check_idtype($id, $idtype);
$num = 10;
$list = $ids = $note_inserts = array();
$fusername = dimplode($_POST['fusername']);
if ($fusername) {
$query = DB::query('SELECT * FROM ' . DB::table('home_friend') . " WHERE uid='{$_G['uid']}' AND fusername IN (" . $fusername . ") LIMIT {$num}");
$note = lang('spacecp', 'magic_call', array('url' => "home.php?mod=space&uid={$_G['uid']}&do=blog&id={$id}"));
while ($value = DB::fetch($query)) {
$ids[] = $value['fuid'];
$value['avatar'] = str_replace("'", "\\'", avatar($value[fuid], 'small'));
$list[] = $value;
$note_inserts[] = "('{$value['fuid']}', '{$name}', '1', '{$_G['uid']}', '{$_G['username']}', '{$note}', '{$_G['timestamp']}')";
}
}
if (empty($ids)) {
showmessage('magicuse_has_no_valid_friend');
}
DB::query('INSERT INTO ' . DB::table('home_notification') . '(uid, type, new, authorid, author, note, dateline) VALUES ' . implode(',', $note_inserts));
DB::query('UPDATE ' . DB::table('common_member') . ' SET newprompt = newprompt + 1 WHERE uid IN (' . dimplode($ids) . ')');
usemagic($this->magic['magicid'], $this->magic['num']);
updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', $idtype, $id);
$op = 'show';
include template('home/magic_call');
}
开发者ID:pan289091315,项目名称:Discuz,代码行数:29,代码来源:magic_call.php
示例12: index
public function index()
{
if ($this->uri->segment(3)) {
redirect('market');
}
if ($this->session->userdata('logged_in')) {
define('INGAME', TRUE);
define('AJAX', TRUE);
$this->output->enable_profiler($this->config->item('debug'));
$this->lang->load('market');
$this->lang->load('ingame');
$user = $this->user->data($this->session->userdata('user_id'));
$country = $this->user->data($user->country, 'countries');
date_default_timezone_set($user->timezone);
$panel['avatar'] = avatar($user, $this->lang->lang());
$panel['user'] = $user;
$panel['exp_prcnt'] = exp_percent($user);
$panel['l18n'] = l18n($this->lang->lang());
$panel['currency'] = $country->currency;
$script['img'] = loading(lang('overal.loading'));
$head['panel'] = $this->load->view('panel', $panel, TRUE);
$head['help'] = lang('ingame.help');
$head['menu'] = $this->load->view('menu_ingame', '', TRUE);
$head['script'] = $this->load->view('market/market_ajax', $script, TRUE);
$data['head'] = $this->load->view('head', $head, TRUE);
$data['footer'] = $this->load->view('footer', '', TRUE);
$data['is_society'] = $this->user->has_company();
$this->load->view('market/market', $data);
} else {
log_message('error', 'User with IP ' . $this->input->ip_address() . ' has tried to enter /market without loggin in.');
redirect('/');
}
}
开发者ID:Razican,项目名称:MegaPublik,代码行数:33,代码来源:market.php
示例13: run
public function run()
{
global $_FANWE;
$root = array();
$root['return'] = 0;
$data = array('email' => $_FANWE['requestData']['email'], 'user_name' => $_FANWE['requestData']['user_name'], 'password' => $_FANWE['requestData']['password'], 'gender' => intval($_FANWE['requestData']['gender']));
$vservice = FS('Validate');
$validate = array(array('email', 'required', lang('user', 'register_email_require')), array('email', 'email', lang('user', 'register_email_error')), array('user_name', 'required', lang('user', 'register_user_name_require')), array('user_name', 'range_length', lang('user', 'register_user_name_len'), 2, 20), array('user_name', '/^[\\x{4e00}-\\x{9fa5}a-zA-Z][\\x{4e00}-\\x{9fa5}a-zA-Z0-9]+$/u', lang('user', 'register_user_name_error')), array('password', 'range_length', lang('user', 'register_password_range'), 6, 20));
if (!$vservice->validation($validate, $data)) {
$root['info'] = "注册失败:" . $vservice->getError();
m_display($root);
}
$uservice = FS('User');
if ($uservice->getEmailExists($data['email'])) {
$root['info'] = "注册失败:" . lang('user', 'register_email_exist');
m_display($root);
}
if ($uservice->getUserNameExists($data['user_name'])) {
$root['info'] = "注册失败:" . lang('user', 'register_user_name_exist');
m_display($root);
}
//================add by chenfq 2011-10-14 =======================
$user_field = $_FANWE['setting']['integrate_field_id'];
$integrate_id = FS("Integrate")->addUser($data['user_name'], $data['password'], $data['email']);
if ($integrate_id < 0) {
$info = FS("Integrate")->getInfo();
$root['info'] = "注册失败:" . $info;
m_display($root);
}
//================add by chenfq 2011-10-14=======================
$user = array('email' => $data['email'], 'user_name' => $data['user_name'], 'user_name_match' => segmentToUnicode($data['user_name']), 'password' => md5($data['password']), 'status' => 1, 'email_status' => 0, 'avatar_status' => 0, 'gid' => 7, 'invite_id' => FS('User')->getReferrals(), 'reg_time' => TIME_UTC, $user_field => $integrate_id);
$uid = FDB::insert('user', $user, true);
if ($uid > 0) {
$_FANWE['uid'] = $uid;
FDB::insert('user_count', array('uid' => $uid));
if ($user['invite_id'] > 0) {
FS('User')->insertReferral($uid, $user['invite_id'], $user['user_name']);
}
FS("User")->updateUserScore($uid, 'user', 'register');
unset($user);
$user_profile = array('uid' => $uid, 'gender' => $data['gender']);
FDB::insert('user_profile', $user_profile);
unset($user_profile);
$user_status = array('uid' => $uid, 'reg_ip' => $_FANWE['client_ip'], 'last_ip' => $_FANWE['client_ip'], 'last_time' => TIME_UTC, 'last_activity' => TIME_UTC);
FDB::insert('user_status', $user_status);
$root['return'] = 1;
$root['info'] = "用户注册成功";
$root['uid'] = $uid;
$root['user_name'] = $data['user_name'];
$root['user_avatar'] = avatar($uid, 'm', '', 1, true);
$root['user_email'] = $data['email'];
$deviceuid = addslashes(trim($_FANWE['requestData']['deviceuid']));
$sql = "update " . FDB::table('apns_devices') . " set clientid = " . $uid . " where clientid = 0 and deviceuid = '" . $deviceuid . "'";
FDB::query($sql);
} else {
$root['info'] = lang('user', 'register_error');
}
m_display($root);
}
开发者ID:BGCX261,项目名称:zhubao-tupu-svn-to-git,代码行数:59,代码来源:register.mapi.php
示例14: index
public function index()
{
global $G, $lang;
$avatarsmall = avatar($this->uid, 'small');
$avatarmiddle = avatar($this->uid, 'middle');
$avatarbig = avatar($this->uid, 'big');
include template('avatar');
}
开发者ID:xy113,项目名称:XiangBaLaoServer,代码行数:8,代码来源:class.AvatarController.php
示例15: getuserpic
function getuserpic($user)
{
if ($user[picurl]) {
return $user[picurl];
}
$picurl = avatar($user[username], $user['uid']);
return $picurl;
}
开发者ID:lqlstudio,项目名称:ttae_open,代码行数:8,代码来源:extends.function.php
示例16: output
function output()
{
global $_G;
foreach ($GLOBALS['data']['hot']['threadlist'] as $tid => $thread) {
$GLOBALS['data']['hot']['threadlist'][$tid]['avatar'] = avatar($thread['authorid'], 'big', true);
}
$variable = array('data' => array_values($GLOBALS['data']['hot']['threadlist']), 'perpage' => $GLOBALS['perpage']);
mobile_core::result(mobile_core::variable($variable));
}
开发者ID:renning,项目名称:html,代码行数:9,代码来源:hotthread.php
示例17: main
function main()
{
global $_G;
$type = trim($_GET[type]);
$id = intval($_GET[id]);
if (!$_G[setting][say_status]) {
json(array('msg' => '系统已关闭评论', 'data' => -1));
}
if (!$id) {
json(array('msg' => '分类id不存在'));
}
if (!$type) {
json(array('msg' => '获取的类型不存在'));
}
if (!preg_match("/^[a-z_]+\$/", $type)) {
json(array('msg' => '类型格式不正确'));
}
if (!array_key_exists($type, $_G[setting][comment_types])) {
json(array('msg' => '当前模块不允许评论或留言'));
}
$page_size = $_G[setting][comment_page_size];
$and = " AND type_id = {$id} AND type = '{$type}' AND `check` = 1 AND is_reply = 0 ";
if ($_GET['num_iid']) {
$and .= " AND num_iid = " . trim_html($_GET['num_iid']);
}
$rs = D(array('and' => $and, 'order' => ' id DESC ', 'table' => 'comment'), array('size' => $page_size, 'url' => ''));
$comment = array();
foreach ($rs[goods] as $k => $v) {
//$tmp = array('id'=>$v['id'],'uid'=>$v[uid],'username'=>$v[username],'content'=>$v[content],'ip'=>$v[ip],'user_pic'=> $v['user_pic'],'dateline'=>$v[dateline]);
//$user_picurl = DB::fetch_first("SELECT picurl FROM ".DB::table('member')." WHERE uid = ".$v['uid']);
$v['user_pic'] = avatar($v['username'], $v['uid']);
//if($user_picurl['picurl'])$v['user_pic'] = $user_picurl['picurl'];
$and2 = "AND type = '{$type}' AND type_id = " . $v[type_id] . " AND `check` = 1 AND is_reply=1 AND reply_id = " . $v[id];
if ($_GET['num_iid']) {
$and2 .= " AND num_iid = " . trim_html($_GET['num_iid']);
}
$v[comment_list] = D(array('table' => 'comment', 'and' => $and2, 'order' => ' id DESC ', 'limit' => 30));
$comment[] = $v;
}
$max_page = ceil($rs[count] / $page_size);
if ($_G['uid'] > 0) {
if ($_G['member']['picurl']) {
$picurl = $_G['member']['picurl'];
} else {
$picurl = avatar($_G['username'], $_G['uid']);
}
} else {
$picurl = '/assets/global/images/avatar.png';
}
$comment_msg = $_G[setting][comment_msg] ? trim($_G[setting][comment_msg]) : '';
$data = array('user_pic' => $picurl, 'max_page' => $max_page, 'comment_msg' => $comment_msg, 'data' => $comment);
$rt = array('status' => 'success', 'data' => $data);
if (defined('APP')) {
return $rt;
}
json($rt);
}
开发者ID:lqlstudio,项目名称:ttae_open,代码行数:57,代码来源:comment.action.php
示例18: output
function output()
{
$comments = mobile_core::getvalues($GLOBALS['comments'], array('/^\\d+$/'), array('id', 'tid', 'pid', 'author', 'authorid', 'dateline', 'comment', 'avatar'));
foreach ($GLOBALS['comments'] as $k => $c) {
$comments[$k]['avatar'] = avatar($c['authorid'], 'small', true);
}
$variables = array('tid' => $_GET['tid'], 'pid' => $_GET['pid'], 'comments' => array($_GET['pid'] => $comments), 'totalcomment' => $GLOBALS['totalcomment'], 'count' => $GLOBALS['count']);
mobile_core::result(mobile_core::variable($variables));
}
开发者ID:samyex6,项目名称:discuz3.2-lite,代码行数:9,代码来源:viewcomment.php
示例19: output
function output()
{
$comments = array();
foreach ($GLOBALS['comments'] as $comment) {
$comments[] = array('author' => $comment['author'], 'authorid' => $comment['authorid'], 'avatar' => avatar($comment['authorid'], 'small', 1), 'message' => $comment['comment'], 'dateline' => strip_tags($comment['dateline']));
}
$variable = array('tid' => $_GET['tid'], 'pid' => $_GET['pid'], 'postlist' => $comments);
mobile_core::result(mobile_core::variable($variable));
}
开发者ID:hacktea8,项目名称:d_z_s_t_u_d_e_n_t,代码行数:9,代码来源:showactivity.php
示例20: run
public function run()
{
global $_FANWE;
$root = array();
$root['return'] = 0;
$uid = (int) $_FANWE['requestData']['uid'];
if ($uid > 0) {
if (!FS('User')->getUserExists($uid)) {
$uid = 0;
}
}
if ($uid == 0) {
$uid = $_FANWE['uid'];
$root['home_user'] = $_FANWE['user'];
}
if ($uid == 0) {
$root['info'] = "请选择要查看的会员";
m_display($root);
}
if (!isset($root['home_user'])) {
$root['home_user'] = FS("User")->getUserById($uid);
unset($root['home_user']['user_name_match'], $root['home_user']['password'], $root['home_user']['active_hash'], $root['home_user']['reset_hash']);
$root['home_user']['user_avatar'] = avatar($uid, 'm', $root['home_user']['server_code'], 1, true);
}
$page = (int) $_FANWE['requestData']['page'];
$page = max(1, $page);
$is_spare_flow = (int) $_FANWE['requestData']['is_spare_flow'];
$img_size = 200;
$scale = 2;
if ($is_spare_flow == 1) {
$img_size = 100;
$scale = 1;
}
$total = FDB::resultFirst('SELECT COUNT(photo_id) FROM ' . FDB::table('share_photo') . ' WHERE uid = ' . $uid);
$page_size = 20;
//PAGE_SIZE;
$page_total = max(1, ceil($total / $page_size));
if ($page > $page_total) {
$page = $page_total;
}
$limit = ($page - 1) * $page_size . "," . $page_size;
$photo_list = array();
$res = FDB::query('SELECT photo_id,share_id,img
FROM ' . FDB::table('share_photo') . '
WHERE uid = ' . $uid . ' ORDER BY photo_id DESC LIMIT ' . $limit);
while ($photo = FDB::fetch($res)) {
$photo['img'] = getImgName($photo['img'], $img_size, $img_size, 1, true);
$photo['height'] = round($img_size / $scale);
$photo['url'] = FU('note/m', array('sid' => $photo['share_id'], 'id' => $photo['photo_id']), true);
$photo_list[] = $photo;
}
$root['return'] = 1;
$root['item'] = $photo_list;
$root['page'] = array("page" => $page, "page_total" => $page_total);
m_display($root);
}
开发者ID:BGCX261,项目名称:zhubao-tupu-svn-to-git,代码行数:56,代码来源:photolist.mapi.php
注:本文中的avatar函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论