Ejemplo n.º 1
0
 /**
  * Checks configuration to conclude if EmailService is usable.
  */
 public static function canUse()
 {
     if (isset(self::$_canUse) === false && (self::$_canUse === true || self::$_canUse === false)) {
         return self::$_canUse;
     }
     $canuse = EmailConfiguration::canUse();
     if (strtolower(trim($canuse)) === 'production') {
         $canuse = ApplicationConfiguration::isProductionInstance();
     }
     if ($canuse !== true && $canuse !== false) {
         $canuse = false;
     }
     self::$_canUse = $canuse;
     return self::$_canUse;
 }
Ejemplo n.º 2
0
 public static function sendVONotification($user, $vappliance, $notificationtype, $vos, $subject, $message)
 {
     $notification = null;
     $usermessage = "" . $message;
     $usersubject = "" . $subject;
     $result = self::createVONotification($user, $vappliance, $notificationtype, $vos, $subject, $message, $notification);
     if ($result !== true) {
         return $result;
     }
     if (!$notification) {
         return "Could not send notification";
     }
     $recipients = $notification["recipients"];
     $subject = $notification["subject"];
     $message = $notification["message"];
     $replyto = $notification["useremail"];
     try {
         foreach ($recipients as $rec) {
             $voname = $rec["vo"];
             $to = array();
             foreach ($rec["contacts"] as $cnt) {
                 $to[] = trim($cnt["email"]);
             }
             $txtbody = preg_replace('/\\{\\{vo\\.name\\}\\}/i', $voname, $message);
             $subj = preg_replace('/\\{\\{vo\\.name\\}\\}/i', $voname, $subject);
             if (ApplicationConfiguration::isProductionInstance() === FALSE) {
                 self::debugSendMultipart($subj, $to, $txtbody, null, "appdb reports username", "appdb reports password", $replyto, null, false, null);
             } else {
                 //sendMultipartMail($subj, $to, $txtbody, null, '*****@*****.**', 'enadyskolopassword', $replyto, null, false, array("Precedence"=>"bulk"));
                 EmailService::sendBulkReport($subj, $to, $txtbody, null, $replyto);
             }
         }
         self::sendVONotificationReportMessage($notification, $user, $vappliance, $notificationtype, $usersubject, $usermessage);
     } catch (Exception $ex) {
         return $ex->getMessage();
     }
     return true;
 }
Ejemplo n.º 3
0
			'https://aai.egi.eu/proxy/metadata': 'egi-aai',
			'https://aai.egi.eu/proxy/metadata.php': 'egi-aai',
			'https://aai.egi.eu/google/saml2/idp/metadata.php': 'google',
			'https://aai.egi.eu/linkedin/saml2/idp/metadata.php': 'linkedin',
			'https://aai.egi.eu/facebook/saml2/idp/metadata': 'facebook',
			'https://aai.egi.eu/facebook/saml2/idp/metadata.php': 'facebook',
			'https://extidp.cesnet.cz/idp/shibboleth': 'elixir',
			'https://engine.elixir-czech.org/authentication/idp/metadata': 'elixir',
			'https://engine.elixir-czech.org/authentication/idp/metadata.php': 'elixir',
			'https://www.egi.eu/idp/shibboleth': 'egi sso',
			'https://vho.grnet.gr/idp/shibboleth': 'vho'
		}
	}
};
<?php 
if (ApplicationConfiguration::isProductionInstance() === false) {
    ?>
appdb.config.accounts.available.push({ id: "elixir-sp", source: "elixir", name:"Elixir", image: "/images/elixir.png", canAdd: true, canRemove: true, displayName: true, connectMessage: "If you are already signed in Elixir the system will try to connect to the signed in account of Elixir. Otherwise, please consider to be signed out from Elixir." });
appdb.config.accounts.available.push({ id: "facebook-sp", source: "facebook", name:"Facebook", image: "/images/social_facebook.png", canAdd: true, canRemove: true, displayName: true, connectMessage: "If you are already signed in Facebook the system will try to connect to the signed in account of Facebook. Otherwise, please consider to be signed out from Facebook." });
appdb.config.accounts.available.push({ id: "linkedin-sp", source: "linkedin", name:"LinkedIn", image: "/images/social_linkedin.png", canAdd: true, canRemove: true, displayName: true, connectMessage: "If you are already signed in LinkedIn the system will try to connect to the signed in account of LinkedIn. Otherwise, please consider to be signed out from LinkedIn." });
<?php 
}
?>

