<?php
error_reporting(4095);
function wsc($a){if(is_array($a)){foreach($a as $k=>$v) $a[$k]=wsc($v);}else{$a=str_replace('$','$$',HtmlSpecialChars($a));} return $a;}
function seanum($file) { preg_match_all('/([[:digit:]]+)/s',$file,$p); $p=array_unique($p[1]); sort($p); return $p;}
function parsarray($arr) {for($n=0,$s=count($arr)-1;$n<$s; $n++) {for($x=$n+1,$y=$s+1; $x<$y; $x++) if(strpos($arr[$x],$arr[$n])!==false) {unset($arr[$n]); break; }} return $arr; }
function depacun(&$a,$len,$arr) {if(is_array($arr)) {foreach($arr as $k=>$v) {depacun($a,$len,$v); }} else {for($max=strlen($arr)-$len+1,$n=0; $n<$max; $n++) {$aa=substr($arr,$n,$len); if(isset($a[$aa])) $a[$aa]++; else $a[$aa]=0; }} return $a; }
function sear($len,$arr) { $count=pow(10,$len); if(count($arr)>=$count) return false; for($n=0; $n<$count; $n++) {$nn=str_pad($n,$len,'0',STR_PAD_LEFT); if(!isset($arr[$nn])) return $nn; } return false; }
function allsear($argl) {if(!is_array($argl)) $argl=array($argl); if(count($argl)===0) $max=''; else $max=max($argl); $max=1+strlen($max); $maxkey=0; $mas=strlen(join('',$argl)); while($mas+1-pow(10,$maxkey)>0) $maxkey++; if($maxkey>$max) $maxkey=$max; if(!$maxkey) return mt_rand(2,9); for($n=1; $n<=$maxkey; $n++) {$a=array(); depacun($a,$n,$argl); $unikey=sear($n,$a); if($unikey!==false) return $unikey; } return false; }
function filekey($file) {return allsear(parsarray(seanum($file))); }
function utftoasc($txt) {$utftoasctabl=array('А'=>'A','а'=>'a','В'=>'B','Е'=>'E','е'=>'e','К'=>'K','М'=>'M','Н'=>'H','О'=>'O','о'=>'o','Р'=>'P','р'=>'p','С'=>'C','с'=>'c','Т'=>'T','у'=>'y','Х'=>'X','х'=>'x'); return strtr($txt,$utftoasctabl);}
function keycoders($str,$basa="%~^:@") { if(empty($basa)) $basa="%~^:@"; if(is_array($str)) $str=join('',$str); $rv='/['.preg_quote($basa,'/').']/s'; preg_match_all($rv,$str.$basa,$r,PREG_PATTERN_ORDER); $r=array_count_values($r[0]); asort($r,SORT_NUMERIC); reset($r); return key($r); }
function unidecode($txt) { $unitoutftabl=array(chr(208).chr(144) => "A",chr(208).chr(145) => "Б",chr(208).chr(146) => "B",chr(208).chr(147) => "Г",chr(208).chr(148) => "Д",chr(208).chr(149) => "E",chr(208).chr(150) => "Ж",chr(208).chr(151) => "З",chr(208).chr(152) => "И",chr(208).chr(153) => "Й",chr(208).chr(154) => "K",chr(208).chr(155) => "Л",chr(208).chr(156) => "M",chr(208).chr(157) => "H",chr(208).chr(158) => "O",chr(208).chr(159) => "П",chr(208).chr(160) => "P",chr(208).chr(161) => "C",chr(208).chr(162) => "T",chr(208).chr(163) => "У",chr(208).chr(164) => "Ф",chr(208).chr(165) => "X",chr(208).chr(166) => "Ц",chr(208).chr(167) => "Ч",chr(208).chr(168) => "Ш",chr(208).chr(169) => "Щ",chr(208).chr(170) => "Ь",chr(208).chr(171) => "Ы",chr(208).chr(172) => "Ъ",chr(208).chr(173) => "Э",chr(208).chr(174) => "Ю",chr(208).chr(175) => "Я",chr(208).chr(176) => "a",chr(208).chr(177) => "б",chr(208).chr(178) => "в",chr(208).chr(179) => "г",chr(208).chr(180) => "д",chr(208).chr(181) => "e",chr(208).chr(182) => "ж",chr(208).chr(183) => "з",chr(208).chr(184) => "и",chr(208).chr(185) => "й",chr(208).chr(186) => "к",chr(208).chr(187) => "л",chr(208).chr(188) => "м",chr(208).chr(189) => "н",chr(208).chr(190) => "o",chr(208).chr(191) => "п",chr(209).chr(128) => "p",chr(209).chr(129) => "c",chr(209).chr(130) => "т",chr(209).chr(131) => "y",chr(209).chr(132) => "ф",chr(209).chr(133) => "x",chr(209).chr(134) => "ц",chr(209).chr(135) => "ч",chr(209).chr(136) => "ш",chr(209).chr(137) => "щ",chr(209).chr(138) => "ь",chr(209).chr(139) => "ы",chr(209).chr(140) => "ъ",chr(209).chr(141) => "э",chr(209).chr(142) => "ю",chr(209).chr(143) => "я",chr(209).chr(145) => "ё",chr(208).chr(129) => "Ë");return strtr($txt,$unitoutftabl); }
function hexutf($txt) { function hexpex($b) {$a=$b[5]; if(empty($b[3]) && (int)$b[5]===hexdec(dechex($b[5]))) $a=dechex($b[5]); $a1=hexdec($a); if($a1==1025 || $a1==1105 || ($a1>1039 && $a1<1104)) {$b[3]='x'; $b[4]=''; $b[5]=strtolower($a);} return $b[2].$b[3].$b[4].$b[5].$b[6];} return preg_replace_callback('/((&#)(x?)(0*)([0-9abcdefABCDEF]+)(;))/s','hexpex',$txt);}
function translit($a,$tabl='') {global $tabl; $key=filekey($a); $key=str_pad($key,2*strlen($key),'-',STR_PAD_LEFT); $a=str_replace('##',$key,$a); if(!is_array($tabl)) $tabl=array('b' => 'б','B' => 'Б','v' => 'в','V' => 'B','g' => 'г','G' => 'Г','d' => 'д','D' => 'Д','jo' => 'ё','Jo' => 'Ë','JO' => 'Ë','jO' => 'Ë','zh' => 'ж','Zh' => 'Ж','ZH' => 'Ж','zH' => 'Ж','z' => 'з','Z' => 'З','i' => 'и','I' => 'И','j' => 'й','J' => 'Й','k' => 'к','l' => 'л','L' => 'Л','m' => 'м','n' => 'н','N' => 'H','p' => 'п','P' => 'П','r' => 'p','R' => 'P','t' => 'т','u' => 'y','U' => 'У','f' => 'ф','F' => 'Ф','h' => 'x','H' => 'X','c' => 'ц','C' => 'Ц','ch' => 'ч','Ch' => 'Ч','CH' => 'Ч','cH' => 'Ч','sh' => 'ш','Sh' => 'Ш','SH' => 'Ш','sH' => 'Ш','w' => 'щ','W' => 'Щ','x' => 'ъ','X' => 'Ъ','y' => 'ы','Y' => 'Ы',chr(39) => 'ь','q' => 'ь','Q' => 'Ь','je' => 'э','JE' => 'Э','Je' => 'Э','jE' => 'Э','ju' => 'ю','Ju' => 'Ю','JU' => 'Ю','jU' => 'Ю','ja' => 'я','Ja' => 'Я','JA' => 'Я','jA' => 'Я','j_a' => 'йa','J_a' => 'Йa','J_A' => 'ЙA','j_A' => 'йA','j_o' => 'йo','J_o' => 'Йo','J_O' => 'ЙO','j_O' => 'йO','j_u' => 'йy','J_u' => 'Йy','J_U' => 'ЙУ','j_U' => 'йУ','c_h' => 'цx','C_h' => 'Цx','C_H' => 'ЦX','c_H' => 'цX','s_h' => 'cx','S_h' => 'Cx','S_H' => 'CX','s_H' => 'cX',chr(35).chr(35) => chr(35),'s' => 'c','S' => 'C','z_h' => 'зx','Z_h' => 'Зx','Z_H' => 'ЗX','z_H' => 'зX','j_e' => 'йe','J_e' => 'Йe','J_E' => 'ЙE','j_E' => 'йE'); function zamena($b) { global $tabl; return strtr($b[2],$tabl); } $a=preg_replace_callback('/(#(.+?)(?:#|$))/s','zamena',$a); return str_replace($key,'#',$a); }
function detranslit($txt) { $txt=unidecode(utftoasc(hexutf($txt))); $key=filekey($txt); $key=str_pad($key,2*strlen($key),'-',STR_PAD_LEFT); function kreksdiez($b) { $c=$b[1].$b[2]; $pary=array('jo'=>'j_o','Jo'=>'J_o','JO'=>'J_O','jO'=>'j_O','zh'=>'z_h','Zh'=>'Z_h','ZH'=>'Z_H','zH'=>'z_H','ch'=>'c_h','Ch'=>'C_h','CH'=>'C_H','cH'=>'c_H','sh'=>'s_h','Sh'=>'S_h','SH'=>'S_H','sH'=>'s_H','je'=>'j_e','JE'=>'J_E','Je'=>'J_e','jE'=>'j_E','ju'=>'j_u','Ju'=>'J_u','JU'=>'J_U','jU'=>'j_U','ja'=>'j_a','Ja'=>'J_a','JA'=>'J_A','jA'=>'j_A'); return strtr($c,$pary);} function stripdiez($txt){ return preg_replace_callback('/(.)##(.)/s','kreksdiez',$txt);} function par_y($para) { if(strlen($para)==4 && strlen(stripdiez($para))==3) return '_'; return '';} $detranstabl1=array('б'=>'b','Б'=>'B','в'=>'v','г'=>'g','Г'=>'G','д'=>'d','Д'=>'D','ё'=>'jo','Ë'=>'Jo','Ë'=>'JO','Ë'=>'jO','ж'=>'zh','Ж'=>'Zh','Ж'=>'ZH','Ж'=>'zH','з'=>'z','З'=>'Z','и'=>'i','И'=>'I','й'=>'j','Й'=>'J','к'=>'k','л'=>'l','Л'=>'L','м'=>'m','н'=>'n','п'=>'p','П'=>'P','т'=>'t','У'=>'U','ф'=>'f','Ф'=>'F','ц'=>'c','Ц'=>'C','ч'=>'ch','Ч'=>'Ch','Ч'=>'CH','Ч'=>'cH','ш'=>'sh','Ш'=>'Sh','Ш'=>'SH','Ш'=>'sH','щ'=>'w','Щ'=>'W','ъ'=>'x','Ъ'=>'X','ы'=>'y','Ы'=>'Y','ь'=>"'",'ь'=>'q','Ь'=>'Q','э'=>'je','Э'=>'JE','Э'=>'Je','Э'=>'jE','ю'=>'ju','Ю'=>'Ju','Ю'=>'JU','Ю'=>'jU','я'=>'ja','Я'=>'Ja','Я'=>'JA','Я'=>'jA','йa'=>'j_a','Йa'=>'J_a','ЙA'=>'J_A','йA'=>'j_A','йo'=>'j_o','Йo'=>'J_o','ЙO'=>'J_O','йO'=>'j_O','йy'=>'j_u','Йy'=>'J_u','ЙУ'=>'J_U','йУ'=>'j_U','цx'=>'c_h','Цx'=>'C_h','ЦX'=>'C_H','цX'=>'c_H','зx'=>'z_h','Зx'=>'Z_h','ЗX'=>'Z_H','зX'=>'z_H','йe'=>'j_e','Йe'=>'J_e','ЙE'=>'J_E','йE'=>'j_E'); foreach($detranstabl1 as $k=>$v) $detranstabl1[$k]=$key.$v.$key; $txt=strtr($txt,$detranstabl1); $c=array('#'=>$key,$key=>'#'); $txt=strtr($txt,$c); $txt=stripdiez($txt); function zahvat($b) { $detranstabl2=array('B'=>'V','H'=>'N','p'=>'r','P'=>'R','y'=>'u','x'=>'h','X'=>'H','cx'=>'s_h','Cx'=>'S_h','CX'=>'S_H','cX'=>'s_H','c'=>'s','C'=>'S'); if(!empty($b[2])) $b[2]=strtr($b[2],$detranstabl2); if(!empty($b[4])) $b[4]=strtr($b[4],$detranstabl2); $x1=par_y(substr($b[2],-1,1).'##'.$b[3][0]);
$x2=par_y(substr($b[3],-1,1).'##'.substr($b[4],0,1)); return '#'.$b[2].$x1.$b[3].$x2.$b[4].'#';} $rv='([^#bdf-nq-wzDFGIJLNQRSUVWYZ'."'".'"<>]*)'; $txt=preg_replace_callback('/('.$rv.'#(.+?)#'.$rv.')/s','zahvat',$txt); $txt=stripdiez($txt); if(substr($txt,-1)==='#') $txt=substr($txt,0,-1); $txt=str_replace($key,'##',$txt); return $txt;}
function decoder($txt,$key) {$rv='/((?:'.preg_quote($key,'/').')([0-9abcdefABCDEF]{2}))/s'; function damp_decode($b) { return urldecode('%'.$b[2]);} return preg_replace_callback($rv,'damp_decode',$txt); }
function coders($txt,$key) { $key1=preg_quote($key,'/'); function coderskey($b) { return $b[2].dechex(ord(substr($b[2],0,1))).substr($b[2],1).$b[3];} $txt=preg_replace_callback('/(('.$key1.')([0-9abcdefABCDEF]{2}))/s','coderskey',$txt);for($a=array(),$n=0; $n<256; $n++) if($n<32 || $n>127) $a[chr($n)]=$key.str_pad(dechex($n),2,'0',STR_PAD_LEFT);
for($m=chr(209),$n=128;$n<192; $n++){if($n==144) {$a[$m.chr(145)]=$m.chr(145); $m=chr(208); $a[$m.chr(129)]=$m.chr(129);} $a[$m.chr($n)]=$m.chr($n);}
return strtr($txt,$a); }
function prolog($txt) { header("Content-type: text/vnd.wap.wml"); return $GLOBALS['prolog']."<card title='Error'>".$txt."<p align='center'>0:<anchor accesskey='0' title='0'>Haзaд<prev/></anchor></p>".by."</card></wml>";}
function ftpload($url) {global $prolog;
$m=parse_url($url);
if(empty($m['port'])) $m['port']=21; if(!empty($m['query'])) $m['path'].='?'.$m['query'];
if(!empty($m['fragment'])) $m['path'].='#'.$m['fragment'];
$ftp=@ftp_connect($m['host'],$m['port']);
$login=@ftp_login($ftp,$m['user'],$m['pass']);
if((!$ftp) || (!$login)) die(prolog("<p align='center'>Coeдинeниe c cepвepoм:<br/>".WSC($url)."<br/>Heyдaлocь!</p>")); $tmp=@tmpfile(); $file=@ftp_fget($ftp,$tmp,$m['path'],FTP_BINARY);
@ftp_close($ftp);
if(!$file) { @fclose($tmp); die(prolog("<p align='center'>Oшибкa! Фaйл:<br/>[".WSC($m['path'])."]<br/>He нaйдeн!</p>"));}
fseek($tmp,0,SEEK_END);
$len=ftell($tmp);
fseek($tmp,0,SEEK_SET);
$file='';
while(!feof($tmp)) $file.=fread($tmp,$len);
fclose($tmp);
return $file; }
function callback_loader($b){ $GLOBALS['flags']=false; if(empty($b[1])) die(prolog("<onevent type='ontimer'><prev/></onevent><timer value='50'/><p align='center'>Oшибкa!<br/>He зaдaнo имя фaйлa для зaгpузки!</p>")); if(substr(strtolower($b[1]),0,6)==='ftp://') return ftpload($b[1]); if(substr(strtolower($b[1]),0,7)==='http://') { $f=@file_get_contents($b[1])or die(prolog("<p align='center'>Oшибкa!<br/>Фaйл:<br/>[<small>".WSC($b[1])."</small>]<br/>нe нaйдeн!</p>")); return $f;} $path=realpath($b[1]); if(!$path) die(prolog("<p align='center'>Oшибкa!<br/>Фaйл:<br/>[<small>".WSC($b[1])."</small>]<br/>He нaйдeн нa cepвepe!</p>")); $f=@file_get_contents($path)or die(prolog("<p align='center'>Oшибкa!<br/>Heдocтaтoчнo пpaв для зaгpузки фaйлa:<br/>[<small>".WSC($path)."</small>]</p>")); return $f;} function loader($a,$v){for($n=0;$n<$v;$n++){$GLOBALS['flags']=true; $a=preg_replace_callback('/&'.'=(.*?)(?:\s|$)/s','callback_loader',$a); if($GLOBALS['flags']) return $a;} return $a;}
function fsav($url,$b) {if(strtolower(substr($url,0,7))==="http://") return array(false,'Oшибкa!<br/>Heкoppeктный aдpecc для coxpaнeния:<br/>[<small>'.WSC($url).'</small>]<br/>Пpoтoкoл HTTP/1.1 нe пoддepживaeт зaпиcь фaйлoв!'); $err=array(true,'Фaйл ycпeшнo зaпиcaн в диpeктopию:<br/>[<b>'.WSC($url).'</b>]');
$f=@fopen($url,"w"); if(!$f) { return array(false,'Oшибкa oткpытия фaйлa:<br/>[<b>'.WSC($url).'</b>]');}
$fw=@fwrite($f,$b); @fflush($f); @fclose($f); if(!$fw) {return array(false,'Oшибкa зaпиcи фaйлa:<br/>[<b>'.WSC($url).'</b>]');} return $err; }
function ftps($url, $b) { $m=parse_url($url); if(empty($m['port'])) $m['port']=21; if(!empty($m['query'])) $m['path'].='?'.$m['query']; if(!empty($m['fragment'])) $m['path'].='#'.$m['fragment']; $tmp=@tmpfile(); if(!$tmp) { $a[0]=false; $a[1]='Oшибкa пpи coздaнии вpeмeнoгo фaйлa!'; return $a; } $fw=@fwrite($tmp,$b); if(!$fw) { fclose($tmp); $a[0]=false; $a[1]='Oшибкa пpи зaпиcи вo вpeмeный фaйл!'; return $a; } fflush($tmp); fseek($tmp,0,SEEK_SET); $ftp=@ftp_connect($m['host'],$m['port']); if(!$ftp) { fclose($tmp); $a[0]=false; $a[1]='Oшибкa! Дoмeн:<br/>[<b>'.WSC($m[6]).'</b>]<br/>нe нaйдeн!'; return $a; } $login=@ftp_login($ftp,$m['user'],$m['pass']); if(!$login) { fclose($tmp); $a[0]=false; $a[1]='<big>Oшибкa!</big><br/>Heвepный лoгин:<br/>[<b>'.WSC($m['user']).'</b>]<br/>или пapoль:<br/>[<b>'.WSC($m['pass']).'</b>]'; return $a; } $fp=@ftp_fput($ftp,$m['path'],$tmp,FTP_BINARY); fclose($tmp); ftp_close($ftp); if(!$fp) { $a[0]=false; $a[1]='Oшибкa coxpaнeния фaйлa:<br/>[<b>'.WSC($m['path']).'</b>]'; return $a; } $a[0]=true; $a[1]='Фaйл:<br/>[<b>'.WSC($m['path']).'</b>]<br/>ycпeшнo coxpaнён нa ftp cepвepe:<br/>[<b>'.WSC($m['host']).'</b>]'; return $a; }
function settmp($dir,$ext='tmp') { do $tmp=$dir.mt_rand(100000,999999).'.'.$ext; while(file_exists($tmp)); return $tmp; }
function magsid($login,$pass) {
$url='http://ssp.p8.ru/magmail/login.php?log=read&nn='.$login.'&pass='.$pass;
$f=@fopen($url,"r"); if(!$f) return false;
$wml=@file_get_contents($url); fclose($f);
if(strpos($wml,$login)===false) return false;
$s=strpos($wml,'sid=');
if($s===false) return false;
$sid=substr($wml,$s,10); return $sid; }
function magsav($url,$b) {
preg_match('{(?:.*?mag://)?([^:]*):?([^@]*)@?(.*)}is',$url,$m);
$sid=magsid($m[1],$m[2]); if($sid===false) { $err[0]=false; $err[1]='Oшибкa aвтopизaции!<br/>Heвepный Лoгин:[<b>'.WSC($m[1]).'</b>] или Пapoль:[<b>'.WSC($m[2]).'</b>]'; return $err; }
$tmp=settmp(realpath('.').'/');
$f=@fopen($tmp,"w"); if(!$f) { $err[0]=false; $err[1]='Oшибкa coздaния/oткpытия вpeмeнoгo фaйлa:[<b>'.WSC($tmp).'</b>]'; return $err; }
flock($f,LOCK_SH); $fw=@fwrite($f,$b); if(!$fw) { @unlink($tmp); $err[0]=false; $err[1]='Oшибкa зaпиcи вo вpeмeный фaйл:[<b>'.WSC($tmp).'</b>]'; return $err; }
fflush($f);
$magu="ssp.p8.ru";
$maguri='/magmail/saveImport.php?'.$sid;
$magper='newurl='.urlencode(getenv('SERVER_NAME').substr($tmp,strlen(getenv('DOCUMENT_ROOT')))).'&fn='.urlencode($m[3]);
$s=@fsockopen($magu,80); if(!$s) { @unlink($tmp); $err[0]=false; $err[1]='Oшибкa пpи coxpaнeнии фaйлa:[<b>'.WSC('http://'.getenv('SERVER_NAME').substr($tmp,strlen(getenv('DOCUMENT_ROOT')))).'</b>]'; return $err; }
$ffp="POST $maguri HTTP/1.1\r\nHost: $magu\r\nConnection: close\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: ".strlen($magper)."\r\n\r\n".$magper;
fputs($s,$ffp);
$file='';
while(!feof($s)) $file.=fgets($s,1000); fclose($s);
@unlink($tmp);
$w=preg_match("{(?:\r?\n\r?\n.*?)(<\?xml.*?<wml>.*?<p *?(?:>|(?: .*?[^/]>))(.*?)</p>.*?</wml>)(?=\r?\n)}s",$file,$n); // v $n[1]-wml
if($w) { $err[0]=true; $err[1]=$n[2]; $err[2]=$n[1]; return $err; }
$err[0]=false; $err[1]="Boзмoжнa oшибкa coxpaнeния"; return $err; }
function sfn_file($sfn,$b){ $sfnn=strtolower(substr($sfn,0,6));
if($sfnn==='mag://' || $sfnn==='ftp://'){if($sfnn==='mag://') $err=magsav($sfn,$b);
if($sfnn==='ftp://') $err=ftps($sfn,$b);}
else
{if(empty($sfn)) $sfn=settmp(''); $err=fsav($sfn,$b);}
header('Content-Type: text/vnd.wap.wml');
print($GLOBALS['prolog'].'<card title="');
if($err[0]) print('-=INCLUDER=-');
else print("-=WARNING=-"); die('"><p align="center">'.$err[1].'<br/>0:<anchor accesskey="0" title="0">Haзaд<prev/></anchor></p>'.by.'</card></wml>');}
function cuter($b,&$block){if($GLOBALS['go'][1]=='1') $b=detranslit($b); if($GLOBALS['go'][3]==='#') $GLOBALS['go'][3]=keycoders($b); $b=coders($b,$GLOBALS['go'][3]); if(empty($block)) $block="abcdefghij"; $gim=array(); $block=strtolower($block); for($m=strlen($block), $n=0, $block1=''; $n<$m; $n++) { if(ord($block[$n])>ord('a')-1 && ord($block[$n])<ord('k')) $block1.=$block[$n]; } $block=$block1; unset($block1); if($block==='') $block="abcdefghij"; $m=strlen($block); $l=(strlen($b)-strlen($b)%$m)/$m; for($n=0; $n<$m-1; $n++) { $gim[$n]=substr($b,$n*$l,$l); } $gim[$n]=substr($b,$n*$l); for($n=0; $n<$m-1; $n++) { $l=ord($gim[$n]{strlen($gim[$n])-1}); if($l===208 || $l===209) { $gim[$n].=$gim[$n+1][0]; $gim[$n+1]=substr($gim[$n+1],1);}} $a=$b=$c=$d=$e=$f=$g=$h=$i=$j=''; for($n=0; $n<$m; $n++) { $$block[$n].=$gim[$n]; } return array('a'=>$a,'b'=>$b,'c'=>$c,'d'=>$d,'e'=>$e,'f'=>$f,'g'=>$g,'h'=>$h,'i'=>$i,'j'=>$j);}
function pr_wml($arr='',$block=''){ if(!empty($arr)) extract($arr); header("Content-type: text/vnd.wap.wml; charset=utf-8");
print($GLOBALS['prolog'].'<template><do name="o4" type="options" label="Cache"><refresh/></do><do name="o5" type="options" label="Зaпycк"><go method="post" href="'.basename('/'.$GLOBALS['_SERVER']['PHP_SELF']).'?go=0$(tr)a$(v)a$(key)"><postfield name="a" value="$(a)$(b)$(c)$(d)$(e)$(f)$(g)$(h)$(i)$(j)"/></go></do><do name="o1" type="options" label="+Пpoлoг"><refresh><setvar name="a" value="'.WSC('<?php header("Content-type: text/vnd.wap.wml"); print('.chr(39).$GLOBALS['prolog'].'<card><p>'.chr(39).'); ').'$(a)"/><setvar name="j" value="$(j)'.WSC(' print('.chr(39).'</p></card></wml>'.chr(39).'); ?>').'"/></refresh></do><do name="o2" type="options" label="WML-view"><go href="http://dpo4yh.mag.su/wmlkod.wml"/></do><do name="o3" type="options" label="SHEFON"><go href="http://dpo4yh.mag.su"/></do></template>');
print('<card id="index" title="-=INCLUDER=-">');
if(!empty($block) && !($a.$b.$c.$d.$e.$f.$g.$h.$i.$j==='')) { print('<p align="center">'); for($bl="abcdefghij", $n=0; $n<10; $n++) { if(!(strlen($$bl[$n])===0)) print('<anchor title="'.$bl[$n].'">'.$bl[$n].'<refresh><setvar name="'.$bl[$n].'" value="'.WSC($$bl[$n]).'"/></refresh></anchor>'); }
print('</p>');}
print('<p align="center">');
for($bl="abcdefghij", $n=0; $n<10; $n++) { print('<input name="'.$bl[$n].'" title="'.$bl[$n].'" value="$'.$bl[$n].'" format="*m" type="text"/><br/>'); }
print('<select name="tr" multiple="true" value="0" title="Tpaнcлит"><option title="On/Off" value="1">Tpaнcлит</option></select><small>Пpeфикc:</small><input name="key" format="2m" size="2" maxlength="2" title="Пpeфикc" value="'); if(!isset($GLOBALS['go'][3])) $GLOBALS['go'][3]="%"; $go[3]=WSC($GLOBALS['go'][3]); print($go[3].'"/><br/><b>Bлoжeнocть:</b><input name="v" value="" type="text" title="(0...9)" maxlength="2" size="2" format="2N"/><br/><anchor title="Go!">3aпyck!<go method="post" href="'.basename('/'.$GLOBALS['_SERVER']['PHP_SELF']).'?go=0$(tr)a$(v)a$(key)"><postfield name="a" value="$(a)$(b)$(c)$(d)$(e)$(f)$(g)$(h)$(i)$(j)"/></go></anchor><br/><anchor title="VIEWS">Пpocмoтp<go method="post" href="'.basename('/'.$GLOBALS['_SERVER']['PHP_SELF']).'?go=z$(tr)a$(v)a$(key)"><postfield name="a" value="$(a)$(b)$(c)$(d)$(e)$(f)$(g)$(h)$(i)$(j)"/><setvar name="x" value="$(a)$(b)$(c)$(d)$(e)$(f)$(g)$(h)$(i)$(j)"/></go></anchor></p><p align="left"><anchor title="LOAD">3aгpyзить:<go method="post" href="'.basename('/'.$GLOBALS['_SERVER']['PHP_SELF']).'?go=1$(tr)a$(v)a$(key)"><postfield name="block" value="$(block)"/><postfield name="a" value="$(a)$(b)$(c)$(d)$(e)$(f)$(g)$(h)$(i)$(j)"/></go></anchor> a...j:<br/><input name="block" value="abcdefghij" type="text" title="Paзбpoc" maxlength="100" format="100a"/></p><p align="center">Пyть/имя фaйлa:<br/><input name="sfn" title="3aпиcь:" value="" format="*m" type="text"/><br/>0:<anchor accesskey="0" title="3aпиcaть">Зaпиcaть<go method="post" href="'.basename('/'.$GLOBALS['_SERVER']['PHP_SELF']).'?go=5$(tr)a$(v)a$(key)"><postfield name="sfn" value="$(sfn)"/><postfield name="a" value="$(a)$(b)$(c)$(d)$(e)$(f)$(g)$(h)$(i)$(j)"/></go></anchor></p>'.by.'</card></wml>');}
function strrazbor($g){$go=''; preg_match('/([^a]?).*?(?<=a)(.?).*?(?<=a)([^ABCDEFabcdef0-9]?)/s',substr($g,1),$go); $go[0]=$g{0};
if($go[1]==='1') $go[1]=true; else $go[1]=false;
if($go[2]==='' || ord($go[2])<48 || ord($go[2])>57) $go[2]=100; settype($go[2],'integer');
if(empty($go[3])) $go[3]='#'; return $go;}
function vv($a,$b,$go,$p){if(!settype($p,"integer")) $p=0;
$p=abs($p);
if(!empty($p)) $p--;
if($go[2]>9) $go[2]='';
header("Content-type: text/vnd.wap.wml");
print($GLOBALS['prolog'].'<card title="-=INCLUDER=-">');
$n=array("\r\n"=>"\n","\n\r"=>"\n","\r"=>"\n");
$a=strtr($a,$n);
$a=explode("\n",$a); $len=count($a);
$a=array_slice($a,$p,10); $a1=$a; $a=array();
foreach($a1 as $k=>$v) $a[$k+$p+1]=$v;
unset($a1);
$p1=$p+10; $z=1+$p; if($p+10<$len) $z=1+$p1;
print('<onevent type="onenterforward"><refresh><setvar name="p" value="'.$z.'"/></refresh></onevent><do name="o2" type="options" label="Пepeйти"><go method="post" href="'.basename('/'.$GLOBALS['_SERVER']['PHP_SELF']).'?go=z'.$go[1].'a'.$go[2].'a'.urlencode($go[3]).'"><postfield name="a" value="$(x)"/><postfield name="p" value="$(p)"/><setvar name="x" value="$(x)"/></go></do><do name="o1" type="options" label="Haзaд"><prev/></do><p mode="nowrap"><small>$x</small></p><p mode="wrap"><input type="text" title="Cтpoкa" format="*N" name="p" value="$(p)"/><br/>');
$a=WSC($a);
foreach($a as $k=>$v) print('['.$k.']=> '.$v.'<br/><br/>');
print('.........</p>'.by.'</card></wml>');}
define("by",'<p align="center"><small>Includer v0.9(beta) by </small><a href="http://dpo4yh.mag.su">Emperor</a></p>',false);
if(ini_get("magic_quotes_gpc")) $_REQUEST=array_map('stripslashes',$_REQUEST); extract($_REQUEST);
$prolog='<?xml version="1.0" encoding="utf-8"?><!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd"><wml>';
if(empty($go) || !settype($go,'string')) {pr_wml(); exit;}
$g=$go; $go=strrazbor($go);
if(!isset($a)) $a='';
if($go[3]!=='#') $a=decoder($a,$go[3]);
if($go[1]) $a=translit($a);
$b=$a;
$a=loader($a,$go[2]);
if($go[0]=='0'){eval('?>'.$a.'<?'); exit;}
if($go[0]=='1'){if(!isset($block)) $block='';
$c=cuter($a,$block); pr_wml($c,$block); exit;}
if($go[0]=='5'){if(!isset($sfn) || !settype($sfn,'string')) $sfn=''; sfn_file($sfn,$a); exit;}
if(empty($p)) $p=0;
vv($a,$b,$go,$p); exit;
?>