当前位置: 首页>>代码示例>>PHP>>正文


PHP get_user函数代码示例

本文整理汇总了PHP中get_user函数的典型用法代码示例。如果您正苦于以下问题:PHP get_user函数的具体用法?PHP get_user怎么用?PHP get_user使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_user函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * Constructor with common logic for pages that required login
  */
 public function __construct()
 {
     parent::__construct();
     // basic URL params
     $this->mCtrler = $this->router->fetch_class();
     $this->mAction = $this->router->fetch_method();
     $this->mParam = $this->uri->segment(3);
     // default values for page output
     $this->mLayout = "default";
     // locale handling
     $this->setup_locale();
     // get user data from session
     if (ENABLED_MEMBERSHIP) {
         $this->mUser = get_user();
         $menu = empty($this->mUser) ? 'menu' : 'menu_member';
     } else {
         $menu = 'menu';
     }
     // setup menu
     $this->config->load($menu);
     $this->mMenu = $this->config->item('menu');
     // setup breadcrumb
     $this->mBreadcrumb = array();
     $this->push_breadcrumb('Home', '', 'home');
     // setup basic view data
     $this->mViewData = array('locale' => $this->mLocale, 'ctrler' => $this->mCtrler, 'action' => $this->mAction, 'menu' => $this->mMenu);
     if (ENABLED_MEMBERSHIP) {
         $this->mViewData['user'] = $this->mUser;
     }
 }
开发者ID:msd1310,项目名称:ci_bootstrap,代码行数:33,代码来源:MY_Controller.php

示例2: __construct

 /**
  * Constructor with common logic for pages that required login
  */
 public function __construct()
 {
     parent::__construct();
     // redirect to Login page if user not logged in
     $this->mUser = get_user();
     if (empty($this->mUser)) {
         redirect('login');
         exit;
     }
     // basic URL params
     $this->mCtrler = $this->router->fetch_class();
     $this->mAction = $this->router->fetch_method();
     $this->mParam = $this->uri->segment(3);
     // Use default language if the Backend System only support single locale
     $this->mLocale = $this->config->item('language');
     // default values for page output
     $this->mLayout = "default";
     // switch theme by login user roles
     $this->mTheme = verify_role('admin') ? THEME_ADMIN : THEME_STAFF;
     // side menu items
     $this->config->load('menu_' . $this->mUser['role']);
     $this->mMenu = $this->config->item('menu');
     // breadcrumb entries
     $this->mBreadcrumb = array();
     $this->push_breadcrumb('Home', '', 'home');
     // setup basic view data
     $this->mViewData = array('locale' => $this->mLocale, 'ctrler' => $this->mCtrler, 'action' => $this->mAction, 'user' => $this->mUser, 'menu' => $this->mMenu);
 }
开发者ID:msd1310,项目名称:ci_bootstrap,代码行数:31,代码来源:MY_Controller.php

示例3: authToken

function authToken(\Slim\Route $route)
{
    $app = \Slim\Slim::getInstance();
    $token = $app->request->headers->get('X-Auth-Token');
    if (isset($token) && !empty($token)) {
        if (!function_exists('get_user')) {
            $username = dbFetchCell('SELECT `U`.`username` FROM `api_tokens` AS AT JOIN `users` AS U ON `AT`.`user_id`=`U`.`user_id` WHERE `AT`.`token_hash`=?', array($token));
        } else {
            $username = get_user(dbFetchCell('SELECT `AT`.`user_id` FROM `api_tokens` AS AT WHERE `AT`.`token_hash`=?', array($token)));
        }
        if (!empty($username)) {
            $authenticated = true;
        } else {
            $authenticated = false;
        }
    } else {
        $authenticated = false;
    }
    if ($authenticated === false) {
        $app->response->setStatus(401);
        $output = array('status' => 'error', 'message' => 'API Token is missing or invalid; please supply a valid token');
        echo _json_encode($output);
        $app->stop();
    }
}
开发者ID:wiad,项目名称:librenms,代码行数:25,代码来源:api_functions.inc.php

