Example #1
0
## Includes
require_once '..' . DIRECTORY_SEPARATOR . 'include.php';
require_once '..' . DIRECTORY_SEPARATOR . 'include_globals.php';
require_once 'heyuconfold.class.php';
require_once 'converttoaliasmap.func.php';
if ($config['theme'] != 'default') {
    $_SESSION['configChecked'] = true;
    header("Location: ../index.php");
    exit;
}
## Set template parameters
$tpl->set('title', $lang['setupverify']);
$tpl->set('lang', $lang);
$aliasMaps = array();
try {
    $oldHeyuConf = new heyuConfOld($config['heyuconfloc']);
    $aliasMaps = $oldHeyuConf->getAliasesWithLocationAndType();
} catch (Exception $e) {
    $_SESSION['configChecked'] = true;
    header("Location: ../index.php");
    exit;
}
## Security validation must be checked to convert.
$authCheck = new Login(USERDB_FILE_LOCATION, $config['use_domus_security']);
if (!$authCheck->login()) {
    header("Location: ../login.php?from=utility/setupverify");
    exit;
}
if ($authCheck->getUser()->getSecurityLevel() != 0) {
    header("Location: ../login.php?from=utility/setupverify");
    exit;
<?php

require_once "../include.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) {