• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP JO_Session类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: get_avatarAction

 public function get_avatarAction()
 {
     $this->noLayout(true);
     $request = $this->getRequest();
     if (JO_Session::get('user[user_id]')) {
         $connectObject = new Model_Facebook_Login();
         $user_info = $connectObject->getDataByUserId(JO_Session::get('user[user_id]'));
         $user_id = 0;
         if ($user_info) {
             $user_id = $user_info['oauth_uid'];
         } else {
             $facebookObject = new Helper_Modules_Facebook();
             $user_data = $facebookObject->getUser(true);
             if ($user_data && isset($user_data['id'])) {
                 $user_id = $user_data['id'];
             }
         }
         if ($user_id) {
             $ph = new WM_Facebook_Photo();
             $image = $ph->getRealUrl('http://graph.facebook.com/' . $user_id . '/picture?type=large');
             $image_info = @getimagesize($image);
             if ($image_info) {
                 $image_data = @file_get_contents($image);
                 if ($image_data) {
                     JO_Session::set('upload_avatar', array('name' => basename($image), 'type' => $image_info['mime'], 'data' => $image_data));
                     $this->view->success = WM_Router::create($request->getBaseUrl() . '?controller=settings&action=temporary_avatar&hash=' . microtime(true));
                 }
             }
         } else {
             $this->view->error = $this->translate('There is no established connection with facebook!');
         }
     }
     echo $this->renderScript('json');
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:34,代码来源:UseravatarController.php


示例2: initSession

 public static function initSession($user_id)
 {
     $db = JO_Db::getDefaultAdapter();
     $query = $db->select()->from(self::getPrefixDB() . 'users')->where('user_id = ?', (int) $user_id)->limit(1, 0);
     $user_data = $db->fetchRow($query);
     if ($user_data && $user_data['status'] == 'activate') {
         $groups = unserialize($user_data['groups']);
         if (is_array($groups) && count($groups) > 0) {
             $query_group = $db->select()->from(self::getPrefixDB() . 'user_groups')->where("ug_id IN (?)", new JO_Db_Expr(implode(',', array_keys($groups))));
             $fetch_all = $db->fetchAll($query_group);
             $user_data['access'] = array();
             if ($fetch_all) {
                 foreach ($fetch_all as $row) {
                     $modules = unserialize($row['rights']);
                     if (is_array($modules)) {
                         foreach ($modules as $module => $ison) {
                             $user_data['access'][$module] = $module;
                         }
                     }
                 }
             }
         }
         if (isset($user_data['access']) && count($user_data['access'])) {
             $user_data['is_admin'] = true;
         }
         $db->update(self::getPrefixDB() . 'users', array('last_login_datetime' => new JO_Db_Expr('NOW()'), 'ip_address' => JO_Request::getInstance()->getClientIp()), array('user_id = ?' => (int) $user_id));
         JO_Session::set($user_data);
     }
     return $user_data;
 }
开发者ID:noikiy,项目名称:PD,代码行数:30,代码来源:Users.php


示例3: logoutAction

 public function logoutAction()
 {
     $this->setInvokeArg('noViewRenderer', true);
     @setcookie('csrftoken_', md5(JO_Session::get('user[user_id]') . $this->getRequest()->getDomain() . JO_Session::get('user[date_added]')), time() - 100, '/', '.' . $this->getRequest()->getDomain());
     JO_Session::set(array('user' => false));
     $this->redirect(JO_Request::getInstance()->getBaseUrl());
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:7,代码来源:LoginController.php


示例4: __construct

 public function __construct($to, $type, $pin_id = 0, $board_id = 0, $comment = '')
 {
     if ($to == JO_Session::get('user[user_id]')) {
         return;
     } else {
         if (!JO_Session::get('user[user_id]')) {
             return;
         }
     }
     $history_id = Helper_Db::insert('users_history', array('date_added' => new JO_Db_Expr('NOW()'), 'from_user_id' => (string) JO_Session::get('user[user_id]'), 'to_user_id' => (string) $to, 'history_action' => (int) $type, 'pin_id' => (string) $pin_id, 'board_id' => (string) $board_id, 'comment' => $comment));
     if ($history_id) {
         if (self::FOLLOW == $type) {
             Helper_Db::delete('users_history', array('to_user_id = ?' => (string) $to, 'from_user_id = ?' => (string) JO_Session::get('user[user_id]'), 'history_action = ?' => self::UNFOLLOW, 'board_id = ?' => (string) $board_id));
         } elseif (self::UNFOLLOW == $type) {
             Helper_Db::delete('users_history', array('to_user_id = ?' => (string) $to, 'from_user_id = ?' => (string) JO_Session::get('user[user_id]'), 'history_action = ?' => self::FOLLOW, 'board_id = ?' => (string) $board_id));
         } elseif (self::FOLLOW_USER == $type) {
             Helper_Db::delete('users_history', array('to_user_id = ?' => (string) $to, 'from_user_id = ?' => (string) JO_Session::get('user[user_id]'), 'history_action = ?' => self::UNFOLLOW_USER));
         } elseif (self::UNFOLLOW_USER == $type) {
             Helper_Db::delete('users_history', array('to_user_id = ?' => (string) $to, 'from_user_id = ?' => (string) JO_Session::get('user[user_id]'), 'history_action = ?' => self::FOLLOW_USER));
         } elseif (self::LIKEPIN == $type) {
             Helper_Db::delete('users_history', array('to_user_id = ?' => (string) $to, 'from_user_id = ?' => (string) JO_Session::get('user[user_id]'), 'history_action = ?' => self::UNLIKEPIN, 'pin_id = ?' => (string) $pin_id));
         } elseif (self::UNLIKEPIN == $type) {
             Helper_Db::delete('users_history', array('to_user_id = ?' => (string) $to, 'from_user_id = ?' => (string) JO_Session::get('user[user_id]'), 'history_action = ?' => self::LIKEPIN, 'pin_id = ?' => (string) $pin_id));
         }
     }
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:26,代码来源:AddHistory.php


示例5: __construct

 public function __construct($pin_id)
 {
     $db = JO_Db::getDefaultAdapter();
     $query = self::getListPinsQuery();
     //$query->columns(array('pin_next'=>new JO_Db_Expr('('.$db->select()->from(array('next'=>'pins'),'pin_id')->where('pin_id > ?', (string)$pin_id)->order('pin_id ASC')->limit(1).')')));
     //$query->columns(array('pin_prev'=>new JO_Db_Expr('('.$db->select()->from(array('prev'=>'pins'),'pin_id')->where('pin_id < ?', (string)$pin_id)->order('pin_id DESC')->limit(1).')')));
     if (JO_Session::get('user[user_id]')) {
         $query->columns(array('following_board' => new JO_Db_Expr('((' . $db->select()->from('users_following_user', 'COUNT(ufu_id)')->where('user_id = ?', JO_Session::get('user[user_id]'))->where('following_id = pins.user_id')->limit(1) . ') + (' . $db->select()->from('users_following', 'COUNT(users_following_id)')->where('user_id = ?', JO_Session::get('user[user_id]'))->where('following_id = pins.user_id')->where('board_id = pins.board_id')->limit(1) . ')-(' . $db->select()->from('users_following_ignore', 'COUNT(users_following_id)')->where('user_id = ?', JO_Session::get('user[user_id]'))->where('following_id = pins.user_id')->where('board_id = pins.board_id')->limit(1) . '))')));
         $query->columns(array('following_user' => new JO_Db_Expr('((' . $db->select()->from('users_following_user', 'COUNT(ufu_id)')->where('user_id = ?', JO_Session::get('user[user_id]'))->where('following_id = pins.user_id')->limit(1) . ') + (' . $db->select()->from('users_following', 'COUNT(users_following_id)')->where('user_id = ?', JO_Session::get('user[user_id]'))->where('following_id = pins.user_id')->where('board_id = pins.board_id')->limit(1) . '))')));
         $query->columns(array('following_via' => new JO_Db_Expr('((' . $db->select()->from('users_following_user', 'COUNT(ufu_id)')->where('user_id = ?', JO_Session::get('user[user_id]'))->where('following_id = pins.via')->limit(1) . ') + (' . $db->select()->from('users_following', 'COUNT(users_following_id)')->where('user_id = ?', JO_Session::get('user[user_id]'))->where('following_id = pins.via')->where('board_id = pins.board_id')->limit(1) . '))')));
     } else {
         $query->columns(array('following_board' => new JO_Db_Expr("0")));
         $query->columns(array('following_user' => new JO_Db_Expr("0")));
         $query->columns(array('following_via' => new JO_Db_Expr("0")));
     }
     $rows_source = self::describeTable('pins_sources', 'source_');
     $query->joinLeft('pins_sources', 'pins.source_id = pins_sources.source_id', $rows_source);
     $query->where('pins.pin_id = ?', (string) $pin_id);
     //v2.2
     if (Helper_Config::get('config_enable_follow_private_profile')) {
         $query = self::filterFriend($query);
     }
     $response = $db->fetchRow($query);
     $response = is_array($response) ? $response : array();
     $this->data = $response;
     // 		parent::__construct($response);
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:27,代码来源:Pin.php


示例6: getPageParents

 public static function getPageParents($id)
 {
     $db = JO_Db::getDefaultAdapter();
     $query = $db->select()->from('pages')->joinLeft('pages_description', 'pages_description.id = pages.id AND pages_description.lid = \'' . JO_Session::get('language_id') . '\'', array('lid', 'name', 'text'))->where('visible = ?', 'true')->order('sub_of DESC');
     $results = $db->fetchAll($query);
     $return = array();
     $cnt = count($results);
     for ($i = 0; $i < $cnt; $i++) {
         if ($results[$i]['id'] == $id) {
             $return[] = $results[$i];
             $sub_of = $results[$i]['sub_of'];
             break;
         }
     }
     $i--;
     while ($sub_of > 0 && $i >= 0) {
         if ($sub_of == $results[$i]['id']) {
             $return[] = $results[$i];
             $sub_of = $results[$i]['sub_of'];
         }
         $i--;
     }
     $return = array_reverse($return);
     return $return;
 }
开发者ID:noikiy,项目名称:PD,代码行数:25,代码来源:Pages.php


示例7: __construct

 public function __construct($data = array())
 {
     $db = JO_Db::getDefaultAdapter();
     try {
         $db->beginTransaction();
         $data['user_id'] = isset($data['user_id']) ? $data['user_id'] : JO_Session::get('user[user_id]');
         $data['public'] = isset($data['public']) ? (int) $data['public'] : 1;
         $data['date_added'] = date('Y-m-d H:i:s');
         $board_id = Helper_Db::create('boards', $data);
         if (!$board_id) {
             return $this;
         }
         Helper_Db::insert('users_boards', array('user_id' => isset($data['user_id']) ? (string) $data['user_id'] : JO_Session::get('user[user_id]'), 'board_id' => $board_id, 'is_author' => 1));
         if (isset($data['friends'])) {
             foreach ($data['friends'] as $fr) {
                 Helper_Db::insert('users_boards', array('user_id' => $fr, 'board_id' => $board_id));
             }
         }
         $config_private_boards = Helper_Config::get('config_private_boards');
         Helper_Db::update('users', array('boards' => new JO_Db_Expr("(SELECT COUNT(board_id) FROM boards WHERE user_id = '" . (isset($data['user_id']) ? (string) $data['user_id'] : JO_Session::get('user[user_id]')) . "' " . ($config_private_boards ? ' AND public = 1' : '') . ")")), array('user_id = ?' => isset($data['user_id']) ? (string) $data['user_id'] : JO_Session::get('user[user_id]')));
         ////autoseo
         new Model_Boards_Autoseo($board_id);
         $this->board_id = $board_id;
         $db->commit();
     } catch (JO_Exception $e) {
         $db->rollBack();
         $this->error = $e->getMessage();
     }
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:29,代码来源:Create.php


示例8: autocompleteAction

 public function autocompleteAction()
 {
     $request = $this->getRequest();
     $this->view->items = array();
     if (JO_Session::get('user[user_id]') && $request->getPost('value')) {
         $methods = glob(dirname(__FILE__) . '/Search/*.php');
         if ($methods) {
             foreach ($methods as $file) {
                 $controller = basename($file, '.php');
                 $class_name = 'Search_' . $controller;
                 if (!class_exists($class_name, false)) {
                     JO_Loader::loadFile($file);
                 }
                 $class = new $class_name();
                 if (method_exists($class, 'autocomplete')) {
                     $this->view->items = array_merge($this->view->items, $class->autocomplete($request->getPost('value')));
                 }
             }
         }
     }
     $this->view->items[] = array('template' => 'global', 'label' => sprintf($this->translate('Search for %s'), $request->getPost('value')), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=search&q=' . $request->getPost('value')));
     if ($request->isXmlHttpRequest()) {
         echo $this->renderScript('json');
     } else {
         $this->forward('error', 'error404');
     }
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:27,代码来源:SearchController.php


示例9: replyMail

 public static function replyMail($data)
 {
     $db = JO_Db::getDefaultAdapter();
     $db->insert('users_mails', array('from_user_id' => isset($data['user_id']) ? (string) $data['user_id'] : JO_Session::get('user[user_id]'), 'date_mail' => new JO_Db_Expr('NOW()'), 'text_mail' => (string) $data['text'], 'parent_mail_id' => isset($data['parent']) ? (string) $data['parent'] : 0));
     $mail_id = $db->lastInsertId();
     if (!$mail_id) {
         return false;
     }
     $replies = self::getReplyConversation($data['parent']);
     $recipients = "";
     foreach ($replies as $reply) {
         if ($reply["from_user_id"] != JO_Session::get('user[user_id]')) {
             $pos = strpos($recipients, $reply["from_user_id"] . ",");
             if ($pos === false) {
                 $recipients .= $reply["from_user_id"] . ",";
                 $db->insert('users_mails_to', array('user_id' => $reply["from_user_id"], 'mail_id' => $mail_id));
             }
         }
         if ($reply["user_id"] != JO_Session::get('user[user_id]')) {
             $pos = strpos($recipients, $reply["user_id"] . ",");
             if ($pos === false) {
                 $recipients .= $reply["user_id"] . ",";
                 $db->insert('users_mails_to', array('user_id' => $reply["user_id"], 'mail_id' => $mail_id));
             }
         }
     }
     return array('status' => "OK");
 }
开发者ID:noikiy,项目名称:amatteur,代码行数:28,代码来源:Mails.php


示例10: resetAction

 public function resetAction()
 {
     $request = $this->getRequest();
     if (!JO_Session::get('user[user_id]')) {
         $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=login'));
     }
     $done = $request->issetQuery('done');
     if ($done) {
         $this->forward('password', 'done');
     }
     if ($request->isPost()) {
         $validate = new Helper_Validate();
         $validate->_set_rules($request->getPost('email'), $this->translate('E-mail'), 'not_empty;min_length[5];max_length[100];email');
         if ($validate->_valid_form()) {
             $result = Model_Users::forgotPassword($request->getPost('email'));
             if ($result) {
                 if ($result['status']) {
                     $new_password = Model_Users::generatePassword(8);
                     $key_forgot = md5($result['user_id'] . md5($new_password));
                     $add_new_pass = Model_Users::edit($result['user_id'], array('new_password' => $new_password, 'new_password_key' => $key_forgot));
                     if ($add_new_pass) {
                         $is_mail_smtp = JO_Registry::forceGet('config_mail_smtp');
                         $mail = new JO_Mail();
                         if ($is_mail_smtp) {
                             $mail->setSMTPParams(JO_Registry::forceGet('config_mail_smtp_host'), JO_Registry::forceGet('config_mail_smtp_port'), JO_Registry::forceGet('config_mail_smtp_user'), JO_Registry::forceGet('config_mail_smtp_password'));
                         }
                         $this->view->new_password = $new_password;
                         $this->view->user_info = $result;
                         $this->view->forgot_password_href = WM_Router::create($request->getBaseUrl() . '?controller=users&action=login&user_id=' . $result['user_id'] . '&key=' . $key_forgot);
                         $this->view->header_title = JO_Registry::get('site_name');
                         $this->view->base_href = WM_Router::create($request->getBaseUrl());
                         $mail->setFrom(JO_Registry::get('noreply_mail'));
                         $mail->setReturnPath(JO_Registry::get('noreply_mail'));
                         $mail->setSubject($this->translate('Request for forgotten password') . ' ' . JO_Registry::get('site_name'));
                         $mail->setHTML($this->view->render('send_forgot_password_request', 'mail'));
                         $result_send = (int) $mail->send(array($result['email']), $is_mail_smtp ? 'smtp' : 'mail');
                         if ($result_send) {
                             $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=password&action=reset&done='));
                         } else {
                             $this->view->error = $this->translate('There was an error. Please try again later!');
                         }
                     } else {
                         $this->view->error = $this->translate('There was a problem with the record. Please try again!');
                     }
                 } else {
                     $this->view->error = $this->translate('This profile is not active.');
                 }
             } else {
                 $this->view->error = $this->translate('E-mail address was not found!');
             }
         } else {
             $this->view->error = $validate->_get_error_messages();
         }
     }
     $this->view->form_action = WM_Router::create($request->getBaseUrl() . '?controller=password&action=reset');
     $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
 }
开发者ID:noikiy,项目名称:amatteur,代码行数:57,代码来源:PasswordController.php


示例11: add

 public static function add($action, $transactionID, $userID = 0)
 {
     if ($userID == 0) {
         $userID = JO_Session::get('user_id');
     }
     $db = JO_Db::getDefaultAdapter();
     $db->insert(Model_Users::getPrefixDB() . 'history', array('user_id' => $userID, 'action' => $action, 'transaction_id' => $transactionID, 'datetime' => new JO_Db_Expr('NOW()')));
     return true;
 }
开发者ID:noikiy,项目名称:PD,代码行数:9,代码来源:History.php


示例12: bind

 public function bind($pin_id)
 {
     $req = new JO_Http_Async();
     $request = $this->getRequest();
     $user_login_buttons = $this->getByMethod('pin_oncomplete');
     foreach ($user_login_buttons as $id => $login) {
         $req->curl_get_async($request->getBaseUrl(), array('controller' => 'modules_' . $login . '_pinoncomplete', 'user' => JO_Session::get('user[user_id]'), 'pin' => $pin_id, 'type' => 'edit'));
     }
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:9,代码来源:PinOnEdit.php


示例13: getHistoryV2

 public static function getHistoryV2($data, $row = 'to_user_id', $user_id = 0)
 {
     $db = JO_Db::getDefaultAdapter();
     if (!$user_id) {
         $user_id = (string) JO_Session::get('user[user_id]');
     }
     $rows_history = self::describeTable('users_history', 'history_');
     $rows_users = self::describeTable('users', 'user_');
     switch (Helper_Config::get('config_user_view')) {
         case 'username':
             $rows_users['user_fullname'] = new JO_Db_Expr('users.username');
             break;
         case 'firstname':
             $rows_users['user_fullname'] = new JO_Db_Expr('users.firstname');
             break;
         case 'fullname':
         default:
             $rows_users['user_fullname'] = new JO_Db_Expr('CONCAT(users.firstname, " ", users.lastname)');
             break;
     }
     $query = $db->select()->from('users_history', $rows_history)->joinLeft('users', ($row == 'to_user_id' ? 'users_history.from_user_id' : 'users_history.to_user_id') . ' = users.user_id', $rows_users)->where($row . ' = ?', $user_id);
     if (isset($data['filter_history_action']) && (int) $data['filter_history_action']) {
         $query->where('users_history.history_action = ?', (int) $data['filter_history_action']);
     }
     if (isset($data['start']) && isset($data['limit'])) {
         if ($data['start'] < 0) {
             $data['start'] = 0;
         }
         $query->limit($data['limit'], $data['start']);
     }
     if (isset($data['sort']) && strtolower($data['sort']) == 'asc') {
         $sort = ' ASC';
     } else {
         $sort = ' DESC';
     }
     $allow_sort = array('history_id');
     if (isset($data['order']) && in_array($data['order'], $allow_sort)) {
         $query->order($data['order'] . $sort);
     } else {
         $query->order('history_id' . $sort);
     }
     $results = $db->fetchAll($query);
     $data = array();
     if ($results) {
         foreach ($results as $result) {
             $result['history_text_type'] = self::getType($result['history_history_action']);
             if ($result['history_text_type']) {
                 $result['history_date_dif'] = array_shift(WM_Date::dateDiff($result['history_date_added'], time()));
                 $data[] = $result;
             }
         }
     }
     return $data;
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:54,代码来源:Activity.php


示例14: indexAction

 public function indexAction()
 {
     $request = $this->getRequest();
     $settings = Model_Extensions::getSettingsPairs('facebook');
     if (!isset($settings['facebook_login_with_facebook']) || !$settings['facebook_login_with_facebook']) {
         $this->forward('error', 'error404');
     } elseif (!isset($settings['facebook_module_status_enable']) || !$settings['facebook_module_status_enable']) {
         $this->forward('error', 'error404');
     }
     $facebook = new Helper_Modules_Facebook();
     $user_data = $facebook->getUser(true);
     if ($user_data) {
         $modelLogin = new Model_Facebook_Login($user_data['id']);
         $error = true;
         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());
                 }
                 new Model_Users_Edit($modelLogin->row['user_id'], array('last_login' => new JO_Db_Expr('NOW()')));
                 $modelLogin->facebook = $facebook;
                 $modelLogin->update($user_data);
                 if ($request->getQuery('next')) {
                     $this->redirect(urldecode($request->getQuery('next')));
                 } else {
                     $this->redirect(WM_Router::create($this->getRequest()->getBaseUrl()));
                 }
             }
         } elseif (Helper_Config::get('enable_free_registration')) {
             $this->forward('modules_facebook_register');
         } elseif (JO_Session::get('user[user_id]')) {
             $this->redirect($request->getBaseUrl());
         }
         $this->setViewChange('no_account');
         $page_login_trouble = Model_Pages::getPage(Helper_Config::get('page_login_trouble'));
         if ($page_login_trouble) {
             $this->view->page_login_trouble = array('title' => $page_login_trouble['title'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=pages&action=read&page_id=' . $page_login_trouble['page_id']));
         }
     } else {
         //not session
         $this->setViewChange('error_login');
         $page_login_trouble = Model_Pages::getPage(Helper_Config::get('page_login_trouble'));
         if ($page_login_trouble) {
             $this->view->page_login_trouble = array('title' => $page_login_trouble['title'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=pages&action=read&page_id=' . $page_login_trouble['page_id']));
         }
     }
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:52,代码来源:LoginController.php


示例15: autocomplete

 public function autocomplete($query)
 {
     $request = $this->getRequest();
     $result = array();
     $has_friends = (int) JO_Session::get('user[following]') + (int) JO_Session::get('user[followers]');
     $users = $has_friends ? new Model_Users_SearchAutocomplete(array('filter_username' => $query, 'start' => 0, 'limit' => 100)) : new ArrayObject();
     if ($has_friends && $users->count()) {
         foreach ($users as $user) {
             $result[] = array('template' => 'user', 'avatars' => Helper_Uploadimages::userAvatars($user), 'fullname' => $user['fullname'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $user['user_id']));
         }
     }
     return $result;
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:13,代码来源:PeopleController.php


示例16: __construct

 public function __construct()
 {
     $request = JO_Request::getInstance();
     parent::__construct();
     if (Model_Allowips::getTotalWords()) {
         if (!Model_Allowips::getTotalWords(array('filete_ip' => $request->getClientIp()))) {
             if (!in_array($request->getController(), array('login', 'error'))) {
                 $this->forward('error', 'noPermission');
             }
         }
     }
     //set default timezone if is not set
     if (!ini_get('date.timezone')) {
         ini_set('date.timezone', 'UTC');
     }
     WM_Users::initSession(JO_Session::get('user[user_id]'));
     if (!JO_Session::get('user[user_id]')) {
         JO_Session::set('user', array('user_id' => 0));
     }
     //admin check login
     $login_page = $request->getController() != 'login';
     if (JO_Session::get('user[is_developer]')) {
         $login_page = false;
     } else {
         if (JO_Session::get('user[is_admin]')) {
             $login_page = false;
         }
     }
     if (in_array($request->getController(), array('login', 'error'))) {
         $login_page = false;
     }
     if ($login_page) {
         $this->forward('login', 'index');
     }
     //admin top menu
     Helper_Config::set('adminmenupermisions', WM_Users::initPermision());
     //no permisions
     $controller_name = JO_Front::getInstance()->formatControllerName($request->getController());
     if (!class_exists($controller_name, false)) {
         JO_Loader::loadFile(APPLICATION_PATH . '/modules/' . $request->getModule() . '/controllers/' . JO_Front::getInstance()->classToFilename($controller_name));
     }
     if (method_exists($controller_name, 'config')) {
         $data = call_user_func(array($controller_name, 'config'));
         if (isset($data['has_permision']) && $data['has_permision'] && !WM_Users::allow('read', $request->getController())) {
             $this->forward('error', 'noPermission');
         }
     }
     WM_Rebuild::getInformation();
     WM_Licensecheck::checkIt();
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:50,代码来源:Admin.php


示例17: getCategory

 public function getCategory($id)
 {
     static $result = array();
     if (isset($result[$id])) {
         return $result[$id];
     }
     $db = JO_Db::getDefaultAdapter();
     $query = 'SELECT c.*, cd.name
     		FROM categories c
     		JOIN categories_description cd ON cd.id = c.id AND cd.lid = ' . JO_Session::get('language_id') . '
     		WHERE c.id = ' . $db->quote($id);
     $result[$id] = $db->fetchRow($query);
     return $result[$id];
 }
开发者ID:noikiy,项目名称:PD,代码行数:14,代码来源:Items.php


示例18: indexAction

 public function indexAction()
 {
     $request = $this->getRequest();
     if (!JO_Session::get('user_id')) {
         $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=login'));
     }
     if (JO_Session::get('msg_success')) {
         $this->view->msg_error = JO_Session::get('msg_success');
         JO_Session::clear('msg_success');
     }
     if (JO_Session::get('msg_error')) {
         $this->view->msg_error = JO_Session::get('msg_error');
         JO_Session::clear('msg_error');
     }
     $this->view->questions = $questions = Model_Quiz::getAllQuestions(0, 0, '', 'RAND()');
     $this->view->answers = $answers = Model_Quiz::getAllAnswers(0, 0, '', true);
     if ($request->isPost()) {
         $rightAnswers = 0;
         $user_answers = $request->getPost('answers');
         if (is_array($user_answers)) {
             foreach ($user_answers as $question => $answer) {
                 if (isset($answers[$question][$answer]) && $answers[$question][$answer]['right'] == 'true') {
                     $rightAnswers++;
                 }
             }
         }
         if ($rightAnswers > 0 && count($questions) == $rightAnswers) {
             $_SESSION['user']['quiz'] = 'true';
             JO_Session::set('quiz', 'true');
             Model_Users::updateQuiz(JO_Session::get('user_id'), 'true');
             JO_Session::set('msg_success', 'You have successfully completed the quiz');
             $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=upload'));
         } else {
             JO_Session::set('msg_error', 'You have to answer all questions correctly. You have ' . $rightAnswers . ' right answers from ' . $question . ' questions');
             $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=quiz'));
         }
     }
     $this->view->usersCount = Model_Users::countUsers();
     $this->view->itemsCount = Model_Items::countItems();
     $this->getLayout()->meta_title = $this->translate('Quiz');
     $this->getLayout()->meta_description = $this->translate('Quiz');
     $this->view->page_name = $this->translate('Quiz');
     /* CRUMBS */
     $this->view->crumbs = array();
     $this->view->crumbs[] = array('name' => $this->view->translate('Home'), 'href' => $request->getBaseUrl());
     $this->view->children = array();
     $this->view->children['header_part'] = 'layout/header_part';
     $this->view->children['footer_part'] = 'layout/footer_part';
 }
开发者ID:noikiy,项目名称:PD,代码行数:49,代码来源:QuizController.php


示例19: indexAction

 public function indexAction()
 {
     if (!WM_Users::allow('edit', 'modules')) {
         JO_Session::set('error_permision', $this->translate('You do not have permission to this action'));
         $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/modules_oauth/');
     }
     $request = $this->getRequest();
     if (JO_Session::get('successfu_edite')) {
         $this->view->successfu_edite = true;
         JO_Session::clear('successfu_edite');
     }
     if ($request->isPost()) {
         //validate app id
         $validate = new Helper_Modules_Facebook($request->getPost('facebook[facebook_oauth_key]'), $request->getPost('facebook[facebook_oauth_secret]'));
         if ($validate->checkValidAppId()) {
             Model_Settings::updateAll(array('facebook' => $request->getPost('facebook')));
             JO_Session::set('successfu_edite', true);
             $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/modules_oauth_facebook/');
         } else {
             $this->view->error = $this->translate('Invalid appID');
         }
     }
     $this->view->modules_url = $this->getRequest()->getModule() . '/modules';
     $this->view->modules_oauth_url = $this->getRequest()->getModule() . '/modules_oauth';
     $methods = $this->getClassResources();
     $this->view->methods = array();
     $ignore = array('index', 'error404', 'install', 'uninstall');
     foreach ($methods as $type => $mods) {
         foreach ($mods as $key => $value) {
             if (in_array($value, $ignore)) {
                 continue;
             }
             if ($type == 'actions') {
                 $this->view->methods[$type][] = array('title' => $this->translate($value), 'edit' => $this->getRequest()->getModule() . '/modules_oauth_facebook/' . strtolower($value));
             } elseif ($type == 'radio') {
                 $this->view->methods[$type][] = array('title' => $this->translate(str_replace('_', ' ', $value)), 'key' => 'facebook_' . strtolower($value));
             }
         }
     }
     $store_config = Model_Settings::getSettingsPairs(array('filter_group' => 'facebook'));
     foreach ($store_config as $key => $data) {
         if ($request->issetPost('facebook[' . $key . ']')) {
             $this->view->{$key} = $request->getPost('facebook[' . $key . ']');
         } else {
             $this->view->{$key} = $data;
         }
     }
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:48,代码来源:FacebookController.php


示例20: getFollowing

 private function getFollowing($query, $data = array())
 {
     $db = JO_Db::getDefaultAdapter();
     $has_pins = 'pins.user_id = ?';
     if (JO_Session::get('user[following]')) {
         $has_pins .= ' OR pins.user_id IN (' . $db->select()->from('users_following', 'following_id')->where('user_id = ?')->where('users_following.board_id = pins.board_id') . ')';
         $has_pins .= ' OR pins.user_id IN (' . $db->select()->from('users_following_user', 'following_id')->where('user_id = ?') . ')';
     }
     $query->where(new JO_Db_Expr($has_pins), JO_Session::get('user[user_id]'));
     if (JO_Session::get('user[following]')) {
         $query->where('pins.board_id NOT IN (SELECT board_id FROM `users_following_ignore` WHERE user_id = ?)', JO_Session::get('user[user_id]'));
     }
     //sort and limit add to query from Model_Pins_Abstract
     $query = self::sortOrderLimit($query, $data);
     return $query;
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:16,代码来源:HomePage.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP JObject类代码示例发布时间:2022-05-23
下一篇:
PHP JO_Request类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap