Example #1
0
function recurse_dir($base_dir)
{
    foreach (scandir($base_dir) as $filename) {
        $full_path = $base_dir . "/" . $filename;
        if (substr($full_path, -1) != ".") {
            if (is_dir($full_path)) {
                recurse_dir($base_dir . "/" . $filename);
                list_dir($full_path);
            } else {
                // full path is a file
                convert_to_html($full_path);
            }
        }
    }
}
Example #2
0
function print_doc($doc)
{
    if (isset($_GET['json'])) {
        header("Access-Control-Allow-Origin: *");
        header('Content-Type: application/json');
        echo json_encode($doc);
    } else {
        if (isset($_GET['html'])) {
            echo '
			<html>
			<head>
				<title>Free Hack Quest</title>
				<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
				<meta name="author" content="sea-kg" />
				<meta name="copyright" lang="ru" content="sea-kg" />
				<meta name="description" content="competition information security" />
				<meta name="keywords" content="security, fhq, fhq 2012, fhq 2013, fhq 2014, free, hack, quest, competition, information security, ctf, joepardy" />		
			</head>
			<body>
		';
            include "../copyright.php";
            echo convert_to_html($doc);
            echo '</body>';
        } else {
            echo "<a href='?html'>HTML</a> <a href='?json'>JSON</a>";
        }
    }
}