本文整理汇总了PHP中user::get方法的典型用法代码示例。如果您正苦于以下问题:PHP user::get方法的具体用法?PHP user::get怎么用?PHP user::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类user
的用法示例。
在下文中一共展示了user::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: award_points
public static function award_points($points, $eventmsg = false, $user = false)
{
if (!$user) {
if (!user::logged()) {
return false;
}
$user = user::get();
} else {
if (!$user instanceof Model_User) {
$user = ORM::factory('User', $user_id);
if (!$user->loaded()) {
return false;
}
}
}
if ($eventmsg) {
$event = ORM::factory('User_Event');
$event->user_id = $user->id;
$event->message = $eventmsg;
$event->created = $user->timestamp();
$event->save();
}
$user->points += $points;
$user->save();
}
示例2: getSectorLink
public function getSectorLink($x, $y, &$i)
{
if (isset($this->data[$i]) && $this->data[$i]['x'] == $x && $this->data[$i]['y'] == $y) {
if ($this->data[$i]['type'] != 2) {
$output = 'href="javascript: fetch(\'getGrid.php\', \'x=' . $x . '&y=' . $y . '\')" onMouseOver="setSectorData(labels[' . $this->data[$i]['type'] . '], \'-\', \'-\')" onMouseOut="setSectorData(\'-\', \'-\', \'-\')"';
} else {
$node = new node();
$node->get('id', $this->data[$i]['id']);
$user = new user();
$user->get('id', $node->data['user']);
$alliancename = '-';
if ($user->data['alliance']) {
$alliance = new alliance();
$alliance->get('user', $user->data['id']);
$alliancename = $alliance->data['name'];
}
$output = 'href="javascript: fetch(\'getGrid.php\', \'x=' . $x . '&y=' . $y . '\')" onMouseOver="setSectorData(\'' . $node->data['name'] . '\', \'' . $user->data['name'] . '\', \'' . $alliancename . '\')" onMouseOut="setSectorData(\'-\', \'-\', \'-\')"';
}
if ($i < count($this->data) - 1) {
$i++;
}
} else {
$output = 'href="javascript: fetch(\'getGrid.php\', \'x=' . $x . '&y=' . $y . '\')"';
}
return $output;
}
示例3: action_login
public function action_login()
{
if ((bool) arr::get($_GET, 'return', false)) {
site::set_last_url($this->request->referrer());
}
$error = false;
if ($_POST) {
$email = arr::get($_POST, 'email', '');
$password = arr::get($_POST, 'password', '');
$remember = arr::get($_POST, 'remember', '') == 'yes';
if (user::login($email, $password, $remember)) {
$user = user::get();
notes::success('You have been logged in. Welcome back!');
$lasturl = site::get_last_url();
if ($lasturl) {
site::redirect($lasturl);
}
site::redirect('write');
} else {
//notes::error('Wrong username or password. Please try again.');
$error = true;
}
}
$this->bind('error', $error);
}
示例4: user_data
function user_data($vars = null)
{
$vars['uid'] or iPHP::warning('iCMS:user:data 标签出错! 缺少"uid"属性或"uid"值为空.');
$uid = $vars['uid'];
if ($uid == 'me') {
$uid = 0;
$auth = user::get_cookie();
$auth && ($uid = user::$userid);
}
if (strpos($uid, ',') === false) {
$user = (array) user::get($uid);
if ($vars['data']) {
$user += (array) user::data($uid);
}
} else {
$uid_array = explode(',', $uid);
foreach ($uid_array as $key => $value) {
$user[$key] = (array) user::get($uid);
if ($vars['data']) {
$user[$key] += (array) user::data($uid);
}
}
}
return $user[0] === false ? false : (array) $user;
}
示例5: add
public function add()
{
global $db;
$recipient = new user();
if ($recipient->get('name', $this->data['recipient']) == 'done') {
$sender = new user();
if ($sender->get('name', $this->data['sender']) == 'done') {
if (!$sender->isBlocked($recipient->data['id'])) {
$this->data['id'] = misc::newId('messages');
$sent = strftime('%Y-%m-%d %H:%M:%S', time());
$db->query('insert into messages (id, sender, recipient, subject, body, sent, viewed) values ("' . $this->data['id'] . '", "' . $sender->data['id'] . '", "' . $recipient->data['id'] . '", "' . $this->data['subject'] . '", "' . $this->data['body'] . '", "' . $sent . '", "' . $this->data['viewed'] . '")');
if ($db->affected_rows() > -1) {
$status = 'done';
} else {
$status = 'error';
}
} else {
$status = 'blocked';
}
} else {
$status = 'noSender';
}
} else {
$status = 'noRecipient';
}
return $status;
}
示例6: action_index
public function action_index()
{
$this->require_login();
$this->bind('user', user::get());
seo::instance()->title("Morning Pages Profile");
seo::instance()->description("By default, Morning Pages has private profiles. If you'd like, however, you may turn it on at any time.");
}
示例7: action_index
public function action_index()
{
$user = user::get();
$messages = array();
$usermessages = $user->messages->find_all();
if ((bool) $usermessages->count()) {
foreach ($usermessages as $message) {
$messages[] = $message->info();
}
}
$roles = $user->roles->find_all();
$roleids = array();
if ((bool) $roles->count()) {
foreach ($roles as $role) {
$roleids[] = $role->id;
}
}
if ((bool) count($roleids)) {
$rolemessages = ORM::factory('Message')->where('role_id', 'in', $roleids)->where('user_id', '!=', $user->id)->find_all();
if ((bool) $rolemessages->count()) {
foreach ($rolemessages as $message) {
$messages[] = $message->info();
}
}
}
reply::ok(View::factory('Cms/Messages/index', array('messages' => $messages, 'roles' => user::get()->roles->find_all()->as_array())), 'messages', array('viewModel' => 'viewModels/Messages/index', 'messages' => $messages));
}
示例8: action_all
public function action_all()
{
$dashboards = user::get()->dashboards->find_all();
$darray();
foreach ($dashboards as $dashboard) {
$darray[] = $dashboard->info();
}
ajax::success('', array('dashboards' => $darray));
}
示例9: getChat
public static function getChat($clientid)
{
$return = '';
$user = new beuser($_SESSION['beuser_id']);
$RS = $user->getChat(0, $clientid);
$client = new user($clientid);
foreach ($RS as $msg) {
if ($msg['recipient_id'] == 0) {
// FROM client
$return .= '<div class="row chat_entry chat_relo" data-msgid="' . $msg['id'] . '">
<div class="col-xs-1">
<img class="chat_userimg" src="../data/img/_users/_thumbs/' . $client->get('profilepic') . '">
</div>
<div class="col-xs-6 chat_message">
<div class="chat_time">
' . $client->get('firstname') . ' ' . $client->get('lastname') . ' | ' . date('d.m.Y H:i', $msg['time']) . '
</div>
' . $msg['text'] . '
</div>
</div>';
} else {
if ($msg['recipient_id'] == $clientid) {
//FROM RELO
$messenger = new beuser($msg['sender_id']);
$return .= '<div class="row chat_entry chat_client" data-msgid="' . $msg['id'] . '">
<div class="col-xs-6 col-xs-offset-5 text-right chat_message">
<div class="chat_time text-right">
' . $user->get('firstname') . ' ' . $user->get('lastname') . ' | ' . date('d.m.Y H:i', $msg['time']) . '
</div>
' . $msg['text'] . '
</div>
<div class="col-xs-1">
<img class="chat_userimg" src="../data/img/_users/_thumbs/' . $user->get('profilepic') . '">
</div>
</div>';
}
}
}
//end foreach
return $return;
}
示例10: getCblockList
public function getCblockList($id = 0, $maxlevel = 0, $roleid = 0, $filterArray)
{
if ($filterArray[0]['CBID']) {
$limit = array('CBID' => $filterArray[0]['CBID']);
$coList = \sCblockMgr()->filterEntrymasks(false, $this->getFilter(), $limit, false);
} else {
$limit = array('FOLDER' => $id);
$coList = \sCblockMgr()->filterEntrymasks(false, $this->getFilter(), $limit, false);
}
// Get additional data for each formfield (and strip folders)
$finalCoList = array();
foreach ($coList as $coListItem) {
if ($coListItem['FOLDER'] == 0) {
// get last modifier
$history = \sCblockMgr()->history->getList($coListItem['CBID']);
if ($allMailingsItem['CHANGEDBY']) {
$userObj = new \user($history[0]['UID'] ? $history[0]['UID'] : $coListItem['CHANGEDBY']);
} else {
$userObj = new \user($history[0]['UID'] ? $history[0]['UID'] : $coListItem['CREATEDBY']);
}
$userInfo = $userObj->get();
$userProps = $userObj->properties->getValues($userInfo['ID']);
$userInfo['PROPS'] = $userProps;
// Get controls
$cb = new \Cblock($coListItem['CBID']);
$coListItem['ENTRYMASKS'] = $cb->getEntrymasks();
// Get additional control info
$col1Data = array(array('CO_NAME' => $coListItem['NAME'], 'FORMFIELD' => 101, 'OBJECTIDENTIFIER' => true));
$col2Data = array(array('USER_NAME' => trim($userInfo['PROPS']['FIRSTNAME'] . ' ' . $userInfo['PROPS']['LASTNAME']), 'USER_ID' => $userInfo['ID'], 'FORMFIELD' => 100));
$col3Data = array(array('CHANGEDTS' => TStoLocalTS($coListItem['CHANGEDTS']), 'FORMFIELD' => 103));
$result[0] = $col1Data;
$result[1] = $col2Data;
$result[2] = $col3Data;
$data = array('CBID' => $coListItem['CBID'], 'CBVERSION' => $coListItem['CBVERSION'], 'NAME' => $coListItem['NAME'], 'HASCHANGED' => $coListItem['HASCHANGED'], 'FIELDS' => $result, 'RREAD' => $coListItem['RREAD'], 'RWRITE' => $coListItem['RWRITE'], 'RDELETE' => $coListItem['RDELETE'], 'RSUB' => $coListItem['RSUB'], 'RSTAGE' => $coListItem['RSTAGE'], 'RMODERATE' => $coListItem['RMODERATE'], 'RCOMMENT' => $coListItem['RCOMMENT']);
array_push($finalCoList, $data);
}
}
if (!$filterArray[0]['CBID']) {
$pageDirOrderBy = $filterArray[1]['VALUE'];
$pageDirOrderDir = $filterArray[1]['VALUE2'];
if (strlen($pageDirOrderBy) && strlen($pageDirOrderDir)) {
$listColumns = $this->getListColumns();
usort($finalCoList, array('com\\nt\\DefaultCblockListView', $listColumns['COLUMNS'][$pageDirOrderBy]['SORTFUNC']));
if ($pageDirOrderDir == -1) {
$finalCoList = array_reverse($finalCoList);
}
}
$pageDirFrom = $filterArray[0]['VALUE'];
$pageDirCount = $filterArray[0]['VALUE2'];
if (strlen($pageDirFrom) && strlen($pageDirCount)) {
$finalCoList = array_slice($finalCoList, $pageDirFrom, $pageDirCount);
}
}
return $finalCoList;
}
示例11: get_current
public static function get_current()
{
$dashboard = ORM::factory('Dashboard')->where('user_id', '=', user::get()->id)->where('current', '=', '1')->find();
if (!$dashboard->loaded()) {
$dashboard->user_id = user::get()->id;
$dashboard->current = 1;
$dashboard->order = 0;
$dashboard->name = 'Default';
$dashboard->save();
}
return $dashboard;
}
示例12: superuser
function superuser($id = "")
{
if (!$id and $id = user::id()) {
$id = user::id();
}
$userArray = user::get($id);
if (group::superuser($userArray[group])) {
return TRUE;
} else {
return FALSE;
}
}
示例13: login
/**
* Login
* Load user information in session
* @param int $id User ID
* @return bool User found
*/
public static function login($id)
{
$user = new user((int) $id);
if ($user->ok()) {
$_SESSION['user'] = $user->get();
$_SESSION['user']['login'] = time();
self::save();
return true;
} else {
return false;
}
}
示例14: action_write
public function action_write()
{
$errors = false;
$page = false;
if (user::logged()) {
$page = $this->request->param('page');
if ($_POST && strlen(arr::get($_POST, 'content', '')) > 0) {
$content = arr::get($_POST, 'content', '');
if ($page->type == 'page') {
$raw = $page->rawcontent();
if ($raw != "") {
$content = $raw . "\n" . $content;
}
} else {
if ($page->type == 'autosave') {
$page->type = 'page';
}
}
try {
$page->wordcount = site::count_words($content);
$page->content = $content;
if ($page->wordcount >= 750 && !(bool) $page->counted) {
user::update_stats($page);
$page->counted = 1;
}
$page->duration = $page->duration + (time() - arr::get($_POST, 'start', 999));
$page->update();
$oldsaves = ORM::factory('Page')->where('type', '=', 'autosave')->where('user_id', '=', user::get()->id)->find_all();
if ((bool) $oldsaves->count()) {
foreach ($oldsaves as $old) {
$old->delete();
}
}
achievement::check_all(user::get());
notes::success('Your page has been saved!');
//site::redirect('write/'.$page->day);
} catch (ORM_Validation_Exception $e) {
$errors = $e->errors('models');
}
}
} else {
if ($_POST) {
notes::error('You must be logged in to save your page. Please log in and submit again.');
}
}
$this->bind('errors', $errors);
$this->bind('page', $page);
$this->template->daystamp = $this->request->param('daystamp');
$this->template->page = $page;
seo::instance()->title("Write Your Morning Pages");
seo::instance()->description("Morning Pages is about writing three pages of stream of consciousness thought every day. Become a better person by using MorninPages.net");
}
示例15: fetchXML
function fetchXML()
{
$this->isAllianceStandings_ = false;
$this->isCorporationStandings_ = false;
if ($this->isUser_) {
// is a player feed - take details from logged in user
if (user::get('usr_pilot_id')) {
$myEveCharAPI = new API_CharacterSheet();
$this->html .= $myEveCharAPI->fetchXML();
$skills = $myEveCharAPI->getSkills();
$this->connections_ = 0;
$this->diplomacy_ = 0;
foreach ((array) $skills as $myTempData) {
if ($myTempData['typeID'] == "3359") {
$this->connections_ = $myTempData['Level'];
}
if ($myTempData['typeID'] == "3357") {
$this->diplomacy_ = $myTempData['Level'];
}
}
$myKeyString = array();
$myKeyString["userID"] = $this->API_userID_;
$myKeyString["apiKey"] = $this->API_apiKey_;
$myKeyString["characterID"] = $this->API_characterID_;
$data = $this->loaddata($myKeyString, "char");
} else {
return "You are not logged in.";
}
} else {
// is a corp feed
$myKeyString = "userID=" . $this->API_userID_ . "&apiKey=" . $this->API_apiKey_ . "&characterID=" . $this->API_characterID_;
$data = $this->loaddata($myKeyString, "corp");
}
$xml_parser = xml_parser_create();
xml_set_object($xml_parser, $this);
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, 'characterData');
if (!xml_parse($xml_parser, $data, true)) {
return "<i>Error getting XML data from " . API_SERVER . "/Standings.xml.aspx </i><br><br>";
}
xml_parser_free($xml_parser);
// sort the arrays (in descending order of standing)
$this->Factions_ = $this->mysortarray($this->Factions_);
$this->Characters_ = $this->mysortarray($this->Characters_);
$this->Corporations_ = $this->mysortarray($this->Corporations_);
$this->Alliances_ = $this->mysortarray($this->Alliances_);
$this->Agents_ = $this->mysortarray($this->Agents_);
$this->NPCCorporations_ = $this->mysortarray($this->NPCCorporations_);
$this->AllianceCorporations_ = $this->mysortarray($this->AllianceCorporations_);
$this->AllianceAlliances_ = $this->mysortarray($this->AllianceAlliances_);
return $this->html;
}