/** * Выборка файлов(для АЦ) * @param string $path путь к дирректории * @param string $name имя дирректории * @param string $folder выбранная дирректория * @param array $apaths разрешённые дирректории внутри основной * @param bool $deny_delete запретить удалять? * @return null */ public function filechooser($path, $name, $folder = null, $apaths = null, $deny_delete = false) { $ajax = globals::g('ajax'); if (!validfolder($name, $path)) { return; } lang::o()->get('admin/filechooser'); $npath = ($path ? $path . '/' : '') . $name; if ($apaths) { $apaths = (array) $apaths; } if ($folder) { $folder = preg_replace('/(?:^|^(.*)\\/)[^\\/]+\\/\\.\\.\\/$/siu', '\\1', $folder); $folder = rtrim($folder, '/'); $folder = validpath($folder . '/', false, $apaths); $folder = rtrim($folder, '/'); if ($folder) { $npath .= "/" . rtrim($folder, '/'); } } $rows = file::o()->open_folder($npath, false, '^.+(\\.[a-z]+)?$'); if ($rows === false) { return; } file::o()->sort($npath, $rows); $arr = array(); foreach ($rows as $row) { $f = ROOT . $npath . '/' . $row; if (!$folder && $apaths && !validpath($row . '/', false, $apaths)) { continue; } if ($row == 'index.html') { continue; } $arr[$row] = array(is_dir($f), is_writable($f), filesize($f), filemtime($f)); } tpl::o()->assign('id', $name); tpl::o()->assign('files', $arr); tpl::o()->assign('deny_add', false); if ($folder) { tpl::o()->assign('parent', $folder . '/'); } elseif ($apaths) { tpl::o()->assign('deny_modify', true); } tpl::o()->assign('deny_delete', (bool) $deny_delete); if ($ajax) { ok(true); } tpl::o()->display('admin/filechooser.tpl'); }
/** * Инициализация AJAX-части модуля * @return null */ public function init() { $POST = globals::g('POST'); $act = $_GET['act']; $name = $_POST['id']; if (!validfolder($name, LANGUAGES_PATH)) { die; } switch ($act) { case "replace": $_POST['search'] = $POST['search']; $_POST['with'] = $POST['with']; $this->replace($name, $_POST); break; case "clone": $this->copy($name, $_POST['new']); break; case "delete": $this->delete($name); break; case "delete_file": $this->delete_file($name, $_POST['file']); break; case "default": $this->bydefault($name); break; } ok(); }
/** * Проверка стандартных типов * @param string $type имя типа * @param string $value значение * @param mixed $allowed допустимые значения * @param string $name имя поля * @param bool $keyed ключи в кач. значений опций? * @return bool всё верно? */ public function standart_types_check($type, &$value, $allowed = null, $name = null, $keyed = false) { switch ($type) { case "int": return is_numeric($value); case "text": case "string": return is_string($value); case "date": $value = display::o()->make_time($name, $allowed); return true; case "folder": return validfolder($value, $allowed); case "radio": case "select": if (!is_array($allowed)) { $allowed = unserialize($allowed); } return $keyed ? isset($allowed[$value]) : in_array($value, (array) $allowed); case "checkbox": $value = (bool) $value; return true; } return false; }
/** * Начало инициализации пользователя * @return null */ protected function init_begin() { display::o()->site_autoon(); $this->lang = validfolder($_COOKIE["lang"], LANGUAGES_PATH) ? $_COOKIE["lang"] : config::o()->v('default_lang'); $this->theme = validfolder($_COOKIE["theme"]) ? $_COOKIE["theme"] : config::o()->v('default_style'); init_spaths(); $this->theme_color = tpl::o()->set_color($_COOKIE["theme_color"]); lang::o()->change_folder($this->lang); $this->init_ipbans(); $this->get_groups(); try { plugins::o()->run_hook('user_init_begin'); } catch (PReturn $e) { return $e->r(); } }
include "install/include/class.tpl.php"; define('ILOCK_FILE', 'install/lock'); if (file_exists(ILOCK_FILE)) { define('INSTALL_LOCKED', true); } else { define('INSTALL_LOCKED', false); } db::o()->nt_error(); $pages = array('license', 'check', 'database', 'import', 'admin', 'config', 'finish'); define("COPYRIGHT", "Powered by <a href=\"http://ctrev.cyber-tm.ru/\" title=\"Go to the official site of CTRev\">CTRev v." . ENGINE_VERSION . ' ' . ENGINE_STAGE . "</a> © <a href=\"http://cyber-tm.ru\" title=\"Go to the official site of Cyber-Team\">Cyber-Team</a> 2008-" . date("Y")); $l = $_GET['install_lang']; if ($l) { setcookie('lang', $l); $_COOKIE['lang'] = $l; } if (!validfolder($_COOKIE['lang'], LANGUAGES_PATH)) { setcookie('lang', ''); $lng = DEFAULT_LANG; } else { $lng = $_COOKIE['lang']; } lang::o()->change_folder($lng); lang::o()->get('system'); lang::o()->get('main'); lang::o()->get('install/main'); if (!defined('INCONVERT')) { if (INSTALL_LOCKED) { $page = end($pages); $pages = array($page); } define('INSTALL_FILE', 'install');