本文整理汇总了PHP中Users::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Users::get方法的具体用法?PHP Users::get怎么用?PHP Users::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Users
的用法示例。
在下文中一共展示了Users::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildLinks
public function buildLinks($fileid)
{
$user = new Users();
$rowSetUsers = $this->getLinkOnAvatar($fileid);
foreach ($rowSetUsers as $rowUser) {
$user->set($rowUser);
Sydney_Search_Files_Result::init($user->getModule(), 'Avatar', $user->get()->id);
Sydney_Search_Files_Result::add('label', $user->__toString());
Sydney_Search_Files_Result::add('link', '/adminpeople/index/editindex/id/' . $user->get()->id);
}
}
示例2: get_dashboard
/**
* Handles get requests for the dashboard
* @todo update check should probably be cron'd and cached, not re-checked every load
*/
public function get_dashboard()
{
// Not sure how best to determine this yet, maybe set an option on install, maybe do this:
$firstpostdate = DB::get_value('SELECT min(pubdate) FROM {posts} WHERE status = ?', array(Post::status('published')));
$this->theme->active_time = HabariDateTime::date_create($firstpostdate);
// get the active theme, so we can check it
// @todo this should be worked into the main Update::check() code for registering beacons
$active_theme = Themes::get_active();
$active_theme = $active_theme->name . ':' . $active_theme->version;
// check to see if we have updates to display
$this->theme->updates = Options::get('updates_available', array());
// collect all the stats we display on the dashboard
$this->theme->stats = array('author_count' => Users::get(array('count' => 1)), 'page_count' => Posts::get(array('count' => 1, 'content_type' => Post::type('page'), 'status' => Post::status('published'))), 'entry_count' => Posts::get(array('count' => 1, 'content_type' => Post::type('entry'), 'status' => Post::status('published'))), 'comment_count' => Comments::count_total(Comment::STATUS_APPROVED, false), 'tag_count' => Tags::vocabulary()->count_total(), 'page_draft_count' => Posts::get(array('count' => 1, 'content_type' => Post::type('page'), 'status' => Post::status('draft'), 'user_id' => User::identify()->id)), 'entry_draft_count' => Posts::get(array('count' => 1, 'content_type' => Post::type('entry'), 'status' => Post::status('draft'), 'user_id' => User::identify()->id)), 'unapproved_comment_count' => User::identify()->can('manage_all_comments') ? Comments::count_total(Comment::STATUS_UNAPPROVED, false) : Comments::count_by_author(User::identify()->id, Comment::STATUS_UNAPPROVED), 'spam_comment_count' => User::identify()->can('manage_all_comments') ? Comments::count_total(Comment::STATUS_SPAM, false) : Comments::count_by_author(User::identify()->id, Comment::STATUS_SPAM), 'user_entry_scheduled_count' => Posts::get(array('count' => 1, 'content_type' => Post::type('any'), 'status' => Post::status('scheduled'), 'user_id' => User::identify()->id)));
$this->fetch_dashboard_modules();
// check for first run
$u = User::identify();
if (!isset($u->info->experience_level)) {
$this->theme->first_run = true;
$u->info->experience_level = 'user';
$u->info->commit();
} else {
$this->theme->first_run = false;
}
$this->display('dashboard');
}
示例3: get_dashboard
/**
* Handles get requests for the dashboard
* @todo update check should probably be cron'd and cached, not re-checked every load
*/
public function get_dashboard()
{
// Not sure how best to determine this yet, maybe set an option on install, maybe do this:
$firstpostdate = DB::get_value('SELECT min(pubdate) FROM {posts} WHERE status = ?', array(Post::status('published')));
if ($firstpostdate) {
$this->theme->active_time = DateTime::create($firstpostdate);
}
// check to see if we have updates to display
$this->theme->updates = Options::get('updates_available', array());
// collect all the stats we display on the dashboard
$user = User::identify();
$this->theme->stats = array('author_count' => Users::get(array('count' => 1)), 'post_count' => Posts::get(array('count' => 1, 'content_type' => Post::type('any'), 'status' => Post::status('published'))), 'comment_count' => Comments::count_total('approved', false), 'tag_count' => Tags::vocabulary()->count_total(), 'user_draft_count' => Posts::get(array('count' => 1, 'content_type' => Post::type('any'), 'status' => Post::status('draft'), 'user_id' => $user->id)), 'unapproved_comment_count' => User::identify()->can('manage_all_comments') ? Comments::count_total('unapproved', false) : Comments::count_by_author(User::identify()->id, Comment::status('unapproved')), 'spam_comment_count' => $user->can('manage_all_comments') ? Comments::count_total('spam', false) : Comments::count_by_author($user->id, Comment::status('spam')), 'user_scheduled_count' => Posts::get(array('count' => 1, 'content_type' => Post::type('any'), 'status' => Post::status('scheduled'), 'user_id' => $user->id)));
// check for first run
$u = User::identify();
$uinfo = $u->info;
if (!isset($uinfo->experience_level)) {
$this->theme->first_run = true;
$u->info->experience_level = 'user';
$u->info->commit();
} else {
$this->theme->first_run = false;
}
$this->get_additem_form();
Stack::add('admin_header_javascript', 'dashboard-js');
$this->display('dashboard');
}
示例4: get_user
public static function get_user()
{
if (is_null(self::$user_object)) {
self::$user_object = Users::get(self::$data["username"]);
}
return self::$user_object;
}
示例5: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$users = Users::get();
$comments = Comments::get();
$supports = Supports::get();
$notes = Notes::get();
$usersJson = array();
$commentsJson = array();
$supportsJson = array();
$notesJson = array();
// build users
foreach ($users as $user) {
array_push($usersJson, array('id' => $user->id, 'name' => $user->name));
}
// build comments
foreach ($comments as $comment) {
array_push($commentsJson, array('id' => $comment->id, 'article_id' => $comment->article_id, 'user_id' => $comment->user_id, 'comment' => $comment->comment, 'challenge' => $comment->challenge));
}
// build supports
foreach ($supports as $support) {
array_push($supportsJson, array('id' => $support->id, 'user_id' => $support->user_id, 'comment_id' => $support->comment_id));
}
// build notes
foreach ($notes as $note) {
array_push($notesJson, array('id' => $note->id, 'comment_id' => $note->comment_id, 'comment' => $note->comment));
}
// build json
$json = array('users' => $usersJson, 'comments' => $commentsJson, 'supports' => $supportsJson, 'notes' => $notesJson);
// display json
echo json_encode($json);
}
示例6: action_handler_display_user
public function action_handler_display_user($params)
{
$users = Users::get(array('info' => array('ircnick' => $params['username'])));
//Utils::debug($user->info);
switch (count($users)) {
case 0:
$xml = new SimpleXMLElement('<error>No user with that IRC nickname.</error>');
break;
default:
$xml = new SimpleXMLElement('<error>More than one user is registered under that nickname!</error>');
break;
case 1:
$user = reset($users);
$xml = new SimpleXMLElement('<userinfo></userinfo>');
$xml['nickname'] = $params['username'];
$xml->blog = $user->info->blog;
$xml->name = $user->info->displayname;
$xml->nickname = $user->info->ircnick;
break;
}
header('Content-type: text/xml');
ob_clean();
// no idea why we get a blank line at the beginning, but it breaks XML parsing
echo $xml->asXML();
}
示例7: pdoEditModelAction
public function pdoEditModelAction($id)
{
$this->_view->title = 'Model Edit Form';
$this->_view->link = base_url() . 'pdo-database/pdo-model/pdo-edit-model/' . $id;
$users = new Users();
$row = $users->get($id);
if (empty($row)) {
redirect('pdo-database/pdo-model/pdo-model');
}
$this->_view->data = $row;
if (!empty($_POST)) {
$val = new Validation();
$val->source = $_POST;
$val->addValidator(array('name' => 'first_name', 'type' => 'string', 'required' => true));
$val->addValidator(array('name' => 'last_name', 'type' => 'string', 'required' => true));
$val->addValidator(array('name' => 'email', 'type' => 'email', 'required' => true));
$val->addValidator(array('name' => 'address', 'type' => 'string', 'required' => true));
$val->run();
if (sizeof($val->errors) == 0) {
$data = array('first_name' => $_POST['first_name'], 'last_name' => $_POST['last_name'], 'email' => $_POST['email'], 'address' => $_POST['address']);
$users->update($id, $data);
redirect('pdo-database/pdo-model/pdo-model');
}
$this->_view->errorMessage = $val->errorMessage();
$this->_view->data = $_POST;
}
$this->renderView('pdo-database/pdo-model/_form');
}
示例8: countStats
function countStats()
{
$resultData = array();
$today = date('Y-m-d');
$loadData = Post::get(array('query' => "select count(postid)as totalcount from " . Database::getPrefix() . "post"));
$resultData['post']['total'] = $loadData[0]['totalcount'];
$loadData = Post::get(array('query' => "select count(postid)as totalcount from " . Database::getPrefix() . "post where DATE(date_added)='{$today}'"));
$resultData['post']['today'] = $loadData[0]['totalcount'];
$loadData = Post::get(array('query' => "select count(postid)as totalcount from " . Database::getPrefix() . "post where status='1'"));
$resultData['post']['published'] = $loadData[0]['totalcount'];
$loadData = Post::get(array('query' => "select count(postid)as totalcount from " . Database::getPrefix() . "post where status='0'"));
$resultData['post']['pending'] = $loadData[0]['totalcount'];
$loadData = Comments::get(array('query' => "select count(commentid)as totalcount from " . Database::getPrefix() . "comments"));
$resultData['comments']['total'] = $loadData[0]['totalcount'];
$loadData = Comments::get(array('query' => "select count(commentid)as totalcount from " . Database::getPrefix() . "comments where DATE(date_added)='{$today}'"));
$resultData['comments']['today'] = $loadData[0]['totalcount'];
$loadData = Comments::get(array('query' => "select count(commentid)as totalcount from " . Database::getPrefix() . "comments where status='1'"));
$resultData['comments']['approved'] = $loadData[0]['totalcount'];
$loadData = Comments::get(array('query' => "select count(commentid)as totalcount from " . Database::getPrefix() . "comments where status='0'"));
$resultData['comments']['pending'] = $loadData[0]['totalcount'];
$loadData = Contactus::get(array('query' => "select count(contactid)as totalcount from " . Database::getPrefix() . "contactus"));
$resultData['contactus']['total'] = $loadData[0]['totalcount'];
$loadData = Contactus::get(array('query' => "select count(contactid)as totalcount from " . Database::getPrefix() . "contactus where DATE(date_added)='{$today}'"));
$resultData['contactus']['today'] = $loadData[0]['totalcount'];
$loadData = Users::get(array('query' => "select count(userid)as totalcount from " . Database::getPrefix() . "users"));
$resultData['users']['total'] = $loadData[0]['totalcount'];
$loadData = Users::get(array('query' => "select count(userid)as totalcount from " . Database::getPrefix() . "users where DATE(date_added)='{$today}'"));
$resultData['users']['today'] = $loadData[0]['totalcount'];
return $resultData;
}
示例9: action_ajax_update
public function action_ajax_update($handler)
{
$users = Users::get();
$payload = $handler->handler_vars->raw('payload');
$decoded_payload = json_decode($payload);
if (isset($decoded_payload)) {
// Invalid decoded JSON is NULL.
$commit_sha = $decoded_payload->after;
$owner = isset($decoded_payload->repository->organization) ? $decoded_payload->repository->organization : $decoded_payload->repository->owner->name;
$repo_URL = $decoded_payload->repository->url;
$tree_URL = "https://api.github.com/repos/" . $owner . "/" . $decoded_payload->repository->name . "/git/trees/{$commit_sha}";
$decoded_tree = json_decode(file_get_contents($tree_URL, 0, null, null));
$xml_urls = array_map(function ($a) {
if (strpos($a->path, ".plugin.xml") !== false || $a->path === 'theme.xml') {
return $a->url;
// path was just the filename, url is the API endpoint for the file itself
}
}, $decoded_tree->tree);
$xml_urls = array_filter($xml_urls);
// remove NULLs
if (count($xml_urls) === 1) {
$xml_URL = array_pop($xml_urls);
$decoded_blob = json_decode(file_get_contents($xml_URL, 0, null, null));
if ($decoded_blob->encoding === 'base64') {
$xml_data = base64_decode($decoded_blob->content);
} else {
if ($decoded_blob->encoding === 'utf-8') {
// does it need to be decoded?
} else {
// there's an invalid encoding.
return;
}
}
$xml_object = simplexml_load_string($xml_data, 'SimpleXMLElement');
/* can't hurt to hold onto these */
$xml_object->addChild("xml_string", $xml_object->asXML());
/* won't always need these */
$xml_object->addChild("tree_url", $tree_URL);
$xml_object->addChild("blob_url", $xml_URL);
$xml_object->addChild("ping_contents", $payload);
/* might need this. Or should it go in downloadurl? */
$xml_object->addChild("repo_url", $repo_URL);
/* need to check if there's already a posts with this guid */
if (!isset($xml_object->guid) || trim($xml_object->guid) == '') {
// You must have a GUID or we can't find your plugin...
// @todo Send the owner an error message/file an issue on the repo
$this->file_issue($owner, $decoded_payload->repository->name, 'Info XML needs a GUID', "Habari addons require a GUID to be listed in the Addons Directory.<br>Please create and add a GUID to your xml file. You can use this one, which is new:<br><b>" . UUID::get() . "</b>");
} else {
EventLog::log(_t('Making post for GUID %s', array(trim($xml_object->guid))), 'info');
self::make_post_from_XML($xml_object);
}
} else {
// Wrong number of xml files.
$this->file_issue($owner, $decoded_payload->repository->name, 'Too many XML files', "Habari addons should have a single XML file containing addon information.<br>");
}
} else {
// Something has gone wrong with the json_decode. Do nothing, since there is nothing that can really be done.
}
}
示例10: get_delete
public function get_delete($userID)
{
$user = Users::get($userID);
if ($user != null) {
return View::make('admin/users.delete')->with('user', $user);
} else {
return "Error";
}
}
示例11: layout
/**
* list comments as successive notes in a thread
*
* @param resource the SQL result
* @return string the rendered text
**/
function layout($result)
{
global $context;
// we return formatted text
$text = '';
// empty list
if (!SQL::count($result)) {
return $text;
}
// build a list of comments
while ($item = SQL::fetch($result)) {
// automatic notification
if ($item['type'] == 'notification') {
$text = '<dd class="thread_other" style="font-style: italic;">' . ucfirst(trim($item['description'])) . '</dd>' . $text;
} else {
// link to user profile -- open links in separate window to enable side browsing of participant profiles
if ($item['create_id']) {
if ($user = Users::get($item['create_id']) && $user['full_name']) {
$hover = $user['full_name'];
} else {
$hover = NULL;
}
$author = Users::get_link($item['create_name'], $item['create_address'], $item['create_id'], TRUE, $hover);
} else {
$author = Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id'], TRUE);
}
// differentiate my posts from others
if (Surfer::get_id() && $item['create_id'] == Surfer::get_id()) {
$style = ' class="thread_me"';
} else {
$style = ' class="thread_other"';
}
// a clickable label
$stamp = '#';
// flag old items on same day
if (!strncmp($item['edit_date'], gmstrftime('%Y-%m-%d %H:%M:%S', time()), 10)) {
$stamp = Skin::build_time($item['edit_date']);
} else {
$stamp = Skin::build_date($item['edit_date']);
}
// append this at the end of the comment
$stamp = ' <div style="float: right; font-size: x-small">' . Skin::build_link(Comments::get_url($item['id']), $stamp, 'basic', i18n::s('Edit')) . '</div>';
// package everything --change order to get oldest first
$text = '<dt' . $style . '>' . $author . '</dt><dd' . $style . '>' . $stamp . ucfirst(trim($item['description'])) . '</dd>' . $text;
}
}
// end of processing
SQL::free($result);
// finalize the returned definition list
if ($text) {
$text = '<dl>' . $text . '</dl>';
}
// process yacs codes
$text = Codes::beautify($text);
return $text;
}
示例12: getFollows
/**
* Get the list of users this user follows.
* @param interger|null $id user id
* @param array $params delimiting parameters
* @param array $requestOpts request options
* @return array results
*/
public function getFollows($id = null, $params = array(), $requestOpts = array())
{
if (null === $id) {
if (null === $this->getAuthClientId()) {
return parent::get('self/follows', $params, $requestOpts);
}
return parent::get($this->getAuthClientId() . '/follows', $params, $requestOpts);
}
return parent::get($id . '/follows', $params, $requestOpts);
}
示例13: form
public function form()
{
$this->views = new Views(new Template("admin"));
$this->views->title = "Adicionar voluntário";
if (isset($this->get->uid)) {
$this->views->title = "Editar voluntário";
$this->views->data = Users::get($this->get->uid);
}
$this->views->display('users_form.phtml');
}
示例14: loadApi
function loadApi($action)
{
switch ($action) {
case 'login':
if (isset($_COOKIE['userid'])) {
throw new Exception("You have been loggedin.");
}
$username = Request::get('username', '');
$password = Request::get('password', '');
try {
Users::makeLogin($username, $password);
return json_encode(array('error' => 'no', 'loggedin' => 'yes'));
} catch (Exception $e) {
throw new Exception($e->getMessage());
}
break;
case 'register':
try {
$id = Users::makeRegister();
return json_encode(array('error' => 'no', 'userid' => $id));
} catch (Exception $e) {
throw new Exception($e->getMessage());
}
break;
case 'verify_email':
$code = Request::get('verify_code', '');
if ($code == '') {
throw new Exception("Error Processing Request");
}
$loadData = Users::get(array('where' => "where verify_code='{$code}'"));
if (isset($loadData[0]['userid'])) {
Users::update($loadData[0]['userid'], array('verify_code' => ''));
Redirect::to(ROOT_URL);
// Users::sendNewPassword($loadData[0]['email']);
} else {
throw new Exception("Verify link not valid.");
}
break;
case 'verify_forgotpassword':
$code = Request::get('verify_code', '');
if ($code == '') {
throw new Exception("Error Processing Request");
}
$loadData = Users::get(array('where' => "where forgot_code='{$code}'"));
if (isset($loadData[0]['userid'])) {
Users::update($loadData[0]['userid'], array('forgot_code' => ''));
Users::sendNewPassword($loadData[0]['email']);
Redirect::to(ROOT_URL);
} else {
throw new Exception("Verify code not valid.");
}
break;
}
}
示例15: sendValidationEmail
public static function sendValidationEmail($uid)
{
$me = Users::get($uid);
if (!$me) {
return false;
}
$key = substr(md5(RANDOM_SALT . "_" . $me["email"]), 0, 5);
$to = $me["email"];
$subject = _("Email validation for the public OpenMediakit Transcoder");
$message = sprintf(_("\nHi,\n\nSomeone, maybe you, created an account on a public OpenMediakit Transcoder service.\n\nThis email is sent to the subscription email to validate its ownership. Please click the link below if you want to confirm the account creation.\n\n%s\n\nPlease note that you will not be able to use this public transcoder until your email has been validated, since we may need to contact you if something goes wrong with this service.\n\nIf you didn't asked for this account, please ignore this message.\n\n--\nRegards,\n\nThe OpenMediakit Transcoder public instance service at\n%s\n"), FULL_URL . "users/validate/" . $me["uid"] . "/" . $key, FULL_URL);
$headers = 'From: ' . MAIL_FROMNAME . ' <' . MAIL_FROM . '>' . "\r\n" . 'Reply-To: ' . MAIL_FROM . "\r\n" . 'Content-type: text/plain; charset=utf-8' . "\r\n" . 'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
}