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'); } }
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"); }
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; }
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'); } }
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'); }
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'); }
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'); }
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'); } }
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()); } }
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'); }
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"); } }
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'); } }
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) { } }
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(); }
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"); }
public static function addStatistics($event, $type = '', $objectSID = 0, $unique = false, $featured = 0, $priority = 0, $userSID = false, $price = 0, $plugin = '', $reactivate = 0) { if (!$userSID) { $userSID = SJB_UserManager::getCurrentUserSID(); $userSID = $userSID ? $userSID : 0; } $IP = $_SERVER['REMOTE_ADDR']; $params = array('ip' => $IP, 'type' => $type, 'event' => $event, 'date' => 'YEAR(CURDATE()) = YEAR(`date`) AND DAYOFYEAR(CURDATE()) = DAYOFYEAR(`date`)', 'object_sid' => $objectSID, 'limit' => 1, 'price' => $price); if (!in_array($event, array('siteView', 'viewMobileVersion'))) { $params['user_sid'] = $userSID; } $browsingEvents = array('viewListing', 'siteView', 'partneringSites', 'showInSearchResults'); if (SJB_Request::isBot() && in_array($event, $browsingEvents)) { return false; } else { if ($statistics = self::getStatistics($params)) { $statistics = array_pop($statistics); if (!$unique) { SJB_DB::query("UPDATE `statistics` SET `count` = ?n WHERE `sid` = ?n", ++$statistics['count'], $statistics['sid']); } elseif ($userSID && $statistics['user_sid'] == 0) { SJB_DB::query("UPDATE `statistics` SET `user_sid` = ?n WHERE `sid` = ?n", $userSID, $statistics['sid']); } } else { SJB_DB::query("INSERT INTO `statistics` (`user_sid`, `ip`, `event`, `object_sid`, `type`, `date`, `featured`, `priority`, `reactivate`, `price`, `plugin`) VALUES (?n, ?s, ?s, ?n, ?s, NOW(), ?n, ?n, ?n, ?f, ?s)", $userSID, $IP, $event, $objectSID, $type, $featured, $priority, $reactivate, $price, $plugin); } return true; } }
public function execute() { $tp = SJB_System::getTemplateProcessor(); $errors = array(); $listingSID = SJB_Request::getVar('listing_id', false); if ($listingSID == false) { $errors['UNDEFINED_LISTING_ID'] = 1; } else { $queryParams = ''; $userInfo = SJB_UserManager::getCurrentUserInfo(); // if logged user if (!empty($userInfo)) { $firstName = !empty($userInfo['FirstName']) ? $userInfo['FirstName'] : false; $lastName = !empty($userInfo['LastName']) ? $userInfo['LastName'] : false; $town = !empty($userInfo['City']) ? $userInfo['City'] : false; $postCode = !empty($userInfo['ZipCode']) ? $userInfo['ZipCode'] : false; $email = !empty($userInfo['email']) ? $userInfo['email'] : false; $phone = !empty($userInfo['PhoneNumber']) ? $userInfo['PhoneNumber'] : false; // Optional prefilled params for apply for JogG8 // * Title // * FirstName // * LastName // * Town // * PostCode // * HomeTelephone // * WorkTelephone // * Mobile // * Email // * ContactedPreviously if ($firstName) { $queryParams .= '&FirstName=' . urlencode($firstName); } if ($lastName) { $queryParams .= '&LastName=' . urlencode($lastName); } if ($town) { $queryParams .= '&Town=' . urlencode($town); } if ($postCode) { $queryParams .= '&PostCode=' . urlencode($postCode); } if ($phone) { $queryParams .= '&Mobile=' . urlencode($phone); } if ($email) { $queryParams .= '&Email=' . urlencode($email); } } $listing = SJB_ListingManager::getObjectBySID($listingSID); if (!$listing) { $errors['WRONG_LISTING_ID_SPECIFIED'] = 1; } else { $applicationSettings = $listing->getPropertyValue('ApplicationSettings'); $tp->assign('applicationURL', $applicationSettings['value'] . $queryParams); } } $tp->assign('errors', $errors); $tp->display("apply_now_jobg8.tpl"); }
public function execute() { $tp = SJB_System::getTemplateProcessor(); $user_group_sid = SJB_Request::getVar('sid', null); $errors = array(); if (!is_null($user_group_sid)) { $action = SJB_Request::getVar("action", false); $product_sid = SJB_Request::getVar("product_sid", false); if ($action && $product_sid !== false) { switch ($action) { case 'move_up': SJB_ProductsManager::moveUpProductBySID($product_sid, $user_group_sid); break; case 'move_down': SJB_ProductsManager::moveDownProductBySID($product_sid, $user_group_sid); break; case 'set_default_product': SJB_UserGroupManager::setDefaultProduct($user_group_sid, $product_sid); break; } } $user_group_info = SJB_UserGroupManager::getUserGroupInfoBySID($user_group_sid); $user_group_info = array_merge($user_group_info, $_REQUEST); $userGroup = new SJB_UserGroup($user_group_info); $userGroup->setSID($user_group_sid); $edit_user_group_form = new SJB_Form($userGroup); $form_is_submitted = SJB_Request::getVar('submit'); if ($form_is_submitted && $edit_user_group_form->isDataValid($errors)) { SJB_UserGroupManager::saveUserGroup($userGroup); if ($form_is_submitted == 'save_info') { SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/user-groups/'); } } $productSIDs = SJB_ProductsManager::getProductsInfoByUserGroupSID($user_group_sid); $productsInfo = array(); $user_sids_in_group = SJB_UserManager::getUserSIDsByUserGroupSID($user_group_sid); $user_group_product_user_number = array(); foreach ($productSIDs as $product) { $productsInfo[] = $product; $user_sids_in_product = SJB_UserManager::getUserSIDsByProductSID($product['sid']); $user_number = count(array_intersect($user_sids_in_group, $user_sids_in_product)); $user_group_product_user_number[$product['sid']] = $user_number; } $edit_user_group_form->registerTags($tp); $tp->assign('object_sid', $userGroup->getSID()); $tp->assign('notifications', $userGroup->getNotifications()); $tp->assign('notificationGroups', $userGroup->getNotificationsGroups()); $tp->assign('user_group_sid', $user_group_sid); $tp->assign('user_group_products_info', $productsInfo); $tp->assign('user_group_product_user_number', $user_group_product_user_number); $tp->assign('form_fields', $edit_user_group_form->getFormFieldsInfo()); } else { $errors['USER_GROUP_SID_NOT_SET'] = 1; } $tp->assign('user_group_info', isset($user_group_info) ? $user_group_info : null); $tp->assign('errors', $errors); $tp->assign('object_sid', $user_group_sid); $tp->display('edit_user_group.tpl'); }
public static function createInfoForCustomProduct($userSid, $productSid, $listingSid, $price, $name, $type) { $productName = SJB_ProductsManager::getProductNameBySid($productSid); $userGroupSid = SJB_UserManager::getUserGroupByUserSid($userSid); $productInfo = array('custom_item' => "{$name} ({$productName})", 'custom_info' => array('listing_id' => (int) $listingSid, 'type' => $type, 'extraDescription' => "({$productName})", 'productSid' => (int) $productSid), 'name' => $name, 'number_of_listings' => 1, 'QtyPeriod' => 1, 'price' => $price, 'pricing_type' => 'fixed', 'sid' => -1, 'product_type' => 'post_listings', 'user_group_sid' => $userGroupSid); $productInfo['serialized_extra_info'] = serialize($productInfo); return $productInfo; }
public static function deleteUserById($id) { SJB_DB::query('UPDATE `users` SET `parent_sid` = 0 WHERE `parent_sid` = ?n', $id); SJB_DB::query('UPDATE `listings` SET `subuser_sid` = 0 WHERE `subuser_sid` = ?n', $id); $user = SJB_UserManager::getObjectBySID($id); SJB_Statistics::addStatistics('deleteUser', $user->getUserGroupSID(), $user->getSID()); return parent::deleteObjectInfoFromDB('users', $id); }
function getPropertyVariablesToAssign() { $profile_field_as_dv = ''; if (isset($this->property_info['profile_field_as_dv']) && $this->property_info['profile_field_as_dv'] != '') { $profile_field_as_dv = SJB_UserManager::getSystemPropertyValueByObjectSID('users', SJB_UserManager::getCurrentUserSID(), $this->property_info['profile_field_as_dv']); } return array('id' => $this->property_info['id'], 'useAutocomplete' => $this->property_info['use_autocomplete'], 'type' => $this->property_info['type'], 'isClassifieds' => $this->property_info['is_classifieds'], 'value' => $this->property_info['value'], 'default_value' => $this->property_info['default_value'], 'profile_field_as_dv' => $profile_field_as_dv); }
public static function getUserSIDByUsername($raw_value) { $sid = SJB_UserManager::getUserSIDByUsername($raw_value); if (empty($sid) && !empty($raw_value)) { $sid = -1; } return $sid; }
public function execute() { $template = SJB_Request::getVar('template', 'featured_profiles.tpl'); $profiles = SJB_UserManager::getFeaturedProfiles(SJB_Request::getVar('items_count', 1)); $tp = SJB_System::getTemplateProcessor(); $tp->assign('profiles', $profiles); $tp->assign('number_of_cols', SJB_Request::getVar('number_of_cols', 1)); $tp->display($template); }
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'); } }
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'); }
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']; } }
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"); } }
public function execute() { $listing_id = SJB_Request::getVar('listing_id', null); $listing_info = SJB_ListingManager::getListingInfoBySID($listing_id); $field_id = SJB_Request::getVar('field_id', null); $current_user_sid = SJB_UserManager::getCurrentUserSID(); $owner_sid = SJB_ListingManager::getUserSIDByListingSID($listing_id); $errors = array(); $complexEmun = SJB_Request::getVar('complexEnum', null, 'GET'); $complexFieldID = SJB_Request::getVar('complexParent', null, 'GET'); if (!is_null($complexEmun) && !is_null($complexFieldID)) { $fieldArr = array(); array_push($fieldArr, $complexFieldID); array_push($fieldArr, $field_id); array_push($fieldArr, $complexEmun); $field_id = $complexFieldID . ':' . $field_id . $complexEmun . '_' . $listing_id; } else { $fieldArr = explode(':', $field_id); $complexEmun = isset($fieldArr[2]) ? explode('_', $fieldArr[2]) : false; $complexEmun = $complexEmun ? $complexEmun[0] : false; } if (is_null($listing_id) || is_null($field_id)) { $errors['PARAMETERS_MISSED'] = 1; } else { if (is_null($listing_info) || $complexEmun === false || !isset($listing_info[$fieldArr[0]][$fieldArr[1]][$complexEmun])) { $errors['WRONG_PARAMETERS_SPECIFIED'] = 1; } else { if ($owner_sid != $current_user_sid) { $errors['NOT_OWNER'] = 1; } else { $uploaded_file_id = $listing_info[$fieldArr[0]][$fieldArr[1]][$complexEmun]; SJB_UploadFileManager::deleteUploadedFileByID($uploaded_file_id); $listing_info[$field_id] = ''; $listing = new SJB_Listing($listing_info, $listing_info['listing_type_sid']); $props = $listing->getProperties(); foreach ($props as $prop) { if ($prop->getID() !== $field_id) { $listing->deleteProperty($prop->getID()); } } $listing->setSID($listing_id); SJB_ListingManager::saveListing($listing); } } } $tp = SJB_System::getTemplateProcessor(); $tp->assign('errors', $errors); $tp->assign('listing_id', $listing_id); $tp->display('delete_uploaded_file.tpl'); }
public static function writeToLog($payment, $result = false) { if (SJB_Settings::getSettingByName('notification_payment') != $payment->recipient_payment) { $username = SJB_UserManager::getUserSIDbyPayment($payment->recipient_payment); } if (!$username) { $admin = SJB_SubAdminManager::getUserSIDbyPayment($payment->recipient_payment); $admin = $admin ? $admin : 'admin'; } $status = 'Delivered'; if (!$result) { $status = 'Undelivered'; } SJB_DB::query("INSERT INTO `payment_log` (`date`, `gateway`, `message`, `status`) VALUES (NOW(), ?s, ?s, ?s, ?s, ?s, ?s)", $payment->gateway, $payment->text, $status); }
public function execute() { $tp = SJB_System::getTemplateProcessor(); $errors = array(); $activated = SJB_Request::getVar('account_activated', '') == 'yes'; if (SJB_Request::getVar('returnToShoppingCart', false)) { SJB_Session::setValue('fromAnonymousShoppingCart', 1); } if (!$activated) { if (!isset($_REQUEST['username'], $_REQUEST['activation_key'])) { $errors['PARAMETERS_MISSED'] = 1; } elseif (!($userInfo = SJB_UserManager::getUserInfoByUserName($_REQUEST['username']))) { $errors['USER_NOT_FOUND'] = 1; } elseif ($userInfo['activation_key'] != $_REQUEST['activation_key']) { $errors['INVALID_ACTIVATION_KEY'] = true; } elseif ($userInfo['approval'] == 'Rejected') { SJB_UserDBManager::deleteActivationKeyByUsername($_REQUEST['username']); SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/system/users/activate_account/?account_activated=no&approval_status=Rejected'); } else { if (SJB_UserManager::activateUserByUserName($_REQUEST['username'])) { SJB_UserDBManager::deleteActivationKeyByUsername($_REQUEST['username']); if (!SJB_Authorization::isUserLoggedIn()) { SJB_Authorization::login($_REQUEST['username'], false, false, $errors, true, true); if (!SJB_SocialPlugin::getProfileSocialID($userInfo['sid'])) { SJB_Notifications::sendUserWelcomeLetter($userInfo['sid']); } $requireApprove = SJB_UserGroupManager::isApproveByAdmin($userInfo['user_group_sid']); if ($requireApprove && !empty($userInfo['approval'])) { $approvalStatus = $userInfo['approval']; } else { $userGroupInfo = SJB_UserGroupManager::getUserGroupInfoBySID($userInfo['user_group_sid']); $pageId = !empty($userGroupInfo['after_registration_redirect_to']) ? $userGroupInfo['after_registration_redirect_to'] : ''; $redirectUrl = SJB_UserGroupManager::getRedirectUrlByPageID($pageId); SJB_HelperFunctions::redirect($redirectUrl . 'account_activated=yes'); } } $activated = 1; } else { $errors['CANNOT_ACTIVATE'] = TRUE; } } } $tp->assign('activated', $activated); $tp->assign('errors', $errors); $tp->assign('approvalStatus', !empty($approvalStatus) ? $approvalStatus : SJB_Request::getVar('approval_status', '')); $tp->assign('isLoggedIn', SJB_Authorization::isUserLoggedIn()); $tp->display('activate_account.tpl'); }