Skip to content

Commit

Permalink
8.6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Jul 8, 2015
1 parent ea7c80e commit a2cc45f
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 25 deletions.
Empty file modified html/highcharts/dark-unica.js
100644 → 100755
Empty file.
Empty file modified html/highcharts/exporting.js
100644 → 100755
Empty file.
Empty file modified html/highcharts/highstock.js
100644 → 100755
Empty file.
1 change: 0 additions & 1 deletion modules/gpio/control_close
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ date=$(date +%y%m%d-%H%M)
gl="$1"

sudo /bin/kill -9 `pgrep -l -f control_proc |grep $gl | awk '{print $1}'`

6 changes: 3 additions & 3 deletions modules/gpio/html/gpio_add.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
if ( $add == "ADD") {
$db = new PDO('sqlite:dbf/nettemp.db');
if (!empty($gpioad)) {
$db->exec("INSERT INTO gpio (gpio, name, status) VALUES ('$gpio','new_$gpio','OFF')") or die ($db->lastErrorMsg());
$db->exec("INSERT INTO gpio (gpio, name, status) VALUES ('$gpio','new_$gpio','OFF')") or exit(header("Location: html/errors/db_error.php"));
}
else {
$db->exec("DELETE FROM gpio WHERE gpio='$gpio'") or die ($db->lastErrorMsg());
$db->exec("DELETE FROM gpio WHERE gpio='$gpio'") or exit(header("Location: html/errors/db_error.php"));
}
$db = NULL;
header("location: " . $_SERVER['REQUEST_URI']);
Expand Down Expand Up @@ -47,7 +47,7 @@
<?php
foreach ($gpiolist as $value1) {
$db = new PDO('sqlite:dbf/nettemp.db');
$rows = $db->query("SELECT * FROM gpio WHERE gpio='$value1'");
$rows = $db->query("SELECT * FROM gpio WHERE gpio='$value1'") or exit(header("Location: html/errors/db_error.php"));
$row = $rows->fetchAll();
foreach ($row as $result) {
$added[] = $result['gpio'];
Expand Down
2 changes: 1 addition & 1 deletion modules/gpio/html/gpio_buzzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

$buzzerexit = isset($_POST['buzzerexit']) ? $_POST['buzzerexit'] : '';
if (($buzzerexit == "buzzerexit") ){
$db->exec("UPDATE gpio SET mode='' where gpio='$gpio_post' ") or die("simple off db error");
$db->exec("UPDATE gpio SET mode='' where gpio='$gpio_post' ") or exit(header("Location: html/errors/db_error.php"));
$db = null;
header("location: " . $_SERVER['REQUEST_URI']);
exit();
Expand Down
8 changes: 4 additions & 4 deletions modules/gpio/html/gpio_control.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
$control = isset($_POST['control']) ? $_POST['control'] : '';
$save = isset($_POST['save']) ? $_POST['save'] : '';
if (($save == "save") ){
$db->exec("UPDATE gpio SET control='$control' where gpio='$gpio_post' ") or die("simple off db error");
$db->exec("UPDATE gpio SET control='$control' where gpio='$gpio_post' ") or exit(header("Location: html/errors/db_error.php"));
$db = null;
header("location: " . $_SERVER['REQUEST_URI']);
exit();
Expand All @@ -11,23 +11,23 @@

$exit = isset($_POST['exit']) ? $_POST['exit'] : '';
if (($exit == "control_exit") ){
$db->exec("UPDATE gpio SET mode='' where gpio='$gpio_post' ") or die("simple off db error");
$db->exec("UPDATE gpio SET mode='' where gpio='$gpio_post' ") or exit(header("Location: html/errors/db_error.php"));
$db = null;
header("location: " . $_SERVER['REQUEST_URI']);
exit();
}

$controlrun = isset($_POST['controlrun']) ? $_POST['controlrun'] : '';
if ($controlrun == "on") {
$db->exec("UPDATE gpio SET control_run='on', status='Wait' WHERE gpio='$gpio_post'") or die("exec error");
$db->exec("UPDATE gpio SET control_run='on', status='Wait' WHERE gpio='$gpio_post'") or exit(header("Location: html/errors/db_error.php"));
$db = null;
$cmd=("nohup modules/gpio/control_proc $gpio_post");
shell_exec( $cmd . "> /dev/null 2>/dev/null &" );
header("location: " . $_SERVER['REQUEST_URI']);
exit();
}
if ($controlrun == "off") {
$db->exec("UPDATE gpio SET control_run='', status='OFF' WHERE gpio='$gpio_post'") or die("exec error");
$db->exec("UPDATE gpio SET control_run='', status='OFF' WHERE gpio='$gpio_post'") or exit(header("Location: html/errors/db_error.php"));
$db = null;
shell_exec("modules/gpio/control_close $gpio_post");
header("location: " . $_SERVER['REQUEST_URI']);
Expand Down
8 changes: 4 additions & 4 deletions modules/gpio/html/gpio_controls.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
$simple = isset($_POST['simple']) ? $_POST['simple'] : '';
$onoff = isset($_POST['onoff']) ? $_POST['onoff'] : '';
if (($onoff == "onoff")){
$db->exec("UPDATE gpio SET simple='$simple', status='$simple' WHERE gpio='$gpio_post'") or die("PDO exec error");
$db->exec("UPDATE gpio SET simple='$simple', status='$simple' WHERE gpio='$gpio_post'") or exit(header("Location: html/errors/db_error.php"));
if ($simple == 'on'){
include('modules/gpio/html/gpio_on.php');
} else {
Expand All @@ -32,13 +32,13 @@
$trigger = isset($_POST['trigger']) ? $_POST['trigger'] : '';
if ($triggeronoff == "onoff") {
if ( $trigger == 'on' ) {
$db->exec("UPDATE gpio SET trigger_run='on', status='Wait' WHERE gpio='$gpio_post'") or die("exec error");
$db->exec("UPDATE gpio SET trigger_run='on', status='Wait' WHERE gpio='$gpio_post'") or exit(header("Location: html/errors/db_error.php"));
$db = null;
$cmd=("nohup modules/gpio/trigger_proc $gpio_post");
shell_exec( $cmd . "> /dev/null 2>/dev/null &" );

} else {
$db->exec("UPDATE gpio SET trigger_run='', status='OFF' WHERE gpio='$gpio_post'") or die("exec error");
$db->exec("UPDATE gpio SET trigger_run='', status='CONTROLS OFF' WHERE gpio='$gpio_post'") or exit(header("Location: html/errors/db_error.php"));
$db = null;
shell_exec("modules/gpio/trigger_close $gpio_post");
}
Expand All @@ -56,7 +56,7 @@



$sth2 = $db->prepare("select * from gpio where mode='simple'");
$sth2 = $db->prepare("select * from gpio where mode='simple'") or exit(header("Location: html/errors/db_error.php"));
$sth2->execute();
$result2 = $sth2->fetchAll();
foreach ( $result2 as $a) {
Expand Down
8 changes: 4 additions & 4 deletions modules/gpio/html/gpio_trigger.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
$triggerexit = isset($_POST['triggerexit']) ? $_POST['triggerexit'] : '';

if (($triggerexit == "triggerexit") ){
$db->exec("UPDATE gpio SET mode='' where gpio='$gpio_post' ") or die("humid off db error");
$db->exec("UPDATE gpio SET mode='' where gpio='$gpio_post' ") or exit(header("Location: html/errors/db_error.php"));
$db = null;
header("location: " . $_SERVER['REQUEST_URI']);
exit();
Expand All @@ -11,15 +11,15 @@

$triggerrun = isset($_POST['triggerrun']) ? $_POST['triggerrun'] : '';
if ($triggerrun == "on") {
$db->exec("UPDATE gpio SET trigger_run='on', status='Wait' WHERE gpio='$gpio_post'") or die("exec error");
$db->exec("UPDATE gpio SET trigger_run='on', status='Wait' WHERE gpio='$gpio_post'") or exit(header("Location: html/errors/db_error.php"));
$db = null;
$cmd=("nohup modules/gpio/trigger_proc $gpio_post");
shell_exec( $cmd . "> /dev/null 2>/dev/null &" );
header("location: " . $_SERVER['REQUEST_URI']);
exit();
}
if ($triggerrun == "off") {
$db->exec("UPDATE gpio SET trigger_run='', status='OFF' WHERE gpio='$gpio_post'") or die("exec error");
$db->exec("UPDATE gpio SET trigger_run='', status='WWW OFF' WHERE gpio='$gpio_post'") or exit(header("Location: html/errors/db_error.php"));
$db = null;
shell_exec("modules/gpio/trigger_close $gpio_post");
header("location: " . $_SERVER['REQUEST_URI']);
Expand All @@ -32,7 +32,7 @@
$tout=isset($_POST["tout".$num]) ? $_POST["tout".$num] : '';
if (($toutonoff == "onoff") && (!empty($tout))) {
$tout == "off" ? $tout='' : "";
$db->exec("UPDATE gpio SET tout$num='$tout' WHERE gpio='$gpio_post'") or die("exec error");
$db->exec("UPDATE gpio SET tout$num='$tout' WHERE gpio='$gpio_post'") or exit(header("Location: html/errors/db_error.php"));
$db = null;
header("location: " . $_SERVER['REQUEST_URI']);
exit();
Expand Down
2 changes: 1 addition & 1 deletion modules/gpio/html/gpio_triggerout.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
$triggeroutexit = isset($_POST['triggeroutexit']) ? $_POST['triggeroutexit'] : '';
if (($triggeroutexit == "triggeroutexit") ){
$db->exec("UPDATE gpio SET mode='' where gpio='$gpio_post' ") or die("simple off db error");
$db->exec("UPDATE gpio SET mode='' where gpio='$gpio_post' ") or exit(header("Location: html/errors/db_error.php"));
$db = null;
header("location: " . $_SERVER['REQUEST_URI']);
exit();
Expand Down
1 change: 1 addition & 0 deletions modules/gpio/trigger_close
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function close {

close

sqlite3 $dir/dbf/nettemp.db "UPDATE gpio SET trigger_run='', status='BUTTON OFF' WHERE gpio='$gl'"

fil=$(ls $dir/tmp/mail/hour/ |grep alarm$gl)
for i in $fil; do
Expand Down
13 changes: 7 additions & 6 deletions modules/gpio/trigger_proc
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ function triggerout_gpio {
else
/usr/local/bin/gpio -g write $g 1
fi
ledalarm
done

}

function ledalarm {
Expand Down Expand Up @@ -70,11 +70,12 @@ do
status=$(/usr/local/bin/gpio -g read $gpio)
if [[ "$status" = "0" && "$rev" = "on" ]] || [[ "$status" = "1" && "$rev" = "" ]]
then
trigger="on"
triggerout_gpio
mail
sqlite3 $dir/dbf/nettemp.db "UPDATE gpio SET status='ALARM' WHERE gpio='$gpio'"
$dir/modules/gpio/timestamp $gpio
trigger="on"
triggerout_gpio
ledalarm &
mail
sqlite3 $dir/dbf/nettemp.db "UPDATE gpio SET status='ALARM' WHERE gpio='$gpio'"
$dir/modules/gpio/timestamp $gpio
break
fi
sleep 0.1
Expand Down
4 changes: 3 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ USERS:

Changelog:

8.6.1
8.6.2
fix trigger, mail notification

8.6.1
Fix not working HIGH/LOW reverse state.

8.6
Expand Down

0 comments on commit a2cc45f

Please sign in to comment.