<?php
/*---------------------------------------------------+
| PHP-Fusion Content Management System
+----------------------------------------------------+
| Copyright © 2002 - 2008 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
+----------------------------------------------------+
| DOWNLOAD DATABASE
+----------------------------------------------------+
| Copyright © 2005 Nichelini Giuseppe - Update Dallas
| http://www.nichelini.it/
+----------------------------------------------------*/
require_once "../../maincore.php";
require_once THEMES."templates/header.php";
include INFUSIONS."advanced_downloadDB_panel/infusion_db.php";
if (file_exists(INFUSIONS."advanced_downloadDB_panel/locale/".$settings['locale'].".php")) {
include INFUSIONS."advanced_downloadDB_panel/locale/".$settings['locale'].".php";
} else { include INFUSIONS."advanced_downloadDB_panel/locale/English.php"; }
require_once INFUSIONS."advanced_downloadDB_panel/include/functions.php";
error_reporting(E_ALL ^ E_NOTICE);
$ar_order = array('DL' => $locale['dldb453'],'AZ' => $locale['dldb454']);
if (iMEMBER) {
if (isset($download_id) && !isNum($download_id)) redirect("index.php");
if (isset($download_id)) {
$res = 0;
if ($data = dbarray(dbquery("SELECT dldb_url,dldb_cat FROM ".DB_PREFIX."adv_dldb WHERE dldb_id='$download_id'"))) {
$cdata = dbarray(dbquery("SELECT * FROM ".DB_PREFIX."adv_dldb_cats WHERE dldb_cat_id='".$data['dldb_cat']."'"));
if (checkgroup($cdata['dldb_cat_access'])) {
$res = 1;
$result = dbquery("UPDATE ".DB_PREFIX."adv_dldb SET dldb_count=dldb_count+1 WHERE dldb_id='$download_id'");
redirect($data['dldb_url']);
}
}
if ($res == 0) redirect("dldb.php");
}
if (($op == "view") && ($id > 0)) {
$result1 = dbquery("SELECT * FROM ".DB_PREFIX."adv_dldb WHERE dldb_id='".$id."'");
while ($data = dbarray($result1)) {
$id = $data['dldb_id'];
opentable( $data[dldb_title]);
echo "<table border='0' cellpadding='0' cellspacing='0' width='100%'>";
echo "<tr>";
echo "<td width='100%'>";
echo "<table cellSpacing='0' cellPadding='0' align='center' width='100%' border='0' class='tbl-border'>";
echo "<tr><td width='100%'>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>";
echo "</tr>\n";
echo "<tr>";
echo "</tr>\n";
echo "<tr>";
echo "</tr>\n";
echo "<tr>";
echo "</tr>\n";
echo "<tr>";
echo "</tr>\n";
echo "<tr>";
echo "</tr>\n";
echo "<tr><td class='tbl2' colspan='3'><b>".$locale['dldb208']."</b></td></tr>\n";
echo "<tr><td class='tbl1' colspan='3'>".nl2br(parseubb($data['dldb_description']))."</td></tr>\n";
echo "</table>\n";
echo "</td></tr></table>\n";
echo "</td></tr></table>\n";
}
closetable();
} else {
echo "<form name='' method='post' action='".FUSION_SELF."'>\n";
opentable($locale['dldb100']." - v.".$locale['dldb103']);
echo "<table width='100%' align='center' cellspacing='0' cellpadding='0' border='0'>\n";
echo "<tr><td class='tbl' width='100%' align='right'>Pasirinkite leidinį:</td>";
echo "<td valign=top class='tbl'>\n";
echo "<select name='cat_id' class='textbox' onChange='submit()'>\n";
echo "<option value=''>".$locale['dldb452']."</option>\n";
$rescat = dbquery("SELECT * FROM ".$db_prefix."adv_dldb_cats ORDER BY dldb_cat_name ASC");
while ($data = dbarray($rescat)) {
if ( $cat_id == $data["dldb_cat_id"]) { echo "<option value='".$data["dldb_cat_id"]."' selected>".$data["dldb_cat_name"]."</option>\n"; }
else { echo "<option value='".$data["dldb_cat_id"]."'>".$data["dldb_cat_name"]."</option>\n"; }
}
echo "</select></td></tr>\n";
echo "</table>\n";
echo "<table width='100%' align='center' cellspacing='0' cellpadding='0' border='0'>\n";
//echo "<form name='' method='post' action='".FUSION_SELF."'>\n";
echo "<tr><td valign=top class='tbl'>\n";
echo "</td></tr>\n";
echo "</form></table>\n";
if ($cat_id > 0) { $where = " WHERE dldb_cat='".$cat_id."'";} else { $where = "";}
if ($type_id == 2) { $order = " dldb_count DESC";}
elseif ($type_id == 3) { $order = " dldb_datestamp DESC";}
else { $order = " dldb_title ASC";}
$TotCats = dbrows(dbquery("SELECT * FROM ".$db_prefix."adv_dldb_cats"));
$TotObj = dbrows(dbquery("SELECT * FROM ".$db_prefix."adv_dldb".$where));
$rows = $TotCats + $TotObj;
if (!isset($rowstart) || !isNum($rowstart)) $rowstart = 0;
$items_per_page = 17;
echo "<table width='100%' align='center' cellspacing='0' cellpadding='0' border='0' class='tbl-border'>\n";
echo "<tr><td><table width='100%' align='center' border='0' cellpadding='0'>\n";
echo "<tr>";
echo "<td class='tbl2' valign='top' align='left' width='60%' colspan='2'><b>Puslapis</b></td>\n";
echo "<td class='tbl2' valign='top' align='left' nowrap width='25%'><b>Data</b></td>\n";
echo "<td class='tbl2' valign='top' align='left' nowrap width='25%'><b>Paspaudė</b></td>\n";
echo "</tr>\n";
$catname = "";
if ($cat_id > 0) { $where2 = " AND dldb_cat ='".$cat_id."'";} else { $where2 = "";}
$myquery =" SELECT tu.*, tn.*, dldb_cat_id, dldb_cat_name FROM ".$db_prefix."adv_dldb_cats tn
LEFT JOIN ".$db_prefix."adv_dldb tu ON tn.dldb_cat_id=tu.dldb_cat
WHERE dldb_id!=''".$where2." ORDER BY dldb_cat_name ASC,".$order." LIMIT $rowstart,$items_per_page";
$result1 = dbquery($myquery);
if (dbrows($result1)>0) {
while ($data = dbarray($result1)) {
if ( ($catname == "") || ($catname != $data['dldb_cat_name']) ) {
$catname = $data['dldb_cat_name'];
echo "<tr><td class='forum-caption' colspan='7'>".$catname."</td></tr>\n";
}
if ($data['dldb_datestamp']+604800 > time()+($settings['timeoffset']*3600)) { $new = "<img src='".INFUSIONS."advanced_downloadDB_panel/images/new.gif' border='0'>"; }
else { $new = "<img src='".THEME."images/blank.gif' width='20' height='1' border='0'>"; }
echo "<tr>";
echo "<td class='tbl1' valign='middle' align='left'>".$new."</td>\n";
echo "<td class='tbl1' valign='top' align='left' width='60%'><a title='".$locale['dldb302']."' href='".FUSION_SELF."?op=view&id=".$data[dldb_id]."'>".$data[dldb_title]."</a></td>\n";
echo "<td class='tbl1' valign='top' align='center' nowrap width='20%'>".showdate("%d/%m/%Y", $data['dldb_datestamp'])."</td>\n";
echo "<td class='tbl1' valign='top' align='right' width='20%'>".$data['dldb_count']."</td>\n";
echo "</tr>\n";
}
}
echo "</table>\n";
echo "</td></tr></table>\n";
closetable();
}
if ($rows > $items_per_page) echo "<div align='center' style='margin-top:5px;'>".makepagenav($_GET['rowstart'],$items_per_page,$rows,1,FUSION_SELF."?")."\n</div>\n";
} else {
opentable($locale['dldb100']." - v.".$locale['dldb103']);
echo "<div align='center' style='margin-top:5px;'><b>aš</b></div>\n";
closetable();
}
require_once THEMES."templates/footer.php";
function CalcolaVoto ($id) {
global $locale;
}
?>