diff --git a/index.php b/index.php index 46843e9..8f7558a 100644 --- a/index.php +++ b/index.php @@ -29,14 +29,19 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -@ini_set('display_errors', '1'); +ini_set('display_errors', '1'); //@error_reporting(E_ALL & ~E_NOTICE); -@session_cache_expire (1440); -@set_time_limit (1500); +session_cache_expire (1440); +set_time_limit (1500); +define('ENVIRONMENT', 'production'); /** - * OPTIONAL SETTINGS: + * OPTIONAL SETTINGS: 'production' or 'development' */ +if (!defined('ENVIRONMENT')) +{ + @define('ENVIRONMENT', 'development'); +} //filenames and paths for configuration related files /*EDIT*/$CONFIG_PATH = './'; @@ -131,10 +136,12 @@ if (ini_get('zlib.output_compression') == '1') * users' browsers. If you do this, make sure any changes you make to the * template do not break XHTML 1.1 compliance. */ -/*if (!empty($_SERVER['HTTP_ACCEPT']) && preg_match('#application/(xhtml\+xml|\*)#i', $_SERVER['HTTP_ACCEPT'])) +/* +if (!empty($_SERVER['HTTP_ACCEPT']) && preg_match('#application/(xhtml\+xml|\*)#i', $_SERVER['HTTP_ACCEPT'])) { header('Content-Type: application/xhtml+xml'); -}*/ +} +*/ session_name('AutoIndex2'); session_start(); @@ -147,38 +154,48 @@ session_start(); * @param string $title * @return string */ -function simple_display($text, $title = 'Error on Page') -{ +function simple_display($text, $title = 'Error on Page', $notify = '', $return_index = "index.php") +{ return ' - - - - - - - - ' . $title . ' - - - -

' . $text . '

- - -'; + + + + + + + ' . + '' . $title . '' . + '' . + '' . + '' . + '
' . + ' ' . + '
' . + '
' . + '
' . + '

' . $title . '

' . + '
' . $text . '
' . + $notify . + '
' . + '
' . + '
' . + ' ' . + '
' . + '' . + ' + + '; } /** @@ -256,7 +273,7 @@ try throw new ExceptionFatal('Neither ' . Url::html_output(CONFIG_GENERATOR) . ' nor ' . Url::html_output(CONFIG_STORED) . ' could be found.'); } //find and store the user's IP address and hostname: $ip = (!empty($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : 'N/A'); - $ip = htmlspecialchars_decode($request->server('HTTP_X_FORWARDED_FOR')); + $ip = !empty($request->server('HTTP_X_FORWARDED_FOR')) ? htmlspecialchars_decode($request->server('HTTP_X_FORWARDED_FOR')) : $request->server('REMOTE_ADDR'); //localhost.localdomain if (!empty($_SESSION['host'])) { @@ -371,8 +388,7 @@ try } } } - - + //size of the "chunks" that are read at a time from the file (when $force_download is on) $speed = (BANDWIDTH_LIMIT ? $config->__get('bandwidth_limit') : 8); @@ -389,16 +405,15 @@ try } $downloads = new ConfigData($config->__get('download_count')); } - //create a user object: $log_login = false; - if (USE_LOGIN_SYSTEM && !empty($_POST['username']) && ($_POST['username'] != '') && ($_POST['password'] != '')) + if (USE_LOGIN_SYSTEM && $request->is_set_post('username')) { - $you = new UserLoggedIn($_POST['username'], sha1($_POST['password'])); + $you = new UserLoggedIn($request->post('username'), sha1($request->post('password'))); $log_login = true; - $_SESSION['password'] = sha1($_POST['password']); - unset($_POST['password']); - $_SESSION['username'] = $_POST['username']; + $_SESSION['password'] = sha1($request->post('password')); + $request->recursive_set_var('password', '', true); //unset($_POST['password']); + $_SESSION['username'] = $request->post('username'); } else if (USE_LOGIN_SYSTEM && !empty($_SESSION['username'])) {