Changeset 1054
- Timestamp:
- 11/28/08 21:18:36 (3 years ago)
- Location:
- trunk/core
- Files:
-
- 4 edited
-
bin/setlib.cfg (modified) (4 diffs)
-
lib/Foswiki.pm (modified) (10 diffs)
-
lib/Foswiki/Plugins.pm (modified) (1 diff)
-
lib/Foswiki/UI.pm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/core/bin/setlib.cfg
r1050 r1054 12 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 13 # 14 # setlib.cfg: determines the defaults for TWiki and Perl library paths14 # setlib.cfg: determines the defaults for Foswiki and Perl library paths 15 15 # 16 16 … … 22 22 23 23 # for development, you can enable ASSERTS by adding 24 # $ENV{ TWIKI_ASSERTS} = 1;24 # $ENV{FOSWIKI_ASSERTS} = 1; 25 25 # to your bin/LocalLib.cfg 26 26 27 use vars qw( $ twikiLibPath @localPerlLibPath );27 use vars qw( $foswikiLibPath @localPerlLibPath ); 28 28 29 29 eval 'require "LocalLib.cfg"'; 30 # if foswikiLibPath isn't defined, then see if $twikiLibPath is 31 # for compatibility 32 $foswikiLibPath = $twikiLibPath unless defined( $foswikiLibPath ); 30 33 31 unless (( defined ($ twikiLibPath) ) and (-e $twikiLibPath)) {34 unless (( defined ($foswikiLibPath) ) and (-e $foswikiLibPath)) { 32 35 use Cwd qw( abs_path ); 33 ( $ twikiLibPath ) = ($twikiLibPath = Cwd::abs_path( "../lib" )) =~ /(.*)/;36 ( $foswikiLibPath ) = ($foswikiLibPath = Cwd::abs_path( "../lib" )) =~ /(.*)/; 34 37 } 35 if ($ twikiLibPath eq "") {36 $ twikiLibPath = "../lib";38 if ($foswikiLibPath eq "") { 39 $foswikiLibPath = "../lib"; 37 40 warn "using relative path for libs - some plugins may break"; 38 41 } … … 40 43 # Path to local Perl modules 41 44 my $defaultingCPANBASE = !defined($CPANBASE); 42 $CPANBASE = "$ twikiLibPath/CPAN/lib/" unless $CPANBASE;45 $CPANBASE = "$foswikiLibPath/CPAN/lib/" unless $CPANBASE; 43 46 if ( -e $CPANBASE ) { 44 47 require Config; … … 49 52 50 53 # Prepend to @INC, the Perl search path for modules 51 unshift @INC, $ twikiLibPath;54 unshift @INC, $foswikiLibPath; 52 55 if ($defaultingCPANBASE) { 53 56 push @INC, @localPerlLibPath if @localPerlLibPath; -
trunk/core/lib/Foswiki.pm
r1051 r1054 66 66 67 67 # Other computed constants 68 our $ twikiLibDir;68 our $foswikiLibDir; 69 69 our %regex; 70 70 our %functionTags; … … 91 91 our $TranslationToken = "\0"; 92 92 93 =begin TML 94 95 ---++ StaticMethod getLibDir() -> $path 96 97 Returns the full path of the directory containing Foswiki.pm 98 99 =cut 100 101 sub getLibDir { 102 if ($twikiLibDir) { 103 return $twikiLibDir; 104 } 105 106 # FIXME: Should just use $INC{"Foswiki.pm"} to get path used to load this 107 # module. 108 my $dir = ''; 109 foreach $dir (@INC) { 110 if ( $dir && -e "$dir/Foswiki.pm" ) { 111 $twikiLibDir = $dir; 112 last; 113 } 114 } 93 # Returns the full path of the directory containing Foswiki.pm 94 sub _getLibDir { 95 return $foswikiLibDir if $foswikiLibDir; 96 97 $foswikiLibDir = $INC{'Foswiki.pm'}; 115 98 116 99 # fix path relative to location of called script 117 if ( $ twikiLibDir =~ /^\./ ) {100 if ( $foswikiLibDir =~ /^\./ ) { 118 101 print STDERR 119 "WARNING: Foswiki lib path $ twikiLibDir is relative; you should make it absolute, otherwise some scripts may not run from the command line.";102 "WARNING: Foswiki lib path $foswikiLibDir is relative; you should make it absolute, otherwise some scripts may not run from the command line."; 120 103 my $bin; 121 104 … … 140 123 $bin = cwd(); 141 124 } 142 $ twikiLibDir = "$bin/$twikiLibDir/";125 $foswikiLibDir = "$bin/$foswikiLibDir/"; 143 126 144 127 # normalize "/../" and "/./" 145 while ( $ twikiLibDir =~ s|([\\/])[^\\/]+[\\/]\.\.[\\/]|$1| ) {146 } 147 $ twikiLibDir =~ s|([\\/])\.[\\/]|$1|g;148 } 149 $ twikiLibDir =~ s|([\\/])[\\/]*|$1|g; # reduce "//" to "/"150 $ twikiLibDir =~ s|[\\/]$||; # cut trailing "/"151 152 return $ twikiLibDir;128 while ( $foswikiLibDir =~ s|([\\/])[^\\/]+[\\/]\.\.[\\/]|$1| ) { 129 } 130 $foswikiLibDir =~ s|([\\/])\.[\\/]|$1|g; 131 } 132 $foswikiLibDir =~ s|([\\/])[\\/]*|$1|g; # reduce "//" to "/" 133 $foswikiLibDir =~ s|[\\/]$||; # cut trailing "/" 134 135 return $foswikiLibDir; 153 136 } 154 137 … … 497 480 498 481 # initialize lib directory early because of later 'cd's 499 getLibDir();482 _getLibDir(); 500 483 501 484 # initialize the runtime engine … … 812 795 ---++ ObjectMethod redirect( $url, $passthrough, $action_redirectto ) 813 796 814 * $url - url or t wikitopic to redirect to797 * $url - url or topic to redirect to 815 798 * $passthrough - (optional) parameter to **FILLMEIN** 816 799 * $action_redirectto - (optional) redirect to where ?redirectto= … … 939 922 940 923 # Don't double-cache 941 return '' if ( $query->param(' twiki_redirect_cache') );924 return '' if ( $query->param('foswiki_redirect_cache') ); 942 925 943 926 require Digest::MD5; … … 955 938 $query->save( \*F ); 956 939 close(F); 957 return ' twiki_redirect_cache=' . $uid;940 return 'foswiki_redirect_cache=' . $uid; 958 941 } 959 942 … … 1095 1078 Returns the URL to a Foswiki script, providing the web and topic as 1096 1079 "path info" parameters. The result looks something like this: 1097 "http://host/ twiki/bin/$script/$web/$topic".1080 "http://host/foswiki/bin/$script/$web/$topic". 1098 1081 * =...= - an arbitrary number of name,value parameter pairs that will be url-encoded and added to the url. The special parameter name '#' is reserved for specifying an anchor. e.g. <tt>getScriptUrl('x','y','view','#'=>'XXX',a=>1,b=>2)</tt> will give <tt>.../view/x/y?a=1&b=2#XXX</tt> 1099 1082 … … 3169 3152 'Sorry, this version of Foswiki does not support the url parameter to Foswiki::initialize being different to the url in the query'; 3170 3153 } 3171 my $ twiki= new Foswiki( $theRemoteUser, $query );3154 my $session = new Foswiki( $theRemoteUser, $query ); 3172 3155 3173 3156 # Force the new session into the plugins context. 3174 $Foswiki::Plugins::SESSION = $ twiki;3157 $Foswiki::Plugins::SESSION = $session; 3175 3158 3176 3159 return ( 3177 $ twiki->{topicName}, $twiki->{webName}, $twiki->{scriptUrlPath},3178 $ twiki->{userName}, $Foswiki::cfg{DataDir}3160 $session->{topicName}, $session->{webName}, $session->{scriptUrlPath}, 3161 $session->{userName}, $Foswiki::cfg{DataDir} 3179 3162 ); 3180 3163 } … … 3631 3614 #| $web | web and | 3632 3615 #| $topic | topic to display the name for | 3633 #| $formatString | twikiformat string (like in search) |3616 #| $formatString | format string (like in search) | 3634 3617 sub REVINFO { 3635 3618 my ( $this, $params, $theTopic, $theWeb ) = @_; -
trunk/core/lib/Foswiki/Plugins.pm
r1050 r1054 453 453 foreach my $plugin ( @{ $this->{plugins} } ) { 454 454 unless ( $plugin->{disabled} ) { 455 $text .= "$plugin->{installWeb}.$plugin->{name}, "; 455 my $web = $plugin->topicWeb(); 456 $text .= ($web ? "$web." : '!')."$plugin->{name}, "; 456 457 } 457 458 } -
trunk/core/lib/Foswiki/UI.pm
r1050 r1054 134 134 my ( $req, $sub, %initialContext ) = @_; 135 135 136 my $cache = $req->param(' twiki_redirect_cache');136 my $cache = $req->param('foswiki_redirect_cache'); 137 137 138 138 # Never trust input data from a query. We will only accept an MD5 32 character string … … 155 155 close(F); 156 156 unlink($passthruFilename); 157 $req->delete(' twiki_redirect_cache');157 $req->delete('foswiki_redirect_cache'); 158 158 print STDERR "Passthru: Loaded and unlinked $passthruFilename\n" 159 159 if TRACE_PASSTHRU;
Note: See TracChangeset
for help on using the changeset viewer.
