Ejemplo n.º 1
0
 /**
  * Селектор модулей
  * @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);
 }
Ejemplo n.º 2
0
/**
 * Автоподгрузка классов из classes
 * @param string $class имя класса
 * @return null
 */
function __autoload($class)
{
    if (allowed::o()->is($class, "classes")) {
        /**
         * Не нужно убирать любой постфикс у интерфейса, ибо интерфейс автоматически
         * загружается вместе с классом.
         */
        if (file_exists(ROOT . 'include/classes/interface.' . $class . '.php')) {
            include ROOT . 'include/classes/interface.' . $class . '.php';
        }
        if (file_exists(ROOT . 'include/classes/class.' . $class . '.php')) {
            include ROOT . 'include/classes/class.' . $class . '.php';
        }
    } elseif (preg_match('/^(.*)_interface$/siu', $class, $matches)) {
        if (file_exists(ROOT . 'include/classes/interface.' . $matches[1] . '.php')) {
            include ROOT . 'include/classes/interface.' . $matches[1] . '.php';
        }
    }
}
Ejemplo n.º 3
0
 /**
  * Отключённые модули
  * @param string $value значение поля
  * @return string HTML код поля
  */
 protected function show_field_disabled_modules($value)
 {
     $modules = allowed::o()->get();
     $c = count($modules);
     for ($i = 0; $i < $c; $i++) {
         if (allowed::o()->is_basic($modules[$i])) {
             unset($modules[$i]);
         }
     }
     return input::o()->scurrent(explode(";", $value))->ssize(4)->snull()->simple_selector("config_disabled_modules", $modules);
 }
Ejemplo n.º 4
0
 /**
  * Проверка, включен ли модуль
  * @param string $module имя модуля
  * @return bool true, если включен
  */
 public function mstate($module)
 {
     $disabled =& $this->vars['disabled_modules'];
     if (!is_array($disabled)) {
         $disabled = explode(';', $disabled);
     }
     return allowed::o()->is_basic($module) || !in_array($module, $disabled);
 }
Ejemplo n.º 5
0
 /**
  * Добавление/редактирование группы
  * @param int $id ID группы
  * @param bool $add добавление?
  * @param bool $onlyperms только права?
  * @return null
  * @throws EngineException
  */
 public function add($id, $add = false, $onlyperms = false)
 {
     if (is_array($id) && $onlyperms) {
         $row = $id;
     } else {
         $row = users::o()->get_group($id);
     }
     if (!$row) {
         throw new EngineException();
     }
     users::o()->acp_modules($row);
     tpl::o()->assign('id', $add ? 0 : $id);
     tpl::o()->assign('row', $row);
     $r = db::o()->query('SELECT cat FROM groups_perm GROUP BY cat');
     tpl::o()->assign('types', db::o()->fetch2array($r, null, array('cat')));
     $r = db::o()->query('SELECT cat, perm, allowed FROM groups_perm');
     $perms = null;
     while ($row = db::o()->fetch_assoc($r)) {
         $perms[$row["cat"]][] = $row;
     }
     tpl::o()->assign('perms', $perms);
     tpl::o()->assign('allowed_modules', allowed::o()->get("acp_modules"));
     tpl::o()->register_modifier('show_selector', array($this, 'show_selector'));
     tpl::o()->display('admin/groups/' . ($onlyperms ? 'perms' : 'add') . '.tpl');
 }
Ejemplo n.º 6
0
    $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 {
        plugins::o()->call_init($m);
    } catch (EngineException $e) {
        $e->defaultCatch();
    }
}
if (!$ajax) {
    tpl::o()->display("admin/footer.tpl");
} else {
    print '<script type="text/javascript">ajax_complete();</script>';
}
die;
Ejemplo n.º 7
0
$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") {
    display::o()->siteoffline_check();
}
$content = "";
try {
Ejemplo n.º 8
0
 /**
  * Получение объекта класса
  * @return allowed $this
  */
 public static function o()
 {
     if (!self::$o) {
         self::$o = new self();
     }
     return self::$o;
 }