public function execute() { $uri = parse_url($_SERVER['REQUEST_URI']); if (!preg_match("/\\/\$/", $uri['path'])) { $uri = parse_url($_SERVER['REQUEST_URI']); $query = isset($uri['query']) ? '?' . $uri['query'] : ''; SJB_HelperFunctions::redirect($uri['path'] . '/' . $query); } else { $uri = SJB_Request::getVar('browseUrl', $this->getUri()); } $listingTypeId = SJB_Request::getVar('listing_type_id', ''); $browseManager = SJB_ObjectMother::createBrowseManager($listingTypeId, $this->parameters); $browseItems = array(); if ($browseManager->canBrowse()) { if (SJB_Settings::getValue('enableBrowseByCounter')) { $browseItems = $browseManager->getItemsFromDB($uri, true); } else { $browseItems = $browseManager->getItems($this->parameters, true); } } $tp = $this->getTemplateProcessor($browseManager, $listingTypeId); $tp->assign('browseItems', $browseItems); $tp->assign('recordsNumToDisplay', SJB_Request::getVar('recordsNumToDisplay', 20)); $tp->assign('user_page_uri', $uri); $tp->assign('sitePageUri', SJB_HelperFunctions::getSiteUrl() . $this->getUri()); $tp->assign('browse_level', $browseManager->getLevel() + 1); $tp->assign('browse_navigation_elements', $browseManager->getNavigationElements($uri)); $tp->display(SJB_Request::getVar('browse_template', 'browse_items_and_results.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 function execute() { $listing_field = new SJB_ListingField($_REQUEST); /** * add infilll instructions field */ //$listing_field->addInfillInstructions(SJB_Request::getVar('instructions')); $template_processor = SJB_System::getTemplateProcessor(); $add_listing_field_form = new SJB_Form($listing_field); $add_listing_field_form->registerTags($template_processor); $form_is_submitted = isset($_REQUEST['action']) && $_REQUEST['action'] == 'add'; $errors = null; $pages = SJB_PostingPagesManager::getFirstPageEachListingType(); if ($form_is_submitted && $add_listing_field_form->isDataValid($errors)) { $pages = SJB_PostingPagesManager::getFirstPageEachListingType(); SJB_ListingFieldManager::saveListingField($listing_field, $pages); $listing_sid = $listing_field->getSID(); SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . "/attention-listing-type-field/?listing_sid={$listing_sid}"); } else { $pagesNum = SJB_PostingPagesManager::getNumAllPages(); $pageCount = 0; foreach ($pagesNum as $val) { if ($val['num'] > 1) { $pageCount = 1; } } $template_processor->assign("pageCount", $pageCount); $template_processor->assign("errors", $errors); $add_listing_field_form->registerTags($template_processor); $template_processor->assign("form_fields", $add_listing_field_form->getFormFieldsInfo()); $template_processor->display("add_listing_field.tpl"); } }
public function execute() { $user_group = new SJB_UserGroup($_REQUEST); $add_user_group_form = new SJB_Form($user_group); $form_is_submitted = isset($_REQUEST['action']) && $_REQUEST['action'] == 'add'; $errors = null; $tp = SJB_System::getTemplateProcessor(); if ($form_is_submitted && $add_user_group_form->isDataValid($errors)) { SJB_UserGroupManager::saveUserGroup($user_group); $page = array('uri' => '/' . mb_strtolower($user_group->getPropertyValue('id'), 'UTF-8') . '-products/', 'module' => 'payment', 'function' => 'user_products', 'access_type' => 'user', 'parameters' => 'userGroupID=' . $user_group->getID()); $userPage = new SJB_UserPage(); $page_data = SJB_UserPage::extractPageData($page); $userPage->setPageData($page_data); $userPage->save(); $this->addLocationField($user_group->getSID()); SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . "/user-groups/"); } else { $add_user_group_form->registerTags($tp); $tp->assign('notifications', $user_group->getNotifications()); $tp->assign('notificationGroups', $user_group->getNotificationsGroups()); $tp->assign('form_fields', $add_user_group_form->getFormFieldsInfo()); $tp->assign('errors', $errors); $tp->display('add_user_group.tpl'); } }
public function execute() { $tp = SJB_System::getTemplateProcessor(); $action = SJB_Request::getVar('action'); $api = SJB_Request::getVar('api', false); $request = $_REQUEST; unset($request['action']); switch ($action) { case 'header': $test = $tp->fetch("header.tpl"); echo $test; exit; break; case 'simplyHired': SJB_Statistics::addStatistics('partneringSites'); break; default: $isIPhone = false; if (class_exists('MobilePlugin')) { $isIPhone = MobilePlugin::isPhone(); } $url = SJB_Request::getVar('url'); $url = $url ? base64_decode($url) : ''; if (str_replace('www.', '', $_SERVER['HTTP_HOST']) === SJB_Settings::getValue('mobile_url') || SJB_Settings::getValue('detect_iphone') && $isIPhone) { $url = str_replace('viewjob', 'm/viewjob', $url); } SJB_Statistics::addStatistics('partneringSites'); if ($api && $api == 'indeed') { SJB_HelperFunctions::redirect($url); } $tp->assign('url', $url); $tp->display("partnersite.tpl"); break; } }
public function execute() { $template_processor = SJB_System::getTemplateProcessor(); $errors = array(); $UserProfileFieldListItemManager = new SJB_UserProfileFieldListItemManager(); if (!isset($_REQUEST['field_sid'], $_REQUEST['item_sid'])) { echo 'The system cannot proceed as some key paramaters are missed'; } else { if (is_null($list_item = $UserProfileFieldListItemManager->getListItemBySID($_REQUEST['item_sid']))) { echo 'Wrong parameters are specified'; } else { $list_item_info['value'] = $list_item->getValue(); $template_processor->assign("list_item_info", $list_item_info); if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'save') { $list_item->setValue($_REQUEST['list_item_value']); if (empty($_REQUEST['list_item_value'])) { $errors = array('Value' => 'EMPTY_VALUE'); } else { $UserProfileFieldListItemManager->saveListItem($list_item); SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . "/edit-user-profile-field/edit-list/?field_sid=" . $_REQUEST['field_sid']); } } $user_profile_field = SJB_UserProfileFieldManager::getFieldBySID($_REQUEST['field_sid']); $user_profile_field_info = SJB_UserProfileFieldManager::getFieldInfoBySID($_REQUEST['field_sid']); $template_processor->assign("user_profile_field_info", $user_profile_field_info); $template_processor->assign("user_group_sid", $user_profile_field->getUserGroupSID()); $template_processor->assign("user_profile_field_sid", $_REQUEST['field_sid']); $template_processor->assign("item_sid", $_REQUEST['item_sid']); $template_processor->assign("list_item_value", htmlspecialchars($list_item->getValue())); $template_processor->assign("errors", $errors); $template_processor->assign("user_group_info", SJB_UserGroupManager::getUserGroupInfoBySID($user_profile_field->getUserGroupSID())); $template_processor->display("user_profile_list_item_editing.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() { if (isset($_REQUEST['passed_parameters_via_uri'])) { $passed_parameters_via_uri = SJB_UrlParamProvider::getParams(); $etSID = SJB_Array::get($passed_parameters_via_uri, 0); } $field_id = SJB_Request::getVar('field_id', null); $etInfo = SJB_EmailTemplateEditor::getEmailTemplateInfoBySID($etSID); if (is_null($etSID) || is_null($field_id)) { $errors['PARAMETERS_MISSED'] = 1; } elseif (is_null($etInfo) || !isset($etInfo[$field_id])) { $errors['WRONG_PARAMETERS_SPECIFIED'] = 1; } else { $uploaded_file_id = $etInfo[$field_id]; SJB_UploadFileManager::deleteUploadedFileByID($uploaded_file_id); $etInfo[$field_id] = ''; $emailTemplate = new SJB_EmailTemplate($etInfo); $emailTemplate->setSID($etSID); SJB_EmailTemplateEditor::saveEmailTemplate($emailTemplate); SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/edit-email-templates/' . $emailTemplate->getPropertyValue('group') . '/' . $etSID); } $tp = SJB_System::getTemplateProcessor(); $tp->assign('errors', isset($errors) ? $errors : null); $tp->display('delete_uploaded_file.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 init() { $this->cleanSessionData(self::$network); $error = SJB_Request::getVar('error', false); if ($error && $error == 'access_denied') { SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL')); } if (isset($_GET['code'])) { $this->initialize(); $googlePlusService = new Google_PlusService(self::$object); $oauth2 = new Google_Oauth2Service(self::$object); self::$object->authenticate($_GET['code']); $_SESSION['access_token'] = self::$object->getAccessToken(); if (!empty($_SESSION['access_token'])) { self::$oProfile = self::getProfileInformation($googlePlusService, $oauth2); if (self::$oProfile) { $this->flagSocialPluginInSession(self::$network); self::$oSocialPlugin = $this; $this->redirectToRegistrationSocialPage(); } } } if (is_null(self::$object) && empty($_SESSION['sn']['authorized'])) { $this->initialize(); $authUrl = self::$object->createAuthUrl(); SJB_HelperFunctions::redirect($authUrl); } elseif (self::$oProfile && !parent::ifUserIsRegistered(self::$network)) { $this->redirectToRegistrationSocialPage(); } }
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() { $user_group_sid = isset($_REQUEST['user_group_sid']) ? $_REQUEST['user_group_sid'] : null; $user_group_info = SJB_UserGroupManager::getUserGroupInfoBySID($user_group_sid); $user_profile_field = new SJB_UserProfileField($_REQUEST); $user_profile_field->setUserGroupSID($user_group_sid); //infill instructions field //$user_profile_field->addInfillInstructions(SJB_Request::getVar('instructions')); $add_user_profile_field_form = new SJB_Form($user_profile_field); $form_is_submitted = isset($_REQUEST['action']) && $_REQUEST['action'] == 'add'; $errors = null; if ($form_is_submitted && $add_user_profile_field_form->isDataValid($errors)) { SJB_UserProfileFieldManager::saveUserProfileField($user_profile_field); if (SJB_Request::getVar('type', '') == 'youtube') { SJB_HelperFunctions::redirect(SJB_System::getSystemSettings("SITE_URL") . "/instruction_user_profile_field/?user_group_sid=" . $user_group_sid . "&user_field_sid=" . $user_profile_field->sid); } else { SJB_HelperFunctions::redirect(SJB_System::getSystemSettings("SITE_URL") . "/edit-user-profile/?user_group_sid=" . $user_group_sid); } } else { $template_processor = SJB_System::getTemplateProcessor(); $add_user_profile_field_form->registerTags($template_processor); $template_processor->assign("form_fields", $add_user_profile_field_form->getFormFieldsInfo()); $template_processor->assign("user_group_sid", $user_group_sid); $template_processor->assign("errors", $errors); $template_processor->assign("user_group_info", $user_group_info); $template_processor->display("add_user_profile_field.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 function execute() { $id = SJB_Request::getVar('id', false); if ($id) { SJB_DB::query("DELETE FROM `parsers` WHERE id = ?n", $id); } SJB_HelperFunctions::redirect(SJB_System::getSystemSettings("SITE_URL") . "/show-import/"); }
public function execute() { $tp = SJB_System::getTemplateProcessor(); $subAdminSID = SJB_Request::getVar('subadmin', 0); if (!empty($subAdminSID) && ($adminInfo = SJB_SubAdminManager::getSubAdminInfoBySID($subAdminSID))) { $editedSubAdminInfo = $_REQUEST; $subAdminInfo = array_merge($adminInfo, $editedSubAdminInfo); // create subAdmin object $oSubAdmin = SJB_ObjectMother::createSubAdmin($subAdminInfo); $oSubAdmin->setSID($adminInfo['sid']); $oSubAdmin->makePropertyNotRequired("password"); // permissions $acl = SJB_SubAdminAcl::getInstance(); $type = 'subadmin'; $resources = $acl->getResources(); $perms = SJB_SubAdminAcl::getAllPermissions($type, $oSubAdmin->getSID()); // /permissions SJB_SubAdminAcl::mergePermissionsWithResources($resources, $perms); $registration_form = SJB_ObjectMother::createForm($oSubAdmin); $action = SJB_Request::getVar('action', ''); $registration_form->registerTags($tp); $errors = array(); if ('save' == $action || $action == 'apply') { if ($adminInfo['username'] == $subAdminInfo['username']) { $oSubAdmin->deleteProperty('username'); } if ($adminInfo['email'] == $subAdminInfo['email']) { $oSubAdmin->deleteProperty('email'); } if ($registration_form->isDataValid($errors)) { $password_value = $oSubAdmin->getPropertyValue('password'); if (empty($password_value['original'])) { $oSubAdmin->deleteProperty('password'); } // save subAdmin SJB_SubAdminManager::saveSubAdmin($oSubAdmin); $role = $oSubAdmin->getSID(); SJB_Acl::clearPermissions($type, $role); foreach ($resources as $name => $resource) { SJB_SubAdminAcl::allow($name, $type, $role, SJB_SubAdminAcl::definePermission($name), SJB_Array::get($resource, 'params', '')); } SJB_FlashMessages::getInstance()->addMessage('CHANGES_SAVED'); if ($action == 'save') { SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . "/manage-subadmins/"); } } SJB_SubAdminAcl::mergePermissionsWithRequest($resources); } SJB_SubAdminAcl::prepareSubPermissions($resources); $tp->assign("errors", $errors); $tp->assign("form_fields", $registration_form->getFormFieldsInfo()); $tp->assign('groups', SJB_SubAdminAcl::getPermissionGroups()); $tp->assign('resources', $resources); $tp->assign('type', $type); $tp->assign('sid', $subAdminInfo['sid']); $tp->display('add_subadmin.tpl'); } }
public function execute() { $breadcrumbs = new SJB_Breadcrumbs(); $errors = array(); if (isset($_REQUEST['action'])) { // проверим, задали element_id или нет if (!isset($_REQUEST['element_id'])) { // задаем текст ошибки и сбрасываем 'action', чтобы ничего не выполнялось $errors[] = "NOT_ID"; $_REQUEST['action'] = ''; } else { $element_id = $_REQUEST['element_id']; } switch ($_REQUEST['action']) { case 'add': // если была отправка формы добавления элемента if (isset($_REQUEST['addElement']) && $_REQUEST['addElement'] != '') { $item_name = $_REQUEST['item_name']; $item_uri = $_REQUEST['item_uri']; $breadcrumbs->addElement($item_name, $item_uri, $element_id); $site_url = SJB_System::getSystemSettings("SITE_URL"); SJB_HelperFunctions::redirect($site_url . "/manage-breadcrumbs/"); } $parentElement = $breadcrumbs->getElement($element_id); $tp = SJB_System::getTemplateProcessor(); $tp->assign("parentElement", $parentElement); $tp->display("add_item.tpl"); break; case 'edit': // если была отправка формы редактирования элемента if (isset($_REQUEST['updateElement']) && $_REQUEST['updateElement'] != '') { $item_name = $_REQUEST['item_name']; $item_uri = $_REQUEST['item_uri']; $breadcrumbs->updateElement($item_name, $item_uri, $element_id); $site_url = SJB_System::getSystemSettings("SITE_URL"); SJB_HelperFunctions::redirect($site_url . "/manage-breadcrumbs/"); } $editElement = $breadcrumbs->getElement($element_id); $tp = SJB_System::getTemplateProcessor(); $tp->assign("editElement", $editElement); $tp->display("edit_item.tpl"); break; case 'delete': $breadcrumbs->deleteElement($element_id); $site_url = SJB_System::getSystemSettings("SITE_URL"); SJB_HelperFunctions::redirect($site_url . "/manage-breadcrumbs/"); break; default: break; } } $navStructure = $breadcrumbs->makeStructure(); $tp = SJB_System::getTemplateProcessor(); $tp->assign('ERRORS', $errors); $tp->assign("navStructure", $navStructure); $tp->display("manage_breadcrumbs.tpl"); }
public function execute() { $templateProcessor = SJB_System::getTemplateProcessor(); $errors = array(); $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null; $gateway_id = isset($_REQUEST['gateway']) ? $_REQUEST['gateway'] : null; $formSubmitted = SJB_Request::getVar('submit'); $gateway_sid = SJB_PaymentGatewayManager::getSIDByID($gateway_id); if ($_SERVER['REQUEST_METHOD'] == 'GET' && !empty($action)) { if ($action == 'deactivate') { SJB_PaymentGatewayManager::deactivateByID($gateway_id); } elseif ($action == 'activate') { SJB_PaymentGatewayManager::activateByID($gateway_id); } } if ($_SERVER['REQUEST_METHOD'] == 'POST') { $gateway = SJB_PaymentGatewayManager::createObjectByID($gateway_id, $_REQUEST); $gateway->dontSaveProperty('id'); $gateway->dontSaveProperty('caption'); $gateway->setSID($gateway_sid); if ($gateway->isValid()) { if (SJB_PaymentGatewayManager::saveGateway($gateway) !== false) { $templateProcessor->assign('gatewaySaved', true); if ($formSubmitted == 'save_gateway') { $siteUrl = SJB_System::getSystemsettings('SITE_URL') . '/system/payment/gateways/?gatewaySaved=1'; SJB_HelperFunctions::redirect($siteUrl); } } else { $errors['SETTINGS_SAVED_WITH_PROBLEMS'] = 1; } } else { $errors = $gateway->getErrors(); } } $gateway = SJB_PaymentGatewayManager::getObjectByID($gateway_id); $gateway_form = new SJB_Form($gateway); $gateway_form->registerTags($templateProcessor); $gateway_form->makeDisabled('id'); $gateway_form->makeDisabled('caption'); $countryCode = $gateway->getPropertyValue('country'); if (empty($countryCode)) { $countryValue = SJB_CountriesManager::getCountrySIDByCountryCode('US'); $gateway->setPropertyValue('country', $countryValue); } if (empty($gateway)) { $errors['GATEWAY_NOT_FOUND'] = 1; $templateProcessor->assign('errors', $errors); $templateProcessor->display('configure_gateway.tpl'); return; } $gateway_info = SJB_PaymentGatewayManager::getInfoBySID($gateway_sid); $form_fields = $gateway_form->getFormFieldsInfo(); $templateProcessor->assign('gateway', $gateway_info); $templateProcessor->assign('form_fields', $form_fields); $templateProcessor->assign('errors', $errors); $templateProcessor->display('configure_gateway.tpl'); }
public function execute() { $template_processor = SJB_System::getTemplateProcessor(); $listingTypeSID = isset($_REQUEST['sid']) ? $_REQUEST['sid'] : null; if (!is_null($listingTypeSID)) { $form_submitted = SJB_Request::getVar('action', ''); $listing_type_info = SJB_ListingTypeManager::getListingTypeInfoBySID($listingTypeSID); $approveSettingChanged = $listing_type_info['waitApprove'] != SJB_Request::getVar('waitApprove'); $listing_type_info = array_merge($listing_type_info, $_REQUEST); $listingType = new SJB_ListingType($listing_type_info); $listingType->setSID($listingTypeSID); $edit_form = new SJB_Form($listingType); $listingTypeEmailAlert = $listingType->getPropertyValue('email_alert'); if (empty($listingTypeEmailAlert)) { $listingType->setPropertyValue('email_alert', 0); } $listingTypeEmailAlertForGuests = $listingType->getPropertyValue('guest_alert_email'); if (empty($listingTypeEmailAlertForGuests)) { $listingType->setPropertyValue('guest_alert_email', 0); } $errors = array(); if ($form_submitted && $edit_form->isDataValid($errors)) { SJB_Breadcrumbs::updateBreadcrumbsByListingTypeSID($listingTypeSID, $listingType->getPropertyValue('name')); SJB_PageManager::updatePagesByListingTypeSID($listingTypeSID, $listingType->getPropertyValue('name')); SJB_ListingTypeManager::saveListingType($listingType); if ($approveSettingChanged) { SJB_BrowseDBManager::rebuildBrowses(); } if ($form_submitted == 'save_info') { SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/listing-types/'); } } $template_processor->assign('errors', $errors); $template_processor->assign('listing_type_sid', $listingTypeSID); $listing_fields_info = SJB_ListingFieldManager::getListingFieldsInfoByListingType($listingTypeSID); $listing_fields = array(); $listing_field_sids = array(); foreach ($listing_fields_info as $listing_field_info) { if ($listing_field_info['type'] == 'logo') { continue; } $listing_field = new SJB_ListingField($listing_field_info); $listing_field->setSID($listing_field_info['sid']); $listing_fields[] = $listing_field; $listing_field_sids[] = $listing_field_info['sid']; } $edit_form->registerTags($template_processor); $template_processor->assign("listing_type_info", $listing_type_info); $template_processor->assign("form_fields", $edit_form->getFormFieldsInfo()); $template_processor->display("edit_listing_type.tpl"); $form_collection = new SJB_FormCollection($listing_fields); $form_collection->registerTags($template_processor); $template_processor->assign("listing_field_sids", $listing_field_sids); $template_processor->display("listing_type_fields.tpl"); } }
public function execute() { $tp = SJB_System::getTemplateProcessor(); $productType = SJB_Request::getVar('product_type', false); $action = SJB_Request::getVar('action', false); $errors = array(); $productErrors = array(); if ($productType) { if ($productType == 'featured_user') { $_REQUEST['user_group_sid'] = SJB_UserGroupManager::getUserGroupSIDByID('Employer'); } $product = new SJB_Product($_REQUEST, $productType); $pages = $product->getProductPages(); $addProductForm = new SJB_Form($product); $addProductForm->registerTags($tp); $form_submitted = SJB_Request::getVar('action', '') == 'save'; if ($form_submitted) { $productErrors = $product->isValid($product); if (in_array($productType, array('access_listings', 'featured_user', 'banners', 'custom_product'))) { $periodName = $product->getPropertyValue('period_name'); if ($periodName == 'unlimited') { $product->makePropertyNotRequired('period'); } } } if ($form_submitted && $addProductForm->isDataValid($errors) && !$productErrors) { $product->addProperty(array('id' => 'product_type', 'type' => 'string', 'value' => $productType, 'is_system' => true)); $product->saveProduct($product, $_REQUEST); $product->savePermissions($_REQUEST); SJB_HelperFunctions::redirect(SJB_System::getSystemSettings("SITE_URL") . '/products/'); } $errors = array_merge($errors, $productErrors); $formFieldsInfo = $addProductForm->getFormFieldsInfo(); $formFields = array(); foreach ($pages as $pageID => $page) { foreach ($formFieldsInfo as $formFieldInfo) { if (in_array($formFieldInfo['id'], $page['fields'])) { $formFields[$pageID][] = $formFieldInfo; } } if (!isset($formFields[$pageID])) { $formFields[$pageID] = array(); } } $tp->assign('form_fields', $formFields); $tp->assign('product_type', $productType); $tp->assign('request', $_REQUEST); $tp->assign('params', http_build_query($_REQUEST)); $tp->assign('pages', $pages); $tp->assign('pageTab', SJB_Request::getVar('page', false)); $tp->assign("errors", $errors); $tp->display('add_product.tpl'); } else { $tp->display('select_product_type.tpl'); } }
public function execute() { $listingTypeSID = SJB_Request::getVar('sid', null); if (!is_null($listingTypeSID)) { SJB_Breadcrumbs::deleteBreadcrumbsByListingTypeSID($listingTypeSID); SJB_ListingTypeManager::deleteListingTypeBySID($listingTypeSID); SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . "/listing-types/"); } echo 'The system cannot proceed as Listing Type SID is not set'; }
public function execute() { $user_group_sid = SJB_Request::getVar('sid', null); if (!is_null($user_group_sid)) { SJB_UserGroupManager::deleteUserGroupBySID($user_group_sid); SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . "/user-groups/"); } else { echo 'The system cannot proceed as User Group SID is not set'; } }
public function execute() { $listing_field_sid = SJB_Request::getVar('sid', null); if (!is_null($listing_field_sid)) { $listing_field_info = SJB_ListingFieldManager::getFieldInfoBySID($listing_field_sid); SJB_ListingFieldManager::deleteListingFieldBySID($listing_field_sid); SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . "/edit-listing-type/?sid=" . $listing_field_info['listing_type_sid']); } echo 'The system cannot proceed as Listing Field SID is not set'; }
public static function editCaptcha($info) { $captchaType = !empty($info['type']) ? $info['type'] : ''; $info['template'] = '../../../system/plugins/captcha/edit_captcha.tpl'; $event = !empty($info['event']) ? $info['event'] : false; $settings = array(); $errors = array(); switch ($captchaType) { case 'reCaptcha': if ($event == 'save' && !empty($info['settings'])) { foreach ($info['settings'] as $setting => $val) { if ($val == '') { $errors[$setting] = 'empty'; } } if (!$errors) { SJB_Settings::updateSettings($info['settings']); if (SJB_Request::getVar('submit') == 'save') { SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/system/miscellaneous/plugins/?action=settings&plugin=CaptchaPlugin'); } } } $settings = array(array('id' => 'reCaptchaPubkey', 'caption' => 'Public Key', 'type' => 'string', 'length' => '50', 'order' => null, 'comment' => 'To get these Keys go to http://google.com/recaptcha/admin/create,<br/> register/sign in and then create a reCAPTCHA key following the given instructions.'), array('id' => 'reCaptchaPrivkey', 'caption' => 'Private Key', 'type' => 'string', 'length' => '50', 'order' => null, 'comment' => 'To get these Keys go to http://google.com/recaptcha/admin/create,<br/> register/sign in and then create a reCAPTCHA key following the given instructions.'), array('id' => 'reCaptchaTheme', 'caption' => 'Theme', 'type' => 'list', 'list_values' => array(array('id' => 'red', 'caption' => 'red'), array('id' => 'white', 'caption' => 'white'), array('id' => 'blackglass', 'caption' => 'blackglass'), array('id' => 'clean', 'caption' => 'clean')), 'length' => '50', 'order' => null)); break; case 'customCaptcha': if ($event == 'save' && !empty($info['settings'])) { foreach ($info['settings'] as $setting => $val) { if ($val == '') { $errors[$setting] = 'empty'; } } if (!$errors) { SJB_Settings::updateSettings($info['settings']); if (SJB_Request::getVar('submit') == 'save') { SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/system/miscellaneous/plugins/?action=settings&plugin=CaptchaPlugin'); } } } $fontsDir = dir(SJB_BASE_DIR . "system/plugins/captcha/fonts"); $fonts = array(); $i = 0; while (false !== ($entry = $fontsDir->read())) { if (strstr($entry, '.ttf') || strstr($entry, '.TTF')) { $fonts[$i]['id'] = $fonts[$i]['caption'] = str_replace('.TTF', '', str_replace('.ttf', '', $entry)); $i++; } } $settings = array(array('id' => 'custCaptchaFont', 'caption' => 'Font', 'type' => 'list', 'length' => '50', 'list_values' => $fonts, 'order' => null), array('id' => 'custCaptchaFontSize', 'caption' => 'Font Size', 'type' => 'integer', 'length' => '50', 'comment' => 'Allow you to specify the font size in pixels for generating the CAPTCHA. The default is 24px.', 'order' => null), array('id' => 'custCaptchaHeight', 'caption' => 'Height', 'type' => 'integer', 'length' => '50', 'order' => null), array('id' => 'custCaptchaWidth', 'caption' => 'Width', 'type' => 'integer', 'length' => '50', 'order' => null), array('id' => 'custCaptchaWordlen', 'caption' => 'Word Length', 'type' => 'integer', 'comment' => 'Allow you to specify the length of the generated "word" in characters.', 'length' => '50', 'order' => null), array('id' => 'custDotNoiseLevel', 'caption' => 'Dot Noise Level', 'type' => 'integer', 'length' => '50', 'order' => null), array('id' => 'custLineNoiseLevel', 'caption' => 'Line Noise Level', 'type' => 'integer', 'length' => '50', 'order' => null)); break; } $info['fieldErrors'] = $errors; $info['savedSettings'] = SJB_Settings::getSettings(); $info['settings'] = $settings; return $info; }
public function execute() { $templateProcessor = SJB_System::getTemplateProcessor(); $listingSid = isset($_REQUEST['listing_id']) ? $_REQUEST['listing_id'] : null; $listing = SJB_ListingManager::getObjectBySID($listingSid); if (!is_null($listing) && !$listing->isActive()) { $listingInfo = SJB_ListingManager::getListingInfoBySID($listingSid); $productInfo = !empty($listingInfo['product_info']) ? unserialize($listingInfo['product_info']) : array(); if (isset($listingInfo['complete']) && $listingInfo['complete'] == 1 && $listingInfo['checkouted'] == 1) { $subTotalPrice = 0; // проверить истек ли листинг, если истек , прайс прировнять к renewal_price if (SJB_ListingManager::getIfListingHasExpiredBySID($listing->getID()) && isset($productInfo['renewal_price'])) { $subTotalPrice = $productInfo['renewal_price']; } $userSid = $listing->getUserSID(); $productSid = $productInfo['product_sid']; $listingTitle = $listing->getProperty('Title')->getValue(); $listingTypeSid = $listing->getListingTypeSID(); $listingTypeId = SJB_ListingTypeManager::getListingTypeIDBySID($listingTypeSid); $newProductName = "Reactivation of \"{$listingTitle}\" {$listingTypeId}"; $newProductInfo = SJB_ShoppingCart::createInfoForCustomProduct($userSid, $productSid, $listingSid, $subTotalPrice, $newProductName, 'activateListing'); if ($subTotalPrice <= 0) { if (SJB_ListingManager::activateListingBySID($listing->getSID())) { SJB_Notifications::sendUserListingActivatedLetter($listing, $listing->getUserSID()); } } else { SJB_ShoppingCart::createCustomProduct($newProductInfo, $userSid); $shoppingUrl = SJB_System::getSystemSettings('SITE_URL') . '/shopping-cart/'; SJB_HelperFunctions::redirect($shoppingUrl); } $templateProcessor->assign('listingTypeID', SJB_ListingTypeManager::getListingTypeIDBySID($listingTypeSid)); } elseif ($listingInfo['checkouted'] == 0) { $productsInfoFromShopppingCart = SJB_ShoppingCart::getProductsInfoFromCartByProductSID($productInfo['product_sid'], $listing->getUserSID()); if (empty($productsInfoFromShopppingCart)) { $productInfoToShopCart = SJB_ProductsManager::getProductInfoBySID($productInfo['product_sid']); $productInfo['number_of_listings'] = 1; $productObj = new SJB_Product($productInfoToShopCart, $productInfoToShopCart['product_type']); $productObj->setNumberOfListings($productInfoToShopCart['number_of_listings']); $productInfoToShopCart['price'] = $productObj->getPrice(); SJB_ShoppingCart::addToShoppingCart($productInfoToShopCart, $listing->getUserSID()); } SJB_HelperFunctions::redirect(SJB_System::getSystemsettings('SITE_URL') . '/shopping-cart/'); } else { $errors['LISTING_IS_NOT_COMPLETE'] = 1; } } elseif (is_null($listingSid)) { $errors['INVALID_LISTING_ID'] = 1; } elseif (!is_null($listing) && $listing->isActive()) { $errors['LISTING_ALREADY_ACTIVE'] = 1; } else { $errors['WRONG_LISTING_ID_SPECIFIED'] = 1; } $templateProcessor->assign("errors", isset($errors) ? $errors : null); $templateProcessor->display("pay_for_listing.tpl"); }
public function execute() { $tp = SJB_System::getTemplateProcessor(); $listingTypeSID = SJB_Request::getVar('listing_type'); if (!empty($listingTypeSID)) { SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . "/flagged-listings/?listing_type_sid=" . $listingTypeSID); } $allListingTypes = SJB_ListingTypeManager::getAllListingTypesInfo(); $tp->assign('listing_types', $allListingTypes); $tp->display('select_flagged_listing_type.tpl'); }
public function execute() { $tp = SJB_System::getTemplateProcessor(); $template_editor = new SJB_TemplateEditor(); $setNewTheme = SJB_Request::getVar('theme', false); $theme = SJB_Request::getVar('theme', SJB_Settings::getValue('TEMPLATE_USER_THEME', 'default')); if ($setNewTheme) { if (SJB_System::getSystemSettings("isDemo")) { $tp->assign('ERROR', 'ACCESS_DENIED'); } else { SJB_Settings::setValue('TEMPLATE_USER_THEME', $theme); SJB_Settings::setValue('CURRENT_THEME', $theme); } } if (!$template_editor->doesThemeExists(SJB_Settings::getValue('TEMPLATE_USER_THEME', 'default'))) { SJB_Settings::setValue('CURRENT_THEME', 'default'); SJB_Settings::setValue('TEMPLATE_USER_THEME', 'default'); $theme = 'default'; } else { if ($setNewTheme && !SJB_System::getSystemSettings("isDemo")) { SJB_HelperFunctions::redirect(SJB_System::getSystemSettings("SITE_URL") . '/edit-themes/'); } } $tp->assign('theme_list', $template_editor->getThemeList()); $tp->assign('theme', $theme); if (isset($_REQUEST['action'])) { if (SJB_System::getSystemSettings("isDemo")) { $tp->assign('ERROR', 'ACCESS_DENIED'); } else { switch (SJB_Request::getVar("action")) { case "copy_theme": if (isset($_REQUEST['copy_from_theme'], $_REQUEST['new_theme']) && $template_editor->doesThemeExists($_REQUEST['copy_from_theme']) && !$template_editor->doesThemeExists($_REQUEST['new_theme']) && !empty($_REQUEST['new_theme'])) { $template_editor->copyEntireTheme($_REQUEST['copy_from_theme'], $_REQUEST['new_theme']); SJB_HelperFunctions::redirect("?theme=" . $_REQUEST['new_theme']); } else { if ($template_editor->doesThemeExists(SJB_Request::getVar('new_theme', ''))) { $tp->assign('ERROR', 'ALREADY_EXISTS'); } if (empty($_REQUEST['new_theme'])) { $tp->assign('ERROR', 'EMPTY_NAME'); } } break; case "delete_theme": if (isset($_REQUEST['theme_name']) && $template_editor->doesThemeExists($_REQUEST['theme_name'])) { $template_editor->deleteEntireTheme($_REQUEST['theme_name']); SJB_HelperFunctions::redirect(SJB_System::getSystemSettings("SITE_URL") . '/edit-themes/'); } break; } } } $tp->display('theme_editor.tpl'); }
public function execute() { $request_uri = $_SERVER['REQUEST_URI']; $template_processor = SJB_System::getTemplateProcessor(); $callback_page_uri = ''; preg_match('#.*/system/payment/callback/([^/?]+)#', $request_uri, $mm); if (!empty($mm)) { $gateway_id = $mm[1]; $redirectPage = $callback_page_uri . $gateway_id . "/"; preg_match("(.*{$redirectPage}([^/]*)/?)", $request_uri, $invoice_sid); $invoice_sid = !empty($invoice_sid[1]) ? $invoice_sid[1] : ''; $redirectPage = $callback_page_uri . $gateway_id . "/" . $invoice_sid; preg_match("(.*{$redirectPage}([^/]*)/?)", $request_uri, $tt); $redirectPage = !empty($tt[1]) ? $tt[1] : ''; $invoice = SJB_InvoiceManager::getObjectBySID($invoice_sid); if (!empty($invoice) && $invoice->getStatus() == SJB_Invoice::INVOICE_STATUS_PAID) { SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . "/payment-completed/"); } $gateway = SJB_PaymentGatewayManager::getObjectByID($gateway_id); $gateway_caption = $gateway->getPropertyValue('caption'); $invoice = $gateway->getPaymentFromCallbackData($_REQUEST); SJB_PaymentLogManager::recordPaymentLog($gateway->getPaymentStatusFromCallbackData($_REQUEST), $gateway_caption, $_REQUEST); if (is_null($invoice)) { $errors = $gateway->getErrors(); $template_processor->assign('errors', $errors); $template_processor->display('callback_payment_page.tpl'); } else { $status = $invoice->getStatus(); if ($status == SJB_Invoice::INVOICE_STATUS_VERIFIED) { SJB_Statistics::addStatisticsFromInvoice($invoice); $success_url = $invoice->getSuccessPageURL(); $page = empty($redirectPage) ? '' : '&' . $redirectPage; SJB_HelperFunctions::redirect($success_url . '?invoice_sid=' . $invoice->getSID() . $page); } elseif ($status == SJB_Invoice::INVOICE_STATUS_PENDING) { $template_processor->assign('message', 'INVOICE_WAITING'); $template_processor->display('callback_payment_page.tpl'); } else { SJB_InvoiceManager::markUnPaidInvoiceBySID($invoice_sid); $payment_error = 1; if ($gateway_id == 'paypal_pro') { $httpPostResponse = SJB_Request::getVar('http_post_response', false); if (!empty($httpPostResponse['L_SHORTMESSAGE0']) && urldecode($httpPostResponse['L_SHORTMESSAGE0']) == 'Authentication/Authorization Failed') { $payment_error = 2; } } SJB_HelperFunctions::redirect(SJB_System::getSystemSettings("SITE_URL") . "/view-invoice/?sid=" . $invoice_sid . "&payment_error=" . $payment_error . "&payment_gateway=" . $gateway_id); } } } else { $errors['INVOICE_ID_IS_NOT_SET'] = 1; $template_processor->assign('errors', $errors); $template_processor->display('callback_payment_page.tpl'); } }
public function execute() { $listing_field_sid = SJB_Request::getVar('sid', null); if (!is_null($listing_field_sid)) { $listingFieldID = SJB_ListingFieldManager::getListingFieldIDBySID($listing_field_sid); if ($listingFieldID != 'Location') { SJB_ListingFieldManager::deleteListingFieldBySID($listing_field_sid); } SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . "/listing-fields/"); } echo 'The system cannot proceed as Listing Field SID is not set'; }
public function execute() { $tp = SJB_System::getTemplateProcessor(); $oSubAdmin = SJB_ObjectMother::createSubAdmin($_REQUEST); $registration_form = SJB_ObjectMother::createForm($oSubAdmin); $registration_form->registerTags($tp); $form_submitted = SJB_Request::getVar('action', '') == 'add'; $errors = array(); $acl = SJB_SubAdminAcl::getInstance(); $type = 'subadmin'; $resources = $acl->getResources(); SJB_SubAdminAcl::mergePermissionsWithResources($resources); switch (SJB_Request::getVar('action')) { case 'save': if ($registration_form->isDataValid($errors)) { SJB_SubAdminManager::saveSubAdmin($oSubAdmin); $role = $oSubAdmin->getSID(); SJB_Acl::clearPermissions($type, $role); foreach ($resources as $name => $resource) { SJB_SubAdminAcl::allow($name, $type, $role, SJB_SubAdminAcl::definePermission($name), SJB_Request::getVar($name . '_params')); } // get new defined permissions for notification letter $permissions = SJB_SubAdminAcl::getAllPermissions($type, $role); $resources = $acl->getResources(); SJB_SubAdminAcl::mergePermissionsWithResources($resources, $permissions); SJB_Notifications::sendSubAdminRegistrationLetter($oSubAdmin, SJB_Request::get(), $resources); SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/manage-subadmins/'); } break; case 'delete': $subadmins = SJB_Request::getVar('subadmin', array()); foreach ($subadmins as $subadmin_sid) { $username = SJB_SubAdminManager::getUserNameBySubAdminSID($subadmin_sid); SJB_SubAdminManager::deleteSubAdminByUserName($username); } SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/manage-subadmins/'); break; default: break; } $tp->assign('errors', $errors); $tp->assign('form_fields', $registration_form->getFormFieldsInfo()); $aPermissionGroups = SJB_SubAdminAcl::getPermissionGroups(); if ('save' == SJB_Request::getVar('action', '')) { SJB_SubAdminAcl::mergePermissionsWithRequest($resources); } SJB_SubAdminAcl::prepareSubPermissions($resources); $tp->assign('groups', $aPermissionGroups); $tp->assign('resources', $resources); $tp->assign('type', $type); $tp->assign('role', 0); $tp->display('add_subadmin.tpl'); }