示例4: mcm_demo_related_posts

/**
 * Assumes the existence of a custom field with the label "Related Post"
 * Usage: Creates a new template tag {related} that returns the output defined.
*/
function mcm_demo_related_posts($p, $custom)
{
    // get the meta field value
    $related_post = $p['_related-post'];
    // get the post data.
    $post = get_post($related_post);
    // get the post title.
    $post_title = apply_filters('the_title', $post->post_title);
    // get the post title.
    $post_content = apply_filters('the_content', $post->post_content);
    if ($related_post) {
        $p['related'] = "\n\t\t\t<div class='related-post related-post-{$related_post}'>\n\t\t\t\t<h2>{$post_title}</h2>\n\t\t\t\t<div class='post-content'>\n\t\t\t\t\t{$post_content}\n\t\t\t\t</div>\n\t\t\t</div>";
    } else {
        $p['related'] = '';
    }
    // get the meta field value
    $related_user = $p['_related-user'];
    // get the user object.
    $user = get_user($related_user);
    // get the user name (display name if set, otherwise login)
    $user_name = $user->display_name == '' ? $user->user_login : $user->display_name;
    if ($related_user) {
        $p['user'] = "\n\t\t\t<div class='related-user related-user-{$related_user}'>\n\t\t\t\t<h2>Contributed by {$user_name}</h2>\n\t\t\t</div>";
    } else {
        $p['user'] == '';
    }
    return $p;
}
开发者ID:joedolson,项目名称:plugin-extensions,代码行数:32,代码来源:mcm-related-posts.php

示例5: index

 public function index()
 {
     $root = array();
     $id = intval($GLOBALS['request']['id']);
     $deal = get_deal($id);
     //send_deal_contract_email($id,$deal,$deal['user_id']);  //发送电子协议邮件
     $root['deal'] = $deal;
     //借款列表
     $load_list = $GLOBALS['db']->getAll("SELECT deal_id,user_id,user_name,money,is_auto,create_time FROM " . DB_PREFIX . "deal_load WHERE deal_id = " . $id);
     $u_info = get_user("*", $deal['user_id']);
     //可用额度
     $can_use_quota = get_can_use_quota($deal['user_id']);
     $root['can_use_quota'] = $can_use_quota;
     $credit_file = get_user_credit_file($deal['user_id']);
     $deal['is_faved'] = 0;
     /*
     		if($GLOBALS['user_info']){
     			$deal['is_faved'] = $GLOBALS['db']->getOne("SELECT count(*) FROM ".DB_PREFIX."deal_collect WHERE deal_id = ".$id." AND user_id=".intval($GLOBALS['user_info']['id']));
     				
     			if($deal['deal_status'] >=4){
     				//还款列表
     				$loan_repay_list = get_deal_load_list($deal);
     				
     				$root['loan_repay_list']= $loan_repay_list;
     				
     				
     				foreach($load_list as $k=>$v){
     					$load_list[$k]['remain_money'] = $v['money'] - $GLOBALS['db']->getOne("SELECT sum(self_money) FROM ".DB_PREFIX."deal_load_repay WHERE user_id=".$v['user_id']." AND deal_id=".$id);
     					if($load_list[$k]['remain_money'] <=0){
     						$load_list[$k]['remain_money'] = 0;
     						$load_list[$k]['status'] = 1;
     					}
     				}
     			}
     			
     		}*/
     $user_statics = sys_user_status($deal['user_id'], true);
     $root['user_statics'] = $user_statics;
     //借款笔数
     $root['load_list'] = $load_list;
     $root['credit_file'] = $credit_file;
     $root['u_info'] = $u_info;
     //工作认证是否过期
     $root['expire'] = user_info_expire($u_info);
     //留言
     $message_list = $GLOBALS['db']->getAll("SELECT title,content,a.create_time,rel_id,a.user_id,a.is_effect,b.user_name FROM " . DB_PREFIX . "message as a left join " . DB_PREFIX . "user as b on  a.user_id = b.id WHERE rel_id = " . $id);
     $root['message'] = $message_list;
     //seo
     if ($deal['type_match_row']) {
         $seo_title = $deal['seo_title'] != '' ? $deal['seo_title'] : $deal['type_match_row'] . " - " . $deal['name'];
     } else {
         $seo_title = $deal['seo_title'] != '' ? $deal['seo_title'] : $deal['name'];
     }
     $root['page_title'] = $seo_title;
     $seo_keyword = $deal['seo_keyword'] != '' ? $deal['seo_keyword'] : $deal['type_match_row'] . "," . $deal['name'];
     $root['page_keyword'] = $seo_keyword;
     $seo_description = $deal['seo_description'] != '' ? $deal['seo_description'] : $deal['name'];
     $root['seo_description'] = $seo_description;
     output($root);
 }
