Changeset 809 for trunk/core/lib/Foswiki.pm
- Timestamp:
- 11/19/08 13:40:25 (4 years ago)
- File:
-
- 1 moved
-
trunk/core/lib/Foswiki.pm (moved) (moved from trunk/core/lib/TWiki.pm) (95 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/core/lib/Foswiki.pm
r792 r809 1 1 # See bottom of file for license and copyright information 2 package TWiki;2 package Foswiki; 3 3 4 4 =pod … … 16 16 17 17 ---++ Public Data members 18 * =request= Pointer to the TWiki::Request19 * =response= Pointer to the TWiki::Respose18 * =request= Pointer to the Foswiki::Request 19 * =response= Pointer to the Foswiki::Respose 20 20 * =context= Hash of context ids 21 * moved: =loginManager= TWiki::LoginManager singleton (moved to TWiki::Users)22 * =plugins= TWiki::Plugins singleton23 * =prefs= TWiki::Prefs singleton21 * moved: =loginManager= Foswiki::LoginManager singleton (moved to Foswiki::Users) 22 * =plugins= Foswiki::Plugins singleton 23 * =prefs= Foswiki::Prefs singleton 24 24 * =remoteUser= Login ID when using ApacheLogin. Maintained for 25 25 compatibility only, do not use. 26 26 * =requestedWebName= Name of web found in URL path or =web= URL parameter 27 * =sandbox= TWiki::Sandbox singleton27 * =sandbox= Foswiki::Sandbox singleton 28 28 * =scriptUrlPath= URL path to the current script. May be dynamically 29 29 extracted from the URL path if {GetScriptUrlFromCgi}. 30 30 Only required to support {GetScriptUrlFromCgi} and 31 31 not consistently used. Avoid. 32 * =security= TWiki::Access singleton32 * =security= Foswiki::Access singleton 33 33 * =SESSION_TAGS= Hash of TWiki variables whose value is specific to 34 34 the current request. 35 * =store= TWiki::Store singleton35 * =store= Foswiki::Store singleton 36 36 * =topicName= Name of topic found in URL path or =topic= URL 37 37 parameter … … 40 40 {DefaultUrlHost} 41 41 * =user= Unique user ID of logged-in user 42 * =users= TWiki::Users singleton42 * =users= Foswiki::Users singleton 43 43 * =webName= Name of web found in URL path, or =web= URL parameter, 44 44 or {UsersWebName} … … 50 50 use Error qw( :try ); 51 51 use CGI; # Always required to get html generation tags; 52 use TWiki::Response; 53 use TWiki::Request; 52 53 BEGIN { $Package::Alias::BRAVE = 1 } 54 use Package::Alias 55 'TWiki::Plugins' => 'Foswiki::Plugins', 56 'TWiki::Func' => 'Foswiki::Func'; 57 { package TWiki::Func; } 58 59 use Foswiki::Response; 60 use Foswiki::Request; 54 61 55 62 require 5.005; # For regex objects and internationalisation … … 60 67 # Uncomment this and the __END__ to enable AutoLoader 61 68 #use AutoLoader 'AUTOLOAD'; 62 # You then need to autosplit TWiki.pm:69 # You then need to autosplit Foswiki.pm: 63 70 # cd lib 64 # perl -e 'use AutoSplit; autosplit(" TWiki.pm", "auto")'71 # perl -e 'use AutoSplit; autosplit("Foswiki.pm", "auto")' 65 72 66 73 # Other computed constants … … 96 103 ---++ StaticMethod getTWikiLibDir() -> $path 97 104 98 Returns the full path of the directory containing TWiki.pm105 Returns the full path of the directory containing Foswiki.pm 99 106 100 107 =cut … … 105 112 } 106 113 107 # FIXME: Should just use $INC{" TWiki.pm"} to get path used to load this114 # FIXME: Should just use $INC{"Foswiki.pm"} to get path used to load this 108 115 # module. 109 116 my $dir = ''; 110 117 foreach $dir (@INC) { 111 if ( $dir && -e "$dir/ TWiki.pm" ) {118 if ( $dir && -e "$dir/Foswiki.pm" ) { 112 119 $twikiLibDir = $dir; 113 120 last; … … 156 163 BEGIN { 157 164 require Monitor; 158 require TWiki::Sandbox; # system command sandbox159 require TWiki::Configure::Load; # read configuration files165 require Foswiki::Sandbox; # system command sandbox 166 require Foswiki::Configure::Load; # read configuration files 160 167 161 168 $TRUE = 1; … … 256 263 $contextFreeSyntax{IF} = 1; 257 264 258 unless ( ( $ TWiki::cfg{DetailedOS} = $^O ) ) {265 unless ( ( $Foswiki::cfg{DetailedOS} = $^O ) ) { 259 266 require Config; 260 $ TWiki::cfg{DetailedOS} = $Config::Config{'osname'};261 } 262 $ TWiki::cfg{OS} = 'UNIX';263 if ( $ TWiki::cfg{DetailedOS} =~ /darwin/i ) { # MacOS X264 $ TWiki::cfg{OS} = 'UNIX';265 } 266 elsif ( $ TWiki::cfg{DetailedOS} =~ /Win/i ) {267 $ TWiki::cfg{OS} = 'WINDOWS';268 } 269 elsif ( $ TWiki::cfg{DetailedOS} =~ /vms/i ) {270 $ TWiki::cfg{OS} = 'VMS';271 } 272 elsif ( $ TWiki::cfg{DetailedOS} =~ /bsdos/i ) {273 $ TWiki::cfg{OS} = 'UNIX';274 } 275 elsif ( $ TWiki::cfg{DetailedOS} =~ /dos/i ) {276 $ TWiki::cfg{OS} = 'DOS';277 } 278 elsif ( $ TWiki::cfg{DetailedOS} =~ /^MacOS$/i ) { # MacOS 9 or earlier279 $ TWiki::cfg{OS} = 'MACINTOSH';280 } 281 elsif ( $ TWiki::cfg{DetailedOS} =~ /os2/i ) {282 $ TWiki::cfg{OS} = 'OS2';267 $Foswiki::cfg{DetailedOS} = $Config::Config{'osname'}; 268 } 269 $Foswiki::cfg{OS} = 'UNIX'; 270 if ( $Foswiki::cfg{DetailedOS} =~ /darwin/i ) { # MacOS X 271 $Foswiki::cfg{OS} = 'UNIX'; 272 } 273 elsif ( $Foswiki::cfg{DetailedOS} =~ /Win/i ) { 274 $Foswiki::cfg{OS} = 'WINDOWS'; 275 } 276 elsif ( $Foswiki::cfg{DetailedOS} =~ /vms/i ) { 277 $Foswiki::cfg{OS} = 'VMS'; 278 } 279 elsif ( $Foswiki::cfg{DetailedOS} =~ /bsdos/i ) { 280 $Foswiki::cfg{OS} = 'UNIX'; 281 } 282 elsif ( $Foswiki::cfg{DetailedOS} =~ /dos/i ) { 283 $Foswiki::cfg{OS} = 'DOS'; 284 } 285 elsif ( $Foswiki::cfg{DetailedOS} =~ /^MacOS$/i ) { # MacOS 9 or earlier 286 $Foswiki::cfg{OS} = 'MACINTOSH'; 287 } 288 elsif ( $Foswiki::cfg{DetailedOS} =~ /os2/i ) { 289 $Foswiki::cfg{OS} = 'OS2'; 283 290 } 284 291 … … 290 297 { 291 298 $ENV{SERVER_NAME} = 292 TWiki::Sandbox::untaintUnchecked( $ENV{SERVER_NAME} );293 } 294 295 # readConfig is defined in TWiki::Configure::Load to allow overriding it296 TWiki::Configure::Load::readConfig();297 298 if ( $ TWiki::cfg{WarningsAreErrors} ) {299 Foswiki::Sandbox::untaintUnchecked( $ENV{SERVER_NAME} ); 300 } 301 302 # readConfig is defined in Foswiki::Configure::Load to allow overriding it 303 Foswiki::Configure::Load::readConfig(); 304 305 if ( $Foswiki::cfg{WarningsAreErrors} ) { 299 306 300 307 # Note: Warnings are always errors if ASSERTs are enabled … … 302 309 } 303 310 304 if ( $ TWiki::cfg{UseLocale} ) {311 if ( $Foswiki::cfg{UseLocale} ) { 305 312 require locale; 306 313 import locale(); … … 309 316 # Constant tags dependent on the config 310 317 $functionTags{ALLOWLOGINNAME} = 311 sub { $ TWiki::cfg{Register}{AllowLoginName} || 0 };312 $functionTags{AUTHREALM} = sub { $ TWiki::cfg{AuthRealm} };313 $functionTags{DEFAULTURLHOST} = sub { $ TWiki::cfg{DefaultUrlHost} };314 $functionTags{HOMETOPIC} = sub { $ TWiki::cfg{HomeTopicName} };315 $functionTags{LOCALSITEPREFS} = sub { $ TWiki::cfg{LocalSitePreferences} };318 sub { $Foswiki::cfg{Register}{AllowLoginName} || 0 }; 319 $functionTags{AUTHREALM} = sub { $Foswiki::cfg{AuthRealm} }; 320 $functionTags{DEFAULTURLHOST} = sub { $Foswiki::cfg{DefaultUrlHost} }; 321 $functionTags{HOMETOPIC} = sub { $Foswiki::cfg{HomeTopicName} }; 322 $functionTags{LOCALSITEPREFS} = sub { $Foswiki::cfg{LocalSitePreferences} }; 316 323 $functionTags{NOFOLLOW} = 317 sub { $ TWiki::cfg{NoFollow} ? 'rel=' . $TWiki::cfg{NoFollow} : '' };318 $functionTags{NOTIFYTOPIC} = sub { $ TWiki::cfg{NotifyTopicName} };319 $functionTags{SCRIPTSUFFIX} = sub { $ TWiki::cfg{ScriptSuffix} };320 $functionTags{STATISTICSTOPIC} = sub { $ TWiki::cfg{Stats}{TopicName} };321 $functionTags{SYSTEMWEB} = sub { $ TWiki::cfg{SystemWebName} };322 $functionTags{TRASHWEB} = sub { $ TWiki::cfg{TrashWebName} };323 $functionTags{WIKIADMINLOGIN} = sub { $ TWiki::cfg{AdminUserLogin} };324 $functionTags{USERSWEB} = sub { $ TWiki::cfg{UsersWebName} };325 $functionTags{WEBPREFSTOPIC} = sub { $ TWiki::cfg{WebPrefsTopicName} };326 $functionTags{WIKIPREFSTOPIC} = sub { $ TWiki::cfg{SitePrefsTopicName} };327 $functionTags{WIKIUSERSTOPIC} = sub { $ TWiki::cfg{UsersTopicName} };328 $functionTags{WIKIWEBMASTER} = sub { $ TWiki::cfg{WebMasterEmail} };329 $functionTags{WIKIWEBMASTERNAME} = sub { $ TWiki::cfg{WebMasterName} };324 sub { $Foswiki::cfg{NoFollow} ? 'rel=' . $Foswiki::cfg{NoFollow} : '' }; 325 $functionTags{NOTIFYTOPIC} = sub { $Foswiki::cfg{NotifyTopicName} }; 326 $functionTags{SCRIPTSUFFIX} = sub { $Foswiki::cfg{ScriptSuffix} }; 327 $functionTags{STATISTICSTOPIC} = sub { $Foswiki::cfg{Stats}{TopicName} }; 328 $functionTags{SYSTEMWEB} = sub { $Foswiki::cfg{SystemWebName} }; 329 $functionTags{TRASHWEB} = sub { $Foswiki::cfg{TrashWebName} }; 330 $functionTags{WIKIADMINLOGIN} = sub { $Foswiki::cfg{AdminUserLogin} }; 331 $functionTags{USERSWEB} = sub { $Foswiki::cfg{UsersWebName} }; 332 $functionTags{WEBPREFSTOPIC} = sub { $Foswiki::cfg{WebPrefsTopicName} }; 333 $functionTags{WIKIPREFSTOPIC} = sub { $Foswiki::cfg{SitePrefsTopicName} }; 334 $functionTags{WIKIUSERSTOPIC} = sub { $Foswiki::cfg{UsersTopicName} }; 335 $functionTags{WIKIWEBMASTER} = sub { $Foswiki::cfg{WebMasterEmail} }; 336 $functionTags{WIKIWEBMASTERNAME} = sub { $Foswiki::cfg{WebMasterName} }; 330 337 331 338 # Compatibility synonyms, deprecated in 4.2 but still used throughout … … 341 348 # this in 'non-locale regexes' mode. 342 349 343 if ( $ TWiki::cfg{UseLocale} ) {350 if ( $Foswiki::cfg{UseLocale} ) { 344 351 345 352 # Set environment variables for grep 346 $ENV{LC_CTYPE} = $ TWiki::cfg{Site}{Locale};353 $ENV{LC_CTYPE} = $Foswiki::cfg{Site}{Locale}; 347 354 348 355 # Load POSIX for I18N support. … … 353 360 # won't this play with the Apache process's locale settings too? 354 361 # What effects would this have? 355 setlocale( &LC_CTYPE, $ TWiki::cfg{Site}{Locale} );356 setlocale( &LC_COLLATE, $ TWiki::cfg{Site}{Locale} );362 setlocale( &LC_CTYPE, $Foswiki::cfg{Site}{Locale} ); 363 setlocale( &LC_COLLATE, $Foswiki::cfg{Site}{Locale} ); 357 364 } 358 365 359 366 $functionTags{CHARSET} = sub { 360 $ TWiki::cfg{Site}{CharSet}367 $Foswiki::cfg{Site}{CharSet} 361 368 || 'iso-8859-1'; 362 369 }; 363 370 364 371 $functionTags{LANG} = sub { 365 $ TWiki::cfg{Site}{Locale} =~ m/^([a-z]+_[a-z]+)/i ? $1 : 'en_US';372 $Foswiki::cfg{Site}{Locale} =~ m/^([a-z]+_[a-z]+)/i ? $1 : 'en_US'; 366 373 }; 367 374 … … 376 383 # Depends on locale mode and Perl version, and finally on 377 384 # whether locale-based regexes are turned off. 378 if ( not $ TWiki::cfg{UseLocale}385 if ( not $Foswiki::cfg{UseLocale} 379 386 or $] < 5.006 380 or not $ TWiki::cfg{Site}{LocaleRegexes} )387 or not $Foswiki::cfg{Site}{LocaleRegexes} ) 381 388 { 382 389 383 390 # No locales needed/working, or Perl 5.005, so just use 384 391 # any additional national characters defined in TWiki.cfg 385 $regex{upperAlpha} = 'A-Z' . $ TWiki::cfg{UpperNational};386 $regex{lowerAlpha} = 'a-z' . $ TWiki::cfg{LowerNational};392 $regex{upperAlpha} = 'A-Z' . $Foswiki::cfg{UpperNational}; 393 $regex{lowerAlpha} = 'a-z' . $Foswiki::cfg{LowerNational}; 387 394 $regex{numeric} = '\d'; 388 395 $regex{mixedAlpha} = $regex{upperAlpha} . $regex{lowerAlpha}; … … 404 411 # book at http://regex.info/. 405 412 406 $regex{linkProtocolPattern} = $ TWiki::cfg{LinkProtocolPattern};413 $regex{linkProtocolPattern} = $Foswiki::cfg{LinkProtocolPattern}; 407 414 408 415 # Header patterns based on '+++'. The '###' are reserved for numbered … … 422 429 $regex{webNameBaseRegex} = 423 430 qr/[$regex{upperAlpha}]+[$regex{mixedAlphaNum}_]*/o; 424 if ( $ TWiki::cfg{EnableHierarchicalWebs} ) {431 if ( $Foswiki::cfg{EnableHierarchicalWebs} ) { 425 432 $regex{webNameRegex} = 426 433 qr/$regex{webNameBaseRegex}(?:(?:[\.\/]$regex{webNameBaseRegex})+)*/o; … … 501 508 # Check for unsafe search regex mode (affects filtering in) - default 502 509 # to safe mode 503 $ TWiki::cfg{ForceUnsafeRegexes} = 0504 unless defined $ TWiki::cfg{ForceUnsafeRegexes};510 $Foswiki::cfg{ForceUnsafeRegexes} = 0 511 unless defined $Foswiki::cfg{ForceUnsafeRegexes}; 505 512 506 513 # initialize lib directory early because of later 'cd's … … 508 515 509 516 # initialize the runtime engine 510 if ( !defined $ TWiki::cfg{Engine} ) {517 if ( !defined $Foswiki::cfg{Engine} ) { 511 518 512 519 # Caller did not define an engine; try and work it out (mainly for 513 520 # the benefit of pre-5.0 CGI scripts) 514 521 if ( defined $ENV{GATEWAY_INTERFACE} ) { 515 $ TWiki::cfg{Engine} = 'TWiki::Engine::CGI';522 $Foswiki::cfg{Engine} = 'Foswiki::Engine::CGI'; 516 523 use CGI::Carp qw(fatalsToBrowser); 517 524 $SIG{__DIE__} = \&CGI::Carp::confess; 518 525 } 519 526 else { 520 $ TWiki::cfg{Engine} = 'TWiki::Engine::CLI';527 $Foswiki::cfg{Engine} = 'Foswiki::Engine::CLI'; 521 528 require Carp; 522 529 $SIG{__DIE__} = \&Carp::confess; 523 530 } 524 531 } 525 $engine = eval qq(use $ TWiki::cfg{Engine}; $TWiki::cfg{Engine}->new);532 $engine = eval qq(use $Foswiki::cfg{Engine}; $Foswiki::cfg{Engine}->new); 526 533 die $@ if $@; 527 534 … … 541 548 my ( $this, $text ) = @_; 542 549 543 return $text unless ( defined $ TWiki::cfg{Site}{CharSet} );550 return $text unless ( defined $Foswiki::cfg{Site}{CharSet} ); 544 551 545 552 # Detect character encoding of the full topic name from URL … … 550 557 551 558 # If site charset is already UTF-8, there is no need to convert anything: 552 if ( $ TWiki::cfg{Site}{CharSet} =~ /^utf-?8$/i ) {559 if ( $Foswiki::cfg{Site}{CharSet} =~ /^utf-?8$/i ) { 553 560 554 561 # warn if using Perl older than 5.8 … … 567 574 # Convert into ISO-8859-1 if it is the site charset. This conversion 568 575 # is *not valid for ISO-8859-15*. 569 if ( $ TWiki::cfg{Site}{CharSet} =~ /^iso-?8859-?1$/i ) {576 if ( $Foswiki::cfg{Site}{CharSet} =~ /^iso-?8859-?1$/i ) { 570 577 571 578 # ISO-8859-1 maps onto first 256 codepoints of Unicode … … 582 589 import Encode qw(:fallbacks); 583 590 584 # Map $ TWiki::cfg{Site}{CharSet} into real encoding name591 # Map $Foswiki::cfg{Site}{CharSet} into real encoding name 585 592 my $charEncoding = 586 Encode::resolve_alias( $ TWiki::cfg{Site}{CharSet} );593 Encode::resolve_alias( $Foswiki::cfg{Site}{CharSet} ); 587 594 if ( not $charEncoding ) { 588 595 $this->writeWarning( 'Conversion to "' 589 . $ TWiki::cfg{Site}{CharSet}596 . $Foswiki::cfg{Site}{CharSet} 590 597 . '" not supported, or name not recognised - check ' 591 598 . '"perldoc Encode::Supported"' ); … … 605 612 else { 606 613 require Unicode::MapUTF8; # Pre-5.8 Perl versions 607 my $charEncoding = $ TWiki::cfg{Site}{CharSet};614 my $charEncoding = $Foswiki::cfg{Site}{CharSet}; 608 615 if ( not Unicode::MapUTF8::utf8_supported_charset($charEncoding) ) { 609 616 $this->writeWarning( 'Conversion to "' 610 . $ TWiki::cfg{Site}{CharSet}617 . $Foswiki::cfg{Site}{CharSet} 611 618 . '" not supported, or name not recognised - check ' 612 619 . '"perldoc Unicode::MapUTF8"' ); … … 710 717 711 718 # Get time now in HTTP header format 712 require TWiki::Time;719 require Foswiki::Time; 713 720 my $lastModifiedString = 714 TWiki::Time::formatTime( time, '$http', 'gmtime' );721 Foswiki::Time::formatTime( time, '$http', 'gmtime' ); 715 722 716 723 # Expiry time is set high to avoid any data loss. Each instance of … … 743 750 744 751 $contentType = 'text/html' unless $contentType; 745 if ( defined( $ TWiki::cfg{Site}{CharSet} ) ) {746 $contentType .= '; charset=' . $ TWiki::cfg{Site}{CharSet};752 if ( defined( $Foswiki::cfg{Site}{CharSet} ) ) { 753 $contentType .= '; charset=' . $Foswiki::cfg{Site}{CharSet}; 747 754 } 748 755 … … 772 779 773 780 #TODO: this should really use URI 774 if ( ( !$ TWiki::cfg{AllowRedirectUrl} )781 if ( ( !$Foswiki::cfg{AllowRedirectUrl} ) 775 782 && ( $redirect =~ m!^([^:]*://[^/]*)/*(.*)?$! ) ) 776 783 { … … 778 785 779 786 #remove trailing /'s to match 780 $ TWiki::cfg{DefaultUrlHost} =~ m!^([^:]*://[^/]*)/*(.*)?$!;787 $Foswiki::cfg{DefaultUrlHost} =~ m!^([^:]*://[^/]*)/*(.*)?$!; 781 788 my $expected = $1; 782 789 783 if ( defined( $ TWiki::cfg{PermittedRedirectHostUrls} )784 && $ TWiki::cfg{PermittedRedirectHostUrls} ne '' )790 if ( defined( $Foswiki::cfg{PermittedRedirectHostUrls} ) 791 && $Foswiki::cfg{PermittedRedirectHostUrls} ne '' ) 785 792 { 786 793 my @permitted = 787 794 map { s!^([^:]*://[^/]*)/*(.*)?$!$1!; $1 } 788 split( /,\s*/, $ TWiki::cfg{PermittedRedirectHostUrls} );795 split( /,\s*/, $Foswiki::cfg{PermittedRedirectHostUrls} ); 789 796 return 1 if ( grep ( { uc($host) eq uc($_) } @permitted ) ); 790 797 } … … 913 920 $url = $this->getScriptUrl( 914 921 1, 'oops', 915 $this->{web} || $ TWiki::cfg{UsersWebName},916 $this->{topic} || $ TWiki::cfg{HomeTopicName},922 $this->{web} || $Foswiki::cfg{UsersWebName}, 923 $this->{topic} || $Foswiki::cfg{HomeTopicName}, 917 924 template => 'oopsaccessdenied', 918 925 def => 'topic_access', … … 921 928 . $url 922 929 . ': host does not match {DefaultUrlHost} , and is not in {PermittedRedirectHostUrls}"' 923 . $ TWiki::cfg{DefaultUrlHost} . '"'930 . $Foswiki::cfg{DefaultUrlHost} . '"' 924 931 ); 925 932 } … … 961 968 $md5->add( $$, time(), rand(time) ); 962 969 my $uid = $md5->hexdigest(); 963 my $passthruFilename = "$ TWiki::cfg{WorkingDir}/tmp/passthru_$uid";970 my $passthruFilename = "$Foswiki::cfg{WorkingDir}/tmp/passthru_$uid"; 964 971 965 972 use Fcntl; … … 968 975 sysopen( F, "$passthruFilename", O_RDWR | O_EXCL | O_CREAT, 0600 ) 969 976 || die 970 "Unable to open $ TWiki::cfg{WorkingDir}/tmp for write; check the setting of {WorkingDir} in configure, and check file permissions: $!";977 "Unable to open $Foswiki::cfg{WorkingDir}/tmp for write; check the setting of {WorkingDir} in configure, and check file permissions: $!"; 971 978 $query->save( \*F ); 972 979 close(F); … … 1022 1029 otherwise only user web names are valid 1023 1030 1024 If $ TWiki::cfg{EnableHierarchicalWebs} is off, it will also return false1031 If $Foswiki::cfg{EnableHierarchicalWebs} is off, it will also return false 1025 1032 when a nested web name is passed to it. 1026 1033 … … 1049 1056 1050 1057 my @mirrorInfo = ( '', '', '', '' ); 1051 if ( $ TWiki::cfg{SiteWebTopicName} ) {1058 if ( $Foswiki::cfg{SiteWebTopicName} ) { 1052 1059 my $mirrorSiteName = 1053 1060 $this->{prefs}->getWebPreferencesValue( 'MIRRORSITENAME', $theWeb ); 1054 1061 if ( $mirrorSiteName 1055 && $mirrorSiteName ne $ TWiki::cfg{SiteWebTopicName} )1062 && $mirrorSiteName ne $Foswiki::cfg{SiteWebTopicName} ) 1056 1063 { 1057 1064 my $mirrorViewURL = … … 1067 1074 $mirrorNote = 1068 1075 $this->renderer->getRenderedVersion( $mirrorNote, $theWeb, 1069 $ TWiki::cfg{HomeTopic} );1076 $Foswiki::cfg{HomeTopic} ); 1070 1077 $mirrorNote =~ s/\s*$//g; 1071 1078 @mirrorInfo = … … 1141 1148 1142 1149 my $url; 1143 if ( defined $ TWiki::cfg{ScriptUrlPaths} && $script ) {1144 $url = $ TWiki::cfg{ScriptUrlPaths}{$script};1150 if ( defined $Foswiki::cfg{ScriptUrlPaths} && $script ) { 1151 $url = $Foswiki::cfg{ScriptUrlPaths}{$script}; 1145 1152 } 1146 1153 unless ( defined($url) ) { 1147 $url = $ TWiki::cfg{ScriptUrlPath};1154 $url = $Foswiki::cfg{ScriptUrlPath}; 1148 1155 if ($script) { 1149 1156 $url .= '/' unless $url =~ /\/$/; 1150 1157 $url .= $script; 1151 1158 if ( 1152 rindex( $url, $ TWiki::cfg{ScriptSuffix} ) !=1153 ( length($url) - length( $ TWiki::cfg{ScriptSuffix} ) ) )1159 rindex( $url, $Foswiki::cfg{ScriptSuffix} ) != 1160 ( length($url) - length( $Foswiki::cfg{ScriptSuffix} ) ) ) 1154 1161 { 1155 $url .= $ TWiki::cfg{ScriptSuffix} if $script;1162 $url .= $Foswiki::cfg{ScriptSuffix} if $script; 1156 1163 } 1157 1164 } … … 1221 1228 1222 1229 my $url = ''; 1223 $url .= $ TWiki::cfg{PubUrlPath};1230 $url .= $Foswiki::cfg{PubUrlPath}; 1224 1231 if ( $absolute && $url !~ /^[a-z]+:/ ) { 1225 1232 … … 1319 1326 1320 1327 *WARNING* if there is no web specification (in the web or topic parameters) 1321 the web defaults to $ TWiki::cfg{UsersWebName}. If there is no topic1328 the web defaults to $Foswiki::cfg{UsersWebName}. If there is no topic 1322 1329 specification, or the topic is '0', the topic defaults to the web home topic 1323 1330 name. … … 1354 1361 want to be logged-in if none is available from a session or browser. 1355 1362 Used mainly for side scripts and debugging. 1356 * =$query= the TWiki::Request query (may be undef, in which case an empty query1363 * =$query= the Foswiki::Request query (may be undef, in which case an empty query 1357 1364 is used) 1358 1365 * =\%initialContext= - reference to a hash containing context … … 1363 1370 sub new { 1364 1371 my ( $class, $login, $query, $initialContext ) = @_; 1365 ASSERT( !$query || UNIVERSAL::isa( $query, ' TWiki::Request' ) );1372 ASSERT( !$query || UNIVERSAL::isa( $query, 'Foswiki::Request' ) ); 1366 1373 Monitor::MARK("Static compilation complete"); 1367 1374 1368 1375 # Compatibility; not used except maybe in plugins 1369 $ TWiki::cfg{TempfileDir} = "$TWiki::cfg{WorkingDir}/tmp"1370 unless defined( $ TWiki::cfg{TempfileDir} );1376 $Foswiki::cfg{TempfileDir} = "$Foswiki::cfg{WorkingDir}/tmp" 1377 unless defined( $Foswiki::cfg{TempfileDir} ); 1371 1378 1372 1379 # Set command_line context if there is no query 1373 1380 $initialContext ||= defined($query) ? {} : { command_line => 1 }; 1374 1381 1375 $query ||= new TWiki::Request();1382 $query ||= new Foswiki::Request(); 1376 1383 my $this = bless( {}, $class ); 1377 1384 $this->{request} = $query; 1378 $this->{response} = new TWiki::Response();1379 1380 # Tell TWiki::Response which charset we are using if not default1381 if ( defined $ TWiki::cfg{Site}{CharSet}1382 && $ TWiki::cfg{Site}{CharSet} !~ /^iso-?8859-?1$/io )1385 $this->{response} = new Foswiki::Response(); 1386 1387 # Tell Foswiki::Response which charset we are using if not default 1388 if ( defined $Foswiki::cfg{Site}{CharSet} 1389 && $Foswiki::cfg{Site}{CharSet} !~ /^iso-?8859-?1$/io ) 1383 1390 { 1384 $this->{response}->charset( $ TWiki::cfg{Site}{CharSet} );1391 $this->{response}->charset( $Foswiki::cfg{Site}{CharSet} ); 1385 1392 } 1386 1393 … … 1393 1400 # "shared" between mod_perl instances 1394 1401 $sandbox = 1395 new TWiki::Sandbox( $TWiki::cfg{OS}, $TWiki::cfg{DetailedOS} );1396 } 1397 require TWiki::Plugins;1398 $this->{plugins} = new TWiki::Plugins($this);1399 require TWiki::Store;1400 $this->{store} = new TWiki::Store($this);1402 new Foswiki::Sandbox( $Foswiki::cfg{OS}, $Foswiki::cfg{DetailedOS} ); 1403 } 1404 require Foswiki::Plugins; 1405 $this->{plugins} = new Foswiki::Plugins($this); 1406 require Foswiki::Store; 1407 $this->{store} = new Foswiki::Store($this); 1401 1408 1402 1409 $this->{remoteUser} = 1403 1410 $login; #use login as a default (set when running from cmd line) 1404 require TWiki::Users;1405 $this->{users} = new TWiki::Users($this);1411 require Foswiki::Users; 1412 $this->{users} = new Foswiki::Users($this); 1406 1413 $this->{remoteUser} = $this->{users}->{remoteUser}; 1407 1414 … … 1412 1419 # with use strict and calling external programs that writes on the disk 1413 1420 # will fail unless Perl seens it as set to safe value. 1414 if ( $ TWiki::cfg{SafeEnvPath} ) {1415 $ENV{PATH} = $ TWiki::cfg{SafeEnvPath};1421 if ( $Foswiki::cfg{SafeEnvPath} ) { 1422 $ENV{PATH} = $Foswiki::cfg{SafeEnvPath}; 1416 1423 } 1417 1424 else { 1418 $ENV{PATH} = TWiki::Sandbox::untaintUnchecked( $ENV{PATH} );1425 $ENV{PATH} = Foswiki::Sandbox::untaintUnchecked( $ENV{PATH} ); 1419 1426 } 1420 1427 delete @ENV{qw( IFS CDPATH ENV BASH_ENV )}; … … 1429 1436 # when there is nothing better available. 1430 1437 if ( $this->{urlHost} eq 'http://localhost' ) { 1431 $this->{urlHost} = $ TWiki::cfg{DefaultUrlHost};1432 } 1433 elsif ( $ TWiki::cfg{RemovePortNumber} ) {1438 $this->{urlHost} = $Foswiki::cfg{DefaultUrlHost}; 1439 } 1440 elsif ( $Foswiki::cfg{RemovePortNumber} ) { 1434 1441 $this->{urlHost} =~ s/\:[0-9]+$//; 1435 1442 } 1436 1443 } 1437 1444 else { 1438 $this->{urlHost} = $ TWiki::cfg{DefaultUrlHost};1439 } 1440 if ( $ TWiki::cfg{GetScriptUrlFromCgi}1445 $this->{urlHost} = $Foswiki::cfg{DefaultUrlHost}; 1446 } 1447 if ( $Foswiki::cfg{GetScriptUrlFromCgi} 1441 1448 && $url 1442 1449 && $url =~ m{^[^:]*://[^/]*(.*)/.*$} … … 1471 1478 1472 1479 # jump to WebHome if 'bin/script?topic=Webname.' 1473 $topic = $ TWiki::cfg{HomeTopicName} if ( $web && !$topic );1480 $topic = $Foswiki::cfg{HomeTopicName} if ( $web && !$topic ); 1474 1481 } 1475 1482 … … 1496 1503 my $topictmp = $2; 1497 1504 my $filetmp = $3; 1498 if (-f $ TWiki::cfg{PubDir}."/$webtmp$topictmp/$filetmp") {1505 if (-f $Foswiki::cfg{PubDir}."/$webtmp$topictmp/$filetmp") { 1499 1506 $web = $webtmp; 1500 1507 $topic = $topictmp; … … 1510 1517 1511 1518 # All roads lead to WebHome 1512 $topic = $ TWiki::cfg{HomeTopicName} if ( $topic =~ /\.\./ );1513 $topic =~ s/$ TWiki::cfg{NameFilter}//go;1514 $topic = $ TWiki::cfg{HomeTopicName} unless $topic;1515 $this->{topicName} = TWiki::Sandbox::untaintUnchecked($topic);1516 1517 $web =~ s/$ TWiki::cfg{NameFilter}//go;1519 $topic = $Foswiki::cfg{HomeTopicName} if ( $topic =~ /\.\./ ); 1520 $topic =~ s/$Foswiki::cfg{NameFilter}//go; 1521 $topic = $Foswiki::cfg{HomeTopicName} unless $topic; 1522 $this->{topicName} = Foswiki::Sandbox::untaintUnchecked($topic); 1523 1524 $web =~ s/$Foswiki::cfg{NameFilter}//go; 1518 1525 $this->{requestedWebName} = 1519 TWiki::Sandbox::untaintUnchecked($web); #can be an empty string1520 $web = $ TWiki::cfg{UsersWebName} unless $web;1521 $this->{webName} = TWiki::Sandbox::untaintUnchecked($web);1526 Foswiki::Sandbox::untaintUnchecked($web); #can be an empty string 1527 $web = $Foswiki::cfg{UsersWebName} unless $web; 1528 $this->{webName} = Foswiki::Sandbox::untaintUnchecked($web); 1522 1529 1523 1530 # Convert UTF-8 web and topic name from URL into site charset if necessary … … 1538 1545 # SMELL: This untaint unchecked is duplicate of one just above 1539 1546 $this->{topicName} = 1540 TWiki::Sandbox::untaintUnchecked( ucfirst $this->{topicName} );1541 1542 $this->{scriptUrlPath} = $ TWiki::cfg{ScriptUrlPath};1543 1544 require TWiki::Prefs;1545 my $prefs = new TWiki::Prefs($this);1547 Foswiki::Sandbox::untaintUnchecked( ucfirst $this->{topicName} ); 1548 1549 $this->{scriptUrlPath} = $Foswiki::cfg{ScriptUrlPath}; 1550 1551 require Foswiki::Prefs; 1552 my $prefs = new Foswiki::Prefs($this); 1546 1553 $this->{prefs} = $prefs; 1547 1554 … … 1552 1559 $prefs->pushGlobalPreferences(); 1553 1560 1554 # SMELL: what happens if we move this into the TWiki::User::new?1561 # SMELL: what happens if we move this into the Foswiki::User::new? 1555 1562 $this->{user} = $this->{users}->initialiseUser( $this->{remoteUser} ); 1556 1563 … … 1576 1583 my $wn = $this->{users}->getWikiName( $this->{user} ); 1577 1584 if ($wn) { 1578 $prefs->pushPreferences( $ TWiki::cfg{UsersWebName}, $wn,1585 $prefs->pushPreferences( $Foswiki::cfg{UsersWebName}, $wn, 1579 1586 'USER ' . $wn ); 1580 1587 } … … 1591 1598 1592 1599 # SMELL: Every place should localize it before use, so it's not necessary here. 1593 $ TWiki::Plugins::SESSION = $this;1600 $Foswiki::Plugins::SESSION = $this; 1594 1601 1595 1602 Monitor::MARK("TWiki session created"); … … 1610 1617 1611 1618 unless ( $this->{renderer} ) { 1612 require TWiki::Render;1619 require Foswiki::Render; 1613 1620 1614 1621 # requires preferences (such as LINKTOOLTIPINFO) 1615 $this->{renderer} = new TWiki::Render($this);1622 $this->{renderer} = new Foswiki::Render($this); 1616 1623 } 1617 1624 return $this->{renderer}; … … 1630 1637 1631 1638 unless ( $this->{attach} ) { 1632 require TWiki::Attach;1633 $this->{attach} = new TWiki::Attach($this);1639 require Foswiki::Attach; 1640 $this->{attach} = new Foswiki::Attach($this); 1634 1641 } 1635 1642 return $this->{attach}; … … 1648 1655 1649 1656 unless ( $this->{templates} ) { 1650 require TWiki::Templates;1651 $this->{templates} = new TWiki::Templates($this);1657 require Foswiki::Templates; 1658 $this->{templates} = new Foswiki::Templates($this); 1652 1659 } 1653 1660 return $this->{templates}; … … 1666 1673 1667 1674 unless ( $this->{i18n} ) { 1668 require TWiki::I18N;1675 require Foswiki::I18N; 1669 1676 1670 1677 # language information; must be loaded after 1671 1678 # *all possible preferences sources* are available 1672 $this->{i18n} = new TWiki::I18N($this);1679 $this->{i18n} = new Foswiki::I18N($this); 1673 1680 } 1674 1681 return $this->{i18n}; … … 1687 1694 1688 1695 unless ( $this->{search} ) { 1689 require TWiki::Search;1690 $this->{search} = new TWiki::Search($this);1696 require Foswiki::Search; 1697 $this->{search} = new Foswiki::Search($this); 1691 1698 } 1692 1699 return $this->{search}; … … 1705 1712 1706 1713 unless ( $this->{security} ) { 1707 require TWiki::Access;1708 $this->{security} = new TWiki::Access($this);1714 require Foswiki::Access; 1715 $this->{security} = new Foswiki::Access($this); 1709 1716 } 1710 1717 return $this->{security}; … … 1723 1730 1724 1731 unless ( $this->{net} ) { 1725 require TWiki::Net;1726 $this->{net} = new TWiki::Net($this);1732 require Foswiki::Net; 1733 $this->{net} = new Foswiki::Net($this); 1727 1734 } 1728 1735 return $this->{net}; … … 1812 1819 my $text = "$user | $action | $webTopic | $extra | $remoteAddr |"; 1813 1820 1814 _writeReport( $this, $ TWiki::cfg{LogFileName}, $text );1821 _writeReport( $this, $Foswiki::cfg{LogFileName}, $text ); 1815 1822 } 1816 1823 … … 1819 1826 ---++ ObjectMethod writeWarning( $text ) 1820 1827 1821 Prints date, time, and contents $text to $ TWiki::cfg{WarningFileName}, typically1828 Prints date, time, and contents $text to $Foswiki::cfg{WarningFileName}, typically 1822 1829 'warnings.txt'. Use for warnings and errors that may require admin 1823 1830 intervention. Use this for defensive programming warnings (e.g. assertions). … … 1827 1834 sub writeWarning { 1828 1835 my $this = shift; 1829 _writeReport( $this, $ TWiki::cfg{WarningFileName}, @_ );1836 _writeReport( $this, $Foswiki::cfg{WarningFileName}, @_ ); 1830 1837 } 1831 1838 … … 1834 1841 ---++ ObjectMethod writeDebug( $text ) 1835 1842 1836 Prints date, time, and contents of $text to $ TWiki::cfg{DebugFileName}, typically1843 Prints date, time, and contents of $text to $Foswiki::cfg{DebugFileName}, typically 1837 1844 'debug.txt'. Use for debugging messages. 1838 1845 … … 1841 1848 sub writeDebug { 1842 1849 my $this = shift; 1843 _writeReport( $this, $ TWiki::cfg{DebugFileName}, @_ );1850 _writeReport( $this, $Foswiki::cfg{DebugFileName}, @_ ); 1844 1851 } 1845 1852 … … 1853 1860 1854 1861 if ($log) { 1855 require TWiki::Time;1856 my $time = TWiki::Time::formatTime( time(), '$year$mo', 'servertime' );1862 require Foswiki::Time; 1863 my $time = Foswiki::Time::formatTime( time(), '$year$mo', 'servertime' ); 1857 1864 $log =~ s/%DATE%/$time/go; 1858 $time = TWiki::Time::formatTime( time(), undef, 'servertime' );1865 $time = Foswiki::Time::formatTime( time(), undef, 'servertime' ); 1859 1866 1860 1867 if ( open( FILE, ">>$log" ) ) { … … 1994 2001 $thePattern =~ 1995 2002 s/([^\\])([\$\@\%\&\#\'\`\/])/$1\\$2/g; # escape some special chars 1996 $thePattern = TWiki::Sandbox::untaintUnchecked($thePattern);2003 $thePattern = Foswiki::Sandbox::untaintUnchecked($thePattern); 1997 2004 $theText = '' unless ( $theText =~ s/$thePattern/$1/is ); 1998 2005 return $theText; … … 2006 2013 # For speed, read file directly if URL matches an attachment directory 2007 2014 if ( $url =~ 2008 /^$this->{urlHost}$ TWiki::cfg{PubUrlPath}\/($regex{webNameRegex})\/([^\/\.]+)\/([^\/]+)$/2015 /^$this->{urlHost}$Foswiki::cfg{PubUrlPath}\/($regex{webNameRegex})\/([^\/\.]+)\/([^\/]+)$/ 2009 2016 ) 2010 2017 { … … 2040 2047 $text = 2041 2048 _cleanupIncludedHTML( $text, $this->{urlHost}, 2042 $ TWiki::cfg{PubUrlPath}, $options )2049 $Foswiki::cfg{PubUrlPath}, $options ) 2043 2050 unless $raw; 2044 2051 $text = applyPatternToIncludedText( $text, $pattern ) … … 2053 2060 2054 2061 return _includeWarning( $this, $warn, 'urls_not_allowed' ) 2055 unless $ TWiki::cfg{INCLUDE}{AllowURLs};2062 unless $Foswiki::cfg{INCLUDE}{AllowURLs}; 2056 2063 2057 2064 # SMELL: should use the URI module from CPAN to parse the URL … … 2116 2123 my ( $this, $text, $defaultTopic, $defaultWeb, $args ) = @_; 2117 2124 2118 require TWiki::Attrs;2119 2120 my $params = new TWiki::Attrs($args);2125 require Foswiki::Attrs; 2126 2127 my $params = new Foswiki::Attrs($args); 2121 2128 2122 2129 # get the topic name attribute … … 2345 2352 and the array of sections. 2346 2353 2347 Each section is a = TWiki::Attrs= object, which contains the attributes2354 Each section is a =Foswiki::Attrs= object, which contains the attributes 2348 2355 {type, name, start, end} 2349 2356 where start and end are character offsets in the … … 2368 2375 foreach my $bit ( split( /(%(?:START|END)SECTION(?:{.*?})?%)/, $_[0] ) ) { 2369 2376 if ( $bit =~ /^%STARTSECTION(?:{(.*)})?%$/ ) { 2370 require TWiki::Attrs;2371 my $attrs = new TWiki::Attrs($1);2377 require Foswiki::Attrs; 2378 my $attrs = new Foswiki::Attrs($1); 2372 2379 $attrs->{type} ||= 'section'; 2373 2380 $attrs->{name} = … … 2398 2405 } 2399 2406 elsif ( $bit =~ /^%ENDSECTION(?:{(.*)})?%$/ ) { 2400 require TWiki::Attrs;2401 my $attrs = new TWiki::Attrs($1);2407 require Foswiki::Attrs; 2408 my $attrs = new Foswiki::Attrs($1); 2402 2409 $attrs->{type} ||= 'section'; 2403 2410 $attrs->{name} = $attrs->{_DEFAULT} || $attrs->{name} || ''; … … 2491 2498 2492 2499 # Make sure func works, for registered tag handlers 2493 $ TWiki::Plugins::SESSION = $this;2500 $Foswiki::Plugins::SESSION = $this; 2494 2501 2495 2502 # Note: it may look dangerous to override the user this way, but … … 2634 2641 if ( 2635 2642 ( 2636 defined( $ TWiki::cfg{Site}{CharSet} )2637 and $ TWiki::cfg{Site}{CharSet} =~ /^utf-?8$/i2643 defined( $Foswiki::cfg{Site}{CharSet} ) 2644 and $Foswiki::cfg{Site}{CharSet} =~ /^utf-?8$/i 2638 2645 ) 2639 2646 or $usingEBCDIC … … 2784 2791 2785 2792 # Make sure func works, for registered tag handlers 2786 $ TWiki::Plugins::SESSION = $this;2793 $Foswiki::Plugins::SESSION = $this; 2787 2794 2788 2795 # NOTE TO DEBUGGERS … … 2965 2972 2966 2973 # my( $topic, $web, $meta ) = @_; 2967 require TWiki::Attrs;2974 require Foswiki::Attrs; 2968 2975 2969 2976 my $e = $this->{prefs}->getPreferencesValue($tag); … … 2972 2979 if ( !defined($e) && defined( $functionTags{$tag} ) ) { 2973 2980 $e = &{ $functionTags{$tag} }( 2974 $this, new TWiki::Attrs( $args, $contextFreeSyntax{$tag} ), @_2981 $this, new Foswiki::Attrs( $args, $contextFreeSyntax{$tag} ), @_ 2975 2982 ); 2976 2983 } … … 3104 3111 * =$verb= - The invoked verb (may be ignored) 3105 3112 3106 *Since:* TWiki::Plugins::VERSION 1.13113 *Since:* Foswiki::Plugins::VERSION 1.1 3107 3114 3108 3115 =cut= … … 3323 3330 ---++ StaticMethod initialize( $pathInfo, $remoteUser, $topic, $url, $query ) -> ($topicName, $webName, $scriptUrlPath, $userName, $dataDir) 3324 3331 3325 Return value: ( $topicName, $webName, $ TWiki::cfg{ScriptUrlPath}, $userName, $TWiki::cfg{DataDir} )3332 Return value: ( $topicName, $webName, $Foswiki::cfg{ScriptUrlPath}, $userName, $Foswiki::cfg{DataDir} ) 3326 3333 3327 3334 Static method to construct a new singleton session instance. 3328 3335 It creates a new TWiki and sets the Plugins $SESSION variable to 3329 point to it, so that TWiki::Func methods will work.3336 point to it, so that Foswiki::Func methods will work. 3330 3337 3331 3338 This method is *DEPRECATED* but is maintained for script compatibility. … … 3339 3346 3340 3347 if ( !$query ) { 3341 $query = new TWiki::Request( {} );3348 $query = new Foswiki::Request( {} ); 3342 3349 } 3343 3350 if ( $query->path_info() ne $pathInfo ) { … … 3353 3360 if ( $theUrl && $theUrl ne $query->url() ) { 3354 3361 die 3355 'Sorry, this version of TWiki does not support the url parameter to TWiki::initialize being different to the url in the query';3356 } 3357 my $twiki = new TWiki( $theRemoteUser, $query );3362 'Sorry, this version of TWiki does not support the url parameter to Foswiki::initialize being different to the url in the query'; 3363 } 3364 my $twiki = new Foswiki( $theRemoteUser, $query ); 3358 3365 3359 3366 # Force the new session into the plugins context. 3360 $ TWiki::Plugins::SESSION = $twiki;3367 $Foswiki::Plugins::SESSION = $twiki; 3361 3368 3362 3369 return ( 3363 3370 $twiki->{topicName}, $twiki->{webName}, $twiki->{scriptUrlPath}, 3364 $twiki->{userName}, $ TWiki::cfg{DataDir}3371 $twiki->{userName}, $Foswiki::cfg{DataDir} 3365 3372 ); 3366 3373 } … … 3482 3489 3483 3490 unless ($ifParser) { 3484 require TWiki::If::Parser;3485 $ifParser = new TWiki::If::Parser();3491 require Foswiki::If::Parser; 3492 $ifParser = new Foswiki::If::Parser(); 3486 3493 } 3487 3494 … … 3505 3512 $expr = $ifParser->parse($texpr); 3506 3513 unless ($meta) { 3507 require TWiki::Meta;3508 $meta = new TWiki::Meta( $this, $web, $topic );3514 require Foswiki::Meta; 3515 $meta = new Foswiki::Meta( $this, $web, $topic ); 3509 3516 } 3510 3517 if ( $expr->evaluate( tom => $meta, data => $meta ) ) { … … 3517 3524 } 3518 3525 } 3519 catch TWiki::Infix::Error with {3526 catch Foswiki::Infix::Error with { 3520 3527 my $e = shift; 3521 3528 $result = … … 3558 3565 } 3559 3566 3560 $path =~ s/$ TWiki::cfg{NameFilter}//go; # zap anything suspicious3561 if ( $ TWiki::cfg{DenyDotDotInclude} ) {3567 $path =~ s/$Foswiki::cfg{NameFilter}//go; # zap anything suspicious 3568 if ( $Foswiki::cfg{DenyDotDotInclude} ) { 3562 3569 3563 3570 # Filter out '..' from filename, this is to … … 3783 3790 sub DATE { 3784 3791 my $this = shift; 3785 return TWiki::Time::formatTime(3792 return Foswiki::Time::formatTime( 3786 3793 time(), 3787 $ TWiki::cfg{DefaultDateFormat},3788 $ TWiki::cfg{DisplayTimeValues}3794 $Foswiki::cfg{DefaultDateFormat}, 3795 $Foswiki::cfg{DisplayTimeValues} 3789 3796 ); 3790 3797 } … … 3792 3799 sub GMTIME { 3793 3800 my ( $this, $params ) = @_; 3794 return TWiki::Time::formatTime( time(), $params->{_DEFAULT} || '',3801 return Foswiki::Time::formatTime( time(), $params->{_DEFAULT} || '', 3795 3802 'gmtime' ); 3796 3803 } … … 3798 3805 sub SERVERTIME { 3799 3806 my ( $this, $params ) = @_; 3800 return TWiki::Time::formatTime( time(), $params->{_DEFAULT} || '',3807 return Foswiki::Time::formatTime( time(), $params->{_DEFAULT} || '', 3801 3808 'servertime' ); 3802 3809 } … … 3804 3811 sub DISPLAYTIME { 3805 3812 my ( $this, $params ) = @_; 3806 return TWiki::Time::formatTime(3813 return Foswiki::Time::formatTime( 3807 3814 time(), 3808 3815 $params->{_DEFAULT} || '', 3809 $ TWiki::cfg{DisplayTimeValues}3816 $Foswiki::cfg{DisplayTimeValues} 3810 3817 ); 3811 3818 } … … 3884 3891 return '' 3885 3892 unless $key 3886 && defined $ TWiki::cfg{AccessibleENV}3887 && $key =~ /$ TWiki::cfg{AccessibleENV}/o;3893 && defined $Foswiki::cfg{AccessibleENV} 3894 && $key =~ /$Foswiki::cfg{AccessibleENV}/o; 3888 3895 my $val; 3889 3896 if ( $key =~ /^HTTPS?_(.*)/ ) { … … 3901 3908 else { 3902 3909 3903 # TSA SMELL: TWiki::Request doesn't support3910 # TSA SMELL: Foswiki::Request doesn't support 3904 3911 # SERVER_\w+, REMOTE_HOST and REMOTE_IDENT. 3905 3912 # Use %ENV as fallback, but for ones above … … 4061 4068 my $value; 4062 4069 if ( $this->{request} ) { 4063 if ( TWiki::isTrue($multiple) ) {4070 if ( Foswiki::isTrue($multiple) ) { 4064 4071 my @valueArray = $this->{request}->param($param); 4065 4072 if (@valueArray) { … … 4421 4428 return '' unless $user; 4422 4429 return '' 4423 if ( $ TWiki::cfg{AntiSpam}{HideUserDetails}4430 if ( $Foswiki::cfg{AntiSpam}{HideUserDetails} 4424 4431 && !$this->{users}->isAdmin( $this->{user} ) 4425 4432 && $user ne $this->{user} ); … … 4442 4449 if ( $info =~ /\$wikiusername/ ) { 4443 4450 my $wikiusername = $this->{users}->webDotWikiName($user); 4444 $wikiusername = "$ TWiki::cfg{UsersWebName}.UnknownUser"4451 $wikiusername = "$Foswiki::cfg{UsersWebName}.UnknownUser" 4445 4452 unless defined $wikiusername; 4446 4453 $info =~ s/\$wikiusername/$wikiusername/g; … … 4482 4489 # Nop it to prevent wikiname expansion unless the topic exists. 4483 4490 my $groupLink = "<nop>$group"; 4484 $groupLink = '[[' . $ TWiki::cfg{UsersWebName} . ".$group][$group]]"4491 $groupLink = '[[' . $Foswiki::cfg{UsersWebName} . ".$group][$group]]" 4485 4492 if ( 4486 $this->{store}->topicExists( $ TWiki::cfg{UsersWebName}, $group ) );4493 $this->{store}->topicExists( $Foswiki::cfg{UsersWebName}, $group ) ); 4487 4494 my $descr = "| $groupLink |"; 4488 4495 my $it = $this->{users}->eachGroupMember($group); … … 4510 4517 # 4511 4518 # Copyright (C) 1999-2007 Peter Thoeny, peter@thoeny.org 4512 # and TWiki Contributors. All Rights Reserved. TWiki Contributors4519 # and Foswiki Contributors. All Rights Reserved. Foswiki Contributors 4513 4520 # are listed in the AUTHORS file in the root of this distribution. 4514 4521 # NOTE: Please extend that file, not this notice.
Note: See TracChangeset
for help on using the changeset viewer.
