download.php zamień na ten kod albo zmień na to co pogrubiłem.
Usnąłem ci to co chciałeś czyli opis pliku
<?php
/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright Š 2002 - 2005 Nick Jones
| http://www.php-fusion.co.uk/
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------*/
require_once "maincore.php";
require_once "subheader.php";
require_once "side_left.php";
if (file_exists(INFUSIONS."master_download_panel/locale/".$settings['locale'].".php")) {
include INFUSIONS."master_download_panel/locale/".$settings['locale'].".php";
} else {
include INFUSIONS."master_download_panel/locale/Polish.php";
}
// ----------------------------------------
// Konfiguracja i funkcje
// ----------------------------------------
require_once INFUSIONS."master_download_panel/master_download_config.php";
require_once INFUSIONS."master_download_panel/master_download_const.php";
require_once INFUSIONS."master_download_panel/master_download_tools.php";
// ----------------------------------------
// Pobieranie
// ----------------------------------------
if (($action == 'get') and ((isset($id)) or (isset($shortcut)))) {
// Plik
if (isset($id))
$file_ident = "file_id='".$id."'";
elseif (isset($shortcut))
$file_ident = "file_shortcut='".$shortcut."'";
else {
redirect(FUSION_SELF);
exit;
}
$files_list = dbquery("
SELECT file_id, file_subcat, file_shortcut, file_url, file_size, subcat_id, subcat_getaccess FROM ".$db_prefix."master_download_files
LEFT JOIN ".$db_prefix."master_download_subcats ON ".$db_prefix."master_download_files.file_subcat=".$db_prefix."master_download_subcats.subcat_id
WHERE ".$file_ident."
LIMIT 1
");
$files_count = mysql_num_rows($files_list);
if ($files_count == 0) {
// Brak pliku
redirect(FUSION_SELF);
exit;
}
$file_details = mysql_fetch_array($files_list);
if (!checkgroup($file_details['subcat_getaccess'])) {
// Brak dostepu
opentable($locale['mdp900']);
print("<center><br>".$locale['mdp934']."</center>");
closetable();
exit;
}
// Dostepne mirrory
$av_mirrors_list = dbquery("SELECT rel_id FROM ".$db_prefix."master_download_rels WHERE rel_fileid='".$file_details['file_id']."'");
$av_mirrors_count = mysql_num_rows($av_mirrors_list);
$file_url = False;
if ($av_mirrors_count == 0) {
// URL downloadu
$file_url = $file_details['file_url'];
}
else {
// Reset wykozystania transferu mirror'ow
$ac_date = showdate("%Y.%m", get_sectime());
$tmp_mirrors_list = dbquery("SELECT mirror_id, mirror_lastdown FROM ".$db_prefix."master_download_mirrors");
while ($tmp_mirror_details = mysql_fetch_array($tmp_mirrors_list))
if (($tmp_mirror_details['mirror_lastdown']) and (showdate("%Y.%m", $tmp_mirror_details['mirror_lastdown']) != $ac_date))
dbquery("UPDATE ".$db_prefix."master_download_mirrors SET mirror_used='0', mirror_lastdown='0' WHERE mirror_id='".$tmp_mirror_details['mirror_id']."'");
// Lista mirrorow
$mirrors_list = dbquery("
SELECT *,
(mirror_used*100)/mirror_limit AS mirror_load
FROM ".$db_prefix."master_download_mirrors
LEFT JOIN ".$db_prefix."master_download_rels ON ".$db_prefix."master_download_rels.rel_mirrorid = ".$db_prefix."master_download_mirrors.mirror_id
WHERE rel_fileid='".$file_details['file_id']."' AND mirror_used+".$file_details['file_size']." <= mirror_limit
ORDER BY mirror_load
LIMIT 1
");
$mirrors_count = mysql_num_rows($mirrors_list);
if ($mirrors_count == 0) {
// Brak dostepnego mirror'a
opentable($locale['mdp900']);
print("<center><br>".$locale['mdp932']."</center>");
closetable();
exit;
}
else {
$mirror_details = mysql_fetch_array($mirrors_list);
// Zaleznosc
$rels_list = dbquery("
SELECT * FROM ".$db_prefix."master_download_rels
WHERE rel_fileid='".$file_details['file_id']."' AND rel_mirrorid='".$mirror_details['mirror_id']."'
LIMIT 1
");
$rels_count = mysql_num_rows($rels_list);
if ($rels_count == 0) {
redirect(FUSION_SELF);
exit;
}
else
$rel_details = mysql_fetch_array($rels_list);
// Brak jakiejkolwiek nazwy pliku
if (!(($rel_details['rel_url']) or ($file_details['file_url']))) {
redirect(FUSION_SELF);
exit;
}
// URL downloadu
if (!$rel_details['rel_url']) $rel_details['rel_url'] = $file_details['file_url'];
$file_url = $mirror_details['mirror_url'].$rel_details['rel_url'];
// Aktualizacja danych
dbquery("UPDATE ".$db_prefix."master_download_mirrors SET mirror_used=mirror_used+".$file_details['file_size'].", mirror_lastdown='".get_sectime()."' WHERE mirror_id='".$mirror_details['mirror_id']."'");
}
}
if ($file_url !== False) {
// Aktualizacja danych
dbquery("UPDATE ".$db_prefix."master_download_files SET file_count=file_count+1 WHERE file_id='".$file_details['file_id']."'");
// Pobranie pliku
redirect($file_url);
}
}
// ----------------------------------------
// Pliki
// ----------------------------------------
elseif (($action == 'subcat') and (isset($id)) and ($id >= 1)) {
// Nazwa subkategorii
$subcats_list = dbquery("
SELECT cat_id, cat_name, subcat_id, subcat_cat, subcat_name, subcat_sort, subcat_viewaccess
FROM ".$db_prefix."master_download_subcats
LEFT JOIN ".$db_prefix."master_download_cats ON ".$db_prefix."master_download_cats.cat_id=".$db_prefix."master_download_subcats.subcat_cat
WHERE subcat_id='".$id."' AND subcat_cat!='0' AND ".groupaccess('subcat_viewaccess')."
LIMIT 1
");
if (mysql_num_rows($subcats_list) == 0) {
redirect(FUSION_SELF);
exit;
}
else
$subcat_details = mysql_fetch_array($subcats_list);
// Lista plikow
$rows = dbcount("(file_id)", "master_download_files", "file_subcat='".$id."'");
if ((!isset($rowstart)) or (!isNum($rowstart))) $rowstart = 0;
$files_list = dbquery("SELECT * FROM ".$db_prefix."master_download_files WHERE file_subcat='".$id."' ORDER BY ".$subcat_sort_array[$subcat_details['subcat_sort']][1]." LIMIT ".$rowstart.",".MDP_FILES_PER_PAGE_LIMIT);
$files_count = mysql_num_rows($files_list);
if ($files_count == 0) {
// Brak plikow
opentable($locale['mdp900'].': '.$subcat_details['cat_name'].' - '.$subcat_details['subcat_name']);
print("<center><br>".$locale['mdp931']."</center>");
closetable();
}
else {
// Strona
opentable($locale['mdp900'].': '.$subcat_details['cat_name'].' - '.$subcat_details['subcat_name']);
while ($file_details = mysql_fetch_array($files_list)) {
print("
<table width='100%' cellpadding='0' cellspacing='1' class='tbl-border'>
<tr>
<td colspan='4' class='forum-caption'><b>".$file_details['file_name']."</b></td>
</tr>
[color=red][b]<tr>
<td colspan='4' class='tbl1' align='center'>".($file_details['file_img'] ? "<img src='".$file_details['file_img']."' alt='".$file_details['file_name']."' border='0' align='center' style='margin: 5px;'>" : "")."</td>
</tr>[/b][/color]
<tr>
<td width='25%' class='tbl2'>".$locale['mdp911']." ".showdate("%d.%m.%y", $file_details['file_date'])."</td>
<td width='25%' class='tbl1'>".$locale['mdp912']." ".$file_details['file_count']."</td>
<td width='25%' class='tbl2'>".$locale['mdp913']." ".format_filesize($file_details['file_size'])."</td>
<td width='25%' class='tbl1'><center><a href='".make_filelink($file_details)."'>".$locale['mdp914']."</a></center></td>
</tr>
</table>
<div align='center'><img src='".THEME."images/blank.gif' alt='' height='15' width='1'></div>
");
}
closetable();
if ($rows > MDP_FILES_PER_PAGE_LIMIT) echo "<div align='center' style='margin-top:5px;'>\n".makePageNav($rowstart, MDP_FILES_PER_PAGE_LIMIT, $rows, 3, FUSION_SELF."?action=subcat&id=".$id."&")."\n</div>\n";
}
}
// ----------------------------------------
// Kategorie i subkategorie
// ----------------------------------------
else {
// Lista kategorii
$cats_list = dbquery("SELECT * FROM ".$db_prefix."master_download_cats ORDER BY cat_order");
$cats_count = mysql_num_rows($cats_list);
if ($cats_count == 0) {
// Brak kategorii
opentable($locale['mdp900']);
print("<center><br>".$locale['mdp930']."</center>");
closetable();
}
else {
// Strona
opentable($locale['mdp900']);
print("<table width='100%' border='0' cellpadding='0' cellspacing='1'>");
$i = 0;
while ($cat_details = mysql_fetch_array($cats_list)) {
// Lista subkategorii
$subcats_list = dbquery("SELECT * FROM ".$db_prefix."master_download_subcats WHERE subcat_cat='".$cat_details['cat_id']."' AND ".groupaccess('subcat_viewaccess')." ORDER BY subcat_order");
$subcats_count = mysql_num_rows($subcats_list);
if ($subcats_count != 0) {
print(((($i % 2 == 0) and ($i)) ? "<tr><td align='center'><hr width='90%'></td><td align='center'><hr width='90%'></td></tr>" : ""));
print(($i % 2 ? "" : "<tr>")."<td width='50%' valign='top'>");
print("<img src='".INFUSIONS."master_download_panel/images/folder.gif' border='0' align='absmiddle'> <b>".$cat_details['cat_name']."</b><br>");
if ($cat_details['cat_desc'])
print("<span class='small' style='padding-left: 22px;'>".$cat_details['cat_desc']."</span><br>");
while ($subcat_details = mysql_fetch_array($subcats_list)) {
print("
<span style='padding-left: 8px;'><img src='".INFUSIONS."master_download_panel/images/subfolder.gif' border='0' align='absmiddle'> <a href='".FUSION_SELF."?action=subcat&id=".$subcat_details['subcat_id']."'>".$subcat_details['subcat_name']."</a> <span class='small'>(".$subcat_details['subcat_count'].")</span></span><br>
");
if ($subcat_details['subcat_desc'])
print("<span class='small' style='padding-left: 30px;'>".$subcat_details['subcat_desc']."</span><br>");
}
print("</td>".($i % 2 ? "</tr>" : ""));
$i++;
}
}
print(($i % 2 ? "<td width='50%'></td></tr>" : "")."</table>");
closetable();
}
}
require_once "side_right.php";
require_once "footer.php";
?>
Edytowane przez kefirek dnia 18.05.2008 11:29:35
|