clean up and reduce depth of some logic

This commit is contained in:
Isaac Connor 2019-01-23 11:18:30 -05:00
parent 124be4eee6
commit 58d3583722
1 changed files with 28 additions and 28 deletions

View File

@ -51,7 +51,6 @@ require_once('includes/Event.php');
require_once('includes/Group.php');
require_once('includes/Monitor.php');
if (
(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on')
or
@ -166,6 +165,7 @@ if ( !is_writable(ZM_DIR_EVENTS) ) {
}
# Globals
$action = null;
$error_message = null;
$redirect = null;
$view = null;
@ -185,9 +185,9 @@ foreach ( getSkinIncludes('skin.php') as $includeFile )
# User Login will be performed in auth.php
require_once('includes/auth.php');
if ( isset($_REQUEST['action']) ) {
if ( isset($_REQUEST['action']) )
$action = detaintPath($_REQUEST['action']);
}
# The only variable we really need to set is action. The others are informal.
isset($view) || $view = NULL;
@ -244,8 +244,9 @@ if ( $request ) {
require_once $includeFile;
}
return;
} else {
if ( $includeFiles = getSkinIncludes('views/'.$view.'.php', true, true) ) {
}
if ( $includeFiles = getSkinIncludes('views/'.$view.'.php', true, true) ) {
foreach ( $includeFiles as $includeFile ) {
if ( !file_exists($includeFile) )
Fatal("View '$view' does not exist");
@ -259,12 +260,11 @@ if ( $request ) {
foreach ( getSkinIncludes('views/login.php', true, true) as $includeFile )
require_once $includeFile;
}
}
// 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' ) {
}
// 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' ) {
foreach ( getSkinIncludes('views/error.php', true, true) as $includeFile )
require_once $includeFile;
}
}
?>