Esempio n. 1
0
    $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
    $headers .= "From: {$from}" . "\r\n";
    $ok = mail($to, $subject, $message, $headers);
    if ($ok) {
        echo "Mail sent!";
    } else {
        echo "Error sending mail";
    }
    return;
});
$app->get("/calendar/facilitators/add/:id", function ($id) use($app) {
    $config = Configuration::get_configuration('calendar');
    if (!$config["facilitator"]) {
        return;
    }
    $user = MorgueAuth::get_auth_data();
    $facilitator = array();
    $facilitator['name'] = $user['username'];
    $facilitator['email'] = Contact::get_email_for_user($user['username']);
    $conn = Persistence::get_database_object();
    $error = Calendar::set_facilitator($id, $facilitator, $conn);
    if (!$error) {
        $userHtml = Contact::get_html_for_user($user['username']);
        $to = implode(", ", $config["facilitators_email"]);
        $from = "Morgue <*****@*****.**>";
        $subject = "Facilitator needed [PM-{$id}]";
        $message = '
            <html>
            <head>
              <title>Facilitator Needed for PM-' . $id . '</title>
            </head>
Esempio n. 2
0
$app->add(new \Slim\Middleware\SessionCookie(array('expires' => '60 minutes', 'path' => '/', 'domain' => null, 'secure' => false, 'httponly' => false, 'name' => 'postmortem', 'secret' => 'PMS_R_US', 'cipher' => MCRYPT_RIJNDAEL_256, 'cipher_mode' => MCRYPT_MODE_CBC)));
$app->add(new AssetVersionMiddleware());
/*
 * Now include all routes and libraries for features before actually running the app
 */
foreach ($config['feature'] as $feature) {
    if ($feature['enabled'] == "on") {
        $app->log->debug("Including Feature {$feature['name']}");
        include 'features/' . $feature['name'] . '/lib.php';
        include 'features/' . $feature['name'] . '/routes.php';
    }
}
// set admin info on the environment array
// so it's available to our request handlers
$env = $app->environment;
$env['admin'] = MorgueAuth::get_auth_data();
$app->get('/', function () use($app) {
    $content = 'content/frontpage';
    $show_sidebar = true;
    $selected_tags = trim($app->request()->get('tags'));
    if (strlen($selected_tags) > 0) {
        $selected_tags = explode(",", $selected_tags);
        $selected_tags = array_map('trim', $selected_tags);
        $events = Postmortem::get_events_for_tags($selected_tags);
    } else {
        $selected_tags = null;
        $events = Postmortem::get_all_events();
    }
    if ($events["status"] == Postmortem::OK) {
        $events = $events["values"];
    } else {
Esempio n. 3
0
 /** 
  * Sets the given event as being modified by the current user
  */
 static function set_event_edit_status($id, $conn = null)
 {
     $conn = $conn ?: Persistence::get_database_object();
     if (!$conn) {
         return null;
     }
     $user = MorgueAuth::get_auth_data();
     $modifier = $user['username'];
     $modified = new DateTime();
     $modified = $modified->getTimestamp();
     $sql = "UPDATE postmortems SET modifier = '" . $modifier . "', modified = " . $modified;
     $sql = $sql . " WHERE id = " . $id;
     try {
         $stmt = $conn->prepare($sql);
         $success = $stmt->execute();
         return null;
     } catch (PDOException $e) {
         return $e->getMessage();
     }
 }