function setLang($lang) { if (SJB_System::getSystemSettings('SYSTEM_ACCESS_TYPE') == SJB_System::getSystemSettings('ADMIN_ACCESS_TYPE')) { $_COOKIE['langAdmin'] = $lang; if (isset($_REQUEST['lang'])) { return setcookie('langAdmin', $lang, time() + 30 * 24 * 3600, '/'); } } if (SJB_Users_CookiePreferences::isAccessibleFunctional()) { $_COOKIE['langUser'] = $lang; if (isset($_REQUEST['lang'])) { return setcookie('langUser', $lang, time() + 30 * 24 * 3600, '/'); } } return $this->session->setValue('lang', $lang); }
/** * load all active plugins * * @param string $dir */ public static function loadPlugins($dir) { $dh = opendir($dir); if ($dh === false) { return; } $excludeDirs = array('.', '..'); while (($file = readdir($dh)) !== false) { if (in_array($file, $excludeDirs)) { continue; } $configFile = $dir . DIRECTORY_SEPARATOR . $file . DIRECTORY_SEPARATOR . 'config.ini'; if (file_exists($configFile)) { $config = parse_ini_file($configFile); $pluginName = isset($config['name']) ? $config['name'] : ''; if (SJB_Users_CookiePreferences::isPluginDisabled($pluginName)) { continue; } $active = isset($config['active']) && $config['active'] == '1'; $initFile = isset($config['init_file']) ? $config['init_file'] : ''; $config['config_file'] = $configFile; $config['group_id'] = isset($config['group']) ? str_replace(' ', '_', $config['group']) : ''; // add to plugins list self::$pluginsList[$config['name']] = $config; if ($active && !empty($initFile)) { $initFilePath = $dir . DIRECTORY_SEPARATOR . $file . DIRECTORY_SEPARATOR . $initFile; if (file_exists($initFilePath)) { require_once $initFilePath; self::$pluginsLoaded[] = $config; } else { SJB_System::$pluginsErrors[] = "'{$pluginName}' plugin '{$initFilePath}' init file not exists or not readable!"; } } } } closedir($dh); }
public static function disableCookieRequiredSettings() { if (!self::$isSettingsDisabled) { SJB_Settings::changeValue('fb_likeResume', 0); SJB_Settings::changeValue('fb_likeJob', 0); SJB_Settings::changeValue('linkedin_resumeAutoFillSync', 0); SJB_Settings::changeValue('view_on_map', false); self::$isSettingsDisabled = true; } }
/** * retrieve fields from database */ protected function getFields() { $result = SJB_DB::query('SELECT `field_sid` as `b_field_sid`, `order` as `b_order`,`html`,`complex`,`fields_holder_id` FROM `formbuilders_fieldsholders` WHERE `fields_holder_id` = ?s AND `listing_type_sid` = ?n AND `theme` = ?s ORDER BY `b_order` ASC', $this->fieldsHolderID, self::getListingTypeSID(), SJB_TemplateSupplier::getUserCurrentTheme()); if ($result) { foreach ($result as $aFieldInfo) { $fieldInfo = SJB_ListingFieldManager::getFieldInfoBySID($aFieldInfo['b_field_sid']); if (!$fieldInfo['hidden'] && !SJB_Users_CookiePreferences::isFieldDisabled($fieldInfo['type'])) { $this->aFields[$aFieldInfo['b_order']] = $aFieldInfo; } } } }
/** * Execute module function * * This function will execute function of the module * If function does not exists, it will display error message * * @param string $module_name name of the module * @param string $function_name function's name * @param array $parameters_override _REQUEST parameters to rewrite */ function executeFunction($module_name, $function_name, $parameters_override = array(), $pageID = false) { if (SJB_Users_CookiePreferences::isModuleDisabled($function_name)) { return; } ob_start(); if ($this->isFunctionAccessible($module_name, $function_name)) { $script_filename = $this->getFunctionScriptFilename($module_name, $function_name); if ($script_filename != null && is_readable($script_filename)) { $adminAccessType = SJB_System::getSystemSettings('SYSTEM_ACCESS_TYPE') == SJB_System::getSystemSettings('ADMIN_ACCESS_TYPE'); $this->prepareFunctionEnvironment($parameters_override); $this->pushExecutionStack($module_name, $function_name); $function = $this->getFunction($function_name, $module_name, $parameters_override); // permissions checking if (!$function->isAccessible()) { if ($adminAccessType && SJB_SubAdmin::admin_authed()) { $function = $this->getFunction('function_is_not_accessible_for_subadmin', 'miscellaneous'); } else { $function = $this->getFunction('function_is_not_accessible', 'miscellaneous'); } SJB_Request::getInstance()->setPageTemplate('index.tpl'); } if (SJB_Profiler::getInstance()->isProfilerEnable()) { SJB_DB::setFunctionInfo($function_name, $module_name); $startTime = microtime(true); $function->execute(); $spendTime = microtime(true) - $startTime; $spendTime = number_format($spendTime, 8); SJB_Profiler::getInstance()->gatherFunctionInfo($module_name, $function_name, $spendTime); } else { $function->execute(); } if (SJB_FlashMessages::getInstance()->isErrors()) { $errors = SJB_FlashMessages::getInstance()->getErrorsAndRemove(); $function = $this->getFunctionForErrors($errors); if ($function) { ob_clean(); $function->execute(); SJB_Request::getInstance()->setPageTemplate('index.tpl'); } } $this->popExecutionStack(); $this->restoreEnvironment(); } else { return "<!-- Either wrong module/function or function script file does not exist for {$module_name}, {$function_name} -->"; } } else { return "<!-- No such function or function is not accessible for {$module_name}, {$function_name} -->"; } return ob_get_clean(); }