-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
43 lines (38 loc) · 1 KB
/
functions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
function slack($message, $icon = ":minidisc:")
{
$data = "payload=" . json_encode(array(
"username" => "Disc-Space",
"channel" => "#" . SLACK_CHANEL,
"text" => $message,
"icon_emoji" => $icon
));
$ch = curl_init(SLACK_HOOK);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
curl_close($ch);
}
function checkOS()
{
$directory = "/";
if (PHP_OS == 'WINNT') {
$directory = "C:";
}
return $directory;
}
function notificationRead($flag = null)
{
if (!is_null($flag)) {
switch ($flag) {
case true:
file_put_contents('notification_read_free_space.txt', '');
return;
case false:
unlink('notification_read_free_space.txt');
return;
}
}
return file_exists('notification_read_free_space.txt');
}