Файл: func.php
Строк: 87
<?php
error_reporting(0);
$k=trim($_GET['k']); include("key.php");
$d=rawurldecode(trim($_GET['d'])); $n=rawurldecode(trim($_GET['n']));
if ($d==NULL) {$d="";} elseif ($d=="/") {$d="";} if ($n==NULL) {$n="";}
$fc=trim($_GET['fc']); $kdr=trim($_GET['kdr']);
$rd=rawurlencode($d); $rn=rawurlencode($n); $p=trim($_GET['p']);
$h=trim($_GET['h']); if ($h==1) {$h="&h=1";}
$d=str_replace(".|htaccess",".htaccess",$d);
$n=str_replace(".|htaccess",".htaccess",$n);
$rp1=trim(stripslashes($_POST['rp1'])); $rp2=trim(stripslashes($_POST['rp2'])); $v=$_GET['ln'];
if ($fc<>NULL) {
if (($fc>1)||(($fc==1)&&($rp1<>NULL))) {
if ($txt=@file_get_contents("data/$k.ed")) {
@copy("data/$k.ed","data/$k.edbk");
include("utf.php");
function chars($ch) {
global $kdr;
if (($ch[1]>=0)&&($ch[1]<=255)) {
if ($kdr==5) {return chr($ch[1]);}
else {return w2u(chr($ch[1]));}
} else {return $ch[0];}
}
$rp1=preg_replace_callback("~#_(d{1,3})#~",chars,$rp1);
if ($rp2<>NULL) {$rp2=preg_replace_callback("~#_(d{1,3})#~",chars,$rp2);}
else {$rp2="";}
if ($fc==1) {$txt=str_replace($rp1,$rp2,$txt);}
elseif ($fc==2) {
$txt=str_replace("nr","",$txt);
$txt=preg_replace("~^rn~","",$txt,1);
}
elseif ($fc==3) {$txt=preg_replace("~[ ]{2,}~"," ",$txt);}
elseif ($fc==4) {$txt=preg_replace("~<[^<>]*>~","",$txt);}
$f=@fopen("data/$k.ed","w");
@fwrite($f,$txt);
@fclose($f);
}
if ($h<>NULL) {$h="2";} else {$h="";}
header("Location: edit$h.php?k=$k&d=$rd&n=$rn&kdr=$kdr&p=$p&ln=$v"); exit;
} elseif ($fc==1) {
$title="Replace";
include("inc/head.php");
echo ('<div class="gmenu"><a href="ftp.php?k='.$k.'&d='.$rd.'">'.$d.'/</a><a href="file.php?k='.$k.'&d='.$rd.'&n='.$rn.'">'.$n.'</a></div>');
echo "<div class="bmenu" align="center"><b>$title</b></div>";
echo("<p class="menu" align="left">");
$alt1="<small>Text: </small><input name="rp1" type="text" maxlength="100"/><br/><small>replace with: </small><input name="rp2" type="text" maxlength="100"/><br/>";
echo("<form action="func.php?k=$k&d=$rd&n=$rn&kdr=$kdr&p=$p&fc=1$h&ln=$v" method="post">$alt1<input type="submit" value="Replace"/></form></p>");
include("inc/foot.php");
}
} else {
$title="Actions";
include("inc/head.php");
echo ('<div class="gmenu"><a href="ftp.php?k='.$k.'&d='.$rd.'">'.$d.'/</a><a href="file.php?k='.$k.'&d='.$rd.'&n='.$rn.'">'.$n.'</a></div>');
echo "<div class="bmenu" align="center"><b>$title</b></div>";
echo("<p class="menu" align="left"><small>
<a href="func.php?k=$k&d=$rd&n=$rn&kdr=$kdr&p=$p&fc=1$h&ln=$v">replace text</a><br/>
<a href="func.php?k=$k&d=$rd&n=$rn&kdr=$kdr&p=$p&fc=2$h&ln=$v">delete empty line</a><br/>
<a href="func.php?k=$k&d=$rd&n=$rn&kdr=$kdr&p=$p&fc=3$h&ln=$v">delete unnecessary symbol</a><br/>
<a href="func.php?k=$k&d=$rd&n=$rn&kdr=$kdr&p=$p&fc=4$h&ln=$v">delete tag</a></small></p>");
include("inc/foot.php");
}
?>