Line: 9 to 9 | ||||||||
---|---|---|---|---|---|---|---|---|
Global variables are avoided wherever possible to avoid problems with CGI accelerators such as mod_perl. | ||||||||
Added: | ||||||||
> > | Public Data members
| |||||||
On this page:
StaticMethod getTWikiLibDir () -> $path | ||||||||
Deleted: | ||||||||
< < | STATIC method. | |||||||
Returns the full path of the directory containing TWiki.pm | ||||||||
Changed: | ||||||||
< < | ObjectMethod UTF82SiteCharSet ($utf8) -> $ascii | |||||||
> > | StaticMethod UTF82SiteCharSet ($utf8) -> $ascii | |||||||
Auto-detect UTF-8 vs. site charset in string, and convert UTF-8 into site charset. | ||||||||
Line: 41 to 67 | ||||||||
Changed: | ||||||||
< < | ObjectMethod writePageHeader ($query,$pageType,$contentType,$contentLength) | |||||||
> > | ObjectMethod generateHTTPHeaders ($query,$pageType,$contentType,$contentLength) -> $header | |||||||
All parameters are optional. | ||||||||
Line: 55 to 81 | ||||||||
delimited. Filters any illegal headers. Plugin headers will override core settings. | ||||||||
Added: | ||||||||
> > | Does not add a Content-length header.
StaticMethod isRedirectSafe ($redirect)=>$ok | |||||||
Added: | ||||||||
> > | tests if the $redirect is an external URL, returning false if AllowRedirectUrl? is denied | |||||||
Changed: | ||||||||
< < | ObjectMethod redirect ($url,$passthrough) | |||||||
> > |
ObjectMethod redirect ($url,$passthrough,$action_redirectto)
| |||||||
Redirects the request to $url , unless
| ||||||||
Line: 65 to 104 | ||||||||
| ||||||||
Changed: | ||||||||
< < | Normally this method will ignore parameters to the current query. If $passthrough is set, then it will pass all parameters that were passed to the current query on to the redirect target. If the request_method was GET, then all parameters can be passed in the URL. If the request_method was POST then it caches the form data and passes over a cache reference in the redirect GET. | |||||||
> > | Normally this method will ignore parameters to the current query. Sometimes, for example when redirecting to a login page during authentication (and then again from the login page to the original requested URL), you want to make sure all parameters are passed on, and for this $passthrough should be set to true. In this case it will pass all parameters that were passed to the current query on to the redirect target. If the request_method for the current query was GET, then all parameters will be passed by encoding them in the URL (after ?). If the request_method was POST, then there is a risk the URL would be too big for the receiver, so it caches the form data and passes over a cache reference in the redirect GET. | |||||||
Changed: | ||||||||
< < | Passthrough is only meaningful if the redirect target is on the same server. | |||||||
> > | NOTE: Passthrough is only meaningful if the redirect target is on the same server. | |||||||
Line: 112 to 156 | ||||||||
system web names are considered valid (names starting with _) otherwise only user web names are valid | ||||||||
Added: | ||||||||
> > | If $TWiki::cfg{EnableHierarchicalWebs} is off, it will also return false when a nested web name is passed to it. | |||||||
ObjectMethod readOnlyMirrorWeb ($theWeb) -> ($mirrorSiteName,$mirrorViewURL,$mirrorLink,$mirrorNote) | ||||||||
Line: 177 to 224 | ||||||||
Changed: | ||||||||
< < | ObjectMethod getOopsUrl ($template,@options) -> $absoluteOopsURL | |||||||
> > | ObjectMethod normalizeWebTopicName ($theWeb,$theTopic) -> ($theWeb,$theTopic)Normalize a Web.TopicName | |||||||
Changed: | ||||||||
< < | Composes a URL for an "oops" error page. The @options consists of a list
of key => value pairs. The following keys are used:
| |||||||
> > | See TWikiFuncDotPm for a full specification of the expansion (not duplicated here) | |||||||
Changed: | ||||||||
< < | Do not include the "oops" part in front of the template name. | |||||||
> > | WARNING if there is no web specification (in the web or topic parameters) the web defaults to $TWiki::cfg{UsersWebName}. If there is no topic specification, or the topic is '0', the topic defaults to the web home topic name. | |||||||
Deleted: | ||||||||
< < | Alternatively you can pass a reference to an OopsException? in place of the template. All other parameters will be ignored. | |||||||
Deleted: | ||||||||
< < | The returned URL ends up looking something like this: "http://host/twiki/bin/oops/$web/$topic?template=$template¶m1=$scriptParams[0]..." | |||||||
Changed: | ||||||||
< < | Note: if {keep} is true in the params, then they will also be pushed into the current query. | |||||||
> > | ClassMethod new ($loginName,$query,\%initialContext) | |||||||
Added: | ||||||||
> > | Constructs a new TWiki object. Parameters are taken from the query object. | |||||||
Added: | ||||||||
> > |
| |||||||
Deleted: | ||||||||
< < | ObjectMethod normalizeWebTopicName ($theWeb,$theTopic) -> ($theWeb,$theTopic) | |||||||
Deleted: | ||||||||
< < | Normalize a Web.TopicName | |||||||
Changed: | ||||||||
< < | See TWikiFuncDotPm for a full specification of the expansion (not duplicated here) | |||||||
> > | ObjectMethod renderer ()Get a reference to the renderer object. Done lazily because not everyone needs the renderer. | |||||||
Deleted: | ||||||||
< < | WARNING if there is no web specification (in the web or topic parameters) the web defaults to $TWiki::cfg{UsersWebName}. If there is no topic specification, or the topic is '0', the topic defaults to the web home topic name. | |||||||
Added: | ||||||||
> > | ObjectMethod attach ()Get a reference to the attach object. Done lazily because not everyone needs the attach. | |||||||
Deleted: | ||||||||
< < | ClassMethod new ($loginName,$query,\%initialContext) | |||||||
Deleted: | ||||||||
< < | Constructs a new TWiki object. Parameters are taken from the query object. | |||||||
Changed: | ||||||||
< < |
| |||||||
> > | ObjectMethod templates ()Get a reference to the templates object. Done lazily because not everyone needs the templates. | |||||||
Added: | ||||||||
> > | ObjectMethod i18n ()Get a reference to the i18n object. Done lazily because not everyone needs the i18ner. | |||||||
Deleted: | ||||||||
< < | ObjectMethod finish | |||||||
Changed: | ||||||||
< < | Complete processing after the client's HTTP request has been responded
to. Right now this does two things:
| |||||||
> > | ObjectMethod search ()Get a reference to the search object. Done lazily because not everyone needs the searcher.ObjectMethod security ()Get a reference to the security object. Done lazily because not everyone needs the security.ObjectMethod net ()Get a reference to the net object. Done lazily because not everyone needs the net.ObjectMethod finish ()Break circular references. | |||||||
Line: 237 to 304 | ||||||||
| ||||||||
Changed: | ||||||||
< < |
| |||||||
> > |
| |||||||
Write the log for an event to the logfile | ||||||||
Line: 292 to 359 | ||||||||
Changed: | ||||||||
< < | ObjectMethod expandVariablesOnTopicCreation ($text,$user) -> $text | |||||||
> > | ObjectMethod expandVariablesOnTopicCreation ($text,$user,$web,$topic) -> $text | |||||||
| ||||||||
Changed: | ||||||||
< < |
| |||||||
> > |
| |||||||
Expand limited set of variables during topic creation. These are variables expected in templates that must be statically expanded in new content. | ||||||||
Added: | ||||||||
> > |
| |||||||
# SMELL: no plugin handler | ||||||||
Line: 339 to 408 | ||||||||
Added: | ||||||||
> > | StaticMethod urlEncodeAttachment ($text)For attachments, URL-encode specially to 'freeze' any characters >127 in the site charset (e.g. ISO-8859-1 or KOI8-R), by doing URL encoding into native charset ($siteCharset) - used when generating attachment URLs, to enable the web server to serve attachments, including images, directly. This encoding is required to handle the cases of: - browsers that generate UTF-8 URLs automatically from site charset URLs - now quite common - web servers that directly serve attachments, using the site charset for filenames, and cannot convert UTF-8 URLs into site charset filenames The aim is to prevent the browser from converting a site charset URL in the web page to a UTF-8 URL, which is the default. Hence we 'freeze' the URL into the site character set through URL encoding. In two cases, no URL encoding is needed: For EBCDIC mainframes, we assume that site charset URLs will be translated (outbound and inbound) by the web server to/from an EBCDIC character set. For sites running in UTF-8, there's no need for TWiki to do anything since all URLs and attachment filenames are already in UTF-8. | |||||||
StaticMethod urlEncode ($string) -> encodedstringEncode by converting characters that are illegal in URLs to | ||||||||
Line: 348 to 441 | ||||||||
characters such as = and ?. RFC 1738, Dec. '94: | ||||||||
Changed: | ||||||||
< < | > | |||||||
> > | ||||||||
...Only alphanumerics [0-9a-zA-Z], the special characters $-_.+!*'(), and reserved characters used for their reserved purposes may be used unencoded within a URL. | ||||||||
Line: 356 to 450 | ||||||||
Reserved characters are $&+,/:;=?@ - these are also encoded by this method. | ||||||||
Changed: | ||||||||
< < | SMELL: For non-ISO-8859-1 $TWiki::cfg{Site}{CharSet}, need to convert to UTF-8 before URL encoding. This encoding only supports 8-bit character codes. | |||||||
> > | This URL-encoding handles all character encodings including ISO-8859-*, KOI8-R, EUC-* and UTF-8. This may not handle EBCDIC properly, as it generates an EBCDIC URL-encoded URL, but mainframe web servers seem to translate this outbound before it hits browser - see CGI::Util::escape for another approach. | |||||||
Line: 387 to 484 | ||||||||
Added: | ||||||||
> > | ObjectMethod expandAllTags (\$text,$topic,$web,$meta)Expands variables by replacing the variables with their values. Some example variables: %TOPIC%, %SCRIPTURL%, %WIKINAME%, etc. $web and $incs are passed in for recursive include expansion. They can safely be undef. The rules for tag expansion are:
| |||||||
ObjectMethod enterContext ($id,$val)Add the context id $id into the set of active contexts. The $val | ||||||||
Line: 461 to 575 | ||||||||
Changed: | ||||||||
< < | ObjectMethod handleCommonTags ($text,$web,$topic) -> $text | |||||||
> > | ObjectMethod handleCommonTags ($text,$web,$topic,$meta) -> $text | |||||||
Processes %VARIABLE%, and %TOC% syntax; also includes 'commonTagsHandler' plugin hook. | ||||||||
Line: 469 to 583 | ||||||||
Returns the text of the topic, after file inclusion, variable substitution, table-of-contents generation, and any plugin changes from commonTagsHandler. | ||||||||
Added: | ||||||||
> > | $meta may be undef when, for example, expanding templates, or one-off strings at a time when meta isn't available. | |||||||
ObjectMethod addToHEAD ($id,$html) |