示例#1
0
    header("Location: ../login.php?from=utility/setupverify");
    exit;
}
if ($authCheck->getUser()->getSecurityLevel() != 0) {
    header("Location: ../login.php?from=utility/setupverify");
    exit;
}
$tpl->set('sec_level', $authCheck->getUser()->getSecurityLevel());
$tpl_body = new Template(TPL_FILE_LOCATION . 'setupverify.tpl');
$tpl_body->set('lang', $lang);
$tpl_body->set('aliasMaps', $aliasMaps);
if (!isset($_GET["action"])) {
    $junk = 1;
} else {
    if ($_GET["action"] == "edit") {
        convert_to_alias_map($oldHeyuConf, $heyuconf);
        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;
        }
        $_SESSION['configChecked'] = true;
    } else {
        $_SESSION['configChecked'] = true;
    }
    header("Location: ../index.php");
require_once FUNC_FILE_LOCATION . "debug.func.php";
require_once CLASS_FILE_LOCATION . "heyuconf.class.php";
require_once "./heyuconfold.class.php";
require_once "./converttoaliasmap.func.php";
//$testLine = "section timers";
echo "-------------------- Test bed for heyu conf conversion --------------------<br/>";
echo "<br/>";
echo "The heyu conf file [x10.conf]<br/>";
echo "<br/>";
echo "* Test Heyu Conf file<br/>";
try {
    $aHeyuConf = new heyuConfOld("/etc/heyu/x10.conf");
    echo "&nbsp;&nbsp;&nbsp;&nbsp;The return of heyu conf old get derived alias map<br/>";
    $newAliasLines = $aHeyuConf->getAliasesWithLocationAndType();
    pr($newAliasLines);
    echo "&nbsp;&nbsp;&nbsp;&nbsp;The return of heyu conf new alias map<br/>";
    $newAliasMap = new AliasMap();
    foreach ($newAliasLines as $aliasLine) {
        $newAliasMap->addElement(new AliasMapElement($aliasLine));
    }
    pr($newAliasMap);
    echo "&nbsp;&nbsp;&nbsp;&nbsp;The return of new Format heyu conf file<br/>";
    $newHeyuConf = new heyuConf("../doc/x10.conf");
    pr($newHeyuConf);
    echo "&nbsp;&nbsp;&nbsp;&nbsp;The return of Converted heyu conf file<br/>";
    convert_to_alias_map($aHeyuConf, $newHeyuConf);
    pr($newHeyuConf);
} catch (Exception $e) {
    echo "&nbsp;&nbsp;&nbsp;&nbsp;E!: " . $e->getMessage() . "<br/>";
}
echo "-------------------- End Test bed for heyu conf conversion --------------------<br/>";