/** * Селектор файлов плагинов * @param array $res массив уже включенных плагинов * @return null */ public function file_selector($res = null) { $res = (array) $res; $mask = implode('|', array_map('mpc', $res)); $mask = '/^plugin\\.' . ($mask ? "(?!" . $mask . ")" : "") . '(\\w+)\\.php$/i'; return input::o()->snull()->select_folder("plugin_files", PLUGINS_PATH, false, $mask, 1); }
/** * Селектор модулей * @param string $current данное значение * @return string HTML код */ public function modules_selector($current = null) { $arr = allowed::o()->get(); $c = count($arr); for ($i = 0; $i < $c; $i++) { if (strpos($arr[$i], '/')) { unset($arr[$i]); } } $current = explode(';', $current); $arr[] = "index"; return input::o()->scurrent($current)->ssize(5)->snull()->simple_selector('module', $arr); }
/** * Отображение настроек БД * @return null */ private function show_database() { require_once ROOT . 'include/classes/class.input.php'; $cfiles = input::o()->scurrent($this->cfile)->select_folder("file", 'install/database', false, "/^(.*)\\.conv\$/siu", 1); tpl::o()->assign('cfiles', $cfiles); $r = db::o()->query('SELECT id, name FROM groups'); tpl::o()->assign('groups', db::o()->fetch2array($r, 'assoc', array('id' => 'name'))); }
/** * Выборка шаблона * @param int $cur ID данного шаблона * @return string HTML код селектора */ public function pattern_selector($cur = null) { $r = db::o()->query('SELECT id,name FROM patterns'); $arr = db::o()->fetch2array($r, null, array('id' => 'name')); return input::o()->scurrent($cur)->snull()->skeyed()->simple_selector('pattern', $arr); }
/** * Выборка страны * @param string $value значение * @return string HTML код */ protected function input_field_website($value) { return input::o()->stype('string')->scurrent($value)->standart_types(self::var_prefix . 'website'); }
/** * Проверка значения конфигурации * @param mixed $value значение параметра * @param string $type тип параметра * @param string $allowed допустимые значения * @param string $name имя параметра * @return bool true, в случае успешного завершения */ public function check_type($type, &$value, $allowed = null, $name = null) { if ($type == 'other') { /* @var $o cofig_man */ $o = plugins::o()->get_module('config', 1); return (bool) $o->check_field($name, $value); } elseif ($type == 'radio' || $type == 'select') { $allowed = explode(";", $allowed); } return input::o()->standart_types_check($type, $value, $allowed, config_man::config_prefix . $name); }
/** * Получение объекта класса * @return input $this */ public static function o() { if (!self::$o) { $cn = __CLASS__; $c = n($cn, true); self::$o = new $c(); } return self::$o; }
/** * Создание настроек модуля * @return null */ public function create() { lang::o()->get('modsettings'); if (!$this->tinited) { $t = array(); foreach ($this->key_types as $type) { $t[$type] = lang::o()->v('modsettings_keytype_' . $type); } $this->key_types = input::o()->skeyed()->simple_selector('keytype[]', $t); $t = array(); foreach ($this->val_types as $type) { $t[$type] = lang::o()->v('modsettings_valtype_' . $type); } $this->val_types = input::o()->skeyed()->simple_selector('valtype[]', $t); $this->tinited = true; } tpl::o()->assign('mkeytypes', $this->key_types); tpl::o()->assign('mvaltypes', $this->val_types); tpl::o()->display('modsettings/add.tpl'); }
tpl::o()->assign('groups', users::o()->get_group()); tpl::o()->assign('curlang', users::o()->get_lang()); tpl::o()->assign('curtheme', users::o()->get_theme()); tpl::o()->assign('curtheme_color', users::o()->get_theme(true)); tpl::o()->assign('curuser', users::o()->v('username')); tpl::o()->assign('curgroup', users::o()->v('group')); } if (!defined('DELAYED_UINIT')) { users_init(); } tpl::o()->assign('URL_PATTERN', display::url_pattern); tpl::o()->assign('slbox_mbinited', false); // Кой-чаво для Smarty // Для модификаторов нет описания, ибо проще посмотреть сами функции. $bbcodes = bbcodes::o(); $input = input::o(); $display = display::o(); if (config::o()->v('torrents_on')) { lang::o()->get('torrents', null, true, true); } /* @var $blocks blocks */ $blocks = n("blocks"); /* @var $message message */ $message = n("message"); tpl::o()->register_modifier('unserialize', 'unserialize'); tpl::o()->register_modifier('arr_current', 'current'); tpl::o()->register_modifier('arr_key', 'key'); tpl::o()->register_modifier('l2ip', 'long2ip'); tpl::o()->register_modifier('long', 'longval'); tpl::o()->register_modifier('is', 'is'); tpl::o()->register_modifier('sl', 'slashes_smarty');
$converted = false; include ROOT . 'install/include/convert.php'; $main = new convert($converted); if ($converted) { $page = end($pages); $pages = array($page); } } else { include ROOT . 'install/include/main.php'; $main = new main(); } if (!$page) { if (!in_array($_GET['page'], $pages)) { $page = reset($pages); } else { $page = $_GET['page']; } } define('INSTALL_PAGE', $page); define('CONTENT_PATH', 'install/style/content/'); define('IMAGES_PATH', 'install/style/content/images/'); define('JS_PAGES', '["' . implode('", "', array_map('addslashes', $pages)) . '"]'); if ($_GET['page']) { $main->init(); } else { include 'include/classes/class.input.php'; tpl::o()->assign('pages', $pages); tpl::o()->assign('clang', $lng); tpl::o()->assign('input', input::o()); tpl::o()->display('contents'); }
/** * Обратная связь * @param array $data данные * @return null * @throws EngineException */ public function feedback($data) { $subject = $data['subject']; $content = $data['content']; $type = $data['type']; if (!$subject || !$content) { throw new EngineException('nothing_entered'); } if (!users::o()->v()) { n("captcha")->check($error); if ($error) { throw new EngineException($error[0]); } } $ft = input::o()->feedback_types; if (!in_array($type, $ft)) { $type = end($ft); } $insert = array('subject' => $subject, 'content' => $content, 'type' => $type, 'uid' => users::o()->v('id'), 'ip' => users::o()->get_ip(), 'time' => time()); try { plugins::o()->pass_data(array('insert' => &$insert, 'data' => $data), true)->run_hook('feedback_send'); } catch (PReturn $e) { return $e->r(); } db::o()->insert($insert, "feedback"); }
/** * Отображение настройки коннекта к БД * @return null */ protected function show_database() { include 'include/classes/class.input.php'; $f = 'include/dbconn.php'; if (file_exists($f)) { include_once ROOT . $f; } if (defined('dbuser')) { list($dbtype, $dbhost, $dbuser, $dbpass, $dbname, $dbprefix, $charset) = array(dbtype, dbhost, dbuser, dbpass, dbname, dbprefix, charset); } if (!$dbhost) { $dbhost = 'localhost:3306'; } if (!$dbtype) { $dbtype = 'mysql'; } if (!$dbuser) { $dbuser = '******'; } if (!$dbname) { $dbname = 'ctrev'; } if (!$charset) { $charset = 'utf8'; } if (!$dbprefix) { $dbprefix = 'ctrev_'; } tpl::o()->assign('dbtype', $dbtype); tpl::o()->assign('dbhost', $dbhost); tpl::o()->assign('dbuser', $dbuser); tpl::o()->assign('dbpass', $dbpass); tpl::o()->assign('dbname', $dbname); tpl::o()->assign('dbprefix', $dbprefix); tpl::o()->assign('charset', $charset); tpl::o()->assign('input', input::o()); tpl::o()->assign('allowed_dbms', $this->allowed_dbms); tpl::o()->display('database'); }