本文整理汇总了PHP中JO_Session::get方法的典型用法代码示例。如果您正苦于以下问题:PHP JO_Session::get方法的具体用法?PHP JO_Session::get怎么用?PHP JO_Session::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JO_Session
的用法示例。
在下文中一共展示了JO_Session::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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());
}
示例2: __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);
}
示例3: 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");
}
示例4: 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');
}
示例5: __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));
}
}
}
示例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;
}
示例7: 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');
}
}
示例8: __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();
}
}
示例9: 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';
}
示例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');
}
示例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;
}
示例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'));
}
}
示例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;
}
示例14: upload_imagesAction
public function upload_imagesAction()
{
$request = $this->getRequest();
if (JO_Session::get('user[user_id]')) {
if (JO_Session::get('upload_from_file')) {
@unlink(BASE_PATH . JO_Session::get('upload_from_file'));
JO_Session::clear('upload_from_file');
JO_Session::clear('upload_from_file_name');
}
$image = $request->getFile('file');
if (!$image) {
$this->view->error = $this->translate('There is no file selected');
} else {
$temporary = '/cache/review/';
$upload_folder = BASE_PATH . $temporary;
$upload = new Helper_Upload();
$files_delete = glob($upload_folder . '*.*');
if ($files_delete) {
for ($i = 0; $i < min(count($files_delete), 250); $i++) {
if (filemtime($files_delete[$i]) + 86400 < time()) {
@unlink($files_delete[$i]);
}
}
}
$upload->setFile($image)->setExtension(array('.jpg', '.jpeg', '.png', '.gif'))->setUploadDir($upload_folder);
$new_name = md5(time() . serialize($image));
if ($upload->upload($new_name)) {
$info = $upload->getFileInfo();
if ($info) {
$config_image_minimum_size = (int) Helper_Config::get('config_image_minimum_size');
if (!$config_image_minimum_size) {
$config_image_minimum_size = 80;
}
if (isset($info['image_dimension']['x']) && $info['image_dimension']['x'] >= $config_image_minimum_size && $info['image_dimension']['y'] >= $config_image_minimum_size) {
$this->view->from_url = WM_Router::create($request->getBaseUrl() . '?controller=addpin_fromfile&action=stepone');
$this->view->success = 1;
JO_Session::set('upload_from_file', $temporary . $info['name']);
JO_Session::set('upload_from_file_name', $image['name']);
} else {
@unlink($upload_folder . $info['name']);
$this->view->error = sprintf($this->translate('Photo size must be larger width and height of %s px'), $config_image_minimum_size);
}
} else {
$this->view->error = $this->translate('An unknown error');
}
} else {
$this->view->error = $upload->getError();
}
}
} else {
$this->view->location = WM_Router::create($request->getBaseUrl() . '?controller=users&action=login');
}
echo $this->renderScript('json');
}
示例15: 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']));
}
}
}