1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-22 14:13:03 +02:00

#3622 - Download plugin - moving 'Report Broken Download' to e_notify

Work in progress:
- Convert previous 'download_email' pref
- Move broken download list to download plugin admin  /e107_admin/message.php
This commit is contained in:
Tijn Kuyper
2019-10-27 18:20:59 +01:00
parent 1322eef97c
commit e5f024e669
4 changed files with 91 additions and 30 deletions

View File

@@ -899,33 +899,36 @@ class download
*/
private function renderReport()
{
$sql = e107::getDb();
$tp = e107::getParser();
$ns = e107::getRender();
$frm = e107::getForm();
$pref = e107::getPref();
$sql = e107::getDb();
$tp = e107::getParser();
$ns = e107::getRender();
$frm = e107::getForm();
$pref = e107::getPref();
$dlrow = $this->rows;
// 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);
$download_name = $tp->toDB($dlrow['download_name']);
$download_sef = $dlrow['download_sef'];
$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));
$breadcrumb[] = array('text' => $dlrow['download_name'], 'url' => e107::url('download','item', $dlrow));
$breadcrumb[] = array('text' => LAN_dl_45, 'url' => null);
e107::breadcrumb($breadcrumb);
if (isset($_POST['report_download']))
{
$report_add = $tp->toDB($_POST['report_add']);
$user = USER ? USERNAME : LAN_GUEST;
$user = USER ? USERNAME : LAN_GUEST;
$ip = e107::getIPHandler()->getIP(false);
// Replaced with e_notify
/*
if ($pref['download_email'])
{ // this needs to be moved into the NOTIFY, with an event.
require_once(e_HANDLER."mail.php");
@@ -933,27 +936,32 @@ class download
$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);
}
}*/
$brokendownload_data = array(
'download_id' => $download_id,
'download_sef' => $download_sef,
'download_name' => $download_name,
'report_add' => $report_add,
'user' => $user,
'ip' => $ip,
);
e107::getEvent()->trigger('user_download_brokendownload_reported', $brokendownload_data);
$sql->insert('generic', "0, 'Broken Download', ".time().",'".USERID."', '{$download_name}', {$download_id}, '{$report_add}'");
$text = $frm->breadcrumb($breadcrumb);
$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
{
// require_once(HEADERF);
$text = $frm->breadcrumb($breadcrumb);