public function logindevAction() { //Apply only in development enviroments if (ApplicationConfiguration::isEnviroment("production") === FALSE) { $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(); $this->session->userid = isset($_GET["id"]) ? $_GET["id"] : NULL; $us = new Default_Model_Researchers(); $us->viewModerated = true; $us->filter->id->equals($this->session->userid); if (count($us->items) > 0) { $this->session->username = $us->items[0]->username; $this->session->fullName = $us->items[0]->name; $this->session->userRole = $us->items[0]->positionTypeID; $this->session->userCountryID = $us->items[0]->countryID; $this->session->userCountryName = $us->items[0]->country->name; $this->session->cname = $us->items[0]->cname; } else { $this->logoutAction(); } $this->view->session = $this->session; $this->view->entries = null; $users = new Default_Model_Researchers(); $users->viewModerated = true; $users->filter->id->equals($this->session->userid); if (count($users->items) > 0) { $user = $users->items[0]; setcookie("SimpleSAMLAuthToken", "09a4fcd92a07c008c2de0dcba1665580", 0, "/", null, true, true); //Create new user credentials $cred = new Default_Model_UserCredential(); $cred->researcherid = $this->session->userid; $cred->sessionid = session_id(); $cred->token = '09a4fcd92a07c008c2de0dcba1665580'; $cred->save(); $this->session->developsession = true; if ($user->deleted === true) { //Setup session variables in case of deleted profile $this->session->userDeleted = $user->deleted; if (isset($user->delInfo)) { $this->session->userDeletedById = $user->delInfo->deleter->id; $this->session->userDeletedByName = $user->delInfo->deleter->name; $this->session->userDeletedByCName = $user->delInfo->deleter->cname; $this->session->userDeletedOn = $user->delInfo->deletedOn; } else { $this->session->userDeletedById = null; $this->session->userDeletedByName = null; $this->session->userDeletedByCName = null; $this->session->userDeletedOn = null; } $this->_redirect('/saml/deletedprofile'); return; } else { //Get first user account and initialize saml session $uaccounts = new Default_Model_UserAccounts(); $uaccounts->filter->researcherid->equals($user->id); if (count($uaccounts->items) > 0) { $uaccount = $uaccounts->items[0]; SamlAuth::setupSamlSession($this->session, $uaccount, $user); } } } header('Location: https://' . $_SERVER['HTTP_HOST']); $this->session->userWarning = array("title" => "Development user", "message" => "You are currently signed in developer mode"); } }
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>"); } }