diff options
author | Paul 'flowerysong' Arthur <flowerysong00@yahoo.com> | 2010-03-14 20:14:52 +0000 |
---|---|---|
committer | Paul 'flowerysong' Arthur <flowerysong00@yahoo.com> | 2010-03-14 20:14:52 +0000 |
commit | 1cb0983ed04c65e06d502ae2ac9ed6d5e31d70dc (patch) | |
tree | 54655ff3e692a71a17f1d37cd97374b263557ca1 /lib/init.php | |
parent | ef48bf3fbdca2a4d25f5d025f4c6ad23905e5369 (diff) | |
download | ampache-1cb0983ed04c65e06d502ae2ac9ed6d5e31d70dc.tar.gz ampache-1cb0983ed04c65e06d502ae2ac9ed6d5e31d70dc.tar.bz2 ampache-1cb0983ed04c65e06d502ae2ac9ed6d5e31d70dc.zip |
Cosmetics: remove trailing whitespace
Diffstat (limited to 'lib/init.php')
-rw-r--r-- | lib/init.php | 144 |
1 files changed, 72 insertions, 72 deletions
diff --git a/lib/init.php b/lib/init.php index 9adc0e86..7dddb533 100644 --- a/lib/init.php +++ b/lib/init.php @@ -21,16 +21,16 @@ */ // SVN Fluf -$svn_version = 'Subversion ' . trim('$Rev$','$ '); +$svn_version = 'Subversion ' . trim('$Rev$','$ '); -// Use output buffering, this gains us a few things and +// Use output buffering, this gains us a few things and // fixes some CSS issues ob_start(); // Do a check for PHP5 because nothing will work without it if (floatval(phpversion()) < 5) { echo "ERROR: Ampache requires PHP5"; - exit; + exit; } error_reporting(E_ERROR); // Only show fatal errors in production @@ -41,7 +41,7 @@ $ampache_path = dirname(__FILE__); $prefix = realpath($ampache_path . "/../"); $configfile = "$prefix/config/ampache.cfg.php"; require_once $prefix . '/lib/general.lib.php'; -require_once $prefix . '/lib/class/config.class.php'; +require_once $prefix . '/lib/class/config.class.php'; require_once $prefix . '/lib/class/vauth.class.php'; // Fixes synology bug with __autoload in certain cases if (!function_exists('gettext')) { @@ -49,15 +49,15 @@ if (!function_exists('gettext')) { } // Define some base level config options -Config::set('prefix',$prefix); +Config::set('prefix',$prefix); /* Check to see if this is Http or https */ -if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') { +if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') { $http_type = "https://"; } -else { +else { $http_type = "http://"; } @@ -66,51 +66,51 @@ else { then go ahead and move them over to the install script */ -if (!file_exists($configfile)) { +if (!file_exists($configfile)) { $path = preg_replace("/(.*)\/(\w+\.php)$/","\${1}", $_SERVER['PHP_SELF']); $link = $http_type . $_SERVER['HTTP_HOST'] . $path . "/install.php"; header ("Location: $link"); exit(); } -// Use the built in PHP function, supress errors here so we can handle it properly -$results = @parse_ini_file($configfile); +// Use the built in PHP function, supress errors here so we can handle it properly +$results = @parse_ini_file($configfile); -if (!count($results)) { +if (!count($results)) { $path = preg_replace("/(.*)\/(\w+\.php)$/","\${1}", $_SERVER['PHP_SELF']); $link = $http_type . $_SERVER['HTTP_HOST'] . $path . "/test.php?action=config"; header ("Location: $link"); exit(); -} +} /** Verify a few commonly removed PHP functions exist and re-direct to /test if not **/ -if (!function_exists('hash') OR !function_exists('inet_pton') OR (strtoupper(substr(PHP_OS,0,3)) == 'WIN' AND floatval(phpversion()) < 5.3)) { +if (!function_exists('hash') OR !function_exists('inet_pton') OR (strtoupper(substr(PHP_OS,0,3)) == 'WIN' AND floatval(phpversion()) < 5.3)) { $path = preg_replace("/(.*)\/(\w+\.php)$/","\${1}", $_SERVER['PHP_SELF']); $link = $http_type . $_SERVER['HTTP_HOST'] . $path . "/test.php"; - header ("Location: $link"); - exit(); -} + header ("Location: $link"); + exit(); +} /** This is the version.... fluf nothing more... **/ -$results['version'] = '3.6-Alpha1 '. $svn_version; -$results['int_config_version'] = '10'; +$results['version'] = '3.6-Alpha1 '. $svn_version; +$results['int_config_version'] = '10'; $results['raw_web_path'] = $results['web_path']; $results['web_path'] = $http_type . $_SERVER['HTTP_HOST'] . $results['web_path']; $results['http_port'] = $_SERVER['SERVER_PORT']; -if (!$results['http_port']) { +if (!$results['http_port']) { $results['http_port'] = '80'; -} -if (!$results['site_charset']) { +} +if (!$results['site_charset']) { $results['site_charset'] = "UTF-8"; } -if (!$results['raw_web_path']) { +if (!$results['raw_web_path']) { $results['raw_web_path'] = '/'; } -if (!$_SERVER['SERVER_NAME']) { +if (!$_SERVER['SERVER_NAME']) { $_SERVER['SERVER_NAME'] = ''; } -if (isset($results['user_ip_cardinality']) && !$results['user_ip_cardinality']) { +if (isset($results['user_ip_cardinality']) && !$results['user_ip_cardinality']) { $results['user_ip_cardinality'] = 42; } @@ -136,8 +136,8 @@ require_once $prefix . '/lib/gettext.php'; require_once $prefix . '/lib/batch.lib.php'; require_once $prefix . '/lib/themes.php'; require_once $prefix . '/lib/class/localplay.abstract.php'; -require_once $prefix . '/lib/class/database_object.abstract.php'; -require_once $prefix . '/lib/class/media.interface.php'; +require_once $prefix . '/lib/class/database_object.abstract.php'; +require_once $prefix . '/lib/class/media.interface.php'; require_once $prefix . '/modules/getid3/getid3.php'; require_once $prefix . '/modules/nusoap/nusoap.php'; require_once $prefix . '/modules/phpmailer/class.phpmailer.php'; @@ -154,7 +154,7 @@ $results = Preference::fix_preferences($results); Config::set_by_array($results,1); // Modules (These are conditionaly included depending upon config values) -if (Config::get('ratings')) { +if (Config::get('ratings')) { require_once $prefix . '/lib/class/rating.class.php'; require_once $prefix . '/lib/rating.lib.php'; } @@ -164,84 +164,84 @@ $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') { +if (substr($post_size,strlen($post_size)-1,strlen($post_size)) != 'M') { /* Sane value time */ ini_set('post_max_size','8M'); } -if ($results['memory_limit'] < 24) { +if ($results['memory_limit'] < 24) { $results['memory_limit'] = 24; } -// Incase the local setting is 0 -ini_set('session.gc_probability','2'); +// Incase the local setting is 0 +ini_set('session.gc_probability','2'); set_memory_limit($results['memory_limit']); /**** END Set PHP Vars ****/ // If we want a session -if (NO_SESSION != '1' AND Config::get('use_auth')) { +if (NO_SESSION != '1' AND 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; } - + 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(); /* Create the new user */ $GLOBALS['user'] = User::get_from_username($_SESSION['userdata']['username']); - + /* If they user ID doesn't exist deny them */ - if (!$GLOBALS['user']->id AND !Config::get('demo_mode')) { vauth::logout(session_id()); exit; } + if (!$GLOBALS['user']->id AND !Config::get('demo_mode')) { vauth::logout(session_id()); exit; } - vauth::session_extend(session_id()); + vauth::session_extend(session_id()); /* Load preferences and theme */ $GLOBALS['user']->update_last_seen(); } -elseif (!Config::get('use_auth')) { +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']; + $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']) { + 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']; - } + } + 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')); +else { + if (isset($_REQUEST['sid'])) { + session_name(Config::get('session_name')); session_id(scrub_in($_REQUEST['sid'])); session_start(); $GLOBALS['user'] = User::get_from_username($_SESSION['userdata']['username']); } - else { - $GLOBALS['user'] = new User(); - } + else { + $GLOBALS['user'] = new User(); + } } // If NO_SESSION passed @@ -249,9 +249,9 @@ else { Preference::init(); // We need to create the tmp playlist for our user only if we have a session -if (session_id()) { - $GLOBALS['user']->load_playlist(); -} +if (session_id()) { + $GLOBALS['user']->load_playlist(); +} /* Add in some variables for ajax done here because we need the user */ Config::set('ajax_url',Config::get('web_path') . '/server/ajax.server.php',1); @@ -267,7 +267,7 @@ unset($array); unset($results); /* Setup the flip class */ -flip_class(array('odd','even')); +flip_class(array('odd','even')); /* Check to see if we need to perform an update */ if (!preg_match('/update\.php/', $_SERVER['PHP_SELF'])) { @@ -277,14 +277,14 @@ if (!preg_match('/update\.php/', $_SERVER['PHP_SELF'])) { } } // For the XMLRPC stuff -$GLOBALS['xmlrpc_internalencoding'] = Config::get('site_charset'); +$GLOBALS['xmlrpc_internalencoding'] = Config::get('site_charset'); // If debug is on GIMMIE DA ERRORS if (Config::get('debug')) { error_reporting(E_ALL); } -// Merge GET then POST into REQUEST effectivly striping COOKIE without depending on +// Merge GET then POST into REQUEST effectivly striping COOKIE without depending on // a PHP setting change to take affect -$_REQUEST = array_merge($_GET,$_POST); +$_REQUEST = array_merge($_GET,$_POST); ?> |