diff --git a/website/internals.php b/website/internals.php index 10a4d0c..a07f3fd 100755 --- a/website/internals.php +++ b/website/internals.php @@ -29,6 +29,7 @@ class Config { $this->mysql_password = $config_array["mysql"]["pass"]; $this->mysql_db_name = $config_array["mysql"]["db_name"]; $this->data_folder = $config_array["general"]["data_folder"]; + $this->slack_webhook = $config_array["general"]["slack_webhook"]; } } @@ -39,6 +40,33 @@ function init_database() mysql_select_db($config->mysql_db_name) or die("ERROR: " . mysql_error()); } +// (string) $message - message to be passed to Slack +// (string) $room - room in which to write the message, too +// (string) $icon - You can set up custom emoji icons to use with each message +function slack($message, $room = "engineering", $icon = ":longbox:") +{ + global $config; + + $room = ($room) ? $room : "engineering"; + $data = "payload=" . json_encode(array( + #"channel" => "#{$room}", + "text" => $message, + "icon_emoji" => $icon + )); + + // You can get your webhook endpoint from your Slack settings + $url = $config->slack_webhook; + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); + curl_setopt($ch, CURLOPT_POSTFIELDS, $data); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + $result = curl_exec($ch); + curl_close($ch); + + return $result; +} + function username() { if (!isset($_SESSION['persona'])) diff --git a/website/style.css b/website/style.css index 52c0903..fe37399 100755 --- a/website/style.css +++ b/website/style.css @@ -75,11 +75,12 @@ h1 { } #navcontainer { - padding-top: 360px; + padding-top: 120px; display: inline; - position: absolute; + position: fixed; margin-left: -20px; left: 0; + height: 100%; } .menu { @@ -110,13 +111,13 @@ h1 { #about { display: none; - margin-left: 250px; + margin-left: 350px; width: 700px; } #breakdown { display: none; - margin-left: 250px; + margin-left: 350px; width: 700px; }