本文整理汇总了PHP中SJB_UserManager类的典型用法代码示例。如果您正苦于以下问题:PHP SJB_UserManager类的具体用法?PHP SJB_UserManager怎么用?PHP SJB_UserManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SJB_UserManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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');
}
}
示例2: execute
public function execute()
{
$tp = SJB_System::getTemplateProcessor();
if (isset($_REQUEST['ajax'])) {
$sent = 0;
$ids = array();
if (isset($_REQUEST['userids'])) {
$ids = $_REQUEST['userids'];
foreach ($ids as $user_sid) {
if (!empty($user_sid) && SJB_Notifications::sendUserActivationLetter($user_sid)) {
$sent++;
}
}
}
$tp->assign("countOfSuccessfulSent", $sent);
$tp->assign("countOfUnsuccessfulSent", count($ids) - $sent);
$tp->display("send_activation_letter.tpl");
exit;
}
$user_sid = SJB_Request::getVar('usersid', null);
$error = null;
if (!SJB_UserManager::getObjectBySID($user_sid)) {
$error = "USER_DOES_NOT_EXIST";
} elseif (!SJB_Notifications::sendUserActivationLetter($user_sid)) {
$error = "CANNOT_SEND_EMAIL";
}
$tp->assign("error", $error);
$tp->display("send_activation_letter.tpl");
}
示例3: 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;
}
示例4: execute
public function execute()
{
$tp = SJB_System::getTemplateProcessor();
$user = SJB_UserManager::getCurrentUser();
if ($user) {
$userNotificationsManager = new SJB_UserNotificationsManager($user);
$userNotificationsInfo = $userNotificationsManager->getUserNotificationsInfo();
$userNotificationsInfo = array_merge($userNotificationsInfo, $_REQUEST);
$userNotifications = new SJB_UserNotifications($userNotificationsInfo);
$userNotificationsForm = new SJB_Form($userNotifications);
$userNotificationsForm->registerTags($tp);
$userNotificationsFields = $userNotificationsForm->getFormFieldsInfo();
$tp->assign('form_fields', $userNotificationsFields);
if (SJB_Request::getVar('action') === 'save') {
$errors = array();
if ($userNotificationsForm->isDataValid($errors)) {
$userNotifications->update();
$tp->assign('isSaved', true);
}
$tp->assign('errors', $errors);
}
$tp->assign('userNotificationGroups', $userNotificationsManager->getNotificationGroups()->getGroups());
$tp->assign('userNotifications', $userNotificationsManager->getEnabledForGroupUserNotifications());
$listingTypes = SJB_ListingTypeManager::getListingTypeByUserSID($user->getSID());
$approveSetting = SJB_ListingTypeManager::getWaitApproveSettingByListingType($listingTypes);
$tp->assign('approve_setting', $approveSetting);
$tp->display('user_notifications.tpl');
} else {
$tp->display('login.tpl');
}
}
示例5: execute
public function execute()
{
$tp = SJB_System::getTemplateProcessor();
$user = SJB_UserManager::getUserInfoBySID(SJB_Request::getVar('user_sid', 0, SJB_Request::METHOD_GET));
$user_id = $user['sid'];
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));
$per_page = 10;
$total = SJB_PrivateMessage::getTotalOutbox($user_id);
$max_pages = ceil($total / $per_page);
if ($max_pages == 0) {
$max_pages = 1;
}
if ($max_pages < $page) {
SJB_HelperFunctions::redirect("?user_sid={$user_id}&page={$max_pages}");
}
$navigate = SJB_PrivateMessage::getNavigate($page, $total, $per_page);
$list = SJB_PrivateMessage::getListOutbox($user_id, $page, $per_page);
$userGroupInfo = SJB_UserGroupManager::getUserGroupInfoBySID($user['user_group_sid']);
SJB_System::setGlobalTemplateVariable('wikiExtraParam', $userGroupInfo['id']);
$tp->assign("user_group_info", $userGroupInfo);
$tp->assign('username', $user['username']);
$tp->assign('user_sid', $user_id);
$tp->assign('message', $list);
$tp->assign('navigate', $navigate);
$tp->assign('page', $page);
$tp->display('pm_outbox.tpl');
}
示例6: execute
public function execute()
{
ini_set('max_execution_time', 0);
$tp = SJB_System::getTemplateProcessor();
$userGroupID = SJB_Request::getVar('user_group_id', 0);
$user = SJB_UsersExportController::createUser($userGroupID);
$searchFormBuilder = new SJB_SearchFormBuilder($user);
$criteria = $searchFormBuilder->extractCriteriaFromRequestData($_REQUEST, $user);
$searchFormBuilder->registerTags($tp);
$searchFormBuilder->setCriteria($criteria);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$exportProperties = SJB_Request::getVar('export_properties', array());
if (empty($exportProperties)) {
SJB_FlashMessages::getInstance()->addWarning('EMPTY_EXPORT_PROPERTIES');
} else {
$innerJoin = false;
if (isset($_REQUEST['product']['multi_like']) && $_REQUEST['product']['multi_like'] != '') {
$products = $_REQUEST['product']['multi_like'];
if (is_array($products)) {
$products = implode(',', $products);
}
$whereParam = implode(',', explode(',', SJB_DB::quote($products)));
$innerJoin = array('contracts' => array('join_field' => 'user_sid', 'join_field2' => 'sid', 'join' => 'INNER JOIN', 'where' => "AND FIND_IN_SET(`contracts`.`product_sid`, '{$whereParam}')"));
unset($criteria['system']['product']);
}
$searcher = new SJB_UserSearcher(false, 'parent_sid', 'ASC', $innerJoin);
$searchAliases = SJB_UsersExportController::getSearchPropertyAliases();
$foundUsersSid = $searcher->getObjectsSIDsByCriteria($criteria, $searchAliases);
if (!empty($foundUsersSid)) {
$result = SJB_UsersExportController::createExportDirectories();
if ($result === true) {
$exportProperties['extUserID'] = 1;
$exportProperties['parent_sid'] = 1;
$exportAliases = SJB_UsersExportController::getExportPropertyAliases();
$exportData = SJB_UsersExportController::getExportData($foundUsersSid, $exportProperties, $exportAliases);
$fileName = 'users.xls';
SJB_UsersExportController::makeExportFile($exportData, $fileName);
if (!file_exists(SJB_System::getSystemSettings('EXPORT_FILES_DIRECTORY') . "/{$fileName}")) {
SJB_FlashMessages::getInstance()->addWarning('CANT_CREATE_EXPORT_FILES');
} else {
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings("SITE_URL") . "/users/archive-and-send-export-data/");
}
}
} else {
SJB_FlashMessages::getInstance()->addWarning('EMPTY_EXPORT_DATA');
}
}
}
$userSystemProperties = SJB_UserManager::getAllUserSystemProperties();
$userGroups = SJB_UserGroupManager::getAllUserGroupsInfo();
$userCommonProperties = array();
foreach ($userGroups as $userGroup) {
$userGroupProperties = SJB_UserProfileFieldManager::getFieldsInfoByUserGroupSID($userGroup['sid']);
$userCommonProperties[$userGroup['id']] = $userGroupProperties;
}
$tp->assign('userSystemProperties', $userSystemProperties);
$tp->assign('userCommonProperties', $userCommonProperties);
$tp->assign('selected_user_group_id', $userGroupID);
$tp->display('export_users.tpl');
}
示例7: execute
public function execute()
{
$tp = SJB_System::getTemplateProcessor();
$listing_types = SJB_ListingTypeManager::getAllListingTypesInfo();
$countListings = array();
foreach ($listing_types as $type) {
$requested_data = array();
$requested_data['action'] = 'search';
$requested_data['active']['equal'] = '1';
$requested_data['listing_type']['equal'] = $type['id'];
$requireApprove = SJB_ListingTypeManager::getWaitApproveSettingByListingType($type['sid']);
if ($requireApprove) {
$requested_data['status']['equal'] = 'approved';
}
$listing = new SJB_Listing(array(), $type['sid']);
$id_alias_info = $listing->addIDProperty();
$listing->addActivationDateProperty();
$username_alias_info = $listing->addUsernameProperty();
$listing_type_id_info = $listing->addListingTypeIDProperty();
$listing->addCompanyNameProperty();
if ($type['id'] == 'Resume') {
$requested_data['access_type'] = array('accessible' => SJB_UserManager::getCurrentUserSID());
}
$criteria = SJB_SearchFormBuilder::extractCriteriaFromRequestData($requested_data, $listing);
$aliases = new SJB_PropertyAliases();
$aliases->addAlias($id_alias_info);
$aliases->addAlias($username_alias_info);
$aliases->addAlias($listing_type_id_info);
$searcher = new SJB_ListingSearcher();
$countListings[$type['id']] = $searcher->countRowsByCriteria($criteria, $aliases);
}
$tp->assign('listings_types', $countListings);
$tp->display('count_listings.tpl');
}
示例8: execute
public function execute()
{
$template_processor = SJB_System::getTemplateProcessor();
$username = SJB_Request::getVar('username', null);
$verification_key = SJB_Request::getVar('verification_key', null);
$ERRORS = array();
$password_was_changed = false;
$user_info = SJB_UserManager::getUserInfoByUserName($username);
if (empty($user_info)) {
$ERRORS['EMPTY_USERNAME'] = 1;
} elseif (empty($verification_key)) {
$ERRORS['EMPTY_VERIFICATION_KEY'] = 1;
} elseif ($user_info['verification_key'] != $verification_key) {
$ERRORS['WRONG_VERIFICATION_KEY'] = 1;
} elseif ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (!empty($_REQUEST['password']) && $_REQUEST['password'] == $_REQUEST['confirm_password']) {
$password_was_changed = SJB_UserManager::changeUserPassword($user_info['sid'], $_REQUEST['password']);
} else {
$ERRORS['PASSWORD_NOT_CONFIRMED'] = 1;
}
}
if ($password_was_changed) {
$template_processor->display('successful_password_change.tpl');
} else {
$template_processor->assign('username', $username);
$template_processor->assign('verification_key', $verification_key);
$template_processor->assign('errors', $ERRORS);
$template_processor->display('change_password.tpl');
}
}
示例9: saveInvoice
public static function saveInvoice($invoice)
{
$serializedItemsDetails['items'] = $invoice->getPropertyValue('items');
$products = isset($serializedItemsDetails['items']['products']) ? $serializedItemsDetails['items']['products'] : array();
$products = implode(',', $products);
$invoice->addProperty(array('id' => 'serialized_items_info', 'type' => 'text', 'value' => serialize($serializedItemsDetails), 'is_system' => true));
$invoice->addProperty(array('id' => 'product_sid', 'type' => 'string', 'value' => $products, 'is_system' => true));
$invoice->deleteProperty('items');
$serializedTaxDetails['tax_info'] = $invoice->getPropertyValue('tax_info');
$invoice->addProperty(array('id' => 'serialized_tax_info', 'type' => 'text', 'value' => serialize($serializedTaxDetails), 'is_system' => true));
$invoice->deleteProperty('tax_info');
$user_sid = $invoice->getPropertyValue('user_sid');
$user_info = SJB_UserManager::getUserInfoBySID($user_sid);
if (!empty($user_info['parent_sid'])) {
$invoice->setPropertyValue('subuser_sid', $user_sid);
$invoice->setPropertyValue('user_sid', $user_info['parent_sid']);
}
$dateProperty = $invoice->getProperty('date');
$value = $dateProperty->getValue();
if (!$dateProperty->type->getConvertToDBDate() && $value != null) {
$invoice->setPropertyValue('date', SJB_I18N::getInstance()->getDate($value));
}
$invoice->setPropertyValue('sub_total', SJB_I18N::getInstance()->getFloat($invoice->getPropertyValue('sub_total')));
$invoice->setPropertyValue('total', SJB_I18N::getInstance()->getFloat($invoice->getPropertyValue('total')));
parent::saveObject('invoices', $invoice);
if ($value == null) {
SJB_DB::query('UPDATE `invoices` SET `date`= NOW() WHERE `sid`=?n', $invoice->getSID());
}
}
示例10: 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');
}
示例11: 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");
}
}
示例12: 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');
}
}
示例13: login
public static function login($request)
{
$blogPath = SJB_Settings::getSettingByName('blog_path');
if (empty($blogPath)) {
return;
}
$username = $request['username'];
$password = $request['password'];
$userInfo = SJB_UserManager::getUserInfoByUserName($username);
$userInfo = $userInfo ? base64_encode(serialize($userInfo)) : false;
$url = SJB_System::getSystemSettings('SITE_URL') . $blogPath . '/wp-login.php';
$client = new Zend_Http_Client($url, array('useragent' => SJB_Request::getUserAgent(), 'maxredirects' => 0));
$client->setCookieJar();
$client->setCookie($_COOKIE);
$client->setMethod(Zend_Http_Client::POST);
$client->setParameterPost(array('log' => $username, 'pwd' => $password, 'noSJB' => 1, 'userInfo' => $userInfo, 'wp-submit' => 'Log in'));
try {
$response = $client->request();
foreach ($response->getHeaders() as $key => $header) {
if ('set-cookie' == strtolower($key)) {
if (is_array($header)) {
foreach ($header as $val) {
header("Set-Cookie: " . $val, false);
}
} else {
header("Set-Cookie: " . $header, false);
}
}
}
$_SESSION['wp_cookie_jar'] = @serialize($client->getCookieJar());
} catch (Exception $ex) {
}
}
示例14: deleteContract
public static function deleteContract($contract_id, $user_sid = false)
{
$contract = new SJB_Contract(array('contract_id' => $contract_id, 'user_sid' => $user_sid));
SJB_ContractManager::deleteContractIDFromNotificationSended($contract_id);
if ($contract->isFeaturedProfile()) {
$allContracts = self::getAllContractsInfoByUserSID($user_sid);
$featured = 0;
foreach ($allContracts as $userContract) {
if ($userContract['id'] != $contract_id) {
$userContract = new SJB_Contract(array('contract_id' => $userContract['id'], 'user_sid' => $user_sid));
if ($userContract->isFeaturedProfile()) {
$featured = 1;
break;
}
}
}
if ($featured == 0) {
SJB_UserManager::removeFromFeaturedBySID($user_sid);
}
}
if ($contract->product_type == 'banners') {
$banner = new SJB_Banners();
$contractBannerID = $banner->getBannerIDByContract($contract_id);
if ($contractBannerID) {
$banner->deleteBanner($contractBannerID);
}
}
$permissions = SJB_Acl::getInstance();
$permissions->clearPermissions('contract', $contract_id);
return $contract->delete();
}
示例15: execute
public function execute()
{
$listing_id = isset($_REQUEST['listing_id']) ? $_REQUEST['listing_id'] : null;
$listing = SJB_ListingManager::getObjectBySID($listing_id);
$current_user = SJB_UserManager::getCurrentUser();
$template_processor = SJB_System::getTemplateProcessor();
if (is_null($listing_id)) {
$errors['PARAMETERS_MISSED'] = 1;
} elseif (empty($current_user)) {
$errors['NOT_LOGGED_IN'] = 1;
} elseif (is_null($listing)) {
$errors['WRONG_PARAMETERS_SPECIFIED'] = 1;
} elseif ($listing->getUserSID() != $current_user->getSID()) {
$errors['NOT_OWNER'] = 1;
} else {
$productInfo = $listing->getProductInfo();
$listing_info = SJB_ListingManager::getListingInfoBySID($listing_id);
$listing_type_info = SJB_ListingTypeManager::getListingTypeInfoBySID($listing_info['listing_type_sid']);
$waitApprove = $listing_type_info['waitApprove'];
$listing_info['type'] = array('id' => $listing_type_info['id'], 'caption' => $listing_type_info['name']);
$listing_info['product'] = $productInfo;
$template_processor->assign("listing", $listing_info);
$contract_id = $listing_info['contract_id'];
$template_processor->assign("waitApprove", $waitApprove);
}
$template_processor->assign("errors", isset($errors) ? $errors : null);
$template_processor->display("manage_listing.tpl");
}