コード例 #1
0
ファイル: globals.php プロジェクト: IASA-GR/appdb-core
 private static function getRecipients()
 {
     return array(EmailConfiguration::getSupportAddress());
 }
コード例 #2
0
ファイル: outdatedapp.php プロジェクト: IASA-GR/appdb-core
 public static function sendMessages($isReminder = false)
 {
     $items = db()->query("SELECT * FROM nonvalidated_apps_per_owner")->fetchAll();
     foreach ($items as $item) {
         $text = "";
         $body = "";
         if (is_null($item["contact"])) {
             error_log("[OutdatedApps]: No contact info for " . $item["ownerid"] . ":" . $item["firstname"] . " " . $item["lastname"]);
             //TODO: Case where the owner of the application has no contact point
             continue;
         }
         $recipients = array($item["contact"]);
         $subject = "Notification:";
         if (isnull($item["lastsent"]) == false) {
             $subject = "Reminder:";
         }
         $subject .= "EGI AppDB outdated software profile";
         $appids = $item["appids"];
         $appids = explode(";", $appids);
         $appnames = $item["appnames"];
         $appnames = explode(";", $appnames);
         if (count($appids) == 0) {
             continue;
         }
         if (count($appids) == 1) {
             $template = self::getTemplateBody($item["firstname"] . " " . $item["lastname"]);
             $body = preg_replace("/\\[1\\]/", "<a href='http://" . $_SERVER["APPLICATION_UI_HOSTNAME"] . "?p=" . base64_encode("/apps/details?id=" . $appids[0]) . "' target='_blank'>" . $appnames[0] . "</a>", $template);
             $body = preg_replace("/\\[2\\]/", "<a href='http://" . $_SERVER["APPLICATION_UI_HOSTNAME"] . "' target='_blank'>EGI Applications Database</a>", $body);
             $body = "<html><head></head><body><pre>" . $body . "</pre></body></html>";
             $text = preg_replace("/\\[1\\]/", "" . $appnames[0] . " [1]", $template);
             $text = preg_replace("/\\[2\\]/", "EGI Applications Database [2]", $text);
             $text .= "\n\n________________________________________________________________________________________________________\n";
             $text .= "[1]. http://" . $_SERVER["APPLICATION_UI_HOSTNAME"] . "?p=" . base64_encode("/apps/details?id=" . $appids[0]) . "\n";
             $text .= "[2]. http://" . $_SERVER["APPLICATION_UI_HOSTNAME"];
         } else {
             $template = self::getTemplateListBody($item["firstname"] . " " . $item["lastname"]);
             $listpermalink = "http://" . $_SERVER["APPLICATION_UI_HOSTNAME"] . "?p=" . base64_encode('{"url":"/apps","query":{"flt":"=application.owner:' . $item["ownerid"] . ' +=application.validated:false"},"ext":{"isBaseQuery":true,"append":true,"filterDisplay":"Search outdated...","mainTitle":"Outdated entries"}}');
             $body = preg_replace("/\\[1\\]/", "<a href='" . $listpermalink . "' target='_blank'>software</a>", $template);
             $body = preg_replace("/\\[2\\]/", "<a href='http://" . $_SERVER["APPLICATION_UI_HOSTNAME"] . "' target='_blank'>EGI Applications Database</a>", $body);
             $body = "<html><head></head><body><pre>" . $body . "</pre></body></html>";
             $text = preg_replace("/\\[1\\]/", "software [1]", $template);
             $text = preg_replace("/\\[2\\]/", "EGI Applications Database [2]", $text);
             $text .= "\n\n________________________________________________________________________________________________________\n";
             $text .= "[1]. " . $listpermalink . " \n";
             $text .= "[2]. http://" . $_SERVER["APPLICATION_UI_HOSTNAME"];
             $bodylist = "";
             $textlist = "";
             //Make unique arrays of application ids and names
             $unames = array();
             $uids = array();
             for ($i = 0; $i < count($appids); $i += 1) {
                 if (in_array($appids[$i], $uids) === false) {
                     $uids[] = $appids[$i];
                     $unames[] = $appnames[$i];
                 }
             }
             $appids = $uids;
             $appnames = $unames;
             for ($i = 0; $i < count($appids); $i += 1) {
                 $bodylist .= "<div style='padding-left:10px;'>-<a href='http://" . $_SERVER["APPLICATION_UI_HOSTNAME"] . "?p=" . base64_encode("/apps/details?id=" . $appids[$i]) . "' target='_blank'>" . $appnames[$i] . "</a></div>";
                 $textlist .= "\t- " . $appnames[$i] . "\n";
             }
             $body = preg_replace("/\\[\\*\\]/", $bodylist, $body);
             $text = preg_replace("/\\[\\*\\]/", $textlist, $text);
         }
         if (ApplicationConfiguration::isProductionInstance() === FALSE) {
             error_log("SENDING OUTDATED TO:");
             error_log("SUBJECT:" . $subject);
             error_log("RECIPIENTS: " . var_export($recipients, true));
             error_log("BODY: " . $text);
             echo "<div style='background-color:lightgrey;border:1px solid black'><b>subject:</b>" . $subject . "</div><div style='background-color:lightgrey;margin-bottom:10px;border:1px solid black'><b>TO:</b>" . implode(",", $recipients) . "</div><div style='background-color:lightgreen;border:1px solid black;'>" . $body . "</div><div style='background-color:#99DBFF;margin-bottom:10px;border:1px solid black'><pre>" . $text . "</pre></div>";
         } else {
             //sendMultipartMail($subject,$recipients,$text,$body,'*****@*****.**','enadyskolopassword','*****@*****.**',null, false,array("Precedence"=>"bulk"));
             EmailService::sendBulkReport($subject, $recipients, $text, $body, EmailConfiguration::getSupportAddress());
         }
     }
     if (APPLICATION_ENV === "production") {
         db()->query("INSERT INTO app_validation_log (appid) SELECT DISTINCT id FROM applications, (SELECT string_to_array(array_to_string(array_agg(array_to_string(ids,',')),','),',') as ids FROM (SELECT string_to_array(appids, ';') as ids FROM (SELECT * FROM nonvalidated_apps_per_owner) AS t) as tt) as ttt WHERE id::text = ANY(ttt.ids)")->fetchAll();
     }
     return true;
 }
