function __construct() { $config = Configuration::get_configuration("calendar"); $this->clientId = $config['clientId']; $this->apiKey = $config['apiKey']; $this->scopes = $config['scopes']; $this->id = $config['id']; $this->facilitator = $config['facilitator']; }
/** * get the email address for a given username. The email address * is the username with the email domain appended to it. If email domain * is not specified in the contact config, then null is returned * * @param $username - the username to subsitutre in the lookup_url * * @returns $email or null */ static function get_email_for_user($username, $config = null) { $config = is_null($config) ? Configuration::get_configuration("contact") : $config; if (isset($config["email_domain"])) { return $username . $config["email_domain"]; } else { return null; } }
/** * get a list of the IRC channels that can be selected for a given postmortem * if the 'morgue_get_irc_channels_list' exists, call it and return * its results - otherwise, lookup the config file for ['irc']['channels'] * * @returns array of IRC channels strings */ static function get_irc_channels_list() { if (function_exists("morgue_get_irc_channels_list")) { return morgue_get_irc_channels_list(); } else { $irc_config = Configuration::get_configuration("irc"); $channels = isset($irc_config["channels"]) ? $irc_config["channels"] : array(); return $channels; } }
function getUserTimezone() { $config = Configuration::get_configuration(); $tz = 'America/New_York'; if (isset($_SESSION['timezone'])) { $tz = $_SESSION['timezone']; } else { if (isset($config['timezone'])) { $tz = $config['timezone']; } } return $tz; }
function __construct() { $config = Configuration::get_configuration("calendar"); $this->clientId = $config['clientId']; $this->apiKey = $config['apiKey']; $this->scopes = $config['scopes']; $this->id = $config['id']; $this->facilitator = $config['facilitator']; if (isset($config['attendees_email'])) { if (!is_array($config['attendees_email'])) { $config['attendees_email'] = array($config['attendees_email']); } $this->attendees = $config['attendees_email']; } else { $this->attendees = []; } }
<h3>To facilitate this post-mortem, click <a href="' . $domain . '/calendar/facilitators/add/' . $id . '" style="text-decoration:none;">here</a></h3> </body> </html> '; $headers = 'MIME-Version: 1.0' . "\r\n"; $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 = '
/** * Provide the different severity levels for a post mortem event * * @returns array of severity levels */ static function get_severity_levels() { $config = Configuration::get_configuration(); if (isset($config['severity']) && isset($config['severity']['levels'])) { return $config['severity']['levels']; } else { return array('default'); } }
$content = "error"; include 'views/page.php'; return; } if (count($pms)) { // get the tags for each PM we found so we can display them foreach ($pms as $k => $pm) { $tags = Postmortem::get_tags_for_event($pm['id'], null); $pms[$k]['tags'] = $tags['values']; } } $pms = $pms; include 'views/page.php'; }); $app->get('/anniversary/mail', function () use($app) { $config = Configuration::get_configuration('anniversary'); if ($config['enabled'] !== 'on') { return; } if (empty($config['mailto'])) { return; } $content = "anniversary/views/anniversary-mail"; $show_sidebar = false; $page_title = "Today in Post Mortem History"; $today = date("Y-m-d", time()); $get_date = trim($app->request->get('date')); if ($get_date) { $get_date = date("Y-m-d", strtotime($get_date)); $today = $get_date; }
/** * Get database object to operate on. This reads in the config file depending * on the environment we are running in (determined by the env var * MORGUE_ENVIRONMENT). * * @returns a database PDO object or null on error */ static function get_database_object() { $config = Configuration::get_configuration(); $host = $config['database']['mysqlhost']; $port = $config['database']['mysqlport']; $adb = $config['database']['database']; $user = $config['database']['username']; $pass = $config['database']['password']; try { $conn = new PDO('mysql:host=' . $host . ';port=' . $port . ';dbname=' . $adb, $user, $pass); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); return $conn; } catch (PDOException $e) { return null; } }
$upload_base_path = $config['upload_dir']; if (!empty($_FILES)) { // Step One: Put our uploaded files somewhere $tempFile = $_FILES['file']['tmp_name']; $targetPath = "{$upload_base_path}{$ds}{$id}{$ds}"; // Ensure we have somewhere to upload to // We're grouping uploades by their associated event so // we're making directories here shell_exec("mkdir -p {$targetPath}"); $targetFile = $targetPath . $_FILES['file']['name']; if (!move_uploaded_file($tempFile, $targetFile)) { $app->log->error("Error saving uploaded file."); $app->response->status(500); } $app->log->error("File Uploaded"); $options = Configuration::get_configuration('upload'); // Step Two: Send the file somewhere and expect a URL back $uploader = new Uploader($options); try { $response = $uploader->send_file($targetFile, $id); } catch (Exception $e) { print $e->getMessage(); $app->log->error($e->getMessage()); return; } $location = $response['location']; // we should have the $location of our uploaded file if (empty($location)) { throw new Exception("Upload expected an image location"); } // Step Three: Add the URL of the file as an image for the event
<!-- gcal--> <div class="row-fluid"> <!-- Editable Controls --> <form class="form-horizontal"> <div class="span6"> <div class="control-group"> <label class="control-label" id="event-start-time">Contact: </label> <div class="controls controls-row"> <?php $config = Configuration::get_configuration("contact"); if (isset($config['lookup_url'])) { $contact_lookup_url = $config['lookup_url']; echo "<input type=\"hidden\" name=\"contact_lookup_url\" value=\"{$contact_lookup_url}\" />"; } ?> <input type="text" placeholder="Enter contact username" id="contact" name="contact" class="input-xxlarge editable editable_hidden" value="" style="display:none;"/> <?php if (isset($contact) && $contact != "") { $contact_html = Contact::get_html_for_user($contact); echo "<div id=\"contact_anchor\">{$contact_html}</div>"; } ?> </div> </div> </div> </form> </div>
<?php // Enumerate any custom javascript assets and make them accessible externally. $config = Configuration::get_configuration(); $edit_page_features = $config['edit_page_features']; /* Build up the path to the appropriate route for this asset. The feature's routes.php should include a route that locates and serves the static asset. The directory containing custom Morgue features should follow the same structure as the core project, including an 'assets/js/' directory. Doing this, the route declaration can call stream_resolve_include_path() to locate the asset via the include_path. */ foreach ($edit_page_features as $feature_name) { $feature = Configuration::get_configuration($feature_name); if (isset($feature['custom_css_assets'])) { // If we are just configured "on" then default to // include a css file named after the feature if ($feature['custom_css_assets'] === "on") { $feature['custom_css_assets'] = array("{$feature_name}.css"); } if (!is_array($feature['custom_css_assets'])) { $css_assets = array($feature['custom_css_assets']); } else { $css_assets = $feature['custom_css_assets']; } foreach ($css_assets as $css_file) { // check if asset exists on an external domain if (strpos($css_file, "https://") === false && strpos($css_file, "http://") === false) { echo "<link rel=\"stylesheet\" href=\"/features/{$feature_name}/css/{$css_file}\" />";
function __construct($curl_client, $config = null) { $this->curl_client = $curl_client; $config = is_null($config) ? Configuration::get_configuration("jira") : $config; $this->jira_base_url = $config['baseurl']; $this->username = $config['username']; $this->password = $config['password']; if (isset($config['proxy'])) { $this->proxy = $config['proxy']; } else { $this->proxy = null; } $this->additional_fields = array(); if (isset($config['additional_fields'])) { $this->additional_fields = $config['additional_fields']; } }
"><?php echo $timezone; ?> </option> <?php } ?> </select> </div> </div> <div class="control-group"> <label id="event-severity" class="control-label severity_levels" for="severity">Severity</label> <div class="controls"> <select id="severity-select" name="severity" class="input-small" title=" <?php $config = Configuration::get_configuration(); if (isset($config['severity']) && isset($config['severity']['tooltip_title'])) { echo $config['severity']['tooltip_title']; } else { echo "Severity Levels"; } ?> "> <?php $severity_levels = Postmortem::get_severity_levels(); foreach ($severity_levels as $key => $severity_description) { $level = $key + 1; $severity_option = "<option value='{$level}' description='{$severity_description}'>{$level}</option>"; echo $severity_option; }