<?php
##############################
## WAP-ENGINE ##
##############################
## ##
## Автор : CHUMA ##
## e-mail : [email protected] ##
## WAP : http://wapeng.info ##
## ICQ : 111-75-74 ##
## ##
##############################
## ВЫ НЕ ИМЕЕТЕ ПРАВО ##
## ИЗМЕНЯТЬ КОД СКРИПТА ##
## ДЛЯ ДАЛЬНЕЙШЕГО ##
## РАСПРОСТРАНЕНИЯ ##
##############################
Error_Reporting(E_ALL & ~E_NOTICE);
Error_Reporting (ERROR | WARNING);
session_name("SESID");
session_start();
include ("../../config.php");
include ("../../themes/$themes.php");
include ("../../templates/tr_to_win.php");
function dir_kol($kat_kol)
{
$dir_kol = opendir("$kat_kol");
while($files_kol = readdir($dir_kol))
{
if(is_file($kat_kol."/".$files_kol) && $files_kol != "Thumbs.db")
{
$kol++;
}
elseif(is_dir($kat_kol."/".$files_kol) && $files_kol != "." && $files_kol != ".." && $files_kol != "op")
{
$es = dir_kol($kat_kol."/".$files_kol);
$kol = $kol + $es;
}
}
closedir($dir_kol);
if(empty($kol))
{
$kol = 0;
}
else
{
$kol = $kol;
}
return"$kol";
}
function dir_kol_new($kat_kol_new)
{
$dir_kol_new = opendir("$kat_kol_new");
while($files_kol_new = readdir($dir_kol_new))
{
if(is_file($kat_kol_new."/".$files_kol_new) && $files_kol_new != "Thumbs.db")
{
$datanew = date ("YmdHis", filemtime("$kat_kol_new/$files_kol_new")) + 5000000;
$datenow = date ("YmdHis");
if($datanew > $datenow)
{
$kol_new++;
}
}
elseif(is_dir($kat_kol_new."/".$files_kol_new) && $files_kol_new != "." && $files_kol_new != ".." && $files_kol_new != "op")
{
$es_new = dir_kol_new($kat_kol_new."/".$files_kol_new);
$kol_new = $kol_new + $es_new;
}
}
closedir($dir_kol_new);
if(empty($kol_new))
{
$kol_new = 0;
}
else
{
$kol_new = $kol_new;
}
return"$kol_new";
}
function dir_list ($kat)
{
include ("../../config.php");
if(empty($kat))
{
$dir = ".";
}
else
{
$dir = "$kat";
}
if(ereg("^\.[-a-zA-Z0-9_\/',()!@\=]*$", $kat))
{
$dir_kat = opendir ("$dir");
$dir_file = opendir ("$dir");
if($dir != ".")
{
$dir_exp = explode("/", "$dir");
$dir_exp_count = count($dir_exp);
echo"<p align=\"center\"><a href=\"index.php\">Загрузки</a>";
for($i=1; $i < $dir_exp_count; $i++)
{
$dir_plus = "$dir_plus/$dir_exp[$i]";
$file_win = "$dir_exp[$i]";
if(ereg("(=[-a-zA-Z0-9_',()!@]*=)", $dir_exp[$i], $replasement))
{
$zamena11 = str_replace("=", "", "$replasement[1]");
$zamena = tr_to_win($zamena11);
$file_win = str_replace("$replasement[1]", "$zamena", "$dir_exp[$i]");
}
$dir_use = str_replace("__", " ", "$file_win");
$dir_use = ereg_replace("^[0-9]{0,2}[-]", "", $dir_use);
if(".$dir_plus" == "$dir" && $_GET['view']==1)
{
echo" | <a href=\"index.php?kat=.$dir_plus\">$dir_use</a>";
}
elseif(".$dir_plus" == "$dir")
{
echo" | $dir_use";
}
else
{
echo" | <a href=\"index.php?kat=.$dir_plus\">$dir_use</a>";
}
}
echo"</p>";
}
else
{
echo"<p align=\"center\">Загрузки</a>";
}
if($_GET['view']==1)
{
if(ereg("^[-a-zA-Z0-9_', ()!@]*$", $_GET['kategor']))
{
if(ereg("^\.\/[-a-zA-Z0-9_\/\.', ()!@\=]*\.[a-z0-9]{3}$", "$_GET[dir_kat]"))
{
if(ereg("^[0-9]{14}$", "$_GET[date]"))
{
ereg_replace("../", "", $_GET['dir_kat']);
ereg("\/([-a-zA-Z0-9_\.', ()!@\=]*\.[a-z0-9]{3})$", "$_GET[dir_kat]", $file_name);
$file_win = "$file_name[1]";
if(ereg("(=[-a-zA-Z0-9_', ()!@]*=)", $file_name[1], $replasement))
{
$zamena = str_replace("=", "", "$replasement[1]");
$zamena = tr_to_win($zamena);
$file_win = str_replace("$replasement[1]", "$zamena", "$file_name[1]");
}
$file_use = str_replace("__", " ", "$file_win");
$sizef = stat("$_GET[dir_kat]");
$kb = 1000;
$size_file = round($sizef[7] / $kb, 2);
$date_zag = date ("d/m/Y H:i:s", filemtime("$_GET[dir_kat]"));
$datanew = $_GET['date'] + 5000000;
$datenow = date ("YmdHis");
ereg("\/([-a-zA-Z0-9_\.', ()!@\=]*\.[a-z0-9]{1,4})$", $_GET['dir_kat'], $fil);
echo "<p class=\"b\">";
if($datanew > $datenow)
{
echo "<font color=\"red\">Новый файл</font><br/>";
}
echo "Имя: $file_use<br/>";
echo "Файл загружен: $date_zag<br/>";
echo "Размер: $size_file Кбайт<br/>";
if(!ereg("\.jar$", $_GET['dir_kat']))
{
echo "<a href=\"$home/modules/zagruz/$_GET[dir_kat]\">Скачать</a><br/>";
}
if(ereg("\.jar$", $_GET['dir_kat']))
{
$jad = str_replace(".jar", ".jad", "$_GET[dir_kat]");
echo "<a href=\"$home/modules/zagruz/$_GET[dir_kat]\">Скачать JAR</a><br/>";
if(file_exists("$jad"))
{
echo "<a href=\"$home/modules/zagruz/$jad\">Скачать JAD</a><br/>";
}
}
if (file_exists("$dir/op/$fil[1].txt"))
{
echo "<br/>Описание: ";
include ("$dir/op/$fil[1].txt");
echo "<br/>";
}
if (file_exists("$dir/op/$fil[1].gif"))
{
echo "<br/>Скриншот: ";
echo "<br/><img src=\"img.php?img=$_GET[kat]/op/$fil[1].gif&wid=100&prev=1\" alt=\"\">";
echo "<br/>";
}
if (file_exists("$dir/op/$fil[1].jpg"))
{
echo "<br/>Скриншот: ";
echo "<br/><img src=\"img.php?img=$_GET[kat]/op/$fil[1].jpg&wid=100&prev=1\" alt=\"\">";
echo "<br/>";
}
if (file_exists("$dir/op/$fil[1].png"))
{
echo "<br/>Скриншот: ";
echo "<br/><img src=\"img.php?img=$_GET[kat]/op/$fil[1].png&wid=100&prev=1\" alt=\"\">";
echo "<br/>";
}
if(ereg("\.gif$|\.jpg$|\.jpeg$|\.jpe$|\.png$", $_GET['dir_kat']))
{
echo "<br/>Просмотр: ";
echo "<br/><img src=\"img.php?img=$_GET[dir_kat]\" alt=\"prew\" />";
echo "<br/>Скачать для вашего экрана:";
echo "<br/>
<a href=\"img.php?img=$_GET[dir_kat]&hei=80\">101x80</a>|<a href=\"img.php?img=$_GET[dir_kat]&hei=90\">128x90</a><br/>
<a href=\"img.php?img=$_GET[dir_kat]&wid=128\">128x128</a>|<a href=\"img.php?img=$_GET[dir_kat]&wid=128\">128x160</a><br/>
<a href=\"img.php?img=$_GET[dir_kat]&wid=132\">132x176</a>|<a href=\"img.php?img=$_GET[dir_kat]&hei=144\">176x144</a><br/>
<a href=\"img.php?img=$_GET[dir_kat]&wid=176\">176x208</a>|<a href=\"img.php?img=$_GET[dir_kat]&wid=176\">176x220</a><br/>
<a href=\"img.php?img=$_GET[dir_kat]&wid=208\">208x208</a>|<a href=\"img.php?img=$_GET[dir_kat]&wid=240\">240x266</a><br/>
<a href=\"img.php?img=$_GET[dir_kat]&wid=240\">240x240</a>|<a href=\"img.php?img=$_GET[dir_kat]&wid=240\">240x320</a><br/>
<br/>";
echo "<form action=\"img.php?img=$_GET[dir_kat]\" method=\"post\">";
echo "Уникальный размер:<br/>
Ширина: <input type=\"text\" name=\"wid\" size=\"3\" maxlength=\"3\" value=\"\" /><br/>
Высота: <input type=\"text\" name=\"hei\" size=\"3\" maxlength=\"3\" value=\"\" /><br/>
<input type=\"submit\" value=\"Скачать\" />";
echo "</form>";
}
echo "<br/>Ссылка:<br/><input type=\"text\" size=\"15\" value=\"$home/modules/zagruz/$_GET[dir_kat]\" /><br/>";
echo "</p>";
}
else
{
echo "<p class=\"b\">Неправильный формат даты</p>";
}
}
else
{
echo "<p class=\"b\">Неправильный формат директоии</p>";
}
}
else
{
echo "<p class=\"b\">Неправильный формат категории</p>";
}
}
else
{
while ($file = readdir($dir_kat))
{
if(is_dir("$dir/$file") && $file != "." && $file != ".." && $file != "op")
{
$files[] = "$file";
}
}
$file_co = count($files);
sort($files);
for ($i=0; $i < $file_co; $i++)
{
if(is_dir("$dir/$files[$i]") && $files[$i] != "." && $files[$i] != ".." && $files[$i] != "op")
{
$file_win = "$files[$i]";
if(ereg("(=[-a-zA-Z0-9_',()!@]*=)", $files[$i], $replasement))
{
$zamena1 = str_replace("=", "", "$replasement[1]");
$zamena = tr_to_win($zamena1);
$file_win = str_replace("$replasement[1]", "$zamena", "$files[$i]");
}
$file_use = str_replace("__", " ", "$file_win");
$file_use = ereg_replace("^[0-9]{1,2}[-]", "", $file_use);
echo "<p class=\"b\">";
echo "<img src=\"../../images/dir.gif\" alt=\"\" /> <a href=\"index.php?kat=$dir/$files[$i]\">$file_use</a>[".dir_kol("$dir/$files[$i]")."";
if(($kolvo = dir_kol_new("$dir/$files[$i]")) > 0)
{
echo "/<font color=\"red\">$kolvo</font>";
}
echo "]";
echo "</p>";
$a++;
}
}
if(!empty($a))
{
echo "<p><br/></p>";
}
while ($file1 = readdir($dir_file))
{
if(is_file("$dir/$file1") && $file1 != "Thumbs.db" && $file1 != ".htaccess" && $file1 != "index.php" && $file1 != "kol.php" && $file1 != "img.php" && $file1 != "adminkom.php" && $file1 != "kom.php")
{
$file_array[] = "".date ("YmdHis", filemtime("$dir/$file1"))."||$file1";
}
}
rsort($file_array);
$count_files = count($file_array);
$kol_files = $kolfiles;
$stranic = ceil($count_files/$kol_files);
if(empty($_GET["page"]))
{
$page_get = 1;
}
else
{
$page_get = "$_GET[page]";
$page_get = htmlspecialchars(stripslashes(trim($page_get)));
}
$do = $kol_files * ($page_get - 1);
$end = $kol_files * $page_get;
$page_nazad = $page_get - 1;
$page_dalee = $page_get + 1;
for($i = $do; $i < $end; $i++)
{
if(!empty($file_array[$i]) && !ereg("\.jad$", $file_array[$i]))
{
$file_win_arr = explode("||", $file_array[$i]);
ereg("^([-a-zA-Z0-9_\.', !()@\=]*)\.[a-z0-9]{3}$", $file_win_arr['1'], $repl);
$file_win = "$repl[1]";
if(ereg("(=[-a-zA-Z0-9_\.', ()!@]*=)", $repl[1], $replasement))
{
$zamena = str_replace("=", "", "$replasement[1]");
$zamena = tr_to_win($zamena);
$file_win = str_replace("$replasement[1]", "$zamena", "$repl[1]");
}
$file_use = str_replace("__", " ", "$file_win");
echo "<p class=\"b\">";
if(file_exists("$dir/op/$file_win_arr[1].jpg"))
{
echo "<img src=\"img.php?img=$dir/op/$file_win_arr[1].jpg&prev=1\" alt=\"prev\" /><br/>";
}
elseif(file_exists("$dir/op/$file_win_arr[1].gif"))
{
echo "<img src=\"img.php?img=$dir/op/$file_win_arr[1].gif&prev=1\" alt=\"prev\" /><br/>";
}
elseif(file_exists("$dir/op/$file_win_arr[1].png"))
{
echo "<img src=\"img.php?img=$dir/op/$file_win_arr[1].png&prev=1\" alt=\"prev\" /><br/>";
}
if(ereg("\.zip$", $file_win_arr[1]))
{
echo "<img src=\"../../images/zip.gif\" alt=\"\" /> ";
}
elseif(ereg("\.rar$|\.jar$", $file_win_arr[1]))
{
echo "<img src=\"../../images/rar.gif\" alt=\"\" /> ";
}
elseif(ereg("\.mp3$|\.mid$|\.mmf$|\.wav$|\.ogg$|\.amr$", $file_win_arr[1]))
{
echo "<img src=\"../../images/melody.gif\" alt=\"\" /> ";
}
elseif(ereg("\.txt$", $file_win_arr[1]))
{
echo "<img src=\"../../images/txt.gif\" alt=\"\" /> ";
}
elseif(ereg("\.exe$|\.sis$", $file_win_arr[1]))
{
echo "<img src=\"../../images/exe.gif\" alt=\"\" /> ";
}
elseif(ereg("\.avi$|\.3gp$", $file_win_arr[1]))
{
echo "<img src=\"../../images/avi.gif\" alt=\"\" /> ";
}
elseif(ereg("\.gif$|\.jpg$|\.jpeg$|\.jpe$|\.png$", $file_win_arr[1]))
{
echo "<img src=\"img.php?img=$dir/$file_win_arr[1]&prev=1\" alt=\"prev\" /><br/><img src=\"../../images/img.gif\" alt=\"\" /> ";
}
else
{
echo "<img src=\"../../images/file.gif\" alt=\"\" /> ";
}
$datanew = $file_win_arr[0] + 5000000;
$datenow = date ("YmdHis");
$sizef = stat("$dir/$file_win_arr[1]");
$kb = 1000;
$size_file = round($sizef[7] / $kb, 2);
if($datanew > $datenow)
{
echo "<font color=\"red\">[NEW]</font> ";
}
echo "<a href=\"index.php?kat=$dir&dir_kat=$dir/$file_win_arr[1]&kategor=$zamena11&date=$file_win_arr[0]&view=1\">$file_use</a>($size_file Кб)";
echo "</p>";
}
}
if($count_files > $kol_files)
{
echo "<p align=\"center\" class=\"d\">";
if($page_get > 1)
{
echo "<a href=\"index.php?page=$page_nazad&kat=$kat\">Назад</a>";
}
echo "|";
if($stranic > $page_get)
{
echo "<a href=\"index.php?page=$page_dalee&kat=$kat\">Дальше</a>";
}
echo "<br/>Страница:$page_get<br/>";
echo "Всего страниц:$stranic<br/>";
if($page_get > 1)
{
echo "<a href=\"index.php?page=1&kat=$kat\">В начало</a>";
}
echo "|";
if($stranic > $page_get)
{
echo "<a href=\"index.php?page=$stranic&kat=$kat\">В конец</a><br/>";
}
echo "<br/>";
echo "<form action=\"index.php\" method=\"get\">";
echo "На страницу<br/>
<input type=\"text\" name=\"page\" size=\"3\" maxlength=\"3\" value=\"\" /><br/>
<input type=\"hidden\" name=\"kat\" value=\"$kat\" />
<input type=\"submit\" value=\"Перейти\" />";
echo "</form>";
echo "</p>";
}
echo "<p class=\"d\">";
if(!empty($a))
{
echo "Категорий: $a<br/>";
}
if($count_files > 0)
{
echo "Файлов: $count_files";
}
echo "</p>";
}
}
else
{
echo "<p class=\"b\">Неправильный формат каталога</p>";
}
closedir ($dir_kat);
closedir ($dir_file);
}
if(empty($_GET['kat']))
{
$dir = ".";
}
else
{
$dir = $_GET['kat'];
}
if(ereg("^\.[-a-zA-Z0-9_\/',!@\=]*$", $dir))
{
dir_list ($dir);
}
else
{
echo "<p class=\"b\">Неправильный формат каталога.</p>";
}
include ("../../templates/foot.php");
?>