<?php
error_reporting(0);
$k=trim($_GET['k']); include("key.php"); $t=trim($_GET['t']);
$d=rawurldecode(trim($_GET['d'])); $n=rawurldecode(trim($_GET['n']));
if ($d==NULL) {$d="";} elseif ($d=="/") {$d="";} if ($n==NULL) {$n="";}
$p=trim($_GET['p']); if ($p==NULL) {$p=trim($_POST['p']);} $ed=trim($_GET['ed']);
$kdr=trim($_GET['kdr']); $ikdr=trim($_GET['ikdr']);
$rf=strtolower(preg_replace("~.*\.([^\.]*)~m","\\1",$n));
$rd=rawurlencode($d); $rn=rawurlencode($n);
$d=str_replace(".|htaccess",".htaccess",$d);
$n=str_replace(".|htaccess",".htaccess",$n);
if ((($t=="wml")||($t=="htm")||($t=="html")||($t=="txt")||($t=="pr")||($t=="pr2"))&&(file_exists("data/$k.ed"))) {
if (($t=="pr")||($t=="pr2")) {
$fl=@file_get_contents("data/$k.ed");
function chrpl($str) {
for ($j=0;$j<32;$j++) {
if ($j<>13) {$str=str_replace(chr($j),'',$str);}
}
return $str;
}
$fl=chrpl($fl);
$fl=htmlspecialchars($fl,ENT_QUOTES);
if ($t=="pr") {
$fl=preg_replace("~<[^<>]*>~iU",
"<font color=\"#0000ff\">\\0</font>",$fl);
$fl=preg_replace("~(<[^\s!]*\s)([^<>]*)([/?]?>)~iU",
"\\1<font color=\"#007f7f\">\\2</font>\\3",$fl);
$fl=preg_replace("~<!--.*-->~iU",
"<font color=\"#909090\">\\0</font>",$fl);
$fl=preg_replace("~("|')[^<>]*("|')~iU",
"<font color=\"#900000\">\\0</font>",$fl);
$fl=str_replace("\r","<br>\r\n",$fl);
} else {$fl=str_replace('$','$$',$fl); $fl=str_replace("\r","<br/>\r\n",$fl);}
if ($t=="pr2") {
header("Cache-Control: no-cache, must-revalidate");
header("Content-Type: text/vnd.wap.wml; charset=Utf-8");
echo ("<?xml version=\"1.0\" encoding=\"Utf-8\"?><!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" \"http://www.wapforum.org/DTD/wml_1.2.xml\"><wml>
<head><meta forua=\"true\" http-equiv=\"Cache-Control\" content=\"no-cache,no-store,must-revalidate\"/></head><card title=\"Просмотр кода\">
<p align=\"left\"><small>
$fl</small></p>
</card></wml>");
} else {
include "includes/header.php";
echo '<div class="box_2">
Путь: <b><a href="ftp.php?k='.$k.'&d='.$rd.'">'.$d.'/</a><a href="file.php?k='.$k.'&d='.$rd.'&n='.$rn.'">'.$n.'</a></b><br/>
</div><div class="box_1">'.$fl.'</div>';
include "includes/footer.php";
}
} else {
$fl=@file_get_contents("data/$k.ed");
if ($t=="wml") {header("Content-Type: text/vnd.wap.wml; charset=utf-8");}
elseif (($t=="htm")||($t=="html")) {header("Content-Type: text/html; charset=utf-8");}
elseif ($t=="txt") {header("Content-Type: text/plain; charset=utf-8");}
echo $fl; exit;
}
}
?>