Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F1383
Parser.php.dotdot.diff
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
bzimport
Nov 21 2014, 7:05 PM
2014-11-21 19:05:16 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
Parser.php.dotdot.diff
View Options
1197,1213d1196
< # JBA inserted code here
< # The two inserted code snippets allow .. syntax like this:
< # [[../Foo]] or [[../../Bar]]
< # Limitations:
< # - ..s can only occur at beginning
< # - cannot go past your top subpage
< # - cannot just do .. or ../..; must have / and something not-..
< $jba_cd_dot_dot = 0; # count # of leading ../ occurrences
< $jba_orig_m1 = $m[1];
< if(substr($m[1],0,3) == '../') {
< while(substr($m[1],0,3) == '../') {
< $jba_cd_dot_dot = $jba_cd_dot_dot + 1;
< $m[1] = substr($m[1],3);
< }
< $m[1] = '/' . $m[1];
< }
< # JBA end of code insertion
1224,1241c1207
< # JBA inserted code here
< $jba_prefix = $this->mTitle->getPrefixedText(); # Prefix to be prepended
<
< # Remove $jba_cd_dot_dot number of /words on the end of the prefix
< if ($jba_cd_dot_dot) {
< $jba_substrings = explode('/', $jba_prefix);
< $jba_substrings = array_slice($jba_substrings, 0, -$jba_cd_dot_dot);
< # Implode seems to malfunction if $jba_substrings is one element.
< if (count($jba_substrings) == 1) {
< $jba_prefix = $jba_substrings[0];
< }
< else {
< $jba_prefix = implode('/', $jba_substrings);
< }
< }
<
< # Prepend the prefix to the suffix to form the link.
< $link = $jba_prefix . '/' . trim($noslash);
---
> $link = $this->mTitle->getPrefixedText(). '/' . trim($noslash);
1243c1209
< $text= $jba_orig_m1;
---
> $text= $m[1];
1245,1246d1210
< # JBA end of code insertion
<
File Metadata
Details
Attached
Mime Type
text/plain
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1282
Default Alt Text
Parser.php.dotdot.diff (1 KB)
Attached To
Mode
T2981: Support .. (dotdot) syntax for subpage links
Attached
Detach File
Event Timeline
Log In to Comment