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 = "
+ + + + + + + + + + + + +
+ ".LAN_dl_32.": ".$download_name."
+ + ".LAN_dl_53." + +
+
".LAN_dl_54."
".LAN_dl_55." +
+ +

+ +
"; + $ns->tablerender(LAN_dl_50, $text); + } + require_once(FOOTERF); + exit; +} + + +//==================================================== +// MIRRORS +//==================================================== +if($action == "mirror") +{ + require_once(HEADERF); + + $load_template = 'download_template'; + if (!isset($DOWNLOAD_MIRROR_START)) eval($template_load_core); + + $sql -> db_Select("download_mirror"); + $mirrorList = $sql -> db_getList("ALL", 0, 200, "mirror_id"); + + if($sql -> db_Select("download", "*", "download_id = {$id}")) + { + $row = $sql->db_Fetch(); + + extract($row); + $array = explode(chr(1), $download_mirror); + + // Shuffle the mirror list into a random order + $c = count($array) -1; // Will always be an empty entry at the end + for ($i=1; $i<$c; $i++) + { + $d = mt_rand(0, $i); + $tmp = $array[$i]; + $array[$i] = $array[$d]; + $array[$d] = $tmp; + } + + $download_mirror = ""; + foreach($array as $mirrorstring) + { + if($mirrorstring) + { + $download_mirror .= parse_download_mirror_table($row, $mirrorstring, $mirrorList); + } + } + + $DOWNLOAD_MIRROR_HOST_LAN = LAN_dl_68; + $DOWNLOAD_MIRROR_GET_LAN = LAN_dl_32; + $DOWNLOAD_MIRROR_LOCATION_LAN = LAN_dl_70; + $DOWNLOAD_MIRROR_DESCRIPTION_LAN = LAN_dl_71; + $DOWNLOAD_MIRROR_REQUEST = LAN_dl_72."'".$download_name."'"; + + $download_mirror_start = preg_replace("/\{(.*?)\}/e", '$\1', $DOWNLOAD_MIRROR_START); + $download_mirror_end = preg_replace("/\{(.*?)\}/e", '$\1', $DOWNLOAD_MIRROR_END); + + $text = $download_mirror_start.$download_mirror.$download_mirror_end; + + if($DOWNLOAD_MIRROR_RENDERPLAIN) { + echo $text; + } else { + $ns->tablerender(LAN_dl_67, $text); + } + + require_once(FOOTERF); + } +} + +function parse_download_mirror_table($row, $mirrorstring, $mirrorList) +{ + + global $DOWNLOAD_MIRROR; + list($mirrorHost_id, $mirrorHost_url, $mirrorRequests) = explode(",", $mirrorstring); + + extract($mirrorList[$mirrorHost_id]); + + $DOWNLOAD_MIRROR_NAME = "
{$mirror_name}"; + $DOWNLOAD_MIRROR_IMAGE = ($mirror_image ? "" : ""); + $DOWNLOAD_MIRROR_LOCATION = ($mirror_location ? $mirror_location : ""); + $DOWNLOAD_MIRROR_DESCRIPTION = ($mirror_description ? $mirror_description : ""); + + $DOWNLOAD_MIRROR_FILESIZE = $e107->parseMemorySize($row['download_filesize']); + $DOWNLOAD_MIRROR_LINK = ""; + + $DOWNLOAD_MIRROR_REQUESTS = (ADMIN ? LAN_dl_73.$mirrorRequests : ""); + $DOWNLOAD_TOTAL_MIRROR_REQUESTS = (ADMIN ? LAN_dl_74.$mirror_count : ""); + + return(preg_replace("/\{(.*?)\}/e", '$\1', $DOWNLOAD_MIRROR)); +} + + + + +function parse_download_cat_parent_table($row) +{ + global $tp,$e107,$current_row,$DOWNLOAD_CAT_PARENT_TABLE; + extract($row); + $current_row = ($current_row) ? 0 : 1; // Alternating CSS for each row.(backwards compatible) + + $template = ($current_row == 1) ? $DOWNLOAD_CAT_PARENT_TABLE : str_replace("forumheader3","forumheader3 forumheader3_alt",$DOWNLOAD_CAT_PARENT_TABLE); + + $DOWNLOAD_CAT_MAIN_ICON = ''; + $DOWNLOAD_CAT_MAIN_NAME = ''; + $DOWNLOAD_CAT_MAIN_DESCRIPTION = ''; + + if (check_class($download_category_class)) + { + if(strstr($download_category_icon, chr(1))) + { + list($download_category_icon, $download_category_icon_empty) = explode(chr(1), $download_category_icon); + } + $DOWNLOAD_CAT_MAIN_ICON = ($download_category_icon ? "" : " "); + $DOWNLOAD_CAT_MAIN_NAME = $tp->toHTML($download_category_name,FALSE,'USER_TITLE'); + $DOWNLOAD_CAT_MAIN_DESCRIPTION = $tp->toHTML($row['download_category_description'],TRUE,'DESCRIPTION'); + } + return(preg_replace("/\{(.*?)\}/e", '$\1', $template)); +} + + + function get_cat_icons($source, $count) + { + if (!$source) return " "; + list($ret[TRUE],$ret[FALSE]) = explode(chr(1), $source.chr(1)); + if (!$ret[FALSE]) $ret[FALSE] = $ret[TRUE]; + return ""; + } + + function check_new_download($last_val) + { + if(USER && ($last_val > USERLV)) + { + return ""; + } + else + { + return ""; + } + } + + +function parse_download_cat_child_table($row) +{ + global $tp,$e107,$current_row, $DOWNLOAD_CAT_CHILD_TABLE, $DOWNLOAD_CAT_SUBSUB_TABLE; + + $current_row = ($current_row) ? 0 : 1; // Alternating CSS for each row.(backwards compatible) + $template = ($current_row == 1) ? $DOWNLOAD_CAT_CHILD_TABLE : str_replace("forumheader3","forumheader3 forumheader3_alt",$DOWNLOAD_CAT_CHILD_TABLE); + + $DOWNLOAD_CAT_SUB_ICON = get_cat_icons($row['download_category_icon'],$row['d_count']); + $DOWNLOAD_CAT_SUB_NEW_ICON = check_new_download($row['d_last_subs']); + $dcatname=$tp->toHTML($row['download_category_name'],FALSE,'USER_TITLE'); + $DOWNLOAD_CAT_SUB_NAME = ($row['d_count'] ? "".$dcatname."" : $dcatname); + $DOWNLOAD_CAT_SUB_NAME_LINKED = "".$dcatname.""; + $DOWNLOAD_CAT_SUB_DESCRIPTION = $tp->toHTML($row['download_category_description'],TRUE,'DESCRIPTION'); + $DOWNLOAD_CAT_SUB_COUNT = $row['d_count']; + $DOWNLOAD_CAT_SUB_SIZE = $e107->parseMemorySize($row['d_size']); + $DOWNLOAD_CAT_SUB_DOWNLOADED = intval( $row['d_requests']); + $DOWNLOAD_CAT_SUBSUB = ""; + // check for subsub cats ... + foreach($row['subsubcats'] as $subrow) + { + $DOWNLOAD_CAT_SUBSUB_ICON = get_cat_icons($subrow['download_category_icon'],$subrow['d_count']); + $DOWNLOAD_CAT_SUBSUB_DESCRIPTION = $tp->toHTML($subrow['download_category_description'],TRUE,'DESCRIPTION'); + $DOWNLOAD_CAT_SUBSUB_COUNT = intval($subrow['d_count']); + $DOWNLOAD_CAT_SUBSUB_SIZE = $e107->parseMemorySize($subrow['d_size']); + $DOWNLOAD_CAT_SUBSUB_DOWNLOADED = intval($subrow['d_requests']); + + $DOWNLOAD_CAT_SUBSUB_NEW_ICON = check_new_download($subrow['d_last']); + $DOWNLOAD_CAT_SUBSUB_NAME = ($subrow['d_count'] ? "".$tp->toHTML($subrow['download_category_name'], FALSE, 'USER_TITLE')."" : $tp->toHTML($subrow['download_category_name'],FALSE,'USER_TITLE')); + $DOWNLOAD_CAT_SUBSUB .= preg_replace("/\{(.*?)\}/e", '$\1', $DOWNLOAD_CAT_SUBSUB_TABLE); + } + + return(preg_replace("/\{(.*?)\}/e", '$\1', $template)); +} + + +function parse_download_list_table($row) +{ +// ***** $agreetext may not need to be global + global $download_shortcodes,$tp,$current_row,$DOWNLOAD_LIST_TABLE, $rater, $pref, $gen, $agreetext; + + $agreetext = $tp->toHTML($pref['agree_text'],TRUE,'DESCRIPTION'); + $current_row = ($current_row) ? 0 : 1; // Alternating CSS for each row.(backwards compatible) + $template = ($current_row == 1) ? $DOWNLOAD_LIST_TABLE : str_replace("forumheader3","forumheader3 forumheader3_alt",$DOWNLOAD_LIST_TABLE); + + return $tp->parseTemplate($template,TRUE,$download_shortcodes); + +} + + +//============================================= +// DOWNLOAD CATEGORY CLASS +//============================================= + +class down_cat_handler +{ + var $cat_tree; // Initialised with all categories in a tree structure + var $cat_count; // Count visible subcats and subsubcats + var $down_count; // Counts total downloads + + function down_cat_handler($nest_level = 1, $load_class = USERCLASS_LIST, $main_cat_load = '', $accum = FALSE) + { // Constructor - make a copy of the tree for re-use + // $nest_level = 0 merges subsubcats with subcats. >0 creates full tree. + // If load-class non-null, assumed to be a 'class set' such as USERCLASS_LIST + // If $accum is TRUE, include file counts and sizes in superior categories + define("SUB_PREFIX","-->"); // Added in front of sub categories + define("SUBSUB_PREFIX","---->"); // Added in front of sub-sub categories + $this->cat_tree = $this->down_cat_tree($nest_level,$load_class, $main_cat_load, $accum); + } + + +// Function returns a 'tree' of download categories, subcategories, and sub-sub-categories. +// Returns empty array if nothing defined +// Within the 'main category' level of the nesting, array 'subcats' has the next level's info +// Within the 'sub-category' level of the nesting, array 'subsubcats' has the next level's info +// If $main_cat_load is numeric, and the value of a 'main' category, only that main category is displayed. +// (Unpredictable if $main_cat_load is some other category) + function down_cat_tree($nest_level = 1, $load_cat_class = USERCLASS_LIST, $main_cat_load = '', $accum = FALSE) + { + global $sql2; + + $catlist = array(); + $this->cat_count = 0; + $this->down_count = 0; + $temp2 = ""; + $temp1 = ""; + if ($load_cat_class != "") + { + $temp1 = " WHERE dc.download_category_class IN ({$load_cat_class}) "; + $temp2 = "AND d.download_visible IN ({$load_cat_class}) "; + } + + $qry = " + SELECT dc.*, + dc1.download_category_parent AS d_parent1, dc1.download_category_order, + 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_category as dc1 ON dc1.download_category_id=dc.download_category_parent + LEFT JOIN #download_category as dc2 ON dc2.download_category_id=dc1.download_category_parent + LEFT JOIN #download AS d on d.download_category = dc.download_category_id AND d.download_active > 0 {$temp2} + {$temp1} + GROUP by dc.download_category_id + ORDER by dc2.download_category_order, dc1.download_category_order, dc.download_category_order"; // This puts main categories first, then sub-cats, then sub-sub cats + + if (!$sql2->db_Select_gen($qry)) return $catlist; + + while ($row = $sql2->db_Fetch()) + { + $tmp = $row['download_category_parent']; + if ($tmp == '0') + { // Its a main category + if (!is_numeric($main_cat_load) || ($main_cat_load == $row['download_category_id'])) + { + $row['subcats'] = array(); + $catlist[$row['download_category_id']] = $row; + } + } + else + { + if (isset($catlist[$tmp])) + { // Sub-Category + $this->cat_count++; + $this->down_count += $row['d_count']; + $catlist[$tmp]['subcats'][$row['download_category_id']] = $row; + $catlist[$tmp]['subcats'][$row['download_category_id']]['subsubcats'] = array(); + $catlist[$tmp]['subcats'][$row['download_category_id']]['d_last_subs'] = + $catlist[$tmp]['subcats'][$row['download_category_id']]['d_last']; + } + else + { // Its a sub-sub category + if (isset($catlist[$row['d_parent1']]['subcats'][$tmp])) + { + $this->cat_count++; + $this->down_count += $row['d_count']; + if ($accum || ($nest_level == 0)) + { // Add the counts into the subcategory values + $catlist[$row['d_parent1']]['subcats'][$tmp]['d_size'] += $row['d_size']; + $catlist[$row['d_parent1']]['subcats'][$tmp]['d_count'] += $row['d_count']; + $catlist[$row['d_parent1']]['subcats'][$tmp]['d_requests'] += $row['d_requests']; + } + if ($nest_level == 0) + { // Reflect subcat dates in category + if ($catlist[$row['d_parent1']]['subcats'][$tmp]['d_last'] < $row['d_last']) + $catlist[$row['d_parent1']]['subcats'][$tmp]['d_last'] = $row['d_last']; + } + else + { + $catlist[$row['d_parent1']]['subcats'][$tmp]['subsubcats'][$row['download_category_id']] = $row; + } + // Separately accumulate 'last update' for subcat plus associated subsubcats + if ($catlist[$row['d_parent1']]['subcats'][$tmp]['d_last_subs'] < $row['d_last']) + $catlist[$row['d_parent1']]['subcats'][$tmp]['d_last_subs'] = $row['d_last']; + } + } + } + } + return $catlist; + } + + +// Rest of the class isn't actually used normally, but print_tree() might help with debug + + function print_cat($cat, $prefix,$postfix) + { + $text = "".$cat['download_category_id']."".$cat['download_category_parent'].""; + $text .= $prefix.htmlspecialchars($cat['download_category_name']).$postfix."".$cat['d_size'].""; + $text .= "".$cat['d_count']."".$cat['d_requests']."".strftime('%H:%M %d-%m-%Y',$cat['d_last']).""; + $text .= ""; + return $text; + } + + function print_tree() + { + echo ""; + foreach ($this->cat_tree as $thiscat) + { // Main categories + $scprefix = SUB_PREFIX; + echo $this->print_cat($thiscat,'',''); + foreach ($thiscat['subcats'] as $sc) + { // Sub-categories + $sscprefix = SUBSUB_PREFIX; + echo $this->print_cat($sc,$scprefix,''); + foreach ($sc['subsubcats'] as $ssc) + { // Sub-sub categories + echo $this->print_cat($ssc,$sscprefix,''); + } + } + } + echo "
IDParentNameBytesFilesRequestsLast Download
"; + return; + } + +} + + + + +?> diff --git a/e107_plugins/download/download_admin.php b/e107_plugins/download/download_admin.php new file mode 100644 index 000000000..0e3f0e1ef --- /dev/null +++ b/e107_plugins/download/download_admin.php @@ -0,0 +1,1936 @@ +load_files(); +} + +$e_sub_cat = 'download'; +require_once(e_HANDLER."form_handler.php"); +require_once(e_HANDLER."userclass_class.php"); +require_once(e_HANDLER."file_class.php"); + +$fl = new e_file; + +// -------- Presets. ------------ +require_once(e_HANDLER."preset_class.php"); +$pst = new e_preset; +$pst->form = array("myform","dlform"); // form id of the form that will have it's values saved. +$pst->page = array("download.php?create","download.php?cat"); // display preset options on which page(s). +$pst->id = array("admin_downloads","admin_dl_cat"); +// ------------------------------- + +$download = new download; +require_once(e_ADMIN."auth.php"); +$pst->save_preset(); // unique name(s) for the presets - comma separated. + + /* +One form example (no arrays needed) +$pst->form = "myform"; // form id of the form that will have it's values saved. +$pst->page = "download.php?create"; // display preset options on which page. +$pst->save_preset("admin_downloads"); // unique name for the preset +*/ + +$rs = new form; +$sub_action = ''; +if (e_QUERY) +{ + $tmp = explode(".", e_QUERY); + $action = $tmp[0]; + $sub_action = varset($tmp[1],''); + $id = intval(varset($tmp[2],'')); + $from = varset($tmp[3], 0); + unset($tmp); +} + + +if(isset($_POST['delete'])) +{ + $tmp = array_keys($_POST['delete']); + list($delete, $del_id) = explode("_", $tmp[0]); + $del_id = intval($del_id); + unset($_POST['searchquery']); +} + +$from = ($from ? $from : 0); +$amount = 50; + + +if($file_array = $fl->get_files(e_DOWNLOAD, "","standard",5)) +{ + sort($file_array); +} + + +if($public_array = $fl->get_files(e_FILE."public/")) +{ + foreach($public_array as $key=>$val) + { + $file_array[] = str_replace(e_FILE."public/","",$val); + } +} + + + +if ($sql->db_Select("rbinary")) +{ + while ($row = $sql->db_Fetch()) + { + extract($row); + $file_array[] = "Binary ".$binary_id."/".$binary_name; + } +} + + + +if($image_array = $fl->get_files(e_FILE.'downloadimages/', '\.gif$|\.jpg$|\.png$|\.GIF$|\.JPG$|\.PNG$','standard',2)) +{ + sort($image_array); +} + +if($thumb_array = $fl->get_files(e_FILE.'downloadimages/', '\.gif$|\.jpg$|\.png$|\.GIF$|\.JPG$|\.PNG$','standard',2)) +{ + sort($thumb_array); +} + + + +if(isset($_POST)) +{ + $e107cache->clear("download_cat"); +} + +if (isset($_POST['add_category'])) +{ + $download->create_category($sub_action, $id); +} + + +if (isset($_POST['submit_download'])) +{ + $download->submit_download($sub_action, $id); + $action = "main"; + unset($sub_action, $id); +} + + +if(isset($_POST['update_catorder'])) +{ + 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)."'"); + } + } + $admin_log->log_event('DOWNL_08',implode(',',array_keys($_POST['catorder'])),E_LOG_INFORMATIVE,''); + $ns->tablerender("", "
".LAN_UPDATED."
"); +} + + +if (isset($_POST['updateoptions'])) +{ + unset($temp); + $temp['download_php'] = $_POST['download_php']; + $temp['download_view'] = $_POST['download_view']; + $temp['download_sort'] = $_POST['download_sort']; + $temp['download_order'] = $_POST['download_order']; + $temp['agree_flag'] = $_POST['agree_flag']; + $temp['download_email'] = $_POST['download_email']; + $temp['agree_text'] = $tp->toDB($_POST['agree_text']); + $temp['download_denied'] = $tp->toDB($_POST['download_denied']); + $temp['download_reportbroken'] = $_POST['download_reportbroken']; + if ($_POST['download_subsub']) $temp['download_subsub'] = '1'; else $temp['download_subsub'] = '0'; + if ($_POST['download_incinfo']) $temp['download_incinfo'] = '1'; else $temp['download_incinfo'] = '0'; + 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($sql->db_Select('generic','gen_id',"gen_type = 'download_limit' AND gen_datestamp = {$_POST['newlimit_class']}")) + { + $message = DOWLAN_116; + } + else + { + $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; + $admin_log->log_event('DOWNL_09',$valString,E_LOG_INFORMATIVE,''); + } + else + { + $message = DOWLAN_118; + } + unset($vals); + } +} + + +if(isset($_POST['updatelimits'])) +{ + + if($pref['download_limits'] != $_POST['download_limits']) + { + $pref['download_limits'] = ($_POST['download_limits'] == 'on') ? 1 : 0; + save_prefs(); + $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]) + { + //All entries empty - Remove record + if($sql->db_Delete('generic',"gen_id = {$idLim}")) + { + $message .= $idLim." - ".DOWLAN_119."
"; + $admin_log->log_event('DOWNL_11','ID: '.$idLim,E_LOG_INFORMATIVE,''); + } + else + { + $message .= $idLim." - ".DOWLAN_120."
"; + } + } + else + { + $vals = array(); + 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."
"; + unset($vals); + } + } +} + + +if(isset($_POST['submit_mirror'])) +{ + $download->submit_mirror($sub_action, $id); +} + + +if($action == "mirror") +{ + $download -> show_existing_mirrors(); +} + + +if ($action == "dlm") +{ + $action = "create"; + $id = $sub_action; + $sub_action = "dlm"; +} + + +if ($action == "create") +{ + $download->create_download($sub_action, $id); +} + + +if ($delete == 'category') +{ + 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); + $admin_log->log_event('DOWNL_04',$del_id,E_LOG_INFORMATIVE,''); + } +} + + +if ($action == 'cat') +{ + $download->show_categories($sub_action, $id); +} + + +if ($delete == 'main') +{ + $result = admin_update($sql->db_Delete('download', 'download_id='.$del_id), 'delete', DOWLAN_27." #".$del_id." ".DOWLAN_36); + if($result) + { + $admin_log->log_event('DOWNL_07',$del_id,E_LOG_INFORMATIVE,''); + admin_purge_related('download', $del_id); + $e_event->trigger('dldelete', $del_id); + } + unset($sub_action, $id); +} + + +if (isset($message)) +{ + $ns->tablerender("", "
".$message."
"); +} + + + +if (!e_QUERY || $action == "main") +{ + $download->show_existing_items($action, $sub_action, $id, $from, $amount); +} + + + + +if ($action == "opt") +{ + global $pref, $ns; + $agree_flag = $pref['agree_flag']; + $agree_text = $pref['agree_text']; + $text = "
+ \n + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
".DOWLAN_69.""; + $c = $pref['download_php'] ? " checked = 'checked' " : ""; + $ssc = ((!isset($pref['download_subsub'])) || ($pref['download_subsub'] == '1')) ? " checked = 'checked' " : ""; + $sacc = (varset($pref['download_incinfo'],0) == '1') ? " checked = 'checked' " : ""; + $text .= " ".DOWLAN_70."
".DOWLAN_158." +
".DOWLAN_159." +
+ ".DOWLAN_55." + + +
+ ".DOWLAN_56." + + + +
+ ".LAN_ORDER." + + +
".DOWLAN_151."". r_userclass("download_reportbroken", $pref['download_reportbroken'])."
".DOWLAN_150."". ($pref['download_email'] ? "" : "")."
".DOWLAN_100."". ($agree_flag ? "" : "")."
+ ".DOWLAN_101." + + +
+ ".DOWLAN_146." + + +
+ +
+ +
"; + $ns->tablerender(DOWLAN_54, $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; +} + +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")." + + + + "; + + // Search Display Column header.---------- + foreach($search_display as $disp) + { + if($disp == "download_name") + { // Toggle direction + $text .= ""; + } + else + { + $repl = array("download_","_"); + $text .= ""; + } + } + + + $text .=""; + + while ($row = $sql->db_Fetch()) + { + $text .= ""; + + // Display Chosen options + foreach($search_display as $disp) + { + $text .= ""; + } + + + $text .= " + + "; + } + $text .= "
ID".DOWLAN_27."".ucwords(str_replace($repl," ",$disp))."".LAN_OPTIONS."
".$row['download_id'].""; + switch ($disp) + { + case "download_name" : + $text .= "".$row['download_name'].""; + break; + case "download_category" : + $text .= $row['download_category_name']." "; + break; + case "download_datestamp" : + $text .= ($row[$disp]) ? strftime($pref['shortdate'],$row[$disp])." " : " "; + break; + case "download_class" : + case "download_visible" : + $text .= r_userclass_name($row[$disp])." "; + break; + case "download_filesize" : + $text .= ($row[$disp]) ? round(($row[$disp] / 1000))." Kb " : " "; + break; + case "download_thumb" : + $text .= ($row[$disp]) ? "" : ""; + break; + case "download_image" : + $text .= "".$row[$disp]." "; + break; + case "download_description" : + $text .= $tp->toHTML($row[$disp],TRUE)." "; + break; + case "download_active" : + if($row[$disp]== 1) + { + $text .= "\n"; + } + elseif($row[$disp]== 2) + { + $text .= "\n"; + } + else + { + $text .= "\n"; + } + break; + case "download_comment" : + $text .= ($row[$disp]) ? ADMIN_TRUE_ICON : " "; + break; + default : + $text .= $row[$disp]." "; + } + $text .= " + ".ADMIN_EDIT_ICON." + toJS(DOWLAN_33." [ID: ".$row['download_id']." ]")."') \" /> +
"; + } + 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 = " +
+
+ + + + + + + + + + + + + + + + + + + "; + } + else + { + $text .= DOWLAN_132."
+
"; + + $mirrorList = $sql -> db_getList(); // Get the list of possible mirrors + + $m_count = (count($mirrorArray) ? count($mirrorArray) : 1); // Count of mirrors actually in use (or count of 1 if none defined yet) + + for($count = 1; $count <= $m_count; $count++) + { + + $opt = ($count==1) ? "id='mirror'" : ""; + $text .=" + + "; + if (DOWNLOAD_DEBUG) + { + if ($id) + { + $text .= '('.$mirrorArray[($count-1)]['requests'].')'; + } + else + { + $text .= " + "; + } + } + $text .= "
"; + } + + $text .="

+ + + + + + + + "; + } // End of mirror-related stuff + + $text .= " + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + "; + + + $text .= " + + + + + + + + + + + "; + + if ($sub_action == "dlm") { + $text .= " + + + + + + + + + + + + "; + } + + $text .= " + + + +
".DOWLAN_11.""; + + $text .= $tp->parseTemplate("{DOWNLOAD_CATEGORY_SELECT={$download_category}}",true,$download_shortcodes); + + $text .= "
".DOWLAN_12.": + toForm($download_name)."\" maxlength='200' /> +
".DOWLAN_13.":
".DOWLAN_131."   + +
+ ".DOWLAN_149." +
+ URL:  + + +    ".DOWLAN_66." + +
+ +
".DOWLAN_128.":"; + + + // See if any mirrors to display + if(!$sql -> db_Select("download_mirror")) + { // No mirrors defined here + $text .= DOWLAN_144."
".DOWLAN_155." + + ".DOWLAN_156."
+ ".DOWLAN_157." +
".DOWLAN_15.": + +
".DOWLAN_16.": + +
".DOWLAN_17.": + +
".DOWLAN_18.": + +
".DOWLAN_19.": + "; + + if($sub_action == "dlm" && $download_image) + { + $text .= " + \n"; + } + + $text .= " +
".DOWLAN_20.": + +
".LAN_DATESTAMP.": + "; + if(!$download_datestamp){ + $download_datestamp = time(); + } + $cal_options['showsTime'] = false; + $cal_options['showOthers'] = false; + $cal_options['weekNumbers'] = false; + $cal_options['ifFormat'] = "%d/%m/%Y %H:%M:%S"; + $cal_options['timeFormat'] = "24"; + $cal_attrib['class'] = "tbox"; + $cal_attrib['size'] = "12"; + $cal_attrib['name'] = "download_datestamp"; + $cal_attrib['value'] = date("d/m/Y H:i:s", $download_datestamp); + $text .= $cal->make_input_field($cal_options, $cal_attrib); + + $update_checked = ($_POST['update_datestamp']) ? "checked='checked'" : ""; + $text .= "  ".DOWLAN_148." + +
".DOWLAN_21.": + "; + + $text .= "
".DOWLAN_102.":"; + + + if ($download_comment == "0") { + $text .= LAN_YES.": + ".LAN_NO.": "; + } else { + $text .= LAN_YES.": + ".LAN_NO.": "; + } + + $text .= "
".DOWLAN_145.":".r_userclass('download_visible', $download_visible, 'off', 'public, nobody, member, admin, classes, language')."
".DOWLAN_106.":".r_userclass('download_class', $download_class, 'off', 'public, nobody, member, admin, classes, language')."
".DOWLAN_153.":
+ +
".DOWLAN_103.":
+ + +
"; + + + if ($id && $sub_action == "edit") { + $text .= " "; + } else { + $text .= ""; + } + + $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 .= " + + + + + + + + "; + + + //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 .= "
 ".DOWLAN_11."".DOWLAN_52."".LAN_ORDER."".LAN_OPTIONS."
