mirror of
https://github.com/e107inc/e107.git
synced 2025-08-04 13:47:31 +02:00
Download plugin cleanup and template upgrade. (Work in progress)
This commit is contained in:
@@ -2047,6 +2047,12 @@ class e107
|
||||
}
|
||||
$reg_path = 'plugin/'.$plug_name.'/templates/'.$id.($override ? '/ext' : '');
|
||||
$path = self::templatePath($plug_name, $id, $override);
|
||||
|
||||
if(ADMIN && E107_DBG_INCLUDES)
|
||||
{
|
||||
e107::getMessage()->addDebug( "template path=".$path );
|
||||
}
|
||||
|
||||
$id = str_replace('/', '_', $id);
|
||||
$ret = self::_getTemplate($id, $key, $reg_path, $path, $info);
|
||||
if(!$merge || !$override || !is_array($ret))
|
||||
@@ -2057,6 +2063,10 @@ class e107
|
||||
// merge
|
||||
$reg_path = 'plugin/'.$plug_name.'/templates/'.$id;
|
||||
$path = self::templatePath($plug_name, $id, false);
|
||||
|
||||
|
||||
|
||||
|
||||
$id = str_replace('/', '_', $id);
|
||||
$ret_plug = self::_getTemplate($id, $key, $reg_path, $path, $info);
|
||||
|
||||
|
@@ -68,8 +68,17 @@ else
|
||||
{ // Get parameters from the query
|
||||
$maincatval = ''; // Show all main categories
|
||||
$tmp = explode(".", e_QUERY);
|
||||
if (is_numeric($tmp[0])) // $tmp[0] at least must be valid
|
||||
{
|
||||
|
||||
$dl->init();
|
||||
|
||||
if(isset($_GET['action'])) // v2.x
|
||||
{
|
||||
$dl->init();
|
||||
$action = $_GET['action'];
|
||||
$id = intval($_GET['id']);
|
||||
}
|
||||
elseif (is_numeric($tmp[0])) //legacy // $tmp[0] at least must be valid
|
||||
{
|
||||
$dl_from = intval($tmp[0]);
|
||||
$action = varset(preg_replace("#\W#", "", $tp->toDB($tmp[1])),'list');
|
||||
$id = intval($tmp[2]);
|
||||
@@ -84,15 +93,25 @@ else
|
||||
$errnum = intval(varset($tmp[2],0));
|
||||
}
|
||||
|
||||
|
||||
|
||||
switch ($action)
|
||||
{
|
||||
case 'list' : // Category-based listing
|
||||
if (isset($_POST['view']))
|
||||
|
||||
|
||||
if (isset($_GET['view']))
|
||||
{
|
||||
$view = intval($_POST['view']);
|
||||
$sort = varset($_POST['sort'],'DESC');
|
||||
$order = varset($_POST['order'],'download_datestamp');
|
||||
// $view = intval($_GET['view']);
|
||||
// $sort = varset($_GET['sort'],'DESC');
|
||||
// $order = varset($_POST['order']) ? 'download_'.$_POST['order'] : 'download_datestamp';
|
||||
|
||||
// $order = preg_replace("#\W#", "", $order);
|
||||
// $sort = preg_replace("#\W#", "", $sort);
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (!isset($dl_from)) $dl_from = 0;
|
||||
|
||||
// Get category type, page title
|
||||
@@ -159,55 +178,51 @@ if (!isset($view)) $view = vartrue($pref['download_view'], '10');
|
||||
switch ($action)
|
||||
{ // Displaying main category or categories
|
||||
case 'maincats' :
|
||||
require_once(HEADERF);
|
||||
// require_once(HEADERF);
|
||||
/*
|
||||
if ($cacheData = $e107cache->retrieve("download_cat".$maincatval,720)) // expires every 12 hours. //TODO make this an option
|
||||
{
|
||||
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
|
||||
$dlcat = new downloadCategory(varset($pref['download_subsub'],1),USERCLASS_LIST,$maincatval,varset($pref['download_incinfo'],FALSE));
|
||||
|
||||
if ($dlcat->down_count == 0)
|
||||
{
|
||||
$ns->tablerender(LAN_dl_18, "<div style='text-align:center'>".LAN_dl_2."</div>");
|
||||
require_once(FOOTERF);
|
||||
exit;
|
||||
}
|
||||
|
||||
$download_cat_table_string = "";
|
||||
foreach($dlcat->cat_tree as $dlrow)
|
||||
{ // Display main category headings, then sub-categories, optionally with sub-sub categories expanded
|
||||
$download_cat_table_string .= $tp->parseTemplate($DOWNLOAD_CAT_PARENT_TABLE, TRUE, vartrue($download_shortcodes));
|
||||
foreach($dlrow['subcats'] as $dlsubrow)
|
||||
{
|
||||
$download_cat_table_string .= $tp->parseTemplate($DOWNLOAD_CAT_CHILD_TABLE, TRUE, $download_shortcodes);
|
||||
foreach($dlsubrow['subsubcats'] as $dlsubsubrow)
|
||||
{
|
||||
$download_cat_table_string .= $tp->parseTemplate($DOWNLOAD_CAT_SUBSUB_TABLE, TRUE, $download_shortcodes);
|
||||
}
|
||||
}
|
||||
}
|
||||
$dl_text = $tp->parseTemplate($DOWNLOAD_CAT_TABLE_START, TRUE, $download_shortcodes);
|
||||
$dl_text .= $download_cat_table_string;
|
||||
$dl_text .= $tp->parseTemplate($DOWNLOAD_CAT_TABLE_END, TRUE, $download_shortcodes);
|
||||
$dlbreadcrumb = $dl->getBreadcrumb(array(LAN_dl_18));
|
||||
$dl_title = $tp->parseTemplate("{BREADCRUMB=dlbreadcrumb}", TRUE, $download_shortcodes);
|
||||
|
||||
ob_start();
|
||||
$ns->tablerender($dl_title, $dl_text);
|
||||
$cache_data = ob_get_flush();
|
||||
$e107cache->set("download_cat".$maincatval, $cache_data);
|
||||
require_once(FOOTERF);
|
||||
exit;
|
||||
{
|
||||
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
|
||||
$dlcat = new downloadCategory(varset($pref['download_subsub'],1),USERCLASS_LIST,$maincatval,varset($pref['download_incinfo'],FALSE));
|
||||
if ($dlcat->down_count == 0)
|
||||
{
|
||||
$ns->tablerender(LAN_dl_18, "<div style='text-align:center'>".LAN_dl_2."</div>");
|
||||
require_once(FOOTERF);
|
||||
exit;
|
||||
}
|
||||
$download_cat_table_string = "";
|
||||
foreach($dlcat->cat_tree as $dlrow)
|
||||
{ // Display main category headings, then sub-categories, optionally with sub-sub categories expanded
|
||||
$download_cat_table_string .= $tp->parseTemplate($DOWNLOAD_CAT_PARENT_TABLE, TRUE, vartrue($download_shortcodes));
|
||||
foreach($dlrow['subcats'] as $dlsubrow)
|
||||
{
|
||||
$download_cat_table_string .= $tp->parseTemplate($DOWNLOAD_CAT_CHILD_TABLE, TRUE, $download_shortcodes);
|
||||
foreach($dlsubrow['subsubcats'] as $dlsubsubrow)
|
||||
{
|
||||
$download_cat_table_string .= $tp->parseTemplate($DOWNLOAD_CAT_SUBSUB_TABLE, TRUE, $download_shortcodes);
|
||||
}
|
||||
}
|
||||
}
|
||||
$dl_text = $tp->parseTemplate($DOWNLOAD_CAT_TABLE_START, TRUE, $download_shortcodes);
|
||||
$dl_text .= $download_cat_table_string;
|
||||
$dl_text .= $tp->parseTemplate($DOWNLOAD_CAT_TABLE_END, TRUE, $download_shortcodes);
|
||||
$dlbreadcrumb = $dl->getBreadcrumb(array(LAN_dl_18));
|
||||
$dl_title = $tp->parseTemplate("{BREADCRUMB=dlbreadcrumb}", TRUE, $download_shortcodes);
|
||||
ob_start();
|
||||
$ns->tablerender($dl_title, $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)
|
||||
|
||||
@@ -235,119 +250,196 @@ if (isset($_POST['commentsubmit']))
|
||||
}
|
||||
}
|
||||
|
||||
//====================================================
|
||||
// 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}' "))
|
||||
require_once (HEADERF);
|
||||
|
||||
|
||||
if($action == 'maincats')
|
||||
{
|
||||
/* 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();
|
||||
$dl->renderCategories();
|
||||
}
|
||||
|
||||
if($action == 'list')
|
||||
{
|
||||
$dl->renderList();
|
||||
}
|
||||
|
||||
if($action == 'view')
|
||||
{
|
||||
$dl->renderView();
|
||||
}
|
||||
|
||||
if ($action == "report" && check_class($pref['download_reportbroken']))
|
||||
{
|
||||
$dl->renderReport();
|
||||
}
|
||||
|
||||
require_once (FOOTERF);
|
||||
exit ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//====================================================
|
||||
//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);
|
||||
echo "WOWO";
|
||||
$dl->list();
|
||||
|
||||
/* 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");
|
||||
}
|
||||
|
||||
$download_cat_table_string = "";
|
||||
$dl_text = $tp->parseTemplate($DOWNLOAD_CAT_TABLE_PRE, TRUE, $download_shortcodes);
|
||||
$dl_text .= $tp->parseTemplate($DOWNLOAD_CAT_TABLE_START, TRUE, $download_shortcodes);
|
||||
|
||||
foreach($scArray as $dlsubsubrow)
|
||||
{
|
||||
$dl_text .= $tp->parseTemplate($DOWNLOAD_CAT_SUBSUB_TABLE, TRUE, $download_shortcodes);
|
||||
}
|
||||
|
||||
$dl_text .= $tp->parseTemplate($DOWNLOAD_CAT_TABLE_END, TRUE, $download_shortcodes);
|
||||
|
||||
$dlbreadcrumb = $dl->getBreadcrumb(array(LAN_dl_18 => e_SELF,$type));
|
||||
$dl_title = $tp->parseTemplate("{BREADCRUMB=dlbreadcrumb}", TRUE, $download_shortcodes);
|
||||
|
||||
$ns->tablerender($dl_title, $dl_text);
|
||||
$text = "";
|
||||
// If other files, show in a separate block
|
||||
$dl_title = "";
|
||||
// Cancel title once displayed
|
||||
}// End of subcategory display
|
||||
|
||||
// Now display individual downloads
|
||||
if(!check_class($download_category_class))
|
||||
{
|
||||
$ns->tablerender(LAN_dl_18, "
|
||||
<div style='text-align:center'>
|
||||
" . LAN_dl_3 . "
|
||||
</div>");
|
||||
require_once (FOOTERF);
|
||||
exit ;
|
||||
}
|
||||
if($total_downloads < $view)
|
||||
{
|
||||
$dl_from = 0;
|
||||
}
|
||||
|
||||
$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");}
|
||||
if(!isset($DOWNLOAD_LIST_TABLE))
|
||||
eval($template_load_core);
|
||||
if(!defined("DL_IMAGESTYLE"))
|
||||
{
|
||||
define("DL_IMAGESTYLE", "border:1px solid blue");
|
||||
}
|
||||
|
||||
$download_cat_table_string = "";
|
||||
$dl_text = $tp->parseTemplate($DOWNLOAD_CAT_TABLE_PRE, TRUE, $download_shortcodes);
|
||||
$dl_text .= $tp->parseTemplate($DOWNLOAD_CAT_TABLE_START, TRUE, $download_shortcodes);
|
||||
foreach($scArray as $dlsubsubrow)
|
||||
{
|
||||
$dl_text .= $tp->parseTemplate($DOWNLOAD_CAT_SUBSUB_TABLE, TRUE, $download_shortcodes);
|
||||
}
|
||||
$dl_text .= $tp->parseTemplate($DOWNLOAD_CAT_TABLE_END, TRUE, $download_shortcodes);
|
||||
$dlbreadcrumb = $dl->getBreadcrumb(array(LAN_dl_18=>e_SELF, $type));
|
||||
$dl_title = $tp->parseTemplate("{BREADCRUMB=dlbreadcrumb}", TRUE, $download_shortcodes);
|
||||
$ns->tablerender($dl_title, $dl_text);
|
||||
$text = ""; // If other files, show in a separate block
|
||||
$dl_title = ""; // Cancel title once displayed
|
||||
} // End of subcategory display
|
||||
require_once (e_HANDLER . "rate_class.php");
|
||||
$dltdownloads = 0;
|
||||
|
||||
// Now display individual downloads
|
||||
if (!check_class($download_category_class))
|
||||
{
|
||||
$ns->tablerender(LAN_dl_18, "<div style='text-align:center'>".LAN_dl_3."</div>");
|
||||
require_once(FOOTERF);
|
||||
exit;
|
||||
}
|
||||
// $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->select("download", "*", "download_category='{$id}' AND download_active > 0 AND download_visible IN (" . USERCLASS_LIST . ") ORDER BY {$order} {$sort} LIMIT {$dl_from}, {$view}");
|
||||
|
||||
if($filetotal)
|
||||
{
|
||||
// Only show list if some files in it
|
||||
$dl_text = $tp->parseTemplate($DOWNLOAD_LIST_TABLE_START, TRUE, $download_shortcodes);
|
||||
|
||||
$dlft = ($filetotal < $view? $filetotal: $view);
|
||||
while($dlrow = $sql->db_Fetch())
|
||||
{
|
||||
$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);
|
||||
$dl_text .= $tp->parseTemplate($template, TRUE, $download_shortcodes);
|
||||
;
|
||||
$dltdownloads += $dlrow['download_requested'];
|
||||
}
|
||||
|
||||
if ($total_downloads < $view) { $dl_from = 0; }
|
||||
$dl_text .= $tp->parseTemplate($DOWNLOAD_LIST_TABLE_END, TRUE, $download_shortcodes);
|
||||
|
||||
$load_template = 'download_template';
|
||||
if (!isset($DOWNLOAD_LIST_TABLE)) eval($template_load_core);
|
||||
if (!defined("DL_IMAGESTYLE")){ define("DL_IMAGESTYLE","border:1px solid blue");}
|
||||
if($sql->db_Select("download_category", "*", "download_category_id='{$download_category_parent}' "))
|
||||
{
|
||||
$parent = $sql->db_Fetch();
|
||||
}
|
||||
$dlbreadcrumb = $dl->getBreadcrumb(array(
|
||||
LAN_dl_18 => e_SELF,
|
||||
$parent['download_category_name'] => e_SELF . "?list." . $parent['download_category_id'],
|
||||
$type
|
||||
));
|
||||
$dl_title .= $tp->parseTemplate("{BREADCRUMB=dlbreadcrumb}", TRUE, $download_shortcodes);
|
||||
$ns->tablerender($dl_title, $dl_text);
|
||||
}
|
||||
|
||||
require_once(e_HANDLER."rate_class.php");
|
||||
$dltdownloads = 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}");
|
||||
if ($filetotal)
|
||||
{ // Only show list if some files in it
|
||||
$dl_text = $tp->parseTemplate($DOWNLOAD_LIST_TABLE_START, TRUE, $download_shortcodes);
|
||||
$dlft = ($filetotal < $view ? $filetotal : $view);
|
||||
while ($dlrow = $sql->db_Fetch())
|
||||
{
|
||||
$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);
|
||||
$dl_text .= $tp->parseTemplate($template,TRUE,$download_shortcodes);;
|
||||
$dltdownloads += $dlrow['download_requested'];
|
||||
}
|
||||
|
||||
$dl_text .= $tp->parseTemplate($DOWNLOAD_LIST_TABLE_END, TRUE, $download_shortcodes);
|
||||
|
||||
if($sql->db_Select("download_category", "*", "download_category_id='{$download_category_parent}' "))
|
||||
{
|
||||
$parent = $sql->db_Fetch();
|
||||
}
|
||||
$dlbreadcrumb = $dl->getBreadcrumb(array(LAN_dl_18=>e_SELF, $parent['download_category_name']=>e_SELF."?list.".$parent['download_category_id'], $type));
|
||||
$dl_title .= $tp->parseTemplate("{BREADCRUMB=dlbreadcrumb}", TRUE, $download_shortcodes);
|
||||
$ns->tablerender($dl_title, $dl_text);
|
||||
}
|
||||
|
||||
if(!isset($DOWNLOAD_LIST_NEXTPREV))
|
||||
{
|
||||
$sc_style['DOWNLOAD_LIST_NEXTPREV']['pre'] = "<div class='nextprev'>";
|
||||
$sc_style['DOWNLOAD_LIST_NEXTPREV']['post'] = "</div>";
|
||||
|
||||
$DOWNLOAD_LIST_NEXTPREV = "
|
||||
<div style='text-align:center;margin-left:auto;margin-right:auto'>{DOWNLOAD_BACK_TO_CATEGORY_LIST}<br /><br />
|
||||
{DOWNLOAD_LIST_NEXTPREV}
|
||||
if(!isset($DOWNLOAD_LIST_NEXTPREV))
|
||||
{
|
||||
$sc_style['DOWNLOAD_LIST_NEXTPREV']['pre'] = "
|
||||
<div class='nextprev'>
|
||||
";
|
||||
$sc_style['DOWNLOAD_LIST_NEXTPREV']['post'] = "
|
||||
</div>";
|
||||
}
|
||||
|
||||
$DOWNLOAD_LIST_NEXTPREV = "
|
||||
<div style='text-align:center;margin-left:auto;margin-right:auto'>
|
||||
{DOWNLOAD_BACK_TO_CATEGORY_LIST}
|
||||
<br />
|
||||
<br />
|
||||
{DOWNLOAD_LIST_NEXTPREV}
|
||||
</div>";
|
||||
}
|
||||
|
||||
$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"
|
||||
$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;
|
||||
@@ -419,7 +511,7 @@ if ($action == "view")
|
||||
|
||||
require_once(FOOTERF);
|
||||
exit;
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
//====================================================
|
||||
@@ -427,6 +519,7 @@ if ($action == "view")
|
||||
//====================================================
|
||||
if ($action == "report" && check_class($pref['download_reportbroken']))
|
||||
{
|
||||
/*
|
||||
$query = "
|
||||
SELECT d.*, dc.* FROM #download AS d
|
||||
LEFT JOIN #download_category AS dc ON d.download_category = dc.download_category_id
|
||||
@@ -499,7 +592,8 @@ if ($action == "report" && check_class($pref['download_reportbroken']))
|
||||
$dlbreadcrumb = $dl->getBreadcrumb(array(LAN_dl_18=>e_SELF, $dlrow['download_category_name']=>e_SELF."?list.".$dlrow['download_category_id'], $dlrow['download_name']=>e_SELF."?view.".$dlrow['download_id'], LAN_dl_50));
|
||||
$dl_title .= $tp->parseTemplate("{BREADCRUMB=dlbreadcrumb}", TRUE, $download_shortcodes);
|
||||
$ns->tablerender($dl_title, $text);
|
||||
}
|
||||
}*/
|
||||
|
||||
require_once(FOOTERF);
|
||||
exit;
|
||||
}
|
||||
|
@@ -16,25 +16,46 @@
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
require_once(e_HANDLER.'shortcode_handler.php');
|
||||
register_shortcode('download_shortcodes', true);
|
||||
initShortcodeClass('download_shortcodes');
|
||||
//register_shortcode('download_shortcodes', true);
|
||||
//initShortcodeClass('download_shortcodes');
|
||||
|
||||
/**
|
||||
* download_shortcodes
|
||||
*/
|
||||
class download_shortcodes
|
||||
class download_shortcodes extends e_shortcode
|
||||
{
|
||||
var $e107;
|
||||
var $postInfo;
|
||||
var $qry;
|
||||
|
||||
/**
|
||||
* download_shortcodes constructor
|
||||
*/
|
||||
function download_shortcodes()
|
||||
function __construct()
|
||||
{
|
||||
$this->e107 = e107::getInstance();
|
||||
$this->postInfo = array();
|
||||
}
|
||||
|
||||
function sc_download_breadcrumb($parm='')
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
$frm = e107::getForm();
|
||||
|
||||
$frm->select();
|
||||
|
||||
global $dlrow;
|
||||
|
||||
$breadcrumb = array();
|
||||
$breadcrumb[] = array('text' => LAN_dl_18, 'url' => e_SELF);
|
||||
$breadcrumb[] = array('text' => $dlrow['download_category_name'], 'url' => e_SELF."?action=list&id=".$dlrow['download_category_id']);
|
||||
$breadcrumb[] = array('text' => $dlrow['download_name'], 'url' => null);
|
||||
|
||||
return $frm->breadcrumb($breadcrumb);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Category ************************************************************************************
|
||||
function sc_download_cat_main_name() {
|
||||
global $tp, $dlrow;
|
||||
@@ -54,7 +75,7 @@ class download_shortcodes
|
||||
global $tp, $dlsubrow;
|
||||
if ($dlsubrow['d_count'])
|
||||
{
|
||||
return "<a href='".e_PLUGIN."download/download.php?list.".$dlsubrow['download_category_id']."'>".$tp->toHTML($dlsubrow['download_category_name'], FALSE, 'TITLE')."</a>";
|
||||
return "<a href='".e_PLUGIN."download/download.php?action=list&id=".$dlsubrow['download_category_id']."'>".$tp->toHTML($dlsubrow['download_category_name'], FALSE, 'TITLE')."</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -85,39 +106,105 @@ class download_shortcodes
|
||||
global $dlsubrow;
|
||||
return intval($dlsubrow['d_requests']);
|
||||
}
|
||||
|
||||
|
||||
// Sub-Sub-Category ****************************************************************************
|
||||
|
||||
|
||||
function sc_download_cat_subsub_name() {
|
||||
global $tp, $dlsubsubrow;
|
||||
if ($dlsubsubrow['d_count'])
|
||||
{
|
||||
return "<a href='".e_PLUGIN."download/download.php?list.".$dlsubsubrow['download_category_id']."'>".$tp->toHTML($dlsubsubrow['download_category_name'], FALSE, 'TITLE')."</a>";
|
||||
return "<a href='".e_PLUGIN."download/download.php?action=list&id=".$dlsubsubrow['download_category_id']."'>".$tp->toHTML($dlsubsubrow['download_category_name'], FALSE, 'TITLE')."</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
return $tp->toHTML($dlsubsubrow['download_category_name'], FALSE, 'TITLE');
|
||||
}
|
||||
}
|
||||
|
||||
function sc_download_cat_subsub_description() {
|
||||
global $tp, $dlsubsubrow;
|
||||
return $tp->toHTML($dlsubsubrow['download_category_description'], TRUE, 'DESCRIPTION');
|
||||
}
|
||||
|
||||
function sc_download_cat_subsub_icon() {
|
||||
global $dlsubsubrow;
|
||||
return $this->_sc_cat_icons($dlsubsubrow['download_category_icon'], $dlsubsubrow['d_count'], $dlsubsubrow['download_category_name']);
|
||||
}
|
||||
|
||||
function sc_download_cat_subsub_count() {
|
||||
global $dlsubsubrow;
|
||||
return $dlsubsubrow['d_count'];
|
||||
}
|
||||
|
||||
function sc_download_cat_subsub_size() {
|
||||
global $e107, $dlsubsubrow;
|
||||
return $this->e107->parseMemorySize($dlsubsubrow['d_size']);
|
||||
}
|
||||
|
||||
function sc_download_cat_subsub_downloaded() {
|
||||
global $dlsubsubrow;
|
||||
return intval($dlsubsubrow['d_requests']);
|
||||
}
|
||||
|
||||
|
||||
// List ****************************************************************************************
|
||||
|
||||
|
||||
function sc_download_list_caption($parm='')
|
||||
{
|
||||
|
||||
$qry = $this->qry;
|
||||
|
||||
$qry['sort'] = ($qry['sort'] == 'asc') ? 'desc' : 'asc'; // reverse.
|
||||
|
||||
switch ($parm)
|
||||
{
|
||||
case 'name':
|
||||
$qry['order'] = 'name';
|
||||
$text = LAN_dl_28;
|
||||
break;
|
||||
|
||||
case 'datestamp':
|
||||
$qry['order'] = 'datestamp';
|
||||
$text = LAN_dl_22;
|
||||
break;
|
||||
|
||||
case 'author':
|
||||
$qry['order'] = 'author';
|
||||
$text = LAN_dl_24;
|
||||
break;
|
||||
|
||||
case 'filesize':
|
||||
$qry['order'] = 'filesize';
|
||||
$text = LAN_dl_21;
|
||||
break;
|
||||
|
||||
case 'requested':
|
||||
$qry['order'] = 'requested';
|
||||
$text = LAN_dl_29;
|
||||
break;
|
||||
|
||||
case 'rating':
|
||||
$text = LAN_dl_12;
|
||||
break;
|
||||
|
||||
case 'link':
|
||||
$text = LAN_dl_8;
|
||||
break;
|
||||
|
||||
default:
|
||||
$text = "Missing LAN Column"; // debug.
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return "<a href='".e_REQUEST_SELF."?".http_build_query($qry)."'>".$text."</a>" ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function sc_download_list_name()
|
||||
{
|
||||
global $dlrow,$tp,$pref,$parm;
|
||||
@@ -134,23 +221,27 @@ class download_shortcodes
|
||||
$text .= $tp->toHTML($dlrow['download_name'], FALSE, 'TITLE')."</a>";
|
||||
return $text;
|
||||
}
|
||||
return "<a href='".e_PLUGIN."download/download.php?view.".$dlrow['download_id']."'>".$tp->toHTML($dlrow['download_name'],TRUE,'LINKTEXT')."</a>";
|
||||
return "<a href='".e_PLUGIN."download/download.php?action=view&id=".$dlrow['download_id']."'>".$tp->toHTML($dlrow['download_name'],TRUE,'LINKTEXT')."</a>";
|
||||
}
|
||||
|
||||
function sc_download_list_author()
|
||||
{
|
||||
global $dlrow;
|
||||
return $dlrow['download_author'];
|
||||
}
|
||||
|
||||
function sc_download_list_requested()
|
||||
{
|
||||
global $dlrow;
|
||||
return $dlrow['download_requested'];
|
||||
}
|
||||
|
||||
function sc_download_list_newicon()
|
||||
{
|
||||
global $dlrow;
|
||||
return (USER && $dlrow['download_datestamp'] > USERLV ? "<img src='".IMAGE_NEW."' alt='*' style='vertical-align:middle' />" : "");
|
||||
}
|
||||
|
||||
function sc_download_list_recenticon()
|
||||
{
|
||||
global $dlrow, $pref;
|
||||
@@ -167,8 +258,8 @@ class download_shortcodes
|
||||
function sc_download_list_datestamp()
|
||||
{
|
||||
global $dlrow;
|
||||
$gen = new convert;
|
||||
return $gen->convert_date($dlrow['download_datestamp'], "short");
|
||||
$tp = e107::getParser();
|
||||
return $tp->toDate($dlrow['download_datestamp'], "short");
|
||||
}
|
||||
|
||||
function sc_download_list_thumb()
|
||||
@@ -178,7 +269,7 @@ class download_shortcodes
|
||||
|
||||
$img = ($dlrow['download_thumb']) ? "<img src='".$tp->replaceConstants($dlrow['download_thumb'])."' alt='*' style='".DL_IMAGESTYLE."' />" : "";
|
||||
if ($parm == "link" && $dlrow['download_thumb']){
|
||||
return "<a href='".e_PLUGIN."download/download.php?view.".$dlrow['download_id']."'>".$img."</a>";
|
||||
return "<a href='".e_PLUGIN."download/download.php?action=view&id=".$dlrow['download_id']."'>".$img."</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -209,6 +300,7 @@ class download_shortcodes
|
||||
return ($ratearray[2] ? "{$ratearray[1]}.{$ratearray[2]}/{$ratearray[0]}" : "{$ratearray[1]}/{$ratearray[0]}");
|
||||
}
|
||||
}
|
||||
|
||||
function sc_download_list_link()
|
||||
{
|
||||
global $tp, $dlrow, $pref, $parm;
|
||||
@@ -230,7 +322,7 @@ class download_shortcodes
|
||||
{
|
||||
global $dlrow,$parm;
|
||||
if ($parm == "link"){
|
||||
return "<a href='".e_PLUGIN."download/download.php?view.".$dlrow['download_id']."' >".$img."</a>";
|
||||
return "<a href='".e_PLUGIN."download/download.php?action=view&id=".$dlrow['download_id']."' >".$img."</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -248,7 +340,7 @@ class download_shortcodes
|
||||
|
||||
if($parm == "link" && $dlrow['download_image'])
|
||||
{
|
||||
return "<a href='".e_BASE."download.php?view.".$dlrow['download_id']."'>".$img."</a>";
|
||||
return "<a href='".e_BASE."download.php?action=view&id=".$dlrow['download_id']."'>".$img."</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -262,21 +354,23 @@ class download_shortcodes
|
||||
global $nextprev_parms,$tp;
|
||||
return $tp->parseTemplate("{NEXTPREV={$nextprev_parms}}");
|
||||
}
|
||||
|
||||
function sc_download_list_total_amount() {
|
||||
global $dltdownloads;
|
||||
return $dltdownloads." ".LAN_dl_16;
|
||||
return intval($dltdownloads)." ".LAN_dl_16;
|
||||
}
|
||||
|
||||
function sc_download_list_total_files() {
|
||||
global $dlft;
|
||||
return $dlft." ".LAN_dl_17;
|
||||
return intval($dlft)." ".LAN_dl_17;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// View ****************************************************************************************
|
||||
|
||||
|
||||
function sc_download_view_id()
|
||||
{
|
||||
global $dlrow;
|
||||
@@ -305,7 +399,7 @@ class download_shortcodes
|
||||
function sc_download_view_name()
|
||||
{
|
||||
global $dlrow,$parm;
|
||||
$link['view'] = "<a href='".e_PLUGIN."download/download.php?view.".$dlrow['download_id']."'>".$dlrow['download_name']."</a>";
|
||||
$link['view'] = "<a href='".e_PLUGIN."download/download.php?action=view&id=".$dlrow['download_id']."'>".$dlrow['download_name']."</a>";
|
||||
$link['request'] = "<a href='".e_BASE."request.php?".$dlrow['download_id']."' title='".LAN_dl_46."'>".$dlrow['download_name']."</a>";
|
||||
if ($parm){
|
||||
return $link[$parm];
|
||||
@@ -351,7 +445,8 @@ class download_shortcodes
|
||||
function sc_download_view_date()
|
||||
{
|
||||
global $gen,$dlrow,$parm;
|
||||
return ($dlrow['download_datestamp']) ? $gen->convert_date($dlrow['download_datestamp'], $parm) : "";
|
||||
$tp = e107::getParser();
|
||||
return ($dlrow['download_datestamp']) ? $tp->toDate($dlrow['download_datestamp'], $parm) : "";
|
||||
}
|
||||
function sc_download_view_date_short()
|
||||
{
|
||||
@@ -460,8 +555,9 @@ class download_shortcodes
|
||||
function sc_download_report_link()
|
||||
{
|
||||
global $dlrow,$pref;
|
||||
return (check_class($pref['download_reportbroken'])) ? "<a href='".e_PLUGIN."download/download.php?report.".$dlrow['download_id']."'>".LAN_dl_45."</a>" : "";
|
||||
return (check_class($pref['download_reportbroken'])) ? "<a href='".e_PLUGIN."download/download.php?action=report&id=".$dlrow['download_id']."'>".LAN_dl_45."</a>" : "";
|
||||
}
|
||||
|
||||
function sc_download_view_caption()
|
||||
{
|
||||
global $dlrow;
|
||||
@@ -469,113 +565,151 @@ class download_shortcodes
|
||||
$text .= ($dlrow['download_category_description']) ? " [ ".$dlrow['download_category_description']." ]" : "";
|
||||
return $text;
|
||||
}
|
||||
|
||||
|
||||
// Mirror **************************************************************************************
|
||||
function sc_download_mirror_request() {
|
||||
|
||||
function sc_download_mirror_request()
|
||||
{
|
||||
global $dlrow;
|
||||
return $dlrow['download_name'];
|
||||
}
|
||||
function sc_download_mirror_request_icon() {
|
||||
|
||||
function sc_download_mirror_request_icon()
|
||||
{
|
||||
global $dlrow;
|
||||
$tp = e107::getParser();
|
||||
return ($dlrow['download_thumb'] ? "<img src='".$tp->replaceConstants($dlrow['download_thumb'])."' alt='*'/>" : "");
|
||||
}
|
||||
function sc_download_mirror_name() {
|
||||
|
||||
function sc_download_mirror_name()
|
||||
{
|
||||
global $dlmirror;
|
||||
return "<a href='{$dlmirror['mirror_url']}' rel='external'>".$dlmirror['mirror_name']."</a>";
|
||||
}
|
||||
function sc_download_mirror_image() {
|
||||
|
||||
function sc_download_mirror_image()
|
||||
{
|
||||
global $dlrow, $dlmirror;
|
||||
$tp = e107::getParser();
|
||||
return ($dlmirror['mirror_image'] ? "<a href='{$dlmirror['mirror_url']}' rel='external'><img src='".$tp->replaceConstants($dlmirror['mirror_image'])."' alt='*'/></a>" : "");
|
||||
}
|
||||
|
||||
function sc_download_mirror_location() {
|
||||
global $dlmirror;
|
||||
return ($dlmirror['mirror_location'] ? $dlmirror['mirror_location'] : "");
|
||||
}
|
||||
function sc_download_mirror_description() {
|
||||
|
||||
function sc_download_mirror_description()
|
||||
{
|
||||
global $dlmirror,$tp;
|
||||
return ($dlmirror['mirror_description'] ? $tp->toHTML($dlmirror['mirror_description'], TRUE) : "");
|
||||
}
|
||||
function sc_download_mirror_filesize() {
|
||||
|
||||
function sc_download_mirror_filesize()
|
||||
{
|
||||
global $e107, $dlmirrorfile;
|
||||
return $e107->parseMemorySize($dlmirrorfile[3]);
|
||||
}
|
||||
function sc_download_mirror_link() {
|
||||
|
||||
function sc_download_mirror_link()
|
||||
{
|
||||
global $dlrow, $dlmirrorfile, $tp, $pref;
|
||||
$click = " onclick='return confirm(\"".$tp->toJS($tp->toHTML($pref['agree_text'],FALSE,'DESCRIPTION'))."\")'";
|
||||
return "<a href='".e_PLUGIN."download/download.php?mirror.{$dlrow['download_id']}.{$dlmirrorfile[0]}' title='".LAN_dl_32."'{$click}>
|
||||
<img src='".IMAGE_DOWNLOAD."' alt='*' title='".LAN_dl_32."' /></a>";
|
||||
}
|
||||
function sc_download_mirror_requests() {
|
||||
|
||||
function sc_download_mirror_requests()
|
||||
{
|
||||
global $dlmirrorfile;
|
||||
return (ADMIN ? LAN_dl_73.$dlmirrorfile[2] : "");
|
||||
}
|
||||
function sc_download_total_mirror_requests() {
|
||||
|
||||
function sc_download_total_mirror_requests()
|
||||
{
|
||||
global $dlmirror;
|
||||
return (ADMIN ? LAN_dl_74.$dlmirror['mirror_count'] : "");
|
||||
}
|
||||
|
||||
|
||||
// --------- Download View Lans -----------------------------
|
||||
|
||||
function sc_download_view_author_lan()
|
||||
{
|
||||
global $dlrow;
|
||||
return ($dlrow['download_author']) ? LAN_dl_24 : "";
|
||||
}
|
||||
|
||||
function sc_download_view_authoremail_lan()
|
||||
{
|
||||
global $dlrow;
|
||||
return ($dlrow['download_author_email']) ? LAN_dl_30 : "";
|
||||
}
|
||||
|
||||
function sc_download_view_authorwebsite_lan()
|
||||
{
|
||||
global $dlrow;
|
||||
return ($dlrow['download_author_website']) ? LAN_dl_31 : "";
|
||||
}
|
||||
|
||||
function sc_download_view_date_lan()
|
||||
{
|
||||
global $dlrow;
|
||||
return ($dlrow['download_datestamp']) ? LAN_dl_22 : "";
|
||||
}
|
||||
|
||||
function sc_download_view_image_lan()
|
||||
{
|
||||
return LAN_dl_11;
|
||||
}
|
||||
|
||||
function sc_download_view_requested()
|
||||
{
|
||||
global $dlrow;
|
||||
return $dlrow['download_requested'];
|
||||
}
|
||||
|
||||
function sc_download_view_rating_lan()
|
||||
{
|
||||
return LAN_dl_12;
|
||||
}
|
||||
|
||||
function sc_download_view_filesize_lan()
|
||||
{
|
||||
return LAN_dl_10;
|
||||
}
|
||||
|
||||
function sc_download_view_description_lan()
|
||||
{
|
||||
return LAN_dl_7;
|
||||
}
|
||||
|
||||
function sc_download_view_requested_lan()
|
||||
{
|
||||
return LAN_dl_77;
|
||||
}
|
||||
|
||||
function sc_download_view_link_lan()
|
||||
{
|
||||
return LAN_dl_32;
|
||||
}
|
||||
|
||||
|
||||
// ----------- Download View : Previous and Next ---------------
|
||||
|
||||
function sc_download_view_prev()
|
||||
{
|
||||
global $dlrow,$sql;
|
||||
$dlrow_id = intval($dlrow['download_id']);
|
||||
if ($sql->db_Select("download", "*", "download_category='".intval($dlrow['download_category_id'])."' AND download_id < {$dlrow_id} AND download_active > 0 && download_visible IN (".USERCLASS_LIST.") ORDER BY download_datestamp DESC LIMIT 1")) {
|
||||
$dlrowrow = $sql->db_Fetch();
|
||||
return "<a href='".e_PLUGIN."download/download.php?view.".$dlrowrow['download_id']."'><< ".LAN_dl_33." [".$dlrowrow['download_name']."]</a>\n";
|
||||
return "<a href='".e_PLUGIN."download/download.php?action=view&id=".$dlrowrow['download_id']."'><< ".LAN_dl_33." [".$dlrowrow['download_name']."]</a>\n";
|
||||
} else {
|
||||
return " ";
|
||||
}
|
||||
}
|
||||
|
||||
function sc_download_view_next()
|
||||
{
|
||||
global $dlrow,$sql;
|
||||
@@ -583,25 +717,30 @@ class download_shortcodes
|
||||
if ($sql->db_Select("download", "*", "download_category='".intval($dlrow['download_category_id'])."' AND download_id > {$dlrow_id} AND download_active > 0 && download_visible IN (".USERCLASS_LIST.") ORDER BY download_datestamp ASC LIMIT 1")) {
|
||||
$dlrowrow = $sql->db_Fetch();
|
||||
extract($dlrowrow);
|
||||
return "<a href='".e_PLUGIN."download/download.php?view.".$dlrowrow['download_id']."'>[".$dlrowrow['download_name']."] ".LAN_dl_34." >></a>\n";
|
||||
return "<a href='".e_PLUGIN."download/download.php?action=view&id=".$dlrowrow['download_id']."'>[".$dlrowrow['download_name']."] ".LAN_dl_34." >></a>\n";
|
||||
} else {
|
||||
return " ";
|
||||
}
|
||||
}
|
||||
|
||||
function sc_download_back_to_list()
|
||||
{
|
||||
global $dlrow;
|
||||
return "<a href='".e_PLUGIN."download/download.php?list.".$dlrow['download_category']."'>".LAN_dl_35."</a>";
|
||||
return "<a class='btn' href='".e_PLUGIN."download/download.php?action=list&id=".$dlrow['download_category']."'>".LAN_dl_35."</a>";
|
||||
}
|
||||
|
||||
function sc_download_back_to_category_list()
|
||||
{
|
||||
return "<a href='".e_SELF."'>".LAN_dl_9."</a>";
|
||||
return "<a class='btn btn-default' href='".e_SELF."'>".LAN_dl_9."</a>";
|
||||
}
|
||||
|
||||
|
||||
// Misc stuff ---------------------------------------------------------------------------------
|
||||
function sc_download_cat_newdownload_text()
|
||||
{
|
||||
return "<img src='".IMAGE_NEW."' alt='*' style='vertical-align:middle' /> ".LAN_dl_36;
|
||||
}
|
||||
|
||||
function sc_download_cat_search()
|
||||
{
|
||||
return "<form class='form-search' method='get' action='".e_BASE."search.php'>
|
||||
@@ -612,6 +751,9 @@ class download_shortcodes
|
||||
</p>
|
||||
</form>";
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
@@ -622,6 +764,8 @@ class download_shortcodes
|
||||
if (!$ret[FALSE]) $ret[FALSE] = $ret[TRUE];
|
||||
return "<img src='".e_IMAGE."icons/{$ret[($count!=0)]}' alt='*'/>";
|
||||
}
|
||||
|
||||
|
||||
function _check_new_download($last_val)
|
||||
{
|
||||
if (USER && ($last_val > USERLV))
|
||||
|
@@ -2,35 +2,623 @@
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
||||
* Copyright (C) 2008-2013 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/download/handlers/download_class.php,v $
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
if (!e107::isInstalled('download')) { exit(); }
|
||||
|
||||
class download
|
||||
{
|
||||
var $e107;
|
||||
function download()
|
||||
{
|
||||
$this->e107 = e107::getInstance();
|
||||
}
|
||||
function displayCategoryList() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var $e107;
|
||||
|
||||
private $qry = array();
|
||||
|
||||
private $orderOptions = array('download_id','download_datestamp','download_filesize','download_name','download_author','download_requested');
|
||||
|
||||
function __construct()
|
||||
{
|
||||
$this->e107 = e107::getInstance();
|
||||
|
||||
|
||||
require_once(e_PLUGIN."download/download_shortcodes.php");
|
||||
}
|
||||
|
||||
public function init()
|
||||
{
|
||||
|
||||
$tp = e107::getParser();
|
||||
|
||||
$tmp = explode('.', e_QUERY);
|
||||
|
||||
$pref = e107::getPref();
|
||||
|
||||
// Set Defaults
|
||||
$this->qry['order'] = vartrue($pref['download_order'],'download_datestamp');
|
||||
$this->qry['sort'] = vartrue($pref['download_sort'], 'desc');
|
||||
$this->qry['view'] = vartrue($pref['download_view'], 10);
|
||||
|
||||
|
||||
// v1.x
|
||||
if (is_numeric($tmp[0])) //legacy // $tmp[0] at least must be valid
|
||||
{
|
||||
$dl_from = intval($tmp[0]);
|
||||
$this->qry['action'] = varset(preg_replace("#\W#", "", $tp->toDB($tmp[1])),'list');
|
||||
$this->qry['id'] = intval($tmp[2]);
|
||||
$this->qry['view'] = intval($tmp[3]);
|
||||
$this->qry['order'] = preg_replace("#\W#", "", $tp->toDB($tmp[4]));
|
||||
$this->qry['sort'] = preg_replace("#\W#", "", $tp->toDB($tmp[5]));
|
||||
}
|
||||
elseif($tmp[1])
|
||||
{
|
||||
$this->qry['action'] = preg_replace("#\W#", "", $tp->toDB($tmp[0]));
|
||||
$this->qry['id'] = intval($tmp[1]);
|
||||
// $errnum = intval(varset($tmp[2],0));
|
||||
}
|
||||
|
||||
|
||||
// v2.x
|
||||
if(varset($_GET['action']))
|
||||
{
|
||||
$this->qry['action'] = (string) $_GET['action'];
|
||||
$this->qry['view'] = varset($_GET['view']) ? intval($_GET['view']) : 10;
|
||||
$this->qry['id'] = intval($_GET['id']);
|
||||
$this->qry['order'] = vartrue($_GET['order']) && in_array("download_".$_GET['order'],$this->orderOptions) ? $_GET['order'] : 'datestamp';
|
||||
$this->qry['sort'] = (varset($_GET['sort']) == 'asc') ? "asc" : 'desc';
|
||||
}
|
||||
|
||||
// v1.x
|
||||
if(varset($_POST['view']))
|
||||
{
|
||||
$this->qry['view'] = varset($_POST['view']) ? intval($_POST['view']) : 10;
|
||||
$this->qry['order'] = varset($_POST['order']) && in_array("download_".$_POST['order'],$this->orderOptions) ? $_POST['order'] : 'datestamp';
|
||||
$this->qry['sort'] = (strtolower($_POST['sort']) == 'asc') ? "asc" : 'desc';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function renderCategories()
|
||||
{
|
||||
|
||||
$tp = e107::getParser();
|
||||
$ns = e107::getRender();
|
||||
|
||||
|
||||
// if ($cacheData = $e107cache->retrieve("download_cat".$maincatval,720)) // expires every 12 hours. //TODO make this an option
|
||||
{
|
||||
// echo $cacheData;
|
||||
// return;
|
||||
}
|
||||
|
||||
|
||||
if(deftrue('BOOTSTRAP')) // v2.x
|
||||
{
|
||||
$template = e107::getTemplate('download','download','categories');
|
||||
|
||||
$DOWNLOAD_CAT_TABLE_START = varset($template['start']);
|
||||
$DOWNLOAD_CAT_PARENT_TABLE = $template['parent'];
|
||||
$DOWNLOAD_CAT_CHILD_TABLE = $template['child'];
|
||||
$DOWNLOAD_CAT_SUBSUB_TABLE = $template['subchild'];
|
||||
$DOWNLOAD_CAT_TABLE_END = varset($template['end']);
|
||||
|
||||
// $DL_VIEW_NEXTPREV = varset($template['nextprev']);
|
||||
// $DL_VIEW_PAGETITLE = varset($template['pagetitle']);
|
||||
// $DL_VIEW_CAPTION = varset($template['caption'],"{DOWNLOAD_VIEW_CAPTION}");
|
||||
}
|
||||
else // Legacy v1.x
|
||||
{
|
||||
$template_name = 'download_template.php';
|
||||
|
||||
if (is_readable(THEME."templates/".$template_name))
|
||||
{
|
||||
require_once(THEME."templates/".$template_name);
|
||||
}
|
||||
elseif (is_readable(THEME.$template_name))
|
||||
{
|
||||
require_once(THEME.$template_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once(e_PLUGIN."download/templates/".$template_name);
|
||||
}
|
||||
}
|
||||
|
||||
$download_shortcodes = new download_shortcodes;
|
||||
$download_shortcodes->qry = $this->qry;
|
||||
|
||||
|
||||
|
||||
if(!defined("DL_IMAGESTYLE")){ define("DL_IMAGESTYLE","border:1px solid blue");}
|
||||
|
||||
// Read in tree of categories which this user is allowed to see
|
||||
$dlcat = new downloadCategory(varset($pref['download_subsub'],1),USERCLASS_LIST,$maincatval,varset($pref['download_incinfo'],FALSE));
|
||||
|
||||
if ($dlcat->down_count == 0)
|
||||
{
|
||||
$ns->tablerender(LAN_dl_18, "<div style='text-align:center'>".LAN_dl_2."</div>");
|
||||
return;
|
||||
// require_once(FOOTERF);
|
||||
// exit;
|
||||
}
|
||||
|
||||
global $dlrow, $dlsubrow;
|
||||
|
||||
$download_cat_table_string = "";
|
||||
foreach($dlcat->cat_tree as $dlrow) // Display main category headings, then sub-categories, optionally with sub-sub categories expanded
|
||||
{
|
||||
$download_cat_table_string .= $tp->parseTemplate($DOWNLOAD_CAT_PARENT_TABLE, TRUE, vartrue($download_shortcodes));
|
||||
|
||||
foreach($dlrow['subcats'] as $dlsubrow)
|
||||
{
|
||||
$download_cat_table_string .= $tp->parseTemplate($DOWNLOAD_CAT_CHILD_TABLE, TRUE, $download_shortcodes);
|
||||
|
||||
foreach($dlsubrow['subsubcats'] as $dlsubsubrow)
|
||||
{
|
||||
$download_cat_table_string .= $tp->parseTemplate($DOWNLOAD_CAT_SUBSUB_TABLE, TRUE, $download_shortcodes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$dl_text = $tp->parseTemplate($DOWNLOAD_CAT_TABLE_START, TRUE, $download_shortcodes);
|
||||
$dl_text .= $download_cat_table_string;
|
||||
$dl_text .= $tp->parseTemplate($DOWNLOAD_CAT_TABLE_END, TRUE, $download_shortcodes);
|
||||
|
||||
$caption = varset($DOWNLOAD_CAT_CAPTION) ? $tp->parseTemplate($DOWNLOAD_CAT_CAPTION, TRUE, $download_shortcodes) : LAN_dl_18;
|
||||
|
||||
//ob_start();
|
||||
|
||||
$ns->tablerender($caption, $dl_text);
|
||||
|
||||
// $cache_data = ob_get_flush();
|
||||
// $e107cache->set("download_cat".$maincatval, $cache_data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function renderView()
|
||||
{
|
||||
if(deftrue('BOOTSTRAP')) // v2.x
|
||||
{
|
||||
$template = e107::getTemplate('download','download','view');
|
||||
|
||||
$DOWNLOAD_VIEW_TABLE_START = varset($template['start']);
|
||||
$DOWNLOAD_VIEW_TABLE = $template['item'];
|
||||
$DOWNLOAD_VIEW_TABLE_END = varset($template['end']);
|
||||
$DL_VIEW_NEXTPREV = varset($template['nextprev']);
|
||||
$DL_VIEW_PAGETITLE = varset($template['pagetitle']);
|
||||
$DL_VIEW_CAPTION = varset($template['caption'],"{DOWNLOAD_VIEW_CAPTION}");
|
||||
}
|
||||
else // Legacy v1.x
|
||||
{
|
||||
$template_name = 'download_template.php';
|
||||
|
||||
if (is_readable(THEME."templates/".$template_name))
|
||||
{
|
||||
require_once(THEME."templates/".$template_name);
|
||||
}
|
||||
elseif (is_readable(THEME.$template_name))
|
||||
{
|
||||
require_once(THEME.$template_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once(e_PLUGIN."download/templates/".$template_name);
|
||||
}
|
||||
}
|
||||
|
||||
$sql = e107::getDb();
|
||||
$tp = e107::getParser();
|
||||
$ns = e107::getRender();
|
||||
|
||||
$gen = new convert;
|
||||
|
||||
$download_shortcodes = new download_shortcodes;
|
||||
$download_shortcodes->qry = $this->qry;
|
||||
|
||||
$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 = {$this->qry['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->gen($query))
|
||||
{
|
||||
//require_once(HEADERF);
|
||||
$ns->tablerender(LAN_dl_18, "<div style='text-align:center'>".LAN_dl_3."</div>");
|
||||
return;
|
||||
//require_once(FOOTERF);
|
||||
//exit;
|
||||
}
|
||||
|
||||
global $dlrow;
|
||||
|
||||
$dlrow = $sql->fetch();
|
||||
|
||||
$comment_edit_query = 'comment.download.'.$id;
|
||||
|
||||
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);
|
||||
|
||||
$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_NEXTPREV))
|
||||
{
|
||||
$DL_VIEW_NEXTPREV = "
|
||||
<div style='text-align:center'>
|
||||
<table style='".USER_WIDTH."'>
|
||||
<tr>
|
||||
<td style='width:40%;'>{DOWNLOAD_VIEW_PREV}</td>
|
||||
<td style='width:20%; text-align: center;'>{DOWNLOAD_BACK_TO_LIST}</td>
|
||||
<td style='width:40%; text-align: right;'>{DOWNLOAD_VIEW_NEXT}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
";
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ------- Next/Prev -----------
|
||||
$text .= $tp->parseTemplate($DL_VIEW_NEXTPREV,TRUE, $download_shortcodes);
|
||||
|
||||
$caption = $tp->parseTemplate($DL_VIEW_CAPTION, TRUE, $download_shortcodes);
|
||||
|
||||
$ns->tablerender($caption, $text);
|
||||
|
||||
unset($text);
|
||||
|
||||
if ($dlrow['download_comment'])
|
||||
{
|
||||
e107::getComment()->compose_comment("download", "comment", $id, $width,$dlrow['download_name'], $showrate=FALSE);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function renderList()
|
||||
{
|
||||
|
||||
if(deftrue('BOOTSTRAP')) // v2.x
|
||||
{
|
||||
$template = e107::getTemplate('download','download','list');
|
||||
|
||||
$DOWNLOAD_LIST_TABLE_START = $template['start'];
|
||||
$DOWNLOAD_LIST_TABLE = $template['item'];
|
||||
$DOWNLOAD_LIST_TABLE_END = $template['end'];
|
||||
$DOWNLOAD_LIST_NEXTPREV = $template['nextprev'];
|
||||
}
|
||||
else // Legacy v1.x
|
||||
{
|
||||
$template_name = 'download_template.php';
|
||||
|
||||
if (is_readable(THEME."templates/".$template_name))
|
||||
{
|
||||
require_once(THEME."templates/".$template_name);
|
||||
}
|
||||
elseif (is_readable(THEME.$template_name))
|
||||
{
|
||||
require_once(THEME.$template_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once(e_PLUGIN."download/templates/".$template_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$sql = e107::getDb();
|
||||
$tp = e107::getParser();
|
||||
$ns = e107::getRender();
|
||||
|
||||
$download_shortcodes = new download_shortcodes;
|
||||
$download_shortcodes->qry = $this->qry;
|
||||
|
||||
$total_downloads = $sql->count("download", "(*)", "WHERE download_category = '{$this->qry['id']}' AND download_active > 0 AND download_visible REGEXP '" . e_CLASS_REGEXP . "'");
|
||||
|
||||
|
||||
/* SHOW SUBCATS ... */
|
||||
$qry = "SELECT download_category_id,download_category_class FROM #download_category WHERE download_category_parent=".intval($this->qry['id']);
|
||||
if($sql->gen($qry))
|
||||
{
|
||||
/* 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='{$this->qry['id']}'
|
||||
WHERE dc.download_category_class IN (" . USERCLASS_LIST . ") AND dc.download_category_parent='{$this->qry['id']}'
|
||||
GROUP by dc.download_category_id ORDER by dc.download_category_order
|
||||
";
|
||||
|
||||
$sql->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");
|
||||
}
|
||||
|
||||
$download_cat_table_string = "";
|
||||
|
||||
$dl_text = $tp->parseTemplate($DOWNLOAD_CAT_TABLE_PRE, TRUE, $download_shortcodes);
|
||||
$dl_text .= $tp->parseTemplate($DOWNLOAD_CAT_TABLE_START, TRUE, $download_shortcodes);
|
||||
|
||||
foreach($scArray as $dlsubsubrow)
|
||||
{
|
||||
$dl_text .= $tp->parseTemplate($DOWNLOAD_CAT_SUBSUB_TABLE, TRUE, $download_shortcodes);
|
||||
}
|
||||
|
||||
$dl_text .= $tp->parseTemplate($DOWNLOAD_CAT_TABLE_END, TRUE, $download_shortcodes);
|
||||
|
||||
$dlbreadcrumb = $this->getBreadcrumb(array(LAN_dl_18 => e_SELF,$type));
|
||||
$dl_title = $tp->parseTemplate("{BREADCRUMB=dlbreadcrumb}", TRUE, $download_shortcodes);
|
||||
|
||||
$ns->tablerender($dl_title, $dl_text);
|
||||
$text = "";
|
||||
// If other files, show in a separate block
|
||||
$dl_title = "";
|
||||
// Cancel title once displayed
|
||||
}// End of subcategory display
|
||||
|
||||
// Now display individual downloads
|
||||
$download_category_class = 0;
|
||||
|
||||
if(!check_class($download_category_class))
|
||||
{
|
||||
|
||||
|
||||
$ns->tablerender(LAN_dl_18, "
|
||||
<div style='text-align:center'>
|
||||
" . LAN_dl_3 . "
|
||||
</div>");
|
||||
|
||||
return;
|
||||
// require_once (FOOTERF);
|
||||
// exit ;
|
||||
}
|
||||
if($total_downloads < $this->qry['view'])
|
||||
{
|
||||
$dl_from = 0;
|
||||
}
|
||||
|
||||
|
||||
if(!defined("DL_IMAGESTYLE"))
|
||||
{
|
||||
define("DL_IMAGESTYLE", "border:1px solid blue");
|
||||
}
|
||||
|
||||
require_once (e_HANDLER . "rate_class.php");
|
||||
$dltdownloads = 0;
|
||||
|
||||
// $dl_from - first entry to show (note - can get reset due to reuse of query,
|
||||
// even if values overridden this time)
|
||||
// $this->qry['view'] - number of entries per page
|
||||
// $total_downloads - total number of entries matching search criteria
|
||||
$filetotal = $sql->select("download", "*", "download_category='{$this->qry['id']}' AND download_active > 0 AND download_visible IN (" . USERCLASS_LIST . ") ORDER BY download_{$this->qry['order']} {$this->qry['sort']} LIMIT {$dl_from}, ".$this->qry['view']);
|
||||
|
||||
if($filetotal)
|
||||
{
|
||||
// Only show list if some files in it
|
||||
$dl_text = $tp->parseTemplate($DOWNLOAD_LIST_TABLE_START, TRUE, $download_shortcodes);
|
||||
|
||||
global $dlrow, $dlft, $dltdownloads;
|
||||
|
||||
$dlft = ($filetotal < $this->qry['view'] ? $filetotal: $this->qry['view']);
|
||||
|
||||
while($dlrow = $sql->fetch())
|
||||
{
|
||||
$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);
|
||||
|
||||
$dltdownloads += $dlrow['download_requested'];
|
||||
|
||||
$dl_text .= $tp->parseTemplate($template, TRUE, $download_shortcodes);
|
||||
|
||||
|
||||
}
|
||||
|
||||
$dl_text .= $tp->parseTemplate($DOWNLOAD_LIST_TABLE_END, TRUE, $download_shortcodes);
|
||||
|
||||
if($sql->select("download_category", "*", "download_category_id='{$download_category_parent}' "))
|
||||
{
|
||||
$parent = $sql->fetch();
|
||||
}
|
||||
|
||||
|
||||
$ns->tablerender(LAN_dl_18, $dl_text, 'download-list');
|
||||
}
|
||||
|
||||
if(!isset($DOWNLOAD_LIST_NEXTPREV))
|
||||
{
|
||||
$sc_style['DOWNLOAD_LIST_NEXTPREV']['pre'] = "
|
||||
<div class='nextprev'>
|
||||
";
|
||||
$sc_style['DOWNLOAD_LIST_NEXTPREV']['post'] = "
|
||||
</div>";
|
||||
|
||||
$DOWNLOAD_LIST_NEXTPREV = "
|
||||
<div style='text-align:center;margin-left:auto;margin-right:auto'>
|
||||
{DOWNLOAD_BACK_TO_CATEGORY_LIST}
|
||||
<br />
|
||||
<br />
|
||||
{DOWNLOAD_LIST_NEXTPREV}
|
||||
</div>";
|
||||
}
|
||||
|
||||
global $nextprev_parms;
|
||||
|
||||
$nextprev_parms = $total_downloads . "," . $this->qry['view'] . "," . $dl_from . "," . e_SELF . "?[FROM].list.{$this->qry['id']}.{$this->qry['view']}.{$this->qry['order']}.{$this->qry['sort']}.";
|
||||
|
||||
echo $tp->parseTemplate($DOWNLOAD_LIST_NEXTPREV, TRUE, $download_shortcodes);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function renderReport()
|
||||
{
|
||||
$sql = e107::getDb();
|
||||
$tp = e107::getParser();
|
||||
$ns = e107::getRender();
|
||||
$frm = e107::getForm();
|
||||
$pref = e107::getPref();
|
||||
|
||||
$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 = {$this->qry['id']}
|
||||
AND download_active > 0
|
||||
LIMIT 1";
|
||||
|
||||
if(!$sql->gen($query))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$dlrow = $sql->fetch();
|
||||
|
||||
extract($dlrow);
|
||||
|
||||
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->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."<br /><br /><a href='".e_PLUGIN."download/download.php?view.".$download_id."'>".LAN_dl_49."</a>";
|
||||
// $dlbreadcrumb = $dl->getBreadcrumb(array(LAN_dl_18=>e_SELF, $dlrow['download_category_name']=>e_SELF."?list.".$dlrow['download_category_id'], $dlrow['download_name']=>e_SELF."?view.".$dlrow['download_id'], LAN_dl_50));
|
||||
// $dl_title .= $tp->parseTemplate("{BREADCRUMB=dlbreadcrumb}", TRUE, $download_shortcodes);
|
||||
|
||||
$ns->tablerender(LAN_dl_18, $text);
|
||||
}
|
||||
else
|
||||
{
|
||||
define("e_PAGETITLE", PAGE_NAME." / ".LAN_dl_51." ".$download_name);
|
||||
// require_once(HEADERF);
|
||||
|
||||
$breadcrumb = array();
|
||||
$breadcrumb[] = array('text' => LAN_dl_18, 'url' => e_SELF);
|
||||
$breadcrumb[] = array('text' => $dlrow['download_category_name'], 'url' => e_SELF."?action=list&id=".$dlrow['download_category_id']);
|
||||
$breadcrumb[] = array('text' => $dlrow['download_name'], 'url' => e_SELF."?action=view&id=".$dlrow['download_id']);
|
||||
$breadcrumb[] = array('text' => LAN_dl_50, 'url' => null);
|
||||
|
||||
$text = $frm->breadcrumb($breadcrumb);
|
||||
|
||||
$text .= "<form action='".e_SELF."?report.{$download_id}' method='post'>
|
||||
<div>
|
||||
".LAN_dl_32.": <a href='".e_PLUGIN."download/download?action=view&id={$download_id}'>".$download_name."</a>
|
||||
</div>
|
||||
<div>".LAN_dl_54."<br />".LAN_dl_55."</div>
|
||||
<div> ".$frm->textarea('report_add')."</div>
|
||||
<div class='text-center'>
|
||||
".$frm->button('report_download',LAN_dl_45,'submit')."
|
||||
</div>
|
||||
</form>";
|
||||
|
||||
$ns->tablerender(LAN_dl_18, $text);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//TODO
|
||||
function renderMirror()
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @DEPRECATED
|
||||
*/
|
||||
function getBreadcrumb($arr)
|
||||
{
|
||||
$dlbreadcrumb = array();
|
||||
@@ -67,7 +655,7 @@ class download
|
||||
LEFT JOIN #download_category as dc2 ON dc2.download_category_id=dc1.download_category_parent ";
|
||||
if (ADMIN === FALSE) $qry .= " WHERE dc.download_category_class IN (".USERCLASS_LIST.") ";
|
||||
$qry .= " 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 (!$sql->db_Select_gen($qry))
|
||||
if (!$sql->gen($qry))
|
||||
{
|
||||
return "Error reading categories<br />";
|
||||
exit;
|
||||
@@ -76,7 +664,7 @@ class download
|
||||
<option value=''>{$blankText}</option>\n";
|
||||
// Its a structured display option - need a 2-step process to create a tree
|
||||
$catlist = array();
|
||||
while ($dlrow = $sql->db_Fetch(MYSQL_ASSOC))
|
||||
while ($dlrow = $sql->fetch(MYSQL_ASSOC))
|
||||
{
|
||||
$tmp = $dlrow['download_category_parent'];
|
||||
if ($tmp == '0')
|
||||
|
@@ -28,5 +28,6 @@
|
||||
<pref name="agree_flag"></pref> <!-- needs download prefix? -->
|
||||
<pref name="agree_text"></pref>
|
||||
<pref name="download_denied"></pref>
|
||||
<pref name="download_reportbroken">254</pref>
|
||||
</mainPrefs>
|
||||
</e107Plugin>
|
||||
|
@@ -150,42 +150,13 @@ if(!isset($DOWNLOAD_LIST_TABLE_START))
|
||||
<col style='width:5%;'/>
|
||||
</colgroup>
|
||||
<tr>
|
||||
<td colspan='7' style='text-align:center' class='forumheader'>
|
||||
<span class='defaulttext'>".LAN_dl_37."</span>
|
||||
<select name='view' class='tbox'>".
|
||||
($view == 5 ? "<option selected='selected'>5</option>" : "<option>5</option>").
|
||||
($view == 10 ? "<option selected='selected'>10</option>" : "<option>10</option>").
|
||||
($view == 15 ? "<option selected='selected'>15</option>" : "<option>15</option>").
|
||||
($view == 20 ? "<option selected='selected'>20</option>" : "<option>20</option>").
|
||||
($view == 50 ? "<option selected='selected'>50</option>" : "<option>50</option>")."
|
||||
</select>
|
||||
|
||||
<span class='defaulttext'>".LAN_dl_38."</span>
|
||||
<select name='order' class='tbox'>".
|
||||
($order == "download_datestamp" ? "<option value='download_datestamp' selected='selected'>".LAN_dl_22."</option>" : "<option value='download_datestamp'>".LAN_dl_22."</option>").
|
||||
($order == "download_requested" ? "<option value='download_requested' selected='selected'>".LAN_dl_18."</option>" : "<option value='download_requested'>".LAN_dl_77."</option>").
|
||||
($order == "download_name" ? "<option value='download_name' selected='selected'>".LAN_dl_23."</option>" : "<option value='download_name'>".LAN_dl_23."</option>").
|
||||
($order == "download_author" ? "<option value='download_author' selected='selected'>".LAN_dl_24."</option>" : "<option value='download_author'>".LAN_dl_24."</option>").
|
||||
($order == "download_requested" ? "<option value='download_requested' selected='selected'>".LAN_dl_24."</option>" : "<option value='download_requested'>".LAN_dl_12."</option>")."
|
||||
</select>
|
||||
|
||||
<span class='defaulttext'>".LAN_dl_39."</span>
|
||||
<select name='sort' class='tbox'>".
|
||||
($sort == "ASC" ? "<option value='ASC' selected='selected'>".LAN_dl_25."</option>" : "<option value='ASC'>".LAN_dl_25."</option>").
|
||||
($sort == "DESC" ? "<option value='DESC' selected='selected'>".LAN_dl_26."</option>" : "<option value='DESC'>".LAN_dl_26."</option>")."
|
||||
</select>
|
||||
|
||||
<input class='btn button' type='submit' name='goorder' value='".LAN_dl_27."' />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='fcaption'>".LAN_dl_28."</th>
|
||||
<th class='fcaption'>".LAN_dl_22."</th>
|
||||
<th class='fcaption'>".LAN_dl_24."</th>
|
||||
<th class='fcaption'>".LAN_dl_21."</th>
|
||||
<th class='fcaption'>".LAN_dl_29."</th>
|
||||
<th class='fcaption'>".LAN_dl_12."</th>
|
||||
<th class='fcaption'>".LAN_dl_8."</th>
|
||||
<th class='fcaption'>{DOWNLOAD_LIST_CAPTION=name}</th>
|
||||
<th class='fcaption'>{DOWNLOAD_LIST_CAPTION=date}</th>
|
||||
<th class='fcaption'>{DOWNLOAD_LIST_CAPTION=author}</th>
|
||||
<th class='fcaption'>{DOWNLOAD_LIST_CAPTION=size}</th>
|
||||
<th class='fcaption'>{DOWNLOAD_LIST_CAPTION=downloads}</th>
|
||||
<th class='fcaption'>{DOWNLOAD_LIST_CAPTION=rating}</th>
|
||||
<th class='fcaption'>{DOWNLOAD_LIST_CAPTION=get}</th>
|
||||
</tr>";
|
||||
}
|
||||
if(!isset($DOWNLOAD_LIST_TABLE))
|
||||
@@ -262,6 +233,9 @@ $sc_style['DOWNLOAD_VIEW_AUTHORWEBSITE']['post'] = "</td></tr>";
|
||||
$sc_style['DOWNLOAD_REPORT_LINK']['pre'] = "<tr><td style='width:20%' class='forumheader3' colspan='2'>";
|
||||
$sc_style['DOWNLOAD_REPORT_LINK']['post'] = "</td></tr>";
|
||||
|
||||
|
||||
|
||||
|
||||
if(!isset($DOWNLOAD_VIEW_TABLE))
|
||||
{
|
||||
$DOWNLOAD_VIEW_TABLE = "
|
||||
@@ -371,5 +345,269 @@ if(!isset($DOWNLOAD_MIRROR_END))
|
||||
";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// v2.x Bootstrap Template. - Overrides the above templates.
|
||||
|
||||
|
||||
$DOWNLOAD_TEMPLATE['categories']['start'] = "
|
||||
<table class='table table-striped fborder'>
|
||||
<colgroup>
|
||||
<col style='width:3%'/>
|
||||
<col style='width:60%'/>
|
||||
<col style='width:10%'/>
|
||||
<col style='width:17%'/>
|
||||
<col style='width:10%'/>
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan='2'>".LAN_dl_19."</th>
|
||||
<th>".LAN_dl_20."</th>
|
||||
<th>".LAN_dl_21."</th>
|
||||
<th>".LAN_dl_77."</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan='5'>{DOWNLOAD_CAT_NEWDOWNLOAD_TEXT}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='5'>{DOWNLOAD_CAT_SEARCH}</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>";
|
||||
|
||||
|
||||
$DOWNLOAD_TEMPLATE['categories']['parent'] = "
|
||||
<tr>
|
||||
<td class='forumheader'>
|
||||
{DOWNLOAD_CAT_MAIN_ICON}
|
||||
</td>
|
||||
<td colspan='4' class='forumheader'>
|
||||
{DOWNLOAD_CAT_MAIN_NAME}<br/>
|
||||
<span class='smalltext'>{DOWNLOAD_CAT_MAIN_DESCRIPTION}</span>
|
||||
</td>
|
||||
</tr>";
|
||||
|
||||
$DOWNLOAD_TEMPLATE['categories']['child'] = "
|
||||
<tr>
|
||||
<td>{DOWNLOAD_CAT_SUB_ICON} </td>
|
||||
<td>
|
||||
{DOWNLOAD_CAT_SUB_NEW_ICON} {DOWNLOAD_CAT_SUB_NAME}<br/>
|
||||
<small>{DOWNLOAD_CAT_SUB_DESCRIPTION}</small>
|
||||
</td>
|
||||
<td>{DOWNLOAD_CAT_SUB_COUNT} </td>
|
||||
<td>{DOWNLOAD_CAT_SUB_SIZE} </td>
|
||||
<td>{DOWNLOAD_CAT_SUB_DOWNLOADED} </td>
|
||||
</tr>
|
||||
{DOWNLOAD_CAT_SUBSUB}";
|
||||
|
||||
|
||||
$DOWNLOAD_TEMPLATE['categories']['subchild'] = "
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<table class='table'>
|
||||
<tr>
|
||||
<td>
|
||||
{DOWNLOAD_CAT_SUBSUB_ICON}
|
||||
</td>
|
||||
<td>
|
||||
{DOWNLOAD_CAT_SUBSUB_NEW_ICON} {DOWNLOAD_CAT_SUBSUB_NAME}<br/>
|
||||
<small>
|
||||
{DOWNLOAD_CAT_SUBSUB_DESCRIPTION}
|
||||
</small>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td>{DOWNLOAD_CAT_SUBSUB_COUNT} </td>
|
||||
<td>{DOWNLOAD_CAT_SUBSUB_SIZE} </td>
|
||||
<td>{DOWNLOAD_CAT_SUBSUB_DOWNLOADED} </td>
|
||||
</tr>";
|
||||
|
||||
|
||||
$DOWNLOAD_TEMPLATE['categories']['end'] = "
|
||||
</tbody>
|
||||
</table>\n";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$DOWNLOAD_WRAPPER['view']['DOWNLOAD_VIEW_AUTHOR_LAN'] = "<tr><td style='width:20%' class='forumheader3'>{---}</td>";
|
||||
$DOWNLOAD_WRAPPER['view']['DOWNLOAD_VIEW_AUTHOR'] = "<td style='width:80%' class='forumheader3'>{---}</td>";
|
||||
$DOWNLOAD_WRAPPER['view']['DOWNLOAD_VIEW_AUTHOREMAIL_LAN'] = "<tr><td style='width:20%' class='forumheader3'>{---}</td>";
|
||||
$DOWNLOAD_WRAPPER['view']['DOWNLOAD_VIEW_AUTHOREMAIL'] = "<td style='width:80%' class='forumheader3'>{---}</td>";
|
||||
$DOWNLOAD_WRAPPER['view']['DOWNLOAD_VIEW_AUTHORWEBSITE_LAN'] = "<tr><td style='width:20%' class='forumheader3'>{---}</td>";
|
||||
$DOWNLOAD_WRAPPER['view']['DOWNLOAD_VIEW_AUTHORWEBSITE'] = "<td style='width:80%' class='forumheader3'>{---}</td>";
|
||||
$DOWNLOAD_WRAPPER['view']['DOWNLOAD_REPORT_LINK'] = "<tr><td style='width:20%' class='forumheader3' colspan='2'>{---}</td></tr>";
|
||||
|
||||
|
||||
$DOWNLOAD_TEMPLATE['view']['caption'] = LAN_dl_18;
|
||||
$DOWNLOAD_TEMPLATE['view']['start'] = "{DOWNLOAD_BREADCRUMB} ";
|
||||
|
||||
$DOWNLOAD_TEMPLATE['view']['item'] = "
|
||||
<div style='text-align:center'>
|
||||
<table class='table table-striped fborder' style='".USER_WIDTH."'>
|
||||
<colgroup>
|
||||
<col style='width:30%;'>
|
||||
<col style='width:70%;'>
|
||||
</colgroup>
|
||||
<tr>
|
||||
<td colspan='2' class='fcaption' style='text-align:left;'>
|
||||
{DOWNLOAD_VIEW_NAME} {DOWNLOAD_ADMIN_EDIT}
|
||||
</td>
|
||||
</tr>
|
||||
{DOWNLOAD_VIEW_AUTHOR_LAN}
|
||||
{DOWNLOAD_VIEW_AUTHOR}
|
||||
{DOWNLOAD_VIEW_AUTHOREMAIL_LAN}
|
||||
{DOWNLOAD_VIEW_AUTHOREMAIL}
|
||||
{DOWNLOAD_VIEW_AUTHORWEBSITE_LAN}
|
||||
{DOWNLOAD_VIEW_AUTHORWEBSITE}
|
||||
<tr>
|
||||
<td class='forumheader3'>{DOWNLOAD_VIEW_DESCRIPTION_LAN}</td>
|
||||
<td class='forumheader3'>{DOWNLOAD_VIEW_DESCRIPTION}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='forumheader3'>{DOWNLOAD_VIEW_IMAGE_LAN}</td>
|
||||
<td class='forumheader3'>{DOWNLOAD_VIEW_IMAGE}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='forumheader3'>{DOWNLOAD_VIEW_FILESIZE_LAN}</td>
|
||||
<td class='forumheader3'>{DOWNLOAD_VIEW_FILESIZE}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='forumheader3'>{DOWNLOAD_VIEW_DATE_LAN}</td>
|
||||
<td class='forumheader3'>{DOWNLOAD_VIEW_DATE=long}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='forumheader3'>{DOWNLOAD_VIEW_REQUESTED_LAN}</td>
|
||||
<td class='forumheader3'>{DOWNLOAD_VIEW_REQUESTED}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='forumheader3'>{DOWNLOAD_VIEW_LINK_LAN}</td>
|
||||
<td class='forumheader3'>{DOWNLOAD_VIEW_LINK}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='forumheader3'>{DOWNLOAD_VIEW_RATING_LAN}</td>
|
||||
<td class='forumheader3'>{DOWNLOAD_VIEW_RATING}</td>
|
||||
</tr>
|
||||
{DOWNLOAD_REPORT_LINK}
|
||||
</table>
|
||||
|
||||
</div>\n";
|
||||
|
||||
$DOWNLOAD_TEMPLATE['view']['end'] = "";
|
||||
|
||||
|
||||
$DOWNLOAD_TEMPLATE['view']['nextprev'] = "
|
||||
<div style='text-align:center'>
|
||||
<table style='".USER_WIDTH."'>
|
||||
<tr>
|
||||
<td style='width:40%;'>{DOWNLOAD_VIEW_PREV}</td>
|
||||
<td style='width:20%; text-align: center;'>{DOWNLOAD_BACK_TO_LIST}</td>
|
||||
<td style='width:40%; text-align: right;'>{DOWNLOAD_VIEW_NEXT}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>\n";
|
||||
|
||||
$DOWNLOAD_TEMPLATE['view']['nextprev'] = '
|
||||
<ul class="pager">
|
||||
<li class="previous">
|
||||
{DOWNLOAD_VIEW_PREV}
|
||||
</li>
|
||||
<li class="next">
|
||||
{DOWNLOAD_VIEW_NEXT}
|
||||
</li>
|
||||
</ul>
|
||||
<div class="text-center">{DOWNLOAD_BACK_TO_LIST}</div>
|
||||
';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$DOWNLOAD_TEMPLATE['list']['start'] = "{DOWNLOAD_BREADCRUMB}
|
||||
<div style='text-align:center'>
|
||||
<form method='post' action='".e_SELF."?".e_QUERY."'>
|
||||
<table class='table table-striped fborder' style='".USER_WIDTH."'>\n
|
||||
<colgroup>
|
||||
<col style='width:35%;'/>
|
||||
<col style='width:15%;'/>
|
||||
<col style='width:20%;'/>
|
||||
<col style='width:10%;'/>
|
||||
<col style='width:5%;'/>
|
||||
<col style='width:10%;'/>
|
||||
<col style='width:5%;'/>
|
||||
</colgroup>
|
||||
<tr>
|
||||
<th>{DOWNLOAD_LIST_CAPTION=name}</th>
|
||||
<th>{DOWNLOAD_LIST_CAPTION=datestamp}</th>
|
||||
<th>{DOWNLOAD_LIST_CAPTION=author}</th>
|
||||
<th>{DOWNLOAD_LIST_CAPTION=filesize}</th>
|
||||
<th>{DOWNLOAD_LIST_CAPTION=requested}</th>
|
||||
<th>{DOWNLOAD_LIST_CAPTION=rating}</th>
|
||||
<th>{DOWNLOAD_LIST_CAPTION=link}</th>
|
||||
</tr>";
|
||||
|
||||
$DOWNLOAD_TEMPLATE['list']['item'] = "
|
||||
<tr>
|
||||
<td>
|
||||
{DOWNLOAD_LIST_NEWICON} {DOWNLOAD_LIST_NAME}
|
||||
</td>
|
||||
<td>
|
||||
{DOWNLOAD_LIST_DATESTAMP}
|
||||
</td>
|
||||
<td>
|
||||
{DOWNLOAD_LIST_AUTHOR}
|
||||
</td>
|
||||
<td>
|
||||
{DOWNLOAD_LIST_FILESIZE}
|
||||
</td>
|
||||
<td>
|
||||
{DOWNLOAD_LIST_REQUESTED}
|
||||
</td>
|
||||
<td>
|
||||
{DOWNLOAD_LIST_RATING}
|
||||
</td>
|
||||
<td>
|
||||
{DOWNLOAD_LIST_LINK}
|
||||
</td>
|
||||
</tr>";
|
||||
|
||||
$DOWNLOAD_TEMPLATE['list']['end'] = "
|
||||
<tr>
|
||||
<td class='forumheader3' colspan='7' style='text-align:right;'>{DOWNLOAD_LIST_TOTAL_AMOUNT} {DOWNLOAD_LIST_TOTAL_FILES}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>\n";
|
||||
|
||||
|
||||
$DOWNLOAD_TEMPLATE['list']['nextprev'] = "
|
||||
<div class='text-center'>
|
||||
{DOWNLOAD_BACK_TO_CATEGORY_LIST}
|
||||
<br />
|
||||
<br />
|
||||
{DOWNLOAD_LIST_NEXTPREV}
|
||||
</div>";
|
||||
|
||||
|
||||
$sc_style['DOWNLOAD_LIST_NEXTPREV']['pre'] = "<div class='nextprev'>";
|
||||
$sc_style['DOWNLOAD_LIST_NEXTPREV']['post'] = " </div>";
|
||||
$DOWNLOAD_LIST_NEXTPREV = "
|
||||
<div style='text-align:center;margin-left:auto;margin-right:auto'>
|
||||
{DOWNLOAD_BACK_TO_CATEGORY_LIST}
|
||||
<br />
|
||||
<br />
|
||||
{DOWNLOAD_LIST_NEXTPREV}
|
||||
</div>";
|
||||
|
||||
// ##### ------------------------------------------------------------------------------------------
|
||||
?>
|
Reference in New Issue
Block a user