diff --git a/e107_plugins/download/download.php b/e107_plugins/download/download.php
new file mode 100644
index 000000000..1a547857a
--- /dev/null
+++ b/e107_plugins/download/download.php
@@ -0,0 +1,881 @@
+ toDB($tmp[1])),'list');
+ $id = intval($tmp[2]);
+ $view = intval($tmp[3]);
+ $order = preg_replace("#\W#", "", $tp -> toDB($tmp[4]));
+ $sort = preg_replace("#\W#", "", $tp -> toDB($tmp[5]));
+ }
+ else
+ {
+ $action = preg_replace("#\W#", "", $tp -> toDB($tmp[0]));
+ $id = intval($tmp[1]);
+ $errnum = intval(varset($tmp[2],0));
+ }
+ switch ($action)
+ {
+ case 'list' : // Category-based listing
+ if (isset($_POST['view']))
+ {
+ $view = intval($_POST['view']);
+ $sort = varset($_POST['sort'],'DESC');
+ $order = varset($_POST['order'],'download_datestamp');
+ }
+ if (!isset($dl_from)) $dl_from = 0;
+
+ // Get category type, page title
+ if ($sql->db_Select("download_category", "download_category_name,download_category_description,download_category_parent,download_category_class", "(download_category_id='{$id}') AND (download_category_class IN (".USERCLASS_LIST."))") )
+ {
+ $row = $sql->db_Fetch();
+ extract($row);
+ $type = "".$download_category_name." ";
+ $type .= ($download_category_description) ? " [".$download_category_description."] " : "";
+ define("e_PAGETITLE", PAGE_NAME." / ".$download_category_name);
+ }
+ else
+ { // No access to this category
+ define("e_PAGETITLE", PAGE_NAME);
+ require_once(HEADERF);
+ $ns->tablerender(LAN_dl_18, "
".LAN_dl_3."
");
+ require_once(FOOTERF);
+ exit;
+ }
+ if ($download_category_parent == 0)
+ { // It's a main category - change the listing type required
+ $action = 'maincats';
+ $maincatval = $id;
+ }
+ break;
+ case 'view' : // Details of individual download
+ break;
+ case 'report' :
+ break;
+ case 'mirror' :
+ break;
+ case 'error' : // Errors passed from request.php
+ define("e_PAGETITLE", PAGE_NAME);
+ require_once(HEADERF);
+ switch ($errnum)
+ {
+ case 1 :
+ $errmsg = LAN_dl_63; // No permissions
+ break;
+ case 2 :
+ $errmsg = LAN_dl_62; // Quota exceeded
+ break;
+ default:
+ $errmsg = LAN_dl_61." ".$errnum; // Generic error - shouldn't happen
+ }
+ $ns->tablerender(LAN_dl_61, "".$errmsg."
");
+ require_once(FOOTERF);
+ exit;
+ }
+}
+
+if (isset($order) && !in_array($order,$order_options)) unset($order);
+if (isset($sort) && !in_array($sort,$sort_options)) unset($sort);
+
+if (!isset($order)) $order = varset($pref['download_order'],'download_datestamp');
+if (!isset($sort)) $sort = varset($pref['download_sort'], 'DESC');
+if (!isset($view)) $view = varset($pref['download_view'], '10');
+
+
+//--------------------------------------------------
+// GENERATE DISPLAY TEXT
+//--------------------------------------------------
+switch ($action)
+{ // Displaying main category or categories
+ case 'maincats' :
+ require_once(HEADERF);
+ if ($cacheData = $e107cache->retrieve("download_cat".$maincatval,720)) // expires every 12 hours.
+ {
+ echo $cacheData;
+ require_once(FOOTERF);
+ exit;
+ }
+
+ // Load the theme
+ $load_template = 'download_template';
+ if (!isset($DOWNLOAD_CAT_PARENT_TABLE)) eval($template_load_core);
+
+ if(!defined("DL_IMAGESTYLE")){ define("DL_IMAGESTYLE","border:1px solid blue");}
+
+ // Read in tree of categories which this user is allowed to see
+ $dl = new down_cat_handler(varset($pref['download_subsub'],1),USERCLASS_LIST,$maincatval,varset($pref['download_incinfo'],FALSE));
+
+ if ($dl->down_count == 0)
+ {
+ $ns->tablerender(LAN_dl_18, "".LAN_dl_2."
");
+ require_once(FOOTERF);
+ exit;
+ }
+ else
+ {
+ $download_cat_table_string = ""; // Notice removal
+ foreach($dl->cat_tree as $row)
+ { // Display main category headings, then sub-categories, optionally with sub-sub categories expanded
+ $download_cat_table_string .= parse_download_cat_parent_table($row);
+ foreach($row['subcats'] as $crow)
+ {
+ $download_cat_table_string .= parse_download_cat_child_table($crow);
+ }
+ }
+ }
+
+ $download_cat_table_start = preg_replace("/\{(.*?)\}/e", '$\1', $DOWNLOAD_CAT_TABLE_START);
+
+ $DOWNLOAD_CAT_NEWDOWNLOAD_TEXT = " ".LAN_dl_36;
+ $DOWNLOAD_CAT_SEARCH = "
+ ";
+
+ $download_cat_table_end = preg_replace("/\{(.*?)\}/e", '$\1', $DOWNLOAD_CAT_TABLE_END);
+ $dl_text = $download_cat_table_start.$download_cat_table_string.$download_cat_table_end;
+
+ ob_start();
+
+ if(isset($DOWNLOAD_CAT_TABLE_RENDERPLAIN) && $DOWNLOAD_CAT_TABLE_RENDERPLAIN)
+ {
+ echo $dl_text;
+ }
+ else
+ {
+ $ns->tablerender(LAN_dl_18, $dl_text);
+ }
+
+ $cache_data = ob_get_flush();
+ $e107cache->set("download_cat".$maincatval, $cache_data);
+
+ require_once(FOOTERF);
+ exit;
+ // Add other 'cases' here
+} // End switch ($action)
+
+
+if (isset($_POST['commentsubmit']))
+{
+ if (!$sql->db_Select("download", "download_comment", "download_id = '{$id}' "))
+ {
+ header("location:".e_BASE."index.php");
+ exit;
+ }
+ else
+ {
+ $row = $sql->db_Fetch();
+ if ($row['download_comment'] && (ANON === TRUE || USER === TRUE))
+ {
+ $clean_authorname = $_POST['author_name'];
+ $clean_comment = $_POST['comment'];
+ $clean_subject = $_POST['subject'];
+
+ $cobj->enter_comment($clean_authorname, $clean_comment, "download", $id, $pid, $clean_subject);
+// $e107cache->clear("comment.download.{$sub_action}"); $sub_action not used here
+ $e107cache->clear("comment.download");
+ }
+ }
+}
+
+//====================================================
+// LIST
+//====================================================
+if ($action == "list")
+{
+ $total_downloads = $sql->db_Count("download", "(*)", "WHERE download_category = '{$id}' AND download_active > 0 AND download_visible REGEXP '".e_CLASS_REGEXP."'");
+
+ require_once(HEADERF);
+
+ /* SHOW SUBCATS ... */
+ if($sql -> db_Select("download_category", "download_category_id", "download_category_parent='{$id}' "))
+ {
+ /* there are subcats - display them ... */
+ $qry = "
+ SELECT dc.*, dc2.download_category_name AS parent_name, dc2.download_category_icon as parent_icon, SUM(d.download_filesize) AS d_size,
+ COUNT(d.download_id) AS d_count,
+ MAX(d.download_datestamp) as d_last,
+ SUM(d.download_requested) as d_requests
+ FROM #download_category AS dc
+ LEFT JOIN #download AS d ON dc.download_category_id = d.download_category AND d.download_active > 0 AND d.download_visible IN (".USERCLASS_LIST.")
+ LEFT JOIN #download_category as dc2 ON dc2.download_category_id='{$id}'
+ WHERE dc.download_category_class IN (".USERCLASS_LIST.") AND dc.download_category_parent='{$id}'
+ GROUP by dc.download_category_id ORDER by dc.download_category_order
+ ";
+ $sql->db_Select_gen($qry);
+ $scArray = $sql -> db_getList();
+ $load_template = 'download_template';
+ if (!isset($DOWNLOAD_CAT_PARENT_TABLE)) eval($template_load_core);
+ if(!defined("DL_IMAGESTYLE")){ define("DL_IMAGESTYLE","border:1px solid blue");}
+
+ foreach($scArray as $row)
+ {
+ $download_cat_table_string .= parse_download_cat_child_table($row, FALSE);
+ }
+ if(strstr($row['parent_icon'], chr(1))) {
+ list($download_category_icon, $download_category_icon_empty) = explode(chr(1), $row['parent_icon']);
+ }
+ $DOWNLOAD_CAT_MAIN_ICON = ($download_category_icon ? " " : " ");
+ $DOWNLOAD_CAT_MAIN_NAME = $tp->toHTML($row['parent_name'], FALSE, 'USER_TITLE');
+ $download_cat_table_start = preg_replace("/\{(.*?)\}/e", '$\1', $DOWNLOAD_CAT_TABLE_START);
+ $DOWNLOAD_CAT_NEWDOWNLOAD_TEXT = " ".LAN_dl_36;
+ $download_cat_table_end = preg_replace("/\{(.*?)\}/e", '$\1', $DOWNLOAD_CAT_TABLE_END);
+ $text = $download_cat_table_start.$download_cat_table_string.$download_cat_table_end;
+ if($DOWNLOAD_CAT_TABLE_RENDERPLAIN)
+ {
+ echo $text;
+ }
+ else
+ {
+ $ns->tablerender($type, $text);
+ }
+ $text = ""; // If other files, show in a separate block
+ $type = ""; // Cancel title once displayed
+ } // End of subcategory display
+
+// Now display individual downloads
+ // Next line looks unnecessary
+// $core_total = $sql->db_Count("download WHERE download_category='{$id}' AND download_active > 0 AND download_visible IN (".USERCLASS_LIST.")");
+ if (!check_class($download_category_class))
+ {
+ $ns->tablerender(LAN_dl_18, "".LAN_dl_3."
");
+ require_once(FOOTERF);
+ exit;
+ }
+
+ if ($total_downloads < $view) { $dl_from = 0; }
+
+ if(strstr($download_category_icon, chr(1)))
+ {
+ list($download_category_icon, $download_category_icon_empty) = explode(chr(1), $download_category_icon);
+ }
+ $DOWNLOAD_CATEGORY_ICON = ($download_category_icon ? " " : " ");
+
+ $DOWNLOAD_CATEGORY = $tp->toHTML($download_category_name,FALSE,'USER_TITLE');
+ $DOWNLOAD_CATEGORY_DESCRIPTION = $tp -> toHTML($download_category_description, TRUE,'DESCRIPTION');
+
+ $load_template = 'download_template';
+ if (!isset($DOWNLOAD_LIST_TABLE)) eval($template_load_core);
+ if(!defined("DL_IMAGESTYLE")){ define("DL_IMAGESTYLE","border:1px solid blue");}
+
+ $gen = new convert;
+ require_once(e_HANDLER."rate_class.php");
+ $rater = new rater;
+ $tdownloads = 0;
+
+ // $dl_from - first entry to show (note - can get reset due to reuse of query, even if values overridden this time)
+ // $view - number of entries per page
+ // $total_downloads - total number of entries matching search criteria
+ $filetotal = $sql->db_Select("download", "*", "download_category='{$id}' AND download_active > 0 AND download_visible IN (".USERCLASS_LIST.") ORDER BY {$order} {$sort} LIMIT {$dl_from}, {$view}");
+ $ft = ($filetotal < $view ? $filetotal : $view);
+ while ($row = $sql->db_Fetch())
+ {
+ extract($row);
+ $download_list_table_string .= parse_download_list_table($row);
+ $tdownloads += $download_requested;
+ }
+
+ $DOWNLOAD_LIST_TOTAL_AMOUNT = $tdownloads." ".LAN_dl_16;
+ $DOWNLOAD_LIST_TOTAL_FILES = $ft." ".LAN_dl_17;
+
+ $download_list_table_start = preg_replace("/\{(.*?)\}/e", '$\1', $DOWNLOAD_LIST_TABLE_START);
+ $download_list_table_end = preg_replace("/\{(.*?)\}/e", '$\1', $DOWNLOAD_LIST_TABLE_END);
+ $text .= $download_list_table_start.$download_list_table_string.$download_list_table_end;
+
+
+ if ($filetotal)
+ { // Only show list if some files in it
+ if($DOWNLOAD_LIST_TABLE_RENDERPLAIN)
+ {
+ echo $text;
+ }
+ else
+ {
+ $ns->tablerender($type, $text);
+ }
+ }
+
+ if(!isset($DOWNLOAD_LIST_NEXTPREV))
+ {
+ $sc_style['DOWNLOAD_LIST_NEXTPREV']['pre'] = "";
+ $sc_style['DOWNLOAD_LIST_NEXTPREV']['post'] = "
";
+
+ $DOWNLOAD_LIST_NEXTPREV = "
+ {DOWNLOAD_BACK_TO_CATEGORY_LIST}
+ {DOWNLOAD_LIST_NEXTPREV}
+
";
+ }
+
+ $nextprev_parms = $total_downloads.",".$view.",".$dl_from.",".e_SELF."?[FROM].list.{$id}.{$view}.{$order}.{$sort}.";
+ echo $tp->parseTemplate($DOWNLOAD_LIST_NEXTPREV, TRUE, $download_shortcodes);
+
+ require_once(FOOTERF);
+ exit;
+} // end of action=="list"
+
+
+//====================================================
+// VIEW
+//====================================================
+if ($action == "view")
+{
+ $gen = new convert;
+
+ $highlight_search = FALSE;
+ if (isset($_POST['highlight_search'])) {
+ $highlight_search = TRUE;
+ }
+
+ $query = "
+ SELECT d.*, dc.* FROM #download AS d
+ LEFT JOIN #download_category AS dc ON d.download_category = dc.download_category_id
+ WHERE d.download_id = {$id} AND d.download_active > 0
+ AND d.download_visible IN (".USERCLASS_LIST.")
+ AND dc.download_category_class IN (".USERCLASS_LIST.")
+ LIMIT 1";
+
+ if(!$sql -> db_Select_gen($query)){
+ require_once(HEADERF);
+ $ns->tablerender(LAN_dl_18, "".LAN_dl_3."
");
+ require_once(FOOTERF);
+ exit;
+ }
+
+ $dl = $sql -> db_Fetch();
+
+$comment_edit_query = 'comment.download.'.$id;
+
+ $load_template = 'download_template';
+ if (!isset($DOWNLOAD_VIEW_TABLE)) eval($template_load_core);
+ if(!defined("DL_IMAGESTYLE")){ define("DL_IMAGESTYLE","border:0px");}
+ if(!isset($DL_VIEW_PAGETITLE))
+ {
+ $DL_VIEW_PAGETITLE = PAGE_NAME." / {DOWNLOAD_CATEGORY} / {DOWNLOAD_VIEW_NAME}";
+ }
+
+ $DL_TITLE = $tp->parseTemplate($DL_VIEW_PAGETITLE, TRUE, $download_shortcodes);
+
+ define("e_PAGETITLE", $DL_TITLE);
+
+ require_once(HEADERF);
+ $DL_TEMPLATE = $DOWNLOAD_VIEW_TABLE_START.$DOWNLOAD_VIEW_TABLE.$DOWNLOAD_VIEW_TABLE_END;
+ $text = $tp->parseTemplate($DL_TEMPLATE, TRUE, $download_shortcodes);
+
+ if(!isset($DL_VIEW_CAPTION))
+ {
+ $DL_VIEW_CAPTION = "{DOWNLOAD_VIEW_CAPTION}";
+ }
+
+ if(!isset($DL_VIEW_NEXTPREV))
+ {
+ $DL_VIEW_NEXTPREV = "
+
+
+
+ {DOWNLOAD_VIEW_PREV}
+ {DOWNLOAD_BACK_TO_LIST}
+ {DOWNLOAD_VIEW_NEXT}
+
+
+
+ ";
+ }
+ // ------- Next/Prev -----------
+ $text .= $tp->parseTemplate($DL_VIEW_NEXTPREV,TRUE,$download_shortcodes);
+ $caption = $tp->parseTemplate($DL_VIEW_CAPTION,TRUE,$download_shortcodes);
+
+ if($DOWNLOAD_VIEW_TABLE_RENDERPLAIN) {
+ echo $text;
+ } else {
+
+ $ns->tablerender($caption, $text);
+ }
+
+ unset($text);
+
+ if ($dl['download_comment']) {
+ $cobj->compose_comment("download", "comment", $id, $width,$dl['download_name'], $showrate=FALSE);
+ }
+
+ require_once(FOOTERF);
+ exit;
+
+}
+
+//====================================================
+// REPORT BROKEN LINKS
+//====================================================
+if ($action == "report" && check_class($pref['download_reportbroken']))
+{
+ if (!$sql->db_Select("download", "*", "download_id = {$id} AND download_active > 0")) {
+ require_once(HEADERF);
+ require_once(FOOTERF);
+ exit;
+ }
+
+ $row = $sql -> db_Fetch();
+ extract($row);
+
+ if (isset($_POST['report_download'])) {
+ $report_add = $tp -> toDB($_POST['report_add']);
+ $download_name = $tp -> toDB($download_name);
+ $user = USER ? USERNAME : LAN_dl_52;
+
+ if ($pref['download_email']) { // this needs to be moved into the NOTIFY, with an event.
+ require_once(e_HANDLER."mail.php");
+ $subject = LAN_dl_60." ".SITENAME;
+ $report = LAN_dl_58." ".SITENAME.":\n".(substr(SITEURL, -1) == "/" ? SITEURL : SITEURL."/")."download.php?view.".$download_id."\n
+ ".LAN_dl_59." ".$user."\n".$report_add;
+ sendemail(SITEADMINEMAIL, $subject, $report);
+ }
+
+ $sql->db_Insert('generic', "0, 'Broken Download', ".time().",'".USERID."', '{$download_name}', {$id}, '{$report_add}'");
+
+ define("e_PAGETITLE", PAGE_NAME." / ".LAN_dl_47);
+ require_once(HEADERF);
+
+ $text = LAN_dl_48."".LAN_dl_49." tablerender(LAN_dl_50, $text);
+
+ } else {
+ define("e_PAGETITLE", PAGE_NAME." / ".LAN_dl_51." ".$download_name);
+ require_once(HEADERF);
+
+ $text = "
+
+
+
+
+
+ ".DOWLAN_67."
+ ".DOWLAN_113."
+ ".DOWLAN_107."
+ ".DOWLAN_108."
+
+ ";
+
+ foreach($limitList as $row)
+ {
+ $txt .= "
+
+
+
+
+
+
+ ";
+ }
+
+ $txt .= "
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ";
+
+ $txt .= "
";
+
+ $ns->tablerender(DOWLAN_112, $txt);
+ require_once(e_ADMIN.'footer.php');
+ exit;
+}
+
+require_once(e_ADMIN."footer.php");
+exit;
+
+
+
+
+class download
+{
+ function show_existing_items($action, $sub_action, $id, $from, $amount)
+ {
+ global $sql, $rs, $ns, $tp, $mySQLdefaultdb, $pref;
+ $text = "";
+ $sortorder = ($pref['download_order']) ? $pref['download_order'] : "download_datestamp";
+ $sortdirection = ($pref['download_sort']) ? strtolower($pref['download_sort']) : "desc";
+ if ($sortdirection != 'desc') $sortdirection = 'asc';
+ if(isset($_POST['searchdisp']))
+ {
+ $pref['admin_download_disp'] = implode("|",$_POST['searchdisp']);
+ save_prefs();
+ }
+
+ if(!$pref['admin_download_disp'])
+ {
+ $search_display = array("download_name","download_class");
+ }
+ else
+ {
+ $search_display = explode("|",$pref['admin_download_disp']);
+ }
+
+ $query = "SELECT d.*, dc.* FROM `#download` AS d LEFT JOIN `#download_category` AS dc ON dc. download_category_id = d.download_category";
+
+ if (isset($_POST['searchquery']) && $_POST['searchquery'] != "")
+ {
+ $query .= " WHERE download_url REGEXP('".$_POST['searchquery']."') OR download_author REGEXP('".$_POST['searchquery']."') OR download_description REGEXP('".$_POST['searchquery']."') ";
+ foreach($search_display as $disp)
+ {
+ $query .= " OR $disp REGEXP('".$_POST['searchquery']."') ";
+ }
+ $query .= " ORDER BY {$sortorder} {$sortdirection}";
+ }
+ else
+ {
+ $query .= " ORDER BY ".($sub_action ? $sub_action : $sortorder)." ".($id ? $id : $sortdirection)." LIMIT $from, $amount";
+ }
+
+ if ($dl_count = $sql->db_Select_gen($query))
+ {
+ $text .= $rs->form_open("post", e_SELF."?".e_QUERY, "myform")."
+
+
+ ID
+ ";
+
+ // Search Display Column header.----------
+ foreach($search_display as $disp)
+ {
+ if($disp == "download_name")
+ { // Toggle direction
+ $text .= "".DOWLAN_27." ";
+ }
+ else
+ {
+ $repl = array("download_","_");
+ $text .= "".ucwords(str_replace($repl," ",$disp))." ";
+ }
+ }
+
+
+ $text .="".LAN_OPTIONS." ";
+
+ while ($row = $sql->db_Fetch())
+ {
+ $text .= "";
+
+ // Display Chosen options
+ foreach($search_display as $disp)
+ {
+ $text .= "";
+ }
+
+
+ $text .= "
+
+ ";
+ }
+ $text .= "
";
+ }
+ else
+ { // 'No downloads yet'
+ $text .= "
".DOWLAN_6."
";
+ }
+ $text .= "
";
+
+ // Next-Previous.
+ $downloads = $sql->db_Count("download");
+ if ($downloads > $amount && !$_POST['searchquery'])
+ {
+ $parms = "{$downloads},{$amount},{$from},".e_SELF."?".(e_QUERY ? "$action.$sub_action.$id." : "main.{$sortorder}.{$sortdirection}.")."[FROM]";
+ $text .= "
".$tp->parseTemplate("{NEXTPREV={$parms}}");
+ }
+
+
+ // Search & display options etc.
+ $text .= "
\n\n \n \n
";
+
+ $text .= "".LAN_DISPLAYOPT."
";
+ $text .= "
+
+ \n
+
";
+
+
+ $ns->tablerender(DOWLAN_7, $text);
+ }
+
+ function show_options($action) {
+
+ if ($action == "") {
+ $action = "main";
+ }
+ $var['main']['text'] = DOWLAN_29;
+ $var['main']['link'] = e_SELF;
+
+ $var['create']['text'] = DOWLAN_30;
+ $var['create']['link'] = e_SELF."?create";
+
+ $var['cat']['text'] = DOWLAN_31;
+ $var['cat']['link'] = e_SELF."?cat";
+ $var['cat']['perm'] = "Q";
+
+ $var['opt']['text'] = LAN_OPTIONS;
+ $var['opt']['link'] = e_SELF."?opt";
+
+ $var['limits']['text'] = DOWLAN_112;
+ $var['limits']['link'] = e_SELF."?limits";
+
+ $var['mirror']['text'] = DOWLAN_128;
+ $var['mirror']['link'] = e_SELF."?mirror";
+
+ show_admin_menu(DOWLAN_32, $action, $var);
+
+ }
+
+
+// ---------------------------------------------------------------------------
+
+
+ // Given the string which is stored in the DB, turns it into an array of mirror entries
+ // If $byID is true, the array index is the mirror ID. Otherwise its a simple array
+ function makeMirrorArray($source, $byID = FALSE)
+ {
+ $ret = array();
+ if($source)
+ {
+ $mirrorTArray = explode(chr(1), $source);
+
+ $count = 0;
+ foreach($mirrorTArray as $mirror)
+ {
+ if ($mirror)
+ {
+ list($mid, $murl, $mreq) = explode(",", $mirror);
+ $ret[$byID ? $mid : $count] = array('id' => $mid, 'url' => $murl, 'requests' => $mreq);
+ $count++;
+ }
+ }
+ }
+ return $ret;
+ }
+
+
+ // Turn the array into a string which can be stored in the DB
+ function compressMirrorArray($source)
+ {
+ if (!is_array($source) || !count($source)) return '';
+ $inter = array();
+ foreach ($source as $s)
+ {
+ $inter[] = $s['id'].','.$s['url'].','.$s['requests'];
+ }
+ return implode(chr(1),$inter);
+ }
+
+
+
+ function create_download($sub_action, $id)
+ {
+ global $cal,$tp, $sql, $fl, $rs, $ns, $file_array, $image_array, $thumb_array,$pst;
+ require_once(e_FILE."shortcode/batch/download_shortcodes.php");
+
+ $mirrorArray = array();
+
+ $download_status[0] = DOWLAN_122;
+ $download_status[1] = DOWLAN_123;
+ $download_status[2] = DOWLAN_124;
+ $preset = $pst->read_preset("admin_downloads"); // read preset values into array
+ extract($preset);
+
+ if (!$sql->db_Select("download_category"))
+ {
+ $ns->tablerender(ADLAN_24, "".DOWLAN_5."
");
+ return;
+ }
+ $download_active = 1;
+ if ($sub_action == "edit" && !$_POST['submit'])
+ {
+ if ($sql->db_Select("download", "*", "download_id=".$id))
+ {
+ $row = $sql->db_Fetch();
+ extract($row);
+
+ $mirrorArray = $this->makeMirrorArray($row['download_mirror']);
+ }
+ }
+
+ if ($sub_action == "dlm" && !$_POST['submit'])
+ {
+ if ($sql->db_Select("upload", "*", "upload_id=".$id))
+ {
+ $row = $sql->db_Fetch();
+
+ $download_category = $row['upload_category'];
+ $download_name = $row['upload_name'].($row['upload_version'] ? " v" . $row['upload_version'] : "");
+ $download_url = $row['upload_file'];
+ $download_author_email = $row['upload_email'];
+ $download_author_website = $row['upload_website'];
+ $download_description = $row['upload_description'];
+ $download_image = $row['upload_ss'];
+ $download_filesize = $row['upload_filesize'];
+ $image_array[] = array("path" => "", "fname" => $row['upload_ss']);
+ $download_author = substr($row['upload_poster'], (strpos($row['upload_poster'], ".")+1));
+ }
+ }
+
+
+ $text = "
+ ";
+ $ns->tablerender(ADLAN_24, $text);
+ }
+
+
+// -----------------------------------------------------------------------------
+
+ function show_message($message) {
+ global $ns;
+ $ns->tablerender("", "".$message."
");
+ }
+
+// -----------------------------------------------------------------------------
+
+
+ // Actually save a new or edited download to the DB
+ function submit_download($sub_action, $id)
+ {
+ global $tp, $sql, $DOWNLOADS_DIRECTORY, $e_event;
+
+ $dlInfo = array();
+ $dlMirrors = array();
+
+ if($sub_action == 'edit')
+ {
+ if($_POST['download_url_external'] == '')
+ {
+ $_POST['download_filesize_external'] = FALSE;
+ }
+ }
+
+ if ($_POST['download_url_external'] && $_POST['download_url'] == '')
+ {
+ $dlInfo['download_url'] = $tp->toDB($_POST['download_url_external']);
+ $filesize = intval($_POST['download_filesize_external']);
+ }
+ else
+ {
+ $dlInfo['download_url'] = $tp->toDB($_POST['download_url']);
+ if($_POST['download_filesize_external'])
+ {
+ $filesize = intval($_POST['download_filesize_external']);
+ }
+ else
+ {
+ if (strpos($DOWNLOADS_DIRECTORY, "/") === 0 || strpos($DOWNLOADS_DIRECTORY, ":") >= 1)
+ {
+ $filesize = filesize($DOWNLOADS_DIRECTORY.$dlInfo['download_url']);
+ }
+ else
+ {
+ $filesize = filesize(e_BASE.$DOWNLOADS_DIRECTORY.$dlInfo['download_url']);
+ }
+ }
+ }
+
+ if (!$filesize)
+ {
+ if($sql->db_Select("upload", "upload_filesize", "upload_file='{$dlInfo['download_url']}'"))
+ {
+ $row = $sql->db_Fetch();
+ $filesize = $row['upload_filesize'];
+ }
+ }
+ $dlInfo['download_filesize'] = $filesize;
+
+
+ // ---- Move Images and Files ------------
+ if($_POST['move_image'])
+ {
+ if($_POST['download_thumb'])
+ {
+ $oldname = e_FILE."public/".$_POST['download_thumb'];
+ $newname = e_FILE."downloadthumbs/".$_POST['download_thumb'];
+ if(!$this -> move_file($oldname,$newname))
+ {
+ return;
+ }
+ }
+ if($_POST['download_image'])
+ {
+ $oldname = e_FILE."public/".$_POST['download_image'];
+ $newname = e_FILE."downloadimages/".$_POST['download_image'];
+ if(!$this -> move_file($oldname,$newname))
+ {
+ return;
+ }
+ }
+ }
+
+ if($_POST['move_file'] && $_POST['download_url'])
+ {
+ $oldname = e_FILE."public/".$_POST['download_url'];
+ $newname = $_POST['move_file'].$_POST['download_url'];
+ if(!$this -> move_file($oldname,$newname))
+ {
+ return;
+ }
+ $dlInfo['download_url'] = str_replace(e_DOWNLOAD,"",$newname);
+ }
+
+
+ // ------------------------------------------
+
+
+ $dlInfo['download_description'] = $tp->toDB($_POST['download_description']);
+ $dlInfo['download_name'] = $tp->toDB($_POST['download_name']);
+ $dlInfo['download_author'] = $tp->toDB($_POST['download_author']);
+ $dlInfo['download_author_email'] = $tp->toDB($_POST['download_author_email']);
+ $dlInfo['download_author_website'] = $tp->toDB($_POST['download_author_website']);
+ $dlInfo['download_category'] = intval($_POST['download_category']);
+ $dlInfo['download_active'] = intval($_POST['download_active']);
+ $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'])
+ {
+ $dlInfo['download_datestamp'] = time();
+ }
+
+ $mirrorStr = "";
+ $mirrorFlag = FALSE;
+
+ // See if any mirrors defined
+ // Need to check all the possible mirror names - might have deleted the first one if we're in edit mode
+ foreach ($_POST['download_mirror_name'] as $mn)
+ {
+ if ($mn)
+ {
+ $mirrorFlag = TRUE;
+ break;
+ }
+ }
+ if($mirrorFlag)
+ {
+ $mirrors = count($_POST['download_mirror_name']);
+ $mirrorArray = array();
+ $newMirrorArray = array();
+ if ($id && $sql->db_Select('download','download_mirror', 'download_id = '.$id)) // Get existing download stats
+ {
+ if ($row = $sql->db_Fetch())
+ {
+ $mirrorArray = $this->makeMirrorArray($row['download_mirror'], TRUE);
+ }
+ }
+ for($a=0; $a<$mirrors; $a++)
+ {
+ $mid = trim($_POST['download_mirror_name'][$a]);
+ $murl = trim($_POST['download_mirror'][$a]);
+ if ($mid && $murl)
+ {
+ $newMirrorArray[$mid] = array('id' => $mid, 'url' => $murl, 'requests' => 0);
+ if (DOWNLOAD_DEBUG && !$id)
+ {
+ $newMirrorArray[$mid]['requests'] = intval($_POST['download_mirror_requests'][$a]);
+ }
+ }
+ }
+ // Now copy across any existing usage figures
+ foreach ($newMirrorArray as $k => $m)
+ {
+ if (isset($mirrorArray[$k]))
+ {
+ $newMirrorArray[$k]['requests'] = $mirrorArray[$k]['requests'];
+ }
+ }
+ $mirrorStr = $this->compressMirrorArray($newMirrorArray);
+ }
+
+ $dlMirrors['download_mirror']=$mirrorStr;
+ $dlMirrors['download_mirror_type']=intval($_POST['download_mirror_type']);
+
+ if ($id)
+ { // Its an edit
+ admin_update($sql->db_UpdateArray('download',array_merge($dlInfo,$dlMirrors),'WHERE download_id='.intval($id)), 'update', DOWLAN_2." (".$_POST['download_name']." )");
+ $dlInfo['download_id'] = $id;
+ $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
+ {
+ if (admin_update($download_id = $sql->db_Insert('download',array_merge($dlInfo,$dlMirrors)), 'insert', DOWLAN_1." (".$_POST['download_name']." )"))
+ {
+ $dlInfo['download_id'] = $download_id;
+ $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'])
+ {
+ $sql->db_Update("upload", "upload_active='1' WHERE upload_id='".$_POST['remove_id']."'");
+ $mes = " ".$_POST['download_name']." ".DOWLAN_104;
+ $mes .= "".DOWLAN_105." ";
+ $this->show_message($mes);
+ }
+ }
+ }
+ }
+
+
+ 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)
+ {
+ global $sql, $rs, $ns, $tp, $pst;
+
+ if (!is_object($sql2)) {
+ $sql2 = new db;
+ }
+ $text = $rs->form_open("post", e_SELF."?".e_QUERY, "myform");
+ $text .= "";
+
+ $qry = "
+ SELECT dc.*, COUNT(d.download_id) AS filecount FROM #download_category AS dc
+ LEFT JOIN #download AS d ON d.download_category = dc.download_category_id
+ GROUP BY dc.download_category_id
+ ORDER BY dc.download_category_order
+ ";
+ if($sql->db_Select_gen($qry))
+ {
+ $categories = $sql->db_getList();
+ foreach($categories as $cat)
+ {
+ $cat_array[$cat['download_category_parent']][] = $cat;
+ }
+
+ $text .= "
+
+
+
+ ".DOWLAN_11."
+ ".DOWLAN_52."
+ ".LAN_ORDER."
+ ".LAN_OPTIONS."
+ ";
+
+
+ //Start displaying parent categories
+ foreach($cat_array[0] as $parent)
+ {
+ if(strstr($parent['download_category_icon'], chr(1)))
+ {
+ list($parent['download_category_icon'], $parent['download_category_icon_empty']) = explode(chr(1), $parent['download_category_icon']);
+ }
+
+ $text .= "
+
+
+
+
+
+ ";
+
+ //Show main categories
+
+ if(is_array($cat_array[$parent['download_category_id']]))
+ {
+ foreach($cat_array[$parent['download_category_id']] as $main)
+ {
+
+ if(strstr($main['download_category_icon'], chr(1)))
+ {
+ list($main['download_category_icon'], $main['download_category_icon_empty']) = explode(chr(1), $main['download_category_icon']);
+ }
+ $text .= "
+
+
+
+
+
+ ";
+
+ //Show sub categories
+ if(is_array($cat_array[$main['download_category_id']]))
+ {
+ foreach($cat_array[$main['download_category_id']] as $sub)
+ {
+
+ if(strstr($sub['download_category_icon'], chr(1)))
+ {
+ list($sub['download_category_icon'], $sub['download_category_icon_empty']) = explode(chr(1), $sub['download_category_icon']);
+ }
+ $text .= "
+
+
+
+
+
+ ";
+ }
+ }
+ }
+ }
+
+ }
+
+ $text .= "
";
+ $text .= "
+
+
";
+ }
+ else
+ {
+ $text .= "".DOWLAN_38."
";
+ }
+ $text .= "";
+ $ns->tablerender(DOWLAN_37, $text);
+
+ unset($download_category_id, $download_category_name, $download_category_description, $download_category_parent, $download_category_icon, $download_category_class);
+
+ $handle = opendir(e_IMAGE."icons");
+ while ($file = readdir($handle)) {
+ if ($file != "." && $file != ".." && $file != "/" && $file != "CVS") {
+ $iconlist[] = $file;
+ }
+ }
+ closedir($handle);
+
+ if ($sub_action == "edit" && !$_POST['add_category']) {
+ if ($sql->db_Select("download_category", "*", "download_category_id=$id")) {
+ $row = $sql->db_Fetch();
+ extract($row);
+ $main_category_parent = $download_category_parent;
+ if(strstr($download_category_icon, chr(1)))
+ {
+ list($download_category_icon, $download_category_icon_empty) = explode(chr(1), $download_category_icon);
+ }
+ else
+ {
+ $download_category_icon_empty = "";
+ }
+ }
+ }
+
+ $preset = $pst->read_preset("admin_dl_cat"); // read preset values into array
+ extract($preset);
+
+ $frm_action = (isset($_POST['add_category'])) ? e_SELF."?cat" : e_SELF."?".e_QUERY;
+ $text = "
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ";
+
+
+ $text .= "
+
+
+
+
+
+
";
+ $ns->tablerender(DOWLAN_39, $text);
+ }
+
+ function create_category($sub_action, $id)
+ {
+ global $sql, $tp, $admin_log;
+ $download_category_name = $tp->toDB($_POST['download_category_name']);
+ $download_category_description = $tp->toDB($_POST['download_category_description']);
+ $download_category_icon = $tp->toDB($_POST['download_category_icon']);
+ $download_category_class = $tp->toDB($_POST['download_category_class']);
+ $download_categoory_parent = intval($_POST['download_category_parent']);
+
+ if(isset($_POST['download_category_icon_empty']) && $_POST['download_category_icon_empty'] != "")
+ {
+ $download_category_icon .= trim(chr(1).$tp->toDB($_POST['download_category_icon_empty']));
+ }
+
+ 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_log->log_event('DOWNL_03',$download_category_name.'[!br!]'.$download_category_description,E_LOG_INFORMATIVE,'');
+ }
+ 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_log->log_event('DOWNL_02',$download_category_name.'[!br!]'.$download_category_description,E_LOG_INFORMATIVE,'');
+ }
+ if ($sub_action == "sn")
+ {
+ $sql->db_Delete("tmp", "tmp_time='{$id}' ");
+ }
+ }
+
+
+
+ function show_existing_mirrors()
+ {
+
+ global $sql, $ns, $tp, $sub_action, $id, $delete, $del_id, $admin_log;
+
+ if($delete == "mirror")
+ {
+ 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,'');
+ }
+
+
+ if(!$sql -> db_Select("download_mirror"))
+ {
+ $text = "".DOWLAN_144."
"; // No mirrors defined yet
+ }
+ else
+ {
+
+ $text = "
+
+
+
+
+
+
+
+
+ ";
+
+ $mirrorList = $sql -> db_getList();
+
+ foreach($mirrorList as $mirror)
+ {
+ extract($mirror);
+ $text .= "
+
+
+
+
+
+
+
+ ";
+ }
+ $text .= "
";
+
+ }
+
+ $ns -> tablerender(DOWLAN_138, $text);
+
+ require_once(e_HANDLER."file_class.php");
+ $fl = new e_file;
+ $imagelist = $fl->get_files(e_FILE.'downloadimages/');
+
+ if($sub_action == "edit" && !defined("SUBMITTED"))
+ {
+ $sql -> db_Select("download_mirror", "*", "mirror_id='".intval($id)."' ");
+ $mirror = $sql -> db_Fetch();
+ extract($mirror);
+ $edit = TRUE;
+ }
+ else
+ {
+ unset($mirror_name, $mirror_url, $mirror_image, $mirror_location, $mirror_description);
+ $edit = FALSE;
+ }
+
+ $text = "
+
\n
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
";
+
+ $caption = ($edit ? DOWLAN_142 : DOWLAN_143);
+
+ $ns -> tablerender($caption, $text);
+ }
+
+
+
+ function submit_mirror()
+ {
+ global $tp, $sql, $admin_log;
+ define("SUBMITTED", TRUE);
+ if(isset($_POST['mirror_name']) && isset($_POST['mirror_url']))
+ {
+ $name = $tp -> toDB($_POST['mirror_name']);
+ $url = $tp -> toDB($_POST['mirror_url']);
+ $location = $tp -> toDB($_POST['mirror_location']);
+ $description = $tp -> toDB($_POST['mirror_description']);
+
+ $logString = $name.'[!br!]'.$url.'[!br!]'.$location.'[!br!]'.$description;
+
+ if (isset($_POST['id']))
+ {
+ 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,'');
+ }
+ }
+ }
+
+ // ---------------------------------------------------------------------------
+
+ function move_file($oldname,$newname)
+ {
+ global $ns;
+ if(file_exists($newname))
+ {
+ return TRUE;
+ }
+
+ if(!file_exists($oldname) || is_dir($oldname))
+ {
+ $ns -> tablerender(LAN_ERROR,DOWLAN_68 . " : ".$oldname);
+ return FALSE;
+ }
+
+ $directory = dirname($newname);
+ if(is_writable($directory))
+ {
+ if(!rename($oldname,$newname))
+ {
+ $ns -> tablerender(LAN_ERROR,DOWLAN_152." ".$oldname ." -> ".$newname);
+ return FALSE;
+ }
+ else
+ {
+ return TRUE;
+ }
+ }
+ else
+ {
+ $ns -> tablerender(LAN_ERROR,$directory ." ".LAN_NOTWRITABLE);
+ return FALSE;
+ }
+ }
+
+// -------------------------------------------------------------------------
+
+
+} // end class.
+
+
+function download_admin_adminmenu($parms)
+{
+ global $download;
+ global $action;
+ $download->show_options($action);
+}
+
+
+
+
+
+?>
diff --git a/e107_plugins/download/download_management.php b/e107_plugins/download/download_management.php
new file mode 100644
index 000000000..f35b4fe79
--- /dev/null
+++ b/e107_plugins/download/download_management.php
@@ -0,0 +1,48 @@
+ ";
+ }
+
+ function download_install_post(&$var)
+ {
+ global $sql;
+ echo "custom install 'post' function ";
+ }
+
+ function download_uninstatll(&$var)
+ {
+ global $sql;
+ echo "custom uninstall function ";
+ }
+
+ function download_upgrade(&$var)
+ {
+ global $sql;
+ echo "custom upgrade function ";
+ //if(version_compare($var['current_plug']['plugin_version'], "1.2", "<"))
+ //{
+ // $qry = "ALTER TABLE #download ADD download_postclass TINYINT( 3 ) UNSIGNED DEFAULT '0' NOT NULL ;";
+ // $sql->db_Select_gen($qry);
+ //}
+ }
+}
diff --git a/e107_plugins/download/help.php b/e107_plugins/download/help.php
new file mode 100644
index 000000000..3ccd18ee7
--- /dev/null
+++ b/e107_plugins/download/help.php
@@ -0,0 +1,26 @@
+
+To submit a download, first create a parent, then create a category under that parent, you will then be able to make the download available.";
+$ns -> tablerender("Download Help", $text);
+?>
\ No newline at end of file
diff --git a/e107_plugins/download/images/downloads_16.png b/e107_plugins/download/images/downloads_16.png
new file mode 100644
index 000000000..60a03f613
Binary files /dev/null and b/e107_plugins/download/images/downloads_16.png differ
diff --git a/e107_plugins/download/images/downloads_32.png b/e107_plugins/download/images/downloads_32.png
new file mode 100644
index 000000000..2c9074d28
Binary files /dev/null and b/e107_plugins/download/images/downloads_32.png differ
diff --git a/e107_plugins/download/languages/English/lan_download.php b/e107_plugins/download/languages/English/lan_download.php
new file mode 100644
index 000000000..892b66006
--- /dev/null
+++ b/e107_plugins/download/languages/English/lan_download.php
@@ -0,0 +1,103 @@
+Thank you.");
+define("LAN_dl_49", "Click here to return to download");
+define("LAN_dl_50", "Report broken download to an administrator");
+define("LAN_dl_51", "Reporting download: ");
+define("LAN_dl_52", "Guest");
+define("LAN_dl_53", "Click to view download");
+define("LAN_dl_54", "An administrator will be made aware of this download, please leave a message if you feel it necessary.");
+define("LAN_dl_55", "Do not use this form to contact the admin for any other reason.");
+// define("LAN_dl_56", "Report broken download"); already defined above.
+define("LAN_dl_57", "reported by");
+define("LAN_dl_58", "The following download has been reported as broken from site");
+define("LAN_dl_59", "Reported by: ");
+define("LAN_dl_60", "Broken download report from");
+
+define("LAN_dl_61", "Download Error");
+define("LAN_dl_62", "You have been prevented from downloading this file; you have exceeded your download quota");
+define("LAN_dl_63", "You do not have the correct permissions to download this file.");
+define("LAN_dl_64", "Back");
+define("LAN_dl_65", "File Not Found");
+
+define("LAN_dl_66", "Select download mirror");
+
+define("LAN_dl_67", "Please select mirror to use ...");
+define("LAN_dl_68", "Mirror Host");
+// define("LAN_dl_69", "Download"); // duplicate
+define("LAN_dl_70", "Location");
+define("LAN_dl_71", "About");
+
+define("LAN_dl_72", "Requesting file: ");
+define("LAN_dl_73", "Downloads from this mirror: ");
+define("LAN_dl_74", "Total downloads from this mirror: ");
+
+define("LAN_dl_75", "no image available ");
+define("LAN_dl_76", "Go to page");
+define("LAN_dl_77", "Downloads"); // Intentional duplicate - some languages need it to be different. This is for number of downloads
+
+define('LAN_dl_78', 'That download has been disabled or discontinued. Please check in the --LINK--downloads area for a more recent version.');
+
+?>
diff --git a/e107_plugins/download/languages/English/lan_download_admin.php b/e107_plugins/download/languages/English/lan_download_admin.php
new file mode 100644
index 000000000..8b5ed6243
--- /dev/null
+++ b/e107_plugins/download/languages/English/lan_download_admin.php
@@ -0,0 +1,149 @@
+
\ No newline at end of file
diff --git a/e107_plugins/download/plugin.xml b/e107_plugins/download/plugin.xml
new file mode 100755
index 000000000..8d17af986
--- /dev/null
+++ b/e107_plugins/download/plugin.xml
@@ -0,0 +1,39 @@
+
+
+
+
+ This plugin is a fully featured Download system
+ download
+
+ download_admin.php
+
+
+
+
+
+
+ images/downloads_32.png
+ images/downloads_16.png
+ Configure Download
+ Your download plugin is now installed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+