".($parent['download_category_icon'] ? "" : " ")."{$parent['download_category_name']} + + + ".ADMIN_EDIT_ICON." + "; + if(!is_array($cat_array[$parent['download_category_id']])) + { + $text .= "toJS(DOWLAN_34." [ID: {$parent['download_category_id']} ]")."') \"/>"; + } + $text .= " +
".($main['download_category_icon'] ? "" : " ")."{$main['download_category_name']}
{$main['download_category_description']}
{$main['filecount']} + + + ".ADMIN_EDIT_ICON.""; + if(!is_array($cat_array[$main['download_category_id']]) && !$main['filecount']) + { + $text .= "toJS(DOWLAN_34." [ID: {$main['download_category_id']} ]")."') \"/>"; + } + $text .= " +
".($sub['download_category_icon'] ? "" : " ")."    ".DOWLAN_53.": {$sub['download_category_name']}
    {$sub['download_category_description']}
{$sub['filecount']} + + + ".ADMIN_EDIT_ICON." + "; + if(!$sub['filecount']) + { + $text .= "toJS(DOWLAN_34." [ID: {$sub['download_category_id']} ]")."') \"/>"; + } + $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 .= " + + + +
".DOWLAN_37.": "; + + if (!$download_cats = $sql->db_Select("download_category")) { + $text .= " + \n"; + } else { + $text .= " + "; + } + $text .= "
".DOWLAN_12.": + +
".DOWLAN_18.": + +
".DOWLAN_41.": + + +
+ +
".DOWLAN_147.": + + +
+ +
".DOWLAN_43.":
(".DOWLAN_44.")
".r_userclass("download_category_class", $download_category_class, 'off', 'public, nobody, member, admin, classes, language')." + +
"; + if ($id && $sub_action == "edit" && !isset($_POST['add_category'])) { + $text .= " "; + } else { + $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 .= "
ID".DOWLAN_12."".DOWLAN_136."".LAN_OPTIONS."
$mirror_id".$tp -> toHTML($mirror_name)."".($mirror_image ? "" : DOWLAN_28)." + ".ADMIN_EDIT_ICON." + +
"; + + } + + $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 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
".DOWLAN_12." + +
".DOWLAN_139." + +
".DOWLAN_136." + + + +
+ +
".DOWLAN_141." + +
".DOWLAN_18." + +
+ ".($edit ? "" : "")." +
+
+
"; + + $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 + + + + + + + + + + + + + + + + + + + + +