mirror of
https://github.com/e107inc/e107.git
synced 2025-08-02 12:48:26 +02:00
Handle 'no downloads' properly
This commit is contained in:
14
download.php
14
download.php
@@ -11,8 +11,8 @@
|
|||||||
| GNU General Public License (http://gnu.org).
|
| GNU General Public License (http://gnu.org).
|
||||||
|
|
|
|
||||||
| $Source: /cvs_backup/e107_0.8/download.php,v $
|
| $Source: /cvs_backup/e107_0.8/download.php,v $
|
||||||
| $Revision: 1.4 $ - with modifications
|
| $Revision: 1.5 $ - with modifications
|
||||||
| $Date: 2006-12-23 12:15:09 $
|
| $Date: 2006-12-29 13:38:55 $
|
||||||
| $Author: e107steved $
|
| $Author: e107steved $
|
||||||
|
|
|
|
||||||
+----------------------------------------------------------------------------+
|
+----------------------------------------------------------------------------+
|
||||||
@@ -67,7 +67,7 @@ if (!e_QUERY || $_GET['elan'])
|
|||||||
// Read in tree of categories which this user is allowed to see
|
// Read in tree of categories which this user is allowed to see
|
||||||
$dl = new down_cat_handler($pref['download_subsub']);
|
$dl = new down_cat_handler($pref['download_subsub']);
|
||||||
|
|
||||||
if (count($dl->cat_tree) == 0)
|
if ($dl->down_count == 0)
|
||||||
{
|
{
|
||||||
$ns->tablerender(LAN_dl_18, "<div style='text-align:center'>".LAN_dl_2."</div>");
|
$ns->tablerender(LAN_dl_18, "<div style='text-align:center'>".LAN_dl_2."</div>");
|
||||||
require_once(FOOTERF);
|
require_once(FOOTERF);
|
||||||
@@ -694,6 +694,8 @@ define("SUBSUB_PREFIX","---->"); // Added in front of sub-sub categories
|
|||||||
class down_cat_handler
|
class down_cat_handler
|
||||||
{
|
{
|
||||||
var $cat_tree; // Initialised with all categories in a tree structure
|
var $cat_tree; // Initialised with all categories in a tree structure
|
||||||
|
var $cat_count; // Count visible subcats and subsubcats
|
||||||
|
var $down_count; // Counts total downloads
|
||||||
|
|
||||||
function down_cat_handler($nest_level = 1, $load_class = USERCLASS_LIST)
|
function down_cat_handler($nest_level = 1, $load_class = USERCLASS_LIST)
|
||||||
{ // Constructor - make a copy of the tree for re-use
|
{ // Constructor - make a copy of the tree for re-use
|
||||||
@@ -712,6 +714,8 @@ class down_cat_handler
|
|||||||
global $sql2;
|
global $sql2;
|
||||||
|
|
||||||
$catlist = array();
|
$catlist = array();
|
||||||
|
$cat_count = 0;
|
||||||
|
$down_count = 0;
|
||||||
$temp1 = "";
|
$temp1 = "";
|
||||||
$temp2 = "";
|
$temp2 = "";
|
||||||
if ($load_cat_class != "")
|
if ($load_cat_class != "")
|
||||||
@@ -749,6 +753,8 @@ class down_cat_handler
|
|||||||
{
|
{
|
||||||
if (isset($catlist[$tmp]))
|
if (isset($catlist[$tmp]))
|
||||||
{ // Sub-Category
|
{ // Sub-Category
|
||||||
|
$cat_count++;
|
||||||
|
$down_count += $row['d_count'];
|
||||||
$catlist[$tmp]['subcats'][$row['download_category_id']] = $row;
|
$catlist[$tmp]['subcats'][$row['download_category_id']] = $row;
|
||||||
$catlist[$tmp]['subcats'][$row['download_category_id']]['subsubcats'] = array();
|
$catlist[$tmp]['subcats'][$row['download_category_id']]['subsubcats'] = array();
|
||||||
$catlist[$tmp]['subcats'][$row['download_category_id']]['d_last_subs'] =
|
$catlist[$tmp]['subcats'][$row['download_category_id']]['d_last_subs'] =
|
||||||
@@ -758,6 +764,8 @@ class down_cat_handler
|
|||||||
{ // Its a sub-sub category
|
{ // Its a sub-sub category
|
||||||
if (isset($catlist[$row['d_parent1']]['subcats'][$tmp]))
|
if (isset($catlist[$row['d_parent1']]['subcats'][$tmp]))
|
||||||
{
|
{
|
||||||
|
$cat_count++;
|
||||||
|
$down_count += $row['d_count'];
|
||||||
if ($nest_level == 0)
|
if ($nest_level == 0)
|
||||||
{ // Add the counts into the subcategory values
|
{ // Add the counts into the subcategory values
|
||||||
$catlist[$row['d_parent1']]['subcats'][$tmp]['d_size'] += $row['d_size'];
|
$catlist[$row['d_parent1']]['subcats'][$tmp]['d_size'] += $row['d_size'];
|
||||||
|
Reference in New Issue
Block a user