mirror of
https://github.com/e107inc/e107.git
synced 2025-07-30 03:10:50 +02:00
#4686: download_shortcodes
: Consistency for agreement text alert box
Extract all accesses of the `agree_text` pref and reformat the value into a JavaScript `alert()` box Uses the new `e_parse::toAttributes()` method Fixes: #4686
This commit is contained in:
@@ -14,10 +14,14 @@
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
if (!defined('e107_INIT'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
e107::plugLan('download', 'front', true);
|
||||
|
||||
|
||||
/**
|
||||
* download_shortcodes
|
||||
*/
|
||||
@@ -35,11 +39,44 @@ class download_shortcodes extends e_shortcode
|
||||
/**
|
||||
* download_shortcodes constructor
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->pref = e107::getPref();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the download agreement text as an HTML-stripped JSON string
|
||||
*
|
||||
* Configured in Admin-UI at `/e107_plugins/download/admin_download.php?mode=main&action=settings`
|
||||
*
|
||||
* @return string|null JSON string with the contents of the "agree_text" pref reformatted without HTML
|
||||
* {@see null} if the "agree_flag" pref is not truthy or if the formatted "agree_text" is empty.
|
||||
*/
|
||||
private function getAgreeTextAsHtmlAttributeJsonString()
|
||||
{
|
||||
if (!isset($this->pref['agree_flag']) || !$this->pref['agree_flag']) return null;
|
||||
|
||||
$rawAgreeText = isset($this->pref['agree_text']) ? $this->pref['agree_text'] : "";
|
||||
$tp = e107::getParser();
|
||||
$agreeText = $tp->toJSON($tp->toText($rawAgreeText), true);
|
||||
|
||||
if (!$agreeText) return null;
|
||||
|
||||
return $agreeText;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap the formatted download agreement text into an HTML JavaScript event that calls `confirm()`
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getAgreeTextAsHtmlEventAttribute()
|
||||
{
|
||||
$maybeJson = $this->getAgreeTextAsHtmlAttributeJsonString();
|
||||
|
||||
return empty($maybeJson) ? "" : "return confirm($maybeJson);";
|
||||
}
|
||||
|
||||
public function breadcrumb()
|
||||
{
|
||||
@@ -57,23 +94,23 @@ class download_shortcodes extends e_shortcode
|
||||
break;
|
||||
|
||||
case 'maincats':
|
||||
$breadcrumb[] = array('text' => LAN_PLUGIN_DOWNLOAD_NAME, 'url' => e107::url('download','index'));
|
||||
$breadcrumb[] = array('text' => LAN_PLUGIN_DOWNLOAD_NAME, 'url' => e107::url('download', 'index'));
|
||||
break;
|
||||
|
||||
default:
|
||||
$breadcrumb[] = array('text' => LAN_PLUGIN_DOWNLOAD_NAME, 'url' => e107::url('download','index'));
|
||||
$breadcrumb[] = array('text' => LAN_PLUGIN_DOWNLOAD_NAME, 'url' => e107::url('download', 'index'));
|
||||
|
||||
if(!empty($this->grandparent))
|
||||
if (!empty($this->grandparent))
|
||||
{
|
||||
$breadcrumb[] = array('text' => $this->grandparent['download_category_name'], 'url' => ($this->grandparent['download_category_id']) ? e107::url('download', 'category', $this->grandparent) : null);
|
||||
}
|
||||
|
||||
if(!empty($this->parent))
|
||||
if (!empty($this->parent))
|
||||
{
|
||||
$breadcrumb[] = array('text' => $this->parent['download_category_name'], 'url' => ($this->parent['download_category_id']) ? e107::url('download', 'category', $this->parent) : null);
|
||||
}
|
||||
|
||||
if(isset($this->var['download_category_name']))
|
||||
if (isset($this->var['download_category_name']))
|
||||
{
|
||||
$breadcrumb[] = array('text' => $this->var['download_category_name'], 'url' => ($this->var['download_category_id']) ? e107::url('download', 'category', $this->var) : null);
|
||||
}
|
||||
@@ -87,7 +124,7 @@ class download_shortcodes extends e_shortcode
|
||||
|
||||
}
|
||||
|
||||
function sc_download_breadcrumb($parm='')
|
||||
function sc_download_breadcrumb($parm = '')
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
$frm = e107::getForm();
|
||||
@@ -104,19 +141,21 @@ class download_shortcodes extends e_shortcode
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
|
||||
if(!empty($this->var['d_count']))
|
||||
if (!empty($this->var['d_count']))
|
||||
{
|
||||
$url = e107::url('download', 'category', $this->var);
|
||||
return "<a href='".$url."'>".$tp->toHTML($this->var['download_category_name'], FALSE, 'TITLE')."</a>";
|
||||
|
||||
return "<a href='" . $url . "'>" . $tp->toHTML($this->var['download_category_name'], false, 'TITLE') . "</a>";
|
||||
}
|
||||
|
||||
return $tp->toHTML($this->var['download_category_name'], FALSE, 'TITLE');
|
||||
return $tp->toHTML($this->var['download_category_name'], false, 'TITLE');
|
||||
}
|
||||
|
||||
public function sc_download_cat_main_description()
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
return $tp->toHTML($this->var['download_category_description'], TRUE, 'DESCRIPTION');
|
||||
|
||||
return $tp->toHTML($this->var['download_category_description'], true, 'DESCRIPTION');
|
||||
}
|
||||
|
||||
public function sc_download_cat_main_icon()
|
||||
@@ -127,7 +166,7 @@ class download_shortcodes extends e_shortcode
|
||||
|
||||
public function sc_download_cat_main_count()
|
||||
{
|
||||
if(!empty($this->var['d_count']))
|
||||
if (!empty($this->var['d_count']))
|
||||
{
|
||||
return intval($this->var['d_count']);
|
||||
}
|
||||
@@ -135,7 +174,7 @@ class download_shortcodes extends e_shortcode
|
||||
|
||||
public function sc_download_cat_main_size()
|
||||
{
|
||||
if(!empty($this->var['d_count']))
|
||||
if (!empty($this->var['d_count']))
|
||||
{
|
||||
return eHelper::parseMemorySize($this->var['d_size']);
|
||||
}
|
||||
@@ -144,7 +183,7 @@ class download_shortcodes extends e_shortcode
|
||||
|
||||
public function sc_download_cat_main_downloaded()
|
||||
{
|
||||
if(!empty($this->var['d_count']))
|
||||
if (!empty($this->var['d_count']))
|
||||
{
|
||||
return intval($this->var['d_requests']);
|
||||
}
|
||||
@@ -158,36 +197,37 @@ class download_shortcodes extends e_shortcode
|
||||
$class = 'category-name';
|
||||
$class .= isset($this->dlsubrow['d_last']) && $this->isNewDownload($this->dlsubrow['d_last']) ? ' new' : '';
|
||||
|
||||
if($parm == 'raw')
|
||||
if ($parm == 'raw')
|
||||
{
|
||||
return $tp->toHTML($this->dlsubrow['download_category_name'], FALSE, 'TITLE');
|
||||
return $tp->toHTML($this->dlsubrow['download_category_name'], false, 'TITLE');
|
||||
}
|
||||
|
||||
if (!empty($this->dlsubrow['d_count']))
|
||||
{
|
||||
$url = e107::url('download', 'category', $this->dlsubrow);
|
||||
return "<a class='".$class."' href='".$url."'>".$tp->toHTML($this->dlsubrow['download_category_name'], FALSE, 'TITLE')."</a>";
|
||||
|
||||
return "<a class='" . $class . "' href='" . $url . "'>" . $tp->toHTML($this->dlsubrow['download_category_name'], false, 'TITLE') . "</a>";
|
||||
// return "<a class='".$class."' 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>";
|
||||
}
|
||||
elseif(isset($this->dlsubrow['download_category_name']))
|
||||
elseif (isset($this->dlsubrow['download_category_name']))
|
||||
{
|
||||
return $tp->toHTML($this->dlsubrow['download_category_name'], FALSE, 'TITLE');
|
||||
return $tp->toHTML($this->dlsubrow['download_category_name'], false, 'TITLE');
|
||||
}
|
||||
}
|
||||
|
||||
function sc_download_cat_sub_description()
|
||||
{
|
||||
if(empty($this->dlsubrow['download_category_description']))
|
||||
if (empty($this->dlsubrow['download_category_description']))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return e107::getParser()->toHTML($this->dlsubrow['download_category_description'], TRUE, 'DESCRIPTION');
|
||||
return e107::getParser()->toHTML($this->dlsubrow['download_category_description'], true, 'DESCRIPTION');
|
||||
}
|
||||
|
||||
function sc_download_cat_sub_icon()
|
||||
{
|
||||
if(empty($this->dlsubrow['download_category_icon']))
|
||||
if (empty($this->dlsubrow['download_category_icon']))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -202,12 +242,12 @@ class download_shortcodes extends e_shortcode
|
||||
|
||||
function sc_download_cat_sub_count()
|
||||
{
|
||||
return varset($this->dlsubrow['d_count'],'0');
|
||||
return varset($this->dlsubrow['d_count'], '0');
|
||||
}
|
||||
|
||||
function sc_download_cat_sub_size()
|
||||
{
|
||||
if(empty($this->dlsubrow['d_size']))
|
||||
if (empty($this->dlsubrow['d_size']))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -217,7 +257,7 @@ class download_shortcodes extends e_shortcode
|
||||
|
||||
function sc_download_cat_sub_downloaded()
|
||||
{
|
||||
if(!isset($this->dlsubrow['d_requests']))
|
||||
if (!isset($this->dlsubrow['d_requests']))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -237,9 +277,9 @@ class download_shortcodes extends e_shortcode
|
||||
$class = 'category-name';
|
||||
$class .= isset($this->dlsubsubrow['d_last']) && $this->isNewDownload($this->dlsubsubrow['d_last']) ? ' new' : '';
|
||||
|
||||
if($parm == 'raw')
|
||||
if ($parm == 'raw')
|
||||
{
|
||||
return $tp->toHTML($this->dlsubsubrow['download_category_name'], FALSE, 'TITLE');
|
||||
return $tp->toHTML($this->dlsubsubrow['download_category_name'], false, 'TITLE');
|
||||
}
|
||||
|
||||
if (!empty($this->dlsubsubrow['d_count']))
|
||||
@@ -247,27 +287,27 @@ class download_shortcodes extends e_shortcode
|
||||
$url = e107::url('download', 'category', $this->dlsubsubrow);
|
||||
// /list/category', array('id'=>$this->dlsubsubrow['download_category_id'], 'name'=> vartrue($this->dlsubsubrow['download_category_sef'],'--sef-not-set--')));
|
||||
// e_PLUGIN_ABS."download/download.php?action=list&id=".$this->dlsubsubrow['download_category_id']
|
||||
return "<a class='".$class."' href='".$url."'>".$tp->toHTML($this->dlsubsubrow['download_category_name'], FALSE, 'TITLE')."</a>";
|
||||
return "<a class='" . $class . "' href='" . $url . "'>" . $tp->toHTML($this->dlsubsubrow['download_category_name'], false, 'TITLE') . "</a>";
|
||||
}
|
||||
elseif(!empty($this->dlsubsubrow['download_category_name']))
|
||||
elseif (!empty($this->dlsubsubrow['download_category_name']))
|
||||
{
|
||||
return $tp->toHTML($this->dlsubsubrow['download_category_name'], FALSE, 'TITLE');
|
||||
return $tp->toHTML($this->dlsubsubrow['download_category_name'], false, 'TITLE');
|
||||
}
|
||||
}
|
||||
|
||||
function sc_download_cat_subsub_description()
|
||||
{
|
||||
if(empty($this->dlsubsubrow['download_category_description']))
|
||||
if (empty($this->dlsubsubrow['download_category_description']))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return e107::getParser()->toHTML($this->dlsubsubrow['download_category_description'], TRUE, 'DESCRIPTION');
|
||||
return e107::getParser()->toHTML($this->dlsubsubrow['download_category_description'], true, 'DESCRIPTION');
|
||||
}
|
||||
|
||||
function sc_download_cat_subsub_icon()
|
||||
{
|
||||
if(empty($this->dlsubsubrow['download_category_icon']))
|
||||
if (empty($this->dlsubsubrow['download_category_icon']))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -287,7 +327,7 @@ class download_shortcodes extends e_shortcode
|
||||
|
||||
function sc_download_cat_subsub_size()
|
||||
{
|
||||
if(empty($this->dlsubsubrow['d_size']))
|
||||
if (empty($this->dlsubsubrow['d_size']))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -297,7 +337,7 @@ class download_shortcodes extends e_shortcode
|
||||
|
||||
function sc_download_cat_subsub_downloaded()
|
||||
{
|
||||
if(empty($this->dlsubsubrow['d_requests']))
|
||||
if (empty($this->dlsubsubrow['d_requests']))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -309,7 +349,7 @@ class download_shortcodes extends e_shortcode
|
||||
// List ****************************************************************************************
|
||||
|
||||
|
||||
function sc_download_list_caption($parm='')
|
||||
function sc_download_list_caption($parm = '')
|
||||
{
|
||||
|
||||
$qry = $this->qry;
|
||||
@@ -357,40 +397,46 @@ class download_shortcodes extends e_shortcode
|
||||
}
|
||||
|
||||
|
||||
return "<a href='".e_REQUEST_SELF."?".http_build_query($qry, '', '&')."'>".$text."</a>" ;
|
||||
return "<a href='" . e_REQUEST_SELF . "?" . http_build_query($qry, '', '&') . "'>" . $text . "</a>";
|
||||
}
|
||||
|
||||
|
||||
|
||||
function sc_download_list_name($parm='')
|
||||
function sc_download_list_name($parm = '')
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
|
||||
if ($parm == "nolink")
|
||||
{
|
||||
return $tp->toHTML($this->var['download_name'],TRUE,'LINKTEXT');
|
||||
return $tp->toHTML($this->var['download_name'], true, 'LINKTEXT');
|
||||
}
|
||||
|
||||
if ($parm == "request")
|
||||
{
|
||||
$agreetext = $tp->toAttribute($tp->toJSON($tp->toText($this->pref['agree_text'],FALSE,'DESCRIPTION'), 'str'));
|
||||
$agreeTextJs = $this->getAgreeTextAsHtmlEventAttribute();
|
||||
|
||||
if ($this->var['download_mirror_type'])
|
||||
{
|
||||
$text = ($this->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_DOWNLOAD."'>");
|
||||
$href = e_PLUGIN_ABS . "download/download.php?mirror." . $this->var['download_id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$text = ($this->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_DOWNLOAD."'>");
|
||||
$href = e_PLUGIN_ABS . "download/request.php?" . $this->var['download_id'];
|
||||
}
|
||||
|
||||
$text .= $tp->toHTML($this->var['download_name'], FALSE, 'TITLE')."</a>";
|
||||
$text = "<a" . $tp->toAttributes([
|
||||
"href" => $href,
|
||||
"onclick" => $agreeTextJs,
|
||||
"title" => defined("LAN_DOWNLOAD") ? LAN_DOWNLOAD : null,
|
||||
]) . ">";
|
||||
|
||||
$text .= $tp->toHTML($this->var['download_name'], false, 'TITLE') . "</a>";
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
$url = e107::url('download', 'item', $this->var);
|
||||
return "<a href='".$url."'>".$tp->toHTML($this->var['download_name'],TRUE,'LINKTEXT')."</a>";
|
||||
|
||||
return "<a href='" . $url . "'>" . $tp->toHTML($this->var['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>";
|
||||
}
|
||||
@@ -413,7 +459,7 @@ class download_shortcodes extends e_shortcode
|
||||
function sc_download_list_recenticon()
|
||||
{
|
||||
// convert "recent_download_days" to seconds
|
||||
return ($this->var['download_datestamp'] > time()-(varset($this->pref['recent_download_days'],0) * 86400) ? $this->renderNewIcon() : '');
|
||||
return ($this->var['download_datestamp'] > time() - (varset($this->pref['recent_download_days'], 0) * 86400) ? $this->renderNewIcon() : '');
|
||||
}
|
||||
|
||||
function sc_download_list_filesize()
|
||||
@@ -425,16 +471,17 @@ class download_shortcodes extends e_shortcode
|
||||
{
|
||||
|
||||
$tp = e107::getParser();
|
||||
|
||||
return $tp->toDate($this->var['download_datestamp'], "short");
|
||||
}
|
||||
|
||||
function sc_download_list_thumb($parm='')
|
||||
function sc_download_list_thumb($parm = '')
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
|
||||
$img = "";
|
||||
|
||||
if(!empty($this->var['download_thumb']))
|
||||
if (!empty($this->var['download_thumb']))
|
||||
{
|
||||
$opts = array(
|
||||
'legacy' => "{e_FILE}downloadthumbs/",
|
||||
@@ -449,7 +496,8 @@ class download_shortcodes extends e_shortcode
|
||||
if ($parm == "link" && $this->var['download_thumb'])
|
||||
{
|
||||
$url = e107::url('download', 'item', $this->var);
|
||||
return "<a href='".$url."'>".$img."</a>";
|
||||
|
||||
return "<a href='" . $url . "'>" . $img . "</a>";
|
||||
// return "<a href='".e_PLUGIN_ABS."download/download.php?action=view&id=".$this->var['download_id']."'>".$img."</a>";
|
||||
}
|
||||
else
|
||||
@@ -468,45 +516,40 @@ class download_shortcodes extends e_shortcode
|
||||
return e107::getForm()->rate("download", $this->var['download_id']);
|
||||
}
|
||||
|
||||
function sc_download_list_link($parm='')
|
||||
function sc_download_list_link($parm = '')
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
$img = '';
|
||||
|
||||
$agreetext = !empty($this->pref['agree_text']) ? $tp->toAttribute($tp->toJSON($tp->toText($this->pref['agree_text'],FALSE,'DESCRIPTION'), 'str')) : '';
|
||||
|
||||
if(defined('IMAGE_DOWNLOAD'))
|
||||
if (defined('IMAGE_DOWNLOAD'))
|
||||
{
|
||||
$img = "<img src='".IMAGE_DOWNLOAD."' alt='".LAN_DOWNLOAD."' title='".LAN_DOWNLOAD."' />";
|
||||
$img = "<img src='" . IMAGE_DOWNLOAD . "' alt='" . LAN_DOWNLOAD . "' title='" . LAN_DOWNLOAD . "' />";
|
||||
}
|
||||
|
||||
if(deftrue('BOOTSTRAP'))
|
||||
if (deftrue('BOOTSTRAP'))
|
||||
{
|
||||
$img = e107::getParser()->toGlyph('fa-download',false);
|
||||
$img = e107::getParser()->toGlyph('fa-download', false);
|
||||
// $img = '<i class="icon-download"></i>';
|
||||
}
|
||||
|
||||
if ($this->var['download_mirror_type'])
|
||||
{
|
||||
return "<a class='e-tip' title='".LAN_DOWNLOAD."' href='".e_PLUGIN_ABS."download/download.php?mirror.".$this->var['download_id']."'>{$img}</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$url = $tp->parseTemplate("{DOWNLOAD_REQUEST_URL}",true, $this); // $this->sc_download_request_url();
|
||||
return (!empty($this->pref['agree_flag']) ? "<a class='e-tip' title='".LAN_DOWNLOAD."' href='".$url."' onclick= \"return confirm({$agreetext});\">{$img}</a>" : "<a class='e-tip' title='".LAN_DOWNLOAD."' href='".$url."' >{$img}</a>");
|
||||
|
||||
// return ($this->pref['agree_flag'] ? "<a class='e-tip' title='".LAN_DOWNLOAD."' href='".e_PLUGIN_ABS."download/request.php?".$this->var['download_id']."' onclick= \"return confirm('{$agreetext}');\">{$img}</a>" : "<a class='e-tip' title='".LAN_DOWNLOAD."' href='".e_PLUGIN_ABS."download/request.php?".$this->var['download_id']."' >{$img}</a>");
|
||||
}
|
||||
return "<a" . $tp->toAttributes([
|
||||
"class" => "e-tip",
|
||||
"title" => defined("LAN_DOWNLOAD") ? LAN_DOWNLOAD : null,
|
||||
"href" => $this->var['download_mirror_type'] ?
|
||||
e_PLUGIN_ABS . "download/download.php?mirror." . $this->var['download_id'] :
|
||||
$tp->parseTemplate("{DOWNLOAD_REQUEST_URL}", true, $this),
|
||||
"onclick" => $this->getAgreeTextAsHtmlEventAttribute(),
|
||||
]) . ">$img</a>";
|
||||
}
|
||||
|
||||
|
||||
function sc_download_request_url($parm=null)
|
||||
function sc_download_request_url($parm = null)
|
||||
{
|
||||
return e107::url('download', 'get', $this->var); // /request/item',array('id'=>$this->var['download_id'], 'name'=>$this->var['download_sef']));
|
||||
|
||||
}
|
||||
|
||||
function sc_download_filename($parm=null)
|
||||
function sc_download_filename($parm = null)
|
||||
{
|
||||
return basename($this->var['download_url']);
|
||||
|
||||
@@ -516,17 +559,17 @@ class download_shortcodes extends e_shortcode
|
||||
{
|
||||
$img = '';
|
||||
|
||||
if(defined('IMAGE_DOWNLOAD'))
|
||||
if (defined('IMAGE_DOWNLOAD'))
|
||||
{
|
||||
$img = "<img src='" . IMAGE_DOWNLOAD . "' alt='" . LAN_DOWNLOAD . "' title='" . LAN_DOWNLOAD . "' />";
|
||||
}
|
||||
|
||||
if(deftrue('BOOTSTRAP'))
|
||||
if (deftrue('BOOTSTRAP'))
|
||||
{
|
||||
$img = e107::getParser()->toGlyph('fa-download', false);
|
||||
}
|
||||
|
||||
if($parm == "link")
|
||||
if ($parm == "link")
|
||||
{
|
||||
$url = e107::url('download', 'item', $this->var);
|
||||
|
||||
@@ -541,20 +584,21 @@ class download_shortcodes extends e_shortcode
|
||||
return;
|
||||
}
|
||||
|
||||
function sc_download_list_imagefull($parm='')
|
||||
function sc_download_list_imagefull($parm = '')
|
||||
{
|
||||
|
||||
$img = "";
|
||||
|
||||
if(!empty($this->var['download_image']))
|
||||
if (!empty($this->var['download_image']))
|
||||
{
|
||||
$img = $this->sc_download_view_imagefull();
|
||||
}
|
||||
|
||||
if($parm == "link" && $this->var['download_image'])
|
||||
if ($parm == "link" && $this->var['download_image'])
|
||||
{
|
||||
$url = e107::url('download', 'item', $this->var);
|
||||
return "<a title=\"".LAN_dl_53."\" href='".$url."'>".$img."</a>";
|
||||
|
||||
return "<a title=\"" . LAN_dl_53 . "\" href='" . $url . "'>" . $img . "</a>";
|
||||
|
||||
// return "<a title=\"".LAN_dl_53."\" href='".e_PLUGIN_ABS."download/download.php?action=view&id=".$this->var['download_id']."'>".$img."</a>";
|
||||
}
|
||||
@@ -568,24 +612,25 @@ class download_shortcodes extends e_shortcode
|
||||
function sc_download_list_nextprev()
|
||||
{
|
||||
global $nextprev_parms;
|
||||
|
||||
return e107::getParser()->parseTemplate("{NEXTPREV={$nextprev_parms}}");
|
||||
}
|
||||
|
||||
function sc_download_list_total_amount()
|
||||
{
|
||||
global $dltdownloads;
|
||||
return intval($dltdownloads)." ".LAN_dl_16;
|
||||
|
||||
return intval($dltdownloads) . " " . LAN_dl_16;
|
||||
}
|
||||
|
||||
function sc_download_list_total_files()
|
||||
{
|
||||
global $dlft;
|
||||
return intval($dlft)." ".strtolower(LAN_FILES);
|
||||
|
||||
return intval($dlft) . " " . strtolower(LAN_FILES);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// View ****************************************************************************************
|
||||
|
||||
|
||||
@@ -596,11 +641,11 @@ class download_shortcodes extends e_shortcode
|
||||
|
||||
function sc_download_admin_edit()
|
||||
{
|
||||
$icon = (deftrue('BOOTSTRAP')) ? e107::getParser()->toGlyph('fa-edit') : "<img src='".e_IMAGE_ABS."generic/edit.png' alt='*' style='padding:0px;border:0px' />";
|
||||
$icon = (deftrue('BOOTSTRAP')) ? e107::getParser()->toGlyph('fa-edit') : "<img src='" . e_IMAGE_ABS . "generic/edit.png' alt='*' style='padding:0px;border:0px' />";
|
||||
|
||||
$url = e_PLUGIN_ABS."download/admin_download.php?action=edit&id=".$this->var['download_id'];
|
||||
$url = e_PLUGIN_ABS . "download/admin_download.php?action=edit&id=" . $this->var['download_id'];
|
||||
|
||||
return (ADMIN && getperms('6')) ? "<a class='e-tip btn btn-default btn-secondary hidden-print' href='".$url."' title='".LAN_EDIT."'>".$icon."</a>" : "";
|
||||
return (ADMIN && getperms('6')) ? "<a class='e-tip btn btn-default btn-secondary hidden-print' href='" . $url . "' title='" . LAN_EDIT . "'>" . $icon . "</a>" : "";
|
||||
}
|
||||
|
||||
function sc_download_category()
|
||||
@@ -608,12 +653,12 @@ class download_shortcodes extends e_shortcode
|
||||
return $this->var['download_category_name'];
|
||||
}
|
||||
|
||||
function sc_download_category_description($parm=null)
|
||||
function sc_download_category_description($parm = null)
|
||||
{
|
||||
|
||||
$text = e107::getParser()->toHTML($this->var['download_category_description'], true, 'DESCRIPTION');
|
||||
|
||||
if($parm)
|
||||
if ($parm)
|
||||
{
|
||||
return substr($text, 0, $parm);
|
||||
}
|
||||
@@ -622,15 +667,16 @@ class download_shortcodes extends e_shortcode
|
||||
return $text;
|
||||
}
|
||||
}
|
||||
function sc_download_view_name($parm='')
|
||||
|
||||
function sc_download_view_name($parm = '')
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
|
||||
$viewUrl = e107::url('download', 'item', $this->var);
|
||||
$requestUrl = $url = $tp->parseTemplate("{DOWNLOAD_REQUEST_URL}",true,$this); // $this->sc_download_request_url();
|
||||
$requestUrl = $url = $tp->parseTemplate("{DOWNLOAD_REQUEST_URL}", true, $this); // $this->sc_download_request_url();
|
||||
|
||||
$link['view'] = "<a href='".$viewUrl."'>".$this->var['download_name']."</a>";
|
||||
$link['request'] = "<a href='".$requestUrl."' title='".LAN_dl_46."'>".$this->var['download_name']."</a>";
|
||||
$link['view'] = "<a href='" . $viewUrl . "'>" . $this->var['download_name'] . "</a>";
|
||||
$link['request'] = "<a href='" . $requestUrl . "' title='" . LAN_dl_46 . "'>" . $this->var['download_name'] . "</a>";
|
||||
|
||||
// $link['view'] = "<a href='".e_PLUGIN_ABS."download/download.php?action=view&id=".$this->var['download_id']."'>".$this->var['download_name']."</a>";
|
||||
// $link['request'] = "<a href='".e_PLUGIN_ABS."download/request.php?".$this->var['download_id']."' title='".LAN_dl_46."'>".$this->var['download_name']."</a>";
|
||||
@@ -638,7 +684,7 @@ class download_shortcodes extends e_shortcode
|
||||
|
||||
if ($parm)
|
||||
{
|
||||
return $tp->toHTML($link[$parm],true, 'TITLE');
|
||||
return $tp->toHTML($link[$parm], true, 'TITLE');
|
||||
}
|
||||
|
||||
return $this->var['download_name'];
|
||||
@@ -649,19 +695,13 @@ class download_shortcodes extends e_shortcode
|
||||
|
||||
$tp = e107::getParser();
|
||||
|
||||
$url = $url = $tp->parseTemplate("{DOWNLOAD_REQUEST_URL}",true,$this); //$this->sc_download_request_url();
|
||||
$url = $tp->parseTemplate("{DOWNLOAD_REQUEST_URL}", true, $this); //$this->sc_download_request_url();
|
||||
|
||||
if (!empty($this->pref['agree_flag']))
|
||||
{
|
||||
return "<a href='".$url."' onclick= \"return confirm(".$tp->toAttribute($tp->toJSON($tp->toHTML($this->pref['agree_text'],FALSE,'DESCRIPTION'))).");\" title='".LAN_dl_46."'>".$this->var['download_name']."</a>";
|
||||
// return "<a href='".e_PLUGIN_ABS."download/request.php?".$dl['download_id']."' onclick= \"return confirm('".$tp->toJS($tp->toHTML($this->pref['agree_text'],FALSE,'DESCRIPTION'))."');\" title='".LAN_dl_46."'>".$dl['download_name']."</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "<a href='".$url."' title='".LAN_dl_46."'>".$this->var['download_name']."</a>";
|
||||
|
||||
// return "<a href='".e_PLUGIN_ABS."download/request.php?".$dl['download_id']."' title='".LAN_dl_46."'>".$dl['download_name']."</a>";
|
||||
}
|
||||
return "<a" . $tp->toAttributes([
|
||||
"href" => $url,
|
||||
"onclick" => $this->getAgreeTextAsHtmlEventAttribute(),
|
||||
"title" => defined('LAN_dl_46') ? LAN_dl_46 : null,
|
||||
]) . ">{$this->var['download_name']}</a>";
|
||||
}
|
||||
|
||||
function sc_download_view_author()
|
||||
@@ -671,18 +711,18 @@ class download_shortcodes extends e_shortcode
|
||||
|
||||
function sc_download_view_authoremail()
|
||||
{
|
||||
return !empty($this->var['download_author_email']) ? e107::getParser()->toHTML($this->var['download_author_email'], TRUE, 'LINKTEXT') : "";
|
||||
return !empty($this->var['download_author_email']) ? e107::getParser()->toHTML($this->var['download_author_email'], true, 'LINKTEXT') : "";
|
||||
}
|
||||
|
||||
function sc_download_view_authorwebsite()
|
||||
{
|
||||
return !empty($this->var['download_author_website']) ? e107::getParser()->toHTML($this->var['download_author_website'], TRUE,'LINKTEXT') : "";
|
||||
return !empty($this->var['download_author_website']) ? e107::getParser()->toHTML($this->var['download_author_website'], true, 'LINKTEXT') : "";
|
||||
}
|
||||
|
||||
function sc_download_view_description($parm='')
|
||||
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') : "");
|
||||
$text = ($this->var['download_description'] ? e107::getParser()->toHTML($this->var['download_description'], true, 'DESCRIPTION') : "");
|
||||
|
||||
if ($maxlen)
|
||||
{
|
||||
@@ -696,7 +736,7 @@ class download_shortcodes extends e_shortcode
|
||||
return $text;
|
||||
}
|
||||
|
||||
function sc_download_view_date($parm='')
|
||||
function sc_download_view_date($parm = '')
|
||||
{
|
||||
return ($this->var['download_datestamp']) ? e107::getParser()->toDate($this->var['download_datestamp'], $parm) : "";
|
||||
}
|
||||
@@ -728,7 +768,7 @@ class download_shortcodes extends e_shortcode
|
||||
$url = e107::url('download', 'image', $this->var);
|
||||
//$url = e_PLUGIN_ABS . "download/request.php?download." . $this->var['download_id'];
|
||||
|
||||
if($this->var['download_thumb'])
|
||||
if ($this->var['download_thumb'])
|
||||
{
|
||||
$opts = array(
|
||||
'legacy' => "{e_FILE}downloadthumbs/",
|
||||
@@ -739,7 +779,7 @@ class download_shortcodes extends e_shortcode
|
||||
|
||||
return ($this->var['download_image'] ? "<a href='" . $url . "'>" . $image . "</a>" : $image);
|
||||
}
|
||||
elseif($this->var['download_image'])
|
||||
elseif ($this->var['download_image'])
|
||||
{
|
||||
$opts = array(
|
||||
//'legacy' => "{e_FILE}downloadthumbs/",
|
||||
@@ -761,15 +801,15 @@ class download_shortcodes extends e_shortcode
|
||||
/**
|
||||
* {DOWNLOAD_VIEW_LINK: class=thumbnail}
|
||||
*/
|
||||
function sc_download_view_imagefull($parm=array())
|
||||
function sc_download_view_imagefull($parm = array())
|
||||
{
|
||||
|
||||
if(!empty($this->var['download_image']))
|
||||
if (!empty($this->var['download_image']))
|
||||
{
|
||||
|
||||
$opts = array(
|
||||
'legacy' => "{e_FILE}downloadimages/",
|
||||
'class' => 'download-image dl_image download-view-image img-responsive img-fluid '.vartrue($parm['class']),
|
||||
'class' => 'download-image dl_image download-view-image img-responsive img-fluid ' . vartrue($parm['class']),
|
||||
'alt' => basename($this->var['download_image'])
|
||||
);
|
||||
|
||||
@@ -781,51 +821,39 @@ class download_shortcodes extends e_shortcode
|
||||
/**
|
||||
* {DOWNLOAD_VIEW_LINK: size=2x}
|
||||
*/
|
||||
function sc_download_view_link($parm=null)
|
||||
function sc_download_view_link($parm = null)
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
|
||||
$click = "";
|
||||
$img = '';
|
||||
|
||||
if(defined('IMAGE_DOWNLOAD'))
|
||||
if (defined('IMAGE_DOWNLOAD'))
|
||||
{
|
||||
$img = "<img src='".IMAGE_DOWNLOAD."' alt='".LAN_DOWNLOAD."' title='".LAN_DOWNLOAD."' />";
|
||||
$img = "<img src='" . IMAGE_DOWNLOAD . "' alt='" . LAN_DOWNLOAD . "' title='" . LAN_DOWNLOAD . "' />";
|
||||
}
|
||||
if(deftrue('BOOTSTRAP'))
|
||||
if (deftrue('BOOTSTRAP'))
|
||||
{
|
||||
$img = e107::getParser()->toGlyph('fa-download',$parm); // '<i class="icon-download"></i>';
|
||||
$img = e107::getParser()->toGlyph('fa-download', $parm); // '<i class="icon-download"></i>';
|
||||
}
|
||||
|
||||
if(!empty($this->pref['agree_flag']))
|
||||
{
|
||||
$click = " onclick='return confirm(".$tp->toAttribute($tp->toJSON($tp->toHTML($this->pref['agree_text'],true,'emotes, no_tags'))).")'";
|
||||
}
|
||||
$url = $tp->parseTemplate("{DOWNLOAD_REQUEST_URL}", true, $this); //$this->sc_download_request_url();
|
||||
|
||||
$url = $url = $tp->parseTemplate("{DOWNLOAD_REQUEST_URL}",true,$this); //$this->sc_download_request_url();
|
||||
|
||||
if(varset($parm['type']) == 'href')
|
||||
if (varset($parm['type']) == 'href')
|
||||
{
|
||||
return $url;
|
||||
}
|
||||
|
||||
$dnld_link = "<a href='".$url."'{$click}>";
|
||||
if ($this->var['download_mirror'] && $this->var['download_mirror_type'])
|
||||
{
|
||||
$url = e_PLUGIN_ABS . "download/download.php?mirror." . $this->var['download_id'];
|
||||
$img = defined('LAN_dl_66') ? LAN_dl_66 : "Select download mirror";
|
||||
}
|
||||
|
||||
if ($this->var['download_mirror'])
|
||||
{
|
||||
if ($this->var['download_mirror_type'])
|
||||
{
|
||||
return "<a href='".e_PLUGIN_ABS."download/download.php?mirror.".$this->var['download_id']."'>".LAN_dl_66."</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
return $dnld_link.$img."</a>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return $dnld_link.$img."</a>";
|
||||
}
|
||||
return "<a" . $tp->toAttributes([
|
||||
"href" => $url,
|
||||
"onclick" => $this->getAgreeTextAsHtmlEventAttribute()
|
||||
]) . ">$img</a>";
|
||||
}
|
||||
|
||||
function sc_download_view_filesize()
|
||||
@@ -837,7 +865,8 @@ class download_shortcodes extends e_shortcode
|
||||
{
|
||||
|
||||
$frm = e107::getForm();
|
||||
$options = array('label'=>' ','template'=>'RATE|VOTES|STATUS');
|
||||
$options = array('label' => ' ', 'template' => 'RATE|VOTES|STATUS');
|
||||
|
||||
return $frm->rate("download", $this->var['download_id'], $options);
|
||||
|
||||
/*
|
||||
@@ -880,11 +909,12 @@ class download_shortcodes extends e_shortcode
|
||||
function sc_download_report_link()
|
||||
{
|
||||
|
||||
if(isset($this->pref['download_reportbroken']) && check_class($this->pref['download_reportbroken']))
|
||||
if (isset($this->pref['download_reportbroken']) && check_class($this->pref['download_reportbroken']))
|
||||
{
|
||||
//$url = e_PLUGIN_ABS."download/download.php?action=report&id=".$this->var['download_id'];
|
||||
$url = e107::url('download','report', $this->var);
|
||||
return "<a href='".$url."'>".LAN_dl_45."</a>";
|
||||
$url = e107::url('download', 'report', $this->var);
|
||||
|
||||
return "<a href='" . $url . "'>" . LAN_dl_45 . "</a>";
|
||||
}
|
||||
|
||||
return '';
|
||||
@@ -893,7 +923,8 @@ class download_shortcodes extends e_shortcode
|
||||
function sc_download_view_caption()
|
||||
{
|
||||
$text = $this->var['download_category_name'];
|
||||
$text .= ($this->var['download_category_description']) ? " [ ".$this->var['download_category_description']." ]" : "";
|
||||
$text .= ($this->var['download_category_description']) ? " [ " . $this->var['download_category_description'] . " ]" : "";
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
@@ -907,22 +938,22 @@ class download_shortcodes extends e_shortcode
|
||||
|
||||
function sc_download_mirror_request_icon()
|
||||
{
|
||||
return ($this->var['download_thumb'] ? "<img src='".e107::getParser()->replaceConstants($this->var['download_thumb'])."' alt='*'/>" : "");
|
||||
return ($this->var['download_thumb'] ? "<img src='" . e107::getParser()->replaceConstants($this->var['download_thumb']) . "' alt='*'/>" : "");
|
||||
}
|
||||
|
||||
function sc_download_mirror_name()
|
||||
{
|
||||
if(empty($this->mirror['dlmirror']['mirror_url']))
|
||||
if (empty($this->mirror['dlmirror']['mirror_url']))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return "<a href='{$this->mirror['dlmirror']['mirror_url']}' rel='external'>".$this->mirror['dlmirror']['mirror_name']."</a>";
|
||||
return "<a href='{$this->mirror['dlmirror']['mirror_url']}' rel='external'>" . $this->mirror['dlmirror']['mirror_name'] . "</a>";
|
||||
}
|
||||
|
||||
function sc_download_mirror_image()
|
||||
{
|
||||
return !empty($this->mirror['dlmirror']['mirror_image']) ? "<a href='{$this->mirror['dlmirror']['mirror_url']}' rel='external'><img src='".e107::getParser()->replaceConstants($this->mirror['dlmirror']['mirror_image'])."' alt='*'/></a>" : '';
|
||||
return !empty($this->mirror['dlmirror']['mirror_image']) ? "<a href='{$this->mirror['dlmirror']['mirror_url']}' rel='external'><img src='" . e107::getParser()->replaceConstants($this->mirror['dlmirror']['mirror_image']) . "' alt='*'/></a>" : '';
|
||||
}
|
||||
|
||||
function sc_download_mirror_location()
|
||||
@@ -932,12 +963,12 @@ class download_shortcodes extends e_shortcode
|
||||
|
||||
function sc_download_mirror_description()
|
||||
{
|
||||
return !empty($this->mirror['dlmirror']['mirror_description']) ? e107::getParser()->toHTML($this->mirror['dlmirror']['mirror_description'], TRUE) : '';
|
||||
return !empty($this->mirror['dlmirror']['mirror_description']) ? e107::getParser()->toHTML($this->mirror['dlmirror']['mirror_description'], true) : '';
|
||||
}
|
||||
|
||||
function sc_download_mirror_filesize()
|
||||
{
|
||||
if(empty($this->mirror['dlmirrorfile'][3]))
|
||||
if (empty($this->mirror['dlmirrorfile'][3]))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -947,7 +978,7 @@ class download_shortcodes extends e_shortcode
|
||||
|
||||
function sc_download_mirror_link()
|
||||
{
|
||||
if(empty($this->mirror['dlmirrorfile'][0]))
|
||||
if (empty($this->mirror['dlmirrorfile'][0]))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -955,28 +986,30 @@ class download_shortcodes extends e_shortcode
|
||||
$tp = e107::getParser();
|
||||
$img = '';
|
||||
|
||||
$click = !empty($this->pref['agree_text']) ? " onclick='return confirm(".$tp->toAttribute($tp->toJSON($tp->toHTML($this->pref['agree_text'],FALSE,'DESCRIPTION'))).")'" : '';
|
||||
|
||||
if(defined('IMAGE_DOWNLOAD'))
|
||||
if (defined('IMAGE_DOWNLOAD'))
|
||||
{
|
||||
$img = "<img src='".IMAGE_DOWNLOAD."' alt='".LAN_DOWNLOAD."' title='".LAN_DOWNLOAD."' />";
|
||||
$img = "<img src='" . IMAGE_DOWNLOAD . "' alt='" . LAN_DOWNLOAD . "' title='" . LAN_DOWNLOAD . "' />";
|
||||
}
|
||||
if(deftrue('BOOTSTRAP'))
|
||||
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_DOWNLOAD."' {$click}>".$img."</a>";
|
||||
return "<a" . $tp->toAttributes([
|
||||
"href" => e_PLUGIN_ABS . "download/download.php?mirror.{$this->var['download_id']}.{$this->mirror['dlmirrorfile'][0]}",
|
||||
"title" => LAN_DOWNLOAD,
|
||||
"onclick" => $this->getAgreeTextAsHtmlEventAttribute(),
|
||||
]) . ">" . $img . "</a>";
|
||||
}
|
||||
|
||||
function sc_download_mirror_requests()
|
||||
{
|
||||
return (ADMIN && !empty($this->mirror['dlmirrorfile'][2])) ? LAN_dl_73.$this->mirror['dlmirrorfile'][2] : "";
|
||||
return (ADMIN && !empty($this->mirror['dlmirrorfile'][2])) ? LAN_dl_73 . $this->mirror['dlmirrorfile'][2] : "";
|
||||
}
|
||||
|
||||
function sc_download_total_mirror_requests()
|
||||
{
|
||||
return (ADMIN && isset($this->mirror['dlmirror']['mirror_count'])) ? LAN_dl_74.$this->mirror['dlmirror']['mirror_count'] : "";
|
||||
return (ADMIN && isset($this->mirror['dlmirror']['mirror_count'])) ? LAN_dl_74 . $this->mirror['dlmirror']['mirror_count'] : "";
|
||||
}
|
||||
|
||||
|
||||
@@ -1002,7 +1035,7 @@ class download_shortcodes extends e_shortcode
|
||||
function sc_download_view_date_lan()
|
||||
{
|
||||
|
||||
return ($this->var['download_datestamp']) ? LAN_DATE: "";
|
||||
return ($this->var['download_datestamp']) ? LAN_DATE : "";
|
||||
}
|
||||
|
||||
function sc_download_view_image_lan()
|
||||
@@ -1047,7 +1080,7 @@ class download_shortcodes extends e_shortcode
|
||||
/**
|
||||
* {DOWNLOAD_VIEW_PREV: x=y}
|
||||
*/
|
||||
function sc_download_view_prev($parm='')
|
||||
function sc_download_view_prev($parm = '')
|
||||
{
|
||||
$sql = e107::getDb();
|
||||
$tp = e107::getParser();
|
||||
@@ -1057,28 +1090,29 @@ class download_shortcodes extends e_shortcode
|
||||
$icon = (deftrue('BOOTSTRAP')) ? $tp->toGlyph('fa-chevron-left') : '<<';
|
||||
$class = empty($parm['class']) ? 'e-tip page-link' : $parm['class'];
|
||||
|
||||
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"))
|
||||
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"))
|
||||
{
|
||||
$dlrowrow = $sql->fetch();
|
||||
|
||||
$url = e107::url('download', 'item', $dlrowrow);
|
||||
|
||||
|
||||
return "<a class='".$class."' href='".$url ."' title=\"".$dlrowrow['download_name']."\">".$icon." ".LAN_PREVIOUS."</a>\n";
|
||||
return "<a class='" . $class . "' href='" . $url . "' title=\"" . $dlrowrow['download_name'] . "\">" . $icon . " " . LAN_PREVIOUS . "</a>\n";
|
||||
|
||||
// return "<a href='".e_PLUGIN_ABS."download/download.php?action=view&id=".$dlrowrow['download_id']."'><< ".LAN_dl_33." [".$dlrowrow['download_name']."]</a>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$class .= ' disabled';
|
||||
return "<a class='".$class."' href='#' >".$icon." ".LAN_PREVIOUS."</a>\n";
|
||||
|
||||
return "<a class='" . $class . "' href='#' >" . $icon . " " . LAN_PREVIOUS . "</a>\n";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {DOWNLOAD_VIEW_NEXT: x=y}
|
||||
*/
|
||||
function sc_download_view_next($parm='')
|
||||
function sc_download_view_next($parm = '')
|
||||
{
|
||||
$sql = e107::getDb();
|
||||
$tp = e107::getParser();
|
||||
@@ -1086,23 +1120,22 @@ class download_shortcodes extends e_shortcode
|
||||
$icon = (deftrue('BOOTSTRAP')) ? $tp->toGlyph('fa-chevron-right') : '>>';
|
||||
$class = empty($parm['class']) ? 'e-tip page-link' : $parm['class'];
|
||||
|
||||
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"))
|
||||
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);
|
||||
$url = $url = e107::url('download', 'item', $dlrowrow);
|
||||
|
||||
|
||||
|
||||
|
||||
return "<a class='".$class."' href='".$url."' title=\"".$dlrowrow['download_name']."\">".LAN_NEXT." ".$icon."</a>\n";
|
||||
return "<a class='" . $class . "' href='" . $url . "' title=\"" . $dlrowrow['download_name'] . "\">" . LAN_NEXT . " " . $icon . "</a>\n";
|
||||
|
||||
// return "<a href='".e_PLUGIN_ABS."download/download.php?action=view&id=".$dlrowrow['download_id']."'>[".$dlrowrow['download_name']."] ".LAN_dl_34." >></a>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$class .= ' disabled';
|
||||
return "<a class='".$class."' href='#' >".LAN_NEXT." ".$icon."</a>\n";
|
||||
|
||||
return "<a class='" . $class . "' href='#' >" . LAN_NEXT . " " . $icon . "</a>\n";
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1110,7 +1143,7 @@ class download_shortcodes extends e_shortcode
|
||||
/**
|
||||
* {DOWNLOAD_BACK_TO_LIST: x=y}
|
||||
*/
|
||||
function sc_download_back_to_list($parm=null)
|
||||
function sc_download_back_to_list($parm = null)
|
||||
{
|
||||
$url = e107::url('download', 'category', $this->var);
|
||||
// e_PLUGIN_ABS."download/download.php?action=list&id=".$this->var['download_category']
|
||||
@@ -1118,12 +1151,12 @@ class download_shortcodes extends e_shortcode
|
||||
$title = "Back to [x]";
|
||||
$class = empty($parm['class']) ? 'e-tip page-link' : $parm['class'];
|
||||
|
||||
return "<a class='".$class."' title=\"".e107::getParser()->lanVars($title,array('x'=>$this->var['download_category_name']))."\" href='".$url."'>".LAN_BACK."</a>";
|
||||
return "<a class='" . $class . "' title=\"" . e107::getParser()->lanVars($title, array('x' => $this->var['download_category_name'])) . "\" href='" . $url . "'>" . LAN_BACK . "</a>";
|
||||
}
|
||||
|
||||
function sc_download_back_to_category_list()
|
||||
{
|
||||
if(!empty($this->parent))
|
||||
if (!empty($this->parent))
|
||||
{
|
||||
$link = e107::url('download', 'category', $this->parent);
|
||||
}
|
||||
@@ -1132,22 +1165,22 @@ class download_shortcodes extends e_shortcode
|
||||
$link = ($this->var['download_category_id']) ? e107::url('download', 'category', $this->var) : null;
|
||||
}
|
||||
|
||||
return "<a class='btn btn-default btn-secondary btn-xs btn-mini' href='".$link."'>".LAN_dl_9."</a>";
|
||||
return "<a class='btn btn-default btn-secondary btn-xs btn-mini' href='" . $link . "'>" . LAN_dl_9 . "</a>";
|
||||
}
|
||||
|
||||
|
||||
// Misc stuff ---------------------------------------------------------------------------------
|
||||
function sc_download_cat_newdownload_text()
|
||||
{
|
||||
return $this->renderNewIcon()." ".LAN_dl_36;
|
||||
return $this->renderNewIcon() . " " . LAN_dl_36;
|
||||
}
|
||||
|
||||
function sc_download_cat_search()
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
$text = "<form class='form-search form-inline' method='get' action='".e_HTTP."search.php'>";
|
||||
$text = "<form class='form-search form-inline' method='get' action='" . e_HTTP . "search.php'>";
|
||||
$text .= '<div><div class="input-group">';
|
||||
$text .= "<input class='tbox form-control search-query' type='text' name='q' size='30' value='' placeholder=\"".LAN_SEARCH."\" maxlength='50' />
|
||||
$text .= "<input class='tbox form-control search-query' type='text' name='q' size='30' value='' placeholder=\"" . LAN_SEARCH . "\" maxlength='50' />
|
||||
<input type='hidden' name='r' value='0' />
|
||||
<input type='hidden' name='t' value='download' />
|
||||
";
|
||||
@@ -1175,7 +1208,6 @@ class download_shortcodes extends e_shortcode
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
@@ -1184,7 +1216,8 @@ class download_shortcodes extends e_shortcode
|
||||
if (!$source) return " ";
|
||||
// list($ret[TRUE],$ret[FALSE]) = explode(chr(1), $source.chr(1)); //XXX ???
|
||||
// if (!$ret[FALSE]) $ret[FALSE] = $ret[TRUE]; //XXX ???
|
||||
$parms = array('legacy'=> "{e_IMAGE}icons/");
|
||||
$parms = array('legacy' => "{e_IMAGE}icons/");
|
||||
|
||||
return e107::getParser()->toIcon($source, $parms);
|
||||
//return "<img src='".e_IMAGE."icons/{$ret[($count!=0)]}' alt='*'/>";
|
||||
}
|
||||
@@ -1204,12 +1237,12 @@ class download_shortcodes extends e_shortcode
|
||||
|
||||
private function renderNewIcon()
|
||||
{
|
||||
if(!defined('IMAGE_NEW'))
|
||||
if (!defined('IMAGE_NEW'))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if(strpos(IMAGE_NEW, '<i ') !== false || strpos(IMAGE_NEW, '<span') !== false)
|
||||
if (strpos(IMAGE_NEW, '<i ') !== false || strpos(IMAGE_NEW, '<span') !== false)
|
||||
{
|
||||
return IMAGE_NEW;
|
||||
}
|
||||
|
Reference in New Issue
Block a user