Changeset 1509 in ExiteCMS for branches/PLi-Fusion/downloads.php


Ignore:
Timestamp:
07/02/08 18:27:06 (4 years ago)
Author:
hverton
Message:

Merged trunk revisions 1408:1508 into the PLi-Fusion branch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/PLi-Fusion/downloads.php

    r1227 r1509  
    6666// if a download ID is given... 
    6767if (isset($download_id)) { 
    68     $res = 0; 
    6968    // and it exists ... 
    7069    if ($data = dbarray(dbquery("SELECT download_url,download_cat FROM ".$db_prefix."downloads WHERE download_id='$download_id'"))) { 
     
    7271        // and the user has access to it... 
    7372        if (checkgroup($cdata['download_cat_access'])) { 
    74             $res = 1; 
    7573            // update the download counter (if we're using internal statistics) 
    76             if (!isset($settings['remote_stats']) || !$settings['remote_stats']) $result = dbquery("UPDATE ".$db_prefix."downloads SET download_count=download_count+1 WHERE download_id='$download_id'"); 
     74            if (!isset($settings['dlstats_remote']) || !$settings['dlstats_remote']) $result = dbquery("UPDATE ".$db_prefix."downloads SET download_count=download_count+1 WHERE download_id='$download_id'"); 
    7775            // if a URL is given for the download, redirect to it, else fall back to the download category 
    7876            if ($data['download_url']) { 
     77                // download statistics plugin installed but no remote stats used? Then update the IP counters 
     78                if (isset($settings['dlstats_remote']) && !$settings['dlstats_remote']) { 
     79                    if (USER_IP != "0.0.0.0") { 
     80                        $result = dbquery("INSERT INTO ".$db_prefix."dlstats_ips (dlsi_ip, dlsi_ccode, dlsi_counter) VALUES ('".USER_IP."', '".USER_CC."', '1') ON DUPLICATE KEY UPDATE dlsi_counter = dlsi_counter + 1"); 
     81                    } 
     82                } 
    7983                redirect($data['download_url']); 
    8084                exit; 
     
    107111    $variables['subcats'] = false; 
    108112    $result = dbquery("SELECT * FROM ".$db_prefix."download_cats WHERE download_parent='0' AND ".groupaccess('download_cat_access').($where==""?"":(" AND ".$where))." ORDER BY download_datestamp DESC"); 
    109     if ($result) { 
     113    if (!$result) { 
    110114        // any downloads in the 'root' are public, and ordered by download_id DESC, by default! 
    111115        $variables['parent'] = array('download_cat_access' => 0, 'download_cat_sorting' => 'download_id DESC');  
    112116        $cat_id = 0; 
    113     } else { 
    114         die('oops'); 
    115117    } 
    116118} 
     
    139141} 
    140142 
     143// check if we have categories at all 
     144$variables['have_cats'] = dbfunction("COUNT(*)", "download_cats"); 
     145 
    141146// define the body panel variables 
    142147$template_panels[] = array('type' => 'body', 'name' => 'downloads', 'template' => 'main.downloads.tpl', 'locale' => "main.downloads"); 
Note: See TracChangeset for help on using the changeset viewer.