-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbut6.php
More file actions
39 lines (37 loc) · 1.75 KB
/
but6.php
File metadata and controls
39 lines (37 loc) · 1.75 KB
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
<?php
require 'functions.php';
# A multi-stage button to cycle through living room modes
$lrfronton = ison(11); # check the state of the LR Front Light. Only care if it's on or not
$lrdlon = ison(25); # check whether the marker DL is on.
$lrdlbri = getBri(25); # get its brightness too.
if(!($lrfronton)) { # 11 is LRFRONT - off is a marker that they all are
doThing("normal.php?fulldl");
if(strpos($_SERVER['HTTP_USER_AGENT'], 'WebKit')) header('Location: ' . $_SERVER['but6.php']); # just in case we're using iUI
exit(0);
}
elseif($lrfronton && ($lrdlon && $lrdlbri === 254)) { # we're in normal with fulldl
doThing("normal.php");
if(strpos($_SERVER['HTTP_USER_AGENT'], 'WebKit')) header('Location: ' . $_SERVER['but6.php']); # just in case we're using iUI
exit(0);
}
elseif($lrfronton && ($lrdlon && $lrdlbri === 127)) { # we're in normal with half DLs
doThing("loft_teevee.php");
if(strpos($_SERVER['HTTP_USER_AGENT'], 'WebKit')) header('Location: ' . $_SERVER['but6.php']); # just in case we're using iUI
exit(0);
}
elseif($lrfronton && ($lrdlon && $lrdlbri === 1)) { # we're in teevee mode
doThing("cinema.php");
if(strpos($_SERVER['HTTP_USER_AGENT'], 'WebKit')) header('Location: ' . $_SERVER['but6.php']); # just in case we're using iUI
exit(0);
}
elseif($lrfronton && !($lrdlon)) { # we're in cinema (or SP2) mode.
doThing("alloff.php?id=L");
if(strpos($_SERVER['HTTP_USER_AGENT'], 'WebKit')) header('Location: ' . $_SERVER['but6.php']); # just in case we're using iUI
exit(0);
}
else { # Unknown/nonstandard state is in place if all those missed.
echo "LOLWTF?\n";
if(strpos($_SERVER['HTTP_USER_AGENT'], 'WebKit')) header('Location: ' . $_SERVER['but6.php']); # just in case we're using iUI
exit(1);
}
?>