/** * @return CSolrClient */ private static function getClient() { if (is_null(self::$_client)) { $params = array("hostname" => CSettingsManager::getSettingValue("solr_server"), "port" => CSettingsManager::getSettingValue("solr_port"), "path" => "solr/PortalASU"); self::$_client = new SolrClient($params); } return self::$_client; }
/** * Реальное положение файла * * @return string */ public function getFileDownloadLink() { // условие для внешней базы данных с закрытым доступом на обновление if (CSettingsManager::getSettingValue("hide_personal_data") == false) { $file = CLibraryManager::getFile($this->getId()); $file->entry = $file->entry + 1; $file->save(); } return WEB_ROOT . "library/" . $this->nameFolder . "/" . $this->nameFile; }
public function getAuthorName() { $result = ""; /** * Если включена защита персональных данных и * пользователь не авторизован, то не показываем ссылку */ if (CSettingsManager::getSettingValue("hide_personal_data")) { if (!CSession::isAuth()) { return $result; } } if (!is_null($this->document)) { if (!is_null($this->document->person)) { $result = $this->document->person->getName(); } } return $result; }
/** * @return CArrayList|null */ private static function getCacheSettings() { if (is_null(self::$_cacheSettings)) { self::$_cacheSettings = new CArrayList(); if (CSettingsManager::getSettingValue("preload_settings")) { // будет с поддержкой кеша if (is_null(CApp::getApp()->cache->get(CACHE_APPLICATION_SETTINGS))) { foreach (CActiveRecordProvider::getAllFromTable(TABLE_SETTINGS)->getItems() as $item) { $setting = new CSetting($item); self::getCacheSettings()->add($setting->getId(), $setting); self::getCacheSettings()->add(strtoupper($setting->alias), $setting); } CApp::getApp()->cache->set(CACHE_APPLICATION_SETTINGS, self::$_cacheSettings, 3600); } else { self::$_cacheSettings = CApp::getApp()->cache->get(CACHE_APPLICATION_SETTINGS); } } } return self::$_cacheSettings; }
/** * Перевод столбца таблицы на текущий язык * @return string */ public function getTranslationTableDefault() { return $this->getTranslationTableByLangId(CSettingsManager::getSettingValue("system_language_default")); }
public function getDisplayName() { if (!CSettingsManager::getSettingValue("hide_personal_data")) { return $this->getName(); } else { return CSettingsManager::getSettingValue("hide_person_data_text"); } }
private function preventJsAndCssCache() { if (CSettingsManager::getSettingValue("debug_javascript") == "true") { return true; } foreach ($this->getCSSIncludes()->getItems() as $key => $value) { $value .= "?_noCache=" . time(); $this->getCSSIncludes()->add($key, $value); } foreach ($this->getJSIncludes()->getItems() as $key => $value) { $value .= "?_noCache=" . time(); $this->getJSIncludes()->add($key, $value); } }
public function actionImport() { /** * Берем папку моделей и ищем все подпапки */ $models = array(); $modelsDir = opendir(CORE_CWD . CORE_DS . "_core" . CORE_DS . "_models"); while (false !== ($dir = readdir($modelsDir))) { if ($dir != "." && $dir != "..") { if (is_dir(CORE_CWD . CORE_DS . '_core' . CORE_DS . '_models' . CORE_DS . $dir)) { /** * Ищем файлы */ $modelDir = opendir(CORE_CWD . CORE_DS . '_core' . CORE_DS . '_models' . CORE_DS . $dir); while (($file = readdir($modelDir)) !== false) { if ($file != "." && $file != "..") { $models[] = $file; } } } } } /** * Последовательно создаем классы и смотрим, являются ли они наследниками * CModel или CActiveModel */ foreach ($models as $model) { $model = substr($model, 0, strpos($model, ".")); $obj = new $model(); if (is_a($obj, "CModel")) { /** * Это модельный класс, отсюда берем названия полей */ $persistedObj = CCoreObjectsManager::getCoreModel(get_class($obj)); if (is_null($persistedObj)) { /** * Создаем сам класс */ $persistedObj = new CCoreModel(); $persistedObj->title = get_class($obj); $persistedObj->class_name = get_class($obj); $persistedObj->save(); $fields = $obj->attributeLabels(); foreach ($fields as $key => $value) { $field = new CCoreModelField(); $field->model_id = $persistedObj->getId(); $field->field_name = $key; $field->save(); $t = new CCoreModelFieldTranslation(); $t->field_id = $field->getId(); $t->language_id = CSettingsManager::getSettingValue("system_language_default"); $t->value = $value; $t->save(); } } } } }
public function actionSearch() { $res = array(); $term = CRequest::getString("query"); /** * Поиск по ФИО преподавателя */ if (CSettingsManager::getSettingValue("hide_person_data_rule")) { $query = new CQuery(); $query->select("distinct(users.id) as id, users.FIO as name")->from(TABLE_USERS . " as users")->innerJoin(TABLE_USER_IN_GROUPS . " as userGroup", "userGroup.user_id=users.id")->condition("users.FIO like '%" . $term . "%' and userGroup.group_id=1")->limit(0, 5); foreach ($query->execute()->getItems() as $item) { $res[] = array("field" => "users.id", "value" => $item["id"], "label" => $item["name"], "class" => "CLecturerOuter"); } } else { $query = new CQuery(); $query->select("distinct(person.id) as id, person.fio as name")->from(TABLE_PERSON . " as person")->innerJoin(TABLE_USERS . " as users", "users.kadri_id=person.id")->innerJoin(TABLE_USER_IN_GROUPS . " as userGroup", "userGroup.user_id=users.id")->condition("person.fio like '%" . $term . "%' and userGroup.group_id=1")->limit(0, 5); foreach ($query->execute()->getItems() as $item) { $res[] = array("field" => "person.id", "value" => $item["id"], "label" => $item["name"], "class" => "CPerson"); } } echo json_encode($res); }
public function actionDelete() { $setting = CSettingsManager::getSetting(CRequest::getInt("id")); $setting->remove(); $this->redirect("?action=index"); }
/** * @return CUserRole */ public static function getCurrentTask() { $self = $_SERVER["PHP_SELF"]; $root_folder = CSettingsManager::getSettingValue("root_folder"); $self = str_replace($root_folder, "", $self); if (substr($self, 0, 1) == "/") { $self = substr($self, 1); } /** * Начинаем поиск задач, походящих под описание. Если не находим, * то отрезаем справа / */ $queryCount = 0; $tasks = CActiveRecordProvider::getWithCondition(TABLE_USER_ROLES, "url='" . $self . "'"); while ($tasks->getCount() == 0 && strlen($self) > 1 && $queryCount <= 5) { $self = CUtils::strLeftBack($self, "/"); if (substr($self, strlen($self) - 1) != "/") { $self .= "/"; } $tasks = CActiveRecordProvider::getWithCondition(TABLE_USER_ROLES, "url='" . $self . "'"); $queryCount++; } $task = null; if ($tasks->getCount() > 0) { foreach ($tasks->getItems() as $ar) { $task = new CUserRole($ar); } } return $task; }
$typepoll = CSettingsManager::getSettingValue("typepoll"); $useMantis = CSettingsManager::getSettingValue("useMantis"); $sso_salt = CSettingsManager::getSettingValue("sso_salt"); $useMoodle = CSettingsManager::getSettingValue("useMoodle"); $moodlePath = CSettingsManager::getSettingValue("moodlePath"); $useIntegManager = CSettingsManager::getSettingValue("useIntegManager"); $use_benchmark = CSettingsManager::getSettingValue("use_benchmark"); /** * Отправка сообщений через SMTP */ define("MAIL_SMTP_ENABLED", CSettingsManager::getSettingValue("smtp_enabled")); define("MAIL_SMTP_HOST", CSettingsManager::getSettingValue("smtp_host")); define("MAIL_SMTP_USER", CSettingsManager::getSettingValue("smtp_user")); define("MAIL_SMTP_PASS", CSettingsManager::getSettingValue("smtp_pass")); define("MAIL_SMTP_AUTH", CSettingsManager::getSettingValue("smtp_auth")); define("MAIL_SMTP_FROM", CSettingsManager::getSettingValue("smtp_from")); /** * Определение текущей страницы */ $curpage = preg_replace('/^\\//', '', str_replace('/' . $root_folder, '', $_SERVER["PHP_SELF"])); if (!isset($files_path)) { $files_path = ''; } // Параметры нового года //-------------------------------------- //начало НГ-периода 2 недели до 01 января $beforeNY = mktime(0, 0, 0, 12, 31 - $daysBetweenNY, date("Y")); //конеч НГ-периода 2 недели после 01 января $afterNY = mktime(0, 0, 0, 1, $daysBetweenNY, date("Y")); $cur_date = mktime(0, 0, 0, date("m"), date("d"), date("Y")); $daysBefNY = ($cur_date - $beforeNY) / 3600 / 24;
/** * Текущий семестр * * @return CTerm|null */ public static function getCurrentYearPart() { if (is_null(self::$_currentYearPart)) { self::$_currentYearPart = CTaxonomyManager::getYearPart(CSettingsManager::getSettingValue("current_year_part")); } return self::$_currentYearPart; }
public function __construct(CActiveRecord $aRecord = null) { parent::__construct($aRecord); $this->language_id = CSettingsManager::getSettingValue("system_language_default"); }
/** * Ссылка на страницу преподавателя, если это разрешено * * @return string */ public function getAuthorLink() { if (!CSettingsManager::getSettingValue("hide_personal_data")) { if (is_null($this->author)) { return ""; } else { return WEB_ROOT . "_modules/_lecturers/index.php?action=view&id=" . $this->author->getId(); } } else { return ""; } }
define("PRINT_DOCUMENTS_URL", WEB_ROOT . "/tmp/print/"); define("ZIP_DOCUMENTS_URL", WEB_ROOT . "/tmp/zip/"); define("ADMIN_EMAIL", CSettingsManager::getSettingValue("admin_email")); define("APP_DEBUG", true); /** * Путь к библиотекам jQuery на сервере */ define("JQUERY_UI_JS_PATH", "_core/jquery-ui-1.8.20.custom.min.js"); define("JQUERY_UI_CSS_PATH", "_core/jUI/jquery-ui-1.8.2.custom.css"); /** * Текущая значковая тема */ if (CSettingsManager::getSettingValue("icon_theme") == "") { define("ICON_THEME", "tango"); } else { define("ICON_THEME", CSettingsManager::getSettingValue("icon_theme")); } /** * Адрес подсистемы масштабирования изображений */ define("IMAGE_RESIZER_URL", WEB_ROOT . "_modules/_thumbnails/index.php"); /** * Роли пользователей */ define("ROLE_NEWS_ADD", "news_add"); /** * Адрес страницы авторизации */ define("NO_ACCESS_URL", WEB_ROOT . "p_administration.php"); /** * Псевдонимы ролей пользователей
protected function onActionBeforeExecute() { if ($this->getAction() == "updateIndex") { if (CRequest::getString("key") == CSettingsManager::getSettingValue("solr_key")) { return true; } } parent::onActionBeforeExecute(); }
$head .= '<script language="javascript" src="' . $web_root . 'scripts/' . CSettingsManager::getSettingValue("jquery_migrate_path") . '" type="text/javascript"> </script>'; $head .= '<script language="javascript" src="' . $web_root . 'scripts/' . CSettingsManager::getSettingValue("bootstrap_custom_path") . "js/bootstrap.js" . '" type="text/javascript"> </script>'; $head .= '<script language="javascript" src="' . $web_root . 'scripts/_core/core.js" type="text/javascript"> </script>'; $head .= '<script language="javascript" src="' . $web_root . 'scripts/_core/jquery.cookie.js" type="text/javascript"> </script>'; $head .= '<script language="javascript" src="' . $web_root . 'scripts/_core/jquery.ajax.js" type="text/javascript"> </script>'; $head .= '<link href="' . $web_root . 'scripts/' . CSettingsManager::getSettingValue("bootstrap_custom_path") . "css/bootstrap.css" . '" rel="stylesheet" type="text/css">'; $head .= '<link href="' . $web_root . 'css/_core/core.css" rel="stylesheet" type="text/css">'; } } else { $head .= '<script language="javascript" src="' . $web_root . 'scripts/' . CSettingsManager::getSettingValue("jquery_path") . '" type="text/javascript"> </script>'; $head .= '<script language="javascript" src="' . $web_root . 'scripts/' . CSettingsManager::getSettingValue("jquery_migrate_path") . '" type="text/javascript"> </script>'; $head .= '<script language="javascript" src="' . $web_root . 'scripts/' . CSettingsManager::getSettingValue("bootstrap_custom_path") . "js/bootstrap.js" . '" type="text/javascript"> </script>'; $head .= '<script language="javascript" src="' . $web_root . 'scripts/_core/core.js" type="text/javascript"> </script>'; $head .= '<script language="javascript" src="' . $web_root . 'scripts/_core/jquery.cookie.js" type="text/javascript"> </script>'; $head .= '<script language="javascript" src="' . $web_root . 'scripts/_core/jquery.ajax.js" type="text/javascript"> </script>'; $head .= '<link href="' . $web_root . 'scripts/' . CSettingsManager::getSettingValue("bootstrap_custom_path") . "css/bootstrap.css" . '" rel="stylesheet" type="text/css">'; $head .= '<link href="' . $web_root . 'css/_core/core.css" rel="stylesheet" type="text/css">'; } /** * Агапов, чтоб ты сдох! * * Подключаем модуль главного меню, он возвращает строку * $menu_str с кодом самого меню */ include '_modules/left_menu/index.php'; /** * Дружественные сайты */ $friends = ' <div align=center class=middle> Дружественные сайты:</div>' . $tab_begin . ' <tr class=round_table><td colspan=3 align=center class=baner_img><a href=http://www.ugatu.ac.ru title="Официальный сайт УГАТУ" target="_blank">
/** * Получение перевода столбца заголовков таблицы на текущий язык * @return array */ public function getTranslationTableCurrent() { $translation = array(); $lang = CSettingsManager::getSettingValue("system_language_current"); $translation = $this->getTranslationTableByLangId($lang); return $translation; }