diff --git a/e107_plugins/download/e_notify.php b/e107_plugins/download/e_notify.php new file mode 100644 index 000000000..3472dedff --- /dev/null +++ b/e107_plugins/download/e_notify.php @@ -0,0 +1,48 @@ + 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 .= " ".$data['download_name']."
"; + $message .= str_replace("[x]", $data['user'], LAN_DL_NT_03)."
"; + $message .= $data['report_add']; + } + + $this->send('user_download_brokendownload_reported', LAN_DL_NT_01, $message); + } + +} \ No newline at end of file diff --git a/e107_plugins/download/handlers/download_class.php b/e107_plugins/download/handlers/download_class.php index 1f6c90959..8ae0b1e00 100644 --- a/e107_plugins/download/handlers/download_class.php +++ b/e107_plugins/download/handlers/download_class.php @@ -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 .= "
".LAN_dl_48."
".LAN_dl_49.""; - return $ns->tablerender(LAN_PLUGIN_DOWNLOAD_NAME, $text, 'download-report', true); } else { - // require_once(HEADERF); - - - $text = $frm->breadcrumb($breadcrumb); diff --git a/e107_plugins/download/includes/admin.php b/e107_plugins/download/includes/admin.php index 2990bdd64..bbd39f456 100644 --- a/e107_plugins/download/includes/admin.php +++ b/e107_plugins/download/includes/admin.php @@ -2229,11 +2229,15 @@ $columnInfo = array( ".DOWLAN_151." ". r_userclass("download_reportbroken", $pref['download_reportbroken'])." - + "; + + //moved to e_notify + /* ".DOWLAN_150." ". ($pref['download_email'] ? "" : "")." - + */ + $text .= " diff --git a/e107_plugins/download/languages/English/English_global.php b/e107_plugins/download/languages/English/English_global.php index 6670f7007..6a6bb7115 100644 --- a/e107_plugins/download/languages/English/English_global.php +++ b/e107_plugins/download/languages/English/English_global.php @@ -1,8 +1,9 @@ \ No newline at end of file +// 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:");