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


PHP SJB_UserManager::isUserLoggedIn方法代码示例

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


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

示例1: execute

 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $errors = array();
     $listingTypeID = SJB_Request::getVar('listing_type_id', '');
     if (SJB_UserManager::isUserLoggedIn()) {
         if (!SJB_Acl::getInstance()->isAllowed('save_' . trim($listingTypeID))) {
             $errors[] = 'DENIED_VIEW_SAVED_LISTING';
         }
         if (!$errors) {
             $userSid = SJB_UserManager::getCurrentUserSID();
             if (SJB_Request::getVar('action', '') == 'delete') {
                 $listing_id = SJB_Request::getVar('listing_id', null);
                 if (!is_null($listing_id)) {
                     foreach ($listing_id as $key => $value) {
                         SJB_SavedListings::deleteListingFromDBBySID($key, $userSid);
                     }
                     SJB_HelperFunctions::redirect(SJB_System::getSystemSettings("SITE_URL") . SJB_Navigator::getURI());
                 }
             }
             $saved_listings_id = SJB_SavedListings::getSavedListingsFromDB($userSid);
             $listings_structure = array();
             $listing_structure_meta_data = array();
             foreach ($saved_listings_id as $saved_listing) {
                 $saved_listing_id = $saved_listing['listing_sid'];
                 $listing = SJB_ListingManager::getObjectBySID($saved_listing_id);
                 if (is_null($listing)) {
                     continue;
                 }
                 $listing->addPicturesProperty();
                 $listing_structure = SJB_ListingManager::createTemplateStructureForListing($listing);
                 $listings_structure[$listing->getID()] = $listing_structure;
                 $listings_structure[$listing->getID()]['saved_listing'] = $saved_listing;
                 if (isset($listing_structure['METADATA'])) {
                     $listing_structure_meta_data = array_merge($listing_structure_meta_data, $listing_structure['METADATA']);
                 }
             }
             $metaDataProvider = SJB_ObjectMother::getMetaDataProvider();
             $tp->assign("METADATA", array("listing" => $metaDataProvider->getMetaData($listing_structure_meta_data)));
             $tp->assign("listings", $listings_structure);
             $tp->assign("listing_type_id", $listingTypeID);
             $tp->display("saved_listings.tpl");
         } else {
             $tp->assign("errors", $errors);
             $tp->display("save_search_failed.tpl");
         }
     } else {
         $url = base64_encode(SJB_System::getSystemSettings("SITE_URL") . "/system/classifieds" . SJB_System::getURI());
         switch ($listingTypeID) {
             case 'job':
                 $url = base64_encode(SJB_System::getSystemSettings("SITE_URL") . "/saved-jobs/");
                 break;
             case 'resume':
                 $url = base64_encode(SJB_System::getSystemSettings("SITE_URL") . "/saved-resumes/");
                 break;
         }
         $tp->assign("return_url", $url);
         $tp->display("../users/login.tpl");
     }
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:60,代码来源:saved_listings.php

