예제 #1
0
파일: lib.php 프로젝트: lonelywoolf/hypervm
function find_closest_mirror()
{
    //TODO: Function is not called.. remove?
    $v = curl_general_get("lxlabs.com/mirrorlist/");
    $v = trim($v);
    $vv = explode("\n", $v);
    $out = null;
    foreach ($vv as $k => $l) {
        $l = trim($l);
        if (!$l) {
            continue;
        }
        $verify = curl_general_get("{$l}/verify.txt");
        $verify = trim($verify);
        if (csa($verify, "lxlabs_mirror_verify")) {
            $out[] = $l;
        }
    }
    if (!$out) {
        return null;
    }
    foreach ($out as $l) {
        $hop[$l] = find_hop($l);
    }
    asort($hop);
    $v = getFirstKeyFromList($hop);
    return $v;
}
예제 #2
0
파일: lib.php 프로젝트: zseand/kloxo
function find_closest_mirror()
{
    // TODO LxCenter: No call to this function found.
    dprint("find_closest_mirror htmllib>lib>lib.php\n");
    $v = curl_general_get("lxlabs.com/mirrorlist/");
    $v = trim($v);
    $vv = explode("\n", $v);
    $out = null;
    foreach ($vv as $k => $l) {
        $l = trim($l);
        if (!$l) {
            continue;
        }
        $verify = curl_general_get("{$l}/verify.txt");
        $verify = trim($verify);
        if (csa($verify, "lxlabs_mirror_verify")) {
            $out[] = $l;
        }
    }
    if (!$out) {
        return null;
    }
    foreach ($out as $l) {
        $hop[$l] = find_hop($l);
    }
    asort($hop);
    $v = getFirstKeyFromList($hop);
    return $v;
}
예제 #3
0
파일: lxlib.php 프로젝트: zseand/kloxo
function get_package_version($name)
{
    $cont = curl_general_get("http://download.lxcenter.org/download/version/{$name}");
    return trim($cont);
}
예제 #4
0
$request = $_SERVER['REQUEST_URI'];
if (!csa($request, "sitepreview/")) {
    header("HTTP/1.0 404 Not Found");
    print "404--- <br> ";
    exit;
}
$request = strfrom($request, "sitepreview/");
$domain = strtilfirst($request, "/");
dprint($domain);
$sq = new Sqlite(null, 'web');
$res = $sq->getRowsWhere("nname = '{$domain}'");
if (!$res) {
    print "Domain Doesn't exist\n";
    exit;
}
$server = $res[0]['syncserver'];
$ip = getOneIPForServer($server);
rl_exec_get(null, 'localhost', 'addtoEtcHost', array($domain, $ip));
$file = curl_general_get("http://{$request}");
$pinfo = pathinfo($request);
$ext = $pinfo['extension'];
if (isset($res[$ext]) && $res[$ext] !== 'text/html' && $res[$ext] !== 'text/css') {
    header("Content-Type  {$res[$ext]}");
    print $file;
    exit;
}
rl_exec_get(null, 'localhost', 'removeFromEtcHost', array($domain));
include "/usr/local/lxlabs/kloxo/httpdocs/lib/hn_urlrewrite_example/hn_urlrewrite.class.php";
$rewrite = new hn_urlrewrite();
$page = $rewrite->_rewrite_page($domain, $file);
print $page;