コード例 #1
0
ファイル: index.php プロジェクト: jungepiraten/ucp
require_once dirname(__FILE__) . "/class/UserDatabase.class.php";
require_once dirname(__FILE__) . "/class/Mailman.class.php";
require_once dirname(__FILE__) . "/class/Hash.class.php";
require_once "Smarty/Smarty.class.php";
session_start();
// Establish the LDAP connection and set some options
$userdb = new UserDatabase($config["admins"], $config["ldap"]["server"], $config["ldap"]["rdn"], $config["ldap"]["pass"], $config["ldap"]["base_dn"], $config["mysql"]["server"], $config["mysql"]["user"], $config["mysql"]["pass"], $config["mysql"]["db"]);
$userdb->open();
// Create the smarty object (templating engine)
$smarty = new Smarty();
$smarty->template_dir = "data/templates";
$smarty->compile_dir = "data/templates_c";
// If we are authenticated, load User-informations from UserDB
$user = null;
if (isset($_SESSION["authenticated"]) && $_SESSION["authenticated"]) {
    $user = $userdb->getUser($_SESSION["user"]);
}
// If a module name has been specified by a GET variable, it is made the current module and saved inside a session variable.
// Otherwise, the module specified by the session variable is made the current module.
$module = "home";
if (isset($_GET["module"])) {
    $module = $_GET["module"];
    $_SESSION["module"] = $module;
} else {
    if (isset($_SESSION["module"])) {
        $module = $_SESSION["module"];
    }
}
function maySeeModule($module, $user)
{
    global $config;