1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 20:58:30 +01:00

Downloads: Fixes #2576 - Report Broken Download breadcrumb URLs and cleanup.

This commit is contained in:
Cameron 2017-05-05 10:11:40 -07:00
parent abc1b3408b
commit 963f35ded1
3 changed files with 46 additions and 21 deletions

View File

@ -781,7 +781,14 @@ class download_shortcodes extends e_shortcode
function sc_download_report_link()
{
$pref = e107::getPref();
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>" : "";
if(check_class($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>";
}
return '';
}
function sc_download_view_caption()

View File

@ -114,6 +114,13 @@ class download_url // plugin-folder + '_url'
'redirect' => '{e_PLUGIN}download/request.php?id=$1', // file-path of what to load when the regex returns true.
);
$config['report'] = array(
'regex' => '^{alias}/report/([\d]*)/(.*)$',
'sef' => '{alias}/report/{download_id}/{download_sef}',
'redirect' => '{e_PLUGIN}download/download.php?action=report&id=$1', // file-path of what to load when the regex returns true.
);
$config['image'] = array(
'regex' => '^{alias}/image/([\d]*)/(.*)$',
'sef' => '{alias}/image/{download_id}/{download_sef}',

View File

@ -781,12 +781,21 @@ class download
$dlrow = $sql->fetch();
extract($dlrow);
// extract($dlrow);
$download_name = $tp->toDB($dlrow['download_name']);
$download_id = (int) $dlrow['download_id'];
$breadcrumb = array();
$breadcrumb[] = array('text' => LAN_PLUGIN_DOWNLOAD_NAME, 'url' => e107::url('download','index', $dlrow));
$breadcrumb[] = array('text' => $dlrow['download_category_name'], 'url' => e107::url('download','category', $dlrow)); // e_SELF."?action=list&id=".$dlrow['download_category_id']);
$breadcrumb[] = array('text' => $dlrow['download_name'], 'url' => e107::url('download','item', $dlrow)); //e_SELF."?action=view&id=".$dlrow['download_id']);
$breadcrumb[] = array('text' => LAN_dl_45, 'url' => null);
if (isset($_POST['report_download']))
{
$report_add = $tp->toDB($_POST['report_add']);
$download_name = $tp->toDB($download_name);
$user = USER ? USERNAME : LAN_GUEST;
if ($pref['download_email'])
@ -798,36 +807,38 @@ class download
sendemail(SITEADMINEMAIL, $subject, $report);
}
$sql->insert('generic', "0, 'Broken Download', ".time().",'".USERID."', '{$download_name}', {$id}, '{$report_add}'");
$sql->insert('generic', "0, 'Broken Download', ".time().",'".USERID."', '{$download_name}', {$download_id}, '{$report_add}'");
define("e_PAGETITLE", LAN_PLUGIN_DOWNLOAD_NAME." / ".LAN_dl_47);
define("e_PAGETITLE", LAN_PLUGIN_DOWNLOAD_NAME." / ".LAN_dl_45);
$text = $frm->breadcrumb($breadcrumb);
$text = LAN_dl_48."<br /><br /><a href='".e_PLUGIN."download/download.php?action=view&id=".$download_id."'>".LAN_dl_49."</a>";
$text .= "<div class='alert alert-success'>".LAN_dl_48."</div>
<a class='btn btn-primary' href='".e107::url('download','item', $dlrow)."'>".LAN_dl_49."</a>";
return $ns->tablerender(LAN_PLUGIN_DOWNLOAD_NAME, $text, 'download-report', true);
}
else
{
define("e_PAGETITLE", LAN_PLUGIN_DOWNLOAD_NAME." / ".LAN_dl_51." ".$download_name);
define("e_PAGETITLE", LAN_PLUGIN_DOWNLOAD_NAME." / ".LAN_dl_45." ".$download_name);
// require_once(HEADERF);
$breadcrumb = array();
$breadcrumb[] = array('text' => LAN_PLUGIN_DOWNLOAD_NAME, 'url' => e_SELF);
$breadcrumb[] = array('text' => $dlrow['download_category_name'], 'url' => e_SELF."?action=list&id=".$dlrow['download_category_id']);
$breadcrumb[] = array('text' => $dlrow['download_name'], 'url' => e_SELF."?action=view&id=".$dlrow['download_id']);
$breadcrumb[] = array('text' => LAN_dl_50, 'url' => null);
$text = $frm->breadcrumb($breadcrumb);
$text .= "<form action='".e_SELF."?report.{$download_id}' method='post'>
<div>
".LAN_DOWNLOAD.": <a href='".e_PLUGIN."download/download?action=view&id={$download_id}'>".$download_name."</a>
</div>
<div>".LAN_dl_54."<br />".LAN_dl_55."</div>
<div> ".$frm->textarea('report_add')."</div>
<div class='text-center'>
$formUrl = e107::url('download', 'report', $dlrow);
$fileUrl = e107::url('download', 'view', $dlrow);
$text .= "<form action='".$formUrl."' method='post'>
<div class='form-group'>
<p> ".LAN_DOWNLOAD.": <a href='".$fileUrl."'>".$download_name."</a></p>
<p>".LAN_dl_54."<br />".LAN_dl_55."</p>
</div>
<div class='form-group clearfix'> ".$frm->textarea('report_add', '')."</div>
<div class='form-group text-center'>
".$frm->button('report_download',LAN_dl_45,'submit')."
</div>
</form>";