Code:<?php
/************************************************************************/
/* Advanced Downloads Block */
/* =========================== */
/* */
/* This is basically just an edit of the original block by Francisco. */
/* Even though this is heavly edited, I think he deserves credit, so: */
/* */
/* Copyright (c) 2002 by Francisco Burzi */
/* http://phpnuke.org */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/************************************************************************/
/* */
/* Copyright © 2002 by Michael Bacoz */
/* http://www.fatal-instinct.com */
/* */
/************************************************************************/
/************************/
/* Variables */
/************************/
$downloadstoshow = 10;
$usemarquee = 1;
$scrolldirection = "Up";
/********************************************/
/* Edit the following to suit your language */
/********************************************/
$newest = "Newest Files";
$most = "Most Downloaded";
$latest = "Latest Downloads";
$lastupdated = "Last Updated";
$totalfiles = "Total Files";
$totalcategories = "Total Categories";
$totaldownloads = "Total Downloads";
$hitstext = "Downloaded";
$addedon = "Added on";
/************************/
/* End Variables */
/************************/
// Make sure people don't try and access it directly
if (eregi("block-Advanced_Downloads.php",$PHP_SELF)) {
Header("Location: index.php");
die();
}
global $prefix, $db, $sitename;
// Total Files
$result = $db->sql_query("select * from ".$prefix."_downloads_downloads");
$files = $db->sql_numrows($result);
// Total Categories
$result2 = $db->sql_query("select * from ".$prefix."_downloads_categories");
$cats = $db->sql_numrows($result2);
// Total Downloads
$result3 = $db->sql_query("select hits from ".$prefix."_downloads_downloads");
$a = 1;
while(list($hits) = $db->sql_fetchrow($result3)) {
$total_hits = $total_hits + $hits;
$a++;
}
$content .= "<b>$totalfiles: $files<br>$totalcategories: $cats<br> $totaldownloads: $total_hits<br></b>";
if ($usemarquee == 1) {
$content .= "<Marquee Behavior=\"Scroll\" Direction=\"$scrolldirection\" Height=\"200\" ScrollAmount=\"2\" ScrollDelay=\"100\" onMouseOver=\"this.stop()\" onMouseOut=\"this.start()\"><br>";
}
// Latest added
$content .= "<center><br><img src=\"images/red_dot.gif\"> <b><u>$newest</u></b> <img src=\"images/red_dot.gif\"><br></center>";
$a = 1;
$result4 = $db->sql_query("select lid, title, date, hits from ".$prefix."_downloads_downloads order by date DESC limit 0,$downloadstoshow");
while(list($lid, $title, $date, $hits) = $db->sql_fetchrow($result4)) {
setlocale (LC_TIME, $locale);
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $date, $datetime);
$datetime = strftime("%d-%b-%Y", mktime($datetime[4],$datetime[5],$datetime[6],$datetime[2],$datetime[3],$datetime[1]));
$datetime = ucfirst($datetime);
$transfertitle = str_replace (" ", "_", $title);
$title2 = ereg_replace("_", " ", $title);
$content .= "<img src=\"images/icon_ultima.gif\"> $a: <a href=\"modules.php?name=Downloads&d_op=viewdownloaddetails&lid=$lid&ttitle=$transfertitle\"><b>$title2</b></a> ($hits)<br>[$addedon: <b>$datetime</b>]<br><hr>";
$a++;
}
// Last updated
$sql_t = "SELECT * FROM ".$prefix."_bbconfig";
$result_t = $db->sql_query($sql_t);
while ( $row_t = $db->sql_fetchrow($result_t) )
{
$board_config[$row_t['config_name']] = $row_t['config_value'];
}
$content .= "<center><br><img src=\"images/green_dot.gif\"> <b><u>$lastupdated</u></b> <img src=\"images/green_dot.gif\"><br></center>";
$a = 1;
$result5 = $db->sql_query("select lid, title, hits, uddate from ".$prefix."_downloads_downloads WHERE uddate!='0' order by uddate DESC limit 0,$downloadstoshow");
while(list($lid, $title, $hits, $uddate) = $db->sql_fetchrow($result5)) {
$udtime = gmdate("M d, Y", $uddate + (3600 * $board_config['board_timezone']));
$transfertitle = str_replace (" ", "_", $title);
$title2 = ereg_replace("_", " ", $title);
$content .= "<img src=\"images/icon_ultima.gif\"> $a: <a href=\"modules.php?name=Downloads&d_op=viewdownloaddetails&lid=$lid&ttitle=$transfertitle\"><b>$title2</b></a> ($hits)<br>[$lastupdated: <b>$udtime</b>]<br><hr>";
$a++;
}
// Most downloaded
$content .= "<center><br><img src=\"images/popular.gif\"> <b><u>$most</u></b> <img src=\"images/popular.gif\"><br></center>";
$a = 1;
$result6 = $db->sql_query("select lid, title, hits from ".$prefix."_downloads_downloads order by hits DESC limit 0,$downloadstoshow");
while(list($lid, $title, $hits) = sql_fetch_row($result6)) {
if ($hits == 1) {
$hitstimes = "Time";
} else {
$hitstimes = "Times";
}
$transfertitle = str_replace (" ", "_", $title);
$title2 = ereg_replace("_", " ", $title);
$content .= "<img src=\"images/icon_ultima.gif\"> $a: <a href=\"modules.php?name=Downloads&d_op=viewdownloaddetails&lid=$lid&ttitle=$transfertitle\"><b>$title2</b></a><br>[$hitstext: <b>$hits</b> $hitstimes]<br><hr>";
$a++;
}
$content .= "</Marquee><br><center><a href=\"downloads.html\"><b>$sitename<br>"._UDOWNLOADS."</b></a><br><br></center>";
?>
|