本文整理汇总了PHP中Users::getUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Users::getUser方法的具体用法?PHP Users::getUser怎么用?PHP Users::getUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Users
的用法示例。
在下文中一共展示了Users::getUser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
public function indexAction()
{
// Get, check and setup the parameters
if (!($widget_id = $this->getRequest()->getParam("id"))) {
throw new Stuffpress_Exception("No widget id provided to the widget controller");
}
// Verify if the requested widget exist and get its data
$widgets = new Widgets();
if (!($widget = $widgets->getWidget($widget_id))) {
throw new Stuffpress_Exception("Invalid widget id");
}
// Get the user
$users = new Users();
$user = $users->getUser($widget['user_id']);
// Get all sources configured for that user
$properties = new Properties(array(Properties::KEY => $user->id));
// Get the bio data
// User profile
$this->view->username = $user->username;
$this->view->first_name = $properties->getProperty('first_name');
$this->view->last_name = $properties->getProperty('last_name');
$this->view->bio = $properties->getProperty('bio');
$this->view->location = $properties->getProperty('location');
$this->view->avatar = $properties->getProperty('avatar_image');
// Get the widget properties
$properties = new WidgetsProperties(array(Properties::KEY => $widget_id));
$title = $properties->getProperty('title');
$this->view->title = $title ? $title : "About {$user->username}";
}
示例2: registerFakeUser
public static function registerFakeUser($post)
{
$userName = $post['username'];
$email = $post['email'];
$fakeUser = Users::getUser($userName, $email);
setcookie('eggmatters_com', md5($email), 0);
return $fakeUser[0];
}
示例3: getUser
function getUser()
{
$db = getDB();
$app = Slim::getInstance();
// used for degugging if desired.
$startTime = time();
$results = Users::getUser($db);
if (!$results) {
return;
}
// User ID is private so don't send it back to the client
unset($results->user_id);
sendResponse($results, $startTime);
}
示例4: getUsers
static function getUsers()
{
$sql = 'SELECT use_login FROM user;';
$sth = dbConnection()->prepare($sql);
$sth->execute();
$fetch = $sth->fetchAll();
$i = 0;
$users = array();
foreach ($fetch as $row) {
$users[$i] = Users::getUser($row['use_login']);
$i++;
}
return $users;
}
示例5: expand
public function expand($token)
{
if (!($url = $this->getUrl($token))) {
return false;
}
if ($url['internal']) {
$users = new Users();
if (!($user = $users->getUser($url['user_id']))) {
return false;
}
$domain = Stuffpress_Application::getDomain($user);
return "http://" . $domain . "/entry/" . $url['url'];
} else {
return $url['url'];
}
}
示例6: indexAction
public function indexAction()
{
// Get, check and setup the parameters
if (!($widget_id = $this->getRequest()->getParam("id"))) {
throw new Stuffpress_Exception("No widget id provided to the widget controller");
}
// Verify if the requested widget exist and get its data
$widgets = new Widgets();
if (!($widget = $widgets->getWidget($widget_id))) {
throw new Stuffpress_Exception("Invalid widget id");
}
// Get the user
$users = new Users();
$user = $users->getUser($widget['user_id']);
// Get the widget properties
$properties = new WidgetsProperties(array(Properties::KEY => $widget_id));
$title = $properties->getProperty('title');
$this->view->title = $title ? $title : "My playlist";
}
示例7: indexAction
public function indexAction()
{
// Get, check and setup the parameters
if (!($widget_id = $this->getRequest()->getParam("id"))) {
throw new Stuffpress_Exception("No widget id provided to the widget controller");
}
// Verify if the requested widget exist and get its data
$widgets = new Widgets();
if (!($widget = $widgets->getWidget($widget_id))) {
throw new Stuffpress_Exception("Invalid widget id");
}
// Get the user
$users = new Users();
$user = $users->getUser($widget['user_id']);
// Get all sources configured for that user
$properties = new Properties(array(Properties::KEY => $user->id));
// Get the friendconnect data
$this->view->googlefc = $properties->getProperty('googlefc');
// Get the widget properties
$properties = new WidgetsProperties(array(Properties::KEY => $widget_id));
$title = $properties->getProperty('title');
$this->view->title = $title;
}
示例8: editAction
/**
* Edit a users
*/
public function editAction()
{
$usersModel = new Users();
$form = $this->_getForm(false);
$user = $usersModel->getUser($this->_getParam('userId'));
$form->setDefaults($user);
if ($this->getRequest()->isPost() && $form->isValid($_POST)) {
$data = $form->getValues();
if ($usersModel->isUserNameInUse($data['user_name'], $user['user_id'])) {
$form->getElement('user_name')->addValidator('customMessages', false, array('Username is already in use'));
}
if ($usersModel->isEmailInUse($data['user_email'], $user['user_id'])) {
$form->getElement('user_email')->addValidator('customMessages', false, array('E-Mail is already in use'));
}
if ($form->isValid($_POST)) {
$password = !empty($data['user_password']) ? $data['user_password'] : null;
$usersModel->updateUser($user['user_id'], $data['user_name'], $data['user_email'], $data['user_role'], $password);
$this->_helper->getHelper('Redirector')->gotoRouteAndExit(array(), 'users-index');
}
}
$this->view->form = $form;
$this->view->users = $usersModel->getUsers();
}
示例9: genericVMcreateAndUserUpdate
private function genericVMcreateAndUserUpdate($username, $type)
{
$users = new Users();
$user = $users->getUser($username);
if ($user != null && $user->user->vm_ip == "") {
$bufferVM = null;
while ($bufferVM == null) {
$bufferVM = Cache::read('bufferVM');
}
Cache::write('bufferVM', null);
// pr($bufferVM);
$users->{$type}($username, $bufferVM);
$this->output['success'] = true;
$this->output['new'] = true;
$this->output['message'] = 'VM created with IP ' . $bufferVM['ip'];
exec(Configure::read('Command.path'));
} else {
$this->output['success'] = true;
$this->output['new'] = false;
$this->output['message'] = 'VM already created with IP ' . $user->user->vm_ip;
}
echo json_encode($this->output);
}
示例10: indexAction
public function indexAction()
{
// Get, check and setup the parameters
if (!($widget_id = $this->getRequest()->getParam("id"))) {
throw new Stuffpress_Exception("No widget id provided to the widget controller");
}
// Verify if the requested widget exist and get its data
$widgets = new Widgets();
if (!($widget = $widgets->getWidget($widget_id))) {
throw new Stuffpress_Exception("Invalid widget id");
}
// Get the basename
$host = trim(Zend_Registry::get("host"), '/');
// Get the user
$users = new Users();
$user = $users->getUser($widget['user_id']);
$username = $user->username;
// Get the widget properties
$properties = new WidgetsProperties(array(Properties::KEY => $widget_id));
$title = $properties->getProperty('title');
$this->view->title = $title ? $title : "Subscribe to my lifestream";
// RSS Link
$this->view->feed = "http://{$host}/rss/feed.xml";
}
示例11: viewAction
public function viewAction()
{
// Get another layout
$this->_helper->layout->setlayout('story');
// Get, check and setup the parameters
$story_id = $this->getRequest()->getParam("id");
$page = $this->getRequest()->getParam("page");
$page = $page == '' ? 'cover' : $page;
$mode = $this->getRequest()->getParam("mode");
$embed = $this->getRequest()->getParam("embed");
$length = 8;
//Verify if the requested user exist
$stories = new Stories();
$story = $stories->getStory($story_id);
// If not, then return to the home page with an error
if (!$story) {
throw new Stuffpress_NotFoundException("Story {$story_id} does not exist");
}
//Get the story owner data for user properties
$users = new Users();
$user = $users->getUser($story->user_id);
// Load the user properties
$properties = new Properties(array(Stuffpress_Db_Properties::KEY => $user->id));
// Are we the owner ?
if (!$embed && $this->_application->user && $this->_application->user->id == $story->user_id) {
$owner = true;
} else {
$owner = false;
}
// If the page is private, go back with an error
if (!$owner && $properties->getProperty('is_private')) {
throw new Stuffpress_AccessDeniedException("This page has been set as private.");
}
// If the story is draft, go back with an error
if (!$owner && $story->is_hidden) {
throw new Stuffpress_AccessDeniedException("This story has not been published yet.");
}
// Are we in edit mode ?
if ($owner && $mode == 'edit') {
$edit = true;
} else {
$edit = false;
}
$data = new StoryItems();
$count = $data->getItemsCount($story_id, $edit);
$pages = ceil($count / $length);
// Now we can check if the page number is valid
if ($page != 'cover') {
if ($page < 0) {
$page = 0;
} else {
if ($page >= $pages) {
$page = $pages - 1;
}
}
}
// If page is not a cover, get the items
if ($page != 'cover') {
$this->view->items = $data->getItems($story_id, $length, $page * $length, $edit);
}
// Add the data required by the view
$this->view->embed = $embed;
$this->view->username = $user->username;
$this->view->edit = $edit;
$this->view->owner = $owner;
$this->view->image = $story->thumbnail;
$this->view->user_id = $user->id;
$this->view->story_id = $story->id;
$this->view->story_title = $story->title;
$this->view->story_subtitle = $story->subtitle;
$this->view->is_private = $story->is_hidden;
$this->view->is_geo = $stories->isGeo($story_id);
// Navigation options
$this->view->page = $page;
$this->view->pages = $pages;
// Add a previous button
$e = $embed ? "embed/{$embed}/" : "";
if ($page == 'cover') {
unset($this->view->previous);
} else {
if ($page == 0) {
$action = $edit ? "edit" : "view";
$this->view->previous = "story/{$action}/id/{$story_id}/page/cover/{$e}";
} else {
if ($page != 'cover' && $page > 0) {
$action = $edit ? "edit" : "view";
$this->view->previous = "story/{$action}/id/{$story_id}/page/" . ($page - 1) . "/{$e}";
}
}
}
// Add a next button
if ($page == 'cover') {
$action = $edit ? "edit" : "view";
$this->view->next = "story/{$action}/id/{$story_id}/page/0/{$e}";
} else {
if ($page + 1 < $pages) {
$action = $edit ? "edit" : "view";
$this->view->next = "story/{$action}/id/{$story_id}/page/" . ($page + 1) . "/{$e}";
}
}
//.........这里部分代码省略.........
示例12: setupApplication
public static function setupApplication()
{
// Set the default values
$application = Stuffpress_Application::getInstance();
$application->user = null;
$application->role = 'guest';
// Try to authenticate based on cookies
try {
$cookie = new Stuffpress_Cookie();
$user_id = $cookie->validate();
} catch (Exception $e) {
$user_id = 0;
}
if ($user_id) {
$users = new Users();
$user = $users->getUser($user_id);
if ($user) {
$application->user = $user;
$application->role = 'member';
}
}
}
示例13: Users
<?php
require '../loader.php';
/**
* get thread messages
*/
$thread_id = input_get('thread_id');
if ($thread_id) {
$users = new Users();
$threads = new Threads();
$messages = new Messages();
$thread_messages_ids = $threads->getThreadMessages($thread_id);
$thread_users_ids = $threads->getThreadUsers($thread_id);
$thread_users = array();
for ($i = 0, $count = count($thread_users_ids); $i < $count; $i++) {
$thread_users[] = $users->getUser($thread_users_ids[$i]);
}
$thread_messages = array();
for ($i = 0, $count = count($thread_messages_ids); $i < $count; $i++) {
$message = $messages->getMessage($thread_messages_ids[$i]);
$message['user'] = $users->getUser($message['sender_id']);
unset($message['sender_id']);
$thread_messages[] = $message;
}
echo output_json(TRUE, ERR_EMPTY, array('users' => $thread_users, 'messages' => $thread_messages));
} else {
echo output_json(FALSE, ERR_MISSING_DATA);
}
/* End of file get_thread_messages.php */
/* Location ./scripts/get_thread_messages.php */
示例14: settimestampAction
public function settimestampAction()
{
// Get, check and setup the parameters
$source_id = $this->getRequest()->getParam("source");
$item_id = $this->getRequest()->getParam("item");
$timestamp = $this->getRequest()->getParam("timestamp");
//Verify if the requested source exist
$sources = new Sources();
if (!($source = $sources->getSource($source_id))) {
throw new Stuffpress_Exception("Error updating timestamp for source {$source} - Invalid source");
}
// Get the user
$users = new Users();
$user = $users->getUser($source['user_id']);
// Check if we are the owner
if ($this->_application->user->id != $user->id) {
throw new Stuffpress_Exception("Error updating timestamp for source {$source} - Not the owner");
}
// Get the user properties
$properties = new Properties($user->id);
// Check if the date is valid
if (!($date = Stuffpress_Date::strToTimezone($timestamp, $properties->getProperty('timezone')))) {
$this->addErrorMessage("Could not understand the provided date/time");
return $this->_forward('index');
}
// Ok, we can change the title of the item
$model = SourceModel::newInstance($source['service'], $source);
$model->setTimestamp($item_id, $date);
$this->addStatusMessage("Life is cool");
// We redirect to the stream
$this->_forward('index');
}
示例15: header
$edit_name = $_POST['edit_name'];
$edit_address = $_POST['edit_address'];
if ($edit->updateUser($_GET['id'], $edit_name, $edit_address)) {
header("Location: manage_veiw.php");
} else {
echo 'Error';
}
}
?>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<form method="post" action="edit_user.php?<?php
echo $_SERVER['QUERY_STRING'];
?>
">
<h2>Edit user</h2>
<?php
foreach ($edit->getUser($_GET['id']) as $value) {
echo "<input type=\"text\" name=\"edit_name\" value='{$value['1']}'><br >";
echo "<input type=\"text\" name=\"edit_address\" value='{$value['2']}'><br >";
}
?>
<input type="submit" value="Submit" name="button"></br>
</form>
</body>
</html>