本文整理汇总了PHP中FrontController::getUser方法的典型用法代码示例。如果您正苦于以下问题:PHP FrontController::getUser方法的具体用法?PHP FrontController::getUser怎么用?PHP FrontController::getUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrontController
的用法示例。
在下文中一共展示了FrontController::getUser方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderComment
public function renderComment(Comment $comm, $template)
{
$vars = array('id' => $comm->getId(), 'username' => $comm->getUsername(), 'text' => $comm->getText(), 'date' => date('j.m.Y H:i', $comm->getDate()), 'ip' => $comm->getIpAddress());
$user = FrontController::getUser();
$config = FrontController::$config;
if (in_array($this->_user->user_group, $config['moder_groups']) || in_array($this->_user->user_id, $config['moders']) || ($user->user_id == $comm->getUserId() && $comm->getUserId() || $user->ip_address == $comm->getIpAddress() && $comm->getDate() > time() - $config['owner_comment_del_time'])) {
$blocks['perm_del'] = true;
}
return $this->render($template, $vars, $blocks);
}
示例2: onDispatch
public function onDispatch(FrontController $sender, $action)
{
if ($action == 'unsubscribe') {
$request = FrontController::getRequest();
if ($request->get('hash') === $this->_getSubscribeHash($request->get('e'), $request->get('u'), $request->get('s'))) {
$st = Statement::getById($request->getClean('s'), FrontController::getUser());
if (empty($st)) {
$sender->msg('Error', 'Запрашиваемой идеи не найдено');
}
$user = new stdClass();
$user->name = '';
$user->user_id = $request->getClean('u');
$user->email = $request->get('e');
$st->removeSubscriber($user);
$sender->msg('Подписка', 'Вы были удачно отписаны от рассылки');
} else {
$sender->msg('Error', 'Ошибка проверки хеша');
}
return false;
}
return true;
}
示例3: getById
/**
*
* @param int $id
* @param stdClass $user
* @return Statement|null
*/
public static function getById($id, stdClass $user = null)
{
if (!$user) {
$user = FrontController::getUser();
}
$row = self::$db->super_query("SELECT s.*, l.id AS isset FROM " . PREFIX . "_statement AS s\n LEFT OUTER JOIN " . PREFIX . "_statement_log AS l\n ON l.statement_id=s.id AND (l.user_id={$user->user_id} OR l.ip_address='" . $user->ip_address . "')\n WHERE s.id=" . $id);
if ($row) {
return new self($row);
} else {
return null;
}
}