From 132009bb33f6a1ab1ba559168134eff47d21b890 Mon Sep 17 00:00:00 2001 From: CaMer0n Date: Sat, 26 Nov 2011 06:27:10 +0000 Subject: [PATCH] adaptation of download-code to use core functions. --- e107_core/shortcodes/single/iconpicker.php | 2 +- e107_plugins/download/admin_download.php | 294 ++++++++++-------- .../download/handlers/adminDownload_class.php | 8 +- 3 files changed, 173 insertions(+), 131 deletions(-) diff --git a/e107_core/shortcodes/single/iconpicker.php b/e107_core/shortcodes/single/iconpicker.php index a955cb8f4..1056d2b07 100644 --- a/e107_core/shortcodes/single/iconpicker.php +++ b/e107_core/shortcodes/single/iconpicker.php @@ -41,7 +41,7 @@ function iconpicker_shortcode($parm) $str = ""; } - $str .= "{$row["; + $str .= "{$row["; $lastsize = $size; diff --git a/e107_plugins/download/admin_download.php b/e107_plugins/download/admin_download.php index 45dd1b7d1..f8765b945 100644 --- a/e107_plugins/download/admin_download.php +++ b/e107_plugins/download/admin_download.php @@ -56,7 +56,16 @@ $pst->id = array("admin_downloads","admin_dl_cat"); $download = new download(); $adminDownload = new adminDownload(); + +new plugin_download_admin(); require_once(e_ADMIN."auth.php"); + + + + + + + $pst->save_preset(); // unique name(s) for the presets - comma separated. /* @@ -87,13 +96,13 @@ $emessage = &eMessage::getInstance(); if(isset($_POST['filter_list'])) { - echo $adminDownload->show_existing_items($action, $subAction, $id, 0, 10); - exit; + //echo $adminDownload->show_existing_items($action, $subAction, $id, 0, 10); + // exit; } if(isset($_POST['execute_batch'])) { - $adminDownload->_observe_processBatch(); + // $adminDownload->_observe_processBatch(); } if (isset($_POST['delete'])) @@ -114,7 +123,7 @@ if (isset($_POST)) if (isset($_POST['add_category'])) { - $adminDownload->create_category($subAction, $id); + // $adminDownload->create_category($subAction, $id); } @@ -139,8 +148,7 @@ if (isset($_POST['update_catorder'])) $ns->tablerender("", "
".LAN_UPDATED."
"); } - -if (isset($_POST['updatedownloadoptions'])) +if (isset($_POST['updatedownlaodoptions'])) { unset($temp); $temp['download_php'] = $_POST['download_php']; @@ -159,11 +167,13 @@ if (isset($_POST['updatedownloadoptions'])) if ($admin_log->logArrayDiffs($temp, $pref, 'DOWNL_01')) { save_prefs(); - $message = DOWLAN_65; + + // e107::getMessage()->add(DOWLAN_65); + } else { - $message = DOWLAN_8; + // e107::getMessage()->add(DOWLAN_8); } } @@ -322,6 +332,7 @@ if (isset($delete) && $delete == 'main') if (isset($message)) { + $ns->tablerender("", "
".$message."
"); } @@ -332,6 +343,9 @@ if ($from === "maint" && isset($_POST['submit_download'])) $subAction = $maintPage; } + e107::getAdminUI()->runPage(); + + if (!e_QUERY || $action == "main") { $text = $emessage->render(); @@ -348,9 +362,136 @@ if ($action == "opt") $adminDownload->show_download_options(); } -if ($action == 'maint') + + + +if ($action == "ulist") { - global $pref, $ns; + $adminDownload->show_upload_list(); +} + +if ($action == "filetypes") +{ + $adminDownload->show_upload_filetypes(); +} + +if ($action == "uopt") +{ + $adminDownload->show_upload_options(); +} + +require_once(e_ADMIN."footer.php"); +exit; + + +function showLimits() +{ + $sql = e107::getDb(); + $ns = e107::getRender(); + global $pref; + + if ($sql->db_Select('userclass_classes','userclass_id, userclass_name')) + { + $classList = $sql->db_getList(); + } + if ($sql->db_Select("generic", "gen_id as limit_id, gen_datestamp as limit_classnum, gen_user_id as limit_bw_num, gen_ip as limit_bw_days, gen_intdata as limit_count_num, gen_chardata as limit_count_days", "gen_type = 'download_limit'")) + { + while($row = $sql->db_Fetch()) + { + $limitList[$row['limit_classnum']] = $row; + } + } + $txt = " +
+ + + + + + + + + + + "; + + if(is_array($limitList)) + { + foreach($limitList as $row) + { + $txt .= " + + + + + + + "; + } + } + $txt .= " +
+ "; + if ($pref['download_limits'] == 1) + { + $chk = "checked = 'checked'"; + } + else + { + $chk = ""; + } + + $txt .= " + ".DOWLAN_125." +
".DOWLAN_67."".DOWLAN_113."".DOWLAN_107."".DOWLAN_108."
".$row['limit_id']."".r_userclass_name($row['limit_classnum'])." + ".DOWLAN_109." + ".DOWLAN_110." + + ".DOWLAN_111." ".DOWLAN_109." + ".DOWLAN_110." +
+
+ +
+ + + + + + + + + + + + + "; + + $txt .= "


