private function getMenu() { if (file_exists(MODUL_DIR . '/mpanel/template/menu.tpl')) { include MODUL_DIR . '/mpanel/template/menu.tpl'; if (file_exists(MODUL_DIR . '/mpanel/lang-ru.php')) { include MODUL_DIR . '/mpanel/lang-ru.php'; } $mas = user::getRights(); ///print_r($mas); $items = $sub_items = ''; $num = 0; while (list($name, $modul) = each($mas)) { if (!empty($modul['rights'])) { $num++; if (file_exists(MODUL_DIR . '/' . $name . '/lang-ru.php')) { include MODUL_DIR . '/' . $name . '/lang-ru.php'; } $mod_name = isset($MODNAME[$name]) ? $MODNAME[$name] : $name; page::assign('name', $mod_name); page::assign('url', system::au() . '/' . $name); if ($num < 7) { $act = system::url(0) == $name ? 'act' : 'no_act'; $items .= page::parse($TEMPLATE['item_' . $act]); } else { $sub_items .= page::parse($TEMPLATE['sub_item']); } } } // Список редко используемых модулей if (!empty($sub_items)) { page::assign('eshe', $LANG['eshe']); page::assign('sub_items', $sub_items); $sub_menu = page::parse($TEMPLATE['sub_menu']); } else { $sub_menu = ''; } // echo $sub_menu; // Вывод списка языковых версий и доменов $sub_menu .= $this->getLangsAndDomains($TEMPLATE); page::assign('items', $items); page::assign('sub_menu', $sub_menu); $menu = page::parse($TEMPLATE['basic_menu']); page::assign('menu', $menu); // Устанавливаем доступ к языковым переменным if (isset($RIGHT) && isset($MODNAME)) { lang::setLang($LANG); lang::setRight($RIGHT); lang::setModule($MODNAME); } } }
autoload::addDir(dir::classes('utils')); new dyn(); if (dyn::get('setup') == true) { header('Location: install/'); exit; } if (isset($DYN['backend'])) { dyn::add('backend', $DYN['backend']); } else { dyn::add('backend', true); } unset($DYN); include dir::functions('html_stuff.php'); include dir::functions('url_stuff.php'); lang::setDefault(); lang::setLang(dyn::get('lang')); $DB = dyn::get('DB'); sql::connect($DB['host'], $DB['user'], $DB['password'], $DB['database']); ob_start(); date_default_timezone_set(dyn::get('timezone', 'Europe/Berlin')); new userLogin(); dyn::add('user', new user(userLogin::getUser())); cache::setCache(dyn::get('cache')); addonConfig::loadAllConfig(); addonConfig::includeAllLangFiles(); addonConfig::includeAllLibs(); if (dyn::get('backend')) { include dir::backend('backend.php'); } else { include dir::backend('frontend.php'); }
include_once 'Net/SFTP.php'; define('NET_SSH2_LOGGING', NET_SSH2_LOG_COMPLEX); include 'lib/classes/dir.php'; new dir(); include dir::classes('autoload.php'); autoload::register(); autoload::addDir(dir::classes('helper')); new rp(); if (rp::get('setup') == true) { header('Location: install/'); exit; } include dir::functions('html.php'); include dir::functions('convert.php'); lang::setDefault(); lang::setLang(rp::get('lang')); $DB = rp::get('DB'); sql::connect($DB['host'], $DB['user'], $DB['password'], $DB['database']); unset($DB); date_default_timezone_set(rp::get('timezone', 'Europe/Berlin')); new userLogin(); rp::add('user', new user(userLogin::getUser())); cache::setCache(rp::get('cache')); addonConfig::loadAllConfig(); addonConfig::includeAllLangFiles(); addonConfig::includeAllLibs(); $page = type::super('page', 'string', 'dashboard'); $action = type::super('action', 'string'); $id = type::super('id', 'int'); $success = type::get('success', 'string'); $error = type::get('error', 'string');
require_once SYSTEMPATH . 'sf/router.class.php'; require_once SYSTEMPATH . 'sf/loader.class.php'; require_once SYSTEMPATH . 'sf/language.class.php'; require_once SYSTEMPATH . 'sf/input.class.php'; //加载配置文件 config::load('default'); //加载必要库文件 loader::lib(array("controller", "model")); //加载默认helper loader::helper(config::get("auto_load_helper", 'url')); //加载默认插件 config::get("auto_load_plugin") && loader::plugin(config::get("auto_load_plugin")); //初始化pathinfo router::parse(); //加载语言文件 lang::setLang(config::get("default_lang", "chinese")); lang::load("global"); //执行控制器 $controller = sf::getController(router::getController()); try { method_exists($controller, "load") && $controller->load(); //存在LOAD方法执行LOAD方法(页面执行开始执行) if (!method_exists($controller, router::getMethod())) { throw new sfException(sprintf(lang::get("Call to undefined method %s::%s"), get_class($controller), router::getMethod())); } $controller->{router::getMethod()}(); method_exists($controller, "shutdown") && $controller->shutdown(); //存在SHUTDOWN方法执行他(页面执行完成执行) } catch (tfException $e) { method_exists($controller, "shutdown") && $controller->shutdown(); //发生意外执行shutdown方法
static function start() { header('Content-Type: text/html; charset=utf-8'); self::parseUrl(); // Опредяем текущий язык и домен (в случае необходимости обрезаем URL) languages::curLang(); // Устанавливаем в доступ языковые переменные if (file_exists(MODUL_DIR . '/core/sitelang-' . languages::curPrefix() . '.php')) { include MODUL_DIR . '/core/sitelang-' . languages::curPrefix() . '.php'; lang::setLang($LANG); } // Подключаем класс для работы с текущим пользователем user::init(); // активация шаблонной системы self::$defTemplate = '/structure/default.tpl'; page::init('%', '%'); page::globalVar('h1', ''); page::globalVar('title', ''); page::globalVar('site_name', domains::curDomain()->getSiteName()); page::globalVar('base_email', domains::curDomain()->getEmail()); page::globalVar('user_id', user::get('id')); page::globalVar('pre_lang', languages::pre()); page::globalVar('time', time()); page::globalVar('current_url', self::getCurrentUrl()); page::globalVar('current_url_pn', self::getCurrentUrlPN()); page::assign('current_url', self::getCurrentUrl()); page::assign('current_url_pn', self::getCurrentUrlPN()); // Заглушка для IE6 if (reg::getKey('/core/noIE6') && preg_match('/msie/i', $_SERVER['HTTP_USER_AGENT']) && !preg_match('/opera/i', $_SERVER['HTTP_USER_AGENT'])) { $val = explode(" ", stristr($_SERVER['HTTP_USER_AGENT'], 'msie')); if ($val[1] == '6.0;') { page::parseIt('/ieDie.tpl', false, true); system::stop(); } } // Заглушка для IE7 if (reg::getKey('/core/noIE7') && preg_match('/msie/i', $_SERVER['HTTP_USER_AGENT']) && !preg_match('/opera/i', $_SERVER['HTTP_USER_AGENT'])) { $val = explode(" ", stristr($_SERVER['HTTP_USER_AGENT'], 'msie')); if ($val[1] == '7.0;') { page::parseIt('/ieDie.tpl', false, true); system::stop(); } } // Заглушка для IE8 if (reg::getKey('/core/noIE8') && preg_match('/msie/i', $_SERVER['HTTP_USER_AGENT']) && !preg_match('/opera/i', $_SERVER['HTTP_USER_AGENT'])) { $val = explode(" ", stristr($_SERVER['HTTP_USER_AGENT'], 'msie')); if ($val[1] == '8.0;') { page::parseIt('/ieDie.tpl', false, true); system::stop(); } } // Оффлайн сообщение if (!domains::curDomain()->online() && !user::isAdmin() && !(self::issetUrl(0) && self::url(0) == 'mpanel')) { page::globalVar('content', domains::curDomain()->getOfflineMsg()); page::parseIt('/offline.tpl', false, true); system::stop(); } // Генерация файлов robots.txt и sitemap.xml ormPages::getContentFileRobots(); ormPages::getContentFileSiteMap(); // Проверяем, есть ли текущая страница в кэше page::checkCache(); // Вызов макроса через Ajax page::callAjaxMacros(); // Парсим мето-информацию "по умолчанию" page::globalVar('keywords', reg::getKey(ormPages::getPrefix() . '/keywords')); page::globalVar('description', reg::getKey(ormPages::getPrefix() . '/description')); // Загрузка необходимого функционала в зависимости от адреса $content = ''; // Пытаемся загрузить МОДУЛЬ if (self::issetUrl(0)) { $content = self::loadController('controller'); } // Пытаемся загрузить СТРАНИЦУ if (!self::issetUrl(0) || $content === false) { $content = self::loadController('controller', 1, 'structure'); } // Отображение сообщения "Страница не найдена" if (empty($content)) { $content = ormPages::get404(); } // Парсим контент на страницу page::fParse('content', $content); // Версия для печати $print_file = '/structure/_' . self::getCurrentNavVal() . '.tpl'; if (self::getCurrentNavVal() != '' && file_exists(TEMPL_DIR . $print_file)) { self::$defTemplate = $print_file; } if (!self::$isAdmin) { $title = str_replace('%text%', page::getGlobalVar('title'), reg::getKey(ormPages::getPrefix() . '/title_prefix')); page::globalVar('title', $title); if (file_exists(MODUL_DIR . '/core/template/minitext.tpl')) { include MODUL_DIR . '/core/template/minitext.tpl'; } // Мини-тексты, если есть $list = reg::getList(ormPages::getPrefix() . '/minitext'); while (list($id, $val) = each($list)) { //инлайн редактирование if (user::isAdmin() && user::issetRight('minitext_edit', 'structure')) { $val = str_replace('%val%', $val, str_replace('%id%', $id, $TEMPLATE['frame'])); } page::globalVar('text_' . $id, $val); } } // Выводим содержимое на экран page::parseIt(self::$defTemplate); // Завершение работы self::stop(); }
include '../lib/classes/dir.php'; new dir('../'); include dir::classes('autoload.php'); autoload::register(); autoload::addDir(dir::classes('helper')); new rp(); include dir::functions('html.php'); include dir::functions('convert.php'); lang::setDefault(); lang::setLang(rp::get('lang')); $page = type::super('page', 'string', 'lang'); $action = type::super('action', 'string'); $lang = type::super('lang', 'string'); $id = type::super('id', 'int'); if ($lang) { lang::setLang($lang); rp::add('lang', $lang, true); rp::save(); } $success = type::get('success', 'string'); $error = type::get('error', 'string'); if (!is_null($error)) { echo message::danger($error); } elseif (!is_null($success)) { echo message::success($success); } $path = 'pages/' . $page . '.php'; if (file_exists($path)) { include $path; } else { echo message::danger(lang::get('page_not_found'), false);