function LoadModule($str, $bar = 0) { //this are the trusted globals: global $GV, $MDL, $DIRS, $ERR, $FLTR, $PDIV, $CURRENT_USER, $page, $type, $id, $act, $topic, $art, $act, $a, $p; //this is full enough, but there's more risk of hack. //extract($GLOBALS); $_NOTBAR = false; $_CONFIGURE = false; $_ADMIN = false; $_MENU = false; $_MODULE = false; $_INSTALL = false; $_UNINSTALL = false; $_GETINFO = false; $_MODULE = 1; //root has individual pages: if (_isroot()) { switch ($str) { case "user_menu": include "root/menu.php"; break; case "user_page": include "root/page.php"; break; } } if ($str == "user_menu" && $this->IsModuleExists('users')) { if (_isrootdef()) { return; } $_MENU = true; if (_isroot()) { OUT("<br>"); } include $GV["modules_dir"] . "/users" . $GV["module_ext"]; $_MENU = false; return; } elseif ($str == "user_page") { if (_isrootdef()) { return; } if (_isroot()) { return; } include $GV["modules_dir"] . "/users" . $GV["module_ext"]; return; } if (file_exists($GV["modules_dir"] . "/" . $str . $GV["module_ext"])) { $_NOTBAR = true; if ($bar) { $_NOTBAR = false; } include $GV["modules_dir"] . "/" . $str . $GV["module_ext"]; } else { OUT("<p><b>Warning!</b> module '{$str}' not found!</p>"); } $_MODULE = false; }
} elseif ($_UNINSTALL) { } elseif ($_MENU) { if (!file_exists(SK_DIR . "/user_menu.php")) { ?> <div align=center><b>Личное меню:</b><br> <a href="?p=users&act=profile">Профиль</a><br> <a href="?p=smadbis">Статистика</a><br> <a href="?act=logout">Выход</a> </div> <?php } else { include SK_DIR . "/user_menu.php"; } } elseif ($_ADMIN) { if (!_isroot() || !check_auth()) { $page = "403"; $MDL->LoadModule("error"); return; } if (!file_exists(SK_DIR . "/users_admin.php")) { // skin doesn't support this module admin, let's draw all by ourself // { //we'll need for our own extract $GLOBALS include "config.php"; $USR = new CUsers($DIRS["users_data"], $DIRS["users_list"], $DIRS["users_private"], $DIRS["users_groups"], $DIRS["users_online"]); $USR->SetSeparators($GV["sep1"], $GV["sep2"]); global $FLTR; if (isset($mod)) { switch ($mod) { case "groups":
function is_group_allowed($group, $uid) { global $GV, $CURRENT_USER, $MDL, $DIRS; if (_isroot()) { return true; } $MDL->Load("users"); $USR = new CUsers($DIRS["users_data"], $DIRS["users_list"], $DIRS["users_private"], $DIRS["users_groups"], $DIRS["users_online"]); $USR->SetSeparators($GV["sep1"], $GV["sep2"]); $gdata = $USR->GetGroupData($group); return $CURRENT_USER["level"] >= $gdata["level"] || $CURRENT_USER["id"] == $uid; }
?> <div align=center> <a href="<?php OUT("?p={$p}&act={$act}&id={$id}"); ?> ">назад</a></div> <?php // } } else { include SK_DIR . "/pager_admin.php"; } } else { if ($_MODULE) { if ($id && file_exists($DIRS["pager_data"] . "/" . $id)) { OUT(get_file($DIRS["pager_data"] . "/" . $id)); if (check_auth() && _isroot()) { ?> <div align=center> <a href="?p=user_page&act=root&id=pager&a=edit&pgrec=<?php OUT($id); ?> ">Редактировать</a> </div> <?php } } else { global $page; $page = "404"; $this->LoadModule("error", false); } }