1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 04:10:38 +02:00

Bugtracker #4568 - extend download url field (255 is recommended max). Also admin logging, plus some tidying up

This commit is contained in:
e107steved
2008-12-06 15:48:26 +00:00
parent cee0b1e802
commit cacf90d2a0
10 changed files with 295 additions and 144 deletions

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_admin/download.php,v $ | $Source: /cvs_backup/e107_0.8/e107_admin/download.php,v $
| $Revision: 1.14 $ | $Revision: 1.15 $
| $Date: 2008-11-20 20:34:44 $ | $Date: 2008-12-06 15:48:16 $
| $Author: e107steved $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -67,16 +67,18 @@ if (e_QUERY)
{ {
$tmp = explode(".", e_QUERY); $tmp = explode(".", e_QUERY);
$action = $tmp[0]; $action = $tmp[0];
$sub_action = varset($tmp[1],''); $sub_action = varset($tmp[1],'');
$id = varset($tmp[2],''); $id = intval(varset($tmp[2],''));
$from = varset($tmp[3], 0); $from = varset($tmp[3], 0);
unset($tmp); unset($tmp);
} }
if(isset($_POST['delete'])) if(isset($_POST['delete']))
{ {
$tmp = array_keys($_POST['delete']); $tmp = array_keys($_POST['delete']);
list($delete, $del_id) = explode("_", $tmp[0]); list($delete, $del_id) = explode("_", $tmp[0]);
$del_id = intval($del_id);
unset($_POST['searchquery']); unset($_POST['searchquery']);
} }
@@ -133,6 +135,7 @@ if (isset($_POST['add_category']))
$download->create_category($sub_action, $id); $download->create_category($sub_action, $id);
} }
if (isset($_POST['submit_download'])) if (isset($_POST['submit_download']))
{ {
$download->submit_download($sub_action, $id); $download->submit_download($sub_action, $id);
@@ -143,34 +146,44 @@ if (isset($_POST['submit_download']))
if(isset($_POST['update_catorder'])) if(isset($_POST['update_catorder']))
{ {
foreach($_POST['catorder'] as $key=>$order) foreach($_POST['catorder'] as $key=>$order)
{
if (is_numeric($_POST['catorder'][$key]))
{ {
$sql -> db_Update("download_category", "download_category_order='".intval($order)."' WHERE download_category_id='".intval($key)."'"); if (is_numeric($_POST['catorder'][$key]))
{
$sql -> db_Update("download_category", "download_category_order='".intval($order)."' WHERE download_category_id='".intval($key)."'");
}
} }
} $admin_log->log_event('DOWNL_08',implode(',',array_keys($_POST['catorder'])),E_LOG_INFORMATIVE,'');
$ns->tablerender("", "<div style='text-align:center'><b>".LAN_UPDATED."</b></div>"); $ns->tablerender("", "<div style='text-align:center'><b>".LAN_UPDATED."</b></div>");
} }
if (isset($_POST['updateoptions'])) if (isset($_POST['updateoptions']))
{ {
$pref['download_php'] = $_POST['download_php']; unset($temp);
$pref['download_view'] = $_POST['download_view']; $temp['download_php'] = $_POST['download_php'];
$pref['download_sort'] = $_POST['download_sort']; $temp['download_view'] = $_POST['download_view'];
$pref['download_order'] = $_POST['download_order']; $temp['download_sort'] = $_POST['download_sort'];
$pref['agree_flag'] = $_POST['agree_flag']; $temp['download_order'] = $_POST['download_order'];
$pref['download_email'] = $_POST['download_email']; $temp['agree_flag'] = $_POST['agree_flag'];
$pref['agree_text'] = $tp->toDB($_POST['agree_text']); $temp['download_email'] = $_POST['download_email'];
$pref['download_denied'] = $tp->toDB($_POST['download_denied']); $temp['agree_text'] = $tp->toDB($_POST['agree_text']);
$pref['download_reportbroken'] = $_POST['download_reportbroken']; $temp['download_denied'] = $tp->toDB($_POST['download_denied']);
if ($_POST['download_subsub']) $pref['download_subsub'] = '1'; else $pref['download_subsub'] = '0'; $temp['download_reportbroken'] = $_POST['download_reportbroken'];
if ($_POST['download_incinfo']) $pref['download_incinfo'] = '1'; else $pref['download_incinfo'] = '0'; if ($_POST['download_subsub']) $temp['download_subsub'] = '1'; else $temp['download_subsub'] = '0';
save_prefs(); if ($_POST['download_incinfo']) $temp['download_incinfo'] = '1'; else $temp['download_incinfo'] = '0';
$message = DOWLAN_65; if ($admin_log->logArrayDiffs($temp, $pref, 'DOWNL_01'))
{
save_prefs();
$message = DOWLAN_65;
}
else
{
$message = DOWLAN_8;
}
} }
$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']))
{ {
@@ -180,14 +193,23 @@ if(isset($_POST['addlimit']))
} }
else else
{ {
if($sql->db_Insert('generic',"0, 'download_limit', '".intval($_POST['newlimit_class'])."', '".intval($_POST['new_bw_num'])."', '".intval($_POST['new_bw_days'])."', '".intval($_POST['new_count_num'])."', '".intval($_POST['new_count_days'])."'")) $vals = array();
$vals['gen_type'] = 'download_limit';
foreach(array('newlimit_class','new_bw_num','new_bw_days','new_count_num','new_count_days') as $k => $lName)
{
$vals[$targetFields[$k]] = intval($_POST[$lName]);
}
$valString = implode(',',$vals);
if($sql->db_Insert('generic',$vals))
{ {
$message = DOWLAN_117; $message = DOWLAN_117;
$admin_log->log_event('DOWNL_09',$valString,E_LOG_INFORMATIVE,'');
} }
else else
{ {
$message = DOWLAN_118; $message = DOWLAN_118;
} }
unset($vals);
} }
} }
@@ -201,24 +223,34 @@ if(isset($_POST['updatelimits']))
save_prefs(); save_prefs();
$message .= DOWLAN_126."<br />"; $message .= DOWLAN_126."<br />";
} }
foreach(array_keys($_POST['count_num']) as $id) foreach(array_keys($_POST['count_num']) as $idLim)
{ {
if(!$_POST['count_num'][$id] && !$_POST['count_days'][$id] && !$_POST['bw_num'][$id] && !$_POST['bw_days'][$id]) $idLim = intval($idLim);
if(!$_POST['count_num'][$idLim] && !$_POST['count_days'][$idLim] && !$_POST['bw_num'][$idLim] && !$_POST['bw_days'][$idLim])
{ {
//All entries empty - Remove record //All entries empty - Remove record
if($sql->db_Delete('generic',"gen_id = {$id}")) if($sql->db_Delete('generic',"gen_id = {$idLim}"))
{ {
$message .= $id." - ".DOWLAN_119."<br />"; $message .= $idLim." - ".DOWLAN_119."<br />";
$admin_log->log_event('DOWNL_11','ID: '.$idLim,E_LOG_INFORMATIVE,'');
} }
else else
{ {
$message .= $id." - ".DOWLAN_120."<br />"; $message .= $idLim." - ".DOWLAN_120."<br />";
} }
} }
else else
{ {
$sql->db_Update('generic',"gen_user_id = '".intval($_POST['bw_num'][$id])."', gen_ip = '".intval($_POST['bw_days'][$id])."', gen_intdata = '".intval($_POST['count_num'][$id])."', gen_chardata = '".intval($_POST['count_days'][$id])."' WHERE gen_id = {$id}"); $vals = array();
$message .= $id." - ".DOWLAN_121."<br />"; foreach(array('bw_num','bw_days','count_num','count_days') as $k => $lName)
{
$vals[$targetFields[$k+1]] = intval($_POST[$lName][$idLim]);
}
$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."<br />";
unset($vals);
} }
} }
} }
@@ -252,14 +284,15 @@ if ($action == "create")
if ($delete == 'category') if ($delete == 'category')
{ {
if (admin_update($sql->db_Delete("download_category", "download_category_id='$del_id' "), 'delete', DOWLAN_49." #".$del_id." ".DOWLAN_36)) if (admin_update($sql->db_Delete('download_category', 'download_category_id='.$del_id), 'delete', DOWLAN_49." #".$del_id." ".DOWLAN_36))
{ {
$sql->db_Delete("download_category", "download_category_parent='{$del_id}' "); $sql->db_Delete('download_category', 'download_category_parent='.$del_id);
$admin_log->log_event('DOWNL_04',$del_id,E_LOG_INFORMATIVE,'');
} }
} }
if ($action == "cat") if ($action == 'cat')
{ {
$download->show_categories($sub_action, $id); $download->show_categories($sub_action, $id);
} }
@@ -267,11 +300,12 @@ if ($action == "cat")
if ($delete == 'main') if ($delete == 'main')
{ {
$result = admin_update($sql->db_Delete("download", "download_id='$del_id' "), 'delete', DOWLAN_27." #".$del_id." ".DOWLAN_36); $result = admin_update($sql->db_Delete('download', 'download_id='.$del_id), 'delete', DOWLAN_27." #".$del_id." ".DOWLAN_36);
if($result) if($result)
{ {
admin_purge_related("download", $del_id); $admin_log->log_event('DOWNL_07',$del_id,E_LOG_INFORMATIVE,'');
$e_event->trigger("dldelete", $del_id); admin_purge_related('download', $del_id);
$e_event->trigger('dldelete', $del_id);
} }
unset($sub_action, $id); unset($sub_action, $id);
} }
@@ -873,7 +907,7 @@ class download
<div id='use_ext' style='padding-top:6px;{$dt}'> <div id='use_ext' style='padding-top:6px;{$dt}'>
URL:&nbsp; URL:&nbsp;
<input class='tbox' type='text' name='download_url_external' size='70' value='{$download_url_external}' maxlength='150' /> <input class='tbox' type='text' name='download_url_external' size='70' value='{$download_url_external}' maxlength='255' />
&nbsp;&nbsp;&nbsp;".DOWLAN_66." &nbsp;&nbsp;&nbsp;".DOWLAN_66."
<input class='tbox' type='text' name='download_filesize_external' size='8' value='{$download_filesize}' maxlength='10' /> <input class='tbox' type='text' name='download_filesize_external' size='8' value='{$download_filesize}' maxlength='10' />
</div> </div>
@@ -1151,21 +1185,22 @@ class download
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
function show_message($message) { function show_message($message) {
global $ns; global $ns;
$ns->tablerender("", "<div style='text-align:center'><b>".$message."</b></div>"); $ns->tablerender("", "<div style='text-align:center'><b>".$message."</b></div>");
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Actually save a new or edited download to the DB
function submit_download($sub_action, $id) function submit_download($sub_action, $id)
{ {
global $tp, $sql, $DOWNLOADS_DIRECTORY, $e_event; global $tp, $sql, $DOWNLOADS_DIRECTORY, $e_event;
$dlInfo = array();
$dlMirrors = array();
if($sub_action == 'edit') if($sub_action == 'edit')
{ {
if($_POST['download_url_external'] == '') if($_POST['download_url_external'] == '')
@@ -1176,40 +1211,41 @@ class download
if ($_POST['download_url_external'] && $_POST['download_url'] == '') if ($_POST['download_url_external'] && $_POST['download_url'] == '')
{ {
$durl = $_POST['download_url_external']; $dlInfo['download_url'] = $tp->toDB($_POST['download_url_external']);
$filesize = $_POST['download_filesize_external']; $filesize = intval($_POST['download_filesize_external']);
} }
else else
{ {
$durl = $_POST['download_url']; $dlInfo['download_url'] = $tp->toDB($_POST['download_url']);
if($_POST['download_filesize_external']) if($_POST['download_filesize_external'])
{ {
$filesize = $_POST['download_filesize_external']; $filesize = intval($_POST['download_filesize_external']);
} }
else else
{ {
if (strpos($DOWNLOADS_DIRECTORY, "/") === 0 || strpos($DOWNLOADS_DIRECTORY, ":") >= 1) if (strpos($DOWNLOADS_DIRECTORY, "/") === 0 || strpos($DOWNLOADS_DIRECTORY, ":") >= 1)
{ {
$filesize = filesize($DOWNLOADS_DIRECTORY.$durl); $filesize = filesize($DOWNLOADS_DIRECTORY.$dlInfo['download_url']);
} }
else else
{ {
$filesize = filesize(e_BASE.$DOWNLOADS_DIRECTORY.$durl); $filesize = filesize(e_BASE.$DOWNLOADS_DIRECTORY.$dlInfo['download_url']);
} }
} }
} }
if (!$filesize) if (!$filesize)
{ {
if($sql->db_Select("upload", "upload_filesize", "upload_file='$durl'")) if($sql->db_Select("upload", "upload_filesize", "upload_file='{$dlInfo['download_url']}'"))
{ {
$row = $sql->db_Fetch(); $row = $sql->db_Fetch();
$filesize = $row['upload_filesize']; $filesize = $row['upload_filesize'];
} }
} }
$dlInfo['download_filesize'] = $filesize;
// ---- Move Images and Files ------------ // ---- Move Images and Files ------------
if($_POST['move_image']) if($_POST['move_image'])
{ {
if($_POST['download_thumb']) if($_POST['download_thumb'])
@@ -1240,26 +1276,38 @@ class download
{ {
return; return;
} }
$durl = str_replace(e_DOWNLOAD,"",$newname); $dlInfo['download_url'] = str_replace(e_DOWNLOAD,"",$newname);
} }
// ------------------------------------------ // ------------------------------------------
$_POST['download_description'] = $tp->toDB($_POST['download_description']); $dlInfo['download_description'] = $tp->toDB($_POST['download_description']);
$_POST['download_name'] = $tp->toDB($_POST['download_name']); $dlInfo['download_name'] = $tp->toDB($_POST['download_name']);
$_POST['download_author'] = $tp->toDB($_POST['download_author']); $dlInfo['download_author'] = $tp->toDB($_POST['download_author']);
$dlInfo['download_author_email'] = $tp->toDB($_POST['download_author_email']);
if (preg_match("#(.*?)/(.*?)/(.*?) (.*?):(.*?):(.*?)$#", $_POST['download_datestamp'], $matches)){ $dlInfo['download_author_website'] = $tp->toDB($_POST['download_author_website']);
$_POST['download_datestamp'] = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[1], $matches[3]); $dlInfo['download_category'] = intval($_POST['download_category']);
}else{ $dlInfo['download_active'] = intval($_POST['download_active']);
$_POST['download_datestamp'] = time(); $dlInfo['download_thumb'] = $tp->toDB($_POST['download_thumb']);
$dlInfo['download_image'] = $tp->toDB($_POST['download_image']);
$dlInfo['download_comment'] = $tp->toDB($_POST['download_comment']);
$dlInfo['download_class'] = intval($_POST['download_class']);
$dlInfo['download_visible'] =intval($_POST['download_visible']);
if (preg_match("#(.*?)/(.*?)/(.*?) (.*?):(.*?):(.*?)$#", $_POST['download_datestamp'], $matches))
{
$dlInfo['download_datestamp'] = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[1], $matches[3]);
}
else
{
$dlInfo['download_datestamp'] = time();
} }
if($_POST['update_datestamp']) if($_POST['update_datestamp'])
{ {
$_POST['download_datestamp'] = time(); $dlInfo['download_datestamp'] = time();
} }
$mirrorStr = ""; $mirrorStr = "";
@@ -1311,18 +1359,27 @@ class download
$mirrorStr = $this->compressMirrorArray($newMirrorArray); $mirrorStr = $this->compressMirrorArray($newMirrorArray);
} }
$dlMirrors['download_mirror']=$mirrorStr;
$dlMirrors['download_mirror_type']=intval($_POST['download_mirror_type']);
if ($id) if ($id)
{ // Its an edit { // Its an edit
admin_update($sql->db_Update("download", "download_name='".$_POST['download_name']."', download_url='".$durl."', download_author='".$_POST['download_author']."', download_author_email='".$_POST['download_author_email']."', download_author_website='".$_POST['download_author_website']."', download_description='".$_POST['download_description']."', download_filesize='".$filesize."', download_category='".intval($_POST['download_category'])."', download_active='".intval($_POST['download_active'])."', download_datestamp='".intval($_POST['download_datestamp'])."', download_thumb='".$_POST['download_thumb']."', download_image='".$_POST['download_image']."', download_comment='".intval($_POST['download_comment'])."', download_class = '{$_POST['download_class']}', download_mirror='$mirrorStr', download_mirror_type='".intval($_POST['download_mirror_type'])."' , download_visible='".$_POST['download_visible']."' WHERE download_id=".intval($id)), 'update', DOWLAN_2." (<a href='".e_BASE."download.php?view.".$id."'>".$_POST['download_name']."</a>)"); admin_update($sql->db_UpdateArray('download',array_merge($dlInfo,$dlMirrors),'WHERE download_id='.intval($id)), 'update', DOWLAN_2." (<a href='".e_BASE."download.php?view.".$id."'>".$_POST['download_name']."</a>)");
$dlinfo = array("download_id" => $download_id, "download_name" => $_POST['download_name'], "download_url" => $durl, "download_author" => $_POST['download_author'], "download_author_email" => $_POST['download_author_email'], "download_author_website" => $_POST['download_author_website'], "download_description" => $_POST['download_description'], "download_filesize" => $filesize, "download_category" => $_POST['download_category'], "download_active" => $_POST['download_active'], "download_datestamp" => $time, "download_thumb" => $_POST['download_thumb'], "download_image" => $_POST['download_image'], "download_comment" => $_POST['download_comment'] ); $dlInfo['download_id'] = $id;
$e_event->trigger("dlupdate", $dlinfo); $this->downloadLog('DOWNL_06',$dlInfo,$dlMirrors);
$dlInfo['download_datestamp'] = $time; // This is what 0.7 did, regardless of settings
unset($dlInfo['download_class']); // Also replicating 0.7
$e_event->trigger('dlupdate', $dlInfo);
} }
else else
{ {
if (admin_update($download_id = $sql->db_Insert("download", "0, '".$_POST['download_name']."', '".$durl."', '".$_POST['download_author']."', '".$_POST['download_author_email']."', '".$_POST['download_author_website']."', '".$_POST['download_description']."', '".$filesize."', '0', '".intval($_POST['download_category'])."', '".intval($_POST['download_active'])."', '".intval($_POST['download_datestamp'])."', '".$_POST['download_thumb']."', '".$_POST['download_image']."', '".intval($_POST['download_comment'])."', '{$_POST['download_class']}', '$mirrorStr', '".intval($_POST['download_mirror_type'])."', '".$_POST['download_visible']."' "), 'insert', DOWLAN_1." (<a href='".e_BASE."download.php?view.".$download_id."'>".$_POST['download_name']."</a>)")) if (admin_update($download_id = $sql->db_Insert('download',array_merge($dlInfo,$dlMirrors)), 'insert', DOWLAN_1." (<a href='".e_BASE."download.php?view.".$download_id."'>".$_POST['download_name']."</a>)"))
{ {
$dlinfo = array("download_id" => $download_id, "download_name" => $_POST['download_name'], "download_url" => $durl, "download_author" => $_POST['download_author'], "download_author_email" => $_POST['download_author_email'], "download_author_website" => $_POST['download_author_website'], "download_description" => $_POST['download_description'], "download_filesize" => $filesize, "download_category" => $_POST['download_category'], "download_active" => $_POST['download_active'], "download_datestamp" => $time, "download_thumb" => $_POST['download_thumb'], "download_image" => $_POST['download_image'], "download_comment" => $_POST['download_comment'] ); $dlInfo['download_id'] = $download_id;
$e_event->trigger("dlpost", $dlinfo); $this->downloadLog('DOWNL_05',$dlInfo,$dlMirrors);
$dlInfo['download_datestamp'] = $time; // This is what 0.7 did, regardless of settings
unset($dlInfo['download_class']); // Also replicating 0.7
$e_event->trigger("dlpost", $dlInfo);
if ($_POST['remove_upload']) if ($_POST['remove_upload'])
{ {
@@ -1336,6 +1393,24 @@ class download
} }
function downloadLog($aText, &$dlInfo, &$mirrorInfo=NULL)
{
global $admin_log;
$logString = DOWLAN_9;
foreach ($dlInfo as $k => $v)
{
$logString .= '[!br!]'.$k.'=>'.$v;
}
if ($mirrorInfo != NULL)
{
foreach ($mirrorInfo as $k => $v)
{
$logString .= '[!br!]'.$k.'=>'.$v;
}
}
$admin_log->log_event($aText,$logString,E_LOG_INFORMATIVE,'');
}
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
function show_categories($sub_action, $id) function show_categories($sub_action, $id)
@@ -1605,7 +1680,8 @@ class download
$ns->tablerender(DOWLAN_39, $text); $ns->tablerender(DOWLAN_39, $text);
} }
function create_category($sub_action, $id) { function create_category($sub_action, $id)
{
global $sql, $tp; global $sql, $tp;
$download_category_name = $tp->toDB($_POST['download_category_name']); $download_category_name = $tp->toDB($_POST['download_category_name']);
$download_category_description = $tp->toDB($_POST['download_category_description']); $download_category_description = $tp->toDB($_POST['download_category_description']);
@@ -1620,14 +1696,17 @@ class download
if ($id) if ($id)
{ {
admin_update($sql->db_Update("download_category", "download_category_name='{$download_category_name}', download_category_description='{$download_category_description}', download_category_icon ='{$download_category_icon}', download_category_parent= '{$download_categoory_parent}', download_category_class='{$download_category_class}' WHERE download_category_id='{$id}'"), 'update', DOWLAN_48); admin_update($sql->db_Update("download_category", "download_category_name='{$download_category_name}', download_category_description='{$download_category_description}', download_category_icon ='{$download_category_icon}', download_category_parent= '{$download_categoory_parent}', download_category_class='{$download_category_class}' WHERE download_category_id='{$id}'"), 'update', DOWLAN_48);
$admin_log->log_event('DOWNL_03',$download_category_name.'[!br!]'.$download_category_description,E_LOG_INFORMATIVE,'');
} }
else else
{ {
admin_update($sql->db_Insert("download_category", "0, '{$download_category_name}', '{$download_category_description}', '{$download_category_icon}', '{$download_categoory_parent}', '{$download_category_class}', 0 "), 'insert', DOWLAN_47); admin_update($sql->db_Insert("download_category", "0, '{$download_category_name}', '{$download_category_description}', '{$download_category_icon}', '{$download_categoory_parent}', '{$download_category_class}', 0 "), 'insert', DOWLAN_47);
$admin_log->log_event('DOWNL_02',$download_category_name.'[!br!]'.$download_category_description,E_LOG_INFORMATIVE,'');
} }
if ($sub_action == "sn") { if ($sub_action == "sn")
$sql->db_Delete("tmp", "tmp_time='$id' "); {
$sql->db_Delete("tmp", "tmp_time='{$id}' ");
} }
} }
@@ -1636,11 +1715,12 @@ class download
function show_existing_mirrors() function show_existing_mirrors()
{ {
global $sql, $ns, $tp, $sub_action, $id, $delete, $del_id; global $sql, $ns, $tp, $sub_action, $id, $delete, $del_id, $admin_log;
if($delete == "mirror") if($delete == "mirror")
{ {
admin_update($sql -> db_Delete("download_mirror", "mirror_id=".$del_id), delete, DOWLAN_135); admin_update($sql -> db_Delete("download_mirror", "mirror_id=".$del_id), delete, DOWLAN_135);
$admin_log->log_event('DOWNL_14','ID: '.$del_id,E_LOG_INFORMATIVE,'');
} }
@@ -1688,9 +1768,7 @@ class download
require_once(e_HANDLER."file_class.php"); require_once(e_HANDLER."file_class.php");
$fl = new e_file; $fl = new e_file;
// $rejecthumb = array('$.','$..','/','CVS','thumbs.db','*._$',"thumb_", 'index', 'null*'); $imagelist = $fl->get_files(e_FILE.'downloadimages/');
// $imagelist = $fl->get_files(e_FILE."downloadimages/","",$rejecthumb);
$imagelist = $fl->get_files(e_FILE.'downloadimages/'); // Standard reject filter should work
if($sub_action == "edit" && !defined("SUBMITTED")) if($sub_action == "edit" && !defined("SUBMITTED"))
{ {
@@ -1712,21 +1790,21 @@ class download
<tr> <tr>
<td style='width: 30%;' class='forumheader3'>".DOWLAN_12."</td> <td style='width: 30%;' class='forumheader3'>".DOWLAN_12."</td>
<td style='width: 70%;' class='forumheader3'> <td style='width: 70%;' class='forumheader3'>
<input class='tbox' type='text' name='mirror_name' size='60' value='$mirror_name' maxlength='200' /> <input class='tbox' type='text' name='mirror_name' size='60' value='{$mirror_name}' maxlength='200' />
</td> </td>
</tr> </tr>
<tr> <tr>
<td style='width: 30%;' class='forumheader3'>".DOWLAN_139."</td> <td style='width: 30%;' class='forumheader3'>".DOWLAN_139."</td>
<td style='width: 70%;' class='forumheader3'> <td style='width: 70%;' class='forumheader3'>
<input class='tbox' type='text' name='mirror_url' size='70' value='$mirror_url' maxlength='200' /> <input class='tbox' type='text' name='mirror_url' size='70' value='{$mirror_url}' maxlength='255' />
</td> </td>
</tr> </tr>
<tr> <tr>
<td style='width: 30%;' class='forumheader3'>".DOWLAN_136."</td> <td style='width: 30%;' class='forumheader3'>".DOWLAN_136."</td>
<td style='width: 70%;' class='forumheader3'> <td style='width: 70%;' class='forumheader3'>
<input class='tbox' type='text' id='mirror_image' name='mirror_image' size='60' value='$mirror_image' maxlength='200' /> <input class='tbox' type='text' id='mirror_image' name='mirror_image' size='60' value='{$mirror_image}' maxlength='200' />
<br /><input class='button' type ='button' style='cursor:pointer' size='30' value='".DOWLAN_42."' onclick='expandit(this)' /> <br /><input class='button' type ='button' style='cursor:pointer' size='30' value='".DOWLAN_42."' onclick='expandit(this)' />
@@ -1734,7 +1812,8 @@ class download
$text .= DOWLAN_140."<br /><br />"; $text .= DOWLAN_140."<br /><br />";
foreach($imagelist as $file){ foreach($imagelist as $file)
{
$text .= "<a href=\"javascript:insertext('".$file['fname']."','mirror_image','imagefile')\"><img src='".e_FILE."downloadimages/".$file['fname']."' alt='' /></a> "; $text .= "<a href=\"javascript:insertext('".$file['fname']."','mirror_image','imagefile')\"><img src='".e_FILE."downloadimages/".$file['fname']."' alt='' /></a> ";
} }
@@ -1758,7 +1837,7 @@ class download
<tr> <tr>
<td colspan='2' class='forumheader' style='text-align:center;'> <td colspan='2' class='forumheader' style='text-align:center;'>
".($edit ? "<input class='button' type='submit' name='submit_mirror' value='".DOWLAN_142."' /><input type='hidden' name='id' value='$mirror_id' />" : "<input class='button' type='submit' name='submit_mirror' value='".DOWLAN_143."' />")." ".($edit ? "<input class='button' type='submit' name='submit_mirror' value='".DOWLAN_142."' /><input type='hidden' name='id' value='{$mirror_id}' />" : "<input class='button' type='submit' name='submit_mirror' value='".DOWLAN_143."' />")."
</td> </td>
</tr> </tr>
@@ -1771,22 +1850,30 @@ class download
$ns -> tablerender($caption, $text); $ns -> tablerender($caption, $text);
} }
function submit_mirror() function submit_mirror()
{ {
global $tp, $sql; global $tp, $sql, $admin_log;
define("SUBMITTED", TRUE); define("SUBMITTED", TRUE);
if(isset($_POST['mirror_name']) && isset($_POST['mirror_url'])) if(isset($_POST['mirror_name']) && isset($_POST['mirror_url']))
{ {
$name = $tp -> toDB($_POST['mirror_name']); $name = $tp -> toDB($_POST['mirror_name']);
$url = $tp -> toDB($_POST['mirror_url']); $url = $tp -> toDB($_POST['mirror_url']);
$location = $tp -> toDB($_POST['mirror_location']); $location = $tp -> toDB($_POST['mirror_location']);
$description = $tp -> toDB($_POST['mirror_description']); $description = $tp -> toDB($_POST['mirror_description']);
if (isset($_POST['id'])){ $logString = $name.'[!br!]'.$url.'[!br!]'.$location.'[!br!]'.$description;
admin_update($sql -> db_Update("download_mirror", "mirror_name='$name', mirror_url='$url', mirror_image='".$_POST['mirror_image']."', mirror_location='$location', mirror_description='$description' WHERE mirror_id=".$_POST['id']), 'update', DOWLAN_133);
} else { if (isset($_POST['id']))
admin_update($sql -> db_Insert("download_mirror", "0, '$name', '$url', '".$_POST['mirror_image']."', '$location', '$description', 0"), 'insert', DOWLAN_134); {
admin_update($sql -> db_Update("download_mirror", "mirror_name='{$name}', mirror_url='{$url}', mirror_image='".$tp->toDB($_POST['mirror_image'])."', mirror_location='{$location}', mirror_description='{$description}' WHERE mirror_id=".intval($_POST['id'])), 'update', DOWLAN_133);
$admin_log->log_event('DOWNL_13','ID: '.intval($_POST['id']).'[!br!]'.$logString,E_LOG_INFORMATIVE,'');
}
else
{
admin_update($sql -> db_Insert("download_mirror", "0, '{$name}', '{$url}', '".$tp->toDB($_POST['mirror_image'])."', '{$location}', '{$description}', 0"), 'insert', DOWLAN_134);
$admin_log->log_event('DOWNL_12',$logString,E_LOG_INFORMATIVE,'');
} }
} }
} }
@@ -1833,7 +1920,8 @@ class download
} // end class. } // end class.
function download_adminmenu($parms) { function download_adminmenu($parms)
{
global $download; global $download;
global $action; global $action;
$download->show_options($action); $download->show_options($action);

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_admin/image.php,v $ | $Source: /cvs_backup/e107_0.8/e107_admin/image.php,v $
| $Revision: 1.5 $ | $Revision: 1.6 $
| $Date: 2008-12-05 22:01:11 $ | $Date: 2008-12-06 15:48:16 $
| $Author: e107steved $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -102,18 +102,9 @@ if (isset($_POST['update_options']))
$temp['image_post_disabled_method'] = intval($_POST['image_post_disabled_method']); $temp['image_post_disabled_method'] = intval($_POST['image_post_disabled_method']);
$temp['enable_png_image_fix'] = intval($_POST['enable_png_image_fix']); $temp['enable_png_image_fix'] = intval($_POST['enable_png_image_fix']);
foreach ($temp as $k => $v) if ($admin_log->logArrayDiffs($temp, $pref, 'IMALAN_04'))
{ {
if ($v != $pref[$k]) save_prefs(); // Only save if changes
{
$pref[$k] = $v;
$changes[] = $k.'=>'.$v;
}
}
if (count($changes))
{
save_prefs();
$admin_log->log_event('IMALAN_04',implode('[!br!]',$changes),E_LOG_INFORMATIVE,'');
$message = IMALAN_9; $message = IMALAN_9;
} }
else else

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_admin/language.php,v $ | $Source: /cvs_backup/e107_0.8/e107_admin/language.php,v $
| $Revision: 1.9 $ | $Revision: 1.10 $
| $Date: 2008-12-06 11:13:50 $ | $Date: 2008-12-06 15:48:16 $
| $Author: e107steved $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -55,16 +55,10 @@ if (isset($_POST['submit_prefs']) && isset($_POST['mainsitelanguage']))
$temp['multilanguage_subdomain'] = $_POST['multilanguage_subdomain']; $temp['multilanguage_subdomain'] = $_POST['multilanguage_subdomain'];
$temp['sitelanguage'] = $_POST['mainsitelanguage']; $temp['sitelanguage'] = $_POST['mainsitelanguage'];
foreach ($temp as $k => $v) if ($admin_log->logArrayDiffs($temp, $pref, 'LANG_01'))
{ {
if ($v != $pref[$k]) save_prefs(); // Only save if changes
{
$pref[$k] = $v;
$changes[] = $k.'=>'.$v;
}
} }
$admin_log->log_event('LANG_01',implode('[!br!]',$changes),E_LOG_INFORMATIVE,'');
save_prefs();
$ns->tablerender(LAN_SAVED, "<div style='text-align:center'>".LAN_SETSAVED."</div>"); $ns->tablerender(LAN_SAVED, "<div style='text-align:center'>".LAN_SETSAVED."</div>");
} }

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_admin/sql/core_sql.php,v $ | $Source: /cvs_backup/e107_0.8/e107_admin/sql/core_sql.php,v $
| $Revision: 1.14 $ | $Revision: 1.15 $
| $Date: 2008-11-29 13:08:31 $ | $Date: 2008-12-06 15:48:16 $
| $Author: e107steved $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -173,7 +173,7 @@ CREATE TABLE dblog (
CREATE TABLE download ( CREATE TABLE download (
download_id int(10) unsigned NOT NULL auto_increment, download_id int(10) unsigned NOT NULL auto_increment,
download_name varchar(100) NOT NULL default '', download_name varchar(100) NOT NULL default '',
download_url varchar(150) NOT NULL default '', download_url varchar(255) NOT NULL default '',
download_author varchar(100) NOT NULL default '', download_author varchar(100) NOT NULL default '',
download_author_email varchar(200) NOT NULL default '', download_author_email varchar(200) NOT NULL default '',
download_author_website varchar(200) NOT NULL default '', download_author_website varchar(200) NOT NULL default '',
@@ -219,7 +219,7 @@ CREATE TABLE download_category (
CREATE TABLE download_mirror ( CREATE TABLE download_mirror (
mirror_id int(10) unsigned NOT NULL auto_increment, mirror_id int(10) unsigned NOT NULL auto_increment,
mirror_name varchar(200) NOT NULL default '', mirror_name varchar(200) NOT NULL default '',
mirror_url varchar(200) NOT NULL default '', mirror_url varchar(255) NOT NULL default '',
mirror_image varchar(200) NOT NULL default '', mirror_image varchar(200) NOT NULL default '',
mirror_location varchar(100) NOT NULL default '', mirror_location varchar(100) NOT NULL default '',
mirror_description text NOT NULL, mirror_description text NOT NULL,
@@ -244,6 +244,22 @@ CREATE TABLE download_requests (
) TYPE=MyISAM; ) TYPE=MyISAM;
# -------------------------------------------------------- # --------------------------------------------------------
#
# Table structure for table `generic`
#
CREATE TABLE generic (
gen_id int(10) unsigned NOT NULL auto_increment,
gen_type varchar(80) NOT NULL default '',
gen_datestamp int(10) unsigned NOT NULL default '0',
gen_user_id int(10) unsigned NOT NULL default '0',
gen_ip varchar(80) NOT NULL default '',
gen_intdata int(10) unsigned NOT NULL default '0',
gen_chardata text NOT NULL,
PRIMARY KEY (gen_id),
KEY gen_type (gen_type)
) TYPE=MyISAM;
# --------------------------------------------------------
# #
# Table structure for table `links` # Table structure for table `links`
# #
@@ -580,19 +596,3 @@ CREATE TABLE user_extended_struct (
) TYPE=MyISAM; ) TYPE=MyISAM;
# -------------------------------------------------------- # --------------------------------------------------------
#
# Table structure for table `generic`
#
CREATE TABLE generic (
gen_id int(10) unsigned NOT NULL auto_increment,
gen_type varchar(80) NOT NULL default '',
gen_datestamp int(10) unsigned NOT NULL default '0',
gen_user_id int(10) unsigned NOT NULL default '0',
gen_ip varchar(80) NOT NULL default '',
gen_intdata int(10) unsigned NOT NULL default '0',
gen_chardata text NOT NULL,
PRIMARY KEY (gen_id),
KEY gen_type (gen_type)
) TYPE=MyISAM;
# --------------------------------------------------------

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_admin/update_routines.php,v $ | $Source: /cvs_backup/e107_0.8/e107_admin/update_routines.php,v $
| $Revision: 1.31 $ | $Revision: 1.32 $
| $Date: 2008-11-18 21:29:37 $ | $Date: 2008-12-06 15:48:16 $
| $Author: e107steved $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -488,6 +488,37 @@ function update_706_to_800($type='')
} }
if (mysql_table_exists('download'))
{ // Need to extend field download_url varchar(255) NOT NULL default ''
if ($sql -> db_Query("SHOW FIELDS FROM ".MPREFIX."download LIKE 'download_url'"))
{
$row = $sql -> db_Fetch();
if (str_replace('varchar', 'char', strtolower($row['Type'])) != 'char(255)')
{
if ($just_check) return update_needed('Update download table field definition');
mysql_query("ALTER TABLE `".MPREFIX."download` MODIFY `download_url` VARCHAR(255) NOT NULL DEFAULT '' ");
$updateMessages[] = LAN_UPDATE_52;
catch_error();
}
}
}
if (mysql_table_exists('download_mirror'))
{ // Need to extend field download_url varchar(255) NOT NULL default ''
if ($sql -> db_Query("SHOW FIELDS FROM ".MPREFIX."download_mirror LIKE 'mirror_url'"))
{
$row = $sql -> db_Fetch();
if (str_replace('varchar', 'char', strtolower($row['Type'])) != 'char(255)')
{
if ($just_check) return update_needed('Update download mirror table field definition');
mysql_query("ALTER TABLE `".MPREFIX."download_mirror` MODIFY `mirror_url` VARCHAR(255) NOT NULL DEFAULT '' ");
$updateMessages[] = LAN_UPDATE_53;
catch_error();
}
}
}
// Check need for user timezone before we delete the field // Check need for user timezone before we delete the field
if (varsettrue($pref['signup_option_timezone'])) if (varsettrue($pref['signup_option_timezone']))
{ {

View File

@@ -12,8 +12,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_handlers/admin_log_class.php,v $ | $Source: /cvs_backup/e107_0.8/e107_handlers/admin_log_class.php,v $
| $Revision: 1.11 $ | $Revision: 1.12 $
| $Date: 2008-06-13 20:20:21 $ | $Date: 2008-12-06 15:48:16 $
| $Author: e107steved $ | $Author: e107steved $
To do: To do:
@@ -302,6 +302,33 @@ Generic log entry point
$sql->db_Delete("dblog", "WHERE `dblog_datestamp` < {$time}", true); $sql->db_Delete("dblog", "WHERE `dblog_datestamp` < {$time}", true);
} }
} }
//--------------------------------------
// HELPER ROUTINES
//--------------------------------------
// Generic routine to log changes to an array. Only elements in $new are checked
// Returns true if changes, false otherwise.
// Only makes log entry if changes detected.
// The $old array is updated with changes, but not saved anywhere
function logArrayDiffs(&$new, &$old, $event)
{
$changes = array();
foreach ($new as $k => $v)
{
if ($v != $old[$k])
{
$old[$k] = $v;
$changes[] = $k.'=>'.$v;
}
}
if (count($changes))
{
$this->log_event($event,implode('[!br!]',$changes),E_LOG_INFORMATIVE,'');
return TRUE;
}
return FALSE;
}
} }
?> ?>

View File

@@ -1,6 +1,6 @@
<?php <?php
// e107 Language File. // e107 Language File.
// $Id: lan_admin_log.php,v 1.6 2008-06-10 21:43:57 e107steved Exp $ // $Id: lan_admin_log.php,v 1.7 2008-12-06 15:48:26 e107steved Exp $
define('RL_LAN_001', 'System Logs'); define('RL_LAN_001', 'System Logs');
define('RL_LAN_002', "Rolling Log"); define('RL_LAN_002', "Rolling Log");
@@ -20,11 +20,11 @@ define('RL_LAN_015', "User ID filter");
define('RL_LAN_016', "Blank for none, zero for guest"); define('RL_LAN_016', "Blank for none, zero for guest");
define('RL_LAN_017', "No log entries, or none match filter"); define('RL_LAN_017', "No log entries, or none match filter");
define('RL_LAN_018', "Refresh log"); define('RL_LAN_018', "Refresh log");
define('RL_LAN_019', "Date"); define('RL_LAN_019', "yy-mm-dd hh:mm:ss");
define('RL_LAN_020', "IP"); define('RL_LAN_020', "IP");
define('RL_LAN_021', "ID"); define('RL_LAN_021', "ID");
define('RL_LAN_022', "User"); define('RL_LAN_022', "User");
define('RL_LAN_023', "Type"); define('RL_LAN_023', "Event Type");
define('RL_LAN_024', "From"); define('RL_LAN_024', "From");
define('RL_LAN_025', "Event Title"); define('RL_LAN_025', "Event Title");
define('RL_LAN_026', "Class for which user actions logged"); define('RL_LAN_026', "Class for which user actions logged");

View File

@@ -4,8 +4,8 @@
| e107 website system - Language File. | e107 website system - Language File.
| |
| $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_download.php,v $ | $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_download.php,v $
| $Revision: 1.3 $ | $Revision: 1.4 $
| $Date: 2007-11-21 22:52:46 $ | $Date: 2008-12-06 15:48:26 $
| $Author: e107steved $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -16,6 +16,8 @@ define("DOWLAN_4", "Please tick the confirm box to delete the download");
define("DOWLAN_5", "There are no download categories defined yet, until you define some you cannot enter any downloads."); define("DOWLAN_5", "There are no download categories defined yet, until you define some you cannot enter any downloads.");
define("DOWLAN_6", "No existing downloads"); define("DOWLAN_6", "No existing downloads");
define("DOWLAN_7", "Existing Downloads"); define("DOWLAN_7", "Existing Downloads");
define("DOWLAN_8", "Nothing changed - not saved");
define('DOWLAN_9', 'Download detail:');
define("DOWLAN_11", "Category"); define("DOWLAN_11", "Category");
define("DOWLAN_12", "Name"); define("DOWLAN_12", "Name");

View File

@@ -4,8 +4,8 @@
| e107 website system - Language File. | e107 website system - Language File.
| |
| $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_e107_update.php,v $ | $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_e107_update.php,v $
| $Revision: 1.5 $ | $Revision: 1.6 $
| $Date: 2008-11-18 21:29:43 $ | $Date: 2008-12-06 15:48:26 $
| $Author: e107steved $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -56,8 +56,8 @@ define('LAN_UPDATE_48', 'Delete obsolete table: ');
define('LAN_UPDATE_49', 'Extend IP address field: '); define('LAN_UPDATE_49', 'Extend IP address field: ');
define('LAN_UPDATE_50', 'Obsolete prefs deleted: '); define('LAN_UPDATE_50', 'Obsolete prefs deleted: ');
define('LAN_UPDATE_51', 'Update plugin table definition: '); define('LAN_UPDATE_51', 'Update plugin table definition: ');
define('LAN_UPDATE_52', ''); define('LAN_UPDATE_52', 'Update downloads table');
define('LAN_UPDATE_53', ''); define('LAN_UPDATE_53', 'Update download mirror table');
define('LAN_UPDATE_54', ''); define('LAN_UPDATE_54', '');
define('LAN_UPDATE_55', ''); define('LAN_UPDATE_55', '');
define('LAN_UPDATE_56', ''); define('LAN_UPDATE_56', '');

View File

@@ -1,6 +1,6 @@
<?php <?php
// e107 Language File. // e107 Language File.
// $Id: lan_log_messages.php,v 1.25 2008-12-06 11:13:55 e107steved Exp $ // $Id: lan_log_messages.php,v 1.26 2008-12-06 15:48:26 e107steved Exp $
/* /*
The definitions in this file are for standard 'explanatory' messages which might be entered The definitions in this file are for standard 'explanatory' messages which might be entered
@@ -232,5 +232,23 @@ define('LAN_AL_LANG_05', '');
//---------- //----------
define('LAN_AL_META_01', 'Meta tags updated'); define('LAN_AL_META_01', 'Meta tags updated');
// Downloads
//----------
define('LAN_AL_DOWNL_01', 'Download options changed');
define('LAN_AL_DOWNL_02', 'Download category created');
define('LAN_AL_DOWNL_03', 'Download category updated');
define('LAN_AL_DOWNL_04', 'Download category deleted');
define('LAN_AL_DOWNL_05', 'Download created');
define('LAN_AL_DOWNL_06', 'Download updated');
define('LAN_AL_DOWNL_07', 'Download deleted');
define('LAN_AL_DOWNL_08', 'Download category order updated');
define('LAN_AL_DOWNL_09', 'Download limit added');
define('LAN_AL_DOWNL_10', 'Download limit edited');
define('LAN_AL_DOWNL_11', 'Download limit deleted');
define('LAN_AL_DOWNL_12', 'Download mirror added');
define('LAN_AL_DOWNL_13', 'Download mirror updated');
define('LAN_AL_DOWNL_14', 'Download mirror deleted');
define('LAN_AL_DOWNL_15', '');
?> ?>