Example #1
0
 /**
  * Инициализация управления категориями
  * @return null
  */
 public function init()
 {
     $admin_file = globals::g('admin_file');
     lang::o()->get('admin/cats');
     $act = $_GET['act'];
     $type = $_GET['type'];
     if (!$type || !$this->cats->change_type($type)) {
         $type = 'content';
     }
     tpl::o()->assign('oldadmin_file', $admin_file);
     $admin_file .= '&type=' . $type;
     globals::s('admin_file', $admin_file);
     tpl::o()->assign('admin_file', $admin_file);
     tpl::o()->assign('cat_type', $type);
     switch ($act) {
         case "add":
         case "edit":
             try {
                 $this->add((int) $_GET['id'], $act == "add");
             } catch (EngineException $e) {
                 $e->defaultCatch(true);
             }
             break;
         case "save":
             $this->save($type, $_POST);
             break;
         default:
             $this->show();
             break;
     }
 }
Example #2
0
 * @todo                Магазин плагинов
 *
 * @page 	  	http://ctrev.cyber-tm.ru/
 * @copyright         	(c) 2008-2012, Cyber-Team
 * @author 	  	The Cheat <*****@*****.**>
 * @name 		"Ядро" системы
 * @version           	1.00
 */
if (!defined('INSITE')) {
    die('Remote access denied!');
}
require_once ROOT . 'include/system/allowed.php';
require_once ROOT . 'include/system/globals.php';
require_once ROOT . 'include/system/autoload.php';
require_once ROOT . 'include/functions.php';
globals::s('start', timer());
// Start time
require_once ROOT . 'include/smarty/Smarty.class.php';
require_once ROOT . 'include/functions_smarty.php';
@set_error_handler("myerror_report");
// Присваиваем функцию myerror_report, вместо стандартной, помогает избежать раскрытия путей.
db::o()->connect();
init_baseurl();
lang::o()->change_folder(config::o()->v('default_lang'));
init_spaths();
tpl::o()->register_modifier('lang', array(lang::o(), 'v'));
// языковая переменная
tpl::o()->register_modifier('getlang', array(lang::o(), 'get'));
// подключение языка прямо в шаблоне
tpl::o()->register_modifier('islang', array(lang::o(), 'visset'));
// языковая переменная
Example #3
0
users::o()->check_inadmin($module, false, true);
$eadmin_file = globals::g('eadmin_file');
$iadmin_file = $eadmin_file . '&item=' . $item;
tpl::o()->assign("iadmin_file", $iadmin_file);
if ($module) {
    $admin_file = $iadmin_file . '&module=' . $module;
    tpl::o()->assign("admin_file", $admin_file);
    $admin_page = null;
} elseif ($admin_page) {
    $module = $admin_page;
    $allowed = $allowed_admin_pages;
    $plugins_isblock = 2;
    $admin_file = $iadmin_file . '&page=' . $admin_page;
    tpl::o()->assign("admin_file", $admin_file);
}
globals::s('admin_file', $admin_file);
/**
 * Загружаем модуль, или индексную страничку во вкладке
 */
