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() { $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 static function updateDatabasePerPatch() { if (!($patchList = self::getPatchList())) { return false; } ini_set('memory_limit', -1); $originalMaxExecutionTime = ini_get('max_execution_time'); ini_set('max_execution_time', 0); SJB_DB::hideMysqlErrors(); SJB_DB::cleanMysqlErrors(); $patchList = (include SJB_BASE_DIR . self::UPDATE_DB_FILE); $patchFound = false; $patchCode = ''; foreach ($patchList as $patch) { if (!$patchCode) { $patchCode = $patch; } else { $patched = SJB_Settings::getValue('db-patch-' . $patchCode); if (empty($patched)) { $patch(); if (SJB_DB::isErrorExist()) { self::logMysqlErrors($patchCode); $patchFound = 'Can\'t install patch ' . $patchCode; } else { SJB_Settings::addSetting('db-patch-' . $patchCode, 'patched'); $patchFound = true; } break; } $patchCode = ''; } } ini_set('max_execution_time', $originalMaxExecutionTime); return $patchFound; }
public static function isAccessibleFunctional() { if (SJB_System::getSystemSettings('SYSTEM_ACCESS_TYPE') == SJB_System::getSystemSettings('ADMIN_ACCESS_TYPE') || !SJB_Settings::getValue('cookieLaw') || SJB_Request::getVar('cookiePreferences', null, 'COOKIE') != 'System') { return true; } self::disableCookieRequiredSettings(); return false; }
protected function _get_Captions_with_Counts_Grouped_by_Captions($request_data, array $listingSids = array()) { if (SJB_Settings::getValue('enableBrowseByCounter')) { $res = parent::_get_Captions_with_Counts_Grouped_by_Captions($request_data, $listingSids); } else { $sql = "select `value` as caption from `listing_field_list` where `field_sid`=?n"; $res = SJB_DB::query($sql, $this->field['sid']); } return $res; }
private static function identificationUserSign() { if (SJB_Settings::getValue('sessionBindIP')) { $userIdentity = md5(SJB_Request::getvar('HTTP_USER_AGENT', '', 'SERVER') . SJB_Request::getvar('REMOTE_ADDR', '', 'SERVER')); if (self::getValue('userSign') !== $userIdentity) { session_unset(); Zend_Session::regenerateId(); self::setValue('userSign', $userIdentity); } } }
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'); }
private function setAllowed() { $ips = explode(',', SJB_Settings::getValue('maintenance_mode_ip')); foreach ($ips as $ip) { $ip = trim($ip); $this->allowedIP = $ip; $this->checkIfSiteIsAvailable(); if ($this->allowed) { break; } } }
function getLang() { if (SJB_System::getSystemSettings('SYSTEM_ACCESS_TYPE') == SJB_System::getSystemSettings('ADMIN_ACCESS_TYPE')) { return SJB_Request::getVar('langAdmin', false, 'COOKIE'); } if (SJB_Settings::getValue('CURRENT_THEME') == 'mobile') { return $this->getDefaultLang(); } if (SJB_Users_CookiePreferences::isAccessibleFunctional()) { return SJB_Request::getVar('langUser', false, 'COOKIE'); } return $this->session->getValue('lang'); }
public function execute() { $ou = SJB_UserManager::getOnlineUsers(); $onlineUsers = array(); $totalOnlineUsers = 0; $userGroups = SJB_UserGroupManager::createTemplateStructureForUserGroups(); foreach ($userGroups as $userGroup) { $onlineUsers[$userGroup["id"]]["count"] = 0; $onlineUsers[$userGroup["id"]]["caption"] = $userGroup["caption"]; } foreach ($ou as $value) { $onlineUsers[$value["type"]]["count"]++; $totalOnlineUsers++; } $theme = SJB_Settings::getValue('TEMPLATE_USER_THEME', 'default'); $themePath = SJB_TemplatePathManager::getAbsoluteThemePath($theme); // FLAGGED LISTINGS $allListingTypes = SJB_ListingTypeManager::getAllListingTypesInfo(); $totalFlagsNum = array(); foreach ($allListingTypes as $type) { $totalFlagsNum[$type['id']] = SJB_ListingManager::getFlagsNumberByListingTypeSID($type['sid'], $filter = null, $groupByListingSID = true); } $files = $this->getCssFiles($themePath); $tp = SJB_System::getTemplateProcessor(); $tp->assign('totalFlagsNum', $totalFlagsNum); $tp->assign('usersInfo', SJB_UserManager::getUsersInfo()); $tp->assign('groupsInfo', SJB_UserManager::getGroupsInfo()); $tp->assign('listingsInfo', SJB_ListingManager::getListingsInfo()); $tp->assign('listingTypesInfo', SJB_ListingTypeManager::getAllListingTypesInfo()); $tp->assign('invoicesInfo', SJB_InvoiceManager::getInvoicesInfo()); $tp->assign('unpaidInvoices', SJB_InvoiceManager::getTotalUnpaidInvoices()); $tp->assign('totalInvoices', SJB_InvoiceManager::getTotalInvoices()); $i18n = SJB_I18N::getInstance(); $lang = $i18n->getLanguageData($i18n->getCurrentLanguage()); $tp->assign("today", strftime($lang['date_format'], time())); // ранее были данные за период: месяц (последние 30 дней), неделя (последние 7 дней) // теперь - текущий месяц и текущая неделя $currMonth = strftime($lang['date_format'], mktime(0, 0, 0, date("m"), 1, date("Y"))); $currWeek = strftime($lang['date_format'], mktime(0, 0, 0, date("m"), date("d") - date("N") + 1, date("Y"))); $tp->assign("weekAgo", $currWeek); $tp->assign("monthAgo", $currMonth); $tp->assign('onlineUsers', $onlineUsers); $tp->assign('totalOnlineUsers', $totalOnlineUsers); if (count($files) > 0) { $tp->assign("file", $files[0]); } $tp->display("index.tpl"); }
protected function _get_Captions_with_Counts_Grouped_by_Captions($request_data, array $listingSids = array()) { if (SJB_Settings::getValue('enableBrowseByCounter')) { $res = parent::_get_Captions_with_Counts_Grouped_by_Captions($request_data, $listingSids); foreach ($res as $key => $value) { if (strpos($key, ',')) { unset($res[$key]); $newKeys = explode(',', $key); foreach ($newKeys as $newKey) { $res[$newKey] = isset($res[$newKey]) ? $res[$newKey] + $value : $value; } } } } else { $sql = "select `value` as caption from `listing_field_list` where `field_sid`=?n"; $res = SJB_DB::query($sql, $this->field['sid']); } return $res; }
/** * @static * @return Zend_Cache_Core */ public static function getInstance() { if (empty(self::$instance)) { $caching = SJB_Settings::getValue('enableCache'); $caching = !empty($caching); $cacheHours = SJB_Settings::getValue('cacheHours'); if (empty($cacheHours)) { $cacheHours = 0; } $cacheMinutes = SJB_Settings::getValue('cacheMinutes'); if (empty($cacheMinutes)) { $cacheMinutes = 0; } $lifetime = intval($cacheHours) * 3600 + intval($cacheMinutes) * 60; $frontendOptions = array('lifetime' => $lifetime, 'automatic_serialization' => true, 'caching' => $caching); $backendOptions = array('cache_dir' => SJB_BASE_DIR . 'system' . DIRECTORY_SEPARATOR . 'cache'); // получение объекта Zend_Cache_Core self::$instance = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions); } return self::$instance; }
public function execute() { $template_processor = SJB_System::getTemplateProcessor(); $template_editor = new SJB_TemplateEditor(); $template_processor->assign('ERROR', "OK"); $module_name = SJB_Request::getVar('module_name', ''); $template_name = SJB_Request::getVar('template_name', ''); $template_processor->assign('module_name', $template_editor->doesModuleExists($module_name) ? $module_name : ""); $template_processor->assign('template_name', $template_editor->doesModuleTemplateExists($module_name, $template_name) ? $template_name : ""); if (!$template_editor->doesModuleExists($module_name)) { $template_processor->assign('ERROR', "MODULE_DOES_NOT_EXIST"); } else { if (!$template_editor->copyDefaultModuleThemeIfNotExists($module_name)) { $template_processor->assign('ERROR', "CANNOT_COPY_THEME"); } $modules = $template_editor->getModuleWithTemplatesList(); $template_processor->assign('display_name', $modules[$module_name]['display_name']); $template_processor->assign('module_name', $module_name); $template_processor->assign('template_list', $template_editor->getTemplateList($module_name, SJB_Settings::getValue('TEMPLATE_USER_THEME', 'default'), true)); } $template_processor->display('template_list.tpl'); }
public function execute() { $template_processor = SJB_System::getTemplateprocessor(); $template_name = isset($_REQUEST['template_name']) ? $_REQUEST['template_name'] : ""; $template_editor = new SJB_TemplateEditor(); $template_processor->assign('ERROR', ''); $theme = SJB_Settings::getValue('TEMPLATE_USER_THEME', 'default'); if (isset($_REQUEST['action'])) { if ($_REQUEST['action'] == 'create_page_template') { if (!isset($_REQUEST['new_template_name'])) { $_REQUEST['new_template_name'] = ''; } $_REQUEST['new_template_name'] = preg_replace("~.tpl\$~iu", "", $_REQUEST['new_template_name']); if (empty($_REQUEST['new_template_name'])) { $template_processor->assign('ERROR', 'EMPTY_TEMPLATE_NAME'); } else { if (preg_match("~\\W~", $_REQUEST['new_template_name'])) { $template_processor->assign('ERROR', 'WRONG_FILENAME'); } else { if (true !== ($result = $template_editor->saveTemplate($_REQUEST['new_template_name'] . ".tpl", SJB_System::getSystemSettings('STARTUP_MODULE'), $theme, "<html>\n<head>\n<title>{\$TITLE}</title>\n</head>\n<body>\n{\$MAIN_CONTENT}\n</body>\n</html>"))) { $template_processor->assign('ERROR', 'CANNOT_SAVE_FILE'); } else { SJB_HelperFunctions::redirect("?"); } } } } if ($_REQUEST['action'] == 'delete_template') { $template_editor->deleteTemplate($_REQUEST['del_template_name'], SJB_System::getSystemSettings('STARTUP_MODULE'), $theme); SJB_HelperFunctions::redirect("?"); } } $template_processor->assign('new_template_name', isset($_REQUEST['new_template_name']) ? $_REQUEST['new_template_name'] : ""); $template_processor->assign('template_name', $template_editor->doesModuleTemplateExists(SJB_System::getSystemSettings('STARTUP_MODULE'), $template_name) ? $template_name : ""); $template_processor->assign('STARTUP_MODULE', SJB_System::getSystemSettings('STARTUP_MODULE')); $template_processor->assign('template_list', $template_editor->getTemplateList(SJB_System::getSystemSettings('STARTUP_MODULE'), $theme)); $template_processor->display('page_template_list.tpl'); }
protected function _get_Captions_with_Counts_Grouped_by_Captions($request_data, array $listingSids = array()) { $columns = '?w as caption'; if (SJB_Settings::getValue('enableBrowseByCounter')) { $columns .= ', count(*) as count'; } $criteria = SJB_SearchFormBuilder::extractCriteriaFromRequestData($request_data); $sqlTranslator = new SJB_SearchSqlTranslator('listings'); $whereStatement = $sqlTranslator->_getWhereStatement($criteria); if (!empty($listingSids)) { $whereStatement .= 'AND `listings`.`sid` IN (' . implode(',', $listingSids) . ')'; } $res = SJB_DB::query("select {$columns} from listings {$whereStatement} and ?w != '' group by ?w", $this->field['field'], $this->field['field'], $this->field['field']); $result = array(); foreach ($res as $value) { if (SJB_Settings::getValue('enableBrowseByCounter')) { $result[$value['caption']] = $value['count']; } else { $result[$value['caption']] = ''; } } return $result; }
public function execute() { $tp = SJB_System::getTemplateProcessor(); $theme = SJB_Settings::getValue('TEMPLATE_USER_THEME', 'default'); $themePath = SJB_TemplatePathManager::getAbsoluteThemePath($theme); $files = $this->getCssFiles($themePath); $tp->assign("action", SJB_Request::getVar("action")); switch (SJB_Request::getVar("action")) { case "save": if (SJB_System::getSystemSettings("isDemo")) { $tp->assign('ERROR', "NOT_ALLOWED_IN_DEMO"); } else { $fp = fopen($_REQUEST["file"], "w"); fwrite($fp, $_REQUEST["file_content"]); fclose($fp); } case "edit": $tp->assign("file_content", file_get_contents($_REQUEST["file"])); $tp->assign("cssFile", $_REQUEST["file"]); break; } $tp->assign("files", $files); $tp->display("edit_css.tpl"); }
public static function getListingsFromBeyond($params) { $listingTypeID = SJB_ListingTypeManager::getListingTypeIDBySID($params->listing_type_sid); if ($listingTypeID == 'Job' && $GLOBALS['uri'] == '/search-results-jobs/' || $GLOBALS['uri'] == '/ajax/') { $limit = SJB_Settings::getSettingByName('countBeyondListings'); $start = $limit * ($params->listing_search_structure['current_page'] - 1) + 1; if ($limit) { // SET PARAMS FOR REQUEST $criteria = $params->criteria_saver->criteria; $categoryCriteria = isset($criteria['JobCategory']['multi_like']) ? $criteria['JobCategory']['multi_like'] : ''; $category = SJB_Settings::getSettingByName('BeyondIndustryList'); if (!empty($categoryCriteria)) { $categoryFromCriteria = self::getCategory($categoryCriteria); if ($category) { $category = explode('|', $category); $category = array_unique(array_merge($category, $categoryFromCriteria)); } else { $category = $categoryFromCriteria; } $category = implode('|', $category); } $keywords = SJB_Settings::getSettingByName('BeyondKeywords'); foreach ($criteria as $field) { if (is_array($field)) { foreach ($field as $fieldType => $values) { if ($fieldType === 'multi_like_and') { foreach ($values as $val) { if ($keywords != '') { $keywords .= ' AND '; } $keywords .= $val; } } if ($fieldType === 'location') { if (isset($values['value']) && !empty($values['value'])) { if ($keywords != '') { $keywords .= ' AND '; } $keywords .= $values['value']; } } if ($fieldType === 'like') { if ($keywords != '') { $keywords .= ' AND '; } $keywords .= $values; } } } } if (isset($criteria['keywords']) && !empty($criteria['keywords'])) { foreach ($criteria['keywords'] as $key => $item) { if (in_array($key, array('exact_phrase', 'any_words', 'all_words', 'like'))) { if (!empty($keywords)) { $keywords .= ' OR '; } $keywords .= $item; } } } if (substr($keywords, -4) == ' OR ') { $keywords = substr($keywords, 0, strlen($keywords) - 4); } $keywords = trim($keywords); $keywords = urlencode($keywords); $keywords = !empty($keywords) ? "({$keywords})" : ''; $city = ''; if (!empty($criteria['Location_City']['like'])) { $city = urlencode($criteria['Location_City']['like']); } else { if (!empty($criteria['Location_City']['multi_like_and'][0])) { $city = urlencode($criteria['Location_City']['multi_like_and'][0]); } else { if (!empty($criteria['Location']['location']['value'])) { $city = urlencode($criteria['Location']['location']['value']); } } } $state = SJB_Settings::getSettingByName('BeyondState'); if (isset($criteria['Location_State']['multi_like'])) { foreach ($criteria['Location_State']['multi_like'] as $stateSID) { if (!empty($stateSID)) { $stateInfo = SJB_StatesManager::getStateInfoBySID($stateSID); $state = !empty($stateInfo['state_code']) ? $stateInfo['state_code'] : ''; } } } $countryCriteria = isset($criteria['Location_Country']['multi_like'][0]) ? $criteria['Location_Country']['multi_like'][0] : SJB_Settings::getSettingByName('BeyondCountry'); $country = SJB_Settings::getSettingByName('BeyondCountry'); if ($countryCriteria && is_numeric($countryCriteria)) { $countryInfo = SJB_CountriesManager::getCountryInfoBySID($countryCriteria); $country = !empty($countryInfo['country_code']) ? $countryInfo['country_code'] : ''; } $employmentTypeCriteria = isset($criteria['EmploymentType']['multi_like']) ? $criteria['EmploymentType']['multi_like'] : ''; $employmentType = SJB_Settings::getSettingByName('BeyonEmploymentType'); if ($employmentTypeCriteria) { $employmentType = self::getEmploymentType($employmentTypeCriteria); } $zipCode = SJB_Settings::getSettingByName('BeyondZipcode'); if (isset($criteria['Location_ZipCode']['geo']['location']) && !empty($criteria['Location_ZipCode']['geo']['location'])) { $zipCode = $criteria['Location_ZipCode']['geo']['location']; } $educationLevel = SJB_Settings::getSettingByName('BeyonEducationLevel'); $experienceLevel = SJB_Settings::getSettingByName('BeyonExperienceLevel'); $affID = SJB_Settings::getSettingByName('BeyondAffiliateID'); $isIPhone = false; if (class_exists('MobilePlugin')) { $isIPhone = MobilePlugin::isPhone(); } if (str_replace('www.', '', $_SERVER['HTTP_HOST']) === SJB_Settings::getValue('mobile_url') || SJB_Settings::getValue('detect_iphone') && $isIPhone) { $mobileAffID = SJB_Settings::getSettingByName('MobileBeyondAffiliateID'); $affID = $mobileAffID ? $mobileAffID : $affID; } $url = "http://www.beyond.com/common/services/job/search/default.asp?aff={$affID}&kw={$keywords}&kt=3&il={$category}&ct={$country}&st={$state}&zc={$zipCode}&el={$educationLevel}&et={$employmentType}&ex={$experienceLevel}&nw=e&pn={$start}&mx={$limit}&fwhere={$city}"; $ch = curl_init(); // set URL and other appropriate options curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // grab URL and pass it to the browser $xml = curl_exec($ch); // close cURL resource, and free up system resources curl_close($ch); $beyondListings = array(); if ($xml !== false) { $doc = new DOMDocument(); $doc->loadXML($xml, LIBXML_NOERROR | LIBXML_NOWARNING); $results = $doc->getElementsByTagName('Item'); if ($results instanceof DOMNodeList) { // if we need just total results number foreach ($results as $node) { $resultXML = simplexml_import_dom($node); $jobKey = (string) $resultXML->SourceInformationID; $location = explode(',', (string) $resultXML->Location); $state = ''; $stateCode = ''; $country = ''; $city = !empty($location[0]) ? $location[0] : ''; if (isset($location[1])) { $location = explode(' ', trim($location[1])); if (!empty($location[0])) { $stateCode = trim($location[0]); $state = self::getState($stateCode); } if (!empty($location[1])) { $country = self::getCountry(trim($location[1])); } } $beyondListings[$jobKey] = array('Title' => (string) $resultXML->Title, 'CompanyName' => (string) $resultXML->CompanyName, 'JobDescription' => (string) $resultXML->ShortDescription, 'JobCategory' => (string) $resultXML->CareerFocus, 'State' => $state, 'Country' => $country, 'City' => $city, 'Location' => array('Country' => $country, 'State' => $state, 'State_Code' => $stateCode, 'City' => $city), 'url' => SJB_System::getSystemSettings('SITE_URL') . '/partnersite/?url=' . base64_encode((string) $resultXML->ApplyURL), 'jobkey' => $jobKey, 'activation_date' => (string) $resultXML->Modified, 'api' => 'beyond', 'code' => '<span id=beyond_at><a href="http://www.beyond.com/">jobs</a> by <a href="http://www.beyond.com/" title="Job Search"><img src="' . SJB_System::getSystemSettings('SITE_URL') . '/system/plugins/beyond_integration_plugin/logo.png" style="border: 0; vertical-align: middle;" alt="Beyond job search"></a></span>'); } } else { SJB_Logger::error('CANT GET BEYOND XML RESULTS'); } } else { SJB_Logger::error('NOT VALID RESPONSE FROM BEYOND'); } self::$beyondListings = $beyondListings; } } return $params; }
/** * Strip tags from string * * @param string $string * @return string */ public static function cleanText($string) { if (SJB_Settings::getValue('escape_html_tags') === 'htmlpurifier' && SJB_System::getSystemSettings('SYSTEM_ACCESS_TYPE') != 'admin') { $filters = str_replace(',', '', SJB_Settings::getSettingByName('htmlFilter')); // выбираем заданные админом тэги для конвертации $string = strip_tags($string, $filters); } return $string; }
SJB_Event::handle('listingDeactivated', array('SJB_Notifications', 'notifyOnUserListingDeactivated')); SJB_Event::handle('beforeListingDelete', array('SJB_Notifications', 'notifyOnUserListingDeleted')); //bind send notification emails if user deactivated/deleted SJB_Event::handle('onBeforeUserDelete', array('SJB_Notifications', 'notifyOnUserDeleted')); SJB_Event::handle('onBeforeUserDeactivate', array('SJB_Notifications', 'notifyOnUserDeactivated')); // bind session clear to task scheduler event SJB_Event::handle('task_scheduler_run', array('SJB_Session', 'clearTemporaryData')); SJB_Request::getInstance()->execute(); SJB_Statistics::addStatistics('siteView', '', 0, true); $isPseudoCronEnabled = intval(SJB_Settings::getSettingByName('isPseudoCronEnabled')) === 1; if ($isPseudoCronEnabled) { $isEmailSchedulerEnabled = intval(SJB_Settings::getSettingByName('email_scheduling')) === 1; $isOncePerHourCondition = SJB_Settings::getSettingByName('emailSchedule_lastTimeExecuted') < strtotime('1 hour ago'); if ($isEmailSchedulerEnabled && $isOncePerHourCondition) { SJB_Settings::updateSetting('emailSchedule_lastTimeExecuted', time()); SJB_System::getModuleManager()->executeFunction('miscellaneous', 'email_scheduling'); } $numberOfPageViewsSinceLastTime = SJB_Settings::getValue('pseudoCron_numberOfPageViewsSinceLastTime'); $isPageViewCondition = intval(SJB_Settings::getValue('pseudoCron_numberOfPageViewsSinceLastTime')) > SJB_Settings::getSettingByName('numberOfPageViewsToExecCronIfExceeded'); if ($isPageViewCondition) { SJB_Settings::updateSetting('pseudoCron_numberOfPageViewsSinceLastTime', 0); list($month, $day, $year) = explode('.', SJB_Settings::getSettingByName('task_scheduler_last_executed_date')); $isOnceADayCondition = strtotime("{$year}-{$month}-{$day}") < strtotime('today'); if ($isOnceADayCondition) { SJB_HelperFunctions::runScriptByCurl(SJB_System::getSystemSettings('SITE_URL') . '/system/miscellaneous/task_scheduler/'); } } else { SJB_Settings::updateSetting('pseudoCron_numberOfPageViewsSinceLastTime', $numberOfPageViewsSinceLastTime + 1); } } SJB_HelperFunctions::debugInfoPrint();
public function __construct() { $i18n = SJB_I18N::getInstance(); $this->lang = $i18n->getLanguageData($i18n->getCurrentLanguage()); $this->sign = SJB_Settings::getValue('transaction_currency'); }
public function execute() { $tp = SJB_System::getTemplateProcessor(); $module_name = SJB_Request::getVar('module_name', "", 'GET'); $template_name = SJB_Request::getVar('template_name', "", 'GET'); // не работало с юзерской if (empty($template_name)) { $template_name = SJB_Request::getVar('template_name', ''); } if (empty($module_name)) { $module_name = SJB_Request::getVar('module_name', ''); } $theme = SJB_Settings::getValue('TEMPLATE_USER_THEME', 'default'); $template_editor = new SJB_TemplateEditor(); $simple_view = SJB_Request::getVar('simple_view'); if (!$template_editor->doesModuleExists($module_name)) { $tp->assign('ERROR', "MODULE_DOES_NOT_EXIST"); } else { if (!$template_editor->doesModuleTemplateExists($module_name, $template_name)) { $tp->assign('ERROR', "TEMPLATE_DOES_NOT_EXIST"); } else { if (isset($_REQUEST['action'])) { $content = SJB_Request::getVar('template_content'); if ($content) { if (SJB_System::getSystemSettings("isDemo")) { $tp->assign('ERROR', 'NOT_ALLOWED_IN_DEMO'); } elseif (SJB_System::getIfTrialModeIsOn() && SJB_HelperFunctions::findSmartyRestrictedTagsInContent($tp, $content)) { $tp->assign('ERROR', 'Php tags are not allowed'); } else { $result = $template_editor->saveTemplate($template_name, $module_name, $theme, $content); // if ajax request to save if ($simple_view) { if ($result) { echo '<p class="message">Template saved successfully. </p>'; } else { echo "ERROR WHILE SAVE TEMPLATE"; } exit; } if ($_REQUEST['action'] == "save_template") { SJB_HelperFunctions::redirect("?module_name=" . $module_name); } } } } echo SJB_System::executeFunction('template_manager', 'add_template'); $modules = $template_editor->getModuleWithTemplatesList(); $tp->assign('module_name', $module_name); $tp->assign('template_name', $template_name); $tp->assign('theme', $theme); $tp->assign('display_name', $modules[$module_name]['display_name']); $tp->assign('template_display_name', $template_name); $path_to_template = SJB_TemplatePathManager::getAbsoluteTemplatePath($theme, $module_name, $template_name); if (!file_exists($path_to_template)) { $theme = SJB_System::getSystemSettings('SYSTEM_TEMPLATE_DIR'); } if (false === ($template_content = $template_editor->loadTemplate($template_name, $module_name, $theme))) { $tp->assign('ERROR', "CANNOT_FETCH_TEMPLATE"); } else { if (!$template_editor->isTemplateWriteable($module_name, $theme, $template_name) && !SJB_System::getSystemSettings("isDemo")) { $tp->assign('ERROR', "TEMPLATE_IS_NOT_WRITEABLE"); } else { $tp->assign('template_content', $template_content); } } $list_modules = SJB_System::getModulesUserList(); $list_functions = array(); $list_params = array(); foreach ($list_modules as $module) { $functions = SJB_System::getFunctionsUserList($module); foreach ($functions as $keyF => $func) { $list_functions[$module][$keyF] = $func; $params = SJB_System::getParamsList($module, $func); if (isset($params[0])) { foreach ($params as $keyP => $param) { $list_params[$module][$func][$keyP] = $param; } } } } $tp->assign('LIST_MODULES', $list_modules); $tp->assign('LIST_FUNCTIONS', $list_functions); $tp->assign('LIST_PARAMS', $list_params); } } if ($simple_view) { $tp->display('edit_template_simple.tpl'); } else { header('X-XSS-Protection: 0'); $tp->display('edit_template.tpl'); } }
public function execute() { $tp = SJB_System::getTemplateProcessor(); $template_editor = new SJB_TemplateEditor(); $module_name = SJB_Request::getVar('module_name', '', 'GET'); // if set simple_view - not shown navigation to user $simple_view = SJB_Request::getVar('simple_view', false); if (!$template_editor->doesModuleExists($module_name)) { $module_name = ''; } $template_name = SJB_Request::getVar('template_name', '', 'GET'); if (!$template_editor->doesModuleTemplateExists($module_name, $template_name)) { $template_name = ''; } $modules = $template_editor->getModuleWithTemplatesList(); global $error; $error = array(); $result = ''; $highlight_setting = SJB_Request::getVar('highlight_templates'); if (!is_null($highlight_setting)) { if (SJB_System::getSystemSettings("isDemo")) { $error[] = 'NOT_ALLOWED_IN_DEMO'; } else { SJB_Settings::updateSetting('highlight_templates', $highlight_setting); } } $tp->assign('highlight_templates', SJB_Settings::getSettingByName('highlight_templates')); $action = SJB_Request::getVar('action', ''); $form_submitted = SJB_Request::getVar('submit'); //Clear Smarty Cache $clear_smarty_cache = SJB_Request::getVar('clear_cache_submit'); if ($clear_smarty_cache) { $compiled_templates_dir = SJB_System::getSystemSettings('COMPILED_TEMPLATES_DIR'); $admin_theme = ThemeManager::getCurrentTheme(); $themes_list['user'] = $template_editor->getThemeList(); $themes_list['admin'][] = $admin_theme; foreach ($themes_list as $access_type => $themes) { foreach ($themes as $theme) { $destination = $compiled_templates_dir . $access_type . "/" . $theme; $result = $tp->deleteCacheBySpecifiedPath($destination); if (is_array($result)) { $error = $result; } } } } // actions if (!empty($action)) { $theme = SJB_Settings::getValue('TEMPLATE_USER_THEME', 'default'); // TODO: !!!!если редактируется с юзерской части , то проверить есть ли тэмплэйт в теме , если нет , брать с _system switch ($action) { case 'delete': $template_editor->deleteTemplate($template_name, $module_name, $theme); SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/edit-templates/?module_name=' . $module_name); break; case 'edit': case 'add': if (SJB_Request::getVar('templ_module') && SJB_Request::getVar('templ_name')) { $newTemplName = trim(SJB_Request::getVar('templ_name')); $newModuleName = SJB_Request::getVar('templ_module'); if (!$template_editor->isTemplateNameValid($newTemplName)) { $error[] = 'NOT_VALID_FILENAME_FORMAT'; } if (!$template_editor->doesModuleExists($newModuleName)) { $error[] = 'MODULE_ERROR'; } if (empty($error)) { if ('edit' == $action) { if ($template_editor->moveTemplate(SJB_Request::getVar('templ_name_or'), SJB_Request::getVar('templ_module_or'), $theme, $newModuleName, $newTemplName)) { if ($form_submitted == 'save_template') { SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/edit-templates/?module_name=' . $newModuleName); } SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/edit-templates/?module_name=' . $newModuleName . '&template_name=' . $newTemplName); exit; } else { $error[] = 'CANT_MOVE_FILE'; } } else { if ($template_editor->createTemplate($theme, $newModuleName, $newTemplName, $error)) { SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/edit-templates/?module_name=' . $newModuleName . '&template_name=' . $newTemplName); } $error[] = 'CANT_CREATE_FILE'; } } } break; default: break; } } // не работало в юзерской if (empty($template_name)) { $template_name = SJB_Request::getVar('template_name', ''); } if (empty($module_name)) { $module_name = SJB_Request::getVar('module_name', ''); } // edittemplate if (!empty($template_name) && !empty($module_name)) { $menu_path = array(array('reference' => '?', 'name' => 'Edit Templates'), array('reference' => "?module_name={$module_name}", 'name' => $modules[$module_name]['display_name']), array('name' => $template_name, 'reference' => '')); $tp->assign('navigation', $menu_path); $tp->assign('errors', $error); $tp->assign('title', 'Edit Templates: ' . $modules[$module_name]['display_name'] . ' / Template: ' . $template_name); $tp->assign('show_clear_cache_setting', false); $tp->assign('show_highlight_setting', false); if (!$simple_view) { $tp->display('navigation_menu.tpl'); } echo SJB_System::executeFunction('template_manager', 'edit_template'); } else { if (!empty($module_name)) { $menu_path = array(array('reference' => '?', 'name' => 'Edit Templates'), array('reference' => '', 'name' => $modules[$module_name]['display_name'])); $tp->assign('navigation', $menu_path); $tp->assign('title', 'Edit Templates'); $tp->assign('errors', $error); $tp->assign('show_clear_cache_setting', false); $tp->assign('show_highlight_setting', false); if (!$simple_view) { $tp->display('navigation_menu.tpl'); } echo SJB_System::executeFunction('template_manager', 'template_list'); } else { $menu_path = array(array('reference' => '', 'name' => 'Edit Templates')); $tp->assign('navigation', $menu_path); $tp->assign('title', 'Edit Templates'); $tp->assign('show_clear_cache_setting', true); $tp->assign('show_highlight_setting', true); $tp->assign('result', $result); $tp->assign('errors', $error); if (!$simple_view) { $tp->display('navigation_menu.tpl'); } echo SJB_System::executeFunction('template_manager', 'add_template'); echo SJB_System::executeFunction('template_manager', 'module_list'); } } }
public static function applyHtmlFilters($string) { $string = trim($string); if (SJB_Settings::getValue('escape_html_tags') == 'htmlpurifier' && SJB_System::getSystemSettings('SYSTEM_ACCESS_TYPE') != 'admin') { $filters = str_replace(',', '', SJB_Settings::getSettingByName('htmlFilter')); $string = strip_tags($string, $filters); } return $string; }
protected function _decorateResults($itemArr, &$html) { $i18n = SJB_I18N::getInstance(); if (SJB_Settings::getValue('enableBrowseByCounter')) { if (is_array($itemArr)) { foreach ($itemArr as $item => $val) { $caption = $i18n->gettext('', $this->tree_values[$item]['caption']); $countItems = "({$this->tree_values[$item]['countListings']})"; if ($this->tree_values[$item]['children']) { $html .= "\n<ul style='display: none;' class='browse_tree' id='browse_tree_ul_{$item}'><li id='browse_tree_li_{$item}'><div>"; $html .= "<div class='arrow collapsed' onclick='openLevel(\"{$item}\")' id='browse_tree_arrow_{$item}'></div><label><a href='" . SJB_System::getSystemSettings('SITE_URL') . "/browse-by-" . strtolower($this->field['field']) . "/{$item}/" . str_replace(" ", "-", htmlentities($this->tree_values[$item]['caption'], ENT_QUOTES, "UTF-8")) . "'>" . htmlentities($caption, ENT_QUOTES, "UTF-8") . $countItems . "</a></label></div>"; self::_decorateResults($val, $html); $html .= "\n</li>"; $html .= "\n</ul>"; } else { $html .= "\n<ul style='display: none;' class='browse_tree' id='browse_tree_ul_{$item}'><li id='browse_tree_li_{$item}'><div><div class='arrow'></div><label><a href='" . SJB_System::getSystemSettings('SITE_URL') . "/browse-by-" . strtolower($this->field['field']) . "/{$item}/" . str_replace(" ", "-", htmlentities($this->tree_values[$item]['caption'], ENT_QUOTES, "UTF-8")) . "'>" . htmlentities($caption, ENT_QUOTES, "UTF-8") . $countItems . "</a></label></div>"; self::_decorateResults($val, $html); $html .= "\n</li>"; $html .= "\n</ul>"; } } } } else { if (isset($itemArr['nodes'])) { foreach ($itemArr['nodes'] as $item => $val) { $caption = $i18n->gettext('', $val['caption']); if ($val['children']) { $html .= "\n<ul style='display: none;' class='browse_tree' id='browse_tree_ul_{$item}'><li id='browse_tree_li_{$item}'><div>"; $html .= "<div class='arrow collapsed' onclick='openLevel(\"{$item}\")' id='browse_tree_arrow_{$item}'></div><label><a href='" . SJB_System::getSystemSettings('SITE_URL') . "/browse-by-" . strtolower($this->field['field']) . "/{$item}/" . str_replace(" ", "-", htmlentities($val['caption'], ENT_COMPAT, "UTF-8")) . "'>" . htmlentities($caption, ENT_QUOTES, "UTF-8") . "</a></label></div>"; self::_decorateResults($val, $html); $html .= "\n</li>"; $html .= "\n</ul>"; } else { $html .= "\n<ul style='display: none;' class='browse_tree' id='browse_tree_ul_{$item}'><li id='browse_tree_li_{$item}'><div><div class='arrow'></div><label><a href='" . SJB_System::getSystemSettings('SITE_URL') . "/browse-by-" . strtolower($this->field['field']) . "/{$item}/" . str_replace(" ", "-", htmlentities($val['caption'], ENT_COMPAT, "UTF-8")) . "'>" . htmlentities($caption, ENT_QUOTES, "UTF-8") . "</a></label></div>"; $html .= "\n</li>"; $html .= "\n</ul>"; } } } } }
public static function getUserCurrentTheme() { return SJB_Settings::getValue('TEMPLATE_USER_THEME', 'default'); }
function doesModuleTemplateExists($module_name, $template_name) { if (!$this->doesModuleExists($module_name)) { return false; } $current_user_theme = SJB_Settings::getValue('TEMPLATE_USER_THEME', 'default'); $list = $this->getTemplateList($module_name, $current_user_theme); return array_search($template_name, $list) !== false; }
/** * @return bool|string */ public static function getBitlyTokenId() { return SJB_Settings::getValue('bitlyTokenId'); }
public function execute() { $tp = SJB_System::getTemplateProcessor(); $theme = SJB_Settings::getValue('TEMPLATE_USER_THEME', 'default'); $tp->assign('theme', $theme); $errors = array(); $message = ''; $alternativeText = SJB_Request::getVar('logoAlternativeText', ''); switch (SJB_Request::getVar('action', '')) { case 'save': if (isset($_FILES['logo']['error'])) { if ($_FILES['logo']['error'] == UPLOAD_ERR_OK) { if (SJB_System::getSystemSettings('isDemo')) { $errors[] = 'NOT_ALLOWED_IN_DEMO'; } else { $themePath = SJB_TemplatePathManager::getAbsoluteThemePath($theme); if (move_uploaded_file($_FILES['logo']['tmp_name'], "{$themePath}main/images/logo.png")) { $message = 'Logo has been uploaded successfully'; } } } else { switch ($_FILES['logo']['error']) { case UPLOAD_ERR_INI_SIZE: $errors[] = 'File size exceeds system limit. Please check the file size limits on your hosting or upload another file.'; break; case UPLOAD_ERR_FORM_SIZE: $errors[] = 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form'; break; case UPLOAD_ERR_PARTIAL: $errors[] = 'The uploaded file was only partially uploaded'; break; case UPLOAD_ERR_NO_FILE: // Разрешим изменять текст без аплоада лого break; case UPLOAD_ERR_NO_TMP_DIR: $errors[] = 'Missing a temporary folder'; break; case UPLOAD_ERR_CANT_WRITE: $errors[] = 'Failed to write file to disk'; break; default: $errors[] = 'File upload error'; } if ($alternativeText == SJB_Settings::getSettingByName('logoAlternativeText')) { $errors[] = 'Upload a logo or enter alternative text'; } } } if (SJB_Settings::getSettingByName('logoAlternativeText') === false) { SJB_Settings::addSetting('logoAlternativeText', $alternativeText); } else { if ($alternativeText != SJB_Settings::getSettingByName('logoAlternativeText')) { SJB_Settings::updateSetting('logoAlternativeText', $alternativeText); if (!$message) { $message = 'Alternative text has been updated successfully'; } else { $message = 'Logo and Alternative text has been uploaded successfully'; } } } break; } $tp->assign('errors', $errors); $tp->assign('message', $message); $tp->assign('uploadMaxFilesize', SJB_UploadFileManager::getIniUploadMaxFilesize()); $tp->assign('logoAlternativeText', SJB_Request::getVar('logoAlternativeText', SJB_Settings::getSettingByName('logoAlternativeText'))); $tp->display('upload_logo.tpl'); }
/** * If listing|listings affects the page with function "browse", updates field `data` in table `browse` * @param array|int $listingSids Listing sids, can work with one or several listings one time * @param bool $addListing true means the request came from function addListings, other way from function deleteListings */ private static function updateBrowses($listingSids, $addListing) { if (!SJB_Settings::getValue('enableBrowseByCounter')) { return; } if (!is_array($listingSids)) { $listingSids = array($listingSids); } $pages = SJB_DB::query("SELECT * FROM `browse`"); foreach ($pages as $page) { $items = self::getItems($page, false, $listingSids); if (!empty($items)) { $pageItems = unserialize($page['data']); foreach ($items as $key => $value) { if ($addListing) { $pageItems[$key] = isset($pageItems[$key]) ? $pageItems[$key] + $value : $value; } else { if (isset($pageItems[$key])) { $pageItems[$key] -= $value; if ($pageItems[$key] == 0) { unset($pageItems[$key]); } } } } SJB_DB::query("UPDATE `browse` SET `data` = ?s WHERE `page_uri` = ?s", serialize($pageItems), $page['page_uri']); } } }