public static function getDetails($user_group_sid, $referenceUid = false) { $details = array(array('id' => 'featured', 'caption' => 'Featured', 'type' => 'boolean', 'length' => '20', 'is_required' => false, 'is_system' => true, 'order' => null), array('id' => 'active', 'caption' => 'Status', 'type' => 'list', 'list_values' => array(array('id' => '1', 'caption' => 'Active'), array('id' => '0', 'caption' => 'Not active')), 'length' => '10', 'is_required' => false, 'is_system' => true), array('id' => 'sendmail', 'caption' => "Don't send mailings", 'type' => 'boolean', 'length' => '1', 'is_required' => false, 'is_system' => true)); $user_group_info = SJB_UserGroupManager::getUserGroupInfoBySID($user_group_sid); $email_confirmation = false; if (isset($user_group_info['email_confirmation'])) { $email_confirmation = $user_group_info['email_confirmation']; } if (SJB_UserGroupManager::isUserEmailAsUsernameInUserGroup($user_group_sid) || class_exists('SJB_SocialPlugin') && $referenceUid) { $userFields = array(array('id' => 'username', 'caption' => 'User name', 'type' => 'string', 'table_name' => 'users', 'length' => '20', 'is_required' => true, 'is_system' => true, 'order' => 0), array('id' => 'password', 'caption' => 'Password', 'type' => 'password', 'length' => '20', 'is_required' => true, 'is_system' => true, 'order' => 2), array('id' => 'email', 'caption' => 'Email', 'type' => 'unique_email', 'table_name' => 'users', 'length' => '20', 'is_required' => true, 'is_system' => true, 'order' => 1, 'email_confirmation' => $email_confirmation)); } else { $userFields = array(array('id' => 'username', 'caption' => 'User name', 'type' => 'unique_string', 'table_name' => 'users', 'length' => '20', 'validators' => array('SJB_IdValidator', 'SJB_UniqueSystemValidator'), 'is_required' => true, 'is_system' => true, 'order' => 0), array('id' => 'password', 'caption' => 'Password', 'type' => 'password', 'length' => '20', 'is_required' => true, 'is_system' => true, 'order' => 1), array('id' => 'email', 'caption' => 'Email', 'type' => 'unique_email', 'table_name' => 'users', 'length' => '20', 'is_required' => true, 'is_system' => true, 'order' => 2, 'email_confirmation' => $email_confirmation)); } $details = array_merge($userFields, $details); $extra_details = SJB_UserProfileFieldManager::getFieldsInfoByUserGroupSID($user_group_sid); foreach ($extra_details as $key => $extra_detail) { if ($extra_detail['type'] == 'monetary' || $extra_detail['type'] == 'complex') { $extra_details[$key]['is_system'] = false; } else { $extra_details[$key]['is_system'] = true; } } $details = array_merge($details, $extra_details); if (SJB_PluginManager::isPluginActive('CaptchaPlugin') && SJB_System::getSettingByName('registrationCaptcha') == 1 && SJB_System::getURI() == '/registration/') { $details_captcha = array(array('id' => 'captcha', 'caption' => 'Enter code from image', 'type' => 'captcha', 'length' => '20', 'is_required' => true, 'is_system' => false)); $details = array_merge($details, $details_captcha); } return $details; }
public static function get($action, $params) { if (SJB_System::getSystemSettings('isDemo')) { return new SJB_LanguageAction(); } $i18n = SJB_I18N::getInstance(); $lang = isset($params['languageId']) ? $params['languageId'] : null; switch ($action) { case 'set_default_language': return new SJB_SetDefaultLanguageAction($i18n, $lang); break; case 'add_language': return new SJB_AddLanguageAction($i18n, $params); break; case 'update_language': return new SJB_UpdateLanguageAction($i18n, $params); break; case 'delete_language': return new SJB_DeleteLanguageAction($i18n, $lang); break; case 'import_language': return new SJB_ImportLanguageAction($i18n, $params); break; case 'export_language': return new SJB_ExportLanguageAction($i18n, $lang); break; default: return new SJB_LanguageAction(); } }
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() { $tp = SJB_System::getTemplateProcessor(); $user_group_sid = SJB_Request::getVar('user_group_sid', null); $user_group_info = SJB_UserGroupManager::getUserGroupInfoBySID($user_group_sid); $errors = null; if (!is_null($user_group_sid)) { if (isset($_REQUEST['action'], $_REQUEST['field_sid'])) { if ($_REQUEST['action'] == 'move_up') { SJB_UserProfileFieldManager::moveUpFieldBySID($_REQUEST['field_sid']); } elseif ($_REQUEST['action'] == 'move_down') { SJB_UserProfileFieldManager::moveDownFieldBySID($_REQUEST['field_sid']); } } $user_profile_fields = SJB_UserProfileFieldManager::getFieldsInfoByUserGroupSID($user_group_sid); } else { $errors['USER_GROUP_SID_NOT_SET'] = 1; $user_profile_fields = null; } $tp->assign("errors", $errors); $tp->assign("user_profile_fields", $user_profile_fields); $tp->assign("user_group_sid", $user_group_sid); $tp->assign("user_group_info", $user_group_info); $tp->display("edit_user_profile_fields.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 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() { $template_processor = SJB_System::getTemplateProcessor(); $user_groups_structure = SJB_UserGroupManager::createTemplateStructureForUserGroups(); $template_processor->assign("user_groups", $user_groups_structure); $template_processor->display("user_groups.tpl"); }
public function execute() { $aListingTypesInfo = SJB_ListingTypeManager::getAllListingTypesInfo(); $tp = SJB_System::getTemplateProcessor(); $tp->assign('listingTypesInfo', $aListingTypesInfo); $tp->display('form_builder.tpl'); }
static function logout() { SessionStorage::destroy(SJB_Session::getSessionId()); $forumPath = SJB_Settings::getSettingByName('forum_path'); if (empty($forumPath)) { return; } $url = SJB_System::getSystemSettings('SITE_URL') . $forumPath . '/'; $client = new Zend_Http_Client($url, array('useragent' => SJB_Request::getUserAgent())); $client->setCookie($_COOKIE); $client->setCookieJar(); try { $response = $client->request(); $matches = array(); if (preg_match('/\\.\\/ucp.php\\?mode=logout\\&sid=([\\w\\d]+)"/', $response->getBody(), $matches)) { $sid = $matches[1]; $client->setUri($url . 'ucp.php?mode=logout&sid=' . $sid); $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); } } } } } catch (Exception $ex) { } }
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(); $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(); $userGroupsInfo = SJB_UserGroupManager::getAllUserGroupsInfo(); $tp->assign('userGroupsInfo', $userGroupsInfo); $tp->display('choose_user_group.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() { $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(); $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() { $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(); $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() { $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 function execute() { $tp = SJB_System::getTemplateProcessor(); $filenameToCheck = SJB_Request::getVar('filepath'); $updateName = SJB_Request::getVar('update_name'); $updatesDir = SJB_System::getSystemSettings('SJB_UPDATES_DIR'); try { if (empty($filenameToCheck)) { throw new Exception('Empty filename to diff'); } $fileExists = file_exists(SJB_BASE_DIR . $filenameToCheck); $currentFile = SJB_BASE_DIR . $filenameToCheck; $updateFile = $updatesDir . $updateName . DIRECTORY_SEPARATOR . $filenameToCheck; $tp->assign('current_file', $currentFile); $tp->assign('update_file', $updateFile); require_once 'PEAR/PEAR/Text_Diff/Diff.php'; if ($fileExists) { $diff = new Text_Diff('native', array(file($currentFile, FILE_IGNORE_NEW_LINES), file($updateFile, FILE_IGNORE_NEW_LINES))); } else { $diff = new Text_Diff('native', array(array(), file($updateFile, FILE_IGNORE_NEW_LINES))); } $out = self::getTableViewForDiff($diff); $tp->assign('diffTbl', $out); } catch (Exception $e) { $tp->assign('errors', array($e->getMessage())); } $tp->display('update_diff.tpl'); }
public function execute() { $listingTypeID = SJB_Request::getVar('listing_type', 'Job'); $tp = SJB_System::getTemplateProcessor(); $tp->assign('listing_type', $listingTypeID); $tp->display('select_posting_type.tpl'); }
public function execute() { $errors = array(); $params = array(); $lang_id = SJB_Request::getVar('languageId', null); $i18n = SJB_ObjectMother::createI18N(); if ($i18n->languageExists($lang_id)) { $params = $i18n->getLanguageData($lang_id); $params['languageId'] = $lang_id; if (isset($_REQUEST['action'])) { $action_name = $_REQUEST['action']; $form_submitted = SJB_Request::getVar('submit'); $params = array_merge($params, $_REQUEST); $action = SJB_LanguageActionFactory::get($action_name, $params); if ($action->canPerform()) { $action->perform(); if ($form_submitted == 'save') { SJB_WrappedFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/manage-languages/'); } } else { $errors = $action->getErrors(); } } } else { $errors[] = 'LANGUAGE_DOES_NOT_EXIST'; } $template_editor = SJB_ObjectMother::createTemplateEditor(); $themes = $template_editor->getThemeList(); $template_processor = SJB_System::getTemplateProcessor(); $template_processor->assign('themes', $themes); $template_processor->assign('lang', $params); $template_processor->assign('errors', $errors); $template_processor->display('update_language.tpl'); }
/** * @param $title * @param $text * @param $link * @param $imageUrl * @return mixed */ public function getContentToPostToGroup($title, $text, $link, $imageUrl) { $siteUrl = SJB_System::getSystemSettings("USER_SITE_URL"); $xml = "\n\t\t<post>\n\t\t\t<title><![CDATA[{$siteUrl}]]></title>\n\t\t\t<summary></summary>\n\t\t\t<content>\n\t\t\t\t<title><![CDATA[{$title}]]></title>\n\t\t\t\t<description><![CDATA[{$text}]]></description>\n\t\t\t\t<submitted-url><![CDATA[{$link}]]></submitted-url>\n\t\t\t\t<submitted-image-url><![CDATA[{$imageUrl}]]></submitted-image-url>\n\t\t\t</content>\n\t\t</post>"; $result = new SimpleXMLElement($xml); return $result->asXML(); }
public function execute() { $errors = array(); $params = array(); $template_processor = SJB_System::getTemplateProcessor(); if (isset($_REQUEST['action'])) { $action_name = $_REQUEST['action']; $params = $_REQUEST; $action = SJB_PhraseActionFactory::get($action_name, $params, $template_processor); if ($action->canPerform()) { $action->perform(); SJB_WrappedFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/manage-phrases/?action=remember_previous_state&result=' . $action->result); } else { $errors = $action->getErrors(); } } $i18n = SJB_ObjectMother::createI18N(); $domains = $i18n->getDomainsData(); $langs = $i18n->getLanguagesData(); $template_processor->assign('domains', $domains); $template_processor->assign('langs', $langs); $template_processor->assign('request_data', $_REQUEST); $template_processor->assign('errors', $errors); $template_processor->display('add_phrase.tpl'); }
public function execute() { $tp = SJB_System::getTemplateProcessor(); $bannersObj = new SJB_Banners(); $action = SJB_Request::getVar('action'); if (isset($action)) { $groupID = SJB_Request::getVar('groupID'); switch ($action) { case 'add': if ($groupID == '') { SJB_FlashMessages::getInstance()->addWarning('EMPTY_VALUE', array('fieldCaption' => 'Group ID')); break; } $result = $bannersObj->addBannerGroup($groupID); if ($result === false) { SJB_FlashMessages::getInstance()->addWarning('ERROR_ADD_BANNER_GROUP'); break; } $site_url = SJB_System::getSystemsettings('SITE_URL') . "/manage-banner-groups/"; header("Location: {$site_url}"); break; } } $tp->display("add_banner_group.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() { $errors = array(); $template_processor = SJB_System::getTemplateProcessor(); if (isset($_REQUEST['action'])) { $action_name = $_REQUEST['action']; $action = SJB_PhraseActionFactory::get($action_name, $_REQUEST, $template_processor); if ($action->canPerform()) { $action->perform(); $template_processor->display('refresh_opener_and_close_popup.tpl'); return; } else { $errors = $action->getErrors(); } } $phrase_id = SJB_Request::getVar('phrase', null); $domain_id = SJB_Request::getVar('domain', null); $i18n = SJB_ObjectMother::createI18N(); $langs = $i18n->getLanguagesData(); $template_processor->assign('langs', $langs); $template_processor->assign('errors', $errors); if (!$i18n->phraseExists($phrase_id, $domain_id)) { $domains = $i18n->getDomainsData(); $template_processor->assign('domains', $domains); $template_processor->assign('request_data', $_REQUEST); $template_processor->display('add_phrase.tpl'); } else { $phrase_data = $i18n->getPhraseData($phrase_id, $domain_id); $template_processor->assign('phrase', $phrase_data); $template_processor->display('update_phrase.tpl'); } }
public function execute() { set_time_limit(0); $notifiedEmails = array(); $emailScheduling = SJB_Settings::getSettingByName('email_scheduling'); $numberEmails = SJB_Settings::getSettingByName('number_emails'); $emailsSend = SJB_Settings::getSettingByName('send_emails'); $limit = $numberEmails - $emailsSend; $limit = $limit > 0 ? $limit : 20; $letters = SJB_DB::query('SELECT * FROM `email_scheduling` ORDER BY `id` ASC LIMIT 0, ?n', $limit); if ($emailScheduling && $numberEmails || count($letters)) { foreach ($letters as $letter) { $params = $letter; unset($params['id']); $email = new SJB_Email($params['email']); $email->setSubject($params['subject']); $email->setText($params['text']); $email->setFile($params['file']); if ($email->send(true)) { SJB_DB::query('DELETE FROM `email_scheduling` WHERE `id` = ?n', $letter['id']); array_push($notifiedEmails, $params['email']); } } } $tp = SJB_System::getTemplateProcessor(); $tp->assign('notified_emails', $notifiedEmails); $schedulerLog = $tp->fetch('email_scheduler_log.tpl'); SJB_HelperFunctions::writeCronLogFile('email_scheduler.log', $schedulerLog); }
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 function execute() { $tp = SJB_System::getTemplateProcessor(); $countrySID = SJB_Request::getVar('country_sid', false); $stateSID = SJB_Request::getVar('state_sid', false); $parentID = SJB_Request::getVar('parentID', false); $caption = SJB_Request::getVar('caption', 'State'); $type = SJB_Request::getVar('type', false); $displayAs = SJB_Request::getVar('display_as', 'state_name'); $displayAs = $displayAs == 'state_name' || $displayAs == 'state_code' ? $displayAs : 'state_name'; $result = array(); if ($countrySID) { $result = SJB_StatesManager::getStatesNamesByCountry($countrySID, true, $displayAs); } $tp->assign("caption", $caption); $tp->assign("value", $stateSID); $tp->assign("list_values", $result); $tp->assign("parentID", $parentID); if (!empty($countrySID)) { $tp->assign("enabled", true); } if ($type == 'search') { $tp->assign("id", $parentID . '_State'); $tp->display("../field_types/search/list.tpl"); } else { $tp->assign("id", 'State'); $tp->display("../field_types/input/list.tpl"); } }
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'); }