public function submitAction() { if ($this->session->userid !== null) { $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(); $type = $this->_getParam("type"); $entryID = $this->_getParam("entryID"); $comment = $this->_getParam("comment"); $reason = $this->_getParam("reason"); switch ($reason) { case self::REASON_OTHER: $reason_str = 'Other'; break; case self::REASON_COPYRIGHT_ISSUE: $reason_str = 'Copyright Issue'; break; case self::REASON_INAPPROPRIATE_CONTENT: $reason_str = 'Inappropriate Content'; break; case self::REASON_INVALID_DATA: $reason_str = 'Invalid or False Data'; break; case self::REASON_OUT_OF_DATE: $reason_str = 'Out of Date Information'; break; case self::REASON_BROKEN_LINK: $reason_str = 'Broken Link'; break; case self::REASON_SPELLING: $reason_str = 'Typo/Misspelling'; break; default: $reason_str = 'Other'; break; } $offender = "id={$entryID}"; $subject = "AppDB report"; if (ApplicationConfiguration::isEnviroment("production")) { $to = EmailConfiguration::getList('ucst'); } else { $to = EmailConfiguration::getList('debug'); } $offenderApp = ""; $body = "EGI Applications Database Abuse Report \n\n" . "A user has submitted a report concerning a" . (in_array(strtolower(substr($type, 0, 1)), array('a', 'e', 'i', 'o', 'u')) ? "n" : "") . " " . $type . "\n\n"; $body = "--------------------------------------------------\n"; $body .= "Please do not reply, this is an automated message.\n"; $body .= "--------------------------------------------------\n\n"; if ($type == "application") { $subject .= " - problem on content"; $body .= "EGI Applications Database problem report on content \n\n"; $body .= "A user has submitted a problem report concerning the software "; $apps = new Default_Model_Applications(); $apps->filter->id->equals($entryID); if (count($apps->items) > 0) { $offender = $apps->items[0]->name . ' (http://' . $_SERVER['HTTP_HOST'] . '/?p=' . base64_encode('/apps/details?id=' . $apps->items[0]->id) . ")"; $body .= $apps->items[0]->name . " with id: " . $apps->items[0]->id; } } elseif ($type == "comment") { $subject .= " - abuse on comment"; $body .= "EGI Applications Database abuse report on a comment\n\n"; $body .= "A user has submitted an abuse report concerning the software "; $aprs = new Default_Model_AppRatings(); $aprs->filter->id->equals($entryID); if (count($aprs->items) > 0) { $cid = $apps->items[0]->id; $apps = new Default_Model_Applications(); $apps->filter->id->equals($aprs->items[0]->appid); if (count($apps->items[0]) > 0) { $body .= $apps->items[0]->name . " with id: " . $apps->items[0]->id; $rs = new Default_Model_Researchers(); $rs->filter->id->equals($aprs->items[0]->submitterid); if (count($rs->items) > 0) { $commentPersonName = $rs->items[0]->firstname . ' ' . $rs->items[0]->lastname; } else { $commentPersonName = 'a guest user'; } $commentDate = new DateTime($aprs->items[0]->submittedon); $commentDate = $commentDate->format('Y-m-d H:i'); $offenderApp = "Offensive software entry: " . $apps->items[0]->name . ' (http://' . $_SERVER['HTTP_HOST'] . '/?p=' . base64_encode('/apps/details?id=' . $apps->items[0]->id) . ")\n"; $offender = "submitted by {$commentPersonName} on {$commentDate} (Comment ID: {$entryID})"; } } } $body = $body . "\n\n"; $body .= $offenderApp . "Offensive " . $type . " entry: " . $offender . "\n" . 'Submitter: ' . $this->session->fullName . ' (http://' . $_SERVER['HTTP_HOST'] . '/?p=' . base64_encode('/people/details?id=' . $this->session->userid) . ")\n" . "Reason: " . $reason_str . "\n\n" . "Description: " . $comment . "\n"; //sendMultipartMail($subject, $to, $body,"<pre>".$body."</pre>", '*****@*****.**', 'enadyskolopassword'); EmailService::sendReport($subject, $to, $body, "<pre>" . $body . "</pre>"); } }