<?php
###############################################
#  by MaZaFaKa                                #
#  ICQ: 449-559                               #
#  E-mail: Dimonnet@inbox.ru                  #
#  Menghabiskan waktu: Sekitar 2 minggu         #
#  Translate by: jogerplay
#  Situs: http://jogerwap.net
###############################################

function exits()
{header("Location: ".PATH."/".VERSION."/?error");
die();
}

$GDD = 'Versi';
$reit = 'Top WAP Situs';


function pages($page, $maxpage, $realpath = '', $version, $query = '')
{
   $rand = rand(1000, 9999);

   if($version == "xhtml")
   {
      $form_version = "<form action='".$realpath."/?".$rand."' method='post'>Kembali ke [1-".$maxpage."]: <input type='text' name='page' maxlength='5' size='5' /><br /><input type='submit' value='Kembali' /></form>\n";
   }
   elseif($version == "wml")
   {
      $form_version = "Kembali ke [1-".$maxpage."]: <input type='text' name='page_".$rand."' format='*N' maxlength='5' size='5' /><br /><a href='".$realpath."/?page=$(page_".$rand.")'>Kembali</a><br />";
   }
   elseif($version == "html")
   {
      $form_version = "<form action='".$realpath."/?".$rand."' method='post'>Kembali ke [1-".$maxpage."]: <input type='text' name='page' maxlength='5' size='5' /><br /><input type='submit' value='Kembali' /></form>\n";
   }


if($version == "xhtml" or $version == "wml")
{
$links = array();

   if($maxpage < 6)
   {
   $showform = false;

      for($i = 1; $i < ($maxpage + 1); $i++)
      {
         if($i == $page) $links[] = $i;
         else $links[] = "<a href='".$realpath."/?page=".$i.$query."'>".$i."</a>";
      }
   }
   else
   {
   $showform = true;

   if($page == 1) $links[] = "1";
   else $links[] = "<a href='".$realpath."/?page=1".$query."'>1</a>";

      if($page > 2)
      {
         $links[] = "...";
         $links[] = "<a href='".$realpath."/?page=".($page - 1).$query."'>".($page - 1)."</a>";
      }

      if($page > 1) $links[] = $page;

      if($maxpage > $page) $links[] = "<a href='".$realpath."/?page=".($page + 1).$query."'>".($page + 1)."</a>";

      if($maxpage > $page + 2)
      {
         $links[] .= "...";
         $links[] .= "<a href='".$realpath."/?page=".$maxpage.$query."'>".$maxpage."</a>";
      }
      elseif($maxpage > $page + 1) $links[] = "<a href='".$realpath."/?page=".$maxpage.$query."'>".$maxpage."</a>";
   }

   if(count($links) < 1) return "";

   if(!$showform)
   {
   return implode(" | ", $links)."<br />\n";
   }
   else
   {
   return implode(" | ", $links)."<br />".$form_version."\n";
   }
}




if($version == "html")  // Navigasi untuk versi Web
{

if(empty($_GET['page'])) // lol informations
{
$lol = 1;
}
else
{
$lol = $_GET['page'];
}

$links = array();

   if($maxpage < 6)
   {
   $showform = false;

      for($i = 1; $i < ($maxpage + 1); $i++)
      {
         if($i == $page) $links[] = $i;
         else $links[] = "<a class=\"scr\" href='".$realpath."/?page=".$i.$query."'>".$i."</a>";
      }
   }
   else
   {
   $showform = true;

   if($page == 1) $links[] = "1";
   else $links[] = "<a class=\"scr\" href='".$realpath."/?page=1".$query."'>1</a>";

      if($page > 2)
      {
         $links[] = "...";
         $links[] = "<a class=\"scr\" href='".$realpath."/?page=".($page - 1).$query."'>".($page - 1)."</a>";
      }

      if($page > 1) $links[] = $page;

      if($maxpage > $page) $links[] = "<a class=\"scr\" href='".$realpath."/?page=".($page + 1).$query."'>".($page + 1)."</a>";

      if($maxpage > $page + 2)
      {
         $links[] .= "...";
         $links[] .= "<a class=\"scr\" href='".$realpath."/?page=".$maxpage.$query."'>".$maxpage."</a>";
      }
      elseif($maxpage > $page + 1) $links[] = "<a class=\"scr\" href='".$realpath."/?page=".$maxpage.$query."'>".$maxpage."</a>";



   }

    $links=str_replace("".$lol."","<span class=\"noscr\">".$lol."</span>",$links); // lol =))

   if(count($links) < 1) return "";

   if(!$showform)
   {
   return implode(" | ", $links)."\n";
   }
   else
   {
   return implode(" | ", $links)."\n";
   }


}

}

?>