Esempio n. 1
0
 private static function getAlreadyExpiredMessage($notification)
 {
     $qdays = intval(floor(abs($notification["days"])));
     $appindex = array();
     $user = $notification["user"];
     $message = "Dear " . $user["name"] . ",\n";
     if ($qdays > VMCasterNotifications::getMaxPastDays()) {
         $subject = "[EGI APPDB] Virtual appliances expired more than " . VMCasterNotifications::getMaxPastDays() . " days ago";
         $message .= "  the published versions of the following virtual appliances expired more than " . VMCasterNotifications::getMaxPastDays() . " days.\n\n";
     } else {
         $subject = "[EGI APPDB] Virtual appliances expired " . $qdays . " days ago";
         $message .= "  the published versions of the following virtual appliances expired " . $qdays . " days ago.\n\n";
     }
     foreach ($notification["vappliances"] as $vapp) {
         $appindex[] = $vapp;
         $message .= "    [" . count($appindex) . "]. " . $vapp["name"] . " \n";
     }
     $message .= "\n\nBest regards,\n";
     $message .= "AppDB team\n\n";
     $message .= "________________________________________________________________________________________________________\n";
     for ($i = 0; $i < count($appindex); $i += 1) {
         $ap = $appindex[$i];
         $message .= "[" . ($i + 1) . "] https://" . $_SERVER["APPLICATION_UI_HOSTNAME"] . "/store/vappliance/" . $ap["cname"] . "\n";
     }
     $notification["message"] = $message;
     $notification["subject"] = $subject;
     return $notification;
 }
Esempio n. 2
0
 public function dispatchvaexpirationAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
     $days = isset($_GET["days"]) ? $_GET["days"] : "none";
     $dispatch = isset($_GET["dispatch"]) ? $_GET["dispatch"] : "false";
     $islocal = localRequest();
     $isAdmin = userIsAdminOrManager($this->session->userid);
     if (strtolower(trim($dispatch)) === "true") {
         $dispatch = true;
     } else {
         $dispatch = false;
     }
     if (is_numeric($days) === false || $dispatch === false && $isAdmin === false || $dispatch === true && $islocal === false) {
         header('HTTP/1.0 404 Not Found');
         header("Status: 404 Not Found");
         return;
     }
     if ($dispatch === false) {
         $res = VMCasterNotifications::getExpirationNotificationList($days);
         echo "<h2>Expiration of vappliances in " . $days . " days </h2><h4>(" . count($res) . " messages)</h4>";
         foreach ($res as $r) {
             $user = $r["user"];
             echo "<div class='notification' style='border:1px solid #aaa;background-color:#f8f8f8;margin: 5px;margin-bottom:20px;padding:10px;'>";
             echo "<div class='recipient'>recipient:  <pre style='display:inline;'>" . $user["name"] . " &lt;" . $r["recipient"] . "&gt;</pre></div>";
             echo "<div class='subject'>subject:    <pre style='display:inline;'>" . $r["subject"] . "</pre></div>";
             echo "<div style='padding:5px;border:1px solid #bbb;background-color:#fefefe;margin-top:5px;padding:3px;'><pre style='padding:5px;'>" . htmlentities($r["message"]) . "</pre></div>";
             echo "</div>";
         }
     } else {
         VMCasterNotifications::sendExpirationNotificationList($days);
     }
 }