コード例 #3
0
 public function feedbackAction()
 {
     $this->_helper->layout->disableLayout();
     if ($_SERVER["REQUEST_METHOD"] == "GET") {
         $this->view->src = isset($_GET["src"]) ? $_GET["src"] : null;
         $this->view->username = "";
         $this->view->contacts = array();
         if ($this->session->userid !== null) {
             $this->view->username = $this->session->fullName;
             $cnts = new Default_Model_Contacts();
             $cnts->filter->researcherid->equals($this->session->userid)->and($cnts->filter->contacttypeid->equals(7));
             if (count($cnts->items) > 0) {
                 $this->view->contacts = $cnts->items;
             }
         } else {
             $this->view->captcha = $this->generateCaptchaForm();
         }
     } else {
         if ($_SERVER["REQUEST_METHOD"] == "POST") {
             $this->_helper->viewRenderer->setNoRender();
             $feedback = isset($_POST["feedback"]) && trim($_POST["feedback"]) !== "" ? $_POST["feedback"] : "";
             $subject = isset($_POST["subject"]) && trim(stripslashes($_POST["subject"])) !== "" ? stripslashes($_POST["subject"]) : "<no subject>";
             $email = isset($_POST["email"]) && trim(stripslashes($_POST["email"])) !== "" ? stripslashes($_POST["email"]) : "";
             $cc = isset($_POST["cc"]) && trim($_POST["cc"]) !== "" ? $_POST["cc"] : false;
             $name = isset($_POST["name"]) && trim($_POST["name"]) !== "" ? $_POST["name"] : "anonymous";
             $captchaid = isset($_POST["captchaid"]) && trim($_POST["captchaid"]) !== "" ? $_POST["captchaid"] : "";
             $captcha = isset($_POST["captcha"]) && trim($_POST["captcha"]) !== "" ? $_POST["captcha"] : "";
             header("Content-type: text/xml; charset=utf-8");
             echo '<' . '?xml version="1.0"?' . '>';
             if ($feedback == "") {
                 echo "<response error='no feedback given' group='feedback'></response>";
                 return;
             }
             if ($email == "") {
                 echo "<response error='no email given' group='email'></response>";
                 return;
             }
             $bodyheader = "----------------------------------------------------------------------------\n";
             $bodyheader .= "Feedback from user: "******" " . ($this->session->userid !== null ? "(id:" . $this->session->userid . ")" : "") . " \n";
             $bodyheader .= "User email: " . $email . " \n";
             $bodyheader .= "----------------------------------------------------------------------------\n\n";
             //Make receivers array
             if (strpos($email, ";") !== false) {
                 $emailto = explode(";", $email);
                 $email = array();
                 for ($i = 0; $i < count($emailto); $i += 1) {
                     $emailto[$i] = trim($emailto[$i]);
                     if ($emailto[$i] !== "") {
                         $email[] = $emailto[$i];
                     }
                 }
             } else {
                 $email = array($email);
             }
             //Validate email format
             for ($i = 0; $i < count($email); $i += 1) {
                 if (!preg_match('/^([0-9a-z]+[-._+&])*[0-9a-z]+@([-0-9a-z]+[.])+[a-z]{2,6}$/i', $email[$i])) {
                     echo "<response error='Email " . $email[$i] . " is invalid' group='email'></response>";
                     return;
                 }
             }
             $body = base64_decode($feedback);
             $body = stripslashes($body);
             if (trim($body) == "") {
                 echo "<response error='no feedback given' group='feedback'></response>";
                 return;
             }
             if (preg_match("/(\r|\n)(to:|from:|cc:|bcc:)/i", $body)) {
                 echo "<response error='Message body contains invalid headers' group='feedback'></response>";
                 return;
             }
             if ($this->session->userid === null) {
                 if (trim($captchaid) == "" && trim($captcha) == "") {
                     echo "<response error='Must login first to send message'></response>";
                     return;
                 }
                 $sessionkey = "Zend_Form_Captcha_" . $captchaid;
                 if (isset($_SESSION[$sessionkey]) && isset($_SESSION[$sessionkey]["word"]) && $_SESSION[$sessionkey]["word"] == $captcha) {
                 } else {
                     echo "<response error='Security word is wrong' group='captcha'></response>";
                     return;
                 }
             }
             $subject = "[AppDB Portal Feedback]: " . $subject;
             $body = $bodyheader . $body;
             //Send email
             $recs = array(EmailConfiguration::getSupportAddress());
             $ccemails = false;
             if ($cc == true) {
                 $ccemails = $email;
             }
             //sendMultipartMail($subject,$recs, $body, '', '*****@*****.**', 'enadyskolopassword', $email[0], null, $ccemails);
             EmailService::sendReport($subject, $recs, $body, '', $email[0], null, $ccemails);
             $to = "";
             foreach ($email as $e) {
                 if (trim($to) !== "") {
                     $to .= ";";
                 }
                 $to .= $e;
             }
             echo "<response to='" . htmlspecialchars($to, ENT_QUOTES) . "' subject='" . htmlspecialchars($subject, ENT_QUOTES) . "' cc='" . $cc . "' >" . htmlspecialchars($body, ENT_QUOTES) . "</response>";
         }
     }
 }
