本文整理汇总了PHP中cmsUser::isLogged方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsUser::isLogged方法的具体用法?PHP cmsUser::isLogged怎么用?PHP cmsUser::isLogged使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmsUser
的用法示例。
在下文中一共展示了cmsUser::isLogged方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run($pass_token)
{
if (!$pass_token) {
cmsCore::error404();
}
if (cmsUser::isLogged()) {
$this->redirectToHome();
}
$users_model = cmsCore::getModel('users');
$user = $users_model->getUserByPassToken($pass_token);
if (!$user) {
cmsCore::error404();
}
$users_model->unlockUser($user['id']);
$users_model->clearUserPassToken($user['id']);
cmsEventsManager::hook('user_registered', $user);
cmsUser::addSessionMessage($this->options['reg_auto_auth'] ? LANG_REG_SUCCESS_VERIFIED_AND_AUTH : LANG_REG_SUCCESS_VERIFIED, 'success');
// авторизуем пользователя автоматически
if ($this->options['reg_auto_auth']) {
$user = cmsEventsManager::hook('user_login', $user);
cmsUser::sessionSet('user', array('id' => $user['id'], 'groups' => $user['groups'], 'time_zone' => $user['time_zone'], 'perms' => cmsUser::getPermissions($user['groups']), 'is_admin' => $user['is_admin']));
$update_data = array('ip' => cmsUser::getIp());
$this->model->update('{users}', $user['id'], $update_data, true);
cmsEventsManager::hook('auth_login', $user['id']);
}
$this->redirect($this->getAuthRedirectUrl($this->options['first_auth_redirect']));
}
示例2: run
public function run()
{
if (!$this->request->isAjax()) {
cmsCore::error404();
}
$orfo = $this->request->get('orfo');
$url = $this->request->get('url');
$comment = $this->request->get('comment', false);
$author = !cmsUser::isLogged() ? cmsUser::getIp() : cmsUser::get('nickname');
$form = $this->getForm('orfo');
$is_submitted = $this->request->has('submit');
if ($is_submitted) {
$data = $form->parse($this->request, $is_submitted);
$data['date'] = date('Y-m-d H:i:s');
$errors = $form->validate($this, $data);
dump($errors);
if (!$errors) {
$this->model->addComplaints($data);
$messenger = cmsCore::getController('messages');
$messenger->addRecipient(1);
$notice = array('content' => sprintf(LANG_COMPLAINTS_ADD_NOTICE, $url, $orfo), 'options' => array('is_closeable' => true));
$messenger->ignoreNotifyOptions()->sendNoticePM($notice, 'complaints_add');
}
cmsTemplate::getInstance()->renderJSON(array('errors' => false, 'callback' => 'formSuccess'));
}
$data = array('orfo' => $orfo, 'url' => $url, 'author' => $author, 'comment' => $comment);
return cmsTemplate::getInstance()->render('orfo', array('form' => $form, 'data' => $data));
}
示例3: run
public function run()
{
if (cmsUser::isLogged()) {
$this->redirectToHome();
}
$users_model = cmsCore::getModel('users');
$form = $this->getForm('restore');
$data = array();
$is_submitted = $this->request->has('submit');
if ($is_submitted) {
$data = $form->parse($this->request, $is_submitted);
$errors = $form->validate($this, $data);
if ($errors) {
cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error');
}
if (!$errors) {
$user = $users_model->getUserByEmail($data['email']);
if (!$user) {
cmsUser::addSessionMessage(LANG_EMAIL_NOT_FOUND, 'error');
} else {
$pass_token = string_random(32, $user['email']);
$users_model->updateUserPassToken($user['id'], $pass_token);
$messenger = cmsCore::getController('messages');
$to = array('email' => $user['email'], 'name' => $user['nickname']);
$letter = array('name' => 'reg_restore');
$messenger->sendEmail($to, $letter, array('nickname' => $user['nickname'], 'page_url' => href_to_abs('auth', 'reset', $pass_token), 'valid_until' => html_date(date('d.m.Y H:i', time() + 24 * 3600), true)));
cmsUser::addSessionMessage(LANG_TOKEN_SENDED, 'success');
}
}
}
return cmsTemplate::getInstance()->render('restore', array('data' => $data, 'form' => $form, 'errors' => isset($errors) ? $errors : false));
}
示例4: run
public function run($profile_id)
{
if (!cmsUser::isLogged()) {
cmsCore::error404();
}
if (!$this->request->isAjax()) {
cmsCore::error404();
}
$user = cmsUser::getInstance();
$direction = $this->request->get('direction');
$comment = $this->request->get('comment');
//
// Проверяем валидность
//
$is_valid = $user->is_logged && cmsUser::isAllowed('users', 'vote_karma') && is_numeric($profile_id) && $user->id != $profile_id && in_array($direction, array('up', 'down')) && (!$this->options['is_karma_comments'] || $comment);
if (!$is_valid) {
$result = array('error' => true, 'message' => LANG_ERROR);
cmsTemplate::getInstance()->renderJSON($result);
}
$profile = $this->model->getUser($profile_id);
if (!$profile || !$this->model->isUserCanVoteKarma($user->id, $profile_id, $this->options['karma_time'])) {
$result = array('error' => true, 'message' => LANG_ERROR);
cmsTemplate::getInstance()->renderJSON($result);
}
//
// Сохраняем оценку
//
$vote = array('user_id' => $user->id, 'profile_id' => $profile_id, 'points' => $direction == 'up' ? 1 : -1, 'comment' => $comment);
$vote_id = $this->model->addKarmaVote($vote);
$value = $profile['karma'] + $vote['points'];
$result = array('error' => $vote_id ? false : true, 'value' => html_signed_num($value), 'css_class' => html_signed_class($value));
cmsTemplate::getInstance()->renderJSON($result);
}
示例5: run
public function run()
{
if (cmsUser::isLogged()) {
return false;
}
return array();
}
示例6: run
public function run()
{
if (cmsUser::isLogged()) {
$this->redirectToHome();
}
$email = $this->request->get('login_email');
$password = $this->request->get('login_password');
$remember = (bool) $this->request->get('remember');
$back_url = $this->request->has('back') ? $this->request->get('back') : false;
$is_site_offline = !cmsConfig::get('is_site_on');
if ($this->request->has('submit')) {
$is_captcha_valid = true;
if (cmsUser::sessionGet('is_auth_captcha') && $this->options['auth_captcha']) {
$is_captcha_valid = cmsEventsManager::hook('captcha_validate', $this->request);
}
if ($is_captcha_valid) {
cmsUser::sessionUnset('is_auth_captcha');
$logged_id = cmsUser::login($email, $password, $remember);
if ($logged_id) {
if ($is_site_offline) {
$userSession = cmsUser::sessionGet('user');
if (!$userSession['is_admin']) {
cmsUser::addSessionMessage(LANG_LOGIN_ADMIN_ONLY, 'error');
cmsUser::logout();
$this->redirectBack();
}
}
cmsEventsManager::hook('auth_login', $logged_id);
$is_back = $this->request->get('is_back');
if ($is_back) {
$this->redirectBack();
}
if ($back_url) {
$this->redirect($back_url);
} else {
$this->redirectToHome();
}
}
}
if ($this->options['auth_captcha'] && !$is_site_offline) {
cmsUser::sessionSet('is_auth_captcha', true);
}
if ($is_captcha_valid) {
cmsUser::addSessionMessage(LANG_LOGIN_ERROR, 'error');
if ($is_site_offline) {
$this->redirectBack();
}
} else {
cmsUser::addSessionMessage(LANG_CAPTCHA_ERROR, 'error');
}
}
if ($back_url) {
cmsUser::addSessionMessage(LANG_LOGIN_REQUIRED, 'error');
}
if (cmsUser::sessionGet('is_auth_captcha')) {
$captcha_html = cmsEventsManager::hook('captcha_html');
}
return cmsTemplate::getInstance()->render('login', array('back_url' => $back_url, 'captcha_html' => isset($captcha_html) ? $captcha_html : false));
}
示例7: run
public function run($friend_id)
{
if (!cmsUser::isLogged()) {
cmsCore::error404();
}
$user = cmsUser::getInstance();
if (!$friend_id) {
cmsCore::error404();
}
if ($user->isFriend($friend_id)) {
return false;
}
$friend = $this->model->getUser($friend_id);
if (!$friend) {
cmsCore::error404();
}
//
// Запрос по ссылке из профиля
//
if ($this->request->isStandard()) {
//
// Если запрос от друга уже существует
//
if ($this->model->isFriendshipRequested($friend_id, $user->id)) {
$this->model->addFriendship($user->id, $friend_id);
cmsUser::addSessionMessage(sprintf(LANG_USERS_FRIENDS_DONE, $friend['nickname']), 'success');
$this->sendNoticeAccepted($friend);
$this->redirectToAction($friend_id);
}
//
// Если запроса от друга не было
//
if ($this->request->has('submit')) {
// подтвержение получено
$csrf_token = $this->request->get('csrf_token');
if (!cmsForm::validateCSRFToken($csrf_token)) {
cmsCore::error404();
}
$this->model->addFriendship($user->id, $friend_id);
cmsUser::addSessionMessage(LANG_USERS_FRIENDS_SENT);
$this->sendNoticeRequest($friend);
$this->redirectToAction($friend_id);
} else {
// спрашиваем подтверждение
return cmsTemplate::getInstance()->render('friend_add', array('user' => $user, 'friend' => $friend));
}
}
//
// Запрос из уведомления (внутренний)
//
if ($this->request->isInternal()) {
$this->model->addFriendship($user->id, $friend_id);
$this->sendNoticeAccepted($friend);
return true;
}
}
示例8: actionUpload
public function actionUpload()
{
if (!cmsUser::isLogged()) {
cmsCore::error404();
}
if ($this->request->has('submit')) {
$this->uploadImage();
}
return $this->cms_template->renderPlain('upload', array('allowed_extensions' => $this->images_controller->getAllowedExtensions()));
}
示例9: before
/**
* Все запросы могут быть выполнены только авторизованными и только по аякс
* @param type $action_name
*/
public function before($action_name)
{
parent::before($action_name);
if (!$this->request->isInternal()) {
if (!$this->request->isAjax()) {
cmsCore::error404();
}
if (!cmsUser::isLogged()) {
cmsCore::error404();
}
}
return true;
}
示例10: actionUpload
public function actionUpload()
{
if (!cmsUser::isLogged()) {
cmsCore::error404();
}
if ($this->request->has('submit')) {
$this->uploadImage();
}
$template = cmsTemplate::getInstance();
$images_controller = cmsCore::getController('images');
$html = $template->render('upload', array('allowed_extensions' => $images_controller->getAllowedExtensions()));
echo $html;
$this->halt();
}
示例11: run
public function run($user_id)
{
if (!cmsUser::isLogged()) {
cmsCore::error404();
}
if (!$this->request->isAjax()) {
cmsCore::error404();
}
$user = cmsUser::getInstance();
if ($user->id != $user_id && !$user->is_admin) {
$result = array('error' => true, 'message' => LANG_ERROR);
cmsTemplate::getInstance()->renderJSON($result);
}
$this->model->clearUserStatus($user_id);
$result = array('error' => false);
cmsTemplate::getInstance()->renderJSON($result);
}
示例12: run
public function run($friend_id)
{
if (!cmsUser::isLogged()) {
cmsCore::error404();
}
$user = cmsUser::getInstance();
if (!$friend_id) {
cmsCore::error404();
}
if (!$this->model->isFriendshipExists($user->id, $friend_id)) {
return false;
}
$friend = $this->model->getUser($friend_id);
if (!$friend) {
cmsCore::error404();
}
//
// Запрос по ссылке из профиля
//
if ($this->request->isStandard()) {
if ($this->request->has('submit')) {
// подтвержение получено
$csrf_token = $this->request->get('csrf_token');
if (!cmsForm::validateCSRFToken($csrf_token)) {
cmsCore::error404();
}
$this->model->deleteFriendship($user->id, $friend_id);
cmsUser::addSessionMessage(sprintf(LANG_USERS_FRIENDS_DELETED, $friend['nickname']));
$this->sendNoticeDeleted($friend);
$this->redirectToAction($friend_id);
} else {
// спрашиваем подтверждение
return cmsTemplate::getInstance()->render('friend_delete', array('user' => $user, 'friend' => $friend));
}
}
//
// Запрос из уведомления (внутренний)
//
if ($this->request->isInternal()) {
$this->model->deleteFriendship($user->id, $friend_id);
$this->sendNoticeDeleted($friend, true);
return true;
}
}
示例13: run
public function run($item)
{
$action = $item['action'];
$menu_item_id = $item['menu_item_id'];
if ($action == 'add') {
return $this->getMenuAddItems($menu_item_id);
} elseif ($action == 'private_list') {
if (!cmsUser::isLogged()) {
return false;
}
return $this->getMenuPrivateItems($menu_item_id);
} else {
$ctype = $this->model->getContentTypeByName($action);
if (!$ctype) {
return false;
}
return $this->getMenuCategoriesItems($menu_item_id, $ctype);
}
}
示例14: run
public function run($pass_token)
{
if (!$pass_token) {
cmsCore::error404();
}
if (cmsUser::isLogged()) {
$this->redirectToHome();
}
$users_model = cmsCore::getModel('users');
$user = $users_model->getUserByPassToken($pass_token);
if (!$user) {
cmsCore::error404();
}
$users_model->unlockUser($user['id']);
$users_model->clearUserPassToken($user['id']);
cmsEventsManager::hook('user_registered', $user);
cmsUser::addSessionMessage(LANG_REG_SUCCESS_VERIFIED, 'success');
$this->redirectToHome();
}
示例15: run
public function run()
{
if (!cmsUser::isLogged()) {
cmsCore::error404();
}
if (!$this->request->isAjax()) {
cmsCore::error404();
}
$user_id = $this->request->get('user_id');
$content = $this->request->get('content');
// Проверяем валидность
if (!is_numeric($user_id)) {
$result = array('error' => true, 'message' => LANG_ERROR);
cmsTemplate::getInstance()->renderJSON($result);
}
$user = cmsUser::getInstance();
if ($user->id != $user_id) {
$result = array('error' => true, 'message' => LANG_ERROR);
cmsTemplate::getInstance()->renderJSON($result);
}
// Вырезаем теги и форматируем
$content = strip_tags($content);
if (mb_strlen($content) > 140) {
$content = mb_substr($content, 0, 140);
}
$content = cmsEventsManager::hook('html_filter', $content);
if (!$content) {
$result = array('error' => true, 'message' => '');
cmsTemplate::getInstance()->renderJSON($result);
}
// Добавляем запись на стену
$wall_model = cmsCore::getModel('wall');
$wall_entry_id = $wall_model->addEntry(array('controller' => 'users', 'profile_type' => 'user', 'profile_id' => $user_id, 'user_id' => $user_id, 'content' => $content, 'content_html' => $content));
// сохраняем статус
$status_id = $this->model->addUserStatus(array('user_id' => $user_id, 'content' => $content, 'wall_entry_id' => $wall_entry_id));
if ($status_id) {
$wall_model->updateEntryStatusId($wall_entry_id, $status_id);
cmsCore::getController('activity')->addEntry($this->name, "status", array('subject_title' => $content, 'reply_url' => href_to($this->name, $user_id) . "?wid={$wall_entry_id}&reply=1"));
}
$result = array('error' => $status_id ? false : true, 'wall_entry_id' => $wall_entry_id, 'content' => $content);
cmsTemplate::getInstance()->renderJSON($result);
}