当前位置: 首页>>代码示例>>PHP>>正文


PHP JO_Session::issetKey方法代码示例

本文整理汇总了PHP中JO_Session::issetKey方法的典型用法代码示例。如果您正苦于以下问题:PHP JO_Session::issetKey方法的具体用法?PHP JO_Session::issetKey怎么用?PHP JO_Session::issetKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JO_Session的用法示例。


在下文中一共展示了JO_Session::issetKey方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: indexAction

 public function indexAction()
 {
     $this->getLayout()->meta_title = $this->translate('Contacts');
     $this->getLayout()->meta_description = $this->translate('Contacts');
     $request = $this->getRequest();
     if (JO_Session::issetKey('msg_success')) {
         $this->view->is_send = JO_Session::get('msg_success');
         JO_Session::clear('msg_success');
     } elseif (JO_Session::issetKey('msg_error')) {
         $this->view->error = JO_Session::get('msg_error');
         $this->view->user = JO_Session::get('data');
         JO_Session::clear('msg_error');
         JO_Session::clear('data');
     }
     $this->view->categories = array();
     $categories = Model_Contactscategories::getCategories();
     if ($categories) {
         foreach ($categories as $category) {
             $this->view->categories[$category['id']] = array('id' => $category['id'], 'name' => $category['name'], 'text' => html_entity_decode($category['text'], ENT_QUOTES, 'utf-8'));
         }
     }
     if (empty($this->view->user['username'])) {
         $this->view->user['username'] = JO_Session::get('username');
     }
     if (empty($this->view->user['email'])) {
         $this->view->user['email'] = JO_Session::get('email');
     }
     $this->view->contact_link = WM_Router::create($request->getBaseUrl() . '?controller=contacts&action=send_mail');
     $this->view->children = array();
     $this->view->children['header_part'] = 'layout/header_part';
     $this->view->children['footer_part'] = 'layout/footer_part';
 }
开发者ID:noikiy,项目名称:PD,代码行数:32,代码来源:ContactsController.php

示例2: loginInit

 private function loginInit($id)
 {
     $user_data = WM_Users::checkLoginFacebookTwitter($id, 'instagram_profile');
     if ($user_data) {
         JO_Session::set(array('user' => $user_data));
         if ($this->instagram) {
             WM_Users::edit2(JO_Session::get('user[user_id]'), array('instagram_token' => $this->instagram->getAccessToken()));
         }
         if (JO_Session::issetKey('next') && JO_Session::get('next')) {
             $this->redirect(urldecode(JO_Session::get('next')));
         } else {
             $this->redirect(WM_Router::create($this->getRequest()->getBaseUrl()));
         }
     }
     return $user_data;
 }
开发者ID:noikiy,项目名称:amatteur,代码行数:16,代码来源:InstagramController.php

示例3: loginAction

 public function loginAction()
 {
     $request = $this->getRequest();
     if ($request->getQuery('verify')) {
         $user_data = new Model_Users_User($request->getParam('user_id'));
         $error = false;
         if ($user_data->count() && $user_data['new_email_key'] == $request->getQuery('verify')) {
             $result = new Model_Users_Edit($user_data['user_id'], array('new_email_key' => '', 'email' => $user_data['new_email']));
             if ($result->affected_rows) {
                 JO_Session::set('user', array());
                 JO_Session::set('successful', $this->translate('You verifying your email. Now you can access with the data from e-mail!'));
                 $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=login'));
             } else {
                 $error = true;
             }
         } else {
             $error = true;
         }
         if ($error) {
             $this->view->error = $this->translate('There was a problem with the record. Please try again!');
         }
     } else {
         if (!$request->getParam('user_id') || !$request->getQuery('key')) {
             if (JO_Session::get('user[user_id]')) {
                 $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . JO_Session::get('user[user_id]')));
             }
         }
     }
     $this->view->successful = false;
     if (JO_Session::get('successful')) {
         $this->view->successful = JO_Session::get('successful');
         JO_Session::clear('successful');
     }
     $this->view->error = false;
     if ($request->getParam('user_id') && $request->getQuery('key')) {
         $user_data = new Model_Users_User($request->getParam('user_id'));
         $error = false;
         if ($user_data->count() && $user_data['new_password_key'] == $request->getQuery('key')) {
             $result = new Model_Users_Edit($user_data['user_id'], array('password' => new JO_Db_Expr('`new_password`'), 'new_password' => '', 'new_password_key' => ''));
             if ($result->affected_rows) {
                 JO_Session::set('user', array());
                 JO_Session::set('successful', $this->translate('You verifying forgotten password. Now you can access with the data from e-mail!'));
                 $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=login'));
             } else {
                 $error = true;
             }
         } else {
             $error = true;
         }
         if ($error) {
             $this->view->error = $this->translate('There was a problem with the record. Please try again!');
         }
     }
     $referer = $request->getServer('HTTP_REFERER');
     $this->view->next = urlencode($request->getBaseUrl());
     if ($referer) {
         $data = parse_url($referer);
         if (isset($data['host'])) {
             if (str_replace('www.', '', $data['host']) == $request->getDomain()) {
                 $this->view->next = urlencode($referer);
             }
         }
     }
     if ($request->issetPost('next')) {
         $this->view->next = html_entity_decode($request->getPost('next'));
     } elseif ($request->getQuery('popup') == 'true' && $request->issetQuery('next')) {
         $this->view->next = urlencode(html_entity_decode($request->getQuery('next')));
     }
     $this->view->is_forgot_password = (int) $request->getPost('forgot_password');
     if (JO_Session::issetKey('forgot_password')) {
         $this->view->is_forgot_password = JO_Session::get('forgot_password');
         JO_Session::clear('forgot_password');
     }
     if ($request->isPost() && $request->issetPost('login')) {
         $validate = new Helper_Validate();
         $validate->_set_rules($request->getPost('email'), $this->translate('Email Address'), 'not_empty;min_length[5];max_length[100];email');
         if ($request->getPost('forgot_password') != 1) {
             $validate->_set_rules($request->getPost('password'), $this->translate('Password'), 'not_empty;min_length[4];max_length[30]');
         }
         if ($validate->_valid_form()) {
             if ($request->getPost('forgot_password') == 1) {
                 $result = new Model_Users_UserByEmail($request->getPost('email'));
                 if ($result->count()) {
                     if ($result['status']) {
                         $new_password = JO_Rand::generateRandumString(8);
                         $key_forgot = md5($result['user_id'] . md5($new_password));
                         $add_new_pass = new Model_Users_Edit($result['user_id'], array('new_password' => $new_password, 'new_password_key' => $key_forgot));
                         if ($add_new_pass->affected_rows) {
                             $template = Model_Notification::getTemplate('send_forgot_password_request');
                             if ($template) {
                                 $template_data = array('user_id' => $result['user_id'], 'user_firstname' => $result['firstname'], 'user_lastname' => $result['lastname'], 'user_fullname' => $result['fullname'], 'user_username' => $result['username'], 'site_url' => $request->getBaseUrl(), 'site_name' => Helper_Config::get('site_name'), 'forgot_password_url' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=login&user_id=' . $result['user_id'] . '&key=' . $key_forgot), 'new_password' => $new_password, 'mail_footer' => html_entity_decode(Helper_Config::get('mail_footer'), ENT_QUOTES, 'utf-8'));
                                 if (!$template['title']) {
                                     $template['title'] = $this->translate('Your new password in') . ' ${site_name}';
                                 }
                                 $template['title'] = Model_Notification::parseTemplate(html_entity_decode($template['title'], ENT_QUOTES, 'utf-8'), $template_data);
                                 $template['template'] = Model_Notification::parseTemplate(html_entity_decode($template['template'], ENT_QUOTES, 'utf-8'), $template_data);
                                 $result_send = Model_Email::send($result['email'], Helper_Config::get('noreply_mail'), $template['title'], $template['template']);
                                 if ($result_send) {
                                     JO_Session::set('forgot_password', $this->view->is_forgot_password);
                                     JO_Session::set('successful', $this->translate('Was sent the e-mail with instructions for the new password!'));
//.........这里部分代码省略.........
开发者ID:NareshChennuri,项目名称:pyng,代码行数:101,代码来源:UsersController.php

示例4: loginAction

 public function loginAction()
 {
     if (JO_Session::get('user_id')) {
         $this->redirect(WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=users&action=dashboard'));
     }
     if (JO_Session::issetKey('msg_error')) {
         $this->view->check_error = JO_Session::get('msg_error');
         $this->view->user = JO_Session::get('data');
         JO_Session::clear('msg_error');
         JO_Session::clear('data');
     }
     $this->view->usersCount = Model_Users::countUsers();
     $this->view->itemsCount = Model_Items::countItems();
     $this->getLayout()->meta_title = $this->translate('Login');
     $this->getLayout()->meta_description = $this->translate('Login');
     $request = $this->getRequest();
     if ($request->isPost()) {
         $result = Model_Users::checkLogin($request->getPost('username'), $request->getPost('password'));
         if ($result) {
             $result['following'] = Model_Users::getFollowers($result['user_id']);
             $groups = unserialize($result['groups']);
             if (is_array($groups) and count($groups) > 1) {
                 unset($result['groups']);
                 $fetch_all = Model_Users::getGroups($groups);
                 $result['access'] = array();
                 if ($fetch_all) {
                     foreach ($fetch_all as $row) {
                         $modules = unserialize($row['rights']);
                         if (is_array($modules)) {
                             foreach ($modules as $module => $ison) {
                                 $result['access'][$module] = $module;
                             }
                         }
                     }
                 }
             }
             if (isset($result['access']) && count($result['access'])) {
                 $result['is_admin'] = true;
             }
             JO_Session::set($result);
             if (JO_Session::get('redirect')) {
                 $this->redirect(JO_Session::get('redirect'));
             } elseif ($request->getServer('HTTP_REFERER')) {
                 $this->redirect($request->getServer('HTTP_REFERER'));
             } else {
                 $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=dashboard'));
             }
         } else {
             JO_Session::set('msg_error', $this->translate('Invalid username or password or the account is not activated.'));
             $request->setParams('username', $request->getPost('username'));
             JO_Session::set('data', $request->getParams());
             $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=login'));
         }
     }
     if ($request->getRequest('command') == 'activate' and $request->getRequest('user') and $request->getRequest('key')) {
         if (Model_Users::checkActivation($request->getRequest('user'), $request->getRequest('key'))) {
             Model_Users::Activate($request->getRequest('user'));
             $result = Model_Users::getByUsername($request->getRequest('user'));
             if ($result) {
                 $groups = unserialize($result['groups']);
                 if (is_array($groups) and count($groups) > 1) {
                     unset($result['groups']);
                     $fetch_all = Model_Users::getGroups($groups);
                     $result['access'] = array();
                     if ($fetch_all) {
                         foreach ($fetch_all as $row) {
                             $modules = unserialize($row['rights']);
                             if (is_array($modules)) {
                                 foreach ($modules as $module => $ison) {
                                     $result['access'][$module] = $module;
                                 }
                             }
                         }
                     }
                 }
                 if (isset($result['access']) && count($result['access'])) {
                     $result['is_admin'] = true;
                 }
                 JO_Session::set($result);
             }
             $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=verify/completed/yes'));
         }
     }
     $facebook = new WM_Facebook_Api(array('appId' => JO_Registry::forceGet('facebook_appid'), 'secret' => JO_Registry::forceGet('facebook_secret')));
     $this->view->facebook_link = $facebook->getLoginUrl(array('redirect_uri' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=callback_facebook'), 'req_perms' => JO_Registry::forceGet('facebook_req_perms'), 'scope' => JO_Registry::forceGet('facebook_req_perms')));
     $this->view->lost_username = WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=users&action=lost_username');
     $this->view->reset_password = WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=users&action=reset_password');
     $this->view->registration = WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=users&action=registration');
     $this->view->children = array();
     $this->view->children['header_part'] = 'layout/header_part';
     $this->view->children['footer_part'] = 'layout/footer_part';
 }
开发者ID:noikiy,项目名称:PD,代码行数:92,代码来源:UsersController.php

示例5: loginInit

 private function loginInit($id, $session = null)
 {
     $user_data = WM_Users::checkLoginFacebookTwitter($id, 'twitter', $session);
     if ($user_data) {
         JO_Session::set(array('user' => $user_data));
         JO_Session::clear('user_info_twitteroauth');
         JO_Session::clear('access_token_twitteroauth');
         if (JO_Session::issetKey('next') && JO_Session::get('next')) {
             $this->redirect(urldecode(JO_Session::get('next')));
         } else {
             $this->redirect(WM_Router::create($this->getRequest()->getBaseUrl()));
         }
     }
     return $user_data;
 }
开发者ID:noikiy,项目名称:amatteur,代码行数:15,代码来源:TwitterController.php

示例6: indexAction

 public function indexAction()
 {
     $request = $this->getRequest();
     if (!Helper_Config::get('enable_free_registration')) {
         $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=landing'));
     }
     if (JO_Session::get('user[user_id]')) {
         $this->redirect(WM_Router::create($this->getRequest()->getBaseUrl()));
     }
     $settings = Model_Extensions::getSettingsPairs('twitter');
     if (!isset($settings['twitter_register_with_twitter']) || !$settings['twitter_register_with_twitter']) {
         $this->forward('error', 'error404');
     } elseif (!isset($settings['twitter_module_status_enable']) || !$settings['twitter_module_status_enable']) {
         $this->forward('error', 'error404');
     }
     $user_data = JO_Session::get('user_info_twitteroauth');
     if ((!isset($user_data->error) || !$user_data->error) && $user_data->id) {
         //check if user is exists
         $modelLogin = new Model_Twitter_Login($user_data->id);
         if ($modelLogin->row) {
             $userObject = new Model_Users_User($modelLogin->row['user_id']);
             if ($userObject->count()) {
                 if (JO_Session::get('user[user_id]')) {
                     if ($modelLogin->row['user_id'] == JO_Session::get('user[user_id]')) {
                         JO_Session::set('user', $userObject->toArray());
                     }
                 } else {
                     JO_Session::set('user', $userObject->toArray());
                 }
                 $up = $modelLogin->update(array('twitter_oauth_token' => JO_Session::get('twitter_oauth[oauth_token]'), 'twitter_oauth_token_secret' => JO_Session::get('twitter_oauth[oauth_token_secret]'), 'username' => $user_data->screen_name));
                 if ($request->getQuery('next')) {
                     $this->redirect(urldecode($request->getQuery('next')));
                 } else {
                     $this->redirect(WM_Router::create($this->getRequest()->getBaseUrl()));
                 }
             }
         }
         if (isset($user_data->profile_image_url) && @getimagesize($user_data->profile_image_url)) {
             $image = str_replace('_normal.', '.', $user_data->profile_image_url);
             if (!@getimagesize($image)) {
                 $image = $user_data->profile_image_url;
             }
             $user_data->avatar = $image;
         } else {
             $image = 'uploads' . Helper_Config::get('no_image');
             $user_data->avatar = '';
         }
         $names = explode(' ', $user_data->name);
         $user_data->first_name = array_shift($names);
         $user_data->last_name = implode(' ', $names);
         if ($request->isPost()) {
             $validate = new Helper_Validate();
             $validate->_set_rules($request->getPost('username'), $this->translate('Username'), 'not_empty;min_length[3];max_length[100];username');
             $validate->_set_rules($request->getPost('email'), $this->translate('Email'), 'not_empty;min_length[5];max_length[100];email');
             $validate->_set_rules($request->getPost('password'), $this->translate('Password'), 'not_empty;min_length[4];max_length[30]');
             if ($validate->_valid_form()) {
                 if (Model_Users::isExistEmail($request->getPost('email'))) {
                     $validate->_set_form_errors($this->translate('This e-mail address is already used'));
                     $validate->_set_valid_form(false);
                 }
                 if (Model_Users::isExistUsername($request->getPost('username'))) {
                     $validate->_set_form_errors($this->translate('This username is already used'));
                     $validate->_set_valid_form(false);
                 }
             }
             if ($validate->_valid_form()) {
                 $result = new Model_Users_Create(array('avatar' => $user_data->avatar, 'location' => isset($user_data->location) ? $user_data->location : '', 'website' => isset($user_data->url) ? $user_data->url : '', 'username' => $request->getPost('username'), 'firstname' => isset($user_data->first_name) ? $user_data->first_name : '', 'lastname' => isset($user_data->last_name) ? $user_data->last_name : '', 'email' => $request->getPost('email'), 'password' => $request->getPost('password')));
                 if (!$result->error) {
                     $userObject = new Model_Users_User($result->user_id);
                     JO_Session::set('user', $userObject->toArray());
                     $modelObject = new Model_Twitter_Login();
                     $modelObject->insert(array('username' => $user_data->screen_name, 'user_id' => $result->user_id, 'oauth_uid' => $user_data->id, 'twitter_oauth_token' => JO_Session::get('twitter_oauth[oauth_token]'), 'twitter_oauth_token_secret' => JO_Session::get('twitter_oauth[oauth_token_secret]')));
                     JO_Session::clear('user_info_twitteroauth');
                     JO_Session::clear('access_token_twitteroauth');
                     JO_Session::get('twitter_oauth');
                     if (JO_Session::issetKey('next') && JO_Session::get('next')) {
                         $this->redirect(urldecode(JO_Session::get('next')));
                     } else {
                         $this->redirect(WM_Router::create($this->getRequest()->getBaseUrl()));
                     }
                 } else {
                     $this->view->error = implode('<br />', $result->error);
                     //$this->translate('There was a problem with the record. Please try again!');
                 }
             } else {
                 $this->view->error = $validate->_get_error_messages();
             }
         }
         $this->view->avatar = $image;
         $this->view->baseUrl = $request->getBaseUrl();
         if ($request->issetPost('email')) {
             $this->view->email = $request->getPost('email');
         } else {
             if (isset($user_data->email)) {
                 $this->view->email = $user_data->email;
             } else {
                 $this->view->email = '';
             }
         }
         if ($request->issetPost('username')) {
//.........这里部分代码省略.........
开发者ID:NareshChennuri,项目名称:pyng,代码行数:101,代码来源:RegisterController.php

示例7: isMobile

 /**
  * @return Ambigous <multitype, NULL>|string
  */
 public function isMobile()
 {
     if (JO_Session::issetKey('ismobile')) {
         return JO_Session::get('ismobile');
     }
     $is_mobile = false;
     if (preg_match('/(android|up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone)/i', strtolower($this->getServer('HTTP_USER_AGENT')))) {
         $is_mobile = true;
     }
     if (strpos(strtolower($this->getServer('HTTP_ACCEPT')), 'application/vnd.wap.xhtml+xml') > 0 or ($this->issetServer('HTTP_X_WAP_PROFILE') or $this->issetServer('HTTP_PROFILE'))) {
         $is_mobile = true;
     }
     $mobile_ua = strtolower(substr($this->getServer('HTTP_USER_AGENT'), 0, 4));
     $mobile_agents = array('w3c ', 'acs-', 'alav', 'alca', 'amoi', 'andr', 'audi', 'avan', 'benq', 'bird', 'blac', 'blaz', 'brew', 'cell', 'cldc', 'cmd-', 'dang', 'doco', 'eric', 'hipt', 'inno', 'ipaq', 'java', 'jigs', 'kddi', 'keji', 'leno', 'lg-c', 'lg-d', 'lg-g', 'lge-', 'maui', 'maxo', 'midp', 'mits', 'mmef', 'mobi', 'mot-', 'moto', 'mwbp', 'nec-', 'newt', 'noki', 'oper', 'palm', 'pana', 'pant', 'phil', 'play', 'port', 'prox', 'qwap', 'sage', 'sams', 'sany', 'sch-', 'sec-', 'send', 'seri', 'sgh-', 'shar', 'sie-', 'siem', 'smal', 'smar', 'sony', 'sph-', 'symb', 't-mo', 'teli', 'tim-', 'tosh', 'tsm-', 'upg1', 'upsi', 'vk-v', 'voda', 'wap-', 'wapa', 'wapi', 'wapp', 'wapr', 'webc', 'winw', 'winw', 'xda', 'xda-');
     if (in_array($mobile_ua, $mobile_agents)) {
         $is_mobile = true;
     }
     if ($this->issetServer('ALL_HTTP')) {
         if (strpos(strtolower($this->getServer('ALL_HTTP')), 'OperaMini') > 0) {
             $is_mobile = true;
         }
     }
     if (strpos(strtolower($this->getServer('HTTP_USER_AGENT')), 'windows') > 0) {
         $is_mobile = false;
     }
     JO_Session::set('ismobile', $is_mobile);
     return $is_mobile;
 }
开发者ID:noikiy,项目名称:amatteur,代码行数:31,代码来源:Request.php


注:本文中的JO_Session::issetKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。