Просмотр файла valid/validator.php

Размер файла: 6.98Kb
яю<?

#-----------------------------------------------------#

#          ********* WAP-MOTORS *********             #

#             Made by   :  DARK-STAR_MC               #

#               E-mail  :  johnxcms@ya.ru             #

#             WAP-Site  :  http://homephp.ru          #

#                  ICQ  :  74-756-67                  #

#  K =5 8<55B5 ?@02> 2=>A8BL 87<5=5=8O 2 :>4 A:@8?B0 #

#        4;O 53> 40;L=59H53> @0A?@>AB@0=5=8O          #

#-----------------------------------------------------#

require_once "../includes/start.php";

require_once "../includes/functions.php";

require_once "../includes/header.php";

include_once "../themes/".$config['themes']."/index.php";



echo '<img src="../images/img/partners.gif" alt="image" /> <b>XML 0;840B>@</b><br /><br />';



if(!$_GET['source'])

{

switch($_GET['go'])

{

default:

print '<div class="w2">XML 0;840B>@<br/></div>

<div class="input">

<form action="?" method="get">

<div>

4@5A<br/>

<input type="text" name="source" value="http://"/><br/>

<input type="submit" value="@>25@8BL"/>

</div>

</form>

</div>

<div class="border">

<a href="?go=faq">FAQ</a><br/>

</div>';

break;



case 'faq':

print '<div>

-! ?><>ILN 40==>3> A5@28A0 2K <>65B5 ?@>25@8BL A2>8 AB@0=8FK =0 A>>B25BAB285 XML AB0=40@B0<.<br/>

-WML 8 xHTML AB@0=8FK 1O70B5;L=> 4>;6=K A>>B25BAB2>20BL AB0=40@B0< XML. HTML =5 B0: B@51>20B5;5=, >4=0:> ;8H=8< B0:>5 A>>B25BAB285 =5 1C45B.<br/>

</div>';

break;

}



}

else

{

$source = rawurldecode(trim($_GET['source']));



if(ereg("^(http:\/\/)+[a-zA-Z_0-9/.&=?-]+$",$source))

{

function validator($current)

{

global $lng;

$data = @fopen($current,'r');

if(!$data)

{return '<div class="red">5 C40;>AL ?@>25@8BL C:070==K9 04@5A<br/></div>';}

ini_set('user_agent',$_SERVER['HTTP_USER_AGENT']);

$fl = file_get_contents($current);

$xml_parser = xml_parser_create();

if(!xml_parse($xml_parser, $fl, feof($data)))

{

$err = xml_error_string(xml_get_error_code($xml_parser));

$line = xml_get_current_line_number($xml_parser);

$column = xml_get_current_column_number($xml_parser);

xml_parser_free($xml_parser);

fclose($data);

return '<div class="red">Error [Line '.$line.', Column '.$column.']: '.$err.'<br/></div>'.code($fl,$line);

}

else

{

xml_parser_free($xml_parser);

return '<div class="red">>:C<5=B !>>B25BAB2C5B XML @028;0<<br/></div>'.code($fl,0);

}

}



function url_highlight($fl)

{return '<code>'.nl2br(preg_replace("~(&quot;|&#039;)[^<>]*(&quot;|&#039;)~iU",'<span style="color:#DD0000">\\0</span>',preg_replace("~&lt;!--.*--&gt;~iU",'<span style="color:#FF8000">\\0</span>',preg_replace("~(&lt;[^\s!]*\s)([^<>]*)([/?]?&gt;)~iU",'\\1<span style="color:#007700">\\2</span>\\3',preg_replace("~&lt;[^<>]*&gt;~iU",'<span style="color:#0000BB">\\0</span>',htmlspecialchars($fl,ENT_QUOTES)))))).'</code>';}





function code($fl,$line)

{

if(substr_count($fl,"\r") > 2)

{$arr = split("\r",url_highlight(str_replace("\n",null,$fl)));}

else

{$arr = split("\n",url_highlight($fl));}



$end = sizeof($arr);

for($i=0; $i<$end; $i++)

{

if($i == ($line-1))

{$page.= '<span class="fail_code">&#160;'.($i+1).'&#160;</span> '.$arr[$i];}

else

{$page.= '<span class="true_code">'.($i+1).'</span> '.$arr[$i];}

}

return '<div class="code">'.$page.'</div>';

}



print validator($source);



}

else

{print '<div class="red">2545= =5 25@=K9 04@5A<br/></div>';}

}



echo '<img src="../images/img/homepage.gif" alt="image" /> <a href="../index.php?'.SID.'">0 3;02=CN</a> ';

include_once "../themes/".$config['themes']."/foot.php";

?>