Skip to content

Commit

Permalink
Minor cleanup, remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
Isaac Connor committed Oct 17, 2022
1 parent 96a2e6f commit ef119e3
Showing 1 changed file with 9 additions and 21 deletions.
30 changes: 9 additions & 21 deletions web/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -138,7 +137,6 @@
$skinBase[] = $skin;

zm_session_start();

if (
!isset($_SESSION['skin']) ||
isset($_REQUEST['skin']) ||
Expand All @@ -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();

Expand All @@ -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');

Expand Down Expand Up @@ -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();
}

Expand All @@ -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");
Expand All @@ -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;
Expand All @@ -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;
}
Expand All @@ -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' ) {
Expand Down

0 comments on commit ef119e3

Please sign in to comment.