Merge branch '1.0-local' into 1.0
This commit is contained in:
commit
d9be4061aa
|
@ -5,7 +5,6 @@
|
||||||
require_once __DIR__.'/../../include/php/const';
|
require_once __DIR__.'/../../include/php/const';
|
||||||
|
|
||||||
$f_auth;
|
$f_auth;
|
||||||
$f_gstate;
|
|
||||||
$f_accesslog;
|
$f_accesslog;
|
||||||
$f_actions;
|
$f_actions;
|
||||||
|
|
||||||
|
@ -26,8 +25,8 @@
|
||||||
*/
|
*/
|
||||||
function get_gstate(){
|
function get_gstate(){
|
||||||
|
|
||||||
/* (1) Export global file descriptor */
|
/* (1) Initialize file descriptor */
|
||||||
global $f_gstate;
|
$f_gstate = new SplFileObject(STATE_CONF, 'r');
|
||||||
|
|
||||||
/* (2) Read first line */
|
/* (2) Read first line */
|
||||||
$f_gstate->seek(0);
|
$f_gstate->seek(0);
|
||||||
|
@ -36,11 +35,13 @@
|
||||||
$state = preg_replace('@^\s+@', '', $state);
|
$state = preg_replace('@^\s+@', '', $state);
|
||||||
$state = preg_replace('@\s+$@', '', $state);
|
$state = preg_replace('@\s+$@', '', $state);
|
||||||
|
|
||||||
/* (3) Check data */
|
/* (3) Free file descriptor */
|
||||||
|
|
||||||
|
/* (4) Check data */
|
||||||
if( strlen($state) < 1 )
|
if( strlen($state) < 1 )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* (4) Return global state */
|
/* (5) Return global state */
|
||||||
return $state;
|
return $state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,7 +112,6 @@
|
||||||
global $f_accesslog;
|
global $f_accesslog;
|
||||||
|
|
||||||
/* (5) Update global state */
|
/* (5) Update global state */
|
||||||
global $f_gstate;
|
|
||||||
$state = get_gstate();
|
$state = get_gstate();
|
||||||
|
|
||||||
// manage error
|
// manage error
|
||||||
|
@ -211,8 +211,7 @@
|
||||||
|
|
||||||
|
|
||||||
/* (2) Update the state file */
|
/* (2) Update the state file */
|
||||||
$f_gstate->seek(0);
|
$written = @file_put_contents(STATE_CONF, $state);
|
||||||
$written = $f_gstate->fwrite($state);
|
|
||||||
|
|
||||||
/* (3) Manage error */
|
/* (3) Manage error */
|
||||||
if( $written === false )
|
if( $written === false )
|
||||||
|
@ -251,7 +250,7 @@
|
||||||
/* [0] Initialize global variables
|
/* [0] Initialize global variables
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
/* (1) File descriptiors */
|
/* (1) File descriptiors */
|
||||||
global $f_auth, $f_accesslog, $f_gstate;
|
global $f_auth, $f_accesslog;
|
||||||
|
|
||||||
/* (2) Caches */
|
/* (2) Caches */
|
||||||
global $actions;
|
global $actions;
|
||||||
|
@ -263,7 +262,6 @@
|
||||||
/* (1) Read accesses */
|
/* (1) Read accesses */
|
||||||
$f_auth = new SplFileObject(AUTH_CONF, 'r');
|
$f_auth = new SplFileObject(AUTH_CONF, 'r');
|
||||||
$f_actions = new SplFileObject(ACTIONS_CONF, 'r');
|
$f_actions = new SplFileObject(ACTIONS_CONF, 'r');
|
||||||
$f_gstate = new SplFileObject(STATE_CONF, 'r+');
|
|
||||||
|
|
||||||
/* (2) Append accesses (logs) */
|
/* (2) Append accesses (logs) */
|
||||||
$f_accesslog = new SplFileObject(DEFAULT_DATA, 'a');
|
$f_accesslog = new SplFileObject(DEFAULT_DATA, 'a');
|
||||||
|
|
Loading…
Reference in New Issue