".r_userclass("newlimit_class", 0, "off", "guest, member, admin, classes, language")." + ".DOWLAN_109." + ".DOWLAN_110." + + ".DOWLAN_111." ".DOWLAN_109." + ".DOWLAN_110." +
+
+ +
"; + echo $txt; + +// $ns->tablerender(DOWLAN_112, $txt); + // require_once(e_ADMIN.'footer.php'); + // exit; +} + + +function showMaint() +{ + + global $pref; + $ns = e107::getRender(); + $sql = e107::getDb(); + if (isset($_POST['dl_maint'])) { switch ($_POST['dl_maint']) { @@ -410,7 +551,7 @@ if ($action == 'maint') } else { - $text = DOWLAN_172; + e107::getMessage()->addInfo(DOWLAN_172); } break; } @@ -453,7 +594,8 @@ if ($action == 'maint') } else { - $text = DOWLAN_174; + e107::getMessage()->addInfo(DOWLAN_174); + } break; } @@ -497,7 +639,8 @@ if ($action == 'maint') } else { - $text = DOWLAN_172; + e107::getMessage()->addInfo(DOWLAN_172); + // $text = DOWLAN_172; } break; } @@ -548,7 +691,8 @@ if ($action == 'maint') } else { - $text = DOWLAN_172; + e107::getMessage()->addInfo(DOWLAN_172); + // $text = DOWLAN_172; } break; } @@ -597,7 +741,8 @@ if ($action == 'maint') } else { - $text = DOWLAN_172; + e107::getMessage()->addInfo(DOWLAN_172); + // $text = DOWLAN_172; } break; } @@ -648,7 +793,8 @@ if ($action == 'maint') } else { - $text = DOWLAN_172; + e107::getMessage()->addInfo(DOWLAN_172); + // $text = DOWLAN_172; } break; } @@ -666,7 +812,7 @@ if ($action == 'maint') $text = DOWLAN_179; $eform = new e_form(); $text = " -
+
".DOWLAN_10." @@ -727,120 +873,12 @@ if ($action == 'maint') "; } - $ns->tablerender(DOWLAN_165.$title, $text); + + echo $text; + // $ns->tablerender(DOWLAN_165.$title, $text); } -if ($action == 'limits') -{ - if ($sql->db_Select('userclass_classes','userclass_id, userclass_name')) - { - $classList = $sql->db_getList(); - } - if ($sql->db_Select("generic", "gen_id as limit_id, gen_datestamp as limit_classnum, gen_user_id as limit_bw_num, gen_ip as limit_bw_days, gen_intdata as limit_count_num, gen_chardata as limit_count_days", "gen_type = 'download_limit'")) - { - while($row = $sql->db_Fetch()) - { - $limitList[$row['limit_classnum']] = $row; - } - } - $txt = " - -
- - - - - - - - - - "; - - foreach($limitList as $row) - { - $txt .= " - - - - - - - "; - } - - $txt .= " - - - - - - - - - - - - - - - "; - - $txt .= "
- "; - if ($pref['download_limits'] == 1) - { - $chk = "checked = 'checked'"; - } - else - { - $chk = ""; - } - - $txt .= " - ".DOWLAN_125." -
".DOWLAN_67."".DOWLAN_113."".DOWLAN_107."".DOWLAN_108."
".$row['limit_id']."".r_userclass_name($row['limit_classnum'])." - ".DOWLAN_109." - ".DOWLAN_110." - - ".DOWLAN_111." ".DOWLAN_109." - ".DOWLAN_110." -
- -


".r_userclass("newlimit_class", 0, "off", "guest, member, admin, classes, language")." - ".DOWLAN_109." - ".DOWLAN_110." - - ".DOWLAN_111." ".DOWLAN_109." - ".DOWLAN_110." -
- -
"; - - $ns->tablerender(DOWLAN_112, $txt); - require_once(e_ADMIN.'footer.php'); - exit; -} - -if ($action == "ulist") -{ - $adminDownload->show_upload_list(); -} - -if ($action == "filetypes") -{ - $adminDownload->show_upload_filetypes(); -} - -if ($action == "uopt") -{ - $adminDownload->show_upload_options(); -} - -require_once(e_ADMIN."footer.php"); -exit; - function admin_download_adminmenu($parms) { global $action,$subAction; diff --git a/e107_plugins/download/handlers/adminDownload_class.php b/e107_plugins/download/handlers/adminDownload_class.php index 04cab47f7..a3099869a 100644 --- a/e107_plugins/download/handlers/adminDownload_class.php +++ b/e107_plugins/download/handlers/adminDownload_class.php @@ -44,13 +44,14 @@ class adminDownload extends download $this->advancedSearchFields = $_POST['download_advanced_search']; } } + function show_filter_form($action, $subAction, $id, $from, $amount) { global $e107, $mySQLdefaultdb, $pref, $user_pref; $frm = new e_form(); $filterColumns = ($user_pref['admin_download_disp'] ? $user_pref['admin_download_disp'] : array("download_name","download_class")); - $url = $e107->url->getUrl('forum', 'thread', array('func' => 'view', 'id' => 123)); + // $url = $e107->url->getUrl('forum', 'thread', array('func' => 'view', 'id' => 123)); $url = "admin_download.php"; // Search field @@ -2158,14 +2159,17 @@ class adminDownload extends download // } if(isset($_POST['etrigger_ecolumns'])) { - $this->_observe_saveColumns(); + // $this->_observe_saveColumns(); } } +/* function _observe_saveColumns() { global $user_pref,$admin_log; $user_pref['admin_download_disp'] = $_POST['e-columns']; save_prefs('user'); } + */ + } ?> \ No newline at end of file