appdb.config.cache = {
	expires: 7, //each cache default expiration in days
	resources: {
		expires: 7, //resources cache default expiration in days
		items: [
			"applications/categories",
			"disciplines",
Ejemplo n.º 4
0
 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;
 }
Ejemplo n.º 5
0
 private static function sendNotification($notification)
 {
     $subject = $notification["subject"];
     $to = $notification["recipient"];
     $txtbody = $notification["message"];
     if (ApplicationConfiguration::isProductionInstance() === FALSE) {
         self::debugSendMultipart($subject, $to, $txtbody, null, "appdb reports username", "appdb reports password", false, null, false, null);
     } else {
         //sendMultipartMail($subject, $to, $txtbody, null, '*****@*****.**', 'enadyskolopassword', false, null, false, array("Precedence"=>"bulk"));
         EmailService::sendBulkReport($subject, $to, $txtbody);
     }
 }
Ejemplo n.º 6
0
 public static function sendEmailResponseNotification($user, $app, $stateid = 0, $type = 'joinapplication')
 {
     $recipients = self::getUserPrimaryEmail($user->id);
     if (($stateid == 2 || $stateid == 3) && count($recipients) > 0) {
         $state = $stateid == 2 ? "Accepted" : "Rejected";
         $subject = "EGI Applications Database: " . $state . " request to join software " . $app->name . " response";
         if ($type == 'releasemanager') {
             $subject = "EGI Applications Database: " . $state . " request to manage releases for software " . $app->name . " response";
         }
         $textbody = self::getResponseEmailBody($user, $app, $stateid, $type);
         $body = preg_replace("/\n/", "<br/>", $textbody);
         $body = preg_replace("/\t/", "<span style='padding-left:10px;'></span>", $body);
         $body = preg_replace("/\\[1\\]/", "'<a href='http://" . $_SERVER["APPLICATION_UI_HOSTNAME"] . "?p=" . base64_encode("/apps/details?id=" . $app->id) . "' target='_blank' title='View software entry in EGI AppDB'>" . $app->name . "</a>'", $body);
         $body = "<html><head></head><body>" . $body . "</body></html>";
         $textbody = preg_replace("/\t/", "   ", $textbody);
         $textbody = preg_replace("/\\[1\\]/", "'" . $app->name . "' [1]", $textbody);
         $textbody .= "\n\n________________________________________________________________________________________________________\n";
         $textbody .= "[1]. http://" . $_SERVER["APPLICATION_UI_HOSTNAME"] . "?p=" . base64_encode("/apps/details?id=" . $app->id) . " \n";
         if (ApplicationConfiguration::isProductionInstance() === FALSE) {
             error_log("SENDING TO: " . $recipients);
             error_log("SUBJECT: " . $subject);
             error_log("MESSAGE: " . $textbody);
         }
         //sendMultipartMail($subject,$recipients, $textbody, $body, '*****@*****.**', 'enadyskolopassword');
         EmailService::sendReport($subject, $recipients, $textbody, $body);
     }
 }
Ejemplo n.º 7
0
 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());
 }
Ejemplo n.º 8
0
 public function vmc2appdbAction()
 {
     $this->_helper->viewRenderer->setNoRender();
     if (ApplicationConfiguration::isProductionInstance()) {
         header('HTTP/1.0 404 Not Found');
         header("Status: 404 Not Found");
         return;
     }
     if ($_SERVER['REQUEST_METHOD'] === "GET") {
         echo '<form action="/apps/vmc2appdb" id="vmc2appdb" name="vmc2appdb" method="post" target="_blank">';
         echo '<textarea rows="30" cols="100" name="data" id="data" ></textarea>';
         echo '<div><label for="appid">Application Id:</label><input type="text" value="" name="appdbid" id="appdbid"></div>';
         echo '<div><input type="submit" value="view transformed xml"></div>';
         echo '<div><input type="button" id="submitxml" value="Call API" ></div>';
         echo '<div class="reply"></div>';
         echo '</form>';
         echo '<script type="text/javascript">';
         echo 'appdb.utils.Vm2Appdb.init();';
         echo '</script>';
     } else {
         $this->_helper->layout->disableLayout();
         if (isset($_POST["data"]) === false) {
             echo '<html><head></head><body>';
             echo '<div>no data posted</div>';
             echo '</body></html>';
         } else {
             header('Content-type: text/xml');
             $data = $_POST["data"];
             echo VMCaster::transformXml($data);
         }
     }
 }
Ejemplo n.º 9
0
 public static function datasets()
 {
     return !ApplicationConfiguration::isProductionInstance();
 }