mirror of
https://github.com/e107inc/e107.git
synced 2025-08-08 07:36:32 +02:00
Download plugin clean-up mostly complete. (cache still needs to be done)
This commit is contained in:
@@ -1247,11 +1247,11 @@ class e_shortcode
|
|||||||
/**
|
/**
|
||||||
* Set external array data to be used in the batch
|
* Set external array data to be used in the batch
|
||||||
* Use setVars() - preferred.
|
* Use setVars() - preferred.
|
||||||
*
|
* //XXX will soon become private. Use setVars() instead.
|
||||||
* @param array $eVars
|
* @param array $eVars
|
||||||
* @return e_shortcode
|
* @return e_shortcode
|
||||||
*/
|
*/
|
||||||
public function setParserVars($eVars) //XXX will soon become private. Use setVars() instead.
|
public function setParserVars($eVars)
|
||||||
{
|
{
|
||||||
$this->var = $eVars;
|
$this->var = $eVars;
|
||||||
return $this;
|
return $this;
|
||||||
|
@@ -2,16 +2,10 @@
|
|||||||
/*
|
/*
|
||||||
* e107 website system
|
* 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
|
* Released under the terms and conditions of the
|
||||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/download/download.php,v $
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('e107_INIT'))
|
if (!defined('e107_INIT'))
|
||||||
@@ -25,663 +19,59 @@ if (!e107::isInstalled('download'))
|
|||||||
}
|
}
|
||||||
|
|
||||||
include_lan(e_PLUGIN.'download/languages/'.e_LANGUAGE.'/download.php');
|
include_lan(e_PLUGIN.'download/languages/'.e_LANGUAGE.'/download.php');
|
||||||
|
|
||||||
require_once(e_PLUGIN.'download/handlers/download_class.php');
|
require_once(e_PLUGIN.'download/handlers/download_class.php');
|
||||||
require_once(e_PLUGIN.'download/handlers/category_class.php');
|
require_once(e_PLUGIN.'download/handlers/category_class.php');
|
||||||
require_once(e_PLUGIN.'download/download_shortcodes.php');
|
|
||||||
require_once(e_HANDLER.'comment_class.php');
|
|
||||||
|
|
||||||
$dl = new download();
|
$dl = new download();
|
||||||
$cobj = new comment();
|
|
||||||
$dl_text = ''; // Output variable
|
|
||||||
|
|
||||||
if(!defined("USER_WIDTH")) { define("USER_WIDTH","width:100%"); }
|
if(!defined("USER_WIDTH")) { define("USER_WIDTH","width:100%"); }
|
||||||
|
|
||||||
/* define images */
|
/* define images */
|
||||||
|
|
||||||
|
/** @Deprecated **/
|
||||||
define("IMAGE_DOWNLOAD", (file_exists(THEME."images/download.png") ? THEME."images/download.png" : e_IMAGE."generic/download.png"));
|
define("IMAGE_DOWNLOAD", (file_exists(THEME."images/download.png") ? THEME."images/download.png" : e_IMAGE."generic/download.png"));
|
||||||
|
|
||||||
|
/** @Deprecated **/
|
||||||
define("IMAGE_NEW", (file_exists(THEME."images/new.png") ? THEME."images/new.png" : e_IMAGE."generic/new.png"));
|
define("IMAGE_NEW", (file_exists(THEME."images/new.png") ? THEME."images/new.png" : e_IMAGE."generic/new.png"));
|
||||||
|
|
||||||
$template_load_core = '
|
|
||||||
$template_name = $load_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);
|
|
||||||
}
|
|
||||||
';
|
|
||||||
|
|
||||||
$order_options = array('download_id','download_datestamp','download_requested','download_name','download_author','download_requested');
|
|
||||||
$sort_options = array('ASC', 'DESC');
|
|
||||||
|
|
||||||
if (!e_QUERY || $_GET['elan'])
|
|
||||||
{
|
|
||||||
$action = 'maincats'; // List categories
|
|
||||||
$maincatval = ''; // Show all main categories
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ // Get parameters from the query
|
|
||||||
$maincatval = ''; // Show all main categories
|
|
||||||
$tmp = explode(".", e_QUERY);
|
|
||||||
|
|
||||||
$dl->init();
|
$dl->init();
|
||||||
|
|
||||||
if(isset($_GET['action'])) // v2.x
|
// Legacy Comment Save.
|
||||||
{
|
|
||||||
$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]);
|
|
||||||
$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($_GET['view']))
|
|
||||||
{
|
|
||||||
// $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
|
|
||||||
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."))") )
|
|
||||||
{
|
|
||||||
$dlrow = $sql->db_Fetch();
|
|
||||||
extract($dlrow);
|
|
||||||
$type = $download_category_name;
|
|
||||||
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, "<div style='text-align:center'>".LAN_dl_3."</div>");
|
|
||||||
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 : // No permissions
|
|
||||||
if (strlen($pref['download_denied']) > 0) {
|
|
||||||
$errmsg = $tp->toHTML($pref['download_denied'],true);
|
|
||||||
} else {
|
|
||||||
$errmsg = LAN_dl_63;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 2 : // Quota exceeded
|
|
||||||
$errmsg = LAN_dl_62;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$errmsg = LAN_dl_61." ".$errnum; // Generic error - shouldn't happen
|
|
||||||
}
|
|
||||||
$ns->tablerender(LAN_dl_61, "<div style='text-align:center'>".$errmsg."</div>");
|
|
||||||
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 = vartrue($pref['download_order'],'download_datestamp');
|
|
||||||
if (!isset($sort)) $sort = vartrue($pref['download_sort'], 'DESC');
|
|
||||||
if (!isset($view)) $view = vartrue($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. //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;
|
|
||||||
// Add other 'cases' here
|
|
||||||
} // End switch ($action)
|
|
||||||
|
|
||||||
|
|
||||||
if (isset($_POST['commentsubmit']))
|
if (isset($_POST['commentsubmit']))
|
||||||
{
|
{
|
||||||
if (!$sql->db_Select("download", "download_comment", "download_id = '{$id}' "))
|
if (!$sql->select("download", "download_comment", "download_id = '{$id}' "))
|
||||||
{
|
{
|
||||||
header("location:".e_BASE."index.php");
|
header("location:".e_BASE."index.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$dlrow = $sql->db_Fetch();
|
$dlrow = $sql->fetch();
|
||||||
if ($dlrow['download_comment'] && (ANON === TRUE || USER === TRUE))
|
if ($dlrow['download_comment'] && (ANON === TRUE || USER === TRUE))
|
||||||
{
|
{
|
||||||
$clean_authorname = $_POST['author_name'];
|
$clean_authorname = $_POST['author_name'];
|
||||||
$clean_comment = $_POST['comment'];
|
$clean_comment = $_POST['comment'];
|
||||||
$clean_subject = $_POST['subject'];
|
$clean_subject = $_POST['subject'];
|
||||||
|
|
||||||
$cobj->enter_comment($clean_authorname, $clean_comment, "download", $id, $pid, $clean_subject);
|
e107::getComment()->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.{$sub_action}"); $sub_action not used here
|
||||||
$e107cache->clear("comment.download");
|
$e107cache->clear("comment.download");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$texts = $dl->render(); // Load before header.
|
||||||
|
|
||||||
require_once (HEADERF);
|
require_once (HEADERF);
|
||||||
|
|
||||||
if($action == 'maincats')
|
echo $texts;
|
||||||
{
|
|
||||||
$dl->renderCategories();
|
|
||||||
}
|
|
||||||
|
|
||||||
if($action == 'list')
|
|
||||||
{
|
|
||||||
$dl->renderList();
|
|
||||||
}
|
|
||||||
|
|
||||||
if($action == 'view')
|
|
||||||
{
|
|
||||||
$dl->renderView();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($action == "report" && check_class($pref['download_reportbroken']))
|
|
||||||
{
|
|
||||||
$dl->renderReport();
|
|
||||||
}
|
|
||||||
|
|
||||||
if($action == 'mirror')
|
|
||||||
{
|
|
||||||
$dl->renderMirror();
|
|
||||||
}
|
|
||||||
|
|
||||||
require_once (FOOTERF);
|
require_once (FOOTERF);
|
||||||
|
|
||||||
|
|
||||||
exit ;
|
exit ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//====================================================
|
|
||||||
//LIST//====================================================
|
|
||||||
if($action == "list")
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
/* SHOW SUBCATS ... */
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
$total_downloads = $sql->db_Count("download", "(*)", "WHERE download_category = '{$id}' AND download_active > 0 AND download_visible REGEXP '" . e_CLASS_REGEXP . "'");
|
|
||||||
|
|
||||||
require_once (HEADERF);
|
|
||||||
|
|
||||||
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_LIST_TABLE))
|
|
||||||
eval($template_load_core);
|
|
||||||
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)
|
|
||||||
// $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'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$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}
|
|
||||||
</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"
|
|
||||||
|
|
||||||
//====================================================
|
|
||||||
// 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, "<div style='text-align:center'>".LAN_dl_3."</div>");
|
|
||||||
require_once(FOOTERF);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$dlrow = $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_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);
|
|
||||||
|
|
||||||
$dlbreadcrumb = $dl->getBreadcrumb(array(LAN_dl_18=>e_SELF, $dlrow['download_category_name']=>e_SELF."?list.".$dlrow['download_category_id'], $dlrow['download_name']));
|
|
||||||
$dl_title .= $tp->parseTemplate("{BREADCRUMB=dlbreadcrumb}", TRUE, $download_shortcodes);
|
|
||||||
$ns->tablerender($dl_title, $text);
|
|
||||||
|
|
||||||
unset($text);
|
|
||||||
|
|
||||||
if ($dlrow['download_comment']) {
|
|
||||||
$cobj->compose_comment("download", "comment", $id, $width,$dlrow['download_name'], $showrate=FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
require_once(FOOTERF);
|
|
||||||
exit;
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
//====================================================
|
|
||||||
// REPORT BROKEN LINKS
|
|
||||||
//====================================================
|
|
||||||
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
|
|
||||||
WHERE d.download_id = {$id}
|
|
||||||
AND download_active > 0
|
|
||||||
LIMIT 1";
|
|
||||||
|
|
||||||
if(!$sql->db_Select_gen($query))
|
|
||||||
{
|
|
||||||
//if (!$sql->db_Select("download", "*", "download_id = {$id} AND download_active > 0")) {
|
|
||||||
require_once(HEADERF);
|
|
||||||
require_once(FOOTERF);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$dlrow = $sql->db_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->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."<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($dl_title, $text);
|
|
||||||
} else {
|
|
||||||
define("e_PAGETITLE", PAGE_NAME." / ".LAN_dl_51." ".$download_name);
|
|
||||||
require_once(HEADERF);
|
|
||||||
|
|
||||||
$text = "<form action='".e_SELF."?report.{$download_id}' method='post'>
|
|
||||||
<table style='".USER_WIDTH."'>
|
|
||||||
<tr>
|
|
||||||
<td style='width:50%' >
|
|
||||||
".LAN_dl_32.": ".$download_name."<br />
|
|
||||||
<a href='".e_PLUGIN."download/download?view.{$download_id}'>
|
|
||||||
<span class='smalltext'>".LAN_dl_53."</span>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td style='text-align:center;width:50%'>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>".LAN_dl_54."<br />".LAN_dl_55."</td>
|
|
||||||
<td style='text-align:center;'>
|
|
||||||
<textarea cols='40' rows='10' class='tbox' name='report_add'></textarea>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td colspan='2' style='text-align:center;'><br />
|
|
||||||
<input class='btn button' type='submit' name='report_download' value=\"".LAN_dl_45."\" />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</form>";
|
|
||||||
$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;
|
|
||||||
}
|
|
||||||
|
|
||||||
//====================================================
|
|
||||||
// MIRRORS
|
|
||||||
//====================================================
|
|
||||||
|
|
||||||
//TODO Move into download_class.php
|
|
||||||
|
|
||||||
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");
|
|
||||||
|
|
||||||
$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}
|
|
||||||
LIMIT 1";
|
|
||||||
|
|
||||||
if($sql->db_Select_gen($query))
|
|
||||||
{
|
|
||||||
$dlrow = $sql->db_Fetch();
|
|
||||||
$array = explode(chr(1), $dlrow['download_mirror']);
|
|
||||||
if (2 == varset($pref['mirror_order']))
|
|
||||||
{
|
|
||||||
// Order by name, sort array manually
|
|
||||||
usort($array, "sort_download_mirror_order");
|
|
||||||
}
|
|
||||||
//elseif (1 == varset($pref['mirror_order']))
|
|
||||||
//{
|
|
||||||
// // Order by ID - do nothing order is as stored in DB
|
|
||||||
//}
|
|
||||||
elseif (0 == varset($pref['mirror_order'], 0))
|
|
||||||
{
|
|
||||||
// Shuffle the mirror list into a random order
|
|
||||||
$c = count($array);
|
|
||||||
for ($i=1; $i<$c; $i++)
|
|
||||||
{
|
|
||||||
$d = mt_rand(0, $i);
|
|
||||||
$tmp = $array[$i];
|
|
||||||
$array[$i] = $array[$d];
|
|
||||||
$array[$d] = $tmp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$dl_text = $tp->parseTemplate($DOWNLOAD_MIRROR_START, TRUE, $download_shortcodes);
|
|
||||||
$download_mirror = 1;
|
|
||||||
foreach($array as $mirrorstring)
|
|
||||||
{
|
|
||||||
if($mirrorstring)
|
|
||||||
{
|
|
||||||
$dlmirrorfile = explode(",", $mirrorstring);
|
|
||||||
$dlmirror = $mirrorList[$dlmirrorfile[0]];
|
|
||||||
$dl_text .= $tp->parseTemplate($DOWNLOAD_MIRROR, TRUE, $download_shortcodes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$dl_text .= $tp->parseTemplate($DOWNLOAD_MIRROR_END, TRUE, $download_shortcodes);
|
|
||||||
$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_67));
|
|
||||||
$dl_title .= $tp->parseTemplate("{BREADCRUMB=dlbreadcrumb}", TRUE, $download_shortcodes);
|
|
||||||
$ns->tablerender($dl_title, $dl_text);*/
|
|
||||||
|
|
||||||
// require_once(FOOTERF);
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
|
|
||||||
function sort_download_mirror_order($a, $b)
|
|
||||||
{
|
|
||||||
$a = explode(",", $a);
|
|
||||||
$b = explode(",", $b);
|
|
||||||
if ($a[1] == $b[1]) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return ($a[1] < $b[1]) ? -1 : 1;
|
|
||||||
}
|
|
||||||
?>
|
?>
|
@@ -15,26 +15,23 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('e107_INIT')) { exit; }
|
if (!defined('e107_INIT')) { exit; }
|
||||||
require_once(e_HANDLER.'shortcode_handler.php');
|
|
||||||
//register_shortcode('download_shortcodes', true);
|
|
||||||
//initShortcodeClass('download_shortcodes');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* download_shortcodes
|
* download_shortcodes
|
||||||
*/
|
*/
|
||||||
class download_shortcodes extends e_shortcode
|
class download_shortcodes extends e_shortcode
|
||||||
{
|
{
|
||||||
var $e107;
|
public $qry;
|
||||||
var $postInfo;
|
public $dlsubrow;
|
||||||
var $qry;
|
public $dlsubsubrow;
|
||||||
|
public $mirror;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* download_shortcodes constructor
|
* download_shortcodes constructor
|
||||||
*/
|
*/
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
$this->e107 = e107::getInstance();
|
|
||||||
$this->postInfo = array();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_breadcrumb($parm='')
|
function sc_download_breadcrumb($parm='')
|
||||||
@@ -42,23 +39,25 @@ class download_shortcodes extends e_shortcode
|
|||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
$frm = e107::getForm();
|
$frm = e107::getForm();
|
||||||
|
|
||||||
global $dlrow;
|
|
||||||
|
|
||||||
$breadcrumb = array();
|
$breadcrumb = array();
|
||||||
|
|
||||||
switch ($this->qry['action'])
|
switch ($this->qry['action'])
|
||||||
{
|
{
|
||||||
case 'mirror':
|
case 'mirror':
|
||||||
$breadcrumb[] = array('text' => LAN_dl_18, 'url' => e_SELF);
|
$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' => $this->var['download_category_name'], 'url' => e_SELF."?action=list&id=".$this->var['download_category_id']);
|
||||||
$breadcrumb[] = array('text' => $dlrow['download_name'], 'url' => e_SELF."?action=view&id=".$dlrow['download_id']);
|
$breadcrumb[] = array('text' => $this->var['download_name'], 'url' => e_SELF."?action=view&id=".$this->var['download_id']);
|
||||||
$breadcrumb[] = array('text' => LAN_dl_67, 'url' => null);
|
$breadcrumb[] = array('text' => LAN_dl_67, 'url' => null);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'maincats':
|
||||||
|
$breadcrumb[] = array('text' => LAN_dl_18, 'url' => e_SELF);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$breadcrumb[] = array('text' => LAN_dl_18, 'url' => e_SELF);
|
$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' => $this->var['download_category_name'], 'url' => e_SELF."?action=list&id=".$this->var['download_category_id']);
|
||||||
$breadcrumb[] = array('text' => $dlrow['download_name'], 'url' => null);
|
$breadcrumb[] = array('text' => $this->var['download_name'], 'url' => null);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,95 +67,109 @@ class download_shortcodes extends e_shortcode
|
|||||||
|
|
||||||
|
|
||||||
// Category ************************************************************************************
|
// Category ************************************************************************************
|
||||||
function sc_download_cat_main_name() {
|
function sc_download_cat_main_name()
|
||||||
global $tp, $dlrow;
|
|
||||||
return $tp->toHTML($dlrow['download_category_name'], FALSE, 'TITLE');
|
|
||||||
}
|
|
||||||
function sc_download_cat_main_description() {
|
|
||||||
global $tp, $dlrow;
|
|
||||||
return $tp->toHTML($dlrow['download_category_description'], TRUE, 'DESCRIPTION');
|
|
||||||
}
|
|
||||||
function sc_download_cat_main_icon() {
|
|
||||||
global $dlrow;
|
|
||||||
// Pass count as 1 to force non-empty icon
|
|
||||||
return $this->_sc_cat_icons($dlrow['download_category_icon'], 1, $dlrow['download_category_name']);
|
|
||||||
}
|
|
||||||
// Sub-Category ********************************************************************************
|
|
||||||
function sc_download_cat_sub_name() {
|
|
||||||
global $tp, $dlsubrow;
|
|
||||||
if ($dlsubrow['d_count'])
|
|
||||||
{
|
{
|
||||||
return "<a href='".e_PLUGIN."download/download.php?action=list&id=".$dlsubrow['download_category_id']."'>".$tp->toHTML($dlsubrow['download_category_name'], FALSE, 'TITLE')."</a>";
|
$tp = e107::getParser();
|
||||||
|
return $tp->toHTML($this->var['download_category_name'], FALSE, 'TITLE');
|
||||||
|
}
|
||||||
|
|
||||||
|
function sc_download_cat_main_description()
|
||||||
|
{
|
||||||
|
$tp = e107::getParser();
|
||||||
|
return $tp->toHTML($this->var['download_category_description'], TRUE, 'DESCRIPTION');
|
||||||
|
}
|
||||||
|
|
||||||
|
function sc_download_cat_main_icon()
|
||||||
|
{
|
||||||
|
// Pass count as 1 to force non-empty icon
|
||||||
|
return $this->_sc_cat_icons($this->var['download_category_icon'], 1, $this->var['download_category_name']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sub-Category ********************************************************************************
|
||||||
|
function sc_download_cat_sub_name()
|
||||||
|
{
|
||||||
|
$tp = e107::getParser();
|
||||||
|
if ($this->dlsubrow['d_count'])
|
||||||
|
{
|
||||||
|
return "<a href='".e_PLUGIN_ABS."download/download.php?action=list&id=".$this->dlsubrow['download_category_id']."'>".$tp->toHTML($this->dlsubrow['download_category_name'], FALSE, 'TITLE')."</a>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return $tp->toHTML($dlsubrow['download_category_name'], FALSE, 'TITLE');
|
return $tp->toHTML($this->dlsubrow['download_category_name'], FALSE, 'TITLE');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function sc_download_cat_sub_description() {
|
|
||||||
global $tp, $dlsubrow;
|
function sc_download_cat_sub_description()
|
||||||
return $tp->toHTML($dlsubrow['download_category_description'], TRUE, 'DESCRIPTION');
|
{
|
||||||
|
$tp = e107::getParser();
|
||||||
|
return $tp->toHTML($this->dlsubrow['download_category_description'], TRUE, 'DESCRIPTION');
|
||||||
}
|
}
|
||||||
function sc_download_cat_sub_icon() {
|
|
||||||
global $dlsubrow;
|
function sc_download_cat_sub_icon()
|
||||||
return $this->_sc_cat_icons($dlsubrow['download_category_icon'], $dlsubrow['d_count'], $dlsubrow['download_category_name']);
|
{
|
||||||
|
return $this->_sc_cat_icons($this->dlsubrow['download_category_icon'], $this->dlsubrow['d_count'], $this->dlsubrow['download_category_name']);
|
||||||
}
|
}
|
||||||
function sc_download_cat_sub_new_icon() {
|
|
||||||
global $dlsubrow;
|
function sc_download_cat_sub_new_icon()
|
||||||
return $this->_check_new_download($dlsubrow['d_last_subs']);
|
{
|
||||||
|
return $this->_check_new_download($this->dlsubrow['d_last_subs']);
|
||||||
}
|
}
|
||||||
function sc_download_cat_sub_count() {
|
|
||||||
global $dlsubrow;
|
function sc_download_cat_sub_count()
|
||||||
return $dlsubrow['d_count'];
|
{
|
||||||
|
return $this->dlsubrow['d_count'];
|
||||||
}
|
}
|
||||||
function sc_download_cat_sub_size() {
|
|
||||||
global $e107, $dlsubrow;
|
function sc_download_cat_sub_size()
|
||||||
return $this->e107->parseMemorySize($dlsubrow['d_size']);
|
{
|
||||||
|
return eHelper::parseMemorySize($this->dlsubrow['d_size']);
|
||||||
}
|
}
|
||||||
function sc_download_cat_sub_downloaded() {
|
|
||||||
global $dlsubrow;
|
function sc_download_cat_sub_downloaded()
|
||||||
return intval($dlsubrow['d_requests']);
|
{
|
||||||
|
return intval($this->dlsubrow['d_requests']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Sub-Sub-Category ****************************************************************************
|
// Sub-Sub-Category ****************************************************************************
|
||||||
|
|
||||||
|
|
||||||
function sc_download_cat_subsub_name() {
|
function sc_download_cat_subsub_name()
|
||||||
global $tp, $dlsubsubrow;
|
|
||||||
if ($dlsubsubrow['d_count'])
|
|
||||||
{
|
{
|
||||||
return "<a href='".e_PLUGIN."download/download.php?action=list&id=".$dlsubsubrow['download_category_id']."'>".$tp->toHTML($dlsubsubrow['download_category_name'], FALSE, 'TITLE')."</a>";
|
$tp = e107::getParser();
|
||||||
|
if ($this->dlsubsubrow['d_count'])
|
||||||
|
{
|
||||||
|
return "<a href='".e_PLUGIN_ABS."download/download.php?action=list&id=".$this->dlsubsubrow['download_category_id']."'>".$tp->toHTML($this->dlsubsubrow['download_category_name'], FALSE, 'TITLE')."</a>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return $tp->toHTML($dlsubsubrow['download_category_name'], FALSE, 'TITLE');
|
return $tp->toHTML($this->dlsubsubrow['download_category_name'], FALSE, 'TITLE');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_cat_subsub_description() {
|
function sc_download_cat_subsub_description()
|
||||||
global $tp, $dlsubsubrow;
|
{
|
||||||
return $tp->toHTML($dlsubsubrow['download_category_description'], TRUE, 'DESCRIPTION');
|
return e107::getParser()->toHTML($this->dlsubsubrow['download_category_description'], TRUE, 'DESCRIPTION');
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_cat_subsub_icon() {
|
function sc_download_cat_subsub_icon()
|
||||||
global $dlsubsubrow;
|
{
|
||||||
return $this->_sc_cat_icons($dlsubsubrow['download_category_icon'], $dlsubsubrow['d_count'], $dlsubsubrow['download_category_name']);
|
return $this->_sc_cat_icons($this->dlsubsubrow['download_category_icon'], $this->dlsubsubrow['d_count'], $this->dlsubsubrow['download_category_name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_cat_subsub_count() {
|
function sc_download_cat_subsub_count()
|
||||||
global $dlsubsubrow;
|
{
|
||||||
return $dlsubsubrow['d_count'];
|
return $this->dlsubsubrow['d_count'];
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_cat_subsub_size() {
|
function sc_download_cat_subsub_size()
|
||||||
global $e107, $dlsubsubrow;
|
{
|
||||||
return $this->e107->parseMemorySize($dlsubsubrow['d_size']);
|
return eHelper::parseMemorySize($this->dlsubsubrow['d_size']);
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_cat_subsub_downloaded() {
|
function sc_download_cat_subsub_downloaded()
|
||||||
global $dlsubsubrow;
|
{
|
||||||
return intval($dlsubsubrow['d_requests']);
|
return intval($this->dlsubsubrow['d_requests']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -216,71 +229,79 @@ class download_shortcodes extends e_shortcode
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
function sc_download_list_name()
|
function sc_download_list_name($parm='')
|
||||||
{
|
{
|
||||||
global $dlrow,$tp,$pref,$parm;
|
$tp = e107::getParser();
|
||||||
if ($parm == "nolink"){
|
$pref = e107::getPref();
|
||||||
return $tp->toHTML($dlrow['download_name'],TRUE,'LINKTEXT');
|
|
||||||
|
if ($parm == "nolink")
|
||||||
|
{
|
||||||
|
return $tp->toHTML($this->var['download_name'],TRUE,'LINKTEXT');
|
||||||
}
|
}
|
||||||
if ($parm == "request"){
|
|
||||||
|
if ($parm == "request")
|
||||||
|
{
|
||||||
$agreetext = $tp->toJS($tp->toHTML($pref['agree_text'],FALSE,'DESCRIPTION'));
|
$agreetext = $tp->toJS($tp->toHTML($pref['agree_text'],FALSE,'DESCRIPTION'));
|
||||||
if ($dlrow['download_mirror_type']){
|
|
||||||
$text = ($pref['agree_flag'] ? "<a href='".e_PLUGIN."download/download.php?mirror.".$dlrow['download_id']."' onclick= \"return confirm('{$agreetext}');\">" : "<a href='".e_PLUGIN."download/download.php?mirror.".$dlrow['download_id']."' title='".LAN_dl_32."'>");
|
if ($this->var['download_mirror_type'])
|
||||||
}else{
|
{
|
||||||
$text = ($pref['agree_flag'] ? "<a href='".e_BASE."request.php?".$dlrow['download_id']."' onclick= \"return confirm('{$agreetext}');\">" : "<a href='".e_BASE."request.php?".$dlrow['download_id']."' title='".LAN_dl_32."'>");
|
$text = ($pref['agree_flag'] ? "<a href='".e_PLUGIN_ABS."download/download.php?mirror.".$this->var['download_id']."' onclick= \"return confirm('{$agreetext}');\">" : "<a href='".e_PLUGIN_ABS."download/download.php?mirror.".$this->var['download_id']."' title='".LAN_dl_32."'>");
|
||||||
}
|
}
|
||||||
$text .= $tp->toHTML($dlrow['download_name'], FALSE, 'TITLE')."</a>";
|
else
|
||||||
|
{
|
||||||
|
$text = ($pref['agree_flag'] ? "<a href='".e_PLUGIN_ABS."download/request.php?".$this->var['download_id']."' onclick= \"return confirm('{$agreetext}');\">" : "<a href='".e_PLUGIN_ABS."download/request.php?".$this->var['download_id']."' title='".LAN_dl_32."'>");
|
||||||
|
}
|
||||||
|
|
||||||
|
$text .= $tp->toHTML($this->var['download_name'], FALSE, 'TITLE')."</a>";
|
||||||
|
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
return "<a href='".e_PLUGIN."download/download.php?action=view&id=".$dlrow['download_id']."'>".$tp->toHTML($dlrow['download_name'],TRUE,'LINKTEXT')."</a>";
|
return "<a href='".e_PLUGIN_ABS."download/download.php?action=view&id=".$this->var['download_id']."'>".$tp->toHTML($this->var['download_name'],TRUE,'LINKTEXT')."</a>";
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_list_author()
|
function sc_download_list_author()
|
||||||
{
|
{
|
||||||
global $dlrow;
|
return $this->var['download_author'];
|
||||||
return $dlrow['download_author'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_list_requested()
|
function sc_download_list_requested()
|
||||||
{
|
{
|
||||||
global $dlrow;
|
return $this->var['download_requested'];
|
||||||
return $dlrow['download_requested'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_list_newicon()
|
function sc_download_list_newicon()
|
||||||
{
|
{
|
||||||
global $dlrow;
|
return (USER && $this->var['download_datestamp'] > USERLV ? "<img src='".IMAGE_NEW."' alt='*' style='vertical-align:middle' />" : "");
|
||||||
return (USER && $dlrow['download_datestamp'] > USERLV ? "<img src='".IMAGE_NEW."' alt='*' style='vertical-align:middle' />" : "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_list_recenticon()
|
function sc_download_list_recenticon()
|
||||||
{
|
{
|
||||||
global $dlrow, $pref;
|
$pref = e107::getPref();
|
||||||
// convert "recent_download_days" to seconds
|
// convert "recent_download_days" to seconds
|
||||||
return ($dlrow['download_datestamp'] > time()-($pref['recent_download_days']*86400) ? '<img src="'.IMAGE_NEW.'" alt="" style="vertical-align:middle" />' : '');
|
return ($this->var['download_datestamp'] > time()-($pref['recent_download_days']*86400) ? '<img src="'.IMAGE_NEW.'" alt="" style="vertical-align:middle" />' : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_list_filesize()
|
function sc_download_list_filesize()
|
||||||
{
|
{
|
||||||
global $dlrow, $e107;
|
return eHelper::parseMemorySize($this->var['download_filesize']);
|
||||||
return $e107->parseMemorySize($dlrow['download_filesize']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_list_datestamp()
|
function sc_download_list_datestamp()
|
||||||
{
|
{
|
||||||
global $dlrow;
|
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
return $tp->toDate($dlrow['download_datestamp'], "short");
|
return $tp->toDate($this->var['download_datestamp'], "short");
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_list_thumb()
|
function sc_download_list_thumb($parm='')
|
||||||
{
|
{
|
||||||
global $dlrow,$parm;
|
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
|
|
||||||
$img = ($dlrow['download_thumb']) ? "<img src='".$tp->replaceConstants($dlrow['download_thumb'])."' alt='*' style='".DL_IMAGESTYLE."' />" : "";
|
$img = ($this->var['download_thumb']) ? "<img class='download-thumb' src='".$tp->replaceConstants($this->var['download_thumb'])."' alt='*' />" : "";
|
||||||
if ($parm == "link" && $dlrow['download_thumb']){
|
|
||||||
return "<a href='".e_PLUGIN."download/download.php?action=view&id=".$dlrow['download_id']."'>".$img."</a>";
|
if ($parm == "link" && $this->var['download_thumb'])
|
||||||
|
{
|
||||||
|
return "<a href='".e_PLUGIN_ABS."download/download.php?action=view&id=".$this->var['download_id']."'>".$img."</a>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -290,50 +311,44 @@ class download_shortcodes extends e_shortcode
|
|||||||
|
|
||||||
function sc_download_list_id()
|
function sc_download_list_id()
|
||||||
{
|
{
|
||||||
global $dlrow;
|
return $this->var['download_id'];
|
||||||
return $dlrow['download_id'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_list_rating()
|
function sc_download_list_rating()
|
||||||
{
|
{
|
||||||
global $dlrow;
|
return e107::getForm()->rate("download", $this->var['download_id']);
|
||||||
|
|
||||||
return e107::getForm()->rate("download", $dlrow['download_id']);
|
|
||||||
|
|
||||||
|
|
||||||
$rater = new rater();
|
|
||||||
$ratearray = $rater->getrating("download", $dlrow['download_id']);
|
|
||||||
if (!$ratearray[0]) {
|
|
||||||
return LAN_dl_13;
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
function sc_download_list_link($parm='')
|
||||||
{
|
{
|
||||||
return ($ratearray[2] ? "{$ratearray[1]}.{$ratearray[2]}/{$ratearray[0]}" : "{$ratearray[1]}/{$ratearray[0]}");
|
$tp = e107::getParser();
|
||||||
}
|
$pref = e107::getPref();
|
||||||
}
|
|
||||||
|
|
||||||
function sc_download_list_link()
|
|
||||||
{
|
|
||||||
global $tp, $dlrow, $pref, $parm;
|
|
||||||
$agreetext = $tp->toJS($tp->toHTML($pref['agree_text'],FALSE,'DESCRIPTION'));
|
$agreetext = $tp->toJS($tp->toHTML($pref['agree_text'],FALSE,'DESCRIPTION'));
|
||||||
|
|
||||||
$img = "<img src='".IMAGE_DOWNLOAD."' alt='".LAN_dl_32."' title='".LAN_dl_32."' />";
|
$img = "<img src='".IMAGE_DOWNLOAD."' alt='".LAN_dl_32."' title='".LAN_dl_32."' />";
|
||||||
if ($dlrow['download_mirror_type'])
|
|
||||||
|
if(deftrue('BOOTSTRAP'))
|
||||||
{
|
{
|
||||||
return "<a href='".e_PLUGIN."download/download.php?mirror.".$dlrow['download_id']."'>{$img}</a>";
|
$img = '<i class="icon-download"></i>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->var['download_mirror_type'])
|
||||||
|
{
|
||||||
|
return "<a class='e-tip' title='".LAN_dl_32."' href='".e_PLUGIN_ABS."download/download.php?mirror.".$this->var['download_id']."'>{$img}</a>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return ($pref['agree_flag'] ? "<a href='".e_BASE."request.php?".$dlrow['download_id']."' onclick= \"return confirm('{$agreetext}');\">{$img}</a>" : "<a href='".e_BASE."request.php?".$dlrow['download_id']."' >{$img}</a>");
|
return ($pref['agree_flag'] ? "<a class='e-tip' title='".LAN_dl_32."' href='".e_PLUGIN_ABS."download/request.php?".$this->var['download_id']."' onclick= \"return confirm('{$agreetext}');\">{$img}</a>" : "<a class='e-tip' title='".LAN_dl_32."' href='".e_PLUGIN_ABS."download/request.php?".$this->var['download_id']."' >{$img}</a>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function sc_download_list_icon()
|
function sc_download_list_icon($parm='')
|
||||||
{
|
{
|
||||||
global $dlrow,$parm;
|
if ($parm == "link")
|
||||||
if ($parm == "link"){
|
{
|
||||||
return "<a href='".e_PLUGIN."download/download.php?action=view&id=".$dlrow['download_id']."' >".$img."</a>";
|
return "<a href='".e_PLUGIN_ABS."download/download.php?action=view&id=".$this->var['download_id']."' >".$img."</a>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -342,16 +357,14 @@ class download_shortcodes extends e_shortcode
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_list_imagefull()
|
function sc_download_list_imagefull($parm='')
|
||||||
{
|
{
|
||||||
global $dlrow,$parm;
|
|
||||||
$tp = e107::getParser();
|
|
||||||
|
|
||||||
$img = ($dlrow['download_image']) ? "<img class='dl_image' src='".$tp->replaceConstants($dlrow['download_image'])."' alt='' style='".DL_IMAGESTYLE."' />" : "";
|
$img = ($this->var['download_image']) ? "<img class='download-image dl_image' src='".e107::getParser()->replaceConstants($this->var['download_image'])."' alt='' />" : "";
|
||||||
|
|
||||||
if($parm == "link" && $dlrow['download_image'])
|
if($parm == "link" && $this->var['download_image'])
|
||||||
{
|
{
|
||||||
return "<a href='".e_BASE."download.php?action=view&id=".$dlrow['download_id']."'>".$img."</a>";
|
return "<a href='".e_BASE."download.php?action=view&id=".$this->var['download_id']."'>".$img."</a>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -362,16 +375,18 @@ class download_shortcodes extends e_shortcode
|
|||||||
|
|
||||||
function sc_download_list_nextprev()
|
function sc_download_list_nextprev()
|
||||||
{
|
{
|
||||||
global $nextprev_parms,$tp;
|
global $nextprev_parms;
|
||||||
return $tp->parseTemplate("{NEXTPREV={$nextprev_parms}}");
|
return e107::getParser()->parseTemplate("{NEXTPREV={$nextprev_parms}}");
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_list_total_amount() {
|
function sc_download_list_total_amount()
|
||||||
|
{
|
||||||
global $dltdownloads;
|
global $dltdownloads;
|
||||||
return intval($dltdownloads)." ".LAN_dl_16;
|
return intval($dltdownloads)." ".LAN_dl_16;
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_list_total_files() {
|
function sc_download_list_total_files()
|
||||||
|
{
|
||||||
global $dlft;
|
global $dlft;
|
||||||
return intval($dlft)." ".LAN_dl_17;
|
return intval($dlft)." ".LAN_dl_17;
|
||||||
}
|
}
|
||||||
@@ -384,22 +399,23 @@ class download_shortcodes extends e_shortcode
|
|||||||
|
|
||||||
function sc_download_view_id()
|
function sc_download_view_id()
|
||||||
{
|
{
|
||||||
global $dlrow;
|
return $this->var['download_id'];
|
||||||
return $dlrow['download_id'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_admin_edit()
|
function sc_download_admin_edit()
|
||||||
{
|
{
|
||||||
global $dlrow;
|
return (ADMIN && getperms('6')) ? "<a href='".e_ADMIN."download.php?create.edit.".$this->var['download_id']."' title='edit'><img src='".e_IMAGE."generic/lite/edit.png' alt='*' style='padding:0px;border:0px' /></a>" : "";
|
||||||
return (ADMIN && getperms('6')) ? "<a href='".e_ADMIN."download.php?create.edit.".$dlrow['download_id']."' title='edit'><img src='".e_IMAGE."generic/lite/edit.png' alt='*' style='padding:0px;border:0px' /></a>" : "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_category()
|
function sc_download_category()
|
||||||
{
|
{
|
||||||
global $dlrow;
|
return $this->var['download_category_name'];
|
||||||
return $dlrow['download_category_name'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_category_description()
|
function sc_download_category_description()
|
||||||
{
|
{
|
||||||
global $tp,$dl,$parm;
|
global $tp,$dl,$parm;
|
||||||
|
|
||||||
$text = $tp -> toHTML($dl['download_category_description'], TRUE,'DESCRIPTION');
|
$text = $tp -> toHTML($dl['download_category_description'], TRUE,'DESCRIPTION');
|
||||||
if ($parm){
|
if ($parm){
|
||||||
return substr($text,0,$parm);
|
return substr($text,0,$parm);
|
||||||
@@ -407,128 +423,164 @@ class download_shortcodes extends e_shortcode
|
|||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function sc_download_view_name()
|
function sc_download_view_name($parm='')
|
||||||
{
|
{
|
||||||
global $dlrow,$parm;
|
|
||||||
$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];
|
|
||||||
}
|
|
||||||
return $dlrow['download_name'];
|
|
||||||
}
|
|
||||||
function sc_download_view_name_linked()
|
|
||||||
{
|
|
||||||
global $pref,$dl,$tp;
|
|
||||||
if ($pref['agree_flag'] == 1) {
|
|
||||||
return "<a href='".e_BASE."request.php?".$dl['download_id']."' onclick= \"return confirm('".$tp->toJS($tp->toHTML($pref['agree_text'],FALSE,'DESCRIPTION'))."');\" title='".LAN_dl_46."'>".$dl['download_name']."</a>";
|
|
||||||
} else {
|
|
||||||
return "<a href='".e_BASE."request.php?".$dl['download_id']."' title='".LAN_dl_46."'>".$dl['download_name']."</a>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function sc_download_view_author()
|
|
||||||
{
|
|
||||||
global $dlrow;
|
|
||||||
return ($dlrow['download_author'] ? $dlrow['download_author'] : "");
|
|
||||||
}
|
|
||||||
function sc_download_view_authoremail()
|
|
||||||
{
|
|
||||||
global $tp,$dlrow;
|
|
||||||
return ($dlrow['download_author_email']) ? $tp -> toHTML($dlrow['download_author_email'], TRUE, 'LINKTEXT') : "";
|
|
||||||
}
|
|
||||||
function sc_download_view_authorwebsite()
|
|
||||||
{
|
|
||||||
global $tp,$dlrow;
|
|
||||||
return ($dlrow['download_author_website']) ? $tp -> toHTML($dlrow['download_author_website'], TRUE,'LINKTEXT') : "";
|
|
||||||
}
|
|
||||||
function sc_download_view_description()
|
|
||||||
{
|
|
||||||
global $tp,$dlrow,$parm;
|
|
||||||
$maxlen = ($parm ? intval($parm) : 0);
|
|
||||||
$text = ($dlrow['download_description'] ? $tp->toHTML($dlrow['download_description'], TRUE, 'DESCRIPTION') : "");
|
|
||||||
if ($maxlen){
|
|
||||||
return substr($text, 0, $maxlen);
|
|
||||||
}else{
|
|
||||||
return $text;
|
|
||||||
}
|
|
||||||
return $text;
|
|
||||||
}
|
|
||||||
function sc_download_view_date()
|
|
||||||
{
|
|
||||||
global $gen,$dlrow,$parm;
|
|
||||||
$tp = e107::getParser();
|
|
||||||
return ($dlrow['download_datestamp']) ? $tp->toDate($dlrow['download_datestamp'], $parm) : "";
|
|
||||||
}
|
|
||||||
function sc_download_view_date_short()
|
|
||||||
{
|
|
||||||
// deprecated: DOWNLOAD_VIEW_DATE should be used instead.
|
|
||||||
global $gen,$dlrow;
|
|
||||||
return ($dlrow['download_datestamp']) ? $gen->convert_date($dlrow['download_datestamp'], "short") : "";
|
|
||||||
}
|
|
||||||
function sc_download_view_date_long()
|
|
||||||
{
|
|
||||||
// deprecated: DOWNLOAD_VIEW_DATE should be used instead.
|
|
||||||
global $gen,$dlrow;
|
|
||||||
return ($dlrow['download_datestamp']) ? $gen->convert_date($dlrow['download_datestamp'], "long") : "";
|
|
||||||
}
|
|
||||||
function sc_download_view_image()
|
|
||||||
{
|
|
||||||
global $dlrow;
|
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
|
|
||||||
if ($dlrow['download_thumb']) {
|
$link['view'] = "<a href='".e_PLUGIN_ABS."download/download.php?action=view&id=".$this->var['download_id']."'>".$this->var['download_name']."</a>";
|
||||||
return ($dlrow['download_image'] ? "<a href='".e_BASE."request.php?download.".$dlrow['download_id']."'><img class='dl_image' src='".$tp->replaceConstants($dlrow['download_thumb'])."' alt='*' style='".DL_IMAGESTYLE."' /></a>" : "<img class='dl_image' src='".$tp->replaceConstants($dlrow['download_thumb'])."' alt='*' style='".DL_IMAGESTYLE."' />");
|
$link['request'] = "<a href='".e_PLUGIN_ABS."download/request.php?".$this->var['download_id']."' title='".LAN_dl_46."'>".$this->var['download_name']."</a>";
|
||||||
|
|
||||||
|
if ($parm)
|
||||||
|
{
|
||||||
|
return $tp->toHTML($link[$parm],true, 'TITLE');
|
||||||
}
|
}
|
||||||
else if ($dlrow['download_image']) {
|
|
||||||
return "<a href='".e_BASE."request.php?download.".$dlrow['download_id']."'>".LAN_dl_40."</a>";
|
return $this->var['download_name'];
|
||||||
|
}
|
||||||
|
|
||||||
|
function sc_download_view_name_linked()
|
||||||
|
{
|
||||||
|
global $dl;
|
||||||
|
$tp = e107::getParser();
|
||||||
|
$pref = e107::getPref();
|
||||||
|
|
||||||
|
if ($pref['agree_flag'] == 1)
|
||||||
|
{
|
||||||
|
return "<a href='".e_PLUGIN_ABS."download/request.php?".$dl['download_id']."' onclick= \"return confirm('".$tp->toJS($tp->toHTML($pref['agree_text'],FALSE,'DESCRIPTION'))."');\" title='".LAN_dl_46."'>".$dl['download_name']."</a>";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return "<a href='".e_PLUGIN_ABS."download/request.php?".$dl['download_id']."' title='".LAN_dl_46."'>".$dl['download_name']."</a>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function sc_download_view_author()
|
||||||
|
{
|
||||||
|
return ($this->var['download_author'] ? $this->var['download_author'] : "");
|
||||||
|
}
|
||||||
|
|
||||||
|
function sc_download_view_authoremail()
|
||||||
|
{
|
||||||
|
return ($this->var['download_author_email']) ? e107::getParser()->toHTML($this->var['download_author_email'], TRUE, 'LINKTEXT') : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function sc_download_view_authorwebsite()
|
||||||
|
{
|
||||||
|
return ($this->var['download_author_website']) ? e107::getParser()->toHTML($this->var['download_author_website'], TRUE,'LINKTEXT') : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function sc_download_view_description($parm='')
|
||||||
|
{
|
||||||
|
$maxlen = ($parm ? intval($parm) : 0);
|
||||||
|
$text = ($this->var['download_description'] ? e107::getParser()->toHTML($this->var['download_description'], TRUE, 'DESCRIPTION') : "");
|
||||||
|
|
||||||
|
if ($maxlen)
|
||||||
|
{
|
||||||
|
return substr($text, 0, $maxlen);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
|
|
||||||
|
function sc_download_view_date($parm='')
|
||||||
|
{
|
||||||
|
return ($this->var['download_datestamp']) ? e107::getParser()->toDate($this->var['download_datestamp'], $parm) : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Deprecated DOWNLOAD_VIEW_DATE should be used instead.
|
||||||
|
*/
|
||||||
|
function sc_download_view_date_short()
|
||||||
|
{
|
||||||
|
return $this->sc_download_view_date('short');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Deprecated DOWNLOAD_VIEW_DATE should be used instead.
|
||||||
|
*/
|
||||||
|
function sc_download_view_date_long()
|
||||||
|
{
|
||||||
|
return $this->sc_download_view_date('long');
|
||||||
|
}
|
||||||
|
|
||||||
|
function sc_download_view_image()
|
||||||
|
{
|
||||||
|
$tp = e107::getParser();
|
||||||
|
|
||||||
|
if ($this->var['download_thumb'])
|
||||||
|
{
|
||||||
|
return ($this->var['download_image'] ? "<a href='".e_PLUGIN_ABS."download/request.php?download.".$this->var['download_id']."'><img class='download-image dl_image' src='".$tp->replaceConstants($this->var['download_thumb'])."' alt='*' /></a>" : "<img class='download-image dl_image' src='".$tp->replaceConstants($this->var['download_thumb'])."' alt='*' />");
|
||||||
|
}
|
||||||
|
elseif ($this->var['download_image'])
|
||||||
|
{
|
||||||
|
return "<a href='".e_PLUGIN_ABS."download/request.php?download.".$this->var['download_id']."'>".LAN_dl_40."</a>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return LAN_dl_75;
|
return LAN_dl_75;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_view_imagefull()
|
function sc_download_view_imagefull()
|
||||||
{
|
{
|
||||||
global $dlrow;
|
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
return ($dlrow['download_image']) ? "<img class='dl_image' src='".$tp->replaceConstants($dlrow['download_image'])."' alt='*' style='".DL_IMAGESTYLE."' />" : "";
|
return ($this->var['download_image']) ? "<img class='download-image dl_image' src='".$tp->replaceConstants($this->var['download_image'])."' alt='*' />" : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_view_link()
|
function sc_download_view_link()
|
||||||
{
|
{
|
||||||
global $pref,$dlrow,$tp;
|
$tp = e107::getParser();
|
||||||
|
$pref = e107::getPref();
|
||||||
|
|
||||||
$click = "";
|
$click = "";
|
||||||
if ($pref['agree_flag'] == 1) {
|
|
||||||
|
$img = "<img src='".IMAGE_DOWNLOAD."' alt='".LAN_dl_32."' title='".LAN_dl_32."' />";
|
||||||
|
|
||||||
|
if(deftrue('BOOTSTRAP'))
|
||||||
|
{
|
||||||
|
$img = '<i class="icon-download"></i>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($pref['agree_flag'] == 1)
|
||||||
|
{
|
||||||
$click = " onclick='return confirm(\"".$tp->toJS($tp->toHTML($pref['agree_text'],true,'emotes, no_tags'))."\")'";
|
$click = " onclick='return confirm(\"".$tp->toJS($tp->toHTML($pref['agree_text'],true,'emotes, no_tags'))."\")'";
|
||||||
}
|
}
|
||||||
$dnld_link = "<a href='".e_BASE."request.php?".$dlrow['download_id']."'{$click}>";
|
$dnld_link = "<a href='".e_PLUGIN_ABS."download/request.php?".$this->var['download_id']."'{$click}>";
|
||||||
if ($dlrow['download_mirror'])
|
|
||||||
|
if ($this->var['download_mirror'])
|
||||||
{
|
{
|
||||||
if ($dlrow['download_mirror_type'])
|
if ($this->var['download_mirror_type'])
|
||||||
{
|
{
|
||||||
return "<a href='".e_PLUGIN."download/download.php?mirror.".$dlrow['download_id']."'>".LAN_dl_66."</a>";
|
return "<a href='".e_PLUGIN_ABS."download/download.php?mirror.".$this->var['download_id']."'>".LAN_dl_66."</a>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return $dnld_link."<img src='".IMAGE_DOWNLOAD."' alt='*' /></a>";
|
return $dnld_link.$img."</a>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return $dnld_link."<img src='".IMAGE_DOWNLOAD."' alt='*' /></a>";
|
return $dnld_link.$img."</a>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_view_filesize()
|
function sc_download_view_filesize()
|
||||||
{
|
{
|
||||||
global $dlrow, $e107;
|
return ($this->var['download_filesize']) ? eHelper::parseMemorySize($this->var['download_filesize']) : "";
|
||||||
return ($dlrow['download_filesize']) ? $e107->parseMemorySize($dlrow['download_filesize']) : "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_view_rating()
|
function sc_download_view_rating()
|
||||||
{
|
{
|
||||||
global $dlrow;
|
|
||||||
$frm = e107::getForm();
|
$frm = e107::getForm();
|
||||||
$options = array('label'=>' ','template'=>'RATE|VOTES|STATUS');
|
$options = array('label'=>' ','template'=>'RATE|VOTES|STATUS');
|
||||||
return $frm->rate("download", $dlrow['download_id'],$options);
|
return $frm->rate("download", $this->var['download_id'], $options);
|
||||||
|
|
||||||
|
/*
|
||||||
require_once(e_HANDLER."rate_class.php");
|
require_once(e_HANDLER."rate_class.php");
|
||||||
$rater = new rater;
|
$rater = new rater;
|
||||||
|
|
||||||
@@ -536,7 +588,7 @@ class download_shortcodes extends e_shortcode
|
|||||||
<table style='width:100%'>
|
<table style='width:100%'>
|
||||||
<tr>
|
<tr>
|
||||||
<td style='width:50%'>";
|
<td style='width:50%'>";
|
||||||
if ($ratearray = $rater->getrating("download", $dlrow['download_id'])) {
|
if ($ratearray = $rater->getrating("download", $this->var['download_id'])) {
|
||||||
for($c = 1; $c <= $ratearray[1]; $c++) {
|
for($c = 1; $c <= $ratearray[1]; $c++) {
|
||||||
$text .= "<img src='".e_IMAGE."rate/star.png' alt='*' />";
|
$text .= "<img src='".e_IMAGE."rate/star.png' alt='*' />";
|
||||||
}
|
}
|
||||||
@@ -552,8 +604,8 @@ class download_shortcodes extends e_shortcode
|
|||||||
$text .= LAN_dl_13;
|
$text .= LAN_dl_13;
|
||||||
}
|
}
|
||||||
$text .= "</td><td style='width:50%; text-align:right'>";
|
$text .= "</td><td style='width:50%; text-align:right'>";
|
||||||
if (!$rater->checkrated("download", $dlrow['download_id']) && USER) {
|
if (!$rater->checkrated("download", $this->var['download_id']) && USER) {
|
||||||
$text .= $rater->rateselect(" <b>".LAN_dl_14, "download", $dlrow['download_id'])."</b>";
|
$text .= $rater->rateselect(" <b>".LAN_dl_14, "download", $this->var['download_id'])."</b>";
|
||||||
}
|
}
|
||||||
else if (!USER) {
|
else if (!USER) {
|
||||||
$text .= " ";
|
$text .= " ";
|
||||||
@@ -562,18 +614,19 @@ class download_shortcodes extends e_shortcode
|
|||||||
}
|
}
|
||||||
$text .= "</td></tr></table>";
|
$text .= "</td></tr></table>";
|
||||||
return $text;
|
return $text;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_report_link()
|
function sc_download_report_link()
|
||||||
{
|
{
|
||||||
global $dlrow,$pref;
|
$pref = e107::getPref();
|
||||||
return (check_class($pref['download_reportbroken'])) ? "<a href='".e_PLUGIN."download/download.php?action=report&id=".$dlrow['download_id']."'>".LAN_dl_45."</a>" : "";
|
return (check_class($pref['download_reportbroken'])) ? "<a href='".e_PLUGIN_ABS."download/download.php?action=report&id=".$this->var['download_id']."'>".LAN_dl_45."</a>" : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_view_caption()
|
function sc_download_view_caption()
|
||||||
{
|
{
|
||||||
global $dlrow;
|
$text = $this->var['download_category_name'];
|
||||||
$text = $dlrow['download_category_name'];
|
$text .= ($this->var['download_category_description']) ? " [ ".$this->var['download_category_description']." ]" : "";
|
||||||
$text .= ($dlrow['download_category_description']) ? " [ ".$dlrow['download_category_description']." ]" : "";
|
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -582,65 +635,65 @@ class download_shortcodes extends e_shortcode
|
|||||||
|
|
||||||
function sc_download_mirror_request()
|
function sc_download_mirror_request()
|
||||||
{
|
{
|
||||||
global $dlrow;
|
return $this->var['download_name'];
|
||||||
return $dlrow['download_name'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_mirror_request_icon()
|
function sc_download_mirror_request_icon()
|
||||||
{
|
{
|
||||||
global $dlrow;
|
return ($this->var['download_thumb'] ? "<img src='".e107::getParser()->replaceConstants($this->var['download_thumb'])."' alt='*'/>" : "");
|
||||||
$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='{$this->mirror['dlmirror']['mirror_url']}' rel='external'>".$this->mirror['dlmirror']['mirror_name']."</a>";
|
||||||
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();
|
$tp = e107::getParser();
|
||||||
return ($dlmirror['mirror_image'] ? "<a href='{$dlmirror['mirror_url']}' rel='external'><img src='".$tp->replaceConstants($dlmirror['mirror_image'])."' alt='*'/></a>" : "");
|
return ($this->mirror['dlmirror']['mirror_image'] ? "<a href='{$this->mirror['dlmirror']['mirror_url']}' rel='external'><img src='".$tp->replaceConstants($this->mirror['dlmirror']['mirror_image'])."' alt='*'/></a>" : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_mirror_location() {
|
function sc_download_mirror_location()
|
||||||
global $dlmirror;
|
{
|
||||||
return ($dlmirror['mirror_location'] ? $dlmirror['mirror_location'] : "");
|
return ($this->mirror['dlmirror']['mirror_location'] ? $this->mirror['dlmirror']['mirror_location'] : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_mirror_description()
|
function sc_download_mirror_description()
|
||||||
{
|
{
|
||||||
global $dlmirror,$tp;
|
return ($this->mirror['dlmirror']['mirror_description'] ? e107::getParser()->toHTML($this->mirror['dlmirror']['mirror_description'], TRUE) : "");
|
||||||
return ($dlmirror['mirror_description'] ? $tp->toHTML($dlmirror['mirror_description'], TRUE) : "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_mirror_filesize()
|
function sc_download_mirror_filesize()
|
||||||
{
|
{
|
||||||
global $e107, $dlmirrorfile;
|
return eHelper::parseMemorySize($this->mirror['dlmirrorfile'][3]);
|
||||||
return $e107->parseMemorySize($dlmirrorfile[3]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_mirror_link()
|
function sc_download_mirror_link()
|
||||||
{
|
{
|
||||||
global $dlrow, $dlmirrorfile, $tp, $pref;
|
$tp = e107::getParser();
|
||||||
|
$pref = e107::getPref();
|
||||||
|
|
||||||
$click = " onclick='return confirm(\"".$tp->toJS($tp->toHTML($pref['agree_text'],FALSE,'DESCRIPTION'))."\")'";
|
$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>";
|
$img = "<img src='".IMAGE_DOWNLOAD."' alt='".LAN_dl_32."' title='".LAN_dl_32."' />";
|
||||||
|
|
||||||
|
if(deftrue('BOOTSTRAP'))
|
||||||
|
{
|
||||||
|
$img = '<i class="icon-download"></i>';
|
||||||
|
}
|
||||||
|
|
||||||
|
return "<a href='".e_PLUGIN_ABS."download/download.php?mirror.{$this->var['download_id']}.{$this->mirror['dlmirrorfile'][0]}' title='".LAN_dl_32."'{$click}>".$img."</a>";
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_mirror_requests()
|
function sc_download_mirror_requests()
|
||||||
{
|
{
|
||||||
global $dlmirrorfile;
|
return (ADMIN ? LAN_dl_73.$this->mirror['dlmirrorfile'][2] : "");
|
||||||
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.$this->mirror['dlmirror']['mirror_count'] : "");
|
||||||
return (ADMIN ? LAN_dl_74.$dlmirror['mirror_count'] : "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -648,26 +701,26 @@ class download_shortcodes extends e_shortcode
|
|||||||
|
|
||||||
function sc_download_view_author_lan()
|
function sc_download_view_author_lan()
|
||||||
{
|
{
|
||||||
global $dlrow;
|
|
||||||
return ($dlrow['download_author']) ? LAN_dl_24 : "";
|
return ($this->var['download_author']) ? LAN_dl_24 : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_view_authoremail_lan()
|
function sc_download_view_authoremail_lan()
|
||||||
{
|
{
|
||||||
global $dlrow;
|
|
||||||
return ($dlrow['download_author_email']) ? LAN_dl_30 : "";
|
return ($this->var['download_author_email']) ? LAN_dl_30 : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_view_authorwebsite_lan()
|
function sc_download_view_authorwebsite_lan()
|
||||||
{
|
{
|
||||||
global $dlrow;
|
|
||||||
return ($dlrow['download_author_website']) ? LAN_dl_31 : "";
|
return ($this->var['download_author_website']) ? LAN_dl_31 : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_view_date_lan()
|
function sc_download_view_date_lan()
|
||||||
{
|
{
|
||||||
global $dlrow;
|
|
||||||
return ($dlrow['download_datestamp']) ? LAN_dl_22 : "";
|
return ($this->var['download_datestamp']) ? LAN_dl_22 : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_view_image_lan()
|
function sc_download_view_image_lan()
|
||||||
@@ -677,8 +730,8 @@ class download_shortcodes extends e_shortcode
|
|||||||
|
|
||||||
function sc_download_view_requested()
|
function sc_download_view_requested()
|
||||||
{
|
{
|
||||||
global $dlrow;
|
|
||||||
return $dlrow['download_requested'];
|
return $this->var['download_requested'];
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_view_rating_lan()
|
function sc_download_view_rating_lan()
|
||||||
@@ -711,33 +764,43 @@ class download_shortcodes extends e_shortcode
|
|||||||
|
|
||||||
function sc_download_view_prev()
|
function sc_download_view_prev()
|
||||||
{
|
{
|
||||||
global $dlrow,$sql;
|
$sql = e107::getDb();
|
||||||
$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")) {
|
$dlrow_id = intval($this->var['download_id']);
|
||||||
$dlrowrow = $sql->db_Fetch();
|
|
||||||
return "<a href='".e_PLUGIN."download/download.php?action=view&id=".$dlrowrow['download_id']."'><< ".LAN_dl_33." [".$dlrowrow['download_name']."]</a>\n";
|
if ($sql->select("download", "*", "download_category='".intval($this->var['download_category_id'])."' AND download_id < {$dlrow_id} AND download_active > 0 && download_visible IN (".USERCLASS_LIST.") ORDER BY download_datestamp DESC LIMIT 1"))
|
||||||
} else {
|
{
|
||||||
|
$dlrowrow = $sql->fetch();
|
||||||
|
|
||||||
|
return "<a href='".e_PLUGIN_ABS."download/download.php?action=view&id=".$dlrowrow['download_id']."'><< ".LAN_dl_33." [".$dlrowrow['download_name']."]</a>\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
return " ";
|
return " ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_view_next()
|
function sc_download_view_next()
|
||||||
{
|
{
|
||||||
global $dlrow,$sql;
|
$sql = e107::getDb();
|
||||||
$dlrow_id = intval($dlrow['download_id']);
|
$dlrow_id = intval($this->var['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 ASC LIMIT 1")) {
|
|
||||||
$dlrowrow = $sql->db_Fetch();
|
if ($sql->select("download", "*", "download_category='".intval($this->var['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->fetch();
|
||||||
extract($dlrowrow);
|
extract($dlrowrow);
|
||||||
return "<a href='".e_PLUGIN."download/download.php?action=view&id=".$dlrowrow['download_id']."'>[".$dlrowrow['download_name']."] ".LAN_dl_34." >></a>\n";
|
|
||||||
} else {
|
return "<a href='".e_PLUGIN_ABS."download/download.php?action=view&id=".$dlrowrow['download_id']."'>[".$dlrowrow['download_name']."] ".LAN_dl_34." >></a>\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
return " ";
|
return " ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_back_to_list()
|
function sc_download_back_to_list()
|
||||||
{
|
{
|
||||||
global $dlrow;
|
return "<a class='btn' href='".e_PLUGIN_ABS."download/download.php?action=list&id=".$this->var['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()
|
function sc_download_back_to_category_list()
|
||||||
|
@@ -13,16 +13,12 @@ if (!e107::isInstalled('download')) { exit(); }
|
|||||||
class download
|
class download
|
||||||
{
|
{
|
||||||
|
|
||||||
var $e107;
|
|
||||||
|
|
||||||
private $qry = array();
|
private $qry = array();
|
||||||
|
|
||||||
private $orderOptions = array('download_id','download_datestamp','download_filesize','download_name','download_author','download_requested');
|
private $orderOptions = array('download_id','download_datestamp','download_filesize','download_name','download_author','download_requested');
|
||||||
|
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
$this->e107 = e107::getInstance();
|
|
||||||
|
|
||||||
|
|
||||||
require_once(e_PLUGIN."download/download_shortcodes.php");
|
require_once(e_PLUGIN."download/download_shortcodes.php");
|
||||||
}
|
}
|
||||||
@@ -31,21 +27,31 @@ class download
|
|||||||
{
|
{
|
||||||
|
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
|
$pref = e107::getPref();
|
||||||
|
|
||||||
$tmp = explode('.', e_QUERY);
|
$tmp = explode('.', e_QUERY);
|
||||||
|
|
||||||
$pref = e107::getPref();
|
|
||||||
|
|
||||||
// Set Defaults
|
// Set Defaults
|
||||||
|
$this->qry['action'] = 'maincats';
|
||||||
$this->qry['order'] = vartrue($pref['download_order'],'download_datestamp');
|
$this->qry['order'] = vartrue($pref['download_order'],'download_datestamp');
|
||||||
$this->qry['sort'] = vartrue($pref['download_sort'], 'desc');
|
$this->qry['sort'] = vartrue($pref['download_sort'], 'desc');
|
||||||
$this->qry['view'] = vartrue($pref['download_view'], 10);
|
$this->qry['view'] = vartrue($pref['download_view'], 10);
|
||||||
|
$this->qry['from'] = 0;
|
||||||
|
|
||||||
|
// v2.x
|
||||||
// v1.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';
|
||||||
|
$this->qry['from'] = vartrue($_GET['from'],0);
|
||||||
|
}
|
||||||
|
else // v1.x Legacy URL support.
|
||||||
|
{
|
||||||
if (is_numeric($tmp[0])) //legacy // $tmp[0] at least must be valid
|
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['action'] = varset(preg_replace("#\W#", "", $tp->toDB($tmp[1])),'list');
|
||||||
$this->qry['id'] = intval($tmp[2]);
|
$this->qry['id'] = intval($tmp[2]);
|
||||||
$this->qry['view'] = intval($tmp[3]);
|
$this->qry['view'] = intval($tmp[3]);
|
||||||
@@ -56,18 +62,9 @@ class download
|
|||||||
{
|
{
|
||||||
$this->qry['action'] = preg_replace("#\W#", "", $tp->toDB($tmp[0]));
|
$this->qry['action'] = preg_replace("#\W#", "", $tp->toDB($tmp[0]));
|
||||||
$this->qry['id'] = intval($tmp[1]);
|
$this->qry['id'] = intval($tmp[1]);
|
||||||
// $errnum = intval(varset($tmp[2],0));
|
$this->qry['error'] = 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
|
// v1.x
|
||||||
@@ -82,11 +79,62 @@ class download
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function renderCategories()
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-detected Render of the appropriate download page.
|
||||||
|
*/
|
||||||
|
public function render()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$pref = e107::getPref();
|
||||||
|
|
||||||
|
if($this->qry['action'] == 'maincats')
|
||||||
|
{
|
||||||
|
return $this->renderCategories();
|
||||||
|
}
|
||||||
|
|
||||||
|
if($this->qry['action'] == 'list')
|
||||||
|
{
|
||||||
|
return $this->renderList();
|
||||||
|
}
|
||||||
|
|
||||||
|
if($this->qry['action'] == 'view')
|
||||||
|
{
|
||||||
|
return $this->renderView();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->qry['action'] == "report" && check_class($pref['download_reportbroken']))
|
||||||
|
{
|
||||||
|
return $this->renderReport();
|
||||||
|
}
|
||||||
|
|
||||||
|
if($this->qry['action'] == 'mirror')
|
||||||
|
{
|
||||||
|
return $this->renderMirror();
|
||||||
|
}
|
||||||
|
|
||||||
|
if($this->qry['action'] == 'error')
|
||||||
|
{
|
||||||
|
return $this->renderError();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render Download Categories.
|
||||||
|
* @todo Cache
|
||||||
|
*/
|
||||||
|
private function renderCategories()
|
||||||
|
{
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
$ns = e107::getRender();
|
$ns = e107::getRender();
|
||||||
|
$pref = e107::getPref();
|
||||||
|
|
||||||
|
|
||||||
// if ($cacheData = $e107cache->retrieve("download_cat".$maincatval,720)) // expires every 12 hours. //TODO make this an option
|
// if ($cacheData = $e107cache->retrieve("download_cat".$maincatval,720)) // expires every 12 hours. //TODO make this an option
|
||||||
@@ -128,7 +176,8 @@ class download
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$download_shortcodes = new download_shortcodes;
|
$download_shortcodes = e107::getScBatch('download',true);
|
||||||
|
$download_shortcodes->wrapper('download/categories');
|
||||||
$download_shortcodes->qry = $this->qry;
|
$download_shortcodes->qry = $this->qry;
|
||||||
|
|
||||||
|
|
||||||
@@ -140,25 +189,25 @@ class download
|
|||||||
|
|
||||||
if ($dlcat->down_count == 0)
|
if ($dlcat->down_count == 0)
|
||||||
{
|
{
|
||||||
$ns->tablerender(LAN_dl_18, "<div style='text-align:center'>".LAN_dl_2."</div>");
|
return $ns->tablerender(LAN_dl_18, "<div style='text-align:center'>".LAN_dl_2."</div>",'download-categories',true);
|
||||||
return;
|
|
||||||
// require_once(FOOTERF);
|
|
||||||
// exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
global $dlrow, $dlsubrow;
|
|
||||||
|
|
||||||
$download_cat_table_string = "";
|
$download_cat_table_string = "";
|
||||||
foreach($dlcat->cat_tree as $dlrow) // Display main category headings, then sub-categories, optionally with sub-sub categories expanded
|
foreach($dlcat->cat_tree as $dlrow) // Display main category headings, then sub-categories, optionally with sub-sub categories expanded
|
||||||
{
|
{
|
||||||
|
$download_shortcodes->setVars($dlrow);
|
||||||
$download_cat_table_string .= $tp->parseTemplate($DOWNLOAD_CAT_PARENT_TABLE, TRUE, vartrue($download_shortcodes));
|
$download_cat_table_string .= $tp->parseTemplate($DOWNLOAD_CAT_PARENT_TABLE, TRUE, vartrue($download_shortcodes));
|
||||||
|
|
||||||
foreach($dlrow['subcats'] as $dlsubrow)
|
foreach($dlrow['subcats'] as $dlsubrow)
|
||||||
{
|
{
|
||||||
|
$download_shortcodes->dlsubrow = $dlsubrow;
|
||||||
|
|
||||||
|
|
||||||
$download_cat_table_string .= $tp->parseTemplate($DOWNLOAD_CAT_CHILD_TABLE, TRUE, $download_shortcodes);
|
$download_cat_table_string .= $tp->parseTemplate($DOWNLOAD_CAT_CHILD_TABLE, TRUE, $download_shortcodes);
|
||||||
|
|
||||||
foreach($dlsubrow['subsubcats'] as $dlsubsubrow)
|
foreach($dlsubrow['subsubcats'] as $dlsubsubrow)
|
||||||
{
|
{
|
||||||
|
$download_shortcodes->dlsubsubrow = $dlsubsubrow;
|
||||||
$download_cat_table_string .= $tp->parseTemplate($DOWNLOAD_CAT_SUBSUB_TABLE, TRUE, $download_shortcodes);
|
$download_cat_table_string .= $tp->parseTemplate($DOWNLOAD_CAT_SUBSUB_TABLE, TRUE, $download_shortcodes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -172,7 +221,7 @@ class download
|
|||||||
|
|
||||||
//ob_start();
|
//ob_start();
|
||||||
|
|
||||||
$ns->tablerender($caption, $dl_text);
|
return $ns->tablerender($caption, $dl_text, 'download-categories',true);
|
||||||
|
|
||||||
// $cache_data = ob_get_flush();
|
// $cache_data = ob_get_flush();
|
||||||
// $e107cache->set("download_cat".$maincatval, $cache_data);
|
// $e107cache->set("download_cat".$maincatval, $cache_data);
|
||||||
@@ -188,8 +237,11 @@ class download
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
public function renderView()
|
* Render a single download
|
||||||
|
* @todo cache
|
||||||
|
*/
|
||||||
|
private function renderView()
|
||||||
{
|
{
|
||||||
if(deftrue('BOOTSTRAP')) // v2.x
|
if(deftrue('BOOTSTRAP')) // v2.x
|
||||||
{
|
{
|
||||||
@@ -199,7 +251,7 @@ class download
|
|||||||
$DOWNLOAD_VIEW_TABLE = $template['item'];
|
$DOWNLOAD_VIEW_TABLE = $template['item'];
|
||||||
$DOWNLOAD_VIEW_TABLE_END = varset($template['end']);
|
$DOWNLOAD_VIEW_TABLE_END = varset($template['end']);
|
||||||
$DL_VIEW_NEXTPREV = varset($template['nextprev']);
|
$DL_VIEW_NEXTPREV = varset($template['nextprev']);
|
||||||
$DL_VIEW_PAGETITLE = varset($template['pagetitle']);
|
// $DL_VIEW_PAGETITLE = varset($template['pagetitle']);
|
||||||
$DL_VIEW_CAPTION = varset($template['caption'],"{DOWNLOAD_VIEW_CAPTION}");
|
$DL_VIEW_CAPTION = varset($template['caption'],"{DOWNLOAD_VIEW_CAPTION}");
|
||||||
}
|
}
|
||||||
else // Legacy v1.x
|
else // Legacy v1.x
|
||||||
@@ -226,7 +278,8 @@ class download
|
|||||||
|
|
||||||
$gen = new convert;
|
$gen = new convert;
|
||||||
|
|
||||||
$download_shortcodes = new download_shortcodes;
|
$download_shortcodes = e107::getScBatch('download',true);
|
||||||
|
$download_shortcodes->wrapper('download/view');
|
||||||
$download_shortcodes->qry = $this->qry;
|
$download_shortcodes->qry = $this->qry;
|
||||||
|
|
||||||
$highlight_search = FALSE;
|
$highlight_search = FALSE;
|
||||||
@@ -246,19 +299,19 @@ class download
|
|||||||
if(!$sql->gen($query))
|
if(!$sql->gen($query))
|
||||||
{
|
{
|
||||||
//require_once(HEADERF);
|
//require_once(HEADERF);
|
||||||
$ns->tablerender(LAN_dl_18, "<div style='text-align:center'>".LAN_dl_3."</div>");
|
return $ns->tablerender(LAN_dl_18, "<div style='text-align:center'>".LAN_dl_3."</div>", 'download-view', true);
|
||||||
return;
|
|
||||||
//require_once(FOOTERF);
|
//require_once(FOOTERF);
|
||||||
//exit;
|
//exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
global $dlrow;
|
|
||||||
|
|
||||||
$dlrow = $sql->fetch();
|
$dlrow = $sql->fetch();
|
||||||
|
$download_shortcodes->setVars($dlrow);
|
||||||
|
|
||||||
$comment_edit_query = 'comment.download.'.$id;
|
$comment_edit_query = 'comment.download.'.$id;
|
||||||
|
|
||||||
if(!defined("DL_IMAGESTYLE")){ define("DL_IMAGESTYLE","border:0px");}
|
if(!defined("DL_IMAGESTYLE")){ define("DL_IMAGESTYLE","border:0px");}
|
||||||
|
|
||||||
if(!isset($DL_VIEW_PAGETITLE))
|
if(!isset($DL_VIEW_PAGETITLE))
|
||||||
{
|
{
|
||||||
$DL_VIEW_PAGETITLE = PAGE_NAME." / {DOWNLOAD_CATEGORY} / {DOWNLOAD_VIEW_NAME}";
|
$DL_VIEW_PAGETITLE = PAGE_NAME." / {DOWNLOAD_CATEGORY} / {DOWNLOAD_VIEW_NAME}";
|
||||||
@@ -294,16 +347,22 @@ class download
|
|||||||
|
|
||||||
$caption = $tp->parseTemplate($DL_VIEW_CAPTION, TRUE, $download_shortcodes);
|
$caption = $tp->parseTemplate($DL_VIEW_CAPTION, TRUE, $download_shortcodes);
|
||||||
|
|
||||||
$ns->tablerender($caption, $text);
|
$ret = $ns->tablerender($caption, $text, 'download-view', true);
|
||||||
|
|
||||||
unset($text);
|
unset($text);
|
||||||
|
|
||||||
if ($dlrow['download_comment'])
|
if ($dlrow['download_comment'])
|
||||||
{
|
{
|
||||||
e107::getComment()->compose_comment("download", "comment", $id, $width,$dlrow['download_name'], $showrate=FALSE);
|
$comments = e107::getComment()->compose_comment("download", "comment", $id, $width,$dlrow['download_name'], FALSE, true);
|
||||||
|
$ret .= $ns->tablerender($comments['caption'], $comments['comment'].$comments['comment_form'], 'download-comments', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// print_a($comments);
|
||||||
|
|
||||||
|
return $ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -316,8 +375,11 @@ class download
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
public function renderList()
|
* Render a list of files in a particular download category.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private function renderList()
|
||||||
{
|
{
|
||||||
|
|
||||||
if(deftrue('BOOTSTRAP')) // v2.x
|
if(deftrue('BOOTSTRAP')) // v2.x
|
||||||
@@ -352,14 +414,42 @@ class download
|
|||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
$ns = e107::getRender();
|
$ns = e107::getRender();
|
||||||
|
|
||||||
$download_shortcodes = new download_shortcodes;
|
// $download_shortcodes = new download_shortcodes;
|
||||||
|
$download_shortcodes = e107::getScBatch('download',true);
|
||||||
|
$download_shortcodes->wrapper('download/list');
|
||||||
$download_shortcodes->qry = $this->qry;
|
$download_shortcodes->qry = $this->qry;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//if (!isset($this->qry['from'])) $this->qry['from'] = 0;
|
||||||
|
|
||||||
|
// Get category type, page title
|
||||||
|
if ($sql->select("download_category", "download_category_name,download_category_description,download_category_parent,download_category_class", "(download_category_id='{$this->qry['id']}') AND (download_category_class IN (".USERCLASS_LIST."))") )
|
||||||
|
{
|
||||||
|
$dlrow = $sql->fetch();
|
||||||
|
$download_shortcodes->setVars($dlrow); // Used below for header / breadcrumb.
|
||||||
|
$type = $dlrow['download_category_name'];
|
||||||
|
define("e_PAGETITLE", PAGE_NAME." / ".$dlrow['download_category_name']);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ // No access to this category
|
||||||
|
define("e_PAGETITLE", PAGE_NAME);
|
||||||
|
return $ns->tablerender(LAN_dl_18, "<div class='alert alert-info' style='text-align:center'>".LAN_dl_3."</div>",'download-list',true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($dlrow['download_category_parent'] == 0) // It's a main category - change the listing type required
|
||||||
|
{
|
||||||
|
$action = 'maincats';
|
||||||
|
$maincatval = $id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$total_downloads = $sql->count("download", "(*)", "WHERE download_category = '{$this->qry['id']}' AND download_active > 0 AND download_visible REGEXP '" . e_CLASS_REGEXP . "'");
|
$total_downloads = $sql->count("download", "(*)", "WHERE download_category = '{$this->qry['id']}' AND download_active > 0 AND download_visible REGEXP '" . e_CLASS_REGEXP . "'");
|
||||||
|
|
||||||
|
|
||||||
/* SHOW SUBCATS ... */
|
/* SHOW SUBCATS ... */
|
||||||
$qry = "SELECT download_category_id,download_category_class FROM #download_category WHERE download_category_parent=".intval($this->qry['id']);
|
$qry = "SELECT download_category_id,download_category_class FROM #download_category WHERE download_category_parent=".intval($this->qry['id']);
|
||||||
|
|
||||||
if($sql->gen($qry))
|
if($sql->gen($qry))
|
||||||
{
|
{
|
||||||
/* there are subcats - display them ... */
|
/* there are subcats - display them ... */
|
||||||
@@ -385,10 +475,11 @@ class download
|
|||||||
eval($template_load_core);
|
eval($template_load_core);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!defined("DL_IMAGESTYLE"))
|
/** @DEPRECATED **/
|
||||||
{
|
// if(!defined("DL_IMAGESTYLE"))
|
||||||
define("DL_IMAGESTYLE", "border:1px solid blue");
|
// {
|
||||||
}
|
// define("DL_IMAGESTYLE", "border:1px solid blue");
|
||||||
|
// }
|
||||||
|
|
||||||
$download_cat_table_string = "";
|
$download_cat_table_string = "";
|
||||||
|
|
||||||
@@ -402,14 +493,9 @@ class download
|
|||||||
|
|
||||||
$dl_text .= $tp->parseTemplate($DOWNLOAD_CAT_TABLE_END, TRUE, $download_shortcodes);
|
$dl_text .= $tp->parseTemplate($DOWNLOAD_CAT_TABLE_END, TRUE, $download_shortcodes);
|
||||||
|
|
||||||
$dlbreadcrumb = $this->getBreadcrumb(array(LAN_dl_18 => e_SELF,$type));
|
$text = $ns->tablerender($dl_title, $dl_text, 'download-list', true);
|
||||||
$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
|
}// End of subcategory display
|
||||||
|
|
||||||
// Now display individual downloads
|
// Now display individual downloads
|
||||||
@@ -430,7 +516,7 @@ class download
|
|||||||
}
|
}
|
||||||
if($total_downloads < $this->qry['view'])
|
if($total_downloads < $this->qry['view'])
|
||||||
{
|
{
|
||||||
$dl_from = 0;
|
$this->qry['from'] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -442,23 +528,25 @@ class download
|
|||||||
require_once (e_HANDLER . "rate_class.php");
|
require_once (e_HANDLER . "rate_class.php");
|
||||||
$dltdownloads = 0;
|
$dltdownloads = 0;
|
||||||
|
|
||||||
// $dl_from - first entry to show (note - can get reset due to reuse of query,
|
// $this->qry['from'] - first entry to show (note - can get reset due to reuse of query,
|
||||||
// even if values overridden this time)
|
// even if values overridden this time)
|
||||||
// $this->qry['view'] - number of entries per page
|
// $this->qry['view'] - number of entries per page
|
||||||
// $total_downloads - total number of entries matching search criteria
|
// $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']);
|
$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 {$this->qry['from']}, ".$this->qry['view']);
|
||||||
|
|
||||||
if($filetotal)
|
if($filetotal)
|
||||||
{
|
{
|
||||||
// Only show list if some files in it
|
// Only show list if some files in it
|
||||||
$dl_text = $tp->parseTemplate($DOWNLOAD_LIST_TABLE_START, TRUE, $download_shortcodes);
|
$dl_text = $tp->parseTemplate($DOWNLOAD_LIST_TABLE_START, TRUE, $download_shortcodes);
|
||||||
|
|
||||||
global $dlrow, $dlft, $dltdownloads;
|
global $dlft, $dltdownloads;
|
||||||
|
|
||||||
$dlft = ($filetotal < $this->qry['view'] ? $filetotal: $this->qry['view']);
|
$dlft = ($filetotal < $this->qry['view'] ? $filetotal: $this->qry['view']);
|
||||||
|
|
||||||
while($dlrow = $sql->fetch())
|
while($dlrow = $sql->fetch())
|
||||||
{
|
{
|
||||||
|
$download_shortcodes->setVars($dlrow);
|
||||||
|
|
||||||
$agreetext = $tp->toHTML($pref['agree_text'], TRUE, 'DESCRIPTION');
|
$agreetext = $tp->toHTML($pref['agree_text'], TRUE, 'DESCRIPTION');
|
||||||
$current_row = ($current_row)? 0: 1;
|
$current_row = ($current_row)? 0: 1;
|
||||||
// Alternating CSS for each row.(backwards compatible)
|
// Alternating CSS for each row.(backwards compatible)
|
||||||
@@ -479,7 +567,7 @@ class download
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$ns->tablerender(LAN_dl_18, $dl_text, 'download-list');
|
$text = $ns->tablerender(LAN_dl_18, $dl_text, 'download-list', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isset($DOWNLOAD_LIST_NEXTPREV))
|
if(!isset($DOWNLOAD_LIST_NEXTPREV))
|
||||||
@@ -501,16 +589,20 @@ class download
|
|||||||
|
|
||||||
global $nextprev_parms;
|
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']}.";
|
$nextprev_parms = $total_downloads . "," . $this->qry['view'] . "," . $this->qry['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);
|
|
||||||
|
|
||||||
|
$text .= $tp->parseTemplate($DOWNLOAD_LIST_NEXTPREV, TRUE, $download_shortcodes);
|
||||||
|
|
||||||
|
return $text;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function renderReport()
|
|
||||||
|
/**
|
||||||
|
* Render a 'Broken Download' Report form.
|
||||||
|
*/
|
||||||
|
private function renderReport()
|
||||||
{
|
{
|
||||||
$sql = e107::getDb();
|
$sql = e107::getDb();
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
@@ -553,13 +645,11 @@ class download
|
|||||||
|
|
||||||
define("e_PAGETITLE", PAGE_NAME." / ".LAN_dl_47);
|
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>";
|
$text = LAN_dl_48."<br /><br /><a href='".e_PLUGIN."download/download.php?action=view&id=".$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);
|
|
||||||
|
return $ns->tablerender(LAN_dl_18, $text, 'download-report', true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -585,13 +675,15 @@ class download
|
|||||||
</div>
|
</div>
|
||||||
</form>";
|
</form>";
|
||||||
|
|
||||||
$ns->tablerender(LAN_dl_18, $text);
|
return $ns->tablerender(LAN_dl_18, $text, 'download-report', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
function renderMirror()
|
* Render Download Mirrors for the selected file.
|
||||||
|
*/
|
||||||
|
private function renderMirror()
|
||||||
{
|
{
|
||||||
|
|
||||||
$sql = e107::getDb();
|
$sql = e107::getDb();
|
||||||
@@ -625,7 +717,9 @@ class download
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
$download_shortcodes = new download_shortcodes;
|
|
||||||
|
$download_shortcodes = e107::getScBatch('download',true);
|
||||||
|
$download_shortcodes->wrapper('download/mirror');
|
||||||
$download_shortcodes->qry = $this->qry;
|
$download_shortcodes->qry = $this->qry;
|
||||||
|
|
||||||
// $load_template = 'download_template';
|
// $load_template = 'download_template';
|
||||||
@@ -640,12 +734,15 @@ class download
|
|||||||
WHERE d.download_id = ".$this->qry['id']."
|
WHERE d.download_id = ".$this->qry['id']."
|
||||||
LIMIT 1";
|
LIMIT 1";
|
||||||
|
|
||||||
global $dlmirrorfile, $dlrow, $dlmirror;
|
// global $dlmirrorfile, $dlmirror;
|
||||||
|
|
||||||
|
|
||||||
if($sql->gen($query))
|
if($sql->gen($query))
|
||||||
{
|
{
|
||||||
$dlrow = $sql->fetch();
|
$dlrow = $sql->fetch();
|
||||||
|
// $dlrow['mirrorlist'] = $mirrorList;
|
||||||
|
$download_shortcodes->setVars($dlrow);
|
||||||
|
|
||||||
|
|
||||||
$array = explode(chr(1), $dlrow['download_mirror']);
|
$array = explode(chr(1), $dlrow['download_mirror']);
|
||||||
|
|
||||||
@@ -681,7 +778,10 @@ class download
|
|||||||
if($mirrorstring)
|
if($mirrorstring)
|
||||||
{
|
{
|
||||||
$dlmirrorfile = explode(",", $mirrorstring);
|
$dlmirrorfile = explode(",", $mirrorstring);
|
||||||
$dlmirror = $mirrorList[$dlmirrorfile[0]];
|
// $dlmirror = $mirrorList[$dlmirrorfile[0]];
|
||||||
|
|
||||||
|
$download_shortcodes->mirror['dlmirrorfile'] = $dlmirrorfile;
|
||||||
|
$download_shortcodes->mirror['dlmirror'] = $mirrorList[$dlmirrorfile[0]];
|
||||||
|
|
||||||
$dl_text .= $tp->parseTemplate($DOWNLOAD_MIRROR, TRUE, $download_shortcodes);
|
$dl_text .= $tp->parseTemplate($DOWNLOAD_MIRROR, TRUE, $download_shortcodes);
|
||||||
}
|
}
|
||||||
@@ -689,7 +789,7 @@ class download
|
|||||||
|
|
||||||
$dl_text .= $tp->parseTemplate($DOWNLOAD_MIRROR_END, TRUE, $download_shortcodes);
|
$dl_text .= $tp->parseTemplate($DOWNLOAD_MIRROR_END, TRUE, $download_shortcodes);
|
||||||
|
|
||||||
$ns->tablerender(LAN_dl_18, $dl_text);
|
return $ns->tablerender(LAN_dl_18, $dl_text, 'download-mirror', true);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -698,43 +798,38 @@ class download
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @DEPRECATED
|
* Render Download Errors.
|
||||||
*/
|
*/
|
||||||
function getBreadcrumb($arr)
|
private function renderError()
|
||||||
{
|
{
|
||||||
$dlbreadcrumb = array();
|
$ns = e107::getRender();
|
||||||
$ix = 0;
|
$pref = e107::getPref();
|
||||||
foreach ($arr as $key=>$crumb) {
|
|
||||||
$dlbreadcrumb[$ix]['sep'] = " :: ";
|
switch ($this->qry['error'])
|
||||||
$ix++;
|
|
||||||
if (is_int($key))
|
|
||||||
{
|
{
|
||||||
$dlbreadcrumb[$ix]['value'] = $crumb;
|
case 1 : // No permissions
|
||||||
|
if (strlen($pref['download_denied']) > 0)
|
||||||
|
{
|
||||||
|
$errmsg = $tp->toHTML($pref['download_denied'],true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$dlbreadcrumb[$ix]['value'] = "<a href='{$crumb}'>".$key."</a>";
|
$errmsg = LAN_dl_63;
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
$dlbreadcrumb['fieldlist'] = implode(",", array_keys($dlbreadcrumb));
|
|
||||||
return $dlbreadcrumb;
|
case 2 : // Quota exceeded
|
||||||
|
$errmsg = LAN_dl_62;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default: // Generic error - shouldn't happen
|
||||||
|
$errmsg = LAN_dl_61." ".$this->qry['error'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$ns->tablerender(LAN_dl_61, "<div class='alert alert-error alert-block' style='text-align:center'>".$errmsg."</div>");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -836,4 +931,14 @@ class download
|
|||||||
return $boxinfo;
|
return $boxinfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sort_download_mirror_order($a, $b)
|
||||||
|
{
|
||||||
|
$a = explode(",", $a);
|
||||||
|
$b = explode(",", $b);
|
||||||
|
if ($a[1] == $b[1]) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return ($a[1] < $b[1]) ? -1 : 1;
|
||||||
|
}
|
||||||
?>
|
?>
|
@@ -351,7 +351,7 @@ if(!isset($DOWNLOAD_MIRROR_END))
|
|||||||
// v2.x Bootstrap Template. - Overrides the above templates.
|
// v2.x Bootstrap Template. - Overrides the above templates.
|
||||||
|
|
||||||
|
|
||||||
$DOWNLOAD_TEMPLATE['categories']['start'] = "
|
$DOWNLOAD_TEMPLATE['categories']['start'] = "{DOWNLOAD_BREADCRUMB}
|
||||||
<table class='table table-striped fborder'>
|
<table class='table table-striped fborder'>
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col style='width:3%'/>
|
<col style='width:3%'/>
|
||||||
@@ -460,7 +460,7 @@ $DOWNLOAD_TEMPLATE['view']['item'] = "
|
|||||||
</colgroup>
|
</colgroup>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan='2' class='fcaption' style='text-align:left;'>
|
<td colspan='2' class='fcaption' style='text-align:left;'>
|
||||||
{DOWNLOAD_VIEW_NAME} {DOWNLOAD_ADMIN_EDIT}
|
<h4>{DOWNLOAD_VIEW_NAME} {DOWNLOAD_ADMIN_EDIT}</h4>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{DOWNLOAD_VIEW_AUTHOR_LAN}
|
{DOWNLOAD_VIEW_AUTHOR_LAN}
|
||||||
@@ -550,7 +550,7 @@ $DOWNLOAD_TEMPLATE['list']['start'] = "{DOWNLOAD_BREADCRUMB}
|
|||||||
<th>{DOWNLOAD_LIST_CAPTION=filesize}</th>
|
<th>{DOWNLOAD_LIST_CAPTION=filesize}</th>
|
||||||
<th>{DOWNLOAD_LIST_CAPTION=requested}</th>
|
<th>{DOWNLOAD_LIST_CAPTION=requested}</th>
|
||||||
<th>{DOWNLOAD_LIST_CAPTION=rating}</th>
|
<th>{DOWNLOAD_LIST_CAPTION=rating}</th>
|
||||||
<th>{DOWNLOAD_LIST_CAPTION=link}</th>
|
<th class='text-center'>{DOWNLOAD_LIST_CAPTION=link}</th>
|
||||||
</tr>";
|
</tr>";
|
||||||
|
|
||||||
|
|
||||||
@@ -575,7 +575,7 @@ $DOWNLOAD_TEMPLATE['list']['item'] = "
|
|||||||
<td>
|
<td>
|
||||||
{DOWNLOAD_LIST_RATING}
|
{DOWNLOAD_LIST_RATING}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td class='text-center'>
|
||||||
{DOWNLOAD_LIST_LINK}
|
{DOWNLOAD_LIST_LINK}
|
||||||
</td>
|
</td>
|
||||||
</tr>";
|
</tr>";
|
||||||
@@ -584,7 +584,7 @@ $DOWNLOAD_TEMPLATE['list']['item'] = "
|
|||||||
|
|
||||||
$DOWNLOAD_TEMPLATE['list']['end'] = "
|
$DOWNLOAD_TEMPLATE['list']['end'] = "
|
||||||
<tr>
|
<tr>
|
||||||
<td class='forumheader3' colspan='7' style='text-align:right;'>{DOWNLOAD_LIST_TOTAL_AMOUNT} {DOWNLOAD_LIST_TOTAL_FILES}</td>
|
<td class='forumheader3' colspan='7' style='text-align:right;'><small class='muted text-muted'>{DOWNLOAD_LIST_TOTAL_AMOUNT} {DOWNLOAD_LIST_TOTAL_FILES}</small></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
@@ -619,7 +619,7 @@ $DOWNLOAD_TEMPLATE['mirror']['start'] = "{DOWNLOAD_BREADCRUMB}
|
|||||||
</colgroup>
|
</colgroup>
|
||||||
<tr>
|
<tr>
|
||||||
<th class='fcaption'>{DOWNLOAD_MIRROR_REQUEST_ICON}</th>
|
<th class='fcaption'>{DOWNLOAD_MIRROR_REQUEST_ICON}</th>
|
||||||
<th class='fcaption' colspan='5'>".LAN_dl_72."{DOWNLOAD_MIRROR_REQUEST}</th>
|
<th class='fcaption' colspan='5'><h4>{DOWNLOAD_MIRROR_REQUEST}</h4></th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th class='forumheader' colspan='2'>".LAN_dl_68."</th>
|
<th class='forumheader' colspan='2'>".LAN_dl_68."</th>
|
||||||
@@ -644,7 +644,7 @@ $DOWNLOAD_TEMPLATE['mirror']['item'] = "
|
|||||||
<td>{DOWNLOAD_MIRROR_DESCRIPTION}</td>
|
<td>{DOWNLOAD_MIRROR_DESCRIPTION}</td>
|
||||||
<td>{DOWNLOAD_MIRROR_LOCATION}</td>
|
<td>{DOWNLOAD_MIRROR_LOCATION}</td>
|
||||||
<td>{DOWNLOAD_MIRROR_FILESIZE}</td>
|
<td>{DOWNLOAD_MIRROR_FILESIZE}</td>
|
||||||
<td>{DOWNLOAD_MIRROR_LINK}</td>
|
<td class='center text-center'>{DOWNLOAD_MIRROR_LINK}</td>
|
||||||
</tr>
|
</tr>
|
||||||
";
|
";
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user