<?php
/*
Запрещается убирать копирайт для дальнейшего распространения скрипта!
////
Автор: Proton
E-mail: [email protected]
icq_uin: 8059371
wap_site: http://svoboda.v1p.su
*/
// Функция перекодировки с windows-1251 в utf-8
function win_to_utf($text)
{
$text=iconv('windows-1251','utf-8',$text);
return $text;
}
// Функция обработки с web в wap и обрезка переносов с тегов
function pages($text)
{
$text=explode('<!--CONTENT_OF_PAGE-->
',$text);
$text=$text[1];
$text=explode('<!--EOF_CONTENT_OF_PAGE-->
',$text);
$text=$text[0];
$text=preg_replace('|<script(.*)</script>|Uis','',$text);
$text=str_replace("\r\n","",$text);
$text=str_replace("\r","",$text);
$text=str_replace("\n","",$text);
return $text;
}
// Функция обработки ссылок и тегов
function obrezka($text)
{
$text=str_replace("<BR>","<br/>\r\n",$text);
$text=str_replace("<BR/>","<br/>\r\n",$text);
$text=str_replace("<BR />","<br/>\r\n",$text);
$text=str_replace("<br>","<br/>\r\n",$text);
$text=str_replace("<br />","<br/>\r\n",$text);
$text=str_replace("<br/>","<br/>\r\n",$text);
$text=str_replace("</H1>","</H1>\r\n",$text);
$text=preg_replace('|<!--(.*)-->|Uis','',$text);
$text=preg_replace('|<a style="(.*)"> </a><br/>|Uis','',$text);
$text=str_replace('<AHREF','<a href',$text);
$text=str_replace('<A HREF','<a href',$text);
$text=str_replace('<A href','<a href',$text);
$text=str_replace('</A>','</a>',$text);
$text=str_replace('<ANAME','<a name',$text);
$text=str_replace('<A NAME','<a name',$text);
$text=str_replace('<H1 STYLE','<h1 style',$text);
$text=str_replace('<H2 STYLE','<h2 style',$text);
$text=str_replace('<H3 STYLE','<h3 style',$text);
$text=str_replace('<H4 STYLE','<h4 style',$text);
$text=str_replace('</H1>','</h1>',$text);
$text=str_replace('</H2>','</h2>',$text);
$text=str_replace('</H3>','</h3>',$text);
$text=str_replace('</H4>','</h4>',$text);
$text=str_replace('<B','<b',$text);
$text=str_replace('</B>','</b>',$text);
$text=str_replace('<P','<p',$text);
$text=str_replace('</P>','</p>',$text);
$text=str_replace('<TT>','<tt>',$text);
$text=str_replace('</TT>','</tt>',$text);
$text=str_replace('<I>','<i>',$text);
$text=str_replace('</I>','</i>',$text);
$text=str_replace('<center></center>','',$text);
$text=str_replace('</index>','',$text);
$text=str_replace('/functions/','',$text);
$text=str_replace(' ','',$text);
$text=str_replace(' TARGET="_BLANK"','',$text);
$text=str_replace('TARGET="_BLANK"','',$text);
$text=str_replace(' target="_blank"','',$text);
$text=str_replace('TABLE','table',$text);
$text=str_replace('WIDTH','width',$text);
$text=str_replace('BORDER','border',$text);
$text=str_replace('TR','tr',$text);
$text=str_replace('TD','td',$text);
$text=str_replace('<DL>','<dl>',$text);
$text.='<center>
<a href="/">'.$_SERVER['HTTP_HOST'].'</a><br/></center>
<center>
<a href="http://svoboda.v1p.su/">© Свобода</a><br/></center>';
$text=str_replace('CLASS=','class=',$text);
$text=str_replace('<DT','<dt',$text);
$text=str_replace('</DT>','</dt>',$text);
$text=str_replace('</DL>','</dl>',$text);
$text=str_replace('<DIV','<div',$text);
$text=str_replace('</DIV>','</div>',$text);
$text=str_replace('<DD>','<dd>',$text);
$text=str_replace('</DD>','</dd>',$text);
$text=str_replace('<VAR','<var',$text);
$text=str_replace('</VAR>','</var>',$text);
$text=str_replace('<COL >','<col>',$text);
$text=str_replace('<THEAD','<thead',$text);
$text=str_replace('</THEAD>','</thead>',$text);
$text=str_replace('<TH>','<th>',$text);
$text=str_replace('</TH>','</th>',$text);
$text=str_replace('<TBODY>','<tbody>',$text);
$text=str_replace('</TBODY>','</tbody>',$text);
$text=str_replace('<BLOCKQUOTE>','<blockquote>',$text);
$text=str_replace('</BLOCKQUOTE>','</blockquote>',$text);
$text=str_replace(' TARGET="_top"','',$text);
$text=str_replace(' TARGET="_TOP"','',$text);
$text=str_replace(' target="_top"','',$text);
$text=str_replace('/learnphp/datatypes/','learnphp_datatypes.php',$text);
$text=str_replace('</CODE>','</code>',$text);
$text=str_replace('<CODE>','<code>',$text);
$text=str_replace('<SPAN','<span',$text);
$text=str_replace('</SPAN>','</span>',$text);
$text=str_replace('COLOR:','color:',$text);
$text=str_replace('<UL','<ul',$text);
$text=str_replace('<LI>','<li>',$text);
$text=str_replace('</UL>','</ul>',$text);
$text=str_replace('</LI>','</li>',$text);
$text=str_replace('MARGIN:','margin:',$text);
$text=str_replace('<a href=""','<a href="?"',$text);
$text=str_replace('/prepare/','prepare.php',$text);
$text=str_replace('/php/intro/','php_intro.php',$text);
$text=str_replace('/learnphp/vars/','learnphp_vars.php',$text);
$text=str_replace('/learnphp/operators/','learnphp_operators.php',$text);
$text=str_replace('/learnphp/cs/','learnphp_cs.php',$text);
$text=str_replace('/learnphp/','learnphp.php',$text);
$text=str_replace('custom/','custom.php',$text);
$text=str_replace('/security/','security.php',$text);
$text=str_replace('/phphttp/','phphttp.php',$text);
$text=str_replace('PHP.SU',$_SERVER['HTTP_HOST'],$text);
$text=str_replace(' ',' ',$text);
$text=str_replace('<hr><hr>','',$text);
$text=str_replace('ALIGN=','align=',$text);
$text=str_replace('CENTER','center',$text);
$text=str_replace('LEFT','left',$text);
$text=str_replace('bLOCKQUOTE','blockquote',$text);
$text=str_replace(' ',' ',$text);
$text=str_replace("{"," { \r\n",$text);
$text=str_replace("}","} \r\n",$text);
$text=str_replace(";",";\r\n",$text);
$text=str_replace("<\r\n","<",$text);
$text=str_replace(">\r\n",">",$text);
$text=str_replace("<\r\n","<",$text);
$text=str_replace(">\r\n",">",$text);
$text=str_replace(""\r\n",""",$text);
$text=str_replace("&\r\n","&",$text);
$text=str_replace(""\r\n",""",$text);
$text=str_replace("<?php","<?php\r\n",$text);
$text=str_replace("</PRE>","</pre>",$text);
$text=str_replace("<pRE>","<pre>",$text);
$text=str_replace("CELLPADDING","cellpadding",$text);
$text=str_replace("CELLSPACING","cellspacing",$text);
$text=str_replace("BGCOLOR","bgcolor",$text);
return $text;
}
?>