Martin,
These look good. I will commit shortly.
jbw
P.S. The PhpWeatherPlugin page in pagesrc/ modification is already in CVS...
Martin Geisler wrote:
> Hi there!
>
> I've accumulated a fair amount of fixes in my WikiWikiWeb now -
> perhaps someone would apply the following patch to CVS?
>
> The patch contains:
>
> * A fix for problems when file_exists($file) triggers a warning
> because $file lies outside the area that PHP allows you to access
> when running in Safe Mode.
>
> * The regexp that matches InterWiki links was too greedy; it didn't
> stop before a !. So Google:Hello! would search for 'Hello!' whereas
> Google:Hello? only searches for 'Hello'.
>
> * The get_cfg_var() function should only be used when one is
> interested in the value from php.ini or similar. Use ini_get()
> instead to get the effective value of a configuration variable.
>
> * (Better error messages from PhpWeather plugin.)
>
> * Small update of PhpWeatherPlugin page in /pgsrc.
>
> I hope you can use my changes!
>
>
>
> ------------------------------------------------------------------------
>
> Index: lib/FileFinder.php
> ===================================================================
> RCS file: /cvsroot/phpwiki/phpwiki/lib/FileFinder.php,v
> retrieving revision 1.11
> diff -u -3 -r1.11 FileFinder.php
> --- lib/FileFinder.php 18 Sep 2002 18:34:13 -0000 1.11
> +++ lib/FileFinder.php 10 Jan 2003 20:53:22 -0000
> @@ -158,7 +158,7 @@
> $file = $this->slashifyPath($file);
> if (file_exists($dir . $this->_pathsep . $file))
> return $dir;
> - } elseif (file_exists("$dir/$file"))
> + } elseif (@file_exists("$dir/$file"))
> return $dir;
> }
> return false;
> Index: lib/InlineParser.php
> ===================================================================
> RCS file: /cvsroot/phpwiki/phpwiki/lib/InlineParser.php,v
> retrieving revision 1.19
> diff -u -3 -r1.19 InlineParser.php
> --- lib/InlineParser.php 25 Nov 2002 22:51:37 -0000 1.19
> +++ lib/InlineParser.php 10 Jan 2003 20:53:24 -0000
> @@ -281,8 +281,8 @@
> function getMatchRegexp () {
> global $request;
> $map = InterWikiMap::GetMap($request);
> - return "(?<! [[:alnum:]])" . $map->getRegexp(). ": \S+ (?<![ ,.?; \] \) \" \' ])";
> + return "(?<! [[:alnum:]])" . $map->getRegexp(). ": \S+ (?<![ ,.?;! \] \) \" \' ])";
> }
>
> function _markup ($match) {
> Index: lib/loadsave.php
> ===================================================================
> RCS file: /cvsroot/phpwiki/phpwiki/lib/loadsave.php,v
> retrieving revision 1.72
> diff -u -3 -r1.72 loadsave.php
> --- lib/loadsave.php 3 Jan 2003 22:25:53 -0000 1.72
> +++ lib/loadsave.php 10 Jan 2003 20:53:31 -0000
> @@ -141,7 +141,7 @@
> $dbi = $request->getDbh();
> $pages = $dbi->getAllPages();
> while ($page = $pages->next()) {
> - if (! get_cfg_var('safe_mode'))
> + if (! ini_get('safe_mode'))
> set_time_limit(30); // Reset watchdog.
>
> $current = $page->getCurrentRevision();
> @@ -188,7 +188,7 @@
> $pages = $dbi->getAllPages();
>
> while ($page = $pages->next()) {
> - if (! get_cfg_var('safe_mode'))
> + if (! ini_get('safe_mode'))
> set_time_limit(30); // Reset watchdog.
>
> $filename = FilenameForPage($page->getName());
> @@ -251,7 +251,7 @@
> $Theme->HTML_DUMP_SUFFIX = $HTML_DUMP_SUFFIX;
>
> while ($page = $pages->next()) {
> - if (! get_cfg_var('safe_mode'))
> + if (! ini_get('safe_mode'))
> set_time_limit(30); // Reset watchdog.
>
> $pagename = $page->getName();
> @@ -318,7 +318,7 @@
> $Theme->HTML_DUMP_SUFFIX = $HTML_DUMP_SUFFIX;
>
> while ($page = $pages->next()) {
> - if (! get_cfg_var('safe_mode'))
> + if (! ini_get('safe_mode'))
> set_time_limit(30); // Reset watchdog.
>
> $current = $page->getCurrentRevision();
> @@ -592,8 +592,8 @@
> $text = implode("", file($filename));
> }
>
> - if (! get_cfg_var('safe_mode'))
> + if (! ini_get('safe_mode'))
> set_time_limit(30); // Reset watchdog.
>
> // FIXME: basename("filewithnoslashes") seems to return garbage sometimes.
> Index: lib/plugin/PhpWeather.php
> ===================================================================
> RCS file: /cvsroot/phpwiki/phpwiki/lib/plugin/PhpWeather.php,v
> retrieving revision 1.7
> diff -u -3 -r1.7 PhpWeather.php
> --- lib/plugin/PhpWeather.php 31 Dec 2002 20:53:40 -0000 1.7
> +++ lib/plugin/PhpWeather.php 10 Jan 2003 20:53:36 -0000
> @@ -23,16 +23,11 @@
> * both_metric, or both_imperial.
> */
>
> -// We require the base class from PHP Weather, adjust this to match
> -// the location of PhpWeather on your server:
> -$WEATHER = $_SERVER['DOCUMENT_ROOT'] . '/phpweather/phpweather.php';
> -if(! @include_once($WEATHER)) {
> - if(!in_array($WEATHER, get_included_files()) ) {
> - $error = sprintf(_("Could not open file %s."), "'$WEATHER'") . " ";
> - $error .= sprintf(_("Make sure %s is installed and properly configured."),
> - 'PHP Weather');
> - trigger_error($error);
> - }
> +if (!defined('PHPWEATHER_BASE_DIR')) {
> + /* PhpWeather has not been loaded before. We include the base
> + * class from PhpWeather, adjust this to match the location of
> + * PhpWeather on your server: */
> + @include_once($_SERVER['DOCUMENT_ROOT'] . '/phpweather-2.1.0/phpweather.php');
> }
>
> class WikiPlugin_PhpWeather
> @@ -58,9 +53,9 @@
> // When 'phpweather/phpweather.php' is not installed then
> // PHPWEATHER_BASE_DIR will be undefined
> if (!defined('PHPWEATHER_BASE_DIR'))
> - return fmt("Plugin %s failed.", $this->getName()); //early return
> -
> + return $this->error(_("You have to configure it before use.")); //early return
> +
> require_once(PHPWEATHER_BASE_DIR . '/output/pw_images.php');
> require_once(PHPWEATHER_BASE_DIR . '/pw_utilities.php');
>
> Index: pgsrc/PhpWeatherPlugin
> ===================================================================
> RCS file: /cvsroot/phpwiki/phpwiki/pgsrc/PhpWeatherPlugin,v
> retrieving revision 1.3
> diff -u -3 -r1.3 PhpWeatherPlugin
> --- pgsrc/PhpWeatherPlugin 29 Dec 2002 00:32:34 -0000 1.3
> +++ pgsrc/PhpWeatherPlugin 10 Jan 2003 20:53:38 -0000
> @@ -45,10 +45,11 @@
> example shows, then you should use <tt>cc||=XX</tt> when combining it with __menu__
> set to <tt>true</tt>.
>
> -__lang__:
> - The default language. When combining __lang__ with __menu__ set to <tt>true</tt> then
> - remember to use the <code>lang||=xx</code> form.
> +__language__:
> + The default language. When combining __language__ with __menu__ set
> + to <tt>true</tt> then remember to use the <code>language||=xx</code>
> + form.
>
> __units__:
> You can specify the way the units are printed. The choice is between having both metric and
>
>
> ------------------------------------------------------------------------
>
>
|