diff --git a/lib/include/bash/const b/lib/include/bash/const index ae4caa5..9248767 100755 --- a/lib/include/bash/const +++ b/lib/include/bash/const @@ -3,13 +3,13 @@ # RESET OUTPUT BUFFER # MAIN DIRECTORIES -#export ROOT_DIR="/home/sats/satsd"; -export ROOT_DIR="/home/xdrm-brackets/SANDBOX/sats-local"; +export ROOT_DIR="/home/sats/satsd"; +#export ROOT_DIR="/home/xdrm-brackets/SANDBOX/sats-local"; export LOG_DIR="$ROOT_DIR/log"; export DATA_DIR="$ROOT_DIR/data"; export CONF_DIR="$ROOT_DIR/conf"; -#export SOURCE_DIR="$ROOT_DIR/source"; -export SOURCE_DIR="/home/xdrm-brackets/Desktop/git.xdr/home/xdrm-brackets/Desktop/git.xdrm.io/logauth-sats"; +export SOURCE_DIR="$ROOT_DIR/source"; +#export SOURCE_DIR="/home/xdrm-brackets/Desktop/git.xdr/home/xdrm-brackets/Desktop/git.xdrm.io/logauth-sats"; export TMP_DIR="$ROOT_DIR/tmp"; diff --git a/lib/include/php/const b/lib/include/php/const index ee9f8f7..b637722 100755 --- a/lib/include/php/const +++ b/lib/include/php/const @@ -3,13 +3,13 @@ # RESET OUTPUT BUFFER # MAIN DIRECTORIES - #define('ROOT_DIR', '/home/sats/satsd'); - define('ROOT_DIR', '/home/xdrm-brackets/SANDBOX/sats-local'); + define('ROOT_DIR', '/home/sats/satsd'); + #define('ROOT_DIR', '/home/xdrm-brackets/SANDBOX/sats-local'); define('LOG_DIR', ROOT_DIR.'/log'); define('DATA_DIR', ROOT_DIR.'/data'); define('CONF_DIR', ROOT_DIR.'/conf'); - #define('SOURCE_DIR', ROOT_DIR.'/source'); - define('SOURCE_DIR', '/home/xdrm-brackets/Desktop/git.xdrm.io/logauth-sats'); + define('SOURCE_DIR', ROOT_DIR.'/source'); + #define('SOURCE_DIR', '/home/xdrm-brackets/Desktop/git.xdrm.io/logauth-sats'); define('TMP_DIR', ROOT_DIR.'/tmp'); # CONFIGURATION FILES diff --git a/lib/mfrc522/source/loop.php b/lib/mfrc522/source/loop.php index a7f66e9..e6a48a7 100755 --- a/lib/mfrc522/source/loop.php +++ b/lib/mfrc522/source/loop.php @@ -6,13 +6,11 @@ $f_auth; $f_accesslog; - $f_states; $f_actions; - $state = []; + $state = null; $actions = []; - $states = []; $last_user = null; $timeout = 0; @@ -82,7 +80,7 @@ global $timeout; /* (2) Caches */ - global $actions, $states, $state; + global $actions, $state; /* (3) Log history file descriptor */ global $f_accesslog; @@ -218,7 +216,7 @@ global $f_auth, $f_accesslog; /* (2) Caches */ - global $actions, $states, $state; + global $actions, $state; @@ -226,7 +224,6 @@ =========================================================*/ /* (1) Read accesses */ $f_auth = new SplFileObject(AUTH_CONF, 'r'); - $f_states = new SplFileObject(STATES_CONF, 'r'); $f_actions = new SplFileObject(ACTIONS_CONF, 'r'); $f_gstate = @file_get_contents(STATE_CONF); @@ -264,43 +261,24 @@ - /* [3] Parse STATES and cache them - =========================================================*/ - /* (1) Parse each line */ - while( $f_states->eof() ){ - - /* (2) Try to parse line */ - $parsed = json_decode($f_states->fgets(), true); - - /* (2) Ignore if parse error */ - if( is_null($parsed) ) - continue; - - /* (3) Add entry to cache */ - $states[] = $parsed; - - } - - /* (4) Free file descriptor */ - $f_states = null; - - - - /* [4] Cache global state + /* [3] Cache global state =========================================================*/ /* (1) Check file */ if( $f_gstate === false ) - return false; + return 127; /* (2) Remove surrounding spaces */ $f_gstate = preg_replace('@^\s+@', '', $f_gstate); $f_gstate = preg_replace('@\s+$@', '', $f_gstate); /* (3) For each character create an entry */ - for( $c = 0 ; $c < strlen($f_gstate) ; $c++ ) - $state[] = $c; + $state = str_split($f_gstate); + + /* (4) Manage error */ + if( is_null($state) ) + return 127; - return true; + return 0; } @@ -316,7 +294,7 @@ global $timeout; /* (2) Caches */ - global $actions, $states, $state; + global $actions, $state; @@ -411,7 +389,7 @@ $exec = mfrc522_setup(); /* (2) Manage error */ - if( $exec === false ){ + if( $exec != 0 ){ slog('cannot set up the daemon', 'mfrc522:loop'); echo $exec; die($exec);