SourceForge logo
SourceForge logo
Menu

phpwiki-checkins

Update of /cvsroot/phpwiki/phpwiki/lib
In directory usw-pr-cvs1:/tmp/cvs-serv11548/lib
Modified Files:
	config.php diff.php loadsave.php main.php pageinfo.php 
	stdlib.php 
Log Message:
Use strftime() for dates/times instead of date().
(Strftime() supports locales, date() does not.)
Also fixed a couple minor bugs having to do with the initial
creation of the RecentChanges page, and other miscellaneous
wiki setup.
Index: config.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/config.php,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -r1.38 -r1.39
*** config.php	2001年04月06日 18:21:37	1.38
--- config.php	2001年04月07日 00:34:30	1.39
***************
*** 27,33 ****
 // Set up localization
 //
! if (empty($LANG))
! $LANG = "C";
! 
 
 // Search PHP's include_path to find file or directory.
--- 27,31 ----
 // Set up localization
 //
! setlocale('LC_ALL', "");
 
 // Search PHP's include_path to find file or directory.
***************
*** 62,72 ****
 function FindLocalizedFile ($file, $missing_okay = false)
 {
! global $LANG;
 
 // FIXME: This wont work for DOS filenames.
 if (!ereg('^/', $file))
 {
! if ( ($path = FindFile("locale/$LANG/$file", 'missing_is_okay')) )
 	 return $path;
 }
 return FindFile($file, $missing_okay);
--- 60,88 ----
 function FindLocalizedFile ($file, $missing_okay = false)
 {
! $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);
***************
*** 91,99 ****
 else
 {
! putenv ("LANG=$LANG");
! bindtextdomain ("phpwiki", "./locale");
 textdomain ("phpwiki");
 }
 
 // To get the POSIX character classes in the PCRE's (e.g.
 // [[:upper:]]) to match extended characters (e.g. GrüßGott), we have
--- 107,116 ----
 else
 {
! bindtextdomain ("phpwiki", FindFile("locale"));
 textdomain ("phpwiki");
 }
 
+ 
+ 
 // To get the POSIX character classes in the PCRE's (e.g.
 // [[:upper:]]) to match extended characters (e.g. GrüßGott), we have
***************
*** 114,118 ****
 // FIXME: Not all environments may support en_US? We should probably
 // have a list of locales to try.
- 
 if (setlocale('LC_CTYPE', 0) == 'C')
 setlocale('LC_CTYPE', 'en_US.iso-8859-1');
--- 131,134 ----
Index: diff.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/diff.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** diff.php	2001年03月05日 23:38:16	1.10
--- diff.php	2001年04月07日 00:34:30	1.11
***************
*** 1038,1042 ****
 $cols .= QElement('td',
 			sprintf(gettext ("last modified on %s"),
! 				date($datetimeformat, $lastmodified)));
 $cols .= QElement('td',
 			sprintf(gettext ("by %s"), $author));
--- 1038,1042 ----
 $cols .= QElement('td',
 			sprintf(gettext ("last modified on %s"),
! 				strftime($datetimeformat, $lastmodified)));
 $cols .= QElement('td',
 			sprintf(gettext ("by %s"), $author));
Index: loadsave.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/loadsave.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** loadsave.php	2001年02月14日 22:02:05	1.4
--- loadsave.php	2001年04月07日 00:34:30	1.5
***************
*** 377,381 ****
 LoadAny($dbi, FindLocalizedFile(WIKI_PGSRC), false, $ignore);
 if ($LANG != "C")
! LoadAny($dbi, FindLocalizedFile(DEFAULT_WIKI_PGSRC), $GenericPages, $ignore);
 
 echo "</dl>\n";
--- 377,381 ----
 LoadAny($dbi, FindLocalizedFile(WIKI_PGSRC), false, $ignore);
 if ($LANG != "C")
! LoadAny($dbi, FindFile(DEFAULT_WIKI_PGSRC), $GenericPages, $ignore);
 
 echo "</dl>\n";
Index: main.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/main.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** main.php	2001年04月06日 18:21:37	1.11
--- main.php	2001年04月07日 00:34:30	1.12
***************
*** 38,42 ****
 if (isset($QUERY_STRING) && preg_match('/^[^&=]+$/', $QUERY_STRING))
 return urldecode(fix_magic_quotes_gpc($QUERY_STRING));
! 
 return gettext("HomePage");
 }
--- 38,42 ----
 if (isset($QUERY_STRING) && preg_match('/^[^&=]+$/', $QUERY_STRING))
 return urldecode(fix_magic_quotes_gpc($QUERY_STRING));
! 
 return gettext("HomePage");
 }
Index: pageinfo.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/pageinfo.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** pageinfo.php	2001年02月13日 05:54:38	1.8
--- pageinfo.php	2001年04月07日 00:34:30	1.9
***************
*** 31,35 ****
 elseif (($key == 'lastmodified') || ($key == 'created'))
 	 $cols .= QElement('td',
! 			 date($datetimeformat, $val));
 else
 	 $cols .= QElement('td', $val);
--- 31,35 ----
 elseif (($key == 'lastmodified') || ($key == 'created'))
 	 $cols .= QElement('td',
! 			 strftime($datetimeformat, $val));
 else
 	 $cols .= QElement('td', $val);
Index: stdlib.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/stdlib.php,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -r1.37 -r1.38
*** stdlib.php	2001年03月05日 23:37:32	1.37
--- stdlib.php	2001年04月07日 00:34:30	1.38
***************
*** 570,574 ****
 	 if (!empty($hash['lastmodified']))
 	 _dotoken('LASTMODIFIED',
! 		 date($datetimeformat, $hash['lastmodified']), $page);
 	 if (!empty($hash['author']))
 	 _dotoken('LASTAUTHOR', $hash['author'], $page);
--- 570,574 ----
 	 if (!empty($hash['lastmodified']))
 	 _dotoken('LASTMODIFIED',
! 		 strftime($datetimeformat, $hash['lastmodified']), $page);
 	 if (!empty($hash['author']))
 	 _dotoken('LASTAUTHOR', $hash['author'], $page);
***************
*** 598,607 ****
 // default pages if this is a new baby Wiki
 $now = time();
! $today = date($dateformat, $now);
 
! if (!is_array($recentchanges)) {
 $recentchanges = array('version' => 1,
 			 'created' => $now,
- 			 'lastmodified' => $now - 48 * 4600, // force $isNewDay
 			 'flags' => FLAG_PAGE_LOCKED,
 			 'author' => $GLOBALS['user']->id());
--- 598,609 ----
 // default pages if this is a new baby Wiki
 $now = time();
! $today = strftime($dateformat, $now);
 
! if (is_array($recentchanges)) {
! $isNewDay = strftime($dateformat, $recentchanges['lastmodified']) != $today;
! }
! else {
 $recentchanges = array('version' => 1,
 			 'created' => $now,
 			 'flags' => FLAG_PAGE_LOCKED,
 			 'author' => $GLOBALS['user']->id());
***************
*** 614,620 ****
 		 '[phpwiki:?action=search&searchterm=()]',
 		 '----');
 }
- 
- $isNewDay = date($dateformat, $recentchanges['lastmodified']) != $today;
 $recentchanges['lastmodified'] = $now;
 
--- 616,621 ----
 		 '[phpwiki:?action=search&searchterm=()]',
 		 '----');
+ $isNewDay = 0;
 }
 $recentchanges['lastmodified'] = $now;
 
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /