diff --git a/e107_plugins/download/download.php b/e107_plugins/download/download.php
index c52c749ef..ba92cad1e 100644
--- a/e107_plugins/download/download.php
+++ b/e107_plugins/download/download.php
@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/download/download.php,v $
-| $Revision: 1.5 $
-| $Date: 2009-02-11 21:41:54 $
+| $Revision: 1.6 $
+| $Date: 2009-05-03 21:16:15 $
| $Author: bugrain $
|
+----------------------------------------------------------------------------+
@@ -78,6 +78,7 @@ else
$id = intval($tmp[1]);
$errnum = intval(varset($tmp[2],0));
}
+
switch ($action)
{
case 'list' : // Category-based listing
@@ -122,11 +123,15 @@ else
require_once(HEADERF);
switch ($errnum)
{
- case 1 :
- $errmsg = LAN_dl_63; // No permissions
+ case 1 : // No permissions
+ if (strlen($pref['download_denied']) > 0) {
+ $errmsg = $tp->toHTML($pref['download_denied'],true);
+ } else {
+ $errmsg = LAN_dl_63;
+ }
break;
- case 2 :
- $errmsg = LAN_dl_62; // Quota exceeded
+ case 2 : // Quota exceeded
+ $errmsg = LAN_dl_62;
break;
default:
$errmsg = LAN_dl_61." ".$errnum; // Generic error - shouldn't happen
diff --git a/e107_plugins/download/download_admin.php b/e107_plugins/download/download_admin.php
index 80170e558..301f0866d 100644
--- a/e107_plugins/download/download_admin.php
+++ b/e107_plugins/download/download_admin.php
@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/download/download_admin.php,v $
-| $Revision: 1.8 $
-| $Date: 2009-02-11 22:50:43 $
+| $Revision: 1.9 $
+| $Date: 2009-05-03 21:16:15 $
| $Author: bugrain $
+----------------------------------------------------------------------------+
*/
@@ -29,13 +29,16 @@ if (!getperms("P") || !plugInstalled('download'))
include_lan(e_PLUGIN.'download/languages/'.e_LANGUAGE.'/lan_download.php');
include_lan(e_PLUGIN.'download/languages/'.e_LANGUAGE.'/lan_download_admin.php');
-require_once(e_PLUGIN.'download/handlers/download_class.php');
-require_once(e_HANDLER."calendar/calendar_class.php");
+require_once(e_PLUGIN.'download/handlers/adminDownload_class.php');
+require_once(e_HANDLER."form_handler.php");
require_once(e_HANDLER."ren_help.php");
+require_once(e_HANDLER."calendar/calendar_class.php");
$cal = new DHTML_Calendar(true);
+$gen = new convert();
+
function headerjs()
{
- global $cal;
+ global $cal;
return $cal->load_files();
}
@@ -80,7 +83,7 @@ if (e_QUERY)
}
-if(isset($_POST['delete']))
+if (isset($_POST['delete']))
{
$tmp = array_keys($_POST['delete']);
list($delete, $del_id) = explode("_", $tmp[0]);
@@ -91,7 +94,7 @@ if(isset($_POST['delete']))
$from = ($from ? $from : 0);
$amount = 50;
-if(isset($_POST))
+if (isset($_POST))
{
$e107cache->clear("download_cat");
}
@@ -110,7 +113,7 @@ if (isset($_POST['submit_download']))
}
-if(isset($_POST['update_catorder']))
+if (isset($_POST['update_catorder']))
{
foreach($_POST['catorder'] as $key=>$order)
{
@@ -153,9 +156,9 @@ if (isset($_POST['updateoptions']))
$targetFields = array('gen_datestamp', 'gen_user_id', 'gen_ip', 'gen_intdata', 'gen_chardata'); // Fields for download limits
-if(isset($_POST['addlimit']))
+if (isset($_POST['addlimit']))
{
- if($sql->db_Select('generic','gen_id',"gen_type = 'download_limit' AND gen_datestamp = {$_POST['newlimit_class']}"))
+ if ($sql->db_Select('generic','gen_id',"gen_type = 'download_limit' AND gen_datestamp = {$_POST['newlimit_class']}"))
{
$message = DOWLAN_116;
}
@@ -168,7 +171,7 @@ if(isset($_POST['addlimit']))
$vals[$targetFields[$k]] = intval($_POST[$lName]);
}
$valString = implode(',',$vals);
- if($sql->db_Insert('generic',$vals))
+ if ($sql->db_Insert('generic',$vals))
{
$message = DOWLAN_117;
$admin_log->log_event('DOWNL_09',$valString,E_LOG_INFORMATIVE,'');
@@ -182,29 +185,29 @@ if(isset($_POST['addlimit']))
}
-if(isset($_POST['updatelimits']))
+if (isset($_POST['updatelimits']))
{
- if($pref['download_limits'] != $_POST['download_limits'])
+ if ($pref['download_limits'] != $_POST['download_limits'])
{
$pref['download_limits'] = ($_POST['download_limits'] == 'on') ? 1 : 0;
save_prefs();
- $message .= DOWLAN_126."
";
+ $message .= DOWLAN_126."
";
}
foreach(array_keys($_POST['count_num']) as $idLim)
{
$idLim = intval($idLim);
- if(!$_POST['count_num'][$idLim] && !$_POST['count_days'][$idLim] && !$_POST['bw_num'][$idLim] && !$_POST['bw_days'][$idLim])
+ if (!$_POST['count_num'][$idLim] && !$_POST['count_days'][$idLim] && !$_POST['bw_num'][$idLim] && !$_POST['bw_days'][$idLim])
{
//All entries empty - Remove record
- if($sql->db_Delete('generic',"gen_id = {$idLim}"))
+ if ($sql->db_Delete('generic',"gen_id = {$idLim}"))
{
- $message .= $idLim." - ".DOWLAN_119."
";
+ $message .= $idLim." - ".DOWLAN_119."
";
$admin_log->log_event('DOWNL_11','ID: '.$idLim,E_LOG_INFORMATIVE,'');
}
else
{
- $message .= $idLim." - ".DOWLAN_120."
";
+ $message .= $idLim." - ".DOWLAN_120."
";
}
}
else
@@ -217,22 +220,22 @@ if(isset($_POST['updatelimits']))
$valString = implode(',',$vals);
$sql->db_UpdateArray('generic',$vals," WHERE gen_id = {$idLim}");
$admin_log->log_event('DOWNL_10',$idLim.', '.$valString,E_LOG_INFORMATIVE,'');
- $message .= $idLim." - ".DOWLAN_121."
";
+ $message .= $idLim." - ".DOWLAN_121."
";
unset($vals);
}
}
}
-if(isset($_POST['submit_mirror']))
+if (isset($_POST['submit_mirror']))
{
$adminDownload->submit_mirror($subAction, $id);
}
-if($action == "mirror")
+if ($action == "mirror")
{
- $download -> show_existing_mirrors();
+ $adminDownload->show_existing_mirrors();
}
@@ -268,9 +271,18 @@ if ($action == 'cat')
if ($delete == 'main')
{
- $result = admin_update($sql->db_Delete('download', 'download_id='.$del_id), 'delete', DOWLAN_27." #".$del_id." ".DOWLAN_36);
- if($result)
+ $result = $sql->db_Delete('download', 'download_id='.$del_id);
+ if ($result)
{
+ // Process triggers before calling admin_update so trigger messages can be shown
+ $data = array('method'=>'delete', 'table'=>'download', 'id'=>$del_id, 'plugin'=>'download', 'function'=>'delete_download');
+ $hooks = $e107->e_event->triggerHook($data);
+ require_once(e_HANDLER."message_handler.php");
+ $emessage = &eMessage::getInstance();
+ $emessage->add($hooks, E_MESSAGE_SUCCESS);
+
+ admin_update($result, 'delete', DOWLAN_27." #".$del_id." ".DOWLAN_36);
+
$admin_log->log_event('DOWNL_07',$del_id,E_LOG_INFORMATIVE,'');
admin_purge_related('download', $del_id);
$e_event->trigger('dldelete', $del_id);
@@ -278,7 +290,6 @@ if ($delete == 'main')
unset($subAction, $id);
}
-
if (isset($message))
{
$ns->tablerender("", "