From: Evan Prodromou Date: Wed, 23 Sep 2009 13:45:22 +0000 (-0400) Subject: Merge branch '0.8.x' into 0.9.x X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=8284b3cb82f4dec6e0f2bf74dea6e1a3bc7f4eac;p=quix0rs-gnu-social.git Merge branch '0.8.x' into 0.9.x Conflicts: actions/requesttoken.php classes/File.php install.php lib/noticeform.php --- 8284b3cb82f4dec6e0f2bf74dea6e1a3bc7f4eac diff --cc index.php index 8ff67d19d9,362ab3cd37..51e30f5782 --- a/index.php +++ b/index.php @@@ -45,11 -29,16 +45,17 @@@ $action = null function getPath($req) { if ((common_config('site', 'fancy') || !array_key_exists('PATH_INFO', $_SERVER)) - && array_key_exists('p', $req)) { + && array_key_exists('p', $req) + ) { return $req['p']; } else if (array_key_exists('PATH_INFO', $_SERVER)) { - return $_SERVER['PATH_INFO']; + $path = $_SERVER['PATH_INFO']; + $script = $_SERVER['SCRIPT_NAME']; + if (substr($path, 0, mb_strlen($script)) == $script) { + return substr($path, mb_strlen($script)); + } else { + return $path; + } } else { return null; } diff --cc install.php index 46248c7891,30dd34496b..c2ca7e1196 --- a/install.php +++ b/install.php @@@ -256,17 -214,22 +256,26 @@@ function haveExternalLibrary($external_ return true; } + // Attempt to include a PHP file and report if it worked, while + // suppressing the annoying warning messages on failure. + function haveIncludeFile($filename) { + $old = error_reporting(error_reporting() & ~E_WARNING); + $ok = include_once($filename); + error_reporting($old); + return $ok; + } + +/** + * Check if all is ready for installation + * + * @return void + */ function checkPrereqs() { - $pass = true; + $pass = true; if (file_exists(INSTALLDIR.'/config.php')) { - ?>

Config file "config.php" already exists.

- Config file "config.php" already exists.

'); $pass = false; } @@@ -280,67 -243,54 +289,74 @@@ foreach ($reqs as $req) { if (!checkExtension($req)) { - ?>

Cannot load required extension:

Cannot load required extension: %s

', $req); + $pass = false; + } + } + // Make sure we have at least one database module available + global $dbModules; + $missingExtensions = array(); + foreach ($dbModules as $type => $info) { + if (!checkExtension($info['check_module'])) { + $missingExtensions[] = $info['check_module']; + } + } + + if (count($missingExtensions) == count($dbModules)) { + $req = implode(', ', $missingExtensions); + printf('

Cannot find mysql or pgsql extension. You need one or the other.'); + $pass = false; + } + + if (!is_writable(INSTALLDIR)) { + printf('

Cannot write config file to: %s

', INSTALLDIR); + printf('

On your server, try this command: chmod a+w %s', INSTALLDIR); + $pass = false; + } + + // Check the subdirs used for file uploads + $fileSubdirs = array('avatar', 'background', 'file'); + foreach ($fileSubdirs as $fileSubdir) { + $fileFullPath = INSTALLDIR."/$fileSubdir/"; + if (!is_writable($fileFullPath)) { + printf('

Cannot write to %s directory: %s

', $fileSubdir, $fileFullPath); + printf('

On your server, try this command: chmod a+w %s

', $fileFullPath); + $pass = false; } } - if (!checkExtension('pgsql') && !checkExtension('mysql')) { - ?>

Cannot find mysql or pgsql extension. You need one or the other:

Cannot write config file to:

-

On your server, try this command: chmod a+w -

Cannot write directory:

-

On your server, try this command: chmod a+w

- Installed Libraries