View file dportal_0.2/bibl/read.php

File size: 4.21Kb
<?
include 'dan.php';

/*
		by Dionisij (c) 2006
		[email protected]
		Скрипт не предназначен для продажи!
		При распространении необходимо обговорить условия распространения с автором скрипта.
		Нарушение авторских прав преследуется по закону и по понятиям!
*/

include 'ver.php';

if($pa=="" || $pa<=0){$pa=1;}

$ar_text=@file("$raz/$text.dat");
if(!$ar_text){$zag="Ошибка"; $ar_text[0]="Ошибка"; $ar_text[1]="Статья не найдена.";}
else{
$ar_text[0]=trim($ar_text[0]);
$ar_text[1]=trim($ar_text[1]);
$ar_text[1]=str_replace("[br]", "<br/>", "$ar_text[1] ");
if($ver=="wml"){$ar_text[1]=str_replace("$", "$$", $ar_text[1]);}
$strrpos=strrpos($ar_text[1], " ");
$pages=1;
$t_si=0;
while($t_si<$strrpos){

	$string = substr($ar_text[1], $t_si, $simvol);
	$t_ki=strrpos($string, " ");
	$m_sim=$t_ki;
	$strings[$pages] = substr($string, 0, $m_sim);
	$t_si=$t_ki+$t_si;
	if($pa==$pages){$page_text=$strings[$pages];}
	if($strings[$pages]==""){$t_si=$strrpos++;}
	else{$pages++;}
	
	
	
	}
}

if($pa>=$pages){$pa=$pages-1; $page_text=$strings[$pa];}

$zag= substr($ar_text[0], 0, 30);
$strrpos=strrpos($zag, " ");
$zag=substr($ar_text[0], 0, $strrpos);
if($zag==""){$zag=$ar_text[0];} else {$zag="$zag...";}
$zag="$zag ($pa)";

$trans1= array("– ","«","»","“","”","…","—");
$trans2= array(" - ","\"","\"","\"","\"","...","-");
$page_text=str_replace($trans1,$trans2,$page_text);

$ntext="$page_text ";
$substr_count = substr_count($ntext,"http://");

$n=1; $ofset=0;
while($n <= $substr_count ){
	$pozicn = strpos($ntext, "http://",$ofset);
	$pozick = strpos($ntext, " ",$pozicn);
	$sim=$pozick-$pozicn;
	if($sim==0) {$sim="";}
	if($sim!=""){$sim=$sim+1;}
	 $zamenstr = substr($ntext, $pozicn, $sim);
	$zamenstr=trim($zamenstr);
	$ntext=str_replace($zamenstr,"<a href=\"$zamenstr\">$zamenstr</a>",$ntext);
	$ofset=$pozick+$pozick1+19;
	$n=$n+1;}

$page_text=$ntext;

if($ver=="wml"){
include 'wapzag.php';}else{ include 'webzag.php';}
$pages=$pages-1;
if($pa==1){print"<b>$ar_text[0]</b><br/>";}
print"$page_text";
$next=$pa+1;
$prev=$pa-1;
if($pa<$pages){print" <a href=\"read.php?pa=$next&amp;raz=$raz&amp;text=$text&amp;ver=$ver&amp;login=$login&amp;pas=$pas\">&gt;&gt;</a>";}
print"</p><p align=\"center\">|";

if($pa>1){print"<a href=\"read.php?pa=1&amp;raz=$raz&amp;text=$text&amp;ver=$ver&amp;login=$login&amp;pas=$pas\">1</a>|";}
if($prev>2){print"<a href=\"vvod.php?raz=$raz&amp;text=$text&amp;ver=$ver&amp;login=$login&amp;pas=$pas\">...</a>|";}
if($prev>1){print"<a href=\"read.php?pa=$prev&amp;raz=$raz&amp;text=$text&amp;ver=$ver&amp;login=$login&amp;pas=$pas\">$prev</a>|";}
print"<b>$pa</b>|";
if($next<$pages){print"<a href=\"read.php?pa=$next&amp;raz=$raz&amp;text=$text&amp;ver=$ver&amp;login=$login&amp;pas=$pas\">$next</a>|";}
if($next<($pages-1)){print"<a href=\"vvod.php?raz=$raz&amp;text=$text&amp;ver=$ver&amp;login=$login&amp;pas=$pas\">...</a>|";}
if($pa<$pages){print"<a href=\"read.php?pa=$pages&amp;raz=$raz&amp;text=$text&amp;ver=$ver&amp;login=$login&amp;pas=$pas\">$pages</a>|";}

print"<br/><br/>";

$name_razdel=@file("$raz/razdel.dat");
$name_razdel=trim($name_razdel[0]);

if($ver=="html"){print"<table style=\"text-align: center; width: 98%;\"
 border=\"1\" cellpadding=\"2\" cellspacing=\"2\">
  <tbody>
    <tr>
      <td
 style=\"background-color: rgb($color2);\" align=\"center\"
 valign=\"top\">";}
 
 print"<a href=\"seeraz.php?ver=$ver&amp;login=$login&amp;pas=$pas&amp;raz=$raz\">&lt;&lt; $name_razdel</a><br/>
 <a href=\"razdel.php?ver=$ver&amp;login=$login&amp;pas=$pas\">&lt;&lt;&lt; Разделы</a><br/>";
 
 if($ver=="wml"){print"<a href=\"read.php?pa=$pa&amp;raz=$raz&amp;text=$text&amp;ver=html&amp;login=$login&amp;pas=$pas\">wap 2.0</a><br/>";}
 else{print"<a href=\"read.php?pa=$pa&amp;raz=$raz&amp;text=$text&amp;ver=wml&amp;login=$login&amp;pas=$pas\">wap 1.2</a><br/>";}
 
 print"<a href=\"$gen_link\">На главную</a>";
 if($ver=="html"){print"</td>
    </tr>
  </tbody>
</table>
</body>
</html>
";}
else{print"</p></card></wml>";}

?>