function run_self_tests() { global $MYSITE; global $LAST_UPDATED, $sqlite, $mirror_stats, $md5_ok; //$MYSITE = "http://sg.php.net/"; $content = fetch_contents($MYSITE . "manual/noalias.txt"); if (is_array($content) || trim($content) !== 'manual-noalias') { return array("name" => "Apache manual alias", "see" => $MYSITE . "mirroring-troubles.php#manual-redirect", "got" => $content); } $ctype = fetch_header($MYSITE . "manual/en/faq.html.php", "content-type"); if (strpos($ctype, "text/html") === false) { return array("name" => "Header weirdness. Pages named '.html.php' are returning wrong status headers", "see" => $MYSITE . "mirroring-troubles.php#content-type", "got" => var_export($ctype, true)); } $ctype = fetch_header($MYSITE . "functions", "content-type"); if (is_array($ctype)) { $ctype = current($ctype); } if (strpos($ctype, "text/html") === false) { return array("name" => "MultiViews on", "see" => $MYSITE . "mirroring-troubles.php#multiviews", "got" => var_export($ctype, true)); } $header = fetch_header($MYSITE . "manual/en/ref.var.php", 0); list($ver, $status, $msg) = explode(" ", $header, 3); if ($status != 200) { return array("name" => "Var Handler", "see" => $MYSITE . "mirroring-troubles.php#var", "got" => var_export($header, true)); } return array("servername" => $MYSITE, "version" => phpversion(), "updated" => $LAST_UPDATED, "sqlite" => $sqlite, "stats" => $mirror_stats, "language" => default_language(), "rsync" => $md5_ok); }
and !$sql->create_redirects_table()) die('Fatal error: could not create the redirects table.'); if(!$sql->users_table_exists() and !$sql->create_users_table()) die('Fatal error: could not create the users table.'); if(strtolower(substr($operation, 0, 5)) == 'admin') { include(PATH_INC.'/admin.inc'); exit(0); } if(strtolower(substr($operation, 0, 4)) == 'list') { include(PATH_INC.'/list.inc'); exit(0); } $found = $sql->get_redirect($operation); if(empty($found)) { header('HTTP/1.x 404 Not Found'); echo fetch_header(); die('<p style="color: #b00">Fatal error: No such redirect: "'.$operation.'"</p>'); } header('Location: '.$found[$operation]); ?>