Początkujący
Postów: 174 Ostrzeżeń: 1
Data rejestracji: 06.05.2006 23:38
|
Witam
Zainstalowałem wtyczkę master download panel. W standardzie wyświetla takie info o pobieranym pliku : data, pobrano, rozmiar oraz przycisk pobierz.
Ja chciałem zmienić pozycję "rozmiar" na "producent" i prawie mi się to udało ale.....w zarzadzaniu przez PA wpisuję adres producenta i nic. Zawsze pokazuje mi się 0 (zero)
A druga rzecz : jak zrobić by naciskając POBIERZ otwierało się w nowym oknie ?
Zmodyfikowałem następujace pliki :
download.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";
include LOCALE.LOCALESET."master_download.php";
// ----------------------------------------
// Funkcje
// ----------------------------------------
// Formatowanie rozmiaru pliku
function format_filesize($size) {
if ($size >= 1024*1024)
$result = sprintf("%2.2f", $size/(1024*1024)).' GB';
else if ($size >= 1024)
$result = sprintf("%2.2f", $size/1024).' MB';
else
$result = $size.' KB';
return($result);
}
// Czas w sekundach
function get_sectime() {
list($ms, $sec) = explode(" ", microtime());
return($sec);
}
// ----------------------------------------
// Pobieranie
// ----------------------------------------
if (($action == 'get') and ((isset($id)) or (isset($shortcut)))) {
// Plik
if (isset($id))
$files_list = dbquery("SELECT * FROM ".$db_prefix."master_download_files WHERE file_id='".$id."' LIMIT 1");
elseif (isset($shortcut))
$files_list = dbquery("SELECT * FROM ".$db_prefix."master_download_files WHERE file_shortcut='".$shortcut."' LIMIT 1");
else {
redirect(FUSION_SELF);
exit;
}
$files_count = mysql_num_rows($files_list);
// Brak pliku
if ($files_count == 0) {
redirect(FUSION_SELF);
exit;
}
$file_details = mysql_fetch_array($files_list);
// 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);
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['400']);
print("<center><br>".$locale['432']."</center>");
closetable();
}
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) {
// 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);
}
else
redirect(FUSION_SELF);
}
// ----------------------------------------
// Pliki
// ----------------------------------------
elseif (($action == 'cat') and (isset($id)) and ($id >= 1)) {
// Nazwa kategorii
$cats_list = dbquery("SELECT cat_name FROM ".$db_prefix."master_download_cats WHERE cat_id='".$id."' LIMIT 1");
if (mysql_num_rows($cats_list) == 0) {
redirect(FUSION_SELF);
exit;
}
else
$cat_details = mysql_fetch_array($cats_list);
// Lista plikow
$files_list = dbquery("SELECT * FROM ".$db_prefix."master_download_files WHERE file_cat='".$id."' ORDER BY file_order");
$files_count = mysql_num_rows($files_list);
if ($files_count == 0) {
// Brak plikow
opentable($locale['400'].': '.$cat_details['cat_name']);
print("<center><br>".$locale['431']."</center>");
closetable();
}
else {
// Strona
opentable($locale['400'].': '.$cat_details['cat_name']);
while ($file_details = mysql_fetch_array($files_list)) {
// Sposob pobrania pliku
if ($file_details['file_shortcut'])
$getmethod = 'shortcut='.$file_details['file_shortcut'];
else
$getmethod = 'id='.$file_details['file_id'];
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>
<tr>
<td colspan='4' class='tbl1'>
");
// Obraz pliku
if ($file_details['file_img'])
print("<img src='".$file_details['file_img']."' alt='".$file_details['file_name']."' border='0' align='left' style='margin: 5px;'>");
print("
".$file_details['file_desc']."</td>
</tr>
<tr>
<td width='25%' class='tbl2'>".$locale['411']." ".showdate("%d.%m.%y", $file_details['file_date'])."</td>
<td width='25%' class='tbl1'>".$locale['412']." ".$file_details['file_count']."</td>
[color=red]<td width='25%' class='tbl2'>".$locale['413']."</td>[/color]
<td width='25%' class='tbl1'><center><a href='".FUSION_SELF."?action=get&".$getmethod."'>".$locale['414']."</a></center></td>
</tr>
</table>
<div align='center'><img src='".THEME."images/blank.gif' alt='' height='15' width='1'></div>
");
}
closetable();
}
}
// ----------------------------------------
// Kategorie
// ----------------------------------------
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['400'].': '.$cat_details['cat_name']);
print("<center><br>".$locale['430']."</center>");
closetable();
}
else {
// Strona
opentable($locale['400']);
while ($cat_details = mysql_fetch_array($cats_list)) {
print("
<a href='".FUSION_SELF."?action=cat&id=".$cat_details['cat_id']."'>".$cat_details['cat_name']."</a> <span class='small'>(".$cat_details['cat_count'].")</span><br>
<span class='small'>".$cat_details['cat_desc']."</span><br><br>
");
}
closetable();
}
}
require_once "side_right.php";
require_once "footer.php";
?>
oraz master_download_admin.php żeby można było wpisać więcej niz 10 znaków, ale nie wiem jak się pozbyć tego zera które się cały czas wyświetla
<?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 BASEDIR."subheader.php";
require_once ADMIN."navigation.php";
if (!checkrights("IP")) fallback("../index.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
// ----------------------------------------
require_once INFUSIONS."master_download_panel/master_download_config.php";
// ----------------------------------------
// Funkcje
// ----------------------------------------
// Odswierzanie ilosci plikow w kategorii
function refresh_cats_count() {
global $db_prefix;
$cats_list = dbquery("SELECT cat_id FROM ".$db_prefix."master_download_cats");
while ($cat_details = mysql_fetch_array($cats_list)) {
$result = dbquery("SELECT file_id FROM ".$db_prefix."master_download_files WHERE file_cat='".$cat_details['cat_id']."'");
dbquery("UPDATE ".$db_prefix."master_download_cats SET cat_count='".mysql_num_rows($result)."' WHERE cat_id='".$cat_details['cat_id']."'");
}
return;
}
// Drukowanie opcji pozycji
function print_options($prefix, $order, $count) {
global $mdp_page, ${$prefix.'_details'}, $locale;
$result = "
<a href='".FUSION_SELF."?mdp_page=".$mdp_page."&".$prefix."_action=".$prefix."_edit&".$prefix."_id=".${$prefix.'_details'}[$prefix.'_id']."' title='".$locale['mdp505']."'>
<img src='".INFUSIONS."master_download_panel/images/edit.gif' border='0' alt='".$locale['mdp505']."'></a>
";
if (($count) and ($order > 0)) $result = $result."
<a href='".FUSION_SELF."?mdp_page=".$mdp_page."&".$prefix."_action=".$prefix."_up&".$prefix."_id=".${$prefix.'_details'}[$prefix.'_id']."' title='".$locale['mdp513']."'>
<img src='".INFUSIONS."master_download_panel/images/up.gif' border='0' alt='".$locale['mdp513']."'></a>
";
if (($count) and ($order < $count-1)) $result = $result."
<a href='".FUSION_SELF."?mdp_page=".$mdp_page."&".$prefix."_action=".$prefix."_down&".$prefix."_id=".${$prefix.'_details'}[$prefix.'_id']."' title='".$locale['mdp514']."'>
<img src='".INFUSIONS."master_download_panel/images/down.gif' border='0' alt='".$locale['mdp514']."'></a>
";
$result = $result."
<a href='".FUSION_SELF."?mdp_page=".$mdp_page."&".$prefix."_action=".$prefix."_del&".$prefix."_id=".${$prefix.'_details'}[$prefix.'_id']."' title='".$locale['mdp506']."' onclick='return delete_confirm();'>
<img src='".INFUSIONS."master_download_panel/images/del.gif' border='0' alt='".$locale['mdp506']."'></a>
";
return($result);
}
// Obliczanie ilosci pobrań na dzień
function get_perdaycount($count, $date) {
$atime = get_sectime();
if ($atime == $date)
return('-');
else
return( sprintf("%1.1f", $count / (($atime-$date)/(60*60*24))) );
}
// Formatowanie rozmiaru pliku
function format_filesize($size) {
if ($size >= 1024*1024)
$result = sprintf("%2.2f", $size/(1024*1024)).' GB';
else if ($size >= 1024)
$result = sprintf("%2.2f", $size/1024).' MB';
else
$result = $size.' KB';
return($result);
}
// Czas w sekundach
function get_sectime() {
list($ms, $sec) = explode(" ", microtime());
return($sec);
}
// ----------------------------------------
// JS
// ----------------------------------------
print("
<script type='text/javascript'>
function delete_confirm() {
return confirm('".$locale['mdp228']."');
}
</script>
");
// ----------------------------------------
// Nawigacja
// ----------------------------------------
if (!isset($mdp_page)) $mdp_page = 'mdp_files';
// Nawigacja
opentable($locale['mdp300']);
print("
<table class='tbl-border' width='100%' height='20' cellpadding='0' cellspacing='1'>
<tr>
<td style='width: 25%; text-align: center;' class='".($mdp_page == 'mdp_files'?"tbl1":"tbl2")."'>".($mdp_page == mdp_files?"<b>".$locale['mdp200']."</b>":"<a href='".FUSION_SELF."?mdp_page=mdp_files'>".$locale['mdp200']."</a>")."</td>
<td style='width: 25%; text-align: center;' class='".($mdp_page == 'mdp_cats'?"tbl1":"tbl2")."'>".($mdp_page == mdp_cats?"<b>".$locale['mdp201']."</b>":"<a href='".FUSION_SELF."?mdp_page=mdp_cats'>".$locale['mdp201']."</a>")."</td>
<td style='width: 25%; text-align: center;' class='".($mdp_page == 'mdp_mirrors'?"tbl1":"tbl2")."'>".($mdp_page == mdp_mirrors?"<b>".$locale['mdp202']."</b>":"<a href='".FUSION_SELF."?mdp_page=mdp_mirrors'>".$locale['mdp202']."</a>")."</td>
<td style='width: 25%; text-align: center;' class='".($mdp_page == 'mdp_others'?"tbl1":"tbl2")."'>".($mdp_page == mdp_others?"<b>".$locale['mdp203']."</b>":"<a href='".FUSION_SELF."?mdp_page=mdp_others'>".$locale['mdp203']."</a>")."</td>
</tr>
</table>
");
closetable();
tablebreak();
// ----------------------------------------
// Administracja
// ----------------------------------------
// ----------------------------------------
// Pliki
// ----------------------------------------
if ($mdp_page == 'mdp_files') {
// Dodaj plik
if ($file_action == 'file_add') {
if (($file_cat >= 1) and ($file_name) and ($file_desc) and (isset($file_size)) and ($file_size >= 0) and (isset($file_count)) and ($file_count >= 0)) {
// Edycja, dodanie
if (($file_id) and ($file_id >= 0)) {
// Zmiana kategorii
$result = dbquery("SELECT * FROM ".$db_prefix."master_download_files WHERE file_id='".$file_id."' LIMIT 1");
$file_details = mysql_fetch_array($result);
if ($file_details['file_cat'] == $file_cat)
$file_order = '';
else {
$file_order = ", file_order='0'";
// Przesuwanie pozycji
dbquery("UPDATE ".$db_prefix."master_download_files SET file_order=file_order+1 WHERE file_cat='".$file_cat."'");
dbquery("UPDATE ".$db_prefix."master_download_files SET file_order=file_order-1 WHERE file_cat='".$file_details['file_cat']."' AND file_order>'".$file_details['file_order']."'");
}
// Data wpisu
if ($file_update_date)
$file_date = ", file_date='".get_sectime()."'";
else
$file_date = '';
// Edycja wpisu pliku
dbquery(
"UPDATE ".$db_prefix."master_download_files SET
file_cat='".$file_cat."',
file_shortcut='".$file_shortcut."',
file_name='".$file_name."',
file_desc='".$file_desc."',
file_url='".$file_url."',
file_img='".$file_img."',
file_size='".$file_size."',
file_count='".$file_count."'
".$file_date."
".$file_order."
WHERE file_id='".$file_id."'"
);
// Usuwanie zaleznosci
dbquery("DELETE FROM ".$db_prefix."master_download_rels WHERE rel_fileid='".$file_id."'");
$rel_fileid = $file_id;
print("<center><b>".$locale['mdp221']."</b></center>");
}
else {
// Przesuwanie pozycji
dbquery("UPDATE ".$db_prefix."master_download_files SET file_order=file_order+1 WHERE file_cat='".$file_cat."'");
// Dodanie pozycji
dbquery(
"INSERT INTO ".$db_prefix."master_download_files
(file_cat, file_shortcut, file_name, file_desc, file_url, file_img, file_size, file_count, file_date, file_order)
VALUES (
'".$file_cat."',
'".$file_shortcut."',
'".$file_name."',
'".$file_desc."',
'".$file_url."',
'".$file_img."',
'".$file_size."',
'".$file_count."',
'".get_sectime()."',
'0'
)"
);
// Zaleznosci
$rel_fileid = mysql_insert_id();
print("<center><b>".$locale['mdp220']."</b></center>");
}
print("<br><center>".$locale['mdp226']);
// Ilosc plikow w kategorii
refresh_cats_count();
// Odbudowa zaleznosci pliku
for ($i=0; $i<=$file_mirrors_count-1; $i++)
if (${'file_mirror'.$i}) {
dbquery(
"INSERT INTO ".$db_prefix."master_download_rels
(rel_fileid, rel_mirrorid, rel_url)
VALUES (
'".$rel_fileid."',
'".${'file_mirror'.$i}."',
'".${'file_mirror'.$i.'_url'}."'
)"
);
}
print($locale['mdp227']."</center>");
}
else
print("<center><b>".$locale['mdp222']."</b></center>");
}
// Edytuj plik
elseif ($file_action == 'file_edit') {
if (($file_id) and ($file_id >= 0))
$file_editpos = mysql_fetch_array(dbquery("SELECT * FROM ".$db_prefix."master_download_files WHERE file_id='".$file_id."'"));
else
print("<center><b>".$locale['mdp223']."</b></center>");
}
// Przesun w gore plik
elseif ($file_action == 'file_up') {
$result = dbquery("SELECT * FROM ".$db_prefix."master_download_files WHERE file_id='".$file_id."' LIMIT 1");
$file_details = mysql_fetch_array($result);
dbquery("UPDATE ".$db_prefix."master_download_files SET file_order=file_order+1 WHERE file_cat='".$file_details['file_cat']."' AND file_order='".($file_details['file_order']-1)."'");
dbquery("UPDATE ".$db_prefix."master_download_files SET file_order=file_order-1 WHERE file_id='".$file_details['file_id']."'");
}
// Przesun na dol plik
elseif ($file_action == 'file_down') {
$result = dbquery("SELECT * FROM ".$db_prefix."master_download_files WHERE file_id='".$file_id."' LIMIT 1");
$file_details = mysql_fetch_array($result);
dbquery("UPDATE ".$db_prefix."master_download_files SET file_order=file_order-1 WHERE file_cat='".$file_details['file_cat']."' AND file_order='".($file_details['file_order']+1)."'");
dbquery("UPDATE ".$db_prefix."master_download_files SET file_order=file_order+1 WHERE file_id='".$file_details['file_id']."'");
}
// Usun plik
elseif ($file_action == 'file_del') {
if (($file_id) and ($file_id >= 0)) {
$result = dbquery("SELECT * FROM ".$db_prefix."master_download_files WHERE file_id='".$file_id."' LIMIT 1");
$file_details = mysql_fetch_array($result);
// Usuwanie pozycji
dbquery("DELETE FROM ".$db_prefix."master_download_files WHERE file_id='".$file_id."'");
// Przesuwanie pozycji
dbquery("UPDATE ".$db_prefix."master_download_files SET file_order=file_order-1 WHERE file_cat='".$file_details['file_cat']."' AND file_order>'".$file_details['file_order']."'");
// Usuwanie zaleznosci
dbquery("DELETE FROM ".$db_prefix."master_download_rels WHERE rel_fileid='".$file_id."'");
// Ilosc plikow w kategorii
refresh_cats_count();
print("<center><b>".$locale['mdp224']."</b></center>");
}
else
print("<center><b>".$locale['mdp223']."</b></center>");
}
// Dodaj plik - formularz
$cats_list = dbquery("SELECT * FROM ".$db_prefix."master_download_cats ORDER BY cat_order");
$mirrors_list = dbquery("SELECT * FROM ".$db_prefix."master_download_mirrors ORDER BY mirror_name");
$rels_list = dbquery("SELECT * FROM ".$db_prefix."master_download_rels ORDER BY rel_id");
if (mysql_num_rows($cats_list) >= 1) {
// Domyslne wartosci
if (!isset($file_editpos['file_cat'])) $file_editpos['file_cat'] = '1';
if (!isset($file_editpos['file_size'])) $file_editpos['file_size'] = '0';
if (!isset($file_editpos['file_count'])) $file_editpos['file_count'] = '0';
// Lista kategorii
$cats_select = "<select name='file_cat' class='textbox' style='width:240px;'>";
while ($cat_details = mysql_fetch_array($cats_list)) {
if ($file_editpos['file_cat'] == $cat_details['cat_id'])
$selected = ' selected';
else
$selected = '';
$cats_select = $cats_select."<option value='".$cat_details['cat_id']."'".$selected.">".$cat_details['cat_name']."</option>";
}
$cats_select = $cats_select."</select>";
// Lista mirror'ow
$mirrors_select = "";
$i = 0;
while ($mirror_details = mysql_fetch_array($mirrors_list)) {
$checked = '';
$url = '';
$testlink = '';
if (isset($file_editpos['file_id'])) {
mysql_data_seek($rels_list, 0);
while ($rel_details = mysql_fetch_array($rels_list))
if (($file_editpos['file_id'] == $rel_details['rel_fileid']) and ($mirror_details['mirror_id'] == $rel_details['rel_mirrorid'])) {
$checked = ' checked';
$url = $rel_details['rel_url'];
$testlink = " <span class='small'>(<a href='".$mirror_details['mirror_url'].$rel_details['rel_url']."'>".$locale['mdp515']."</a>)</span>";
break;
}
}
$mirrors_select = $mirrors_select."
<tr>
<td width='40%'><input class='textbox' type='checkbox' name='file_mirror".$i."' value='".$mirror_details['mirror_id']."'".$checked."> ".$mirror_details['mirror_url']."</td>
<td width='60%'><input class='textbox' type='text' name='file_mirror".$i."_url' value='".$url."' maxlength='200' style='width: 240px;'>".$testlink."</td>
</tr>
";
$i++;
}
$mirrors_select = $mirrors_select."<input type='hidden' name='file_mirrors_count' value='".$i."'>";
// Formularz
opentable(($file_action == 'file_edit' ? $locale['mdp211'].$locale['mdp212'] : $locale['mdp210'].$locale['mdp212']));
print("
<form action='".FUSION_SELF."' method='post'>
<input type='hidden' name='mdp_page' value='".$mdp_page."'>
<input type='hidden' name='file_action' value='file_add'>
<input type='hidden' name='file_id' value='".($file_action == 'file_edit' ? $file_editpos['file_id'] : '')."'>
<table cellspacing='0' cellpadding='0' width='100%' align='center'>
<tr>
<td class='tbl' width='40%'>".$locale['mdp405']."</td>
<td class='tbl' width='60%'>".$cats_select."</td>
</tr>
<tr>
<td class='tbl' width='40%'>".$locale['mdp406']."</td>
<td class='tbl' width='60%'><input class='textbox' type='text' name='file_shortcut' value='".$file_editpos['file_shortcut']."' maxlength='20' style='width:240px;'></td>
</tr>
<tr>
<td class='tbl' width='40%'>".$locale['mdp400']."</td>
<td class='tbl' width='60%'><input class='textbox' type='text' name='file_name' value='".$file_editpos['file_name']."' maxlength='200' style='width:240px;'></td>
</tr>
<tr>
<td class='tbl' width='40%'>".$locale['mdp401']."</td>
<td class='tbl' width='60%'><textarea class='textbox' name='file_desc' rows='4' cols='50'>".$file_editpos['file_desc']."</textarea></td>
</tr>
<tr>
<td class='tbl' width='40%'>".$locale['mdp407']."</td>
<td class='tbl' width='60%'><input class='textbox' type='text' name='file_url' value='".$file_editpos['file_url']."' maxlength='200' style='width:240px;'></td>
</tr>
<tr>
<td class='tbl' width='40%'>".$locale['mdp408']."</td>
<td class='tbl' width='60%'><input class='textbox' type='text' name='file_img' value='".$file_editpos['file_img']."' maxlength='200' style='width:240px;'></td>
</tr>
<tr>
<td class='tbl' width='40%'>".$locale['mdp409']."</td>
<td class='tbl' width='60%'><input class='textbox' type='text' name='file_size' value='".$file_editpos['file_size']."' maxlength='50' style='width:240px;'> </td>
</tr>
<tr>
<td class='tbl' width='40%'>".$locale['mdp410']."</td>
<td class='tbl' width='60%'><input class='textbox' type='text' name='file_count' value='".$file_editpos['file_count']."' maxlength='10' style='width:240px;'></td>
</tr>
<tr>
<td class='tbl' width='40%'>".$locale['mdp411']."</td>
<td class='tbl' width='60%'></td>
</tr>
<tr>
<td class='tbl' width='100%' colspan='2'><table cellspacing='0' cellpadding='0' width='100%'>".$mirrors_select."</table></td>
</tr>
");
if (($file_action == 'file_edit') and ($file_id))
print("
<tr>
<td class='tbl' width='40%'>".$locale['mdp413']."</td>
<td class='tbl' width='60%'><input class='textbox' type='checkbox' name='file_update_date' value='1'></td>
</tr>
");
print("
<tr>
<td class='tbl' colspan='2'><center><input class='button' name='mdp_submit' type='submit' value='".($file_action == 'file_edit' ? $locale['mdp211'].$locale['mdp212'] : $locale['mdp210'].$locale['mdp212'])."'></center></td>
</tr>
</table>
</form>
");
}
else {
print("<center><b>".$locale['mdp225']."</b></center>");
}
closetable();
tablebreak();
// Obecne pliki
opentable($locale['mdp302']);
print("
<table cellpadding='0' cellspacing='1' width='100%' align='center' class='tbl-border'>
<tr>
<td class='tbl2' width='10%'><center>".$locale['mdp500']."</center></td>
<td class='tbl2' width='35%'><center>".$locale['mdp501']."</center></td>
<td class='tbl2' width='15%'><center>".$locale['mdp510']."</center></td>
<td class='tbl2' width='20%'><center>".$locale['mdp511']."</center></td>
<td class='tbl2' width='20%'><center>".$locale['mdp504']."</center></td>
</tr>
");
if (mysql_num_rows($cats_list) > 0) mysql_data_seek($cats_list, 0);
while ($cat_details = mysql_fetch_array($cats_list)) {
// Naglowek kategorii
print("
<tr>
<td class='forum-caption' width='100%' colspan='5'>".$cat_details['cat_name']."</td>
</tr>
");
// Pliki kategorii
$files_list = dbquery("SELECT * FROM ".$db_prefix."master_download_files WHERE file_cat='".$cat_details['cat_id']."' ORDER BY file_order");
$files_count = mysql_num_rows($files_list);
if (mysql_num_rows($files_list) == 0) {
print("
<tr>
<td class='tbl1' width='100%' colspan='5'><center>".$locale['mdp601']."</center></td>
</tr>
");
}
else {
$row_class_id = 0;
while ($file_details = mysql_fetch_array($files_list)) {
if ($file_details['file_shortcut'])
$shortcut = " <span class='small'>(<a href='".BASEDIR.MDP_DOWNLOAD_NAME."?action=get&shortcut=".$file_details['file_shortcut']."'>".$locale['mdp512']."</a>)</span>";
else
$shortcut = "";
if ($row_class_id % 2 == 0) $row_class = "tbl1"; else $row_class = "tbl2";
$row_class_id++;
print("
<tr>
<td class='".$row_class."' width='10%'><center>".$file_details['file_id']."</center></td>
<td class='".$row_class."' width='35%'>".$file_details['file_name'].$shortcut."</td>
<td class='".$row_class."' width='15%'><center>".format_filesize($file_details['file_size'])."</center></td>
<td class='".$row_class."' width='20%'><center>".$file_details['file_count']." <span class='small'>(".get_perdaycount($file_details['file_count'], $file_details['file_date']).")</span></center></td>
<td class='".$row_class."' width='20%'><center>".print_options('file', $file_details['file_order'], $files_count)."</center></td>
</tr>
");
}
}
}
// Brak kategorii
print("
<tr>
<td class='forum-caption' width='100%' colspan='5'>".$locale['mdp412']."</td>
</tr>
");
// Pliki bez kategorii
$files_list = dbquery("SELECT * FROM ".$db_prefix."master_download_files WHERE file_cat='0' ORDER BY file_id");
if (mysql_num_rows($files_list) == 0) {
print("
<tr>
<td class='tbl1' width='100%' colspan='5'><center>".$locale['mdp601']."</center></td>
</tr>
");
}
else {
$row_class_id = 0;
while ($file_details = mysql_fetch_array($files_list)) {
if ($file_details['file_shortcut'])
$shortcut = " <span class='small'>(<a href='".BASEDIR.MDP_DOWNLOAD_NAME."?action=get&shortcut=".$file_details['file_shortcut']."'>".$locale['mdp512']."</a>)</span>";
else
$shortcut = "";
if ($row_class_id % 2 == 0) $row_class = "tbl1"; else $row_class = "tbl2";
$row_class_id++;
print("
<tr>
<td class='".$row_class."' width='10%'><center>".$file_details['file_id']."</center></td>
<td class='".$row_class."' width='35%'>".$file_details['file_name'].$shortcut."</td>
<td class='".$row_class."' width='15%'><center>".format_filesize($file_details['file_size'])."</center></td>
<td class='".$row_class."' width='20%'><center>".$file_details['file_count']." <span class='small'>(".get_perdaycount($file_details['file_count'], $file_details['file_date']).")</span></center></td>
<td class='".$row_class."' width='20%'><center>".print_options('file', 0, 0)."</center></td>
</tr>
");
}
}
print("
</table><br>
<center><a href='".FUSION_SELF."?mdp_page=".$mdp_page."'>".$locale['mdp600']."</a></center>
");
closetable();
}
// ----------------------------------------
// Kategorie
// ----------------------------------------
elseif ($mdp_page == 'mdp_cats') {
// Dodaj kategorie
if ($cat_action == 'cat_add') {
if (($cat_name) and ($cat_desc)) {
if (($cat_id) and ($cat_id >= 0)) {
dbquery("UPDATE ".$db_prefix."master_download_cats SET cat_name='".$cat_name."', cat_desc='".$cat_desc."' WHERE cat_id='".$cat_id."'");
print("<center><b>".$locale['mdp221']."</b></center>");
}
else
{
// Przesuwanie pozycji
dbquery("UPDATE ".$db_prefix."master_download_cats SET cat_order=cat_order+1");
// Dodawanie pozycji
dbquery("INSERT INTO ".$db_prefix."master_download_cats (cat_name, cat_desc, cat_count, cat_order) VALUES ('".$cat_name."', '".$cat_desc."', '0', '0')");
print("<center><b>".$locale['mdp220']."</b></center>");
}
}
else
print("<center><b>".$locale['mdp222']."</b></center>");
}
// Edytuj kategorie
elseif ($cat_action == 'cat_edit') {
if (($cat_id) and ($cat_id >= 0))
$cat_editpos = mysql_fetch_array(dbquery("SELECT * FROM ".$db_prefix."master_download_cats WHERE cat_id='".$cat_id."'"));
else
print("<center><b>".$locale['mdp223']."</b></center>");
}
// Przesun w gore kategorie
elseif ($cat_action == 'cat_up') {
$result = dbquery("SELECT * FROM ".$db_prefix."master_download_cats WHERE cat_id='".$cat_id."' LIMIT 1");
$cat_details = mysql_fetch_array($result);
dbquery("UPDATE ".$db_prefix."master_download_cats SET cat_order=cat_order+1 WHERE cat_order='".($cat_details['cat_order']-1)."'");
dbquery("UPDATE ".$db_prefix."master_download_cats SET cat_order=cat_order-1 WHERE cat_id='".$cat_details['cat_id']."'");
}
// Przesun na dol kategorie
elseif ($cat_action == 'cat_down') {
$result = dbquery("SELECT * FROM ".$db_prefix."master_download_cats WHERE cat_id='".$cat_id."' LIMIT 1");
$cat_details = mysql_fetch_array($result);
dbquery("UPDATE ".$db_prefix."master_download_cats SET cat_order=cat_order-1 WHERE cat_order='".($cat_details['cat_order']+1)."'");
dbquery("UPDATE ".$db_prefix."master_download_cats SET cat_order=cat_order+1 WHERE cat_id='".$cat_details['cat_id']."'");
}
// Usun kategorie
elseif ($cat_action == 'cat_del') {
if (($cat_id) and ($cat_id >= 0)) {
$result = dbquery("SELECT * FROM ".$db_prefix."master_download_cats WHERE cat_id='".$cat_id."' LIMIT 1");
$cat_details = mysql_fetch_array($result);
// Usuwanie pozycji
dbquery("DELETE FROM ".$db_prefix."master_download_cats WHERE cat_id='".$cat_id."'");
// Przesuwanie pozycji
dbquery("UPDATE ".$db_prefix."master_download_cats SET cat_order=cat_order-1 WHERE cat_order>'".$cat_details['cat_order']."'");
// Resetowanie kategorii plikow
dbquery("UPDATE ".$db_prefix."master_download_files SET file_cat='0' WHERE file_cat='".$cat_id."'");
print("<center><b>".$locale['mdp224']."</b></center>");
}
else
print("<center><b>".$locale['mdp223']."</b></center>");
}
// Dodaj kategorie - formularz
opentable(($cat_action == 'cat_edit' ? $locale['mdp211'].$locale['mdp213'] : $locale['mdp210'].$locale['mdp213']));
print("
<form action='".FUSION_SELF."' method='post'>
<input type='hidden' name='mdp_page' value='".$mdp_page."'>
<input type='hidden' name='cat_action' value='cat_add'>
<input type='hidden' name='cat_id' value='".($cat_action == 'cat_edit' ? $cat_editpos['cat_id'] : '')."'>
<table cellspacing='0' cellpadding='0' width='100%' align='center'>
<tr>
<td class='tbl' width='40%'>".$locale['mdp400']."</td>
<td class='tbl' width='60%'><input class='textbox' type='text' name='cat_name' value='".$cat_editpos['cat_name']."' maxlength='100' style='width:240px;'></td>
</tr>
<tr>
<td class='tbl' width='40%'>".$locale['mdp401']."</td>
<td class='tbl' width='60%'><textarea class='textbox' name='cat_desc' rows='4' cols='50'>".$cat_editpos['cat_desc']."</textarea></td>
</tr>
<tr>
<td class='tbl' colspan='2'><center><input class='button' name='mdp_submit' type='submit' value='".($cat_action == 'cat_edit' ? $locale['mdp211'].$locale['mdp213'] : $locale['mdp210'].$locale['mdp213'])."'></center></td>
</tr>
</table>
</form>
");
closetable();
tablebreak();
// Obecne kategorie
$cats_list = dbquery("SELECT * FROM ".$db_prefix."master_download_cats ORDER BY cat_order");
$cats_count = mysql_num_rows($cats_list);
opentable($locale['mdp304']);
print("
<table cellpadding='0' cellspacing='1' width='100%' align='center' class='tbl-border'>
<tr>
<td class='tbl2' width='10%'><center>".$locale['mdp500']."</center></td>
<td class='tbl2' width='60%'><center>".$locale['mdp501']."</center></td>
<td class='tbl2' width='10%'><center>".$locale['mdp503']."</center></td>
<td class='tbl2' width='20%'><center>".$locale['mdp504']."</center></td>
</tr>
");
$row_class_id = 0;
while ($cat_details = mysql_fetch_array($cats_list)) {
if ($row_class_id % 2 == 0) $row_class = "tbl1"; else $row_class = "tbl2";
$row_class_id++;
print("
<tr>
<td class='".$row_class."' width='10%'><center>".$cat_details['cat_id']."</center></td>
<td class='".$row_class."' width='60%'>".$cat_details['cat_name']."</td>
<td class='".$row_class."' width='10%'><center>".$cat_details['cat_count']."</center></td>
<td class='".$row_class."' width='20%'><center>".print_options('cat', $cat_details['cat_order'], $cats_count)."</center></td>
</tr>
");
}
print("
</table><br>
<center><a href='".FUSION_SELF."?mdp_page=".$mdp_page."'>".$locale['mdp600']."</a></center>
");
closetable();
}
// ----------------------------------------
// Mirror'y
// ----------------------------------------
elseif ($mdp_page == 'mdp_mirrors') {
// Dodaj mirror
if ($mirror_action == 'mirror_add') {
if (($mirror_name) and ($mirror_url) and (isset($mirror_used)) and ($mirror_used >= 0) and (isset($mirror_limit)) and ($mirror_limit >= 0)) {
if ($mirror_url[strlen($mirror_url)-1] != '/')
$mirror_url .= '/';
if (($mirror_id) and ($mirror_id >= 0)) {
dbquery("UPDATE ".$db_prefix."master_download_mirrors SET mirror_name='".$mirror_name."', mirror_url='".$mirror_url."', mirror_used='".$mirror_used."', mirror_limit='".$mirror_limit."' WHERE mirror_id='".$mirror_id."'");
print("<center><b>".$locale['mdp221']."</b></center>");
}
else
{
dbquery("INSERT INTO ".$db_prefix."master_download_mirrors (mirror_name, mirror_url, mirror_used, mirror_limit, mirror_lastdown) VALUES ('".$mirror_name."', '".$mirror_url."', '".$mirror_used."', '".$mirror_limit."', '0')");
print("<center><b>".$locale['mdp220']."</b></center>");
}
}
else
print("<center><b>".$locale['mdp222']."</b></center>");
}
// Edytuj mirror
elseif ($mirror_action == 'mirror_edit') {
if (($mirror_id) and ($mirror_id >= 0))
$mirror_editpos = mysql_fetch_array(dbquery("SELECT * FROM ".$db_prefix."master_download_mirrors WHERE mirror_id='".$mirror_id."'"));
else
print("<center><b>".$locale['mdp223']."</b></center>");
}
// Usun mirror
elseif ($mirror_action == 'mirror_del') {
if (($mirror_id) and ($mirror_id >= 0)) {
dbquery("DELETE FROM ".$db_prefix."master_download_mirrors WHERE mirror_id='".$mirror_id."'");
// Usuwanie zaleznosci
dbquery("DELETE FROM ".$db_prefix."master_download_rels WHERE rel_mirrorid='".$mirror_id."'");
print("<center><b>".$locale['mdp224']."</b></center>");
}
else
print("<center><b>".$locale['mdp223']."</b></center>");
}
// Dodaj mirror - formularz
if (!isset($mirror_editpos['mirror_used'])) $mirror_editpos['mirror_used'] = 0;
if (!isset($mirror_editpos['mirror_limit'])) $mirror_editpos['mirror_limit'] = 0;
opentable(($mirror_action == 'mirror_edit' ? $locale['mdp211'].$locale['mdp214'] : $locale['mdp210'].$locale['mdp214']));
print("
<form action='".FUSION_SELF."' method='post'>
<input type='hidden' name='mdp_page' value='".$mdp_page."'>
<input type='hidden' name='mirror_action' value='mirror_add'>
<input type='hidden' name='mirror_id' value='".($mirror_action == 'mirror_edit' ? $mirror_editpos['mirror_id'] : '')."'>
<table cellspacing='0' cellpadding='0' width='100%' align='center'>
<tr>
<td class='tbl' width='40%'>".$locale['mdp400']."</td>
<td class='tbl' width='60%'><input class='textbox' type='text' name='mirror_name' value='".$mirror_editpos['mirror_name']."' maxlength='100' style='width:240px;'></td>
</tr>
<tr>
<td class='tbl' width='40%'>".$locale['mdp402']."</td>
<td class='tbl' width='60%'><input class='textbox' type='text' name='mirror_url' value='".$mirror_editpos['mirror_url']."' maxlength='200' style='width:240px;'></td>
</tr>
<tr>
<td class='tbl' width='40%'>".$locale['mdp403']."</td>
<td class='tbl' width='60%'><input class='textbox' type='text' name='mirror_used' value='".$mirror_editpos['mirror_used']."' maxlength='10' style='width:240px;'> KB</td>
</tr>
<tr>
<td class='tbl' width='40%'>".$locale['mdp404']."</td>
<td class='tbl' width='60%'><input class='textbox' type='text' name='mirror_limit' value='".$mirror_editpos['mirror_limit']."' maxlength='10' style='width:240px;'> KB</td>
</tr>
<tr>
<td class='tbl' colspan='2'><center><input class='button' name='mdp_submit' type='submit' value='".($mirror_action == 'mirror_edit' ? $locale['mdp211'].$locale['mdp214'] : $locale['mdp210'].$locale['mdp214'])."'></center></td>
</tr>
</table>
</form>
");
closetable();
tablebreak();
// Obecne mirror'y
$mirrors_list = dbquery("SELECT * FROM ".$db_prefix."master_download_mirrors ORDER BY mirror_name");
opentable($locale['mdp306']);
print("
<table cellpadding='0' cellspacing='1' width='100%' align='center' class='tbl-border'>
<tr>
<td class='tbl2' width='10%'><center>".$locale['mdp500']."</center></td>
<td class='tbl2' width='30%'><center>".$locale['mdp501']."</center></td>
<td class='tbl2' width='50%'><center>".$locale['mdp508']."</center></td>
<td class='tbl2' width='10%'><center>".$locale['mdp504']."</center></td>
</tr>
");
$row_class_id = 0;
while ($mirror_details = mysql_fetch_array($mirrors_list)) {
$mirror_usedperc = $mirror_details['mirror_used'] / $mirror_details['mirror_limit'];
if ($row_class_id % 2 == 0) $row_class = "tbl1"; else $row_class = "tbl2";
$row_class_id++;
print("
<tr>
<td class='".$row_class."' width='10%'><center>".$mirror_details['mirror_id']."</center></td>
<td class='".$row_class."' width='30%'>".$mirror_details['mirror_name']."</td>
<td class='".$row_class."' width='50%'>
<table width='100%' cellpadding='0' cellspacing='0'>
<tr>
<td width='70%'><center>".format_filesize($mirror_details['mirror_used'])." / ".format_filesize($mirror_details['mirror_limit'])."</center></td>
<td width='30%'><center>".sprintf("%2.2f", $mirror_usedperc*100)."%</center></td>
</tr>
</table>
</td>
<td class='".$row_class."' width='10%'><center>".print_options('mirror', 0, 0)."</center></td>
</tr>
");
}
print("
</table><br>
<center><a href='".FUSION_SELF."?mdp_page=".$mdp_page."'>".$locale['mdp600']."</a></center>
");
closetable();
}
// ----------------------------------------
// Inne
// ----------------------------------------
elseif ($mdp_page == 'mdp_others') {
// Informacje
opentable($locale['mdp307']);
print("
<b>".$locale['mdp100']." ".MDP_VERSION."</b><br>
<br>
".$locale['mdp700']."
");
closetable();
}
echo "</td>\n";
require_once BASEDIR."footer.php";
?>
Jakby co to strona http://www.elektr...n=cat&id=1
Edytowane przez elektryk dnia 02.01.2007 20:59:48
|