Ignore:
Timestamp:
11/19/08 13:40:25 (4 years ago)
Author:
CrawfordCurrie
Message:

Item175: First bulk rename pass. Note: not quite ready yet

File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/core/lib/Foswiki.pm

    r792 r809  
    11# See bottom of file for license and copyright information 
    2 package TWiki; 
     2package Foswiki; 
    33 
    44=pod 
     
    1616 
    1717---++ Public Data members 
    18    * =request=          Pointer to the TWiki::Request 
    19    * =response=         Pointer to the TWiki::Respose 
     18   * =request=          Pointer to the Foswiki::Request 
     19   * =response=         Pointer to the Foswiki::Respose 
    2020   * =context=          Hash of context ids 
    21    * moved: =loginManager=     TWiki::LoginManager singleton (moved to TWiki::Users) 
    22    * =plugins=          TWiki::Plugins singleton 
    23    * =prefs=            TWiki::Prefs singleton 
     21   * moved: =loginManager=     Foswiki::LoginManager singleton (moved to Foswiki::Users) 
     22   * =plugins=          Foswiki::Plugins singleton 
     23   * =prefs=            Foswiki::Prefs singleton 
    2424   * =remoteUser=       Login ID when using ApacheLogin. Maintained for 
    2525                        compatibility only, do not use. 
    2626   * =requestedWebName= Name of web found in URL path or =web= URL parameter 
    27    * =sandbox=          TWiki::Sandbox singleton 
     27   * =sandbox=          Foswiki::Sandbox singleton 
    2828   * =scriptUrlPath=    URL path to the current script. May be dynamically 
    2929                        extracted from the URL path if {GetScriptUrlFromCgi}. 
    3030                        Only required to support {GetScriptUrlFromCgi} and 
    3131                        not consistently used. Avoid. 
    32    * =security=         TWiki::Access singleton 
     32   * =security=         Foswiki::Access singleton 
    3333   * =SESSION_TAGS=     Hash of TWiki variables whose value is specific to 
    3434                        the current request. 
    35    * =store=            TWiki::Store singleton 
     35   * =store=            Foswiki::Store singleton 
    3636   * =topicName=        Name of topic found in URL path or =topic= URL 
    3737                        parameter 
     
    4040                        {DefaultUrlHost} 
    4141   * =user=             Unique user ID of logged-in user 
    42    * =users=            TWiki::Users singleton 
     42   * =users=            Foswiki::Users singleton 
    4343   * =webName=          Name of web found in URL path, or =web= URL parameter, 
    4444                        or {UsersWebName} 
     
    5050use Error qw( :try ); 
    5151use CGI;    # Always required to get html generation tags; 
    52 use TWiki::Response; 
    53 use TWiki::Request; 
     52 
     53BEGIN { $Package::Alias::BRAVE = 1 } 
     54use Package::Alias 
     55  'TWiki::Plugins' => 'Foswiki::Plugins', 
     56  'TWiki::Func' => 'Foswiki::Func'; 
     57{ package TWiki::Func; } 
     58 
     59use Foswiki::Response; 
     60use Foswiki::Request; 
    5461 
    5562require 5.005;    # For regex objects and internationalisation 
     
    6067# Uncomment this and the __END__ to enable AutoLoader 
    6168#use AutoLoader 'AUTOLOAD'; 
    62 # You then need to autosplit TWiki.pm: 
     69# You then need to autosplit Foswiki.pm: 
    6370# cd lib 
    64 # perl -e 'use AutoSplit; autosplit("TWiki.pm", "auto")' 
     71# perl -e 'use AutoSplit; autosplit("Foswiki.pm", "auto")' 
    6572 
    6673# Other computed constants 
     
    96103---++ StaticMethod getTWikiLibDir() -> $path 
    97104 
    98 Returns the full path of the directory containing TWiki.pm 
     105Returns the full path of the directory containing Foswiki.pm 
    99106 
    100107=cut 
     
    105112    } 
    106113 
    107     # FIXME: Should just use $INC{"TWiki.pm"} to get path used to load this 
     114    # FIXME: Should just use $INC{"Foswiki.pm"} to get path used to load this 
    108115    # module. 
    109116    my $dir = ''; 
    110117    foreach $dir (@INC) { 
    111         if ( $dir && -e "$dir/TWiki.pm" ) { 
     118        if ( $dir && -e "$dir/Foswiki.pm" ) { 
    112119            $twikiLibDir = $dir; 
    113120            last; 
     
    156163BEGIN { 
    157164    require Monitor; 
    158     require TWiki::Sandbox;                  # system command sandbox 
    159     require TWiki::Configure::Load;          # read configuration files 
     165    require Foswiki::Sandbox;                  # system command sandbox 
     166    require Foswiki::Configure::Load;          # read configuration files 
    160167 
    161168    $TRUE  = 1; 
     
    256263    $contextFreeSyntax{IF} = 1; 
    257264 
    258     unless ( ( $TWiki::cfg{DetailedOS} = $^O ) ) { 
     265    unless ( ( $Foswiki::cfg{DetailedOS} = $^O ) ) { 
    259266        require Config; 
    260         $TWiki::cfg{DetailedOS} = $Config::Config{'osname'}; 
    261     } 
    262     $TWiki::cfg{OS} = 'UNIX'; 
    263     if ( $TWiki::cfg{DetailedOS} =~ /darwin/i ) {    # MacOS X 
    264         $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 earlier 
    279         $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'; 
    283290    } 
    284291 
     
    290297    { 
    291298        $ENV{SERVER_NAME} = 
    292           TWiki::Sandbox::untaintUnchecked( $ENV{SERVER_NAME} ); 
    293     } 
    294  
    295     # readConfig is defined in TWiki::Configure::Load to allow overriding it 
    296     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} ) { 
    299306 
    300307        # Note: Warnings are always errors if ASSERTs are enabled 
     
    302309    } 
    303310 
    304     if ( $TWiki::cfg{UseLocale} ) { 
     311    if ( $Foswiki::cfg{UseLocale} ) { 
    305312        require locale; 
    306313        import locale(); 
     
    309316    # Constant tags dependent on the config 
    310317    $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} }; 
    316323    $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} }; 
    330337 
    331338    # Compatibility synonyms, deprecated in 4.2 but still used throughout 
     
    341348    # this in 'non-locale regexes' mode. 
    342349 
    343     if ( $TWiki::cfg{UseLocale} ) { 
     350    if ( $Foswiki::cfg{UseLocale} ) { 
    344351 
    345352        # Set environment variables for grep 
    346         $ENV{LC_CTYPE} = $TWiki::cfg{Site}{Locale}; 
     353        $ENV{LC_CTYPE} = $Foswiki::cfg{Site}{Locale}; 
    347354 
    348355        # Load POSIX for I18N support. 
     
    353360        # won't this play with the Apache process's locale settings too? 
    354361        # 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} ); 
    357364    } 
    358365 
    359366    $functionTags{CHARSET} = sub { 
    360         $TWiki::cfg{Site}{CharSet} 
     367        $Foswiki::cfg{Site}{CharSet} 
    361368          || 'iso-8859-1'; 
    362369    }; 
    363370 
    364371    $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'; 
    366373    }; 
    367374 
     
    376383    # Depends on locale mode and Perl version, and finally on 
    377384    # whether locale-based regexes are turned off. 
    378     if (   not $TWiki::cfg{UseLocale} 
     385    if (   not $Foswiki::cfg{UseLocale} 
    379386        or $] < 5.006 
    380         or not $TWiki::cfg{Site}{LocaleRegexes} ) 
     387        or not $Foswiki::cfg{Site}{LocaleRegexes} ) 
    381388    { 
    382389 
    383390        # No locales needed/working, or Perl 5.005, so just use 
    384391        # 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}; 
    387394        $regex{numeric}    = '\d'; 
    388395        $regex{mixedAlpha} = $regex{upperAlpha} . $regex{lowerAlpha}; 
     
    404411    # book at http://regex.info/. 
    405412 
    406     $regex{linkProtocolPattern} = $TWiki::cfg{LinkProtocolPattern}; 
     413    $regex{linkProtocolPattern} = $Foswiki::cfg{LinkProtocolPattern}; 
    407414 
    408415    # Header patterns based on '+++'. The '###' are reserved for numbered 
     
    422429    $regex{webNameBaseRegex} = 
    423430      qr/[$regex{upperAlpha}]+[$regex{mixedAlphaNum}_]*/o; 
    424     if ( $TWiki::cfg{EnableHierarchicalWebs} ) { 
     431    if ( $Foswiki::cfg{EnableHierarchicalWebs} ) { 
    425432        $regex{webNameRegex} = 
    426433          qr/$regex{webNameBaseRegex}(?:(?:[\.\/]$regex{webNameBaseRegex})+)*/o; 
     
    501508    # Check for unsafe search regex mode (affects filtering in) - default 
    502509    # to safe mode 
    503     $TWiki::cfg{ForceUnsafeRegexes} = 0 
    504       unless defined $TWiki::cfg{ForceUnsafeRegexes}; 
     510    $Foswiki::cfg{ForceUnsafeRegexes} = 0 
     511      unless defined $Foswiki::cfg{ForceUnsafeRegexes}; 
    505512 
    506513    # initialize lib directory early because of later 'cd's 
     
    508515 
    509516    # initialize the runtime engine 
    510     if ( !defined $TWiki::cfg{Engine} ) { 
     517    if ( !defined $Foswiki::cfg{Engine} ) { 
    511518 
    512519        # Caller did not define an engine; try and work it out (mainly for 
    513520        # the benefit of pre-5.0 CGI scripts) 
    514521        if ( defined $ENV{GATEWAY_INTERFACE} ) { 
    515             $TWiki::cfg{Engine} = 'TWiki::Engine::CGI'; 
     522            $Foswiki::cfg{Engine} = 'Foswiki::Engine::CGI'; 
    516523            use CGI::Carp qw(fatalsToBrowser); 
    517524            $SIG{__DIE__} = \&CGI::Carp::confess; 
    518525        } 
    519526        else { 
    520             $TWiki::cfg{Engine} = 'TWiki::Engine::CLI'; 
     527            $Foswiki::cfg{Engine} = 'Foswiki::Engine::CLI'; 
    521528            require Carp; 
    522529            $SIG{__DIE__} = \&Carp::confess; 
    523530        } 
    524531    } 
    525     $engine = eval qq(use $TWiki::cfg{Engine}; $TWiki::cfg{Engine}->new); 
     532    $engine = eval qq(use $Foswiki::cfg{Engine}; $Foswiki::cfg{Engine}->new); 
    526533    die $@ if $@; 
    527534 
     
    541548    my ( $this, $text ) = @_; 
    542549 
    543     return $text unless ( defined $TWiki::cfg{Site}{CharSet} ); 
     550    return $text unless ( defined $Foswiki::cfg{Site}{CharSet} ); 
    544551 
    545552    # Detect character encoding of the full topic name from URL 
     
    550557 
    551558    # 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 ) { 
    553560 
    554561        # warn if using Perl older than 5.8 
     
    567574    # Convert into ISO-8859-1 if it is the site charset.  This conversion 
    568575    # 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 ) { 
    570577 
    571578        # ISO-8859-1 maps onto first 256 codepoints of Unicode 
     
    582589            import Encode qw(:fallbacks); 
    583590 
    584             # Map $TWiki::cfg{Site}{CharSet} into real encoding name 
     591            # Map $Foswiki::cfg{Site}{CharSet} into real encoding name 
    585592            my $charEncoding = 
    586               Encode::resolve_alias( $TWiki::cfg{Site}{CharSet} ); 
     593              Encode::resolve_alias( $Foswiki::cfg{Site}{CharSet} ); 
    587594            if ( not $charEncoding ) { 
    588595                $this->writeWarning( 'Conversion to "' 
    589                       . $TWiki::cfg{Site}{CharSet} 
     596                      . $Foswiki::cfg{Site}{CharSet} 
    590597                      . '" not supported, or name not recognised - check ' 
    591598                      . '"perldoc Encode::Supported"' ); 
     
    605612        else { 
    606613            require Unicode::MapUTF8;    # Pre-5.8 Perl versions 
    607             my $charEncoding = $TWiki::cfg{Site}{CharSet}; 
     614            my $charEncoding = $Foswiki::cfg{Site}{CharSet}; 
    608615            if ( not Unicode::MapUTF8::utf8_supported_charset($charEncoding) ) { 
    609616                $this->writeWarning( 'Conversion to "' 
    610                       . $TWiki::cfg{Site}{CharSet} 
     617                      . $Foswiki::cfg{Site}{CharSet} 
    611618                      . '" not supported, or name not recognised - check ' 
    612619                      . '"perldoc Unicode::MapUTF8"' ); 
     
    710717 
    711718        # Get time now in HTTP header format 
    712         require TWiki::Time; 
     719        require Foswiki::Time; 
    713720        my $lastModifiedString = 
    714           TWiki::Time::formatTime( time, '$http', 'gmtime' ); 
     721          Foswiki::Time::formatTime( time, '$http', 'gmtime' ); 
    715722 
    716723        # Expiry time is set high to avoid any data loss.  Each instance of 
     
    743750 
    744751    $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}; 
    747754    } 
    748755 
     
    772779 
    773780    #TODO: this should really use URI 
    774     if (   ( !$TWiki::cfg{AllowRedirectUrl} ) 
     781    if (   ( !$Foswiki::cfg{AllowRedirectUrl} ) 
    775782        && ( $redirect =~ m!^([^:]*://[^/]*)/*(.*)?$! ) ) 
    776783    { 
     
    778785 
    779786        #remove trailing /'s to match 
    780         $TWiki::cfg{DefaultUrlHost} =~ m!^([^:]*://[^/]*)/*(.*)?$!; 
     787        $Foswiki::cfg{DefaultUrlHost} =~ m!^([^:]*://[^/]*)/*(.*)?$!; 
    781788        my $expected = $1; 
    782789 
    783         if ( defined( $TWiki::cfg{PermittedRedirectHostUrls} ) 
    784             && $TWiki::cfg{PermittedRedirectHostUrls} ne '' ) 
     790        if ( defined( $Foswiki::cfg{PermittedRedirectHostUrls} ) 
     791            && $Foswiki::cfg{PermittedRedirectHostUrls} ne '' ) 
    785792        { 
    786793            my @permitted = 
    787794              map { s!^([^:]*://[^/]*)/*(.*)?$!$1!; $1 } 
    788               split( /,\s*/, $TWiki::cfg{PermittedRedirectHostUrls} ); 
     795              split( /,\s*/, $Foswiki::cfg{PermittedRedirectHostUrls} ); 
    789796            return 1 if ( grep ( { uc($host) eq uc($_) } @permitted ) ); 
    790797        } 
     
    913920        $url = $this->getScriptUrl( 
    914921            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}, 
    917924            template => 'oopsaccessdenied', 
    918925            def      => 'topic_access', 
     
    921928              . $url 
    922929              . ': host does not match {DefaultUrlHost} , and is not in {PermittedRedirectHostUrls}"' 
    923               . $TWiki::cfg{DefaultUrlHost} . '"' 
     930              . $Foswiki::cfg{DefaultUrlHost} . '"' 
    924931        ); 
    925932    } 
     
    961968    $md5->add( $$, time(), rand(time) ); 
    962969    my $uid              = $md5->hexdigest(); 
    963     my $passthruFilename = "$TWiki::cfg{WorkingDir}/tmp/passthru_$uid"; 
     970    my $passthruFilename = "$Foswiki::cfg{WorkingDir}/tmp/passthru_$uid"; 
    964971 
    965972    use Fcntl; 
     
    968975    sysopen( F, "$passthruFilename", O_RDWR | O_EXCL | O_CREAT, 0600 ) 
    969976      || 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: $!"; 
    971978    $query->save( \*F ); 
    972979    close(F); 
     
    10221029otherwise only user web names are valid 
    10231030 
    1024 If $TWiki::cfg{EnableHierarchicalWebs} is off, it will also return false 
     1031If $Foswiki::cfg{EnableHierarchicalWebs} is off, it will also return false 
    10251032when a nested web name is passed to it. 
    10261033 
     
    10491056 
    10501057    my @mirrorInfo = ( '', '', '', '' ); 
    1051     if ( $TWiki::cfg{SiteWebTopicName} ) { 
     1058    if ( $Foswiki::cfg{SiteWebTopicName} ) { 
    10521059        my $mirrorSiteName = 
    10531060          $this->{prefs}->getWebPreferencesValue( 'MIRRORSITENAME', $theWeb ); 
    10541061        if (   $mirrorSiteName 
    1055             && $mirrorSiteName ne $TWiki::cfg{SiteWebTopicName} ) 
     1062            && $mirrorSiteName ne $Foswiki::cfg{SiteWebTopicName} ) 
    10561063        { 
    10571064            my $mirrorViewURL = 
     
    10671074            $mirrorNote = 
    10681075              $this->renderer->getRenderedVersion( $mirrorNote, $theWeb, 
    1069                 $TWiki::cfg{HomeTopic} ); 
     1076                $Foswiki::cfg{HomeTopic} ); 
    10701077            $mirrorNote =~ s/\s*$//g; 
    10711078            @mirrorInfo = 
     
    11411148 
    11421149    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}; 
    11451152    } 
    11461153    unless ( defined($url) ) { 
    1147         $url = $TWiki::cfg{ScriptUrlPath}; 
     1154        $url = $Foswiki::cfg{ScriptUrlPath}; 
    11481155        if ($script) { 
    11491156            $url .= '/' unless $url =~ /\/$/; 
    11501157            $url .= $script; 
    11511158            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} ) ) ) 
    11541161            { 
    1155                 $url .= $TWiki::cfg{ScriptSuffix} if $script; 
     1162                $url .= $Foswiki::cfg{ScriptSuffix} if $script; 
    11561163            } 
    11571164        } 
     
    12211228 
    12221229    my $url = ''; 
    1223     $url .= $TWiki::cfg{PubUrlPath}; 
     1230    $url .= $Foswiki::cfg{PubUrlPath}; 
    12241231    if ( $absolute && $url !~ /^[a-z]+:/ ) { 
    12251232 
     
    13191326 
    13201327*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 topic 
     1328the web defaults to $Foswiki::cfg{UsersWebName}. If there is no topic 
    13221329specification, or the topic is '0', the topic defaults to the web home topic 
    13231330name. 
     
    13541361     want to be logged-in if none is available from a session or browser. 
    13551362     Used mainly for side scripts and debugging. 
    1356    * =$query= the TWiki::Request query (may be undef, in which case an empty query 
     1363   * =$query= the Foswiki::Request query (may be undef, in which case an empty query 
    13571364     is used) 
    13581365   * =\%initialContext= - reference to a hash containing context 
     
    13631370sub new { 
    13641371    my ( $class, $login, $query, $initialContext ) = @_; 
    1365     ASSERT( !$query || UNIVERSAL::isa( $query, 'TWiki::Request' ) ); 
     1372    ASSERT( !$query || UNIVERSAL::isa( $query, 'Foswiki::Request' ) ); 
    13661373    Monitor::MARK("Static compilation complete"); 
    13671374 
    13681375    # 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} ); 
    13711378 
    13721379    # Set command_line context if there is no query 
    13731380    $initialContext ||= defined($query) ? {} : { command_line => 1 }; 
    13741381 
    1375     $query ||= new TWiki::Request(); 
     1382    $query ||= new Foswiki::Request(); 
    13761383    my $this = bless( {}, $class ); 
    13771384    $this->{request}  = $query; 
    1378     $this->{response} = new TWiki::Response(); 
    1379  
    1380     # Tell TWiki::Response which charset we are using if not default 
    1381     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 ) 
    13831390    { 
    1384         $this->{response}->charset( $TWiki::cfg{Site}{CharSet} ); 
     1391        $this->{response}->charset( $Foswiki::cfg{Site}{CharSet} ); 
    13851392    } 
    13861393 
     
    13931400        # "shared" between mod_perl instances 
    13941401        $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); 
    14011408 
    14021409    $this->{remoteUser} = 
    14031410      $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); 
    14061413    $this->{remoteUser} = $this->{users}->{remoteUser}; 
    14071414 
     
    14121419    # with use strict and calling external programs that writes on the disk 
    14131420    # 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}; 
    14161423    } 
    14171424    else { 
    1418         $ENV{PATH} = TWiki::Sandbox::untaintUnchecked( $ENV{PATH} ); 
     1425        $ENV{PATH} = Foswiki::Sandbox::untaintUnchecked( $ENV{PATH} ); 
    14191426    } 
    14201427    delete @ENV{qw( IFS CDPATH ENV BASH_ENV )}; 
     
    14291436        # when there is nothing better available. 
    14301437        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} ) { 
    14341441            $this->{urlHost} =~ s/\:[0-9]+$//; 
    14351442        } 
    14361443    } 
    14371444    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} 
    14411448        && $url 
    14421449        && $url =~ m{^[^:]*://[^/]*(.*)/.*$} 
     
    14711478 
    14721479            # jump to WebHome if 'bin/script?topic=Webname.' 
    1473             $topic = $TWiki::cfg{HomeTopicName} if ( $web && !$topic ); 
     1480            $topic = $Foswiki::cfg{HomeTopicName} if ( $web && !$topic ); 
    14741481        } 
    14751482 
     
    14961503                        my $topictmp    = $2; 
    14971504                        my $filetmp     = $3; 
    1498                         if (-f $TWiki::cfg{PubDir}."/$webtmp$topictmp/$filetmp") { 
     1505                        if (-f $Foswiki::cfg{PubDir}."/$webtmp$topictmp/$filetmp") { 
    14991506                                $web    = $webtmp; 
    15001507                                $topic  = $topictmp; 
     
    15101517 
    15111518    # 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; 
    15181525    $this->{requestedWebName} = 
    1519       TWiki::Sandbox::untaintUnchecked($web);    #can be an empty string 
    1520     $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); 
    15221529 
    15231530# Convert UTF-8 web and topic name from URL into site charset if necessary 
     
    15381545    # SMELL: This untaint unchecked is duplicate of one just above 
    15391546    $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); 
    15461553    $this->{prefs} = $prefs; 
    15471554 
     
    15521559    $prefs->pushGlobalPreferences(); 
    15531560 
    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? 
    15551562    $this->{user} = $this->{users}->initialiseUser( $this->{remoteUser} ); 
    15561563 
     
    15761583    my $wn = $this->{users}->getWikiName( $this->{user} ); 
    15771584    if ($wn) { 
    1578         $prefs->pushPreferences( $TWiki::cfg{UsersWebName}, $wn, 
     1585        $prefs->pushPreferences( $Foswiki::cfg{UsersWebName}, $wn, 
    15791586            'USER ' . $wn ); 
    15801587    } 
     
    15911598 
    15921599 # SMELL: Every place should localize it before use, so it's not necessary here. 
    1593     $TWiki::Plugins::SESSION = $this; 
     1600    $Foswiki::Plugins::SESSION = $this; 
    15941601 
    15951602    Monitor::MARK("TWiki session created"); 
     
    16101617 
    16111618    unless ( $this->{renderer} ) { 
    1612         require TWiki::Render; 
     1619        require Foswiki::Render; 
    16131620 
    16141621        # requires preferences (such as LINKTOOLTIPINFO) 
    1615         $this->{renderer} = new TWiki::Render($this); 
     1622        $this->{renderer} = new Foswiki::Render($this); 
    16161623    } 
    16171624    return $this->{renderer}; 
     
    16301637 
    16311638    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); 
    16341641    } 
    16351642    return $this->{attach}; 
     
    16481655 
    16491656    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); 
    16521659    } 
    16531660    return $this->{templates}; 
     
    16661673 
    16671674    unless ( $this->{i18n} ) { 
    1668         require TWiki::I18N; 
     1675        require Foswiki::I18N; 
    16691676 
    16701677        # language information; must be loaded after 
    16711678        # *all possible preferences sources* are available 
    1672         $this->{i18n} = new TWiki::I18N($this); 
     1679        $this->{i18n} = new Foswiki::I18N($this); 
    16731680    } 
    16741681    return $this->{i18n}; 
     
    16871694 
    16881695    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); 
    16911698    } 
    16921699    return $this->{search}; 
     
    17051712 
    17061713    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); 
    17091716    } 
    17101717    return $this->{security}; 
     
    17231730 
    17241731    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); 
    17271734    } 
    17281735    return $this->{net}; 
     
    18121819    my $text = "$user | $action | $webTopic | $extra | $remoteAddr |"; 
    18131820 
    1814     _writeReport( $this, $TWiki::cfg{LogFileName}, $text ); 
     1821    _writeReport( $this, $Foswiki::cfg{LogFileName}, $text ); 
    18151822} 
    18161823 
     
    18191826---++ ObjectMethod writeWarning( $text ) 
    18201827 
    1821 Prints date, time, and contents $text to $TWiki::cfg{WarningFileName}, typically 
     1828Prints date, time, and contents $text to $Foswiki::cfg{WarningFileName}, typically 
    18221829'warnings.txt'. Use for warnings and errors that may require admin 
    18231830intervention. Use this for defensive programming warnings (e.g. assertions). 
     
    18271834sub writeWarning { 
    18281835    my $this = shift; 
    1829     _writeReport( $this, $TWiki::cfg{WarningFileName}, @_ ); 
     1836    _writeReport( $this, $Foswiki::cfg{WarningFileName}, @_ ); 
    18301837} 
    18311838 
     
    18341841---++ ObjectMethod writeDebug( $text ) 
    18351842 
    1836 Prints date, time, and contents of $text to $TWiki::cfg{DebugFileName}, typically 
     1843Prints date, time, and contents of $text to $Foswiki::cfg{DebugFileName}, typically 
    18371844'debug.txt'.  Use for debugging messages. 
    18381845 
     
    18411848sub writeDebug { 
    18421849    my $this = shift; 
    1843     _writeReport( $this, $TWiki::cfg{DebugFileName}, @_ ); 
     1850    _writeReport( $this, $Foswiki::cfg{DebugFileName}, @_ ); 
    18441851} 
    18451852 
     
    18531860 
    18541861    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' ); 
    18571864        $log =~ s/%DATE%/$time/go; 
    1858         $time = TWiki::Time::formatTime( time(), undef, 'servertime' ); 
     1865        $time = Foswiki::Time::formatTime( time(), undef, 'servertime' ); 
    18591866 
    18601867        if ( open( FILE, ">>$log" ) ) { 
     
    19942001    $thePattern =~ 
    19952002      s/([^\\])([\$\@\%\&\#\'\`\/])/$1\\$2/g;    # escape some special chars 
    1996     $thePattern = TWiki::Sandbox::untaintUnchecked($thePattern); 
     2003    $thePattern = Foswiki::Sandbox::untaintUnchecked($thePattern); 
    19972004    $theText = '' unless ( $theText =~ s/$thePattern/$1/is ); 
    19982005    return $theText; 
     
    20062013    # For speed, read file directly if URL matches an attachment directory 
    20072014    if ( $url =~ 
    2008 /^$this->{urlHost}$TWiki::cfg{PubUrlPath}\/($regex{webNameRegex})\/([^\/\.]+)\/([^\/]+)$/ 
     2015/^$this->{urlHost}$Foswiki::cfg{PubUrlPath}\/($regex{webNameRegex})\/([^\/\.]+)\/([^\/]+)$/ 
    20092016      ) 
    20102017    { 
     
    20402047            $text = 
    20412048              _cleanupIncludedHTML( $text, $this->{urlHost}, 
    2042                 $TWiki::cfg{PubUrlPath}, $options ) 
     2049                $Foswiki::cfg{PubUrlPath}, $options ) 
    20432050              unless $raw; 
    20442051            $text = applyPatternToIncludedText( $text, $pattern ) 
     
    20532060 
    20542061    return _includeWarning( $this, $warn, 'urls_not_allowed' ) 
    2055       unless $TWiki::cfg{INCLUDE}{AllowURLs}; 
     2062      unless $Foswiki::cfg{INCLUDE}{AllowURLs}; 
    20562063 
    20572064    # SMELL: should use the URI module from CPAN to parse the URL 
     
    21162123    my ( $this, $text, $defaultTopic, $defaultWeb, $args ) = @_; 
    21172124 
    2118     require TWiki::Attrs; 
    2119  
    2120     my $params = new TWiki::Attrs($args); 
     2125    require Foswiki::Attrs; 
     2126 
     2127    my $params = new Foswiki::Attrs($args); 
    21212128 
    21222129    # get the topic name attribute 
     
    23452352and the array of sections. 
    23462353 
    2347 Each section is a =TWiki::Attrs= object, which contains the attributes 
     2354Each section is a =Foswiki::Attrs= object, which contains the attributes 
    23482355{type, name, start, end} 
    23492356where start and end are character offsets in the 
     
    23682375    foreach my $bit ( split( /(%(?:START|END)SECTION(?:{.*?})?%)/, $_[0] ) ) { 
    23692376        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); 
    23722379            $attrs->{type} ||= 'section'; 
    23732380            $attrs->{name} = 
     
    23982405        } 
    23992406        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); 
    24022409            $attrs->{type} ||= 'section'; 
    24032410            $attrs->{name} = $attrs->{_DEFAULT} || $attrs->{name} || ''; 
     
    24912498 
    24922499    # Make sure func works, for registered tag handlers 
    2493     $TWiki::Plugins::SESSION = $this; 
     2500    $Foswiki::Plugins::SESSION = $this; 
    24942501 
    24952502    # Note: it may look dangerous to override the user this way, but 
     
    26342641    if ( 
    26352642        ( 
    2636             defined( $TWiki::cfg{Site}{CharSet} ) 
    2637             and $TWiki::cfg{Site}{CharSet} =~ /^utf-?8$/i 
     2643            defined( $Foswiki::cfg{Site}{CharSet} ) 
     2644            and $Foswiki::cfg{Site}{CharSet} =~ /^utf-?8$/i 
    26382645        ) 
    26392646        or $usingEBCDIC 
     
    27842791 
    27852792    # Make sure func works, for registered tag handlers 
    2786     $TWiki::Plugins::SESSION = $this; 
     2793    $Foswiki::Plugins::SESSION = $this; 
    27872794 
    27882795    # NOTE TO DEBUGGERS 
     
    29652972 
    29662973    # my( $topic, $web, $meta ) = @_; 
    2967     require TWiki::Attrs; 
     2974    require Foswiki::Attrs; 
    29682975 
    29692976    my $e = $this->{prefs}->getPreferencesValue($tag); 
     
    29722979        if ( !defined($e) && defined( $functionTags{$tag} ) ) { 
    29732980            $e = &{ $functionTags{$tag} }( 
    2974                 $this, new TWiki::Attrs( $args, $contextFreeSyntax{$tag} ), @_ 
     2981                $this, new Foswiki::Attrs( $args, $contextFreeSyntax{$tag} ), @_ 
    29752982            ); 
    29762983        } 
     
    31043111   * =$verb= - The invoked verb (may be ignored) 
    31053112 
    3106 *Since:* TWiki::Plugins::VERSION 1.1 
     3113*Since:* Foswiki::Plugins::VERSION 1.1 
    31073114 
    31083115=cut= 
     
    33233330---++ StaticMethod initialize( $pathInfo, $remoteUser, $topic, $url, $query ) -> ($topicName, $webName, $scriptUrlPath, $userName, $dataDir) 
    33243331 
    3325 Return value: ( $topicName, $webName, $TWiki::cfg{ScriptUrlPath}, $userName, $TWiki::cfg{DataDir} ) 
     3332Return value: ( $topicName, $webName, $Foswiki::cfg{ScriptUrlPath}, $userName, $Foswiki::cfg{DataDir} ) 
    33263333 
    33273334Static method to construct a new singleton session instance. 
    33283335It creates a new TWiki and sets the Plugins $SESSION variable to 
    3329 point to it, so that TWiki::Func methods will work. 
     3336point to it, so that Foswiki::Func methods will work. 
    33303337 
    33313338This method is *DEPRECATED* but is maintained for script compatibility. 
     
    33393346 
    33403347    if ( !$query ) { 
    3341         $query = new TWiki::Request( {} ); 
     3348        $query = new Foswiki::Request( {} ); 
    33423349    } 
    33433350    if ( $query->path_info() ne $pathInfo ) { 
     
    33533360    if ( $theUrl && $theUrl ne $query->url() ) { 
    33543361        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 ); 
    33583365 
    33593366    # Force the new session into the plugins context. 
    3360     $TWiki::Plugins::SESSION = $twiki; 
     3367    $Foswiki::Plugins::SESSION = $twiki; 
    33613368 
    33623369    return ( 
    33633370        $twiki->{topicName}, $twiki->{webName}, $twiki->{scriptUrlPath}, 
    3364         $twiki->{userName},  $TWiki::cfg{DataDir} 
     3371        $twiki->{userName},  $Foswiki::cfg{DataDir} 
    33653372    ); 
    33663373} 
     
    34823489 
    34833490    unless ($ifParser) { 
    3484         require TWiki::If::Parser; 
    3485         $ifParser = new TWiki::If::Parser(); 
     3491        require Foswiki::If::Parser; 
     3492        $ifParser = new Foswiki::If::Parser(); 
    34863493    } 
    34873494 
     
    35053512        $expr = $ifParser->parse($texpr); 
    35063513        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 ); 
    35093516        } 
    35103517        if ( $expr->evaluate( tom => $meta, data => $meta ) ) { 
     
    35173524        } 
    35183525    } 
    3519     catch TWiki::Infix::Error with { 
     3526    catch Foswiki::Infix::Error with { 
    35203527        my $e = shift; 
    35213528        $result = 
     
    35583565    } 
    35593566 
    3560     $path =~ s/$TWiki::cfg{NameFilter}//go;    # zap anything suspicious 
    3561     if ( $TWiki::cfg{DenyDotDotInclude} ) { 
     3567    $path =~ s/$Foswiki::cfg{NameFilter}//go;    # zap anything suspicious 
     3568    if ( $Foswiki::cfg{DenyDotDotInclude} ) { 
    35623569 
    35633570        # Filter out '..' from filename, this is to 
     
    37833790sub DATE { 
    37843791    my $this = shift; 
    3785     return TWiki::Time::formatTime( 
     3792    return Foswiki::Time::formatTime( 
    37863793        time(), 
    3787         $TWiki::cfg{DefaultDateFormat}, 
    3788         $TWiki::cfg{DisplayTimeValues} 
     3794        $Foswiki::cfg{DefaultDateFormat}, 
     3795        $Foswiki::cfg{DisplayTimeValues} 
    37893796    ); 
    37903797} 
     
    37923799sub GMTIME { 
    37933800    my ( $this, $params ) = @_; 
    3794     return TWiki::Time::formatTime( time(), $params->{_DEFAULT} || '', 
     3801    return Foswiki::Time::formatTime( time(), $params->{_DEFAULT} || '', 
    37953802        'gmtime' ); 
    37963803} 
     
    37983805sub SERVERTIME { 
    37993806    my ( $this, $params ) = @_; 
    3800     return TWiki::Time::formatTime( time(), $params->{_DEFAULT} || '', 
     3807    return Foswiki::Time::formatTime( time(), $params->{_DEFAULT} || '', 
    38013808        'servertime' ); 
    38023809} 
     
    38043811sub DISPLAYTIME { 
    38053812    my ( $this, $params ) = @_; 
    3806     return TWiki::Time::formatTime( 
     3813    return Foswiki::Time::formatTime( 
    38073814        time(), 
    38083815        $params->{_DEFAULT} || '', 
    3809         $TWiki::cfg{DisplayTimeValues} 
     3816        $Foswiki::cfg{DisplayTimeValues} 
    38103817    ); 
    38113818} 
     
    38843891    return '' 
    38853892      unless $key 
    3886           && defined $TWiki::cfg{AccessibleENV} 
    3887           && $key =~ /$TWiki::cfg{AccessibleENV}/o; 
     3893          && defined $Foswiki::cfg{AccessibleENV} 
     3894          && $key =~ /$Foswiki::cfg{AccessibleENV}/o; 
    38883895    my $val; 
    38893896    if ( $key =~ /^HTTPS?_(.*)/ ) { 
     
    39013908    else { 
    39023909 
    3903         # TSA SMELL: TWiki::Request doesn't support 
     3910        # TSA SMELL: Foswiki::Request doesn't support 
    39043911        # SERVER_\w+, REMOTE_HOST and REMOTE_IDENT. 
    39053912        # Use %ENV as fallback, but for ones above 
     
    40614068    my $value; 
    40624069    if ( $this->{request} ) { 
    4063         if ( TWiki::isTrue($multiple) ) { 
     4070        if ( Foswiki::isTrue($multiple) ) { 
    40644071            my @valueArray = $this->{request}->param($param); 
    40654072            if (@valueArray) { 
     
    44214428        return '' unless $user; 
    44224429        return '' 
    4423           if ( $TWiki::cfg{AntiSpam}{HideUserDetails} 
     4430          if ( $Foswiki::cfg{AntiSpam}{HideUserDetails} 
    44244431            && !$this->{users}->isAdmin( $this->{user} ) 
    44254432            && $user ne $this->{user} ); 
     
    44424449    if ( $info =~ /\$wikiusername/ ) { 
    44434450        my $wikiusername = $this->{users}->webDotWikiName($user); 
    4444         $wikiusername = "$TWiki::cfg{UsersWebName}.UnknownUser" 
     4451        $wikiusername = "$Foswiki::cfg{UsersWebName}.UnknownUser" 
    44454452          unless defined $wikiusername; 
    44464453        $info =~ s/\$wikiusername/$wikiusername/g; 
     
    44824489        # Nop it to prevent wikiname expansion unless the topic exists. 
    44834490        my $groupLink = "<nop>$group"; 
    4484         $groupLink = '[[' . $TWiki::cfg{UsersWebName} . ".$group][$group]]" 
     4491        $groupLink = '[[' . $Foswiki::cfg{UsersWebName} . ".$group][$group]]" 
    44854492          if ( 
    4486             $this->{store}->topicExists( $TWiki::cfg{UsersWebName}, $group ) ); 
     4493            $this->{store}->topicExists( $Foswiki::cfg{UsersWebName}, $group ) ); 
    44874494        my $descr        = "| $groupLink |"; 
    44884495        my $it           = $this->{users}->eachGroupMember($group); 
     
    45104517# 
    45114518# Copyright (C) 1999-2007 Peter Thoeny, peter@thoeny.org 
    4512 # and TWiki Contributors. All Rights Reserved. TWiki Contributors 
     4519# and Foswiki Contributors. All Rights Reserved. Foswiki Contributors 
    45134520# are listed in the AUTHORS file in the root of this distribution. 
    45144521# NOTE: Please extend that file, not this notice. 
Note: See TracChangeset for help on using the changeset viewer.