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; }
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; }
function get_package_version($name) { $cont = curl_general_get("http://download.lxcenter.org/download/version/{$name}"); return trim($cont); }
$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;