本文整理汇总了PHP中Session::getUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::getUser方法的具体用法?PHP Session::getUser怎么用?PHP Session::getUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Session
的用法示例。
在下文中一共展示了Session::getUser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: editContest
static function editContest($contest, $data)
{
$data = Filter::filterArray($data);
$contest->edit($data);
$contestdao = new ContestDao();
return $contestdao->update($contest, Session::getUser());
}
示例2: editResource
static function editResource($resourceID, $data)
{
$resource = self::loadResource($resourceID);
$resource->edit($data);
$resourcedao = new ResourceDao();
return $resourcedao->update($resource, Session::getUser());
}
示例3: process
public function process()
{
global $db;
$sql = 'UPDATE users SET `group` = :group, email = :email, organization = :organizer, usernameSteam = :usernameSteam WHERE id = :id';
$stmt = $db->prepare($sql);
$stmt->bindValue(':id', $this->getElementValue('uid'));
$stmt->bindValue(':email', $this->getElementValue('email'));
$stmt->bindValue(':usernameSteam', $this->getElementValue('usernameSteam'));
if (Session::getUser()->hasPriv('EDIT_USER')) {
$stmt->bindValue(':organizer', $this->getElementValue('organizer'));
$stmt->bindValue(':group', $this->getElementValue('group'));
$stmt->execute();
$newPassword = $this->getElementValue('password');
if (!empty($newPassword)) {
$this->changePassword($newPassword);
}
redirect('viewUser.php?id=' . $this->getElementValue('uid'), 'User edited.');
} else {
$user = $this->getUser();
$stmt->bindValue(':organizer', $user['organization']);
$stmt->bindValue(':group', $user['group']);
$stmt->execute();
Session::getUser()->getData('username', false);
redirect('account.php?', 'Updated profile');
}
}
示例4: process
public function process()
{
if (Session::isLoggedIn()) {
Session::getUser()->setData('location', $this->getElementValue('location'));
}
setcookie('mylocation', $this->getElementValue('location'));
}
示例5: process
public function process()
{
global $db;
$sql = 'INSERT INTO organizers (title, websiteUrl, published, blurb, created) VALUES (:title, :websiteUrl, :published, :blurb, :created) ';
$stmt = $db->prepare($sql);
$stmt->bindValue(':title', $this->getElementValue('title'));
$stmt->bindValue(':websiteUrl', $this->getElementValue('websiteUrl'));
$stmt->bindValue(':blurb', $this->getElementValue('blurb'));
$stmt->bindValue(':created', date(DATE_ATOM));
if (Session::getUser()->hasPriv('CREATE_ORGANIZERS')) {
$stmt->bindValue(':published', 1);
$stmt->execute();
redirect('account.php', 'Organizer created.');
} else {
$stmt->bindValue(':published', 0);
$stmt->execute();
$sql = 'UPDATE users SET organization = :organization WHERE id = :userId LIMIT 1';
$stmt = $db->prepare($sql);
$stmt->bindValue(':organization', $db->lastInsertId());
$stmt->bindValue(':userId', Session::getUser()->getId());
$stmt->execute();
// Refresh the cached organizer.
Session::getUser()->getData('organization', false);
redirect('account.php', 'Organizer assigned to you.');
}
}
示例6: widget
function widget()
{
$user = Session::getUser();
if ($user) {
$this->data->user = $user;
$this->data->is_logged_in = true;
}
}
示例7: INSERT
public static function INSERT()
{
$row = parent::INSERT();
$row->setContent(Document::INSERT());
$row->setComments(Comment::INSERT());
$row->setTimeCreation(time());
$row->setTimePublished(time() + 60 * 60 * 24 * 30);
$row->setAuthor(Session::getUser());
return $row;
}
示例8: editPost
/**
* Modifica un post "semplice".
*
* @param data: array associativo contenente i dati.
* Le chiavi ricercate dal sistema per questo array sono:
* title: titolo del post (string filtrata)
* subtitle: sottotitolo del post (string filtrata)
* headline: occhiello del post (string filtrata)
* tags: array di oggetti Tag
* categories: array di oggetti Category
* content: il testo di un articolo (filtrato), l'indirizzo del videoreportage o l'elenco di indirizzi di foto di un fotoreportage
* visibile: indica la visibilità dell'articolo se non visibile è da considerare come una bozza (boolean)
*
* @return: l'articolo modificato.
*/
static function editPost($post, $data)
{
if (isset($data["ID"])) {
unset($data["ID"]);
}
$data = Filter::filterArray($data);
$p->edit($data);
$postdao = new PostDao();
$post = $postdao->update($p, Session::getUser());
return $post;
}
示例9: process
public function process()
{
global $db;
$sql = 'INSERT INTO organization_join_requests (user, organizer, comments) VALUES (:user, :organization, :comments) ';
$stmt = $db->prepare($sql);
$stmt->bindValue(':user', Session::getUser()->getId());
$stmt->bindValue(':organization', $this->getElementValue('organization'));
$stmt->bindValue(':comments', $this->getElementValue('comments'));
$stmt->execute();
redirect('account.php', 'Thanks, your request to join will be approved or denied as quickly as possible!');
}
示例10: logout
public static function logout()
{
if (!Session::getUser()) {
Session::deleteSessionCookie();
return;
}
$token = Session::getSessionCookie();
$session = UserSession::findByToken($token);
$session->expired = 1;
$session->save();
Session::deleteSessionCookie();
}
示例11: onOpen
function onOpen() {
$role = $this->getAttribute('role');
if($u = Session::getUser()) {
if($role) {
return $u->isRole($role) ? HTMLTag::PROCESS_BODY : HTMLTag::SKIP_BODY;
} else {
return HTMLTag::PROCESS_BODY;
}
} else {
return HTMLTag::SKIP_BODY;
}
}
示例12: mostrarTodos
function mostrarTodos()
{
$sesion = new Session();
$user = $sesion->getUser();
$arra2 = unserialize(file_get_contents("canciones/archivo.txt"));
foreach ($arra2 as $key => $valor) {
if ($arra2[$key]["privado"] == "ON" && $user != $arra2[$key]["user"]) {
//No muestra los videos privados de otros users.
} else {
echo '<img src="canciones/' . $key . '/' . $arra2[$key]["imagen"] . '"/>';
$cancion = new Cancion($arra2[$key]["user"], $key, $arra2[$key]["genero"], $arra2[$key]["audio"], $arra2[$key]["imagen"], $arra2[$key]["privado"]);
$sesion->set($key, $cancion);
echo "<a href=\"escuchar.php?c={$key}\">Escuchar</a>";
}
}
}
示例13: applicationLayout
function applicationLayout()
{
$r = getRenderer();
$form = new Form(array('controller' => 'Company', 'action' => 'show', 'method' => 'get', 'title' => 'getName', 'auto_submit' => array('id')));
$f = $r->classSelect('Company', array('title' => 'Jump to Client', 'id' => 'client_quicksearch', 'name' => 'id'));
$form->content = $f;
$client_search_form = $form->html;
$bookmark_widget = $r->view('bookmarkWidget', array());
$hour_widget = $r->view('hourWidget', array());
if (Session::sessionExists()) {
$bookmarks = Session::getUser()->getBookmarks();
$bookmark_list = $r->view('bookmarkTable', $bookmarks);
} else {
$bookmark_list = '';
}
return array('client_quicksearch' => $client_search_form, 'bookmark' => $bookmark_widget, 'bookmark_list' => $bookmark_list, 'hour_widget' => $hour_widget);
}
示例14: process
public function process()
{
global $db;
$sql = 'INSERT INTO venues (title, lat, lng, organizer, country) VALUES (:title, :lat, :lng, :organizer, :country) ';
$stmt = $db->prepare($sql);
$stmt->bindValue(':title', $this->getElementValue('title'));
$stmt->bindValue(':lat', $this->getElementValue('lat'));
$stmt->bindValue(':lng', $this->getElementValue('lng'));
$stmt->bindValue(':country', $this->getElementValue('country'));
if (Session::hasPriv('NEW_VENUE')) {
$stmt->bindValue(':organizer', $this->getElementValue('organizer'));
} else {
$stmt->bindValue('organizer', Session::getUser()->getData('organization'));
}
$stmt->execute();
Logger::messageDebug('Venue ' . $this->getElementValue('title') . ' created by: ' . Session::getUser()->getUsername(), LocalEventType::CREATE_VENUE);
redirect('account.php', 'Venue created.');
}
示例15: __construct
public function __construct()
{
parent::__construct('formEditVenue', 'Edit Venue');
$venue = $this->getVenue();
if (Session::getUser()->getData('organization') != $venue['organizer']) {
Session::requirePriv('EDIT_VENUE');
}
$this->addElement(Element::factory('hidden', 'id', null, $venue['id']));
$this->addElement(Element::factory('text', 'title', 'Title', $venue['title']));
$this->addElement(Element::factory('text', 'lat', 'Lat', $venue['lat']));
$this->getElement('lat')->setMinMaxLengths(1, 10);
$this->addElement(Element::factory('text', 'lng', 'Lng', $venue['lng']));
$this->getElement('lng')->setMinMaxLengths(1, 10);
$this->addElement(FormHelpers::getElementCountry($venue['country']));
$this->addElement(FormHelpers::getOrganizerList());
$this->getElement('organizer')->setValue($venue['organizer']);
$this->addButtons(Form::BTN_SUBMIT);
}