if (!$ajax) {
    tpl::o()->display("admin/header.tpl");
} else {
    db::o()->nt_error();
    tpl::o()->assign("from_ajax", 1);
}
if ($module) {
    if (!allowed::o()->is($module, $allowed)) {
        die(lang::o()->v('module_not_exists'));
    }
    $m = plugins::o()->get_module($module, $plugins_isblock, $ajax && !$nno);
    try {
Example #4
0
 /**
  * Проверка сессии в АЦ
  * @param string $module имя модуля
  * @param bool $onlylink только получение ссылки?(тобишь без переадресаций)
  * @param bool $hardmode для АЦ, к примеру. Проверяет SID, даже если отсутствует
  * @return bool в АЦ?
  */
 public function check_inadmin($module, $onlylink = false, $hardmode = false)
 {
     $baseurl = globals::g('baseurl');
     if ($hardmode) {
         $onlylink = false;
     } elseif (!$this->perms['can_acp'] || !$_REQUEST['sid'] && !$onlylink) {
         return false;
     }
     $sid = get_formkey(null, "sid");
     if ($_SESSION['sid'] != $sid) {
         $_SESSION['sid'] = '';
     }
     if (!$_REQUEST['sid'] && $_SESSION['sid']) {
         // Дабы не входить снова, если SID отсутствует
         $sid = $_SESSION['sid'];
     }
     // Но переадресация нужна
     $afile = $baseurl . "admincp.php?sid=";
     $eadmin_file = $afile . $sid;
     globals::s('eadmin_file', $eadmin_file);
     if (!$onlylink) {
         try {
             check_formkey("sid");
         } catch (EngineException $e) {
             if ($hardmode && (!$_SESSION['sid'] || $_REQUEST['sid'])) {
                 $this->acp_login($afile);
             }
             furl::o()->location($eadmin_file);
         }
     }
     $this->acp_modules();
     if ($module && $this->perms['can_acp'] == 1) {
         if (!in_array($module, (array) $this->perms['acp_modules'])) {
             if (!$onlylink) {
                 furl::o()->location($eadmin_file);
             } else {
                 return false;
             }
         }
     }
     tpl::o()->assign("admin_sid", 'sid=' . $sid);
     tpl::o()->assign("eadmin_file", $eadmin_file);
     return true;
 }
Example #5
0
/**
 * Запретить вывод сообщения, что всё хорошо
 * @return null
 */
function deny_ok()
{
    globals::s('ok_denied', true);
}
Example #6
0
unset($input);
unset($display);
unset($blocks);
unset($message);
/// Конец
/// Обнаруживаем IE
if (preg_match("/MSIE\\s*([0-9]+)/siu", $_SERVER['HTTP_USER_AGENT'], $matches)) {
    lang::o()->get("ie_error");
    // Выгоняем IE ниже 8 версии
    if ($matches[1] < 8) {
        tpl::o()->display('ie_error.tpl');
        die;
    }
    tpl::o()->assign('MSIE', $matches[1]);
}
if (function_exists("get_magic_quotes_gpc") && get_magic_quotes_gpc()) {
    if (!empty($_GET)) {
        $_GET = strip_magic_quotes($_GET);
    }
    if (!empty($_POST)) {
        $_POST = strip_magic_quotes($_POST);
    }
    if (!empty($_COOKIE)) {
        $_COOKIE = strip_magic_quotes($_COOKIE);
    }
}
// INCLUDE BACK-END
globals::s('POST', $_POST);
$_POST = xss_array_protect($_POST);
$_GET = xss_array_protect($_GET);
$_REQUEST = $_POST + $_GET;
Example #7
0
 /**
  * Установка цвета темы
  * @param string $color имя цвета
  * @return string установленный цвет
  */
 public function set_color($color)
 {
     $vars = $this->init_cfg(null, null);
     $def = strtolower($vars['default_name']);
     $defc = strtolower($vars['color_default']);
     $color = strtolower($color);
     $allowed = strtolower($vars['allowed_colors']);
     if ($color == strtolower($def)) {
         $color_path = "";
     } else {
         if (!checkpos($allowed, $color, "|")) {
             if (checkpos($allowed, $defc, "|")) {
                 $color = $defc;
             } else {
                 return $this->set_color($def);
             }
         }
         if (!validword($color)) {
             $color_path = "";
         } else {
             $color_path = COLORS_PATH . "/" . $color . "/";
         }
     }
     $this->assign('color_path', $color_path);
     globals::s('color_path', $color_path);
     return $color;
 }
Example #8
0
// отложенная инициализация юзерей...
include_once "./include/include.php";
$module = $_GET['module'];
blocks::set_module($module ? $module : "index");
$this_file = globals::g('baseurl') . "index.php?module=" . $module;
tpl::o()->assign("this_file", $this_file);
$ajax = (bool) $_REQUEST['from_ajax'];
// Из AJAX
$nno = (bool) $_REQUEST['nno'];
// Стандартный класс(без постфикса '_ajax')
if (!$ajax && ($current = stats::o()->read(DATABASE_STATS)) != DATABASE_VERSION) {
    /* @var $m message */
    $m = n("message");
    $m->error('need_to_upgrade_database', array(DATABASE_VERSION, $current ? $current : "unknown"));
}
globals::s('ajax', $ajax);
tpl::o()->assign('from_ajax', $ajax);
tpl::o()->assign('module_loaded', $module);
if ($module) {
    if (!allowed::o()->is($module)) {
        die(lang::o()->v('module_not_exists'));
    }
    $mod = plugins::o()->get_module($module, false, $ajax && !$nno);
    if (!$mod) {
        die(lang::o()->v('module_not_exists'));
    }
    plugins::o()->call_init($mod, 'pre_init');
}
users_init();
// ...доседова
if ($module != "login") {
Example #9
0
 /**
  * Отображение конфигурации сайта
  * @return null 
  */
 protected function show_config()
 {
     init_baseurl();
     $prebaseurl = globals::g('prebaseurl');
     $prebaseurl = $prebaseurl == "/" ? "/" : rtrim($prebaseurl, '/');
     tpl::o()->assign('baseurl', $prebaseurl);
     globals::s('prebaseurl', $prebaseurl);
     tpl::o()->display('config');
 }