Minor cleanup, remove dead code

pull/3667/head
Isaac Connor 2022-10-17 12:35:00 -04:00
parent 96a2e6f6fb
commit ef119e3ed4
1 changed files with 9 additions and 21 deletions

View File

@ -24,7 +24,6 @@ $debug = false;
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 @@ if (!file_exists(ZM_SKIN_PATH))
$skinBase[] = $skin;
zm_session_start();
if (
!isset($_SESSION['skin']) ||
isset($_REQUEST['skin']) ||
@ -159,9 +157,6 @@ if (
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 @@ if ( !is_writable(ZM_DIR_EVENTS) ) {
}
# 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($request) || $request = NULL;
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 @@ if (
# 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 @@ if ( ZM_OPT_USE_AUTH and (!isset($user)) and ($view != 'login') and ($view != 'n
$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 @@ if ( $includeFiles = getSkinIncludes('views/'.$view.'.php', true, true) ) {
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 @@ if ( $includeFiles = getSkinIncludes('views/'.$view.'.php', true, true) ) {
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' ) {