开发者ID:workplayteam,项目名称:P2P,代码行数:60,代码来源:deal_mobile.action.php

示例6: chat_friends

/**
 * List friends' chats that user is member of.
 *
 * @param int $user_guid GUID of the user
 * @return array
 */
function chat_friends($user_guid)
{
    $user = get_user($user_guid);
    if (!$user) {
        forward('chat/all');
    }
    $params = array();
    $params['filter_context'] = 'friends';
    $params['title'] = elgg_echo('chat:title:friends');
    $crumbs_title = $user->name;
    elgg_push_breadcrumb($crumbs_title, "chat/owner/{$user->username}");
    elgg_push_breadcrumb(elgg_echo('friends'));
    elgg_register_title_button();
    $options = array('type' => 'object', 'subtype' => 'chat', 'relationship' => 'member', 'relationship_guid' => $user_guid, 'inverse_relationship' => false, 'limit' => 10, 'pagination' => true, 'full_view' => false);
    if ($friends = get_user_friends($user_guid, ELGG_ENTITIES_ANY_VALUE, 0)) {
        foreach ($friends as $friend) {
            $options['container_guids'][] = $friend->getGUID();
        }
        $params['content'] = elgg_list_entities_from_relationship($options);
    }
    if (empty($params['content'])) {
        $params['content'] = elgg_echo('chat:none');
    }
    return $params;
}
开发者ID:juho-jaakkola,项目名称:elgg-chat,代码行数:31,代码来源:chat.php

示例7: saveUserNotificationsSettings

 /**
  * Save the wire_tools preferences for the user
  *
  * @param string $hook         the name of the hook
  * @param stirng $type         the type of the hook
  * @param array  $return_value the current return value
  * @param array  $params       supplied values
  *
  * @return void
  */
 public static function saveUserNotificationsSettings($hook, $type, $return_value, $params)
 {
     $NOTIFICATION_HANDLERS = _elgg_services()->notifications->getMethods();
     if (empty($NOTIFICATION_HANDLERS) || !is_array($NOTIFICATION_HANDLERS)) {
         return;
     }
     $user_guid = (int) get_input('guid');
     if (empty($user_guid)) {
         return;
     }
     $user = get_user($user_guid);
     if (empty($user) || !$user->canEdit()) {
         return;
     }
     $methods = [];
     foreach ($NOTIFICATION_HANDLERS as $method) {
         $setting = get_input("thewire_tools_{$method}");
         if (!empty($setting)) {
             $methods[] = $method;
         }
     }
     if (!empty($methods)) {
         elgg_set_plugin_user_setting('notification_settings', implode(',', $methods), $user->getGUID(), 'thewire_tools');
     } else {
         elgg_unset_plugin_user_setting('notification_settings', $user->getGUID(), 'thewire_tools');
     }
     // set flag for correct fallback behaviour
     elgg_set_plugin_user_setting('notification_settings_saved', '1', $user->getGUID(), 'thewire_tools');
 }
开发者ID:coldtrick,项目名称:thewire_tools,代码行数:39,代码来源:Notifications.php

示例8: edit

 public function edit($id = null)
 {
     if (IS_POST) {
         $data['id'] = I('id');
         $data['album_name'] = I('album_name');
         $data['album_weight'] = I('album_weight');
         $data['game_id'] = I('game_id');
         $data['album_tags'] = I('album_tags');
         $data['album_intro'] = I('album_intro');
         $data['picture_id'] = I('picture_id');
         $data['album_tags'] = I('album_tags');
         $VideoAlbum = D('VideoAlbum');
         $id = $VideoAlbum->updateVideoAlbum($data);
         if (false !== $id) {
             $this->success('新增成功!', U('index'));
         } else {
             $error = $VideoAlbum->getError();
             $this->error(empty($error) ? '未知错误!' : $error);
         }
     } else {
         if (!$id) {
             $this->error('参数错误');
         }
         $album = D('VideoAlbum')->find($id);
         $this->assign('album', $album);
         $user = get_user($album['uid']);
         $this->assign('user', json_encode($user));
         $games = $this->getGames();
         $this->assign('games', $games);
         $this->display();
     }
 }
开发者ID:nullog,项目名称:zhanglubao,代码行数:32,代码来源:VideoAlbumController.class.php

示例9: group_invite

/**
 * prevent users from being invited to subgroups they can't join
 */
function group_invite($hook, $type, $return, $params)
{
    $user_guid = get_input('user_guid');
    $group_guid = get_input('group_guid');
    $group = get_entity($group_guid);
    $parent = get_parent_group($group);
    // if $parent, then this is a subgroup they're being invited to
    // make sure they're a member of the parent
    if ($parent) {
        if (!is_array($user_guid)) {
            $user_guid = array($user_guid);
        }
        $invalid_users = array();
        foreach ($user_guid as $guid) {
            $user = get_user($guid);
            if ($user && !$parent->isMember($user)) {
                $invalid_users[] = $user;
            }
        }
        if (count($invalid_users)) {
            $error_suffix = "<ul>";
            foreach ($invalid_users as $user) {
                $error_suffix .= "<li>{$user->name}</li>";
            }
            $error_suffix .= "</ul>";
            register_error(elgg_echo('au_subgroups:error:invite') . $error_suffix);
            return false;
        }
    }
}
开发者ID:hypeJunction,项目名称:au_subgroups,代码行数:33,代码来源:hooks.php

示例10: apply

 /**
  * @title 申请兑换
  *
  * @param int $gift_id 物品编号
  *       
  * @method get
  */
 public function apply($gift_id = 0)
 {
     $user = get_user() or ajax_error('USER_NOT_LOGIN', '登录超时,请重新登录!');
     $creditModel = D('Credit');
     $creditModel->apply($user['uid'], $gift_id) or ajax_error($creditModel->getError());
     ajax_success();
 }
开发者ID:torry999,项目名称:lingshi,代码行数:14,代码来源:CreditController.class.php

示例11: page_message

function page_message()
{
    $message_id = $_GET['message'];
    $message = db_easy("SELECT * FROM `intr_message` WHERE `id`={$message_id}");
    $q_comm = db_query("SELECT * FROM `intr_comments` WHERE `message_id`={$message_id} ORDER BY `date` DESC");
    $user = db_easy("SELECT * FROM `users` WHERE `id`=" . $message['user_id']);
    $edit_del_comment_html = "";
    if (check_group("writer") || $user['name'] == get_user()) {
        $edit_del_message_html .= "<br/><a href='" . uri_make_v1(array("UriScript" => 'intranet.php', 'page' => 'message', 'message' => $message_id, 'edit_message' => 'yes', 'message' => $message['id'])) . "' style='font-size:8pt;'>Редактировать</a>";
        $edit_del_message_html .= "<a href='" . uri_make_v1(array("UriScript" => 'intranet.php', 'page' => 'message', 'message' => $message_id, 'delete_message' => 'yes', 'message' => $message['id'])) . "' style='padding-left:10px;font-size:8pt;' onClick=\"if(!confirm('Удалить?')) return false;\">Удалить</a>";
    }
    $comments_html = "";
    while ($comment = db_fetch($q_comm)) {
        $user = db_easy("SELECT * FROM `users` WHERE `id`={$comment['user_id']}");
        $comments_html .= "<div style='margin:15px 0 0 0;padding:0 0 0 10px;border-left:2px solid #AAA;'>";
        $comments_html .= "<span style='font-size:8pt;font-style:italic;'><b>" . $user['name_rus'] . ",</b> " . date("d.m.Y H:i", strtotime($comment['date'])) . "</span><br/>" . $comment['text'] . "</div>";
        if (check_group("writer") || $user['name'] == get_user()) {
            $comments_html .= "<a href='" . uri_make_v1(array("UriScript" => 'intranet.php', 'page' => 'message', 'message' => $message_id, 'edit_comment' => 'yes', 'comment' => $comment['id'])) . "' style='font-size:8pt;'>Редактировать</a>";
            $comments_html .= "<a href='" . uri_make_v1(array("UriScript" => 'intranet.php', 'page' => 'message', 'message' => $message_id, 'delete_comment' => 'yes', 'comment' => $comment['id'])) . "' style='padding-left:10px;font-size:8pt;' onClick=\"if(!confirm('Удалить?')) return false;\">Удалить</a>";
        }
    }
    $html .= template_get('message/message', array("user" => $user['name_rus'], "date" => date("d.m.Y", strtotime($message['date'])), "title" => $message['title'], "edit_del_message" => $edit_del_message_html, "text" => $message['text'], "uri_back" => uri_make_v1(array("UriScript" => "intranet.php")), "uri_comment" => uri_make_v1(array("UriScript" => "intranet.php", "page" => "message", "message" => $message_id, "add_comment" => "yes")), "comments" => $comments_html));
    //Подключаем подвал
    $html .= template_get('footer');
    return $html;
}
开发者ID:jsib,项目名称:dumps.loc,代码行数:26,代码来源:message.php

示例12: get_contact_func

function get_contact_func($xmlrpc_params)
{
    global $db, $lang, $theme, $plugins, $mybb, $session, $settings, $cache, $time, $mybbgroups, $parser, $displaygroupfields;
    $lang->load("member");
    $input = Tapatalk_Input::filterXmlInput(array('user_id' => Tapatalk_Input::STRING), $xmlrpc_params);
    if (isset($input['user_id']) && !empty($input['user_id'])) {
        $uid = $input['user_id'];
    } else {
        $uid = $mybb->user['uid'];
    }
    if ($mybb->user['uid'] != $uid) {
        $member = get_user($uid);
    } else {
        $member = $mybb->user;
    }
    if (!$member['uid']) {
        error($lang->error_nomember);
    }
    // Guests or those without permission can't email other users
    if ($mybb->usergroup['cansendemail'] == 0 || !$mybb->user['uid']) {
        error_no_permission();
    }
    if ($member['hideemail'] != 0) {
        error($lang->error_hideemail);
    }
    $user_info = array('result' => new xmlrpcval(true, 'boolean'), 'user_id' => new xmlrpcval($member['uid']), 'display_name' => new xmlrpcval(basic_clean($member['username']), 'base64'), 'enc_email' => new xmlrpcval(base64_encode(encrypt($member['email'], loadAPIKey()))));
    $xmlrpc_user_info = new xmlrpcval($user_info, 'struct');
    return new xmlrpcresp($xmlrpc_user_info);
}
开发者ID:dthiago,项目名称:tapatalk-mybb,代码行数:29,代码来源:get_contact.php

示例13: deleteRequest

 /**
  * Listen to the delete of a membership request
  *
  * @param stirng            $event        the name of the event
  * @param stirng            $type         the type of the event
  * @param \ElggRelationship $relationship the relationship
  *
  * @return void
  */
 public static function deleteRequest($event, $type, $relationship)
 {
     if (!$relationship instanceof \ElggRelationship) {
         return;
     }
     if ($relationship->relationship !== 'membership_request') {
         // not a membership request
         return;
     }
     $action_pattern = '/action\\/groups\\/killrequest/i';
     if (!preg_match($action_pattern, current_page_url())) {
         // not in the action, so do nothing
         return;
     }
     $group = get_entity($relationship->guid_two);
     $user = get_user($relationship->guid_one);
     if (empty($user) || !$group instanceof \ElggGroup) {
         return;
     }
     if ($user->getGUID() === elgg_get_logged_in_user_guid()) {
         // user kills own request
         return;
     }
     $reason = get_input('reason');
     if (empty($reason)) {
         $body = elgg_echo('group_tools:notify:membership:declined:message', array($user->name, $group->name, $group->getURL()));
     } else {
         $body = elgg_echo('group_tools:notify:membership:declined:message:reason', array($user->name, $group->name, $reason, $group->getURL()));
     }
     $subject = elgg_echo('group_tools:notify:membership:declined:subject', array($group->name));
     $params = array('object' => $group, 'action' => 'delete');
     notify_user($user->getGUID(), $group->getGUID(), $subject, $body, $params);
 }
开发者ID:lorea,项目名称:Hydra-dev,代码行数:42,代码来源:Membership.php

示例14: index

 public function index($manifest = '')
 {
     // 更新用户token(临时,新版本客户端主动触发registerPush接口)
     $user = get_user();
     if ($user && M('common_push_device')->where(['mobile' => $user['mobile']])->count() < 1) {
         $xg = new \Common\Util\XgPush();
         $xg->syncUserToken($user['mobile']);
     }
     // 顶部广告
     $ads = M('app_advertisement')->where(['status' => ['egt', 1]])->order('sort asc,id desc')->field('id,pic,title,url')->select();
     foreach ($ads as &$vo) {
         $vo['url'] = $vo['url'] ?: '/public/page/type/app_ad/id/' . $vo['id'];
     }
     $this->assign('ad_list', $ads);
     // 模块
     $modules = M('app_module')->where(['status' => ['egt', 1]])->order('sort asc,id desc')->field('id,pic,name,url,background')->select();
     foreach ($ads as &$vo) {
         $vo['url'] = $vo['url'] ?: '/public/page/type/app_ad/id/' . $vo['id'];
     }
     $modules[0]['size'] = 'big';
     $modules[1]['size'] = 'wide';
     $modules[2]['size'] = 'wide';
     $modules[3]['size'] = 'mid';
     $modules[4]['size'] = 'mid';
     $modules[5]['size'] = 'mid';
     $modules[6]['size'] = 'wide';
     $modules[7]['size'] = 'wide';
     $this->assign('modules', $modules);
     if ($manifest) {
         $this->assign('tag', md5(serialize($ads + $modules)));
         $this->display('manifest', 'utf-8', 'text/cache-manifest');
     } else {
         $this->display();
     }
 }
开发者ID:torry999,项目名称:lingshi,代码行数:35,代码来源:CampusController.class.php

示例15: checkUserAuthentication

/**
 * Checks whether or not there is an authenticated
 * user in the session. If not, responds with error message.
 */
function checkUserAuthentication($app)
{
    $user = get_user();
    if (!$user) {
        $app->renderErrJson($app, 401, 'User is not authenticated.');
    }
}
开发者ID:hrigu,项目名称:dredit,代码行数:11,代码来源:utils.php


注:本文中的get_user函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。