'z') && ($c < '0' || $c > '9') && ($c < 'A' || $c > 'Z') && $c != '_' && $c != '-') { $page = ''; $pageNotFound = true; } } if (strlen($page) > 0 && $page{strlen($page) - 1} == '/') $page = substr($page, 0, strlen($page) - 1); if (strlen($page) > 0 && $page{0} == '/') $page = substr($page, 1); $remoteAddress = getenv('HTTP_X_FORWARDED_FOR'); if (!$remoteAddress) { $remoteAddress = getenv('HTTP_PC_REMOTE_ADDR'); $proxyAddress = getenv('REMOTE_ADDR'); $proxyName = gethostbyaddr($proxyAddress); if (!$remoteAddress) { $remoteAddress = getenv('REMOTE_ADDR'); $proxyAddress = '-'; $proxyName = '-'; } } else { $proxyAddress = getenv('REMOTE_ADDR'); $proxyName = gethostbyaddr($proxyAddress); } $hostName = gethostbyaddr($remoteAddress); /***************/ /* For miaouwcrasher / miaouw-backtrace-uploader */ if (!strncmp($page, 'test_upload', 11)) { $body = file_get_contents('php://input'); echo ("Uploaded " . strlen($body) . " characters.\n\n"); echo ("This is only a test service.\nPlease, use your own server for your applications."); return; } /***************/ $pageFile = $page; if (is_dir($pageDir . $page)) { $pageFile = $page . '/.index'; $pageIsDir = true; } if (!is_readable($pageDir . $pageFile)) { $page = $pageFile = strtolower($page); if (is_dir($pageDir . $page)) { $pageFile = $page . '/.index'; $pageIsDir = true; } if (!is_readable($pageDir . $pageFile)) { $pageFile = '.index'; $pageNotFound = true; } } $pageModified = filemtime($pageDir . $pageFile); /***************/ $agent = getenv("HTTP_USER_AGENT"); $referer = getenv('HTTP_REFERER'); if (!$pageNotFound && !strncmp($referer, $baseUrl, strlen($baseUrl))) { $referer = NULL; } if ($pageNotFound) $status = "X"; else if ($referer) $status = "+"; else $status = "-"; $date = date('j.n.Y H:i:s'); if (($f = fopen($logFileBase . '.access.log', 'a'))) { fwrite($f, $status . ' ' . $date . "\t $remoteAddress $hostName ($proxyAddress $proxyName)\t /$page\n"); fclose($f); } if ($referer && ($f = fopen($logFileBase . '.referer.log', 'a'))) { fwrite($f, $date . "\t $remoteAddress\t $referer\n"); fclose($f); } if ($agent && ($f = fopen($logFileBase . '.agent.log', 'a'))) { fwrite($f, $date . "\t $remoteAddress\t $agent\n"); fclose($f); } /***************/ $nameCache = array(); if (filemtime($nameCacheFile) < filemtime($pageDir . $pageFile)) { function constructNameCache($path) { global $pageDir, $nameCache; if($d = opendir($pageDir . $path)) { while (($n = readdir($d)) !== false) { if ($n{0} == '.' && ( strlen($n) == 1 || $n{1} == '.')) continue; if (strlen($path) > 0) $pn = $path . '/' . $n; else $pn = $n; if (is_dir($pageDir . $pn)) { constructNameCache($pn); } else { $f = fopen($pageDir . $pn, "r"); if (!strcmp($n, ".index")) $pn = $path; if ($f) { while (!feof($f)) { $s = stristr(fgets($f, 2048), '

'); if ($s !== FALSE) { $i = strpos($s, '

'); if (!$i) $i = strpos($s, ''); if ($i) $nameCache[$pn] = strip_tags(substr($s, 4, $i - 4)); else $nameCache[$pn] = strip_tags(substr($s, 4, strlen($s) - 5)); break; } } if (feof($f)) $nameCache[$pn] = '?'; fclose($f); } } } } } constructNameCache(''); ksort($nameCache); $nameCache[''] = 'Miaouw'; $f = fopen($nameCacheFile, 'w'); if ($f) { reset($nameCache); while (list($key, $value) = each($nameCache)) fwrite($f, "$key $value\n"); fclose($f); } } else { $f = fopen($nameCacheFile, "r"); if ($f) { while (!feof($f)) { $s = fgets($f, 1024); $i = strpos($s, ' '); if ($i !== FALSE) $nameCache[substr($s, 0, $i)] = trim(substr($s, $i + 1)); } fclose($f); } } /****************/ if ($pageNotFound) { header("HTTP/1.1 404 Not Found"); } header("Last-Modified: " . gmdate("D, d M Y H:i:s", $pageModified) . " GMT"); header("Expires: " . gmdate("D, d M Y H:i:s", time() + 20) . " GMT"); header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache"); if (!$pageNotFound && (($p = strrpos($page, '.')) !== FALSE || (strcmp(strtolower($page), $page) && ($p = strrpos($page, '/')) !== FALSE))) { $suffix = substr($page, $p + 1); if (($f = fopen($mimeFile, 'r')) !== FALSE) { while (!feof($f) && ! isset($mimetype)) { $str = fgets($f); if ($str{0} != '#') { $s = split("[[:space:]]", $str); foreach ($s as $i) { if (!strcmp($i, $suffix)) { $mimetype = $s[0]; break; } } } } } if (!isset($mimetype)) { $mimetype = "application/binary"; } header("Content-Type: $mimetype"); readfile($pageDir . $pageFile); } else { ?> Miaouw - <? if ($pageNotFound) echo ("Page Not Found"); else if ($nameCache[$page] == 'Miaouw') echo ('The Miaouw Library for Maemo Development'); else echo($nameCache[$page]); ?>

Page Not Found

If you think this is an error in the site, please, inform the author (miaouw@henrikhedberg.com).