コード例 #4
0
ファイル: accountconnect.php プロジェクト: IASA-GR/appdb-core
 private static function sendConfirmationEmail($session, $pending)
 {
     $researcher = $pending->getResearcher();
     $email = $researcher->getPrimaryContact();
     $accounttype = str_replace("-", " ", trim($pending->accountType));
     $accountname = trim($pending->accountName) === "" ? $pending->accountID : $pending->accountName;
     $res = "Dear " . $researcher->name . ",\n\n";
     $res .= "    a request has been made to connect the " . $accounttype . " account of " . $accountname . "\n";
     $res .= "to your profile in the EGI Applications Database [1].\n";
     $res .= "If it is really you the one that made this request and you wish to proceed with the account connection\n";
     $res .= " - go to the EGI Applications Database Portal[1] and\n";
     $res .= " - sign in with the same " . $accounttype . " account.\n";
     $res .= "The system will prompt you with a form where you should enter the confirmation code bellow:\n\n";
     $res .= "   Confirmation Code: " . $pending->code . "\n\n";
     $res .= "Note: The confirmation code expires 30 minutes after this message was sent.\n\n";
     $res .= "If you are not the one that made this request, then please report the incident by replying to this message.\n\n";
     $res .= "Best regards,\n";
     $res .= "EGI AppDB team\n";
     $res .= "\n\n__________________________________________________\n";
     $res .= "[1]. http://" . $_SERVER["APPLICATION_UI_HOSTNAME"];
     $subject = "EGI AppDB: Request to connect " . $accounttype . " account to your profile";
     $text = $res;
     $body = $body = preg_replace("/\n/", "<br/>", $res);
     $body = "<div>" . $body . "</div>";
     //DEVELOPMENT CODE
     if (ApplicationConfiguration::isProductionInstance() === FALSE) {
         error_log("\nSending to: " . $email);
         error_log("\n\n" . $res);
     }
     $recipients = array($email);
     //sendMultipartMail($subject,$recipients,$text,$body,'*****@*****.**','enadyskolopassword','*****@*****.**',null, false,array("Precedence"=>"bulk"));
     EmailService::sendBulkReport($subject, $recipients, $text, $body, EmailConfiguration::getSupportAddress());
 }
コード例 #5
0
ファイル: socialreport.php プロジェクト: IASA-GR/appdb-core
 private static function mailDispatchReport($recipients, $filename, $folder)
 {
     $reportcsv = file_get_contents($folder . $filename . ".csv");
     if ($reportcsv === false) {
         error_log("[SocialReport::mailDispatch]: Could not load report " . $filename);
         return false;
     }
     $subject = "EGI AppDB Social media sharing report (" . date('Y') . "-" . date('m') . "-" . date('d') . ")";
     $sbody = "This is an automatically generated report for social media sharing count per registered software item.";
     $sbody = $sbody . "Please find attached a CSV file containing the report.<br/>";
     $sbody = $sbody . "You can access this report at http://" . $_SERVER['APPLICATION_UI_HOSTNAME'] . "/reports/social/" . $filename . ".csv <br/><br/>";
     $sbody = $sbody . "Regards,<br/>";
     $sbody = $sbody . "EGI AppDB Team";
     $textsbody = simpleHTML2Text($sbody);
     $att = array("data" => $reportcsv, "type" => "application/vnd.ms-excel", "name" => $filename . ".csv");
     //sendMultipartMail($subject, $recipients, $textsbody, $sbody, '*****@*****.**', 'enadyskolopassword', '*****@*****.**',$att, false,array("Precedence"=>"bulk"));
     EmailService::sendBulkReport($subject, $recipients, $textsbody, $sbody, EmailConfiguration::getSupportAddress(), $att);
 }