Ejemplo n.º 1
0
}
## Security validation's
## Setup the userdb if it does not exist.
require_once $dirname . DIRECTORY_SEPARATOR . 'utility/setupuserdb.php';
setUpUserDB();
$authCheck = new Login(USERDB_FILE_LOCATION, $config['use_domus_security']);
if (!$authCheck->login()) {
    header("Location: login.php?from=index");
    exit;
}
$tpl->set('sec_level', $authCheck->getUser()->getSecurityLevel());
$tpl->set('sec_level_type', $authCheck->getUser()->getSecurityLevelType());
// start/stop controls for heyu
if (isset($_GET["daemon"]) && $authCheck->getUser()->getSecurityLevel() <= 2) {
    try {
        heyu_ctrl($config, $_GET["daemon"]);
    } catch (Exception $e) {
        gen_error("heyu " . $_GET["daemon"], $e->getMessage());
        exit;
    }
}
// get which page is open
$page = isset($_GET['page']) ? $_GET['page'] : "domus_home_page";
// set page title
$tpl->set('title', ucwords($page));
$tpl->set('page', $page);
// check if heyu is running, if true display modules
if (heyu_running()) {
    $dirname = dirname(__FILE__);
    require_once $dirname . DIRECTORY_SEPARATOR . 'include_globals.php';
    ## Load mod group types
Ejemplo n.º 2
0
                }
            }
        }
        $mustSave = true;
    } elseif ($_GET["action"] == "add") {
        $aSchedDirective = new ConfigElement("schedule_file " . $_POST["sched_file_name"]);
        $heyuconf->addElement($aSchedDirective);
        $mustSave = true;
    }
    if ($mustSave) {
        try {
            $heyuconf->save();
        } catch (Exception $e) {
            if (count(preg_grep("/modified/", array($e->getMessage())))) {
                gen_error(null, array($e->getMessage(), $lang['exitbrowser']));
            } else {
                gen_error(null, $e->getMessage());
            }
            exit;
        }
        heyu_ctrl($config, 'restart');
        header("Location: " . $_SERVER['PHP_SELF']);
        exit;
    }
}
## Display the page
if (!isset($tpl_body)) {
    $tpl_body = null;
}
$tpl->set('content', $tpl_body);
echo $tpl->fetch(TPL_FILE_LOCATION . 'layout.tpl');