This commit is contained in:
Hannes Verschore 2015-10-28 10:08:53 +01:00
Родитель 0fd360811d 6efcbb7a78
Коммит d83355b9f3
2 изменённых файлов: 33 добавлений и 4 удалений

Просмотреть файл

@ -29,6 +29,7 @@ class Config {
$this->mysql_password = $config_array["mysql"]["pass"]; $this->mysql_password = $config_array["mysql"]["pass"];
$this->mysql_db_name = $config_array["mysql"]["db_name"]; $this->mysql_db_name = $config_array["mysql"]["db_name"];
$this->data_folder = $config_array["general"]["data_folder"]; $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()); 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() function username()
{ {
if (!isset($_SESSION['persona'])) if (!isset($_SESSION['persona']))

Просмотреть файл

@ -75,11 +75,12 @@ h1 {
} }
#navcontainer { #navcontainer {
padding-top: 360px; padding-top: 120px;
display: inline; display: inline;
position: absolute; position: fixed;
margin-left: -20px; margin-left: -20px;
left: 0; left: 0;
height: 100%;
} }
.menu { .menu {
@ -110,13 +111,13 @@ h1 {
#about { #about {
display: none; display: none;
margin-left: 250px; margin-left: 350px;
width: 700px; width: 700px;
} }
#breakdown { #breakdown {
display: none; display: none;
margin-left: 250px; margin-left: 350px;
width: 700px; width: 700px;
} }