Просмотр файла waplend/kopi/index.php

Размер файла: 3.85Kb
<?php

include ("code.php");
$scn = '';
if ($d[0] == '.' or $d[0] == '/') exit ("Не верный каталог".$px);
$d = str_replace ("..","",$d); $d = str_replace ("//","/",$d);
if (!is_dir ($path.$d)) exit ("Не верный каталог (err:2)".$px);
if ($d == '') $main = 'Загрузки';
else
$main = realname(basename($d));


if ($d) $d = $d."/";
$list = glob ($path.$d."*");

if ($sort == 'n')
{
	sort ($list);
}
if($sort == 'd')
{
	foreach($list as $k=>$v) { $files[$k] = $v;  $time[$k] = filemtime($v); }
arsort($time);
$list = array();
foreach ($time as $k=>$v) { $list[] = $files[$k];  }
}

if($sort == 's')
{
	foreach($list as $v) { $files[] = $v;  $size[] = filesize($v); }
asort($size);
$list = array();
foreach ($size as $k=>$v) { $list[] = $files[$k];  }
}





$all = count ($list);
if ($html) echo "<div class='pnk'>";
pay();
if($html) echo "</div>"; else echo "-----<br/>";
if($html)
echo "<div class='orange'>";
echo"<img src='img/ofolder.gif' alt='.'/><u>$main</u><b>($all)</b>";
if($html) echo "</div>"; else echo "<br/>";

if($html) echo "<div class='pnk'>";
echo "<small>Сортировать по:<br/>";
if($sort != 'd') echo "<a href='index.php?d=".$d."&amp;page=".$page."&amp;sort=d&amp;wap=$wap'>Дате</a>,";
if($sort != 's') echo "<a href='index.php?d=".$d."&amp;page=".$page."&amp;sort=s&amp;wap=$wap'>Размеру</a>,";
if($sort != 'n') echo "<a href='index.php?d=".$d."&amp;page=".$page."&amp;sort=n&amp;wap=$wap'>Названию</a>,";
echo "</small>";

if($html) echo"</div>"; else echo "<br/>";

if (!$page) $page = 1;
$n = 0;
$pages = ceil($all/$onpage);
if(!$pages) $pages = 1;
if ($page) $n = ($onpage*$page)-$onpage;

if ($all == 0)
{
	if($html) echo "<div class='menu'>";
	echo "[Раздел пуст]";
	if($html) echo "</div>"; else echo "<br/>";
}

// Вверх
if ($d!='')
{
	$tt = str_replace(basename($d),"",$d);
	$tt = join("/",$tt);
	if($html) echo "<div class='menu'>";
	echo "<img src='img/folder.gif' alt='.'/><a href='index.php?wap=$wap&amp;d=$tt&amp;sort=$sort'>Вверх</a>";
	if($html) echo "</div>"; else echo "<br/>";

}


for ($i = 1; $i<=$onpage; $i++)
{
	if (!isset($list[$n]))
	{
		$n++;
		continue;
	}

	if (is_dir($list[$n]))
	{
		if ($html) echo "<div class='menu'>";
		echo"<img src='img/folder.gif' alt='.'/><a href='index.php?d=".$d.basename($list[$n])."&amp;sort=$sort&amp;wap=$wap'>".realname(basename($list[$n]))."</a>(".allfiles($list[$n]).")";
		if($html) echo "</div>"; else echo "<br/>";

	}
	else
	{
	$scn ="<img src='img/file.gif' alt='.'/>";
	$ext = pathinfo ($list[$n]);
	$basename = $ext[basename];
	$ext = $ext[extension];
	if($ext == 'jad' or $ext == 'jar')
	{
		// ------------------------------- JAVA Игры
		if(is_file($icon.$basename.'.gif')) $scn = "<img src='".$icon.$basename.".gif' alt='.'/>";
	}

	if ($ext == 'gif' or $ext == 'GIF' or $ext == 'JPEG' or $ext == 'jpeg' or $ext == 'jpg')
	{
		//----------------------------- Картинки

	$scn = "<img src='im.php?pic=".$list[$n]."' alt='wait'/><br/>";
	}

	if($html) echo "<div class='menu'>";
	echo $scn."<a href='f.php?d=".$d.basename($list[$n])."&amp;wap=$wap'>".basename($list[$n])."</a>[".round(filesize($list[$n])/1024)."kb]<br/>
	Добавлен: <b>".date("d/m/y H:i",filemtime($list[$n]))."</b>";
	if($html) echo "</div>"; else echo "<br/>";
    }
$n++;
}

if($html) echo "<div class='orange'>";
echo "Стр.:";
$true = array (1,2,($page-1),$page,($page+1),($pages-1),$pages);
for($i=1; $i<=$pages; $i++)
{
	if(!in_array ($i,$true)) continue;
	if($i != 1 ) { if(($i-1)==$last) echo ','; else echo '...'; }
	if ($i == $page)
	echo"<b>$page</b>";
	else
	echo"<a href='index.php?d=".str_replace("//","/",$d)."&amp;page=".$i."&amp;sort=$sort&amp;wap=$wap'>$i</a>";
	$last = $i;
}

if ($html) echo "</div>";

exit ($px);


?>