本文整理汇总了PHP中avatar函数的典型用法代码示例。如果您正苦于以下问题:PHP avatar函数的具体用法?PHP avatar怎么用?PHP avatar使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了avatar函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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');
}
示例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');
}
}
示例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);
}
示例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');
}
示例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);
}
示例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');
}
示例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);
}
}
示例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'));
}
}
示例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);
}
示例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));
}
示例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');
}
示例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('/');
}
}
示例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);
}
示例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');
}
示例15: getuserpic
function getuserpic($user)
{
if ($user[picurl]) {
return $user[picurl];
}
$picurl = avatar($user[username], $user['uid']);
return $picurl;
}