mirror of
https://github.com/e107inc/e107.git
synced 2025-08-05 14:17:49 +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:
48
e107_plugins/download/e_notify.php
Normal file
48
e107_plugins/download/e_notify.php
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* e107 website system
|
||||||
|
*
|
||||||
|
* Copyright (C) 2008-2014 e107 Inc (e107.org)
|
||||||
|
* Released under the terms and conditions of the
|
||||||
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!defined('e107_INIT')) { exit; }
|
||||||
|
|
||||||
|
// v2.x Standard
|
||||||
|
class download_notify extends notify // plugin-folder + '_notify'
|
||||||
|
{
|
||||||
|
function config()
|
||||||
|
{
|
||||||
|
$config = array();
|
||||||
|
|
||||||
|
$config[] = array(
|
||||||
|
'name' => LAN_DL_NT_01, // "Broken download reported"
|
||||||
|
'function' => "user_download_brokendownload_reported",
|
||||||
|
'category' => ''
|
||||||
|
);
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
function user_download_brokendownload_reported($data)
|
||||||
|
{
|
||||||
|
$download_url = e107::url('download', 'item', $data, array('mode' => 'full'));
|
||||||
|
|
||||||
|
if (isset($data['id']) && isset($data['data']))
|
||||||
|
{
|
||||||
|
$message = 'Notify test: Broken download reported';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$message = LAN_DL_NT_02;
|
||||||
|
$message .= " <a href=".$download_url.">".$data['download_name']."</a><br>";
|
||||||
|
$message .= str_replace("[x]", $data['user'], LAN_DL_NT_03)."<br>";
|
||||||
|
$message .= $data['report_add'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->send('user_download_brokendownload_reported', LAN_DL_NT_01, $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -899,33 +899,36 @@ class download
|
|||||||
*/
|
*/
|
||||||
private function renderReport()
|
private function renderReport()
|
||||||
{
|
{
|
||||||
$sql = e107::getDb();
|
$sql = e107::getDb();
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
$ns = e107::getRender();
|
$ns = e107::getRender();
|
||||||
$frm = e107::getForm();
|
$frm = e107::getForm();
|
||||||
$pref = e107::getPref();
|
$pref = e107::getPref();
|
||||||
|
|
||||||
$dlrow = $this->rows;
|
$dlrow = $this->rows;
|
||||||
|
|
||||||
// extract($dlrow);
|
|
||||||
|
|
||||||
$download_name = $tp->toDB($dlrow['download_name']);
|
|
||||||
$download_id = (int) $dlrow['download_id'];
|
|
||||||
|
|
||||||
$breadcrumb = array();
|
$download_name = $tp->toDB($dlrow['download_name']);
|
||||||
$breadcrumb[] = array('text' => LAN_PLUGIN_DOWNLOAD_NAME, 'url' => e107::url('download','index', $dlrow));
|
$download_sef = $dlrow['download_sef'];
|
||||||
$breadcrumb[] = array('text' => $dlrow['download_category_name'], 'url' => e107::url('download','category', $dlrow)); // e_SELF."?action=list&id=".$dlrow['download_category_id']);
|
$download_id = (int) $dlrow['download_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);
|
$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);
|
e107::breadcrumb($breadcrumb);
|
||||||
|
|
||||||
if (isset($_POST['report_download']))
|
if (isset($_POST['report_download']))
|
||||||
{
|
{
|
||||||
$report_add = $tp->toDB($_POST['report_add']);
|
$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'])
|
if ($pref['download_email'])
|
||||||
{ // this needs to be moved into the NOTIFY, with an event.
|
{ // this needs to be moved into the NOTIFY, with an event.
|
||||||
require_once(e_HANDLER."mail.php");
|
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
|
$report = LAN_dl_58." ".SITENAME.":\n".(substr(SITEURL, -1) == "/" ? SITEURL : SITEURL."/")."download.php?view.".$download_id."\n
|
||||||
".LAN_dl_59." ".$user."\n".$report_add;
|
".LAN_dl_59." ".$user."\n".$report_add;
|
||||||
sendemail(SITEADMINEMAIL, $subject, $report);
|
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}'");
|
$sql->insert('generic', "0, 'Broken Download', ".time().",'".USERID."', '{$download_name}', {$download_id}, '{$report_add}'");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$text = $frm->breadcrumb($breadcrumb);
|
$text = $frm->breadcrumb($breadcrumb);
|
||||||
|
|
||||||
$text .= "<div class='alert alert-success'>".LAN_dl_48."</div>
|
$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>";
|
<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);
|
return $ns->tablerender(LAN_PLUGIN_DOWNLOAD_NAME, $text, 'download-report', true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
// require_once(HEADERF);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$text = $frm->breadcrumb($breadcrumb);
|
$text = $frm->breadcrumb($breadcrumb);
|
||||||
|
|
||||||
|
|
||||||
|
@@ -2229,11 +2229,15 @@ $columnInfo = array(
|
|||||||
<tr>
|
<tr>
|
||||||
<td>".DOWLAN_151."</td>
|
<td>".DOWLAN_151."</td>
|
||||||
<td>". r_userclass("download_reportbroken", $pref['download_reportbroken'])."</td>
|
<td>". r_userclass("download_reportbroken", $pref['download_reportbroken'])."</td>
|
||||||
</tr>
|
</tr>";
|
||||||
|
|
||||||
|
//moved to e_notify
|
||||||
|
/*
|
||||||
<tr>
|
<tr>
|
||||||
<td>".DOWLAN_150."</td>
|
<td>".DOWLAN_150."</td>
|
||||||
<td>". ($pref['download_email'] ? "<input type='checkbox' name='download_email' value='1' checked='checked'/>" : "<input type='checkbox' name='download_email' value='1'/>")."</td>
|
<td>". ($pref['download_email'] ? "<input type='checkbox' name='download_email' value='1' checked='checked'/>" : "<input type='checkbox' name='download_email' value='1'/>")."</td>
|
||||||
</tr>
|
</tr>*/
|
||||||
|
$text .= "
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1,8 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
define("LAN_PLUGIN_DOWNLOAD_NAME", "Downloads");
|
define("LAN_PLUGIN_DOWNLOAD_NAME", "Downloads");
|
||||||
define("LAN_PLUGIN_DOWNLOAD_DIZ", "This plugin is a fully featured File-download system");
|
define("LAN_PLUGIN_DOWNLOAD_DIZ", "This plugin is a fully featured File-download system");
|
||||||
|
|
||||||
|
// NOTIFY
|
||||||
|
define("LAN_DL_NT_01", "Broken download reported");
|
||||||
?>
|
define("LAN_DL_NT_02", "The following download has been reported as broken:");
|
||||||
|
define("LAN_DL_NT_03", "It was reported by [x] with the following comments:");
|
||||||
|
Reference in New Issue
Block a user