|
From: Steve W. <wai...@us...> - 2001-09-19 02:27:53
|
Update of /cvsroot/phpwiki/phpwiki/lib
In directory usw-pr-cvs1:/tmp/cvs-serv32517
Modified Files:
config.php
Log Message:
Testing latest Local Variables setting. I stripped all leading white
space and then did an indent-region.
Index: config.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/config.php,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -r1.41 -r1.42
*** config.php 2001/09/18 19:16:23 1.41
--- config.php 2001/09/19 02:27:50 1.42
***************
*** 3,15 ****
/*
* NOTE: the settings here should probably not need to be changed.
! *
! *
! * (The user-configurable settings have been moved to index.php.)
! */
if (!defined("LC_ALL")) {
! // Backward compatibility (for PHP < 4.0.5)
! define("LC_ALL", "LC_ALL");
! define("LC_CTYPE", "LC_CTYPE");
}
--- 3,15 ----
/*
* NOTE: the settings here should probably not need to be changed.
! *
! *
! * (The user-configurable settings have been moved to index.php.)
! */
if (!defined("LC_ALL")) {
! // Backward compatibility (for PHP < 4.0.5)
! define("LC_ALL", "LC_ALL");
! define("LC_CTYPE", "LC_CTYPE");
}
***************
*** 27,52 ****
function FindFile ($file, $missing_okay = false)
{
! // FIXME: This wont work for DOS filenames.
! if (ereg('^/', $file))
! {
! // absolute path.
! if (file_exists($file))
! return $file;
! }
! else
! {
! $include_path = ini_get('include_path');
! if (empty($include_path))
! $include_path = '.';
! // FIXME: This wont work for DOS filenames.
! $path = explode(':', $include_path);
! while (list($i, $dir) = each ($path))
! if (file_exists("$dir/$file"))
! return "$dir/$file";
! }
!
! if (!$missing_okay)
! ExitWiki("$file: file not found");
! return false;
}
--- 27,52 ----
function FindFile ($file, $missing_okay = false)
{
! // FIXME: This wont work for DOS filenames.
! if (ereg('^/', $file))
! {
! // absolute path.
! if (file_exists($file))
! return $file;
! }
! else
! {
! $include_path = ini_get('include_path');
! if (empty($include_path))
! $include_path = '.';
! // FIXME: This wont work for DOS filenames.
! $path = explode(':', $include_path);
! while (list($i, $dir) = each ($path))
! if (file_exists("$dir/$file"))
! return "$dir/$file";
! }
!
! if (!$missing_okay)
! ExitWiki("$file: file not found");
! return false;
}
***************
*** 55,87 ****
function FindLocalizedFile ($file, $missing_okay = false)
{
! $language = $GLOBALS['LANG'];
!
! if (empty($language))
! $language = getenv("LC_ALL");
! if (empty($language))
! $language = getenv("LC_MESSAGES");
! if (empty($language))
! $language = getenv("LC_RESPONSES"); // deprecated
! if (empty($language))
! $language = getenv("LANG");
! if (empty($language))
! $language = "C";
!
! // FIXME: This wont work for DOS filenames.
! if (!ereg('^/', $file))
! {
! if ( ($path = FindFile("locale/$language/$file", 'missing_is_okay')) )
! return $path;
! // A locale can be, e.g. de_DE.iso8859-1@euro.
! // Try less specific versions of the locale:
! $seps = array('@', '.', '_');
! for ($i = 0; $i < count($seps); $i++)
! if ( ($tail = strchr($language, $seps[$i])) ) {
! $head = substr($language, 0, -strlen($tail));
! if ( ($path = FindFile("locale/$head/$file", 'missing_is_okay')) )
! return $path;
! }
! }
! return FindFile($file, $missing_okay);
}
--- 55,87 ----
function FindLocalizedFile ($file, $missing_okay = false)
{
! $language = $GLOBALS['LANG'];
!
! if (empty($language))
! $language = getenv("LC_ALL");
! if (empty($language))
! $language = getenv("LC_MESSAGES");
! if (empty($language))
! $language = getenv("LC_RESPONSES"); // deprecated
! if (empty($language))
! $language = getenv("LANG");
! if (empty($language))
! $language = "C";
!
! // FIXME: This wont work for DOS filenames.
! if (!ereg('^/', $file))
! {
! if ( ($path = FindFile("locale/$language/$file", 'missing_is_okay')) )
! return $path;
! // A locale can be, e.g. de_DE.iso8859-1@euro.
! // Try less specific versions of the locale:
! $seps = array('@', '.', '_');
! for ($i = 0; $i < count($seps); $i++)
! if ( ($tail = strchr($language, $seps[$i])) ) {
! $head = substr($language, 0, -strlen($tail));
! if ( ($path = FindFile("locale/$head/$file", 'missing_is_okay')) )
! return $path;
! }
! }
! return FindFile($file, $missing_okay);
}
***************
*** 92,114 ****
if (!function_exists ('gettext'))
{
! $locale = array();
! function gettext ($text) {
! global $locale;
! if (!empty ($locale[$text]))
! return $locale[$text];
! return $text;
! }
!
! if ( ($lcfile = FindLocalizedFile("LC_MESSAGES/phpwiki.php", 'missing_ok')) )
! {
! include($lcfile);
! }
}
else
{
! // Setup localisation
! bindtextdomain ("phpwiki", FindFile("locale"));
! textdomain ("phpwiki");
}
--- 92,114 ----
if (!function_exists ('gettext'))
{
! $locale = array();
! function gettext ($text) {
! global $locale;
! if (!empty ($locale[$text]))
! return $locale[$text];
! return $text;
! }
!
! if ( ($lcfile = FindLocalizedFile("LC_MESSAGES/phpwiki.php", 'missing_ok')) )
! {
! include($lcfile);
! }
}
else
{
! // Setup localisation
! bindtextdomain ("phpwiki", FindFile("locale"));
! textdomain ("phpwiki");
}
***************
*** 134,183 ****
// have a list of locales to try.
if (setlocale(LC_CTYPE, 0) == 'C')
! setlocale(LC_CTYPE, 'en_US.iso-8859-1');
/** string pcre_fix_posix_classes (string $regexp)
! *
! * Older version (pre 3.x?) of the PCRE library do not support
! * POSIX named character classes (e.g. [[:alnum:]]).
! *
! * This is a helper function which can be used to convert a regexp
! * which contains POSIX named character classes to one that doesn't.
! *
! * All instances of strings like '[:<class>:]' are replaced by the equivalent
! * enumerated character class.
! *
! * Implementation Notes:
! *
! * Currently we use hard-coded values which are valid only for
! * ISO-8859-1. Also, currently on the classes [:alpha:], [:alnum:],
! * [:upper:] and [:lower:] are implemented. (The missing classes:
! * [:blank:], [:cntrl:], [:digit:], [:graph:], [:print:], [:punct:],
! * [:space:], and [:xdigit:] could easily be added if needed.)
! *
! * This is a hack. I tried to generate these classes automatically
! * using ereg(), but discovered that in my PHP, at least, ereg() is
! * slightly broken w.r.t. POSIX character classes. (It includes
! * "\xaa" and "\xba" in [:alpha:].)
! *
! * So for now, this will do. --Jeff <da...@da...> 14 Mar, 2001
! */
function pcre_fix_posix_classes ($regexp) {
! // First check to see if our PCRE lib supports POSIX character
! // classes. If it does, there's nothing to do.
! if (preg_match('/[[:upper:]]/', 'A'))
! return $regexp;
!
! static $classes = array(
! 'alnum' => "0-9A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\xff",
! 'alpha' => "A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\xff",
! 'upper' => "A-Z\xc0-\xd6\xd8-\xde",
! 'lower' => "a-z\xdf-\xf6\xf8-\xff"
! );
! $keys = join('|', array_keys($classes));
! return preg_replace("/\[:($keys):]/e", '$classes["\1"]', $regexp);
}
!
$WikiNameRegexp = pcre_fix_posix_classes($WikiNameRegexp);
--- 134,183 ----
// have a list of locales to try.
if (setlocale(LC_CTYPE, 0) == 'C')
! setlocale(LC_CTYPE, 'en_US.iso-8859-1');
/** string pcre_fix_posix_classes (string $regexp)
! *
! * Older version (pre 3.x?) of the PCRE library do not support
! * POSIX named character classes (e.g. [[:alnum:]]).
! *
! * This is a helper function which can be used to convert a regexp
! * which contains POSIX named character classes to one that doesn't.
! *
! * All instances of strings like '[:<class>:]' are replaced by the equivalent
! * enumerated character class.
! *
! * Implementation Notes:
! *
! * Currently we use hard-coded values which are valid only for
! * ISO-8859-1. Also, currently on the classes [:alpha:], [:alnum:],
! * [:upper:] and [:lower:] are implemented. (The missing classes:
! * [:blank:], [:cntrl:], [:digit:], [:graph:], [:print:], [:punct:],
! * [:space:], and [:xdigit:] could easily be added if needed.)
! *
! * This is a hack. I tried to generate these classes automatically
! * using ereg(), but discovered that in my PHP, at least, ereg() is
! * slightly broken w.r.t. POSIX character classes. (It includes
! * "\xaa" and "\xba" in [:alpha:].)
! *
! * So for now, this will do. --Jeff <da...@da...> 14 Mar, 2001
! */
function pcre_fix_posix_classes ($regexp) {
! // First check to see if our PCRE lib supports POSIX character
! // classes. If it does, there's nothing to do.
! if (preg_match('/[[:upper:]]/', 'A'))
! return $regexp;
!
! static $classes = array(
! 'alnum' => "0-9A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\xff",
! 'alpha' => "A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\xff",
! 'upper' => "A-Z\xc0-\xd6\xd8-\xde",
! 'lower' => "a-z\xdf-\xf6\xf8-\xff"
! );
! $keys = join('|', array_keys($classes));
! return preg_replace("/\[:($keys):]/e", '$classes["\1"]', $regexp);
}
!
$WikiNameRegexp = pcre_fix_posix_classes($WikiNameRegexp);
***************
*** 189,208 ****
if (!defined('SCRIPT_NAME')) define('SCRIPT_NAME', $HTTP_SERVER_VARS['SCRIPT_NAME']);
if (!defined('DATA_PATH'))
! define('DATA_PATH', dirname(SCRIPT_NAME));
! if (!defined('USE_PATH_INFO'))
{
! /*
! * If SCRIPT_NAME does not look like php source file,
! * or user cgi we assume that php is getting run by an
! * action handler in /cgi-bin. In this case,
! * I think there is no way to get Apache to pass
! * useful PATH_INFO to the php script (PATH_INFO
! * is used to the the php interpreter where the
! * php script is...)
! */
! if (php_sapi_name() == 'apache')
! define('USE_PATH_INFO', true);
! else
! define('USE_PATH_INFO', ereg('\.(php3?|cgi)$', $SCRIPT_NAME));
}
--- 189,208 ----
if (!defined('SCRIPT_NAME')) define('SCRIPT_NAME', $HTTP_SERVER_VARS['SCRIPT_NAME']);
if (!defined('DATA_PATH'))
! define('DATA_PATH', dirname(SCRIPT_NAME));
! if (!defined('USE_PATH_INFO'))
{
! /*
! * If SCRIPT_NAME does not look like php source file,
! * or user cgi we assume that php is getting run by an
! * action handler in /cgi-bin. In this case,
! * I think there is no way to get Apache to pass
! * useful PATH_INFO to the php script (PATH_INFO
! * is used to the the php interpreter where the
! * php script is...)
! */
! if (php_sapi_name() == 'apache')
! define('USE_PATH_INFO', true);
! else
! define('USE_PATH_INFO', ereg('\.(php3?|cgi)$', $SCRIPT_NAME));
}
***************
*** 210,277 ****
function IsProbablyRedirectToIndex ()
{
! // This might be a redirect to the DirectoryIndex,
! // e.g. REQUEST_URI = /dir/ got redirected
! // to SCRIPT_NAME = /dir/index.php
!
! // In this case, the proper virtual path is still
! // $SCRIPT_NAME, since pages appear at
! // e.g. /dir/index.php/HomePage.
!
! //global $REQUEST_URI, $SCRIPT_NAME;
! extract($GLOBALS['HTTP_SERVER_VARS']);
!
! $requri = preg_quote($REQUEST_URI, '%');
! return preg_match("%^${requri}[^/]*$%", $SCRIPT_NAME);
}
-
if (!defined('VIRTUAL_PATH'))
{
! // We'd like to auto-detect when the cases where apaches
! // 'Action' directive (or similar means) is used to
! // redirect page requests to a cgi-handler.
! //
! // In cases like this, requests for e.g. /wiki/HomePage
! // get redirected to a cgi-script called, say,
! // /path/to/wiki/index.php. The script gets all
! // of /wiki/HomePage as it's PATH_INFO.
! //
! // The problem is:
! // How to detect when this has happened reliably?
! // How to pick out the "virtual path" (in this case '/wiki')?
! //
! // (Another time an redirect might occur is to a DirectoryIndex
! // -- the requested URI is '/wikidir/', the request gets
! // passed to '/wikidir/index.php'. In this case, the
! // proper VIRTUAL_PATH is '/wikidir/index.php', since the
! // pages will appear at e.g. '/wikidir/index.php/HomePage'.
! //
!
! $REDIRECT_URL = &$HTTP_SERVER_VARS['REDIRECT_URL'];
! if (USE_PATH_INFO and isset($REDIRECT_URL)
! and ! IsProbablyRedirectToIndex())
! {
! // FIXME: This is a hack, and won't work if the requested
! // pagename has a slash in it.
! define('VIRTUAL_PATH', dirname($REDIRECT_URL . 'x'));
! }
! else
! define('VIRTUAL_PATH', SCRIPT_NAME);
}
if (SERVER_PORT && SERVER_PORT != 80)
! define('SERVER_URL',
! "http://" . SERVER_NAME . ':' . SERVER_PORT);
! else
! define('SERVER_URL',
! "http://" . SERVER_NAME);
if (VIRTUAL_PATH != SCRIPT_NAME)
{
! // Apache action handlers are used.
! define('PATH_INFO_PREFIX', VIRTUAL_PATH . "/");
}
else
! define("PATH_INFO_PREFIX", '/');
--- 210,277 ----
function IsProbablyRedirectToIndex ()
{
! // This might be a redirect to the DirectoryIndex,
! // e.g. REQUEST_URI = /dir/ got redirected
! // to SCRIPT_NAME = /dir/index.php
!
! // In this case, the proper virtual path is still
! // $SCRIPT_NAME, since pages appear at
! // e.g. /dir/index.php/HomePage.
!
! //global $REQUEST_URI, $SCRIPT_NAME;
! extract($GLOBALS['HTTP_SERVER_VARS']);
!
! $requri = preg_quote($REQUEST_URI, '%');
! return preg_match("%^${requri}[^/]*$%", $SCRIPT_NAME);
}
+
if (!defined('VIRTUAL_PATH'))
{
! // We'd like to auto-detect when the cases where apaches
! // 'Action' directive (or similar means) is used to
! // redirect page requests to a cgi-handler.
! //
! // In cases like this, requests for e.g. /wiki/HomePage
! // get redirected to a cgi-script called, say,
! // /path/to/wiki/index.php. The script gets all
! // of /wiki/HomePage as it's PATH_INFO.
! //
! // The problem is:
! // How to detect when this has happened reliably?
! // How to pick out the "virtual path" (in this case '/wiki')?
! //
! // (Another time an redirect might occur is to a DirectoryIndex
! // -- the requested URI is '/wikidir/', the request gets
! // passed to '/wikidir/index.php'. In this case, the
! // proper VIRTUAL_PATH is '/wikidir/index.php', since the
! // pages will appear at e.g. '/wikidir/index.php/HomePage'.
! //
!
! $REDIRECT_URL = &$HTTP_SERVER_VARS['REDIRECT_URL'];
! if (USE_PATH_INFO and isset($REDIRECT_URL)
! and ! IsProbablyRedirectToIndex())
! {
! // FIXME: This is a hack, and won't work if the requested
! // pagename has a slash in it.
! define('VIRTUAL_PATH', dirname($REDIRECT_URL . 'x'));
! }
! else
! define('VIRTUAL_PATH', SCRIPT_NAME);
}
if (SERVER_PORT && SERVER_PORT != 80)
! define('SERVER_URL',
! "http://" . SERVER_NAME . ':' . SERVER_PORT);
! else
! define('SERVER_URL',
! "http://" . SERVER_NAME);
if (VIRTUAL_PATH != SCRIPT_NAME)
{
! // Apache action handlers are used.
! define('PATH_INFO_PREFIX', VIRTUAL_PATH . "/");
}
else
! define("PATH_INFO_PREFIX", '/');
***************
*** 281,285 ****
if (empty($DBParams['dbtype']))
{
! $DBParams['dbtype'] = 'dba';
}
--- 281,285 ----
if (empty($DBParams['dbtype']))
{
! $DBParams['dbtype'] = 'dba';
}
***************
*** 288,292 ****
if (defined('INTERWIKI_MAP_FILE'))
{
! include ('lib/interwiki.php');
}
--- 288,292 ----
if (defined('INTERWIKI_MAP_FILE'))
{
! include ('lib/interwiki.php');
}
***************
*** 294,309 ****
// Access log
if (!defined('ACCESS_LOG'))
! define('ACCESS_LOG', '');
// FIXME: delete
// Get remote host name, if apache hasn't done it for us
if (empty($HTTP_SERVER_VARS['REMOTE_HOST']) && ENABLE_REVERSE_DNS)
! $HTTP_SERVER_VARS['REMOTE_HOST'] = gethostbyaddr($HTTP_SERVER_VARS['REMOTE_ADDR']);
-
// For emacs users
// Local Variables:
// mode: php
! // c-file-style: "ellemtel"
! // End:
?>
--- 294,314 ----
// Access log
if (!defined('ACCESS_LOG'))
! define('ACCESS_LOG', '');
// FIXME: delete
// Get remote host name, if apache hasn't done it for us
if (empty($HTTP_SERVER_VARS['REMOTE_HOST']) && ENABLE_REVERSE_DNS)
! $HTTP_SERVER_VARS['REMOTE_HOST'] = gethostbyaddr($HTTP_SERVER_VARS['REMOTE_ADDR']);
!
// For emacs users
// Local Variables:
// mode: php
! // tab-width: 8
! // c-basic-offset: 4
! // c-hanging-comment-ender-p: nil
! // indent-tabs-mode: nil
! // End:
!
!
?>
|