예제 #1
0
$application = array(name => 'peerlist', version => '0.3-rc1');
$xtpl = new xtemplate("templates/peerlist.xtpl");
$toolbox = new toolbox();
$routerid = $_GET['router'];
if (!isset($config[$routerid])) {
    die('router not found');
}
$remotepeer = $_GET['remotepeer'];
if (!preg_match('/^([0-9]{1,3}\\.){3}[0-9]{1,3}$/', $remotepeer) && !preg_match('/^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\\b((25[0-5])|(1\\d{2})|(2[0 4]\\d)|(\\d{1,2}))\\b)\\.){3}(\\b((25[0-5])|(1\\d{2})|(2[0-4]\\d)|(\\d{1,2}))\\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\\b((25[0-5])|(1\\d{2})|(2[0-4]\\d)|(\\d{1,2
}))\\b)\\.){3}(\\b((25[0-5])|(1\\d{2})|(2[0-4]\\d)|(\\d{1,2}))\\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\\b((25[0-5])|(1\\d{2})|(2[0-4]\\d)|(\\d{1,2}))\\b)\\.){3}(\\b((25[0-5])|(1\\d{2})|(2[0-4]\\d)|(\\d{1,2}))\\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$/', $remotepeer)) {
    die('invalid peer');
}
$config = $config[$routerid];
if (is_file('routers/' . $config['router']['module'] . '.class.php')) {
    include_once 'routers/' . $config['router']['module'] . '.class.php';
} else {
    die('router type not available');
}
if (is_file('exchanges/' . $config['exchange']['module'] . '.class.php')) {
    include_once 'exchanges/' . $config['exchange']['module'] . '.class.php';
} else {
    die('exchange module not available!');
}
$exchange = new $config['exchange']['module']($config['exchange']);
$router = new $config['router']['module']($config['router']);
$xtpl = new xtemplate("templates/simpleconfig_" . $routerid . ".xtpl");
$peer = $exchange->getpeerbyip($remotepeer);
$xtpl->assign('config', $config);
$xtpl->assign('peer', $peer);
$xtpl->parse('page');
echo $xtpl->text('page');
예제 #2
0
파일: index.php 프로젝트: klaver/peerlist
            $routerconfig['selected'] = 'selected';
        }
        if (is_file('routers/' . $routerconfig['router']['module'] . '.class.php')) {
            include_once 'routers/' . $routerconfig['router']['module'] . '.class.php';
        } else {
            die('router type not available');
        }
        if (is_file('exchanges/' . $routerconfig['exchange']['module'] . '.class.php')) {
            include_once 'exchanges/' . $routerconfig['exchange']['module'] . '.class.php';
        } else {
            die('exchange module not available!');
        }
        $exchangeobject = new $routerconfig['exchange']['module']($routerconfig['exchange']);
        $xtpl->assign('exchange', $exchangeobject->exchange_short);
        $xtpl->assign('router', $toolbox->htmlspecialchars_array($routerconfig));
        $xtpl->parse('page.header.routerselection.router');
    }
}
$xtpl->parse('page.header.routerselection');
if ($_GET['header'] != 'no') {
    $xtpl->parse('page.header');
}
if ($config[$_GET['router']]['common_name'] != '') {
    $config = $config[$_GET['router']];
    $xtpl->assign('selectedrouter', $toolbox->htmlspecialchars_array($config));
    if (is_file('routers/' . $config['router']['module'] . '.class.php')) {
        include_once 'routers/' . $config['router']['module'] . '.class.php';
    } else {
        die('router type not available');
    }
    if (is_file('exchanges/' . $config['exchange']['module'] . '.class.php')) {