diff --git a/web/index.php b/web/index.php index 9780f4f098..693a0f5eba 100644 --- a/web/index.php +++ b/web/index.php @@ -24,7 +24,6 @@ if ( $debug ) { // Use these for debugging, though not both at once! phpinfo(INFO_VARIABLES); - //error_reporting( E_ALL ); } // Use new style autoglobals where possible @@ -138,7 +137,6 @@ $skinBase[] = $skin; zm_session_start(); - if ( !isset($_SESSION['skin']) || isset($_REQUEST['skin']) || @@ -159,9 +157,6 @@ zm_setcookie('zmCSS', $css); } -# Running is global but only do the daemonCheck if it is actually needed -$running = null; - # Add Cross domain access headers CORSHeaders(); @@ -171,18 +166,14 @@ } # Globals +# Running is global but only do the daemonCheck if it is actually needed +$running = null; $action = null; $error_message = null; $redirect = null; -$view = null; +$view = isset($_REQUEST['view']) ? detaintPath($_REQUEST['view']) : null; $user = null; -if ( isset($_REQUEST['view']) ) - $view = detaintPath($_REQUEST['view']); - - -$request = null; -if ( isset($_REQUEST['request']) ) - $request = detaintPath($_REQUEST['request']); +$request = isset($_REQUEST['request']) ? detaintPath($_REQUEST['request']) : null; require_once('includes/auth.php'); @@ -215,9 +206,6 @@ isset($action) || $action = NULL; if ( (!$view and !$request) or ($view == 'console') ) { - // Verify the system, php, and mysql timezones all match - #if ( ZM_TIMEZONE ) - #date_default_timezone_set(ZM_TIMEZONE); check_timezone(); } @@ -240,7 +228,6 @@ # Need to include actions because it does auth if ( $action and $view and !$request ) { if ( file_exists('includes/actions/'.$view.'.php') ) { - ZM\Debug("Including includes/actions/$view.php"); require_once('includes/actions/'.$view.'.php'); } else { ZM\Warning("No includes/actions/$view.php for action $action"); @@ -265,10 +252,11 @@ $request = null; } -if ( isset($_REQUEST['redirect']) ) +if ( isset($_REQUEST['redirect']) ) { $redirect = '?view='.detaintPath($_REQUEST['redirect']); +} -if ( $redirect ) { +if ($redirect) { ZM\Debug("Redirecting to $redirect"); header('Location: '.$redirect); return; @@ -289,7 +277,7 @@ ob_start(); CSPHeaders($view, $cspNonce); foreach ( $includeFiles as $includeFile ) { - if ( !file_exists($includeFile) ) + if (!file_exists($includeFile)) ZM\Fatal("View '$view' does not exist"); require_once $includeFile; } @@ -302,7 +290,7 @@ require_once $includeFile; } while (ob_get_level() > 0) ob_end_flush(); -} +} # end if include files for view // If the view is missing or the view still returned error with the user logged in, // then it is not recoverable. if ( !$includeFiles || $view == 'error' ) {