include_once "phplib/base.php"; $my_username = getUsername(); $page_title = getTeamName() . " Weekly Updates - Edit your profile"; include_once 'phplib/header.php'; include_once 'phplib/nav.php'; ?> <div class="container"> <h1>Edit profile <small>for user <?php echo $my_username; ?> </small></h1> <?php if (!($profile = checkForUserProfile($my_username))) { echo insertNotify("info", "Welcome to your profile page! Fill in the data below"); $profile = null; } else { $sleeptracking_settings = json_decode($profile['sleeptracking_settings'], 1); } if (isset($_GET['succ'])) { echo insertNotify("success", "Thanks! Your profile details have been saved. "); } ?> <div class="row"> <div class="span12"> <form method='POST' action='<?php echo $ROOT_URL;
<?php include_once 'phplib/base.php'; if (!connectToDB()) { echo "Database connection failed, cannot continue. "; } else { $username = getUsername(); $range_start = mysql_real_escape_string($_POST['oncall']['range_start']); $range_end = mysql_real_escape_string($_POST['oncall']['range_end']); logline("Started adding a new oncall update for {$username} with range_start: {$range_start} and range_end: {$range_end}..."); if (count($_POST['oncall']['notifications']) > 0) { // See if this user is enrolled in sleep tracking $profile_data = checkForUserProfile($username); if ($profile_data && $profile_data['sleeptracking_provider'] != "none" && $profile_data['sleeptracking_provider'] != "") { $sleep_provider = $profile_data['sleeptracking_provider']; logline("Sleeptracking enabled: {$sleep_provider}"); $sleep = true; // Get the user settings into an array by decoding the JSON we put in the database for them $sleeptracking_settings = json_decode($profile_data['sleeptracking_settings'], 1); // Get the provider settings from the config array $sleepprovider_settings = $sleep_providers[$sleep_provider]; // Load the sleeptracking provider's PHP code include_once $sleepprovider_settings['lib']; } else { logline("No need to do sleep tracking because {$username} has no provider chosen"); } foreach ($_POST['oncall']['notifications'] as $id => $n) { $sleep_state = -1; $mtts = -1; $sleep_level = -1; $confidence = -1;