From 67e14bd12f61cadf285477312e65a2e1320d1a64 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 20 Oct 2016 13:16:50 -0400 Subject: [PATCH] move States loading code into state view where it belongs. Move runnign check into specific places where it is needed. These changes reduce events list load time by about 4 seconds for me. --- web/index.php | 22 +++++++++++----------- web/skins/classic/includes/functions.php | 2 +- web/skins/classic/views/js/state.js.php | 2 +- web/skins/classic/views/state.php | 6 ++++-- web/views/image.php | 2 +- 5 files changed, 18 insertions(+), 16 deletions(-) diff --git a/web/index.php b/web/index.php index 8f0d78131..671307925 100644 --- a/web/index.php +++ b/web/index.php @@ -137,15 +137,15 @@ if ( ZM_OPT_USE_AUTH ) { require_once( 'includes/lang.php' ); require_once( 'includes/functions.php' ); -$running = daemonCheck(); -$states = dbFetchAll( 'SELECT * FROM States' ); -foreach ( $states as $state ) { - if ( $state['IsActive'] == 1 ) { - $run_state = $state['Name']; - break; - } -} -$status = $running?translate('Running'):translate('Stopped'); +#$running = daemonCheck(); +#$states = dbFetchAll( 'SELECT * FROM States' ); +#foreach ( $states as $state ) { + #if ( $state['IsActive'] == 1 ) { + #$run_state = $state['Name']; + #break; + #} +#} +#$status = $running?translate('Running'):translate('Stopped'); #$run_state = dbFetchOne('SELECT Name FROM States WHERE IsActive = 1', 'Name' ); # Add Cross domain access headers @@ -157,10 +157,10 @@ if ( !is_writable(ZM_DIR_EVENTS) || !is_writable(ZM_DIR_IMAGES) ) { } if ( isset($_REQUEST['view']) ) -$view = detaintPath($_REQUEST['view']); + $view = detaintPath($_REQUEST['view']); if ( isset($_REQUEST['request']) ) -$request = detaintPath($_REQUEST['request']); + $request = detaintPath($_REQUEST['request']); foreach ( getSkinIncludes( 'skin.php' ) as $includeFile ) require_once $includeFile; diff --git a/web/skins/classic/includes/functions.php b/web/skins/classic/includes/functions.php index 849d35db8..9a7d2d755 100644 --- a/web/skins/classic/includes/functions.php +++ b/web/skins/classic/includes/functions.php @@ -186,7 +186,7 @@ function getNavBarHTML() { global $CLANG; global $VLANG; global $status; - global $running; + $running = daemonCheck(); global $user; global $bwArray; ?> diff --git a/web/skins/classic/views/js/state.js.php b/web/skins/classic/views/js/state.js.php index 89e589ad4..a7c14a0dc 100644 --- a/web/skins/classic/views/js/state.js.php +++ b/web/skins/classic/views/js/state.js.php @@ -1,2 +1,2 @@ -var running = ; +var running = ; var applying = ; diff --git a/web/skins/classic/views/state.php b/web/skins/classic/views/state.php index 353b798f8..b13474cb9 100644 --- a/web/skins/classic/views/state.php +++ b/web/skins/classic/views/state.php @@ -40,14 +40,16 @@ if ( !canEdit( 'System' ) ) {
diff --git a/web/views/image.php b/web/views/image.php index 96e081e35..479533f47 100644 --- a/web/views/image.php +++ b/web/views/image.php @@ -70,7 +70,7 @@ if ( empty($_REQUEST['path']) ) { $path = $Event->Path().'/'.sprintf('%0'.ZM_EVENT_IMAGE_DIGITS.'d',$Frame->FrameId()).'-'.$show.'.jpg'; } } else { - $errorText = "No image path"; + $errorText = 'No image path'; } if ( ! file_exists( $path ) ) {