示例2: canRate

 public static function canRate($listing_sid, $title = false)
 {
     if (SJB_UserManager::isUserLoggedIn()) {
         $user_info = SJB_UserManager::getCurrentUserInfo();
         $user_id = $user_info['sid'];
     } else {
         if ($title) {
             self::$title = 3;
         }
         //'Please sign in to vote ';
         return false;
     }
     $result = SJB_DB::query("SELECT vote FROM `rating` WHERE `user_id` = {$user_id} AND listing_id = ?n ", $listing_sid);
     if (count($result) == 0) {
         if ($title) {
             self::$title = 1;
         }
         //'Please, Vote!';
         return true;
     }
     if ($title) {
         self::$title = 2;
     }
     //"You've already voted";
     return false;
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:26,代码来源:Rating.php

示例3: execute

 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     if (SJB_UserManager::isUserLoggedIn()) {
         $user_id = SJB_UserManager::getCurrentUserSID();
         $errors = array();
         $id = SJB_Request::getInt('id', 0, 'GET');
         $action = SJB_Request::getVar('action', '', 'GET');
         if ($id > 0) {
             // read message
             if (SJB_PrivateMessage::isMyMessage($id)) {
                 if ($action == 'delete') {
                     SJB_PrivateMessage::delete(array($id));
                     SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/private-messages/inbox/');
                 }
                 $message = SJB_PrivateMessage::readMessage($id);
                 SJB_Authorization::updateCurrentUserSession();
                 $current_user_info = SJB_UserManager::createTemplateStructureForCurrentUser();
                 $current_user_info['logged_in'] = true;
                 $current_user_info['new_messages'] = SJB_PrivateMessage::getCountUnreadMessages($current_user_info['id']);
                 SJB_System::setCurrentUserInfo($current_user_info);
                 $tp->assign('message', $message);
                 $tp->assign('include', 'message_detail.tpl');
             } else {
                 $errors['NOT_EXISTS_MESSAGE'] = 1;
             }
         }
         $tp->assign('errors', $errors);
         $tp->assign('unread', SJB_PrivateMessage::getCountUnreadMessages($user_id));
         $tp->display('main.tpl');
     } else {
         $tp->assign('return_url', base64_encode(SJB_Navigator::getURIThis()));
         $tp->display('../users/login.tpl');
     }
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:35,代码来源:private_messages_read.php

示例4: execute

 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     if (SJB_UserManager::isUserLoggedIn()) {
         $user_id = SJB_UserManager::getCurrentUserSID();
         if (SJB_Request::getVar('pm_action', '', SJB_Request::METHOD_POST) == 'delete') {
             $checked = SJB_Request::getVar('pm_check', array(), SJB_Request::METHOD_POST);
             SJB_PrivateMessage::delete($checked);
         }
         $page = intval(SJB_Request::getVar('page', 1, SJB_Request::METHOD_GET));
         $messagesPerPage = SJB_Request::getInt('messagesPerPage', 10);
         $total = SJB_PrivateMessage::getTotalOutbox($user_id);
         $totalPages = ceil($total / $messagesPerPage);
         if ($totalPages == 0) {
             $totalPages = 1;
         }
         if (empty($page) || $page <= 0) {
             $page = 1;
         }
         if ($totalPages < $page) {
             SJB_HelperFunctions::redirect("?page={$totalPages}");
         }
         $list = SJB_PrivateMessage::getListOutbox($user_id, $page, $messagesPerPage);
         $tp->assign('message_list', $list);
         $tp->assign('messagesPerPage', $messagesPerPage);
         $tp->assign('page', $page);
         $tp->assign('totalPages', $totalPages);
         $tp->assign('include', 'list_outbox.tpl');
         $tp->assign('unread', SJB_PrivateMessage::getCountUnreadMessages($user_id));
     }
     $tp->display('main.tpl');
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:32,代码来源:private_messages_outbox.php

示例5: execute

 public function execute()
 {
     $count_listing = SJB_Request::getVar('count_listing', 10);
     $listings_structure = array();
     $listing_structure_meta_data = array();
     $tp = SJB_System::getTemplateProcessor();
     if (SJB_UserManager::isUserLoggedIn()) {
         $user_sid = SJB_UserManager::getCurrentUserSID();
         $viewed_listings = SJB_UserManager::getRecentlyViewedListingsByUserSid($user_sid, $count_listing);
         if (count($viewed_listings)) {
             foreach ($viewed_listings as $viewed_listing) {
                 $listing = SJB_ListingManager::getObjectBySID($viewed_listing['listing_sid']);
                 if (empty($listing)) {
                     continue;
                 }
                 $listing_structure = SJB_ListingManager::createTemplateStructureForListing($listing);
                 $listings_structure[] = $listing_structure;
                 if (isset($listing_structure['METADATA'])) {
                     $listing_structure_meta_data = array_merge($listing_structure_meta_data, $listing_structure['METADATA']);
                 }
             }
             $metaDataProvider = SJB_ObjectMother::getMetaDataProvider();
             $tp->assign("METADATA", array("listing" => $metaDataProvider->getMetaData($listing_structure_meta_data)));
             $tp->assign("listings", $listings_structure);
         }
         $tp->display('recently_viewed_listings.tpl');
     }
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:28,代码来源:recently_viewed_listings.php

示例6: execute

 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $count_listing = SJB_Request::getVar('count_listing', 10, null, 'int');
     $current_user = SJB_UserManager::getCurrentUser();
     if (SJB_UserManager::isUserLoggedIn()) {
         $lastAddedListing = SJB_ListingManager::getLastAddedListingByUserSID($current_user->getSID());
         if ($lastAddedListing) {
             $properties = $current_user->getProperties();
             $phrase['title'] = $lastAddedListing->getPropertyValue('Title');
             foreach ($properties as $property) {
                 if ($property->getType() == 'location') {
                     $fields = $property->type->child;
                     $childProperties = $fields->getProperties();
                     foreach ($childProperties as $childProperty) {
                         if (in_array($childProperty->getID(), array('City', 'State', 'Country'))) {
                             $value = $childProperty->getValue();
                             switch ($childProperty->getType()) {
                                 case 'list':
                                     if ($childProperty->getID() == 'State') {
                                         $displayAS = $childProperty->display_as;
                                         $displayAS = $displayAS ? $displayAS : 'state_name';
                                         $listValues = SJB_StatesManager::getStatesNamesByCountry(false, true, $displayAS);
                                     } else {
                                         $listValues = $childProperty->type->list_values;
                                     }
                                     foreach ($listValues as $values) {
                                         if ($value == $values['id']) {
                                             $phrase[strtolower($childProperty->getID())] = $values['caption'];
                                         }
                                     }
                                     break;
                                 default:
                                     $phrase[strtolower($childProperty->getID())] = $value;
                                     break;
                             }
                         }
                     }
                 }
             }
             $phrase = array_diff($phrase, array(''));
             $phrase = implode(" ", $phrase);
             $listing_type_id = "Job";
             $request['action'] = 'search';
             $request['listing_type']['equal'] = $listing_type_id;
             $request['default_listings_per_page'] = $count_listing;
             $request['default_sorting_field'] = "activation_date";
             $request['default_sorting_order'] = "DESC";
             $request['keywords']['relevance'] = $phrase;
             $searchResultsTP = new SJB_SearchResultsTP($request, $listing_type_id, array('field' => 'keywords', 'value' => $phrase));
             $tp = $searchResultsTP->getChargedTemplateProcessor();
         }
         $tp->display('suggested_jobs.tpl');
     }
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:55,代码来源:suggested_jobs.php

示例7: execute

 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     if (SJB_UserManager::isUserLoggedIn()) {
         $user_id = SJB_UserManager::getCurrentUserSID();
         $unread = SJB_PrivateMessage::getCountUnreadMessages($user_id);
         $tp->assign('unread', $unread);
         $tp->assign('include', '');
     }
     $tp->display('main.tpl');
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:11,代码来源:private_messages.php

示例8: jsRate

 private function jsRate()
 {
     if (!SJB_UserManager::isUserLoggedIn()) {
         exit;
     }
     $listing_sid = SJB_Request::getInt('listing', 0, SJB_Request::METHOD_POST);
     $rate = SJB_Request::getInt('rate', 0, SJB_Request::METHOD_POST);
     $new_rating = SJB_Rating::setRaiting($rate, $listing_sid, SJB_UserManager::getCurrentUserSID());
     if (isset($new_rating['rating'])) {
         echo $new_rating['rating'];
     }
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:12,代码来源:ajax.php

示例9: execute

 public function execute()
 {
     $template_processor = SJB_System::getTemplateProcessor();
     $listingId = SJB_Request::getVar('listing_id', null, 'default', 'int');
     $listingType = SJB_Request::getVar('listing_type', null);
     if (!$listingType) {
         if ($listingId) {
             $listingInfo = SJB_ListingManager::getListingInfoBySID($listingId);
             $listingType = SJB_ListingTypeManager::getListingTypeIDBySID($listingInfo['listing_type_sid']);
         } else {
             $listingType = 'job';
         }
     }
     $displayForm = SJB_Request::getVar('displayForm', false);
     $error = null;
     if (!SJB_Acl::getInstance()->isAllowed('save_' . trim($listingType))) {
         $error = 'DENIED_SAVE_LISTING';
     }
     if (SJB_UserManager::isUserLoggedIn()) {
         if (!$error) {
             if (!is_null($listingId)) {
                 if (SJB_UserManager::isUserLoggedIn()) {
                     SJB_SavedListings::saveListingOnDB($listingId, SJB_UserManager::getCurrentUserSID());
                     SJB_Statistics::addStatistics('saveListing', SJB_ListingTypeManager::getListingTypeSIDByID($listingType), $listingId);
                 } else {
                     SJB_SavedListings::saveListingInCookie($listingId);
                 }
                 $template_processor->assign('saved_listing', SJB_SavedListings::getSavedListingsByUserAndListingSid(SJB_UserManager::getCurrentUserSID(), $listingId));
             } else {
                 $error = 'LISTING_ID_NOT_SPECIFIED';
             }
         }
         $params = SJB_Request::getVar('params', false);
         $searchId = SJB_Request::getVar('searchId', false);
         $page = SJB_Request::getVar('page', false);
         $template_processor->assign("params", $params);
         $template_processor->assign("searchId", $searchId);
         $template_processor->assign("page", $page);
         $template_processor->assign("listing_type", $listingType);
         $template_processor->assign("listing_sid", $listingId);
         $template_processor->assign("from_login", SJB_Request::getVar("from_login", false));
         $template_processor->assign("error", $error);
         $template_processor->assign("displayForm", $displayForm);
         $template_processor->assign("view", SJB_Request::getVar('view'));
         $template_processor->display("save_listing.tpl");
     } else {
         $template_processor->assign("return_url", base64_encode(SJB_Navigator::getURIThis() . "&from_login=1"));
         $template_processor->assign("ajaxRelocate", true);
         $template_processor->display("../users/login.tpl");
     }
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:51,代码来源:save_listing.php

示例10: execute

 public function execute()
 {
     $pageConfig = SJB_Request::getInstance()->page_config;
     $tp = SJB_System::getTemplateProcessor();
     if (isset($this->params['ERROR'])) {
         $tp->assign('ERROR', $this->params['ERROR']);
     } else {
         if (SJB_UserManager::isUserLoggedIn()) {
             $tp->assign('ERROR', 'ACCESS_DENIED');
         } else {
             $tp->assign('ERROR', 'NOT_LOGIN');
         }
     }
     $tp->assign('page_function', $pageConfig->function);
     $tp->display('../miscellaneous/error.tpl');
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:16,代码来源:error.php

示例11: execute

 public function execute()
 {
     $current_user_info = array('logged_in' => false);
     if (SJB_UserManager::isUserLoggedIn()) {
         SJB_Authorization::updateCurrentUserSession();
         $current_user_info = SJB_UserManager::createTemplateStructureForCurrentUser();
         $current_user_info['logged_in'] = true;
         $current_user_info['new_messages'] = SJB_PrivateMessage::getCountUnreadMessages($current_user_info['id']);
     } else {
         // social plugin
         $userGroups = SJB_UserGroupManager::getAllUserGroupsInfo();
         SJB_System::setCurrentUserGroupsInfo($userGroups);
         SJB_Event::dispatch('Login_Plugin');
     }
     SJB_System::setCurrentUserInfo($current_user_info);
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:16,代码来源:init_current_user_structure.php

示例12: execute

 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     if (SJB_UserManager::isUserLoggedIn()) {
         $userSID = SJB_UserManager::getCurrentUserSID();
         $action = SJB_Request::getVar('pm_action', null);
         if ($action) {
             $checked = SJB_Request::getVar('pm_check', array(), 'POST');
             switch ($action) {
                 case 'delete':
                     SJB_PrivateMessage::deleteContact($userSID, $checked);
                     break;
                 case 'save_contact':
                     $error = '';
                     $contactSID = SJB_Request::getInt('user_id', 0);
                     SJB_PrivateMessage::saveContact($userSID, $contactSID, $error);
                     $tp->assign('error', $error);
                     $tp->display('contact_save.tpl');
                     return true;
                     break;
                 default:
                     break;
             }
         }
         $page = SJB_Request::getInt('page', 1, 'GET');
         $contactsPerPage = SJB_Request::getInt('contactsPerPage', 10);
         SJB_PrivateMessage::deleteNonexistentContacts($userSID);
         $total = SJB_PrivateMessage::getTotalContacts($userSID);
         $totalPages = ceil($total / $contactsPerPage);
         if ($totalPages == 0) {
             $totalPages = 1;
         }
         if (empty($page) || $page <= 0) {
             $page = 1;
         }
         if ($totalPages < $page) {
             SJB_HelperFunctions::redirect("?page={$totalPages}");
         }
         $tp->assign('message_list', SJB_PrivateMessage::getContacts($userSID, $page, $contactsPerPage));
         $tp->assign('contactsPerPage', $contactsPerPage);
         $tp->assign('page', $page);
         $tp->assign('totalPages', $totalPages);
         $tp->assign('include', 'contacts.tpl');
         $tp->assign('unread', SJB_PrivateMessage::getCountUnreadMessages($userSID));
     }
     $tp->display('main.tpl');
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:47,代码来源:private_messages_contacts.php

示例13: execute

 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $user_menu_template = 'user_menu.tpl';
     if (SJB_UserManager::isUserLoggedIn()) {
         $user_info = SJB_Authorization::getCurrentUserInfo();
         if (!empty($user_info)) {
             $user_group_info = SJB_UserGroupManager::getUserGroupInfoBySID($user_info['user_group_sid']);
             if (!empty($user_group_info['user_menu_template']) && $tp->templateExists($user_group_info['user_menu_template'])) {
                 $user_menu_template = $user_group_info['user_menu_template'];
             }
             $tp->assign("user_group_info", $user_group_info);
             $tp->assign('listingTypesInfo', SJB_ListingTypeManager::getAllListingTypesInfo());
         }
     }
     $tp->assign("account_activated", SJB_Request::getVar('account_activated', ''));
     $tp->display($user_menu_template);
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:18,代码来源:user_menu.php

示例14: execute

 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     if (SJB_UserManager::isUserLoggedIn()) {
         $user_id = SJB_UserManager::getCurrentUserSID();
         $action = SJB_Request::getVar('pm_action', SJB_Request::METHOD_POST, false);
         if ($action) {
             $checked = SJB_Request::getVar('pm_check', SJB_Request::METHOD_POST, array());
             switch ($action) {
                 case 'mark':
                     SJB_PrivateMessage::markAsRead($checked);
                     SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/private-messages/inbox/');
                     break;
                 case 'delete':
                     SJB_PrivateMessage::delete($checked);
                     SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/private-messages/inbox/');
                     break;
                 default:
                     break;
             }
         }
         $page = SJB_Request::getInt('page', 1, 'GET');
         $messagesPerPage = SJB_Request::getInt('messagesPerPage', 10);
         $total = SJB_PrivateMessage::getTotalInbox($user_id);
         $totalPages = ceil($total / $messagesPerPage);
         if ($totalPages == 0) {
             $totalPages = 1;
         }
         if (empty($page) || $page <= 0) {
             $page = 1;
         }
         if ($totalPages < $page) {
             SJB_HelperFunctions::redirect("?page={$totalPages}");
         }
         $tp->assign('message_list', SJB_PrivateMessage::getListInbox($user_id, $page, $messagesPerPage));
         $tp->assign('include', 'list_inbox.tpl');
         $tp->assign('messagesPerPage', $messagesPerPage);
         $tp->assign('page', $page);
         $tp->assign('totalPages', $totalPages);
         $tp->assign('unread', SJB_PrivateMessage::getCountUnreadMessages($user_id));
     }
     $tp->display('main.tpl');
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:43,代码来源:private_messages_inbox.php

示例15: execute

 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $action = null;
     if (SJB_UserManager::isUserLoggedIn()) {
         $userSID = SJB_UserManager::getCurrentUserSID();
         $contactSID = 0;
         $errors = array();
         if (isset($_REQUEST['passed_parameters_via_uri'])) {
             $passed_parameters_via_uri = SJB_UrlParamProvider::getParams();
             $contactSID = SJB_Array::get($passed_parameters_via_uri, 0);
         }
         if (!$contactSID) {
             $errors['UNDEFINED_CONTACT_ID'] = 1;
         } else {
             $contactInfo = SJB_PrivateMessage::getContactInfo($userSID, $contactSID);
             if (!$contactInfo) {
                 $errors['WRONG_CONTACT_ID_SPECIFIED'] = 1;
             } else {
                 $action = SJB_Request::getVar('action');
                 switch ($action) {
                     case 'save':
                         $note = SJB_Request::getVar('note');
                         $result = SJB_PrivateMessage::saveContactNote($userSID, $contactSID, $note);
                         if ($result) {
                             $tp->assign('noteSaved', true);
                         }
                         break;
                     default:
                         break;
                 }
             }
             $tp->assign('contactInfo', $contactInfo);
         }
         $tp->assign('errors', $errors);
     }
     if ($action) {
         $tp->assign('action', $action);
         $tp->display('notes.tpl');
     } else {
         $tp->display('contact.tpl');
     }
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:43,代码来源:private_messages_contact.php


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