diff options
author | Paul Arthur <paul.arthur@flowerysong.com> | 2013-01-26 03:00:32 -0500 |
---|---|---|
committer | Paul Arthur <paul.arthur@flowerysong.com> | 2013-01-26 03:38:46 -0500 |
commit | ef4d3660605efc7f1328d4533b0f4bfb6c1107e2 (patch) | |
tree | e4377fb129a899e65aaaf421f8c97098aecaedd5 /lib/init.php | |
parent | 8a750c3e875d590d351c3042570a134fcdf03e5d (diff) | |
download | ampache-ef4d3660605efc7f1328d4533b0f4bfb6c1107e2.tar.gz ampache-ef4d3660605efc7f1328d4533b0f4bfb6c1107e2.tar.bz2 ampache-ef4d3660605efc7f1328d4533b0f4bfb6c1107e2.zip |
Cosmetics: death to tabs
The refactoring I've been doing has reminded me of my strong preference
for spaces, and I feel inclined to impose my will on the tree.
Diffstat (limited to 'lib/init.php')
-rw-r--r-- | lib/init.php | 158 |
1 files changed, 79 insertions, 79 deletions
diff --git a/lib/init.php b/lib/init.php index 73d68b45..fae52aef 100644 --- a/lib/init.php +++ b/lib/init.php @@ -1,5 +1,5 @@ <?php -/* vim:set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab: */ +/* vim:set softtabstop=4 shiftwidth=4 expandtab: */ /** * * LICENSE: GNU General Public License, version 2 (GPLv2) @@ -40,35 +40,35 @@ $path = $http_type . $_SERVER['HTTP_HOST'] . $path; // Check to make sure the config file exists. If it doesn't then go ahead and // send them over to the install script. if (!file_exists($configfile)) { - $link = $path . '/install.php'; + $link = $path . '/install.php'; } else { - // Make sure the config file is set up and parsable - $results = @parse_ini_file($configfile); + // Make sure the config file is set up and parsable + $results = @parse_ini_file($configfile); - if (!count($results)) { - $link = $path . '/test.php?action=config'; - } + if (!count($results)) { + $link = $path . '/test.php?action=config'; + } } // Verify that a few important but commonly disabled PHP functions exist and // that we're on a usable version if (!function_exists('hash') || !function_exists('inet_pton') || (floatval(phpversion()) < 5.3)) { - $link = $path . '/test.php'; + $link = $path . '/test.php'; } // Do the redirect if we can't continue if ($link) { - header ("Location: $link"); - exit(); + header ("Location: $link"); + exit(); } /** This is the version.... fluf nothing more... **/ -$results['version'] = '3.6-Alpha4-DEV'; -$results['int_config_version'] = '12'; +$results['version'] = '3.6-Alpha4-DEV'; +$results['int_config_version'] = '12'; if ($results['force_ssl']) { - $http_type = 'https://'; + $http_type = 'https://'; } $results['raw_web_path'] = $results['web_path']; @@ -79,14 +79,14 @@ $results['raw_web_path'] = $results['raw_web_path'] ?: '/'; $_SERVER['SERVER_NAME'] = $_SERVER['SERVER_NAME'] ?: ''; if (isset($results['user_ip_cardinality']) && !$results['user_ip_cardinality']) { - $results['user_ip_cardinality'] = 42; + $results['user_ip_cardinality'] = 42; } /* Variables needed for vauth class */ -$results['cookie_path'] = $results['raw_web_path']; -$results['cookie_domain'] = $_SERVER['SERVER_NAME']; -$results['cookie_life'] = $results['session_cookielife']; -$results['cookie_secure'] = $results['session_cookiesecure']; +$results['cookie_path'] = $results['raw_web_path']; +$results['cookie_domain'] = $_SERVER['SERVER_NAME']; +$results['cookie_life'] = $results['session_cookielife']; +$results['cookie_secure'] = $results['session_cookiesecure']; // Library and module includes we can't do with the autoloader require_once $prefix . '/modules/getid3/getid3.php'; @@ -105,7 +105,7 @@ Config::set_by_array($results, true); // Modules (These are conditionally included depending upon config values) if (Config::get('ratings')) { - require_once $prefix . '/lib/rating.lib.php'; + require_once $prefix . '/lib/rating.lib.php'; } /* Set a new Error Handler */ @@ -114,15 +114,15 @@ $old_error_handler = set_error_handler('ampache_error_handler'); /* Check their PHP Vars to make sure we're cool here */ $post_size = @ini_get('post_max_size'); if (substr($post_size,strlen($post_size)-1,strlen($post_size)) != 'M') { - /* Sane value time */ - ini_set('post_max_size','8M'); + /* Sane value time */ + ini_set('post_max_size','8M'); } // In case the local setting is 0 ini_set('session.gc_probability','5'); if (! isset($results['memory_limit']) || $results['memory_limit'] < 24) { - $results['memory_limit'] = 24; + $results['memory_limit'] = 24; } set_memory_limit($results['memory_limit']); @@ -131,64 +131,64 @@ set_memory_limit($results['memory_limit']); // If we want a session if (!defined('NO_SESSION') && Config::get('use_auth')) { - /* Verify their session */ - if (!vauth::session_exists('interface',$_COOKIE[Config::get('session_name')])) { vauth::logout($_COOKIE[Config::get('session_name')]); exit; } + /* Verify their session */ + if (!vauth::session_exists('interface',$_COOKIE[Config::get('session_name')])) { vauth::logout($_COOKIE[Config::get('session_name')]); exit; } - // This actually is starting the session - vauth::check_session(); + // This actually is starting the session + vauth::check_session(); - /* Create the new user */ - $GLOBALS['user'] = User::get_from_username($_SESSION['userdata']['username']); + /* Create the new user */ + $GLOBALS['user'] = User::get_from_username($_SESSION['userdata']['username']); - /* If the user ID doesn't exist deny them */ - if (!$GLOBALS['user']->id AND !Config::get('demo_mode')) { vauth::logout(session_id()); exit; } + /* If the user ID doesn't exist deny them */ + if (!$GLOBALS['user']->id AND !Config::get('demo_mode')) { vauth::logout(session_id()); exit; } - /* Load preferences and theme */ - $GLOBALS['user']->update_last_seen(); + /* Load preferences and theme */ + $GLOBALS['user']->update_last_seen(); } elseif (!Config::get('use_auth')) { - $auth['success'] = 1; - $auth['username'] = '-1'; - $auth['fullname'] = "Ampache User"; - $auth['id'] = -1; - $auth['offset_limit'] = 50; - $auth['access'] = Config::get('default_auth_level') ? User::access_name_to_level(Config::get('default_auth_level')) : '100'; - if (!vauth::session_exists('interface',$_COOKIE[Config::get('session_name')])) { - vauth::create_cookie(); - vauth::session_create($auth); - vauth::check_session(); - $GLOBALS['user'] = new User($auth['username']); - $GLOBALS['user']->username = $auth['username']; - $GLOBALS['user']->fullname = $auth['fullname']; - $GLOBALS['user']->access = $auth['access']; - } - else { - vauth::check_session(); - if ($_SESSION['userdata']['username']) { - $GLOBALS['user'] = User::get_from_username($_SESSION['userdata']['username']); - } - else { - $GLOBALS['user'] = new User($auth['username']); - $GLOBALS['user']->id = '-1'; - $GLOBALS['user']->username = $auth['username']; - $GLOBALS['user']->fullname = $auth['fullname']; - $GLOBALS['user']->access = $auth['access']; - } - if (!$GLOBALS['user']->id AND !Config::get('demo_mode')) { vauth::logout(session_id()); exit; } - $GLOBALS['user']->update_last_seen(); - } + $auth['success'] = 1; + $auth['username'] = '-1'; + $auth['fullname'] = "Ampache User"; + $auth['id'] = -1; + $auth['offset_limit'] = 50; + $auth['access'] = Config::get('default_auth_level') ? User::access_name_to_level(Config::get('default_auth_level')) : '100'; + if (!vauth::session_exists('interface',$_COOKIE[Config::get('session_name')])) { + vauth::create_cookie(); + vauth::session_create($auth); + vauth::check_session(); + $GLOBALS['user'] = new User($auth['username']); + $GLOBALS['user']->username = $auth['username']; + $GLOBALS['user']->fullname = $auth['fullname']; + $GLOBALS['user']->access = $auth['access']; + } + else { + vauth::check_session(); + if ($_SESSION['userdata']['username']) { + $GLOBALS['user'] = User::get_from_username($_SESSION['userdata']['username']); + } + else { + $GLOBALS['user'] = new User($auth['username']); + $GLOBALS['user']->id = '-1'; + $GLOBALS['user']->username = $auth['username']; + $GLOBALS['user']->fullname = $auth['fullname']; + $GLOBALS['user']->access = $auth['access']; + } + if (!$GLOBALS['user']->id AND !Config::get('demo_mode')) { vauth::logout(session_id()); exit; } + $GLOBALS['user']->update_last_seen(); + } } // If Auth, but no session is set else { - if (isset($_REQUEST['sid'])) { - session_name(Config::get('session_name')); - session_id(scrub_in($_REQUEST['sid'])); - session_start(); - $GLOBALS['user'] = new User($_SESSION['userdata']['uid']); - } - else { - $GLOBALS['user'] = new User(); - } + if (isset($_REQUEST['sid'])) { + session_name(Config::get('session_name')); + session_id(scrub_in($_REQUEST['sid'])); + session_start(); + $GLOBALS['user'] = new User($_SESSION['userdata']['uid']); + } + else { + $GLOBALS['user'] = new User(); + } } // If NO_SESSION passed @@ -196,9 +196,9 @@ else { Preference::init(); if (session_id()) { - vauth::session_extend(session_id()); - // We only need to create the tmp playlist if we have a session - $GLOBALS['user']->load_playlist(); + vauth::session_extend(session_id()); + // We only need to create the tmp playlist if we have a session + $GLOBALS['user']->load_playlist(); } /* Add in some variables for ajax done here because we need the user */ @@ -216,16 +216,16 @@ unset($results); /* Check to see if we need to perform an update */ if (!defined('OUTDATED_DATABASE_OK')) { - if (Update::need_update()) { - header("Location: " . Config::get('web_path') . "/update.php"); - exit(); - } + if (Update::need_update()) { + header("Location: " . Config::get('web_path') . "/update.php"); + exit(); + } } // For the XMLRPC stuff $GLOBALS['xmlrpc_internalencoding'] = Config::get('site_charset'); // If debug is on GIMMIE DA ERRORS if (Config::get('debug')) { - error_reporting(E_ALL); + error_reporting(E_ALL); } ?> |