Index: trunk/phase3/index.php |
— | — | @@ -25,22 +25,25 @@ |
26 | 26 | |
27 | 27 | # Query string fields |
28 | 28 | # |
29 | | -global $action, $title, $search, $go, $target, $printable; |
30 | | -global $returnto, $diff, $oldid, $curid; |
| 29 | +#global $action, $title, $search, $go, $target, $printable; |
| 30 | +#global $returnto, $diff, $oldid, $curid; |
31 | 31 | |
| 32 | +$action = $_REQUEST['action']; |
| 33 | +$title = $_REQUEST['title']; |
| 34 | + |
32 | 35 | # Placeholders in case of DB error |
33 | 36 | $wgTitle = Title::newFromText( wfMsg( "badtitle" ) ); |
34 | 37 | $wgArticle = new Article($wgTitle); |
35 | 38 | |
36 | 39 | $action = strtolower( trim( $action ) ); |
37 | 40 | if ( "" == $action ) { $action = "view"; } |
38 | | -if ( "yes" == $printable ) { $wgOut->setPrintable(); } |
| 41 | +if ( "yes" == $_REQUEST['printable'] ) { $wgOut->setPrintable(); } |
39 | 42 | |
40 | 43 | if ( "" == $title && "delete" != $action ) { |
41 | 44 | $wgTitle = Title::newFromText( wfMsg( "mainpage" ) ); |
42 | | -} elseif ( $curid ) { |
| 45 | +} elseif ( $_REQUEST['curid'] ) { |
43 | 46 | # URLs like this are generated by RC, because rc_title isn't always accurate |
44 | | - $wgTitle = Title::newFromID( $curid ); |
| 47 | + $wgTitle = Title::newFromID( $_REQUEST['curid'] ); |
45 | 48 | } else { |
46 | 49 | $wgTitle = Title::newFromURL( $title ); |
47 | 50 | } |
— | — | @@ -56,11 +59,11 @@ |
57 | 60 | } |
58 | 61 | } |
59 | 62 | |
60 | | -if ( "" != $search ) { |
| 63 | +if ( "" != $_REQUEST['search'] ) { |
61 | 64 | if( isset($_REQUEST['fulltext']) ) { |
62 | | - wfSearch( $search ); |
| 65 | + wfSearch( $_REQUEST['search'] ); |
63 | 66 | } else { |
64 | | - wfGo( $search ); |
| 67 | + wfGo( $_REQUEST['search'] ); |
65 | 68 | } |
66 | 69 | } else if( !$wgTitle or $wgTitle->getInterwiki() != "" or $wgTitle->getDBkey() == "" ) { |
67 | 70 | $wgTitle = Title::newFromText( wfMsg( "badtitle" ) ); |
Index: trunk/phase3/includes/SpecialUndelete.php |
— | — | @@ -77,7 +77,8 @@ |
78 | 78 | |
79 | 79 | $wgOut->addWikiText( wfMsg( "undeletehistory" ) . "\n<hr>\n" . $row->ar_text ); |
80 | 80 | |
81 | | - $action = wfLocalUrlE( $wgLang->specialPage( "Undelete" ), "action=submit" ); |
| 81 | + $titleObj = Title::makeTitle( NS_SPECIAL, "Undelete" ); |
| 82 | + $action = $titleObj->getURL( "action=submit", true ); |
82 | 83 | $wgOut->addHTML("<p> |
83 | 84 | <form id=\"undelete\" method=\"post\" action=\"{$action}\"> |
84 | 85 | <input type=hidden name=\"target\" value=\"{$target}\"> |
Index: trunk/phase3/includes/MagicWord.php |
— | — | @@ -54,14 +54,14 @@ |
55 | 55 | # Preliminary initialisation |
56 | 56 | /* private */ function initRegex() |
57 | 57 | { |
58 | | - $variableClass = "A-Za-z0-9_\-\x80-\xff"; |
| 58 | + $variableClass = Title::legalChars(); |
59 | 59 | $escSyn = array_map( "preg_quote", $this->mSynonyms ); |
60 | 60 | $this->mBaseRegex = implode( "|", $escSyn ); |
61 | 61 | $case = $this->mCaseSensitive ? "" : "i"; |
62 | 62 | $this->mRegex = "/{$this->mBaseRegex}/{$case}"; |
63 | 63 | $this->mRegexStart = "/^{$this->mBaseRegex}/{$case}"; |
64 | | - $this->mVariableRegex = str_replace( "\\$1", "([$variableClass]*)", $this->mRegex ); |
65 | | - $this->mVariableStartToEndRegex = str_replace( "\\$1", "([$variableClass]*)", |
| 64 | + $this->mVariableRegex = str_replace( "\\$1", "([$variableClass]*?)", $this->mRegex ); |
| 65 | + $this->mVariableStartToEndRegex = str_replace( "\\$1", "([$variableClass]*?)", |
66 | 66 | "/^{$this->mBaseRegex}$/{$case}" ); |
67 | 67 | } |
68 | 68 | |
Index: trunk/phase3/includes/SpecialImagelist.php |
— | — | @@ -48,8 +48,8 @@ |
49 | 49 | $sk = $wgUser->getSkin(); |
50 | 50 | $cap = wfMsg( "ilshowmatch" ); |
51 | 51 | $sub = wfMsg( "ilsubmit" ); |
52 | | - $action = wfLocalUrlE( $wgLang->specialPage( "Imagelist" ), |
53 | | - "sort=byname&limit={$limit}" ); |
| 52 | + $titleObj = Title::makeTitle( NS_SPECIAL, "Imagelist" ); |
| 53 | + $action = $titleObj->getURL( "sort=byname&limit={$limit}", true ); |
54 | 54 | |
55 | 55 | $wgOut->addHTML( "<form id=\"imagesearch\" method=\"post\" action=\"" . |
56 | 56 | "{$action}\">" . |
Index: trunk/phase3/includes/SpecialIpblocklist.php |
— | — | @@ -38,8 +38,8 @@ |
39 | 39 | $ipa = wfMsg( "ipaddress" ); |
40 | 40 | $ipr = wfMsg( "ipbreason" ); |
41 | 41 | $ipus = wfMsg( "ipusubmit" ); |
42 | | - $action = wfLocalUrlE( $wgLang->specialPage( "Ipblocklist" ), |
43 | | - "action=submit" ); |
| 42 | + $titleObj = Title::makeTitle( NS_SPECIAL, "Ipblocklist" ); |
| 43 | + $action = $titleObj->getURL( "action=submit", true ); |
44 | 44 | |
45 | 45 | if ( "" != $err ) { |
46 | 46 | $wgOut->setSubtitle( wfMsg( "formerror" ) ); |
— | — | @@ -87,8 +87,8 @@ |
88 | 88 | $log->addEntry( $action, $wpUnblockReason ); |
89 | 89 | |
90 | 90 | # Report to the user |
91 | | - $success = wfLocalUrl( $wgLang->specialPage( "Ipblocklist" ), |
92 | | - "action=success&ip=" . urlencode($wpUnblockAddress) ); |
| 91 | + $titleObj = Title::makeTitle( NS_SPECIAL, "Ipblocklist" ); |
| 92 | + $success = $titleObj->getURL( "action=success&ip=" . urlencode($wpUnblockAddress) ); |
93 | 93 | $wgOut->redirect( $success ); |
94 | 94 | } |
95 | 95 | |
— | — | @@ -130,15 +130,16 @@ |
131 | 131 | $wgOut->addHTML( "<li>{$line}" ); |
132 | 132 | |
133 | 133 | if ( !$block->mAuto ) { |
134 | | - $clink = "<a href=\"" . wfLocalUrlE( $wgLang->specialPage( |
135 | | - "Contributions" ), "target={$block->mAddress}" ) . "\">" . |
| 134 | + $titleObj = Title::makeTitle( NS_SPECIAL, "Contributions" ); |
| 135 | + $clink = "<a href=\"" . $titleObj->getURL( "target={$block->mAddress}", true ) . "\">" . |
136 | 136 | wfMsg( "contribslink" ) . "</a>"; |
137 | 137 | $wgOut->addHTML( " ({$clink})" ); |
138 | 138 | } |
139 | 139 | |
140 | 140 | if ( $wgUser->isSysop() ) { |
141 | | - $ublink = "<a href=\"" . wfLocalUrlE( $wgLang->specialPage( |
142 | | - "Ipblocklist" ), "action=unblock&ip=" . urlencode( $addr ) ) . "\">" . |
| 141 | + $titleObj = Title::makeTitle( NS_SPECIAL, "Ipblocklist" ); |
| 142 | + $ublink = "<a href=\"" . |
| 143 | + $titleObj->getURL( "action=unblock&ip=" . urlencode( $addr ), true ) . "\">" . |
143 | 144 | wfMsg( "unblocklink" ) . "</a>"; |
144 | 145 | $wgOut->addHTML( " ({$ublink})" ); |
145 | 146 | } |
Index: trunk/phase3/includes/Title.php |
— | — | @@ -3,12 +3,31 @@ |
4 | 4 | |
5 | 5 | /* private static */ $title_interwiki_cache = array(); |
6 | 6 | |
| 7 | +# Title class |
| 8 | +# |
| 9 | +# * Represents a title, which may contain an interwiki designation or namespace |
| 10 | +# * Can fetch various kinds of data from the database, albeit inefficiently. |
| 11 | +# |
7 | 12 | class Title { |
8 | | - /* private */ var $mTextform, $mUrlform, $mDbkeyform; |
9 | | - /* private */ var $mNamespace, $mInterwiki, $mFragment; |
10 | | - /* private */ var $mArticleID, $mRestrictions, $mRestrictionsLoaded; |
11 | | - /* private */ var $mPrefixedText; |
| 13 | + # All member variables should be considered private |
| 14 | + # Please use the accessor functions |
12 | 15 | |
| 16 | + var $mTextform; # Text form (spaces not underscores) of the main part |
| 17 | + var $mUrlform; # URL-encoded form of the main part |
| 18 | + var $mDbkeyform; # Main part with underscores |
| 19 | + var $mNamespace; # Namespace index, i.e. one of the NS_xxxx constants |
| 20 | + var $mInterwiki; # Interwiki prefix (or null string) |
| 21 | + var $mFragment; # Title fragment (i.e. the bit after the #) |
| 22 | + var $mArticleID; # Article ID, fetched from the link cache on demand |
| 23 | + var $mRestrictions; # Array of groups allowed to edit this article |
| 24 | + # Only null or "sysop" are supported |
| 25 | + var $mRestrictionsLoaded; # Boolean for initialisation on demand |
| 26 | + var $mPrefixedText; # Text form including namespace/interwiki, initialised on demand |
| 27 | + |
| 28 | +#---------------------------------------------------------------------------- |
| 29 | +# Construction |
| 30 | +#---------------------------------------------------------------------------- |
| 31 | + |
13 | 32 | /* private */ function Title() |
14 | 33 | { |
15 | 34 | $this->mInterwiki = $this->mUrlform = |
— | — | @@ -19,9 +38,8 @@ |
20 | 39 | $this->mRestrictions = array(); |
21 | 40 | } |
22 | 41 | |
23 | | - # Static factory methods |
24 | | - # |
25 | | - function newFromDBkey( $key ) |
| 42 | + # From a prefixed DB key |
| 43 | + /* static */ function newFromDBkey( $key ) |
26 | 44 | { |
27 | 45 | $t = new Title(); |
28 | 46 | $t->mDbkeyform = $key; |
— | — | @@ -31,7 +49,8 @@ |
32 | 50 | return NULL; |
33 | 51 | } |
34 | 52 | |
35 | | - function newFromText( $text ) |
| 53 | + # From text, such as what you would find in a link |
| 54 | + /* static */ function newFromText( $text ) |
36 | 55 | { |
37 | 56 | static $trans; |
38 | 57 | $fname = "Title::newFromText"; |
— | — | @@ -51,7 +70,9 @@ |
52 | 71 | |
53 | 72 | $text = wfMungeToUtf8( $text ); |
54 | 73 | |
55 | | - $text = urldecode( $text ); |
| 74 | + |
| 75 | + # What was this for? TS 2004-03-03 |
| 76 | + # $text = urldecode( $text ); |
56 | 77 | |
57 | 78 | $t = new Title(); |
58 | 79 | $t->mDbkeyform = str_replace( " ", "_", $text ); |
— | — | @@ -63,23 +84,26 @@ |
64 | 85 | } |
65 | 86 | } |
66 | 87 | |
67 | | - function newFromURL( $url ) |
| 88 | + # From a URL-encoded title |
| 89 | + /* static */ function newFromURL( $url ) |
68 | 90 | { |
69 | 91 | global $wgLang, $wgServer; |
70 | | - |
71 | 92 | $t = new Title(); |
72 | 93 | $s = urldecode( $url ); # This is technically wrong, as anything |
73 | 94 | # we've gotten is already decoded by PHP. |
74 | 95 | # Kept for backwards compatibility with |
75 | 96 | # buggy URLs we had for a while... |
| 97 | + $s = $url; |
76 | 98 | |
77 | 99 | # For links that came from outside, check for alternate/legacy |
78 | 100 | # character encoding. |
79 | 101 | wfDebug( "Refer: {$_SERVER['HTTP_REFERER']}\n" ); |
80 | 102 | wfDebug( "Servr: $wgServer\n" ); |
81 | 103 | if( empty( $_SERVER["HTTP_REFERER"] ) || |
82 | | - strncmp($wgServer, $_SERVER["HTTP_REFERER"], strlen( $wgServer ) ) ) |
| 104 | + strncmp($wgServer, $_SERVER["HTTP_REFERER"], strlen( $wgServer ) ) ) |
| 105 | + { |
83 | 106 | $s = $wgLang->checkTitleEncoding( $s ); |
| 107 | + } |
84 | 108 | |
85 | 109 | $t->mDbkeyform = str_replace( " ", "_", $s ); |
86 | 110 | if( $t->secureAndSplit() ) { |
— | — | @@ -89,9 +113,10 @@ |
90 | 114 | } |
91 | 115 | } |
92 | 116 | |
93 | | - # Create a title from a cur id |
94 | | - # This is inefficiently implemented |
95 | | - function newFromID( $id ) |
| 117 | + # From a cur_id |
| 118 | + # This is inefficiently implemented, the cur row is requested but not |
| 119 | + # used for anything else |
| 120 | + /* static */ function newFromID( $id ) |
96 | 121 | { |
97 | 122 | $fname = "Title::newFromID"; |
98 | 123 | $row = wfGetArray( "cur", array( "cur_namespace", "cur_title" ), |
— | — | @@ -103,9 +128,31 @@ |
104 | 129 | } |
105 | 130 | return $title; |
106 | 131 | } |
| 132 | + |
| 133 | + # From a namespace index and a DB key |
| 134 | + /* static */ function makeTitle( $ns, $title ) |
| 135 | + { |
| 136 | + $t = new Title(); |
| 137 | + $t->mDbkeyform = Title::makeName( $ns, $title ); |
| 138 | + if( $t->secureAndSplit() ) { |
| 139 | + return $t; |
| 140 | + } else { |
| 141 | + return NULL; |
| 142 | + } |
| 143 | + } |
107 | 144 | |
108 | | - function nameOf( $id ) |
| 145 | + function newMainPage() |
109 | 146 | { |
| 147 | + return Title::newFromText( wfMsg( "mainpage" ) ); |
| 148 | + } |
| 149 | + |
| 150 | +#---------------------------------------------------------------------------- |
| 151 | +# Static functions |
| 152 | +#---------------------------------------------------------------------------- |
| 153 | + |
| 154 | + # Get the prefixed DB key associated with an ID |
| 155 | + /* static */ function nameOf( $id ) |
| 156 | + { |
110 | 157 | $sql = "SELECT cur_namespace,cur_title FROM cur WHERE " . |
111 | 158 | "cur_id={$id}"; |
112 | 159 | $res = wfQuery( $sql, DB_READ, "Article::nameOf" ); |
— | — | @@ -116,20 +163,56 @@ |
117 | 164 | return $n; |
118 | 165 | } |
119 | 166 | |
120 | | - |
| 167 | + # Get a regex character class describing the legal characters in a link |
121 | 168 | /* static */ function legalChars() |
122 | 169 | { |
123 | | - global $wgInputEncoding; |
124 | | - if( $wgInputEncoding == "utf-8" ) { |
125 | | - return "-,.()' &;%!?_0-9A-Za-z\\/:\\x80-\\xFF"; |
126 | | - } else { |
127 | | - # ISO 8859-* don't allow 0x80-0x9F |
128 | | - #return "-,.()' &;%!?_0-9A-Za-z\\/:\\xA0-\\xFF"; |
129 | | - # But that breaks interlanguage links at the moment. Temporary: |
130 | | - return "-,.()' &;%!?_0-9A-Za-z\\/:\\x80-\\xFF"; |
| 170 | + # Missing characters: |
| 171 | + # * []|# Needed for link syntax |
| 172 | + # * % and + are corrupted by Apache when they appear in the path |
| 173 | + # |
| 174 | + # Theoretically 0x80-0x9F of ISO 8859-1 should be disallowed, but |
| 175 | + # this breaks interlanguage links |
| 176 | + |
| 177 | + $set = " !\"$&'()*,\\-.\\/0-9:;<=>?@A-Z\\\\^_`a-z{}~\\x80-\\xFF"; |
| 178 | + return $set; |
| 179 | + } |
| 180 | + |
| 181 | + # Returns a stripped-down a title string ready for the search index |
| 182 | + # Takes a namespace index and a text-form main part |
| 183 | + /* static */ function indexTitle( $ns, $title ) |
| 184 | + { |
| 185 | + global $wgDBminWordLen, $wgLang; |
| 186 | + |
| 187 | + $lc = SearchEngine::legalSearchChars() . "&#;"; |
| 188 | + $t = $wgLang->stripForSearch( $title ); |
| 189 | + $t = preg_replace( "/[^{$lc}]+/", " ", $t ); |
| 190 | + $t = strtolower( $t ); |
| 191 | + |
| 192 | + # Handle 's, s' |
| 193 | + $t = preg_replace( "/([{$lc}]+)'s( |$)/", "\\1 \\1's ", $t ); |
| 194 | + $t = preg_replace( "/([{$lc}]+)s'( |$)/", "\\1s ", $t ); |
| 195 | + |
| 196 | + $t = preg_replace( "/\\s+/", " ", $t ); |
| 197 | + |
| 198 | + if ( $ns == Namespace::getImage() ) { |
| 199 | + $t = preg_replace( "/ (png|gif|jpg|jpeg|ogg)$/", "", $t ); |
131 | 200 | } |
| 201 | + return trim( $t ); |
132 | 202 | } |
| 203 | + |
| 204 | + # Make a prefixed DB key from a DB key and a namespace index |
| 205 | + /* static */ function makeName( $ns, $title ) |
| 206 | + { |
| 207 | + global $wgLang; |
133 | 208 | |
| 209 | + $n = $wgLang->getNsText( $ns ); |
| 210 | + if ( "" == $n ) { return $title; } |
| 211 | + else { return "{$n}:{$title}"; } |
| 212 | + } |
| 213 | + |
| 214 | + # Arguably static |
| 215 | + # Returns the URL associated with an interwiki prefix |
| 216 | + # The URL contains $1, which is replaced by the title |
134 | 217 | function getInterwikiLink( $key ) |
135 | 218 | { |
136 | 219 | global $wgMemc, $wgDBname, $title_interwiki_cache; |
— | — | @@ -157,61 +240,29 @@ |
158 | 241 | $title_interwiki_cache[$k] = $s; |
159 | 242 | return $s->iw_url; |
160 | 243 | } |
| 244 | + |
| 245 | +#---------------------------------------------------------------------------- |
| 246 | +# Other stuff |
| 247 | +#---------------------------------------------------------------------------- |
161 | 248 | |
| 249 | + # Simple accessors |
| 250 | + # See the definitions at the top of this file |
| 251 | + |
162 | 252 | function getText() { return $this->mTextform; } |
163 | | - function getURL() { return $this->mUrlform; } |
| 253 | + function getPartialURL() { return $this->mUrlform; } |
164 | 254 | function getDBkey() { return $this->mDbkeyform; } |
165 | 255 | function getNamespace() { return $this->mNamespace; } |
166 | 256 | function setNamespace( $n ) { $this->mNamespace = $n; } |
167 | 257 | function getInterwiki() { return $this->mInterwiki; } |
168 | 258 | function getFragment() { return $this->mFragment; } |
169 | 259 | |
170 | | - /* static */ function indexTitle( $ns, $title ) |
171 | | - { |
172 | | - global $wgDBminWordLen, $wgLang; |
173 | | - |
174 | | - $lc = SearchEngine::legalSearchChars() . "&#;"; |
175 | | - $t = $wgLang->stripForSearch( $title ); |
176 | | - $t = preg_replace( "/[^{$lc}]+/", " ", $t ); |
177 | | - $t = strtolower( $t ); |
178 | | - |
179 | | - # Handle 's, s' |
180 | | - $t = preg_replace( "/([{$lc}]+)'s( |$)/", "\\1 \\1's ", $t ); |
181 | | - $t = preg_replace( "/([{$lc}]+)s'( |$)/", "\\1s ", $t ); |
182 | | - |
183 | | - $t = preg_replace( "/\\s+/", " ", $t ); |
184 | | - |
185 | | - if ( $ns == Namespace::getImage() ) { |
186 | | - $t = preg_replace( "/ (png|gif|jpg|jpeg|ogg)$/", "", $t ); |
187 | | - } |
188 | | - return trim( $t ); |
189 | | - } |
190 | | - |
| 260 | + # Get title for search index |
191 | 261 | function getIndexTitle() |
192 | 262 | { |
193 | 263 | return Title::indexTitle( $this->mNamespace, $this->mTextform ); |
194 | 264 | } |
195 | 265 | |
196 | | - /* static */ function makeName( $ns, $title ) |
197 | | - { |
198 | | - global $wgLang; |
199 | | - |
200 | | - $n = $wgLang->getNsText( $ns ); |
201 | | - if ( "" == $n ) { return $title; } |
202 | | - else { return "{$n}:{$title}"; } |
203 | | - } |
204 | | - |
205 | | - /* static */ function makeTitle( $ns, $title ) |
206 | | - { |
207 | | - $t = new Title(); |
208 | | - $t->mDbkeyform = Title::makeName( $ns, $title ); |
209 | | - if( $t->secureAndSplit() ) { |
210 | | - return $t; |
211 | | - } else { |
212 | | - return NULL; |
213 | | - } |
214 | | - } |
215 | | - |
| 266 | + # Get prefixed title with underscores |
216 | 267 | function getPrefixedDBkey() |
217 | 268 | { |
218 | 269 | $s = $this->prefix( $this->mDbkeyform ); |
— | — | @@ -219,9 +270,10 @@ |
220 | 271 | return $s; |
221 | 272 | } |
222 | 273 | |
| 274 | + # Get prefixed title with spaces |
| 275 | + # This is the form usually used for display |
223 | 276 | function getPrefixedText() |
224 | 277 | { |
225 | | - # TEST THIS @@@ |
226 | 278 | if ( empty( $this->mPrefixedText ) ) { |
227 | 279 | $s = $this->prefix( $this->mTextform ); |
228 | 280 | $s = str_replace( "_", " ", $s ); |
— | — | @@ -230,23 +282,27 @@ |
231 | 283 | return $this->mPrefixedText; |
232 | 284 | } |
233 | 285 | |
| 286 | + # Get a URL-encoded title (not an actual URL) including interwiki |
234 | 287 | function getPrefixedURL() |
235 | 288 | { |
236 | 289 | $s = $this->prefix( $this->mDbkeyform ); |
237 | 290 | $s = str_replace( " ", "_", $s ); |
238 | 291 | |
239 | | - $s = urlencode ( $s ) ; |
| 292 | + $s = wfUrlencode ( $s ) ; |
| 293 | + |
240 | 294 | # Cleaning up URL to make it look nice -- is this safe? |
241 | 295 | $s = preg_replace( "/%3[Aa]/", ":", $s ); |
242 | 296 | $s = preg_replace( "/%2[Ff]/", "/", $s ); |
243 | 297 | $s = str_replace( "%28", "(", $s ); |
244 | 298 | $s = str_replace( "%29", ")", $s ); |
| 299 | + |
245 | 300 | return $s; |
246 | 301 | } |
247 | 302 | |
| 303 | + # Get a real URL referring to this title, with interwiki link and fragment |
248 | 304 | function getFullURL() |
249 | 305 | { |
250 | | - global $wgLang, $wgArticlePath; |
| 306 | + global $wgLang, $wgArticlePath, $wgServer, $wgScript; |
251 | 307 | |
252 | 308 | if ( "" == $this->mInterwiki ) { |
253 | 309 | $p = $wgArticlePath; |
— | — | @@ -262,24 +318,67 @@ |
263 | 319 | return $u; |
264 | 320 | } |
265 | 321 | |
| 322 | + # Get a URL with an optional query string, no fragment |
| 323 | + # * If $query=="", it will use $wgArticlePath |
| 324 | + # * Returns a full for an interwiki link, loses any query string |
| 325 | + # * Optionally adds the server and escapes for HTML |
| 326 | + # * Setting $query to "-" makes an old-style URL with nothing in the |
| 327 | + # query except a title |
| 328 | + function getURL( $query = "", $escape = false, $full = false ) |
| 329 | + { |
| 330 | + global $wgLang, $wgArticlePath, $wgScript, $wgServer; |
| 331 | + |
| 332 | + if ( $this->isExternal() ) { |
| 333 | + return $this->getFullURL(); |
| 334 | + } |
| 335 | + |
| 336 | + $dbkey = wfUrlencode( $this->getPrefixedDBkey() ); |
| 337 | + if ( $query == "" ) { |
| 338 | + $url = str_replace( "$1", $dbkey, $wgArticlePath ); |
| 339 | + } else { |
| 340 | + if ( $query == "-" ) { |
| 341 | + $query = ""; |
| 342 | + } |
| 343 | + if ( $wgScript != "" ) { |
| 344 | + $url = "{$wgScript}?title={$dbkey}&{$query}"; |
| 345 | + } else { |
| 346 | + # Top level wiki |
| 347 | + $url = "/{$dbkey}&{$query}"; |
| 348 | + } |
| 349 | + } |
| 350 | + |
| 351 | + if ( $full ) { |
| 352 | + $url = $wgServer . $url; |
| 353 | + } |
| 354 | + |
| 355 | + if ( $escape ) { |
| 356 | + $url = wfEscapeHTML( $url ); |
| 357 | + } |
| 358 | + return $url; |
| 359 | + } |
| 360 | + |
| 361 | + # Get the edit URL, or a null string if it is an interwiki link |
266 | 362 | function getEditURL() |
267 | 363 | { |
268 | 364 | global $wgServer, $wgScript; |
269 | 365 | |
270 | 366 | if ( "" != $this->mInterwiki ) { return ""; } |
271 | | - $s = wfLocalUrl( $this->getPrefixedURL(), "action=edit" ); |
| 367 | + $s = $this->getURL( "action=edit" ); |
272 | 368 | |
273 | 369 | return $s; |
274 | 370 | } |
275 | 371 | |
| 372 | + # Get HTML-escaped displayable text |
276 | 373 | # For the title field in <a> tags |
277 | 374 | function getEscapedText() |
278 | 375 | { |
279 | 376 | return wfEscapeHTML( $this->getPrefixedText() ); |
280 | 377 | } |
281 | 378 | |
| 379 | + # Is the title interwiki? |
282 | 380 | function isExternal() { return ( "" != $this->mInterwiki ); } |
283 | 381 | |
| 382 | + # Does the title correspond to a protected article? |
284 | 383 | function isProtected() |
285 | 384 | { |
286 | 385 | if ( -1 == $this->mNamespace ) { return true; } |
— | — | @@ -288,6 +387,10 @@ |
289 | 388 | return false; |
290 | 389 | } |
291 | 390 | |
| 391 | + # Is the page a log page, i.e. one where the history is messed up by |
| 392 | + # LogPage.php? This used to be used for suppressing diff links in recent |
| 393 | + # changes, but now that's done by setting a flag in the recentchanges |
| 394 | + # table. Hence, this probably is no longer used. |
292 | 395 | function isLog() |
293 | 396 | { |
294 | 397 | if ( $this->mNamespace != Namespace::getWikipedia() ) { |
— | — | @@ -300,6 +403,7 @@ |
301 | 404 | return false; |
302 | 405 | } |
303 | 406 | |
| 407 | + # Is $wgUser is watching this page? |
304 | 408 | function userIsWatching() |
305 | 409 | { |
306 | 410 | global $wgUser; |
— | — | @@ -310,6 +414,7 @@ |
311 | 415 | return $wgUser->isWatched( $this ); |
312 | 416 | } |
313 | 417 | |
| 418 | + # Can $wgUser edit this page? |
314 | 419 | function userCanEdit() |
315 | 420 | { |
316 | 421 | global $wgUser; |
— | — | @@ -327,6 +432,7 @@ |
328 | 433 | return true; |
329 | 434 | } |
330 | 435 | |
| 436 | + # Accessor/initialisation for mRestrictions |
331 | 437 | function getRestrictions() |
332 | 438 | { |
333 | 439 | $id = $this->getArticleID(); |
— | — | @@ -340,6 +446,7 @@ |
341 | 447 | return $this->mRestrictions; |
342 | 448 | } |
343 | 449 | |
| 450 | + # Is there a version of this page in the deletion archive? |
344 | 451 | function isDeleted() { |
345 | 452 | $ns = $this->getNamespace(); |
346 | 453 | $t = wfStrencode( $this->getDBkey() ); |
— | — | @@ -351,6 +458,8 @@ |
352 | 459 | return 0; |
353 | 460 | } |
354 | 461 | |
| 462 | + # Get the article ID from the link cache |
| 463 | + # Used very heavily, e.g. in Parser::replaceInternalLinks() |
355 | 464 | function getArticleID() |
356 | 465 | { |
357 | 466 | global $wgLinkCache; |
— | — | @@ -360,6 +469,9 @@ |
361 | 470 | return $this->mArticleID; |
362 | 471 | } |
363 | 472 | |
| 473 | + # This clears some fields in this object, and clears any associated keys in the |
| 474 | + # "bad links" section of $wgLinkCache. This is called from Article::insertNewArticle() |
| 475 | + # to allow loading of the new cur_id. It's also called from Article::doDeleteArticle() |
364 | 476 | function resetArticleID( $newid ) |
365 | 477 | { |
366 | 478 | global $wgLinkCache; |
— | — | @@ -371,6 +483,8 @@ |
372 | 484 | $this->mRestrictions = array(); |
373 | 485 | } |
374 | 486 | |
| 487 | + # Updates cur_touched |
| 488 | + # Called from LinksUpdate.php |
375 | 489 | function invalidateCache() { |
376 | 490 | $now = wfTimestampNow(); |
377 | 491 | $ns = $this->getNamespace(); |
— | — | @@ -379,6 +493,7 @@ |
380 | 494 | return wfQuery( $sql, DB_WRITE, "Title::invalidateCache" ); |
381 | 495 | } |
382 | 496 | |
| 497 | + # Prefixes some arbitrary text with the namespace or interwiki prefix of this object |
383 | 498 | /* private */ function prefix( $name ) |
384 | 499 | { |
385 | 500 | global $wgLang; |
— | — | @@ -393,6 +508,8 @@ |
394 | 509 | return $p . $name; |
395 | 510 | } |
396 | 511 | |
| 512 | + # Secure and split - main initialisation function for this object |
| 513 | + # |
397 | 514 | # Assumes that mDbkeyform has been set, and is urldecoded |
398 | 515 | # and uses undersocres, but not otherwise munged. This function |
399 | 516 | # removes illegal characters, splits off the winterwiki and |
— | — | @@ -436,19 +553,25 @@ |
437 | 554 | $this->mDbkeyform = $t; |
438 | 555 | $done = false; |
439 | 556 | |
| 557 | + # :Image: namespace |
440 | 558 | if ( 0 == strncasecmp( $imgpre, $t, strlen( $imgpre ) ) ) { |
441 | 559 | $t = substr( $t, 1 ); |
442 | 560 | } |
| 561 | + |
| 562 | + # Redundant initial colon |
443 | 563 | if ( ":" == $t{0} ) { |
444 | 564 | $r = substr( $t, 1 ); |
445 | 565 | } else { |
| 566 | + # Namespace or interwiki prefix |
446 | 567 | if ( preg_match( "/^((?:i|x|[a-z]{2,3})(?:-[a-z0-9]+)?|[A-Za-z0-9_\\x80-\\xff]+):_*(.*)$/", $t, $m ) ) { |
447 | 568 | #$p = strtolower( $m[1] ); |
448 | 569 | $p = $m[1]; |
449 | 570 | if ( $ns = $wgLang->getNsIndex( strtolower( $p ) )) { |
| 571 | + # Ordinary namespace |
450 | 572 | $t = $m[2]; |
451 | 573 | $this->mNamespace = $ns; |
452 | 574 | } elseif ( $this->getInterwikiLink( $p ) ) { |
| 575 | + # Interwiki link |
453 | 576 | $t = $m[2]; |
454 | 577 | $this->mInterwiki = $p; |
455 | 578 | |
— | — | @@ -461,6 +584,8 @@ |
462 | 585 | } |
463 | 586 | $r = $t; |
464 | 587 | } |
| 588 | + |
| 589 | + # Redundant interwiki prefix to the local wiki |
465 | 590 | if ( 0 == strcmp( $this->mInterwiki, $wgLocalInterwiki ) ) { |
466 | 591 | $this->mInterwiki = ""; |
467 | 592 | } |
— | — | @@ -486,19 +611,25 @@ |
487 | 612 | return false; |
488 | 613 | } |
489 | 614 | |
| 615 | + # Initial capital letter |
490 | 616 | if( $this->mInterwiki == "") $t = $wgLang->ucfirst( $r ); |
| 617 | + |
| 618 | + # Fill fields |
491 | 619 | $this->mDbkeyform = $t; |
492 | 620 | $this->mUrlform = wfUrlencode( $t ); |
| 621 | + |
493 | 622 | $this->mTextform = str_replace( "_", " ", $t ); |
494 | 623 | |
495 | 624 | wfProfileOut( $fname ); |
496 | 625 | return true; |
497 | 626 | } |
498 | 627 | |
| 628 | + # Get a title object associated with the talk page of this article |
499 | 629 | function getTalkPage() { |
500 | 630 | return Title::makeTitle( Namespace::getTalk( $this->getNamespace() ), $this->getDBkey() ); |
501 | 631 | } |
502 | 632 | |
| 633 | + # Get a title object associated with the subject page of this talk page |
503 | 634 | function getSubjectPage() { |
504 | 635 | return Title::makeTitle( Namespace::getSubject( $this->getNamespace() ), $this->getDBkey() ); |
505 | 636 | } |
Index: trunk/phase3/includes/SpecialExport.php |
— | — | @@ -19,7 +19,8 @@ |
20 | 20 | } |
21 | 21 | |
22 | 22 | $wgOut->addWikiText( wfMsg( "exporttext" ) ); |
23 | | - $action = wfLocalUrlE( $wgLang->SpecialPage( "Export" ) ); |
| 23 | + $titleObj = Title::makeTitle( NS_SPECIAL, "Export" ); |
| 24 | + $action = $titleObj->getURL( "", true ); |
24 | 25 | $wgOut->addHTML( " |
25 | 26 | <form method='post' action=\"$action\"> |
26 | 27 | <input type='hidden' name='action' value='submit' /> |
Index: trunk/phase3/includes/Article.php |
— | — | @@ -154,8 +154,7 @@ |
155 | 155 | return; |
156 | 156 | } |
157 | 157 | if ( $rt->getNamespace() == Namespace::getSpecial() ) { |
158 | | - $wgOut->redirect( wfLocalUrl( |
159 | | - $rt->getPrefixedURL() ) ); |
| 158 | + $wgOut->redirect( $rt->getURL() ); |
160 | 159 | return; |
161 | 160 | } |
162 | 161 | $rid = $rt->getArticleID(); |
— | — | @@ -431,7 +430,7 @@ |
432 | 431 | # Squid purging |
433 | 432 | if ( $wgUseSquid ) { |
434 | 433 | $urlArr = Array( |
435 | | - $wgInternalServer.wfLocalUrl( $this->mTitle->getPrefixedURL()) |
| 434 | + $wgInternalServer.$this->mTitle->getURL() |
436 | 435 | ); |
437 | 436 | wfPurgeSquidServers($urlArr); |
438 | 437 | /* this needs to be done after LinksUpdate */ |
— | — | @@ -547,7 +546,7 @@ |
548 | 547 | |
549 | 548 | if ( $wgUseSquid ) { |
550 | 549 | $urlArr = Array( |
551 | | - $wgInternalServer.wfLocalUrl( $this->mTitle->getPrefixedURL()) |
| 550 | + $wgInternalServer.$this->mTitle->getURL() |
552 | 551 | ); |
553 | 552 | wfPurgeSquidServers($urlArr); |
554 | 553 | } |
— | — | @@ -578,7 +577,7 @@ |
579 | 578 | $r = "redirect=no"; |
580 | 579 | else |
581 | 580 | $r = ""; |
582 | | - $wgOut->redirect( wfLocalUrl( $this->mTitle->getPrefixedURL(), $r ) ); |
| 581 | + $wgOut->redirect( $this->mTitle->getURL( $r ) ); |
583 | 582 | } |
584 | 583 | |
585 | 584 | # Add this page to my watchlist |
— | — | @@ -651,7 +650,7 @@ |
652 | 651 | } else { |
653 | 652 | $log->addEntry( wfMsg( "protectedarticle", $this->mTitle->getPrefixedText() ), "" ); |
654 | 653 | } |
655 | | - $wgOut->redirect( wfLocalUrl( $this->mTitle->getPrefixedURL() ) ); |
| 654 | + $wgOut->redirect( $this->mTitle->getURL() ); |
656 | 655 | } |
657 | 656 | |
658 | 657 | function unprotect() |
— | — | @@ -767,9 +766,8 @@ |
768 | 767 | $wgOut->setRobotpolicy( "noindex,nofollow" ); |
769 | 768 | $wgOut->addWikiText( wfMsg( "confirmdeletetext" ) ); |
770 | 769 | |
771 | | - $t = $this->mTitle->getPrefixedURL(); |
772 | | - |
773 | | - $formaction = wfEscapeHTML( wfLocalUrl( $t, "action=delete" . $par ) ); |
| 770 | + $formaction = $this->mTitle->getURL( $this->mTitle, "action=delete" . $par, true ); |
| 771 | + |
774 | 772 | $confirm = wfMsg( "confirm" ); |
775 | 773 | $check = wfMsg( "confirmcheck" ); |
776 | 774 | $delcom = wfMsg( "deletecomment" ); |
— | — | @@ -837,7 +835,7 @@ |
838 | 836 | # Squid purging |
839 | 837 | if ( $wgUseSquid ) { |
840 | 838 | $urlArr = Array( |
841 | | - $wgInternalServer.wfLocalUrl( $this->mTitle->getPrefixedURL()) |
| 839 | + $wgInternalServer.$this->mTitle->getURL() |
842 | 840 | ); |
843 | 841 | wfPurgeSquidServers($urlArr); |
844 | 842 | |
— | — | @@ -847,7 +845,7 @@ |
848 | 846 | while ( $BL = wfFetchObject ( $res ) ) |
849 | 847 | { |
850 | 848 | $tobj = Title::newFromDBkey( $BL->l_from) ; |
851 | | - $blurlArr[] = $wgInternalServer.wfLocalUrl( $tobj->getPrefixedURL() ); |
| 849 | + $blurlArr[] = $wgInternalServer.$tobj->getURL(); |
852 | 850 | } |
853 | 851 | wfFreeResult ( $res ) ; |
854 | 852 | $u = new SquidUpdate( $this->mTitle, $blurlArr ); |
— | — | @@ -1092,86 +1090,10 @@ |
1093 | 1091 | |
1094 | 1092 | function preSaveTransform( $text ) |
1095 | 1093 | { |
1096 | | - $s = ""; |
1097 | | - while ( "" != $text ) { |
1098 | | - $p = preg_split( "/<\\s*nowiki\\s*>/i", $text, 2 ); |
1099 | | - $s .= $this->pstPass2( $p[0] ); |
1100 | | - |
1101 | | - if ( ( count( $p ) < 2 ) || ( "" == $p[1] ) ) { $text = ""; } |
1102 | | - else { |
1103 | | - $q = preg_split( "/<\\/\\s*nowiki\\s*>/i", $p[1], 2 ); |
1104 | | - $s .= "<nowiki>{$q[0]}</nowiki>"; |
1105 | | - $text = $q[1]; |
1106 | | - } |
1107 | | - } |
1108 | | - return rtrim( $s ); |
| 1094 | + global $wgParser, $wgUser; |
| 1095 | + return $wgParser->preSaveTransform( $text, $this->mTitle, $wgUser, ParserOptions::newFromUser( $wgUser ) ); |
1109 | 1096 | } |
1110 | | - |
1111 | | - /* private */ function pstPass2( $text ) |
1112 | | - { |
1113 | | - global $wgUser, $wgLang, $wgLocaltimezone; |
1114 | | - |
1115 | | - # Signatures |
1116 | | - # |
1117 | | - $n = $wgUser->getName(); |
1118 | | - $k = $wgUser->getOption( "nickname" ); |
1119 | | - if ( "" == $k ) { $k = $n; } |
1120 | | - if(isset($wgLocaltimezone)) { |
1121 | | - $oldtz = getenv("TZ"); putenv("TZ=$wgLocaltimezone"); |
1122 | | - } |
1123 | | - /* Note: this is an ugly timezone hack for the European wikis */ |
1124 | | - $d = $wgLang->timeanddate( date( "YmdHis" ), false ) . |
1125 | | - " (" . date( "T" ) . ")"; |
1126 | | - if(isset($wgLocaltimezone)) putenv("TZ=$oldtz"); |
1127 | | - |
1128 | | - $text = preg_replace( "/~~~~/", "[[" . $wgLang->getNsText( |
1129 | | - Namespace::getUser() ) . ":$n|$k]] $d", $text ); |
1130 | | - $text = preg_replace( "/~~~/", "[[" . $wgLang->getNsText( |
1131 | | - Namespace::getUser() ) . ":$n|$k]]", $text ); |
1132 | | - |
1133 | | - # Context links: [[|name]] and [[name (context)|]] |
1134 | | - # |
1135 | | - $tc = "[&;%\\-,.\\(\\)' _0-9A-Za-z\\/:\\x80-\\xff]"; |
1136 | | - $np = "[&;%\\-,.' _0-9A-Za-z\\/:\\x80-\\xff]"; # No parens |
1137 | | - $namespacechar = '[ _0-9A-Za-z\x80-\xff]'; # Namespaces can use non-ascii! |
1138 | | - $conpat = "/^({$np}+) \\(({$tc}+)\\)$/"; |
1139 | | - |
1140 | | - $p1 = "/\[\[({$np}+) \\(({$np}+)\\)\\|]]/"; # [[page (context)|]] |
1141 | | - $p2 = "/\[\[\\|({$tc}+)]]/"; # [[|page]] |
1142 | | - $p3 = "/\[\[($namespacechar+):({$np}+)\\|]]/"; # [[namespace:page|]] |
1143 | | - $p4 = "/\[\[($namespacechar+):({$np}+) \\(({$np}+)\\)\\|]]/"; |
1144 | | - # [[ns:page (cont)|]] |
1145 | | - $context = ""; |
1146 | | - $t = $this->mTitle->getText(); |
1147 | | - if ( preg_match( $conpat, $t, $m ) ) { |
1148 | | - $context = $m[2]; |
1149 | | - } |
1150 | | - $text = preg_replace( $p4, "[[\\1:\\2 (\\3)|\\2]]", $text ); |
1151 | | - $text = preg_replace( $p1, "[[\\1 (\\2)|\\1]]", $text ); |
1152 | | - $text = preg_replace( $p3, "[[\\1:\\2|\\2]]", $text ); |
1153 | | - |
1154 | | - if ( "" == $context ) { |
1155 | | - $text = preg_replace( $p2, "[[\\1]]", $text ); |
1156 | | - } else { |
1157 | | - $text = preg_replace( $p2, "[[\\1 ({$context})|\\1]]", $text ); |
1158 | | - } |
1159 | | - |
1160 | | - # {{SUBST:xxx}} variables |
1161 | | - # |
1162 | | - $mw =& MagicWord::get( MAG_SUBST ); |
1163 | | - $text = $mw->substituteCallback( $text, "wfReplaceSubstVar" ); |
1164 | | - |
1165 | | -/* Experimental: |
1166 | | - # Trim trailing whitespace |
1167 | | - # MAG_END (__END__) tag allows for trailing |
1168 | | - # whitespace to be deliberately included |
1169 | | - $text = rtrim( $text ); |
1170 | | - $mw =& MagicWord::get( MAG_END ); |
1171 | | - $mw->matchAndRemove( $text ); |
1172 | | -*/ |
1173 | | - return $text; |
1174 | | - } |
1175 | | - |
| 1097 | + |
1176 | 1098 | /* Caching functions */ |
1177 | 1099 | |
1178 | 1100 | # checkLastModified returns true iff it has taken care of all |
Index: trunk/phase3/includes/SkinCologneBlue.php |
— | — | @@ -19,12 +19,13 @@ |
20 | 20 | |
21 | 21 | $s = ""; |
22 | 22 | $qb = $this->qbSetting(); |
23 | | - |
| 23 | + $mainPageObj = Title::newMainPage(); |
| 24 | + |
24 | 25 | $s .= "\n<div id='content'>\n<div id='topbar'>" . |
25 | 26 | "<table width='100%' border=0 cellspacing=0 cellpadding=8><tr>"; |
26 | 27 | |
27 | 28 | $s .= "<td class='top' align=left valign=middle nowrap>"; |
28 | | - $s .= "<a href=\"" . wfLocalUrlE( urlencode( wfMsg( "mainpage" ) ) ) . "\">"; |
| 29 | + $s .= "<a href=\"" . $mainPageObj->getURL("", true) . "\">"; |
29 | 30 | $s .= "<span id='sitetitle'>" . wfMsg( "sitetitle" ) . "</span></a>"; |
30 | 31 | |
31 | 32 | $s .= "</td><td class='top' align=right valign=bottom width='100%'>"; |
Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -49,12 +49,14 @@ |
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
| 53 | +# Generates a URL from a URL-encoded title and a query string |
| 54 | +# Title::getURL() is preferred in most cases |
| 55 | +# |
53 | 56 | function wfLocalUrl( $a, $q = "" ) |
54 | 57 | { |
55 | 58 | global $wgServer, $wgScript, $wgArticlePath; |
56 | 59 | |
57 | 60 | $a = str_replace( " ", "_", $a ); |
58 | | - #$a = wfUrlencode( $a ); # This stuff is _already_ URL-encoded. |
59 | 61 | |
60 | 62 | if ( "" == $a ) { |
61 | 63 | if( "" == $q ) { |
— | — | @@ -78,12 +80,14 @@ |
79 | 81 | } |
80 | 82 | |
81 | 83 | function wfFullUrl( $a, $q = "" ) { |
82 | | - global $wgServer; |
83 | | - return $wgServer . wfLocalUrl( $a, $q ); |
| 84 | + $titleObj = Title::newFromURL( $a ); |
| 85 | + return $titleObj->getURL( $q, false, true ); |
84 | 86 | } |
85 | 87 | |
86 | 88 | function wfFullUrlE( $a, $q = "" ) { |
87 | | - return wfEscapeHTML( wfFullUrl( $a, $q ) ); |
| 89 | + $titleObj = Title::newFromURL( $a ); |
| 90 | + return $titleObj->getURL( $q, true, true ); |
| 91 | + |
88 | 92 | } |
89 | 93 | |
90 | 94 | function wfImageUrl( $img ) |
— | — | @@ -154,10 +158,11 @@ |
155 | 159 | |
156 | 160 | function wfUrlencode ( $s ) |
157 | 161 | { |
158 | | - $ulink = urlencode( $s ); |
159 | | - $ulink = preg_replace( "/%3[Aa]/", ":", $ulink ); |
160 | | - $ulink = preg_replace( "/%2[Ff]/", "/", $ulink ); |
161 | | - return $ulink; |
| 162 | + $s = urlencode( $s ); |
| 163 | + $s = preg_replace( "/%3[Aa]/", ":", $s ); |
| 164 | + $s = preg_replace( "/%2[Ff]/", "/", $s ); |
| 165 | + |
| 166 | + return $s; |
162 | 167 | } |
163 | 168 | |
164 | 169 | function wfUtf8Sequence($codepoint) { |
— | — | @@ -604,6 +609,7 @@ |
605 | 610 | global $wgUser; |
606 | 611 | $prev = wfMsg( "prevn", $limit ); |
607 | 612 | $next = wfMsg( "nextn", $limit ); |
| 613 | + $link = wfUrlencode( $link ); |
608 | 614 | |
609 | 615 | $sk = $wgUser->getSkin(); |
610 | 616 | if ( 0 != $offset ) { |
— | — | @@ -725,6 +731,7 @@ |
726 | 732 | return "&#$ord;$newText"; |
727 | 733 | } |
728 | 734 | |
| 735 | +# Sets dest to source and returns the original value of dest |
729 | 736 | function wfSetVar( &$dest, $source ) |
730 | 737 | { |
731 | 738 | $temp = $dest; |
— | — | @@ -732,7 +739,8 @@ |
733 | 740 | return $temp; |
734 | 741 | } |
735 | 742 | |
736 | | -function &wfSetRef( &$dest, $source ) |
| 743 | +# Sets dest to a reference to source and returns the original dest |
| 744 | +function &wfSetRef( &$dest, &$source ) |
737 | 745 | { |
738 | 746 | $temp =& $dest; |
739 | 747 | $dest =& $source; |
Index: trunk/phase3/includes/Namespace.php |
— | — | @@ -20,6 +20,10 @@ |
21 | 21 | define("NS_MEDIAWIKI", 8); |
22 | 22 | define("NS_MEDIAWIKI_TALK", 9); |
23 | 23 | |
| 24 | +# Reserved: |
| 25 | +define("NS_TEMPLATE", 10); |
| 26 | +define("NS_TEMPLATE_TALK", 11); |
| 27 | + |
24 | 28 | class Namespace { |
25 | 29 | |
26 | 30 | /* These functions are deprecated */ |
Index: trunk/phase3/includes/SpecialLockdb.php |
— | — | @@ -35,8 +35,8 @@ |
36 | 36 | $lc = wfMsg( "lockconfirm" ); |
37 | 37 | $lb = wfMsg( "lockbtn" ); |
38 | 38 | $elr = wfMsg( "enterlockreason" ); |
39 | | - $action = wfLocalUrlE( $wgLang->specialPage( "Lockdb" ), |
40 | | - "action=submit" ); |
| 39 | + $titleObj = Title::makeTitle( NS_SPECIAL, "Lockdb" ); |
| 40 | + $action = $titleObj->getURL( "action=submit", true ); |
41 | 41 | |
42 | 42 | $wgOut->addHTML( "<p> |
43 | 43 | <form id=\"lockdb\" method=\"post\" action=\"{$action}\"> |
— | — | @@ -76,9 +76,8 @@ |
77 | 77 | $wgLang->timeanddate( wfTimestampNow() ) . ")\n" ); |
78 | 78 | fclose( $fp ); |
79 | 79 | |
80 | | - $success = wfLocalUrl( $wgLang->specialPage( "Lockdb" ), |
81 | | - "action=success" ); |
82 | | - $wgOut->redirect( $success ); |
| 80 | + $titleObj = Title::makeTitle( NS_SPECIAL, "Lockdb" ); |
| 81 | + $wgOut->redirect( $titleObj->getURL( "action=success" ) ); |
83 | 82 | } |
84 | 83 | |
85 | 84 | function showSuccess() |
Index: trunk/phase3/includes/SpecialUnlockdb.php |
— | — | @@ -31,8 +31,8 @@ |
32 | 32 | } |
33 | 33 | $lc = wfMsg( "unlockconfirm" ); |
34 | 34 | $lb = wfMsg( "unlockbtn" ); |
35 | | - $action = wfLocalUrlE( $wgLang->specialPage( "Unlockdb" ), |
36 | | - "action=submit" ); |
| 35 | + $titleObj = Title::makeTitle( NS_SPECIAL, "Unlockdb" ); |
| 36 | + $action = $titleObj->getURL( "action=submit", true ); |
37 | 37 | |
38 | 38 | $wgOut->addHTML( "<p> |
39 | 39 | <form id=\"unlockdb\" method=\"post\" action=\"{$action}\"> |
— | — | @@ -62,8 +62,8 @@ |
63 | 63 | $wgOut->fileDeleteError( $wgReadOnlyFile ); |
64 | 64 | return; |
65 | 65 | } |
66 | | - $success = wfLocalUrl( $wgLang->specialPage( "Unlockdb" ), |
67 | | - "action=success" ); |
| 66 | + $titleObj = Title::makeTitle( NS_SPECIAL, "Unlockdb" ); |
| 67 | + $success = $titleObj->getURL( "action=success" ); |
68 | 68 | $wgOut->redirect( $success ); |
69 | 69 | } |
70 | 70 | |
Index: trunk/phase3/includes/SpecialPreferences.php |
— | — | @@ -237,7 +237,8 @@ |
238 | 238 | $dateopts = $wgLang->getDateFormats(); |
239 | 239 | $togs = $wgLang->getUserToggles(); |
240 | 240 | |
241 | | - $action = wfLocalUrlE( $wgLang->specialPage( "Preferences" )); |
| 241 | + $titleObj = Title::makeTitle( NS_SPECIAL, "Preferences" ); |
| 242 | + $action = $titleObj->getURL( "", true ); |
242 | 243 | |
243 | 244 | $qb = wfMsg( "qbsettings" ); |
244 | 245 | $cp = wfMsg( "changepassword" ); |
Index: trunk/phase3/includes/SpecialUserlogin.php |
— | — | @@ -4,9 +4,7 @@ |
5 | 5 | |
6 | 6 | function wfSpecialUserlogin() |
7 | 7 | { |
8 | | - global $wpCreateaccount, $wpCreateaccountMail; |
9 | | - global $wpLoginattempt, $wpMailmypassword; |
10 | | - global $action, $_REQUEST, $wgCommandLineMode; |
| 8 | + global $wgCommandLineMode; |
11 | 9 | if( !$wgCommandLineMode && !isset( $_COOKIE[ini_get("session.name")] ) ) { |
12 | 10 | User::SetupSession(); |
13 | 11 | } |
— | — | @@ -16,20 +14,20 @@ |
17 | 15 | wfCleanFormFields( $fields ); |
18 | 16 | |
19 | 17 | # When switching accounts, it sucks to get automatically logged out |
20 | | - global $returnto, $wgLang; |
21 | | - if( $returnto == $wgLang->specialPage( "Userlogout" ) ) $returnto = ""; |
| 18 | + global $wgLang; |
| 19 | + if( $_REQUEST['returnto'] == $wgLang->specialPage( "Userlogout" ) ) $_REQUEST['returnto'] = ""; |
22 | 20 | |
23 | 21 | $wpCookieCheck = $_REQUEST[ "wpCookieCheck" ]; |
24 | 22 | |
25 | 23 | if ( isset( $wpCookieCheck ) ) { |
26 | 24 | onCookieRedirectCheck( $wpCookieCheck ); |
27 | | - } else if ( isset( $wpCreateaccount ) ) { |
| 25 | + } else if ( isset( $_REQUEST['wpCreateaccount'] ) ) { |
28 | 26 | addNewAccount(); |
29 | | - } else if ( isset( $wpCreateaccountMail ) ) { |
| 27 | + } else if ( isset( $_REQUEST['wpCreateaccountMail'] ) ) { |
30 | 28 | addNewAccountMailPassword(); |
31 | | - } else if ( isset( $wpMailmypassword ) ) { |
| 29 | + } else if ( isset( $_REQUEST['wpMailmypassword'] ) ) { |
32 | 30 | mailPassword(); |
33 | | - } else if ( "submit" == $action || isset( $wpLoginattempt ) ) { |
| 31 | + } else if ( "submit" == $_REQUEST['action'] || array_key_exists('wpLoginattempt', $_REQUEST) ) { |
34 | 32 | processLogin(); |
35 | 33 | } else { |
36 | 34 | mainLoginForm( "" ); |
— | — | @@ -39,10 +37,10 @@ |
40 | 38 | |
41 | 39 | /* private */ function addNewAccountMailPassword() |
42 | 40 | { |
43 | | - global $wgOut, $wpEmail, $wpName; |
| 41 | + global $wgOut; |
44 | 42 | |
45 | | - if ("" == $wpEmail) { |
46 | | - mainLoginForm( wfMsg( "noemail", $wpName ) ); |
| 43 | + if ("" == $_REQUEST['wpEmail']) { |
| 44 | + mainLoginForm( wfMsg( "noemail", $_REQUEST['wpName'] ) ); |
47 | 45 | return; |
48 | 46 | } |
49 | 47 | |
— | — | @@ -70,8 +68,8 @@ |
71 | 69 | |
72 | 70 | /* private */ function addNewAccount() |
73 | 71 | { |
74 | | - global $wgUser, $wgOut, $wpPassword, $wpRetype, $wpName, $wpRemember; |
75 | | - global $wpEmail, $wgDeferredUpdateList; |
| 72 | + global $wgUser, $wgOut; |
| 73 | + global $wgDeferredUpdateList; |
76 | 74 | |
77 | 75 | $u = addNewAccountInternal(); |
78 | 76 | |
— | — | @@ -95,23 +93,24 @@ |
96 | 94 | |
97 | 95 | /* private */ function addNewAccountInternal() |
98 | 96 | { |
99 | | - global $wgUser, $wgOut, $wpPassword, $wpRetype, $wpName, $wpRemember; |
100 | | - global $wpEmail, $wgMaxNameChars; |
| 97 | + global $wgUser, $wgOut; |
| 98 | + global $wgMaxNameChars; |
101 | 99 | |
102 | 100 | if (!$wgUser->isAllowedToCreateAccount()) { |
103 | 101 | userNotPrivilegedMessage(); |
104 | 102 | return; |
105 | 103 | } |
106 | 104 | |
107 | | - if ( 0 != strcmp( $wpPassword, $wpRetype ) ) { |
| 105 | + if ( 0 != strcmp( $_REQUEST['wpPassword'], $_REQUEST['wpRetype'] ) ) { |
108 | 106 | mainLoginForm( wfMsg( "badretype" ) ); |
109 | 107 | return; |
110 | 108 | } |
111 | | - $wpName = trim( $wpName ); |
112 | | - if ( ( "" == $wpName ) || |
113 | | - preg_match( "/\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}/", $wpName ) || |
114 | | - (strpos( $wpName, "/" ) !== false) || |
115 | | - (strlen( $wpName ) > $wgMaxNameChars) ) |
| 109 | + |
| 110 | + $name = trim( $_REQUEST['wpName'] ); |
| 111 | + if ( ( "" == $name ) || |
| 112 | + preg_match( "/\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}/", $name ) || |
| 113 | + (strpos( $name, "/" ) !== false) || |
| 114 | + (strlen( $name ) > $wgMaxNameChars) ) |
116 | 115 | { |
117 | 116 | mainLoginForm( wfMsg( "noname" ) ); |
118 | 117 | return; |
— | — | @@ -120,16 +119,16 @@ |
121 | 120 | $wgOut->readOnlyPage(); |
122 | 121 | return; |
123 | 122 | } |
124 | | - $u = User::newFromName( $wpName ); |
| 123 | + $u = User::newFromName( $name ); |
125 | 124 | |
126 | 125 | if ( 0 != $u->idForName() ) { |
127 | 126 | mainLoginForm( wfMsg( "userexists" ) ); |
128 | 127 | return; |
129 | 128 | } |
130 | 129 | $u->addToDatabase(); |
131 | | - $u->setPassword( $wpPassword ); |
132 | | - $u->setEmail( $wpEmail ); |
133 | | - if ( 1 == $wpRemember ) { $r = 1; } |
| 130 | + $u->setPassword( $_REQUEST['wpPassword'] ); |
| 131 | + $u->setEmail( $_REQUEST['wpEmail'] ); |
| 132 | + if ( 1 == $_REQUEST['wpRemember'] ) { $r = 1; } |
134 | 133 | else { $r = 0; } |
135 | 134 | $u->setOption( "rememberpassword", $r ); |
136 | 135 | |
— | — | @@ -141,15 +140,14 @@ |
142 | 141 | |
143 | 142 | /* private */ function processLogin() |
144 | 143 | { |
145 | | - global $wgUser, $wpName, $wpPassword, $wpRemember; |
| 144 | + global $wgUser; |
146 | 145 | global $wgDeferredUpdateList; |
147 | | - global $returnto; |
148 | 146 | |
149 | | - if ( "" == $wpName ) { |
| 147 | + if ( "" == $_REQUEST['wpName'] ) { |
150 | 148 | mainLoginForm( wfMsg( "noname" ) ); |
151 | 149 | return; |
152 | 150 | } |
153 | | - $u = User::newFromName( $wpName ); |
| 151 | + $u = User::newFromName( $_REQUEST['wpName'] ); |
154 | 152 | $id = $u->idForName(); |
155 | 153 | if ( 0 == $id ) { |
156 | 154 | mainLoginForm( wfMsg( "nosuchuser", $u->getName() ) ); |
— | — | @@ -157,7 +155,7 @@ |
158 | 156 | } |
159 | 157 | $u->setId( $id ); |
160 | 158 | $u->loadFromDatabase(); |
161 | | - $ep = $u->encryptPassword( $wpPassword ); |
| 159 | + $ep = $u->encryptPassword( $_REQUEST['wpPassword'] ); |
162 | 160 | if ( 0 != strcmp( $ep, $u->getPassword() ) ) { |
163 | 161 | if ( 0 != strcmp( $ep, $u->getNewpassword() ) ) { |
164 | 162 | mainLoginForm( wfMsg( "wrongpassword" ) ); |
— | — | @@ -167,9 +165,9 @@ |
168 | 166 | |
169 | 167 | # We've verified now, update the real record |
170 | 168 | # |
171 | | - if ( 1 == $wpRemember ) { |
| 169 | + if ( 1 == $_REQUEST['wpRemember'] ) { |
172 | 170 | $r = 1; |
173 | | - $u->setCookiePassword( $wpPassword ); |
| 171 | + $u->setCookiePassword( $_REQUEST['wpPassword'] ); |
174 | 172 | } else { |
175 | 173 | $r = 0; |
176 | 174 | } |
— | — | @@ -190,14 +188,14 @@ |
191 | 189 | |
192 | 190 | /* private */ function mailPassword() |
193 | 191 | { |
194 | | - global $wgUser, $wpName, $wgDeferredUpdateList, $wgOutputEncoding; |
| 192 | + global $wgUser, $wgDeferredUpdateList, $wgOutputEncoding; |
195 | 193 | global $wgCookiePath, $wgCookieDomain, $wgDBname; |
196 | 194 | |
197 | | - if ( "" == $wpName ) { |
| 195 | + if ( "" == $_REQUEST['wpName'] ) { |
198 | 196 | mainLoginForm( wfMsg( "noname" ) ); |
199 | 197 | return; |
200 | 198 | } |
201 | | - $u = User::newFromName( $wpName ); |
| 199 | + $u = User::newFromName( $_REQUEST['wpName'] ); |
202 | 200 | $id = $u->idForName(); |
203 | 201 | if ( 0 == $id ) { |
204 | 202 | mainLoginForm( wfMsg( "nosuchuser", $u->getName() ) ); |
— | — | @@ -216,7 +214,7 @@ |
217 | 215 | |
218 | 216 | /* private */ function mailPasswordInternal( $u ) |
219 | 217 | { |
220 | | - global $wpName, $wgDeferredUpdateList, $wgOutputEncoding; |
| 218 | + global $wgDeferredUpdateList, $wgOutputEncoding; |
221 | 219 | global $wgPasswordSender, $wgDBname, $wgIP; |
222 | 220 | |
223 | 221 | if ( "" == $u->getEmail() ) { |
— | — | @@ -271,9 +269,8 @@ |
272 | 270 | |
273 | 271 | /* private */ function mainLoginForm( $err ) |
274 | 272 | { |
275 | | - global $wgUser, $wgOut, $wgLang, $returnto; |
276 | | - global $wpName, $wpPassword, $wpRetype, $wpRemember; |
277 | | - global $wpEmail, $HTTP_COOKIE_VARS, $wgDBname; |
| 273 | + global $wgUser, $wgOut, $wgLang; |
| 274 | + global $HTTP_COOKIE_VARS, $wgDBname; |
278 | 275 | |
279 | 276 | $le = wfMsg( "loginerror" ); |
280 | 277 | $yn = wfMsg( "yourname" ); |
— | — | @@ -289,8 +286,11 @@ |
290 | 287 | $mmp = wfMsg( "mailmypassword" ); |
291 | 288 | $endText = wfMsg( "loginend" ); |
292 | 289 | |
| 290 | + if ( $endText = "<loginend>" ) { |
| 291 | + $endText = ""; |
| 292 | + } |
293 | 293 | |
294 | | - $name = $wpName; |
| 294 | + $name = $_REQUEST['wpName']; |
295 | 295 | if ( "" == $name ) { |
296 | 296 | if ( 0 != $wgUser->getID() ) { |
297 | 297 | $name = $wgUser->getName(); |
— | — | @@ -298,7 +298,7 @@ |
299 | 299 | $name = $HTTP_COOKIE_VARS["{$wgDBname}UserName"]; |
300 | 300 | } |
301 | 301 | } |
302 | | - $pwd = $wpPassword; |
| 302 | + $pwd = $_REQUEST['wpPassword']; |
303 | 303 | |
304 | 304 | $wgOut->setPageTitle( wfMsg( "userlogin" ) ); |
305 | 305 | $wgOut->setRobotpolicy( "noindex,nofollow" ); |
— | — | @@ -317,13 +317,14 @@ |
318 | 318 | $checked = ""; |
319 | 319 | } |
320 | 320 | $q = "action=submit"; |
321 | | - if ( "" != $returnto ) { $q .= "&returnto=" . wfUrlencode($returnto); } |
322 | | - $action = wfLocalUrlE( $wgLang->specialPage( "Userlogin" ), $q ); |
| 321 | + if ( "" != $_REQUEST['returnto'] ) { $q .= "&returnto=" . wfUrlencode($_REQUEST['returnto']); } |
| 322 | + $titleObj = Title::makeTitle( NS_SPECIAL, "Userlogin" ); |
| 323 | + $action = $titleObj->getURL( $q, true ); |
323 | 324 | |
324 | | - $wpName = wfEscapeHTML( $wpName ); |
325 | | - $wpPassword = wfEscapeHTML( $wpPassword ); |
326 | | - $wpRetype = wfEscapeHTML( $wpRetype ); |
327 | | - $wpEmail = wfEscapeHTML( $wpEmail ); |
| 325 | + $encName = wfEscapeHTML( $name ); |
| 326 | + $encPassword = wfEscapeHTML( $pwd ); |
| 327 | + $encRetype = wfEscapeHTML( $_REQUEST['wpRetype'] ); |
| 328 | + $encEmail = wfEscapeHTML( $_REQUEST['wpEmail'] ); |
328 | 329 | |
329 | 330 | if ($wgUser->getID() != 0) { |
330 | 331 | $cambutton = "<input tabindex=6 type=submit name=\"wpCreateaccountMail\" value=\"{$cam}\">"; |
— | — | @@ -334,7 +335,7 @@ |
335 | 336 | <table border=0><tr> |
336 | 337 | <td align=right>$yn:</td> |
337 | 338 | <td align=left> |
338 | | -<input tabindex=1 type=text name=\"wpName\" value=\"{$name}\" size=20> |
| 339 | +<input tabindex=1 type=text name=\"wpName\" value=\"{$encName}\" size=20> |
339 | 340 | </td> |
340 | 341 | <td align=left> |
341 | 342 | <input tabindex=3 type=submit name=\"wpLoginattempt\" value=\"{$li}\"> |
— | — | @@ -343,7 +344,7 @@ |
344 | 345 | <tr> |
345 | 346 | <td align=right>$yp:</td> |
346 | 347 | <td align=left> |
347 | | -<input tabindex=2 type=password name=\"wpPassword\" value=\"{$pwd}\" size=20> |
| 348 | +<input tabindex=2 type=password name=\"wpPassword\" value=\"{$encPassword}\" size=20> |
348 | 349 | </td> |
349 | 350 | <td align=left> |
350 | 351 | <input tabindex=7 type=checkbox name=\"wpRemember\" value=\"1\" id=\"wpRemember\"$checked><label for=\"wpRemember\">$rmp</label> |
— | — | @@ -351,17 +352,18 @@ |
352 | 353 | </tr>"); |
353 | 354 | |
354 | 355 | if ($wgUser->isAllowedToCreateAccount()) { |
355 | | - |
| 356 | + $encRetype = htmlspecialchars( $_REQUEST['wpRetype'] ); |
| 357 | + $encEmail = htmlspecialchars( $_REQUEST['wpCreateAccount'] ); |
356 | 358 | $wgOut->addHTML("<tr><td colspan=3> </td></tr><tr> |
357 | 359 | <td align=right>$ypa:</td> |
358 | 360 | <td align=left> |
359 | | -<input tabindex=4 type=password name=\"wpRetype\" value=\"{$wpRetype}\" |
| 361 | +<input tabindex=4 type=password name=\"wpRetype\" value=\"{$encRetype}\" |
360 | 362 | size=20> |
361 | 363 | </td><td>$nuo</td></tr> |
362 | 364 | <tr> |
363 | 365 | <td align=right>$ye:</td> |
364 | 366 | <td align=left> |
365 | | -<input tabindex=5 type=text name=\"wpEmail\" value=\"{$wpEmail}\" size=20> |
| 367 | +<input tabindex=5 type=text name=\"wpEmail\" value=\"{$encEmail}\" size=20> |
366 | 368 | </td><td align=left> |
367 | 369 | <input tabindex=6 type=submit name=\"wpCreateaccount\" value=\"{$ca}\"> |
368 | 370 | $cambutton |
— | — | @@ -388,8 +390,8 @@ |
389 | 391 | { |
390 | 392 | global $wgOut, $wgLang; |
391 | 393 | |
392 | | - $check = wfLocalUrl( wfUrlEncode( $wgLang->specialPage( "Userlogin" ) ), |
393 | | - "wpCookieCheck=$type" ); |
| 394 | + $titleObj = Title::makeTitle( NS_SPECIAL, "Userlogin" ); |
| 395 | + $check = $titleObj->getURL( "wpCookieCheck=$type" ); |
394 | 396 | |
395 | 397 | return $wgOut->redirect( $check ); |
396 | 398 | } |
Index: trunk/phase3/includes/SpecialWhatlinkshere.php |
— | — | @@ -8,7 +8,7 @@ |
9 | 9 | if($par) { |
10 | 10 | $target = $par; |
11 | 11 | } else { |
12 | | - $target = wfCleanQueryVar( $_REQUEST['target'] ); |
| 12 | + $target = $_REQUEST['target'] ; |
13 | 13 | } |
14 | 14 | if ( "" == $target ) { |
15 | 15 | $wgOut->errorpage( "notargettitle", "notargettext" ); |
Index: trunk/phase3/includes/SquidUpdate.php |
— | — | @@ -21,7 +21,7 @@ |
22 | 22 | while ( $BL = wfFetchObject ( $res ) ) |
23 | 23 | { |
24 | 24 | $t = Title::newFromDBkey( $BL->l_from) ; |
25 | | - $this->urlArr[] = $wgInternalServer.wfLocalUrl( $t->getPrefixedURL() ); |
| 25 | + $this->urlArr[] = $wgInternalServer.$t->getURL() ; |
26 | 26 | } |
27 | 27 | wfFreeResult ( $res ) ; |
28 | 28 | |
Index: trunk/phase3/includes/SearchEngine.php |
— | — | @@ -130,8 +130,10 @@ |
131 | 131 | wfMsg("powersearch") . "\">\n"; |
132 | 132 | $ret = str_replace( "$9", $tempText, $ret ); |
133 | 133 | |
| 134 | + $titleObj = NULL; # this does tricky stuff |
| 135 | + |
134 | 136 | $ret = "<br><br>\n<form id=\"powersearch\" method=\"get\" " . |
135 | | - "action=\"" . wfLocalUrl( "" ) . "\">\n{$ret}\n</form>\n"; |
| 137 | + "action=\"" . $titleObj->getUrl() . "\">\n{$ret}\n</form>\n"; |
136 | 138 | |
137 | 139 | if ( isset ( $searchx ) ) { |
138 | 140 | if ( ! $listredirs ) { |
— | — | @@ -433,7 +435,7 @@ |
434 | 436 | } |
435 | 437 | |
436 | 438 | if ( 0 != $t->getArticleID() ) { |
437 | | - $wgOut->redirect( wfLocalUrl( $t->getPrefixedURL() ) ); |
| 439 | + $wgOut->redirect( $t->getURL() ); |
438 | 440 | return; |
439 | 441 | } |
440 | 442 | |
— | — | @@ -441,7 +443,7 @@ |
442 | 444 | # |
443 | 445 | $t = Title::newFromText( strtolower( $search ) ); |
444 | 446 | if ( 0 != $t->getArticleID() ) { |
445 | | - $wgOut->redirect( wfLocalUrl( $t->getPrefixedURL() ) ); |
| 447 | + $wgOut->redirect( $t->getURL() ); |
446 | 448 | return; |
447 | 449 | } |
448 | 450 | |
— | — | @@ -449,7 +451,7 @@ |
450 | 452 | # |
451 | 453 | $t = Title::newFromText( ucwords( strtolower( $search ) ) ); |
452 | 454 | if ( 0 != $t->getArticleID() ) { |
453 | | - $wgOut->redirect( wfLocalUrl( $t->getPrefixedURL() ) ); |
| 455 | + $wgOut->redirect( $t->getURL() ); |
454 | 456 | return; |
455 | 457 | } |
456 | 458 | |
— | — | @@ -457,13 +459,14 @@ |
458 | 460 | # |
459 | 461 | $t = Title::newFromText( strtoupper( $search ) ); |
460 | 462 | if ( 0 != $t->getArticleID() ) { |
461 | | - $wgOut->redirect( wfLocalUrl( $t->getPrefixedURL() ) ); |
| 463 | + $wgOut->redirect( $t->getURL() ); |
462 | 464 | return; |
463 | 465 | } |
464 | | - $wgOut->addHTML( wfMsg("nogomatch", |
465 | | - htmlspecialchars( wfLocalUrl( ucfirst($this->mUsertext), "action=edit") ) ) |
466 | | - . "\n<p>" ); |
467 | 466 | |
| 467 | + # No match, generate an edit URL |
| 468 | + $t = Title::newFromText( $this->mUsertext ); |
| 469 | + $wgOut->addHTML( wfMsg("nogomatch", $t->getURL( "action=edit", true ) ) . "\n<p>" ); |
| 470 | + |
468 | 471 | # Try a fuzzy title search |
469 | 472 | $anyhit = false; |
470 | 473 | global $wgDisableFuzzySearch; |
Index: trunk/phase3/includes/Parser.php |
— | — | @@ -9,15 +9,18 @@ |
10 | 10 | # Globals used: |
11 | 11 | # objects: $wgLang, $wgDateFormatter, $wgLinkCache, $wgCurOut |
12 | 12 | # |
| 13 | +# NOT $wgArticle, $wgUser or $wgTitle. Keep them away! |
| 14 | +# |
13 | 15 | # settings: $wgUseTex*, $wgUseCategoryMagic*, $wgUseDynamicDates*, $wgInterwikiMagic*, |
14 | | -# $wgNamespacesWithSubpages, $wgLanguageCode, $wgAllowExternalImages* |
| 16 | +# $wgNamespacesWithSubpages, $wgLanguageCode, $wgAllowExternalImages*, |
| 17 | +# $wgLocaltimezone |
15 | 18 | # |
16 | 19 | # * only within ParserOptions |
17 | 20 | |
18 | 21 | class Parser |
19 | 22 | { |
20 | 23 | # Cleared with clearState(): |
21 | | - var $mOutput, $mAutonumber, $mLastSection, $mDTopen; |
| 24 | + var $mOutput, $mAutonumber, $mLastSection, $mDTopen, $mStripState; |
22 | 25 | |
23 | 26 | # Temporary: |
24 | 27 | var $mOptions, $mTitle; |
— | — | @@ -33,6 +36,7 @@ |
34 | 37 | $this->mAutonumber = 0; |
35 | 38 | $this->mLastSection = ""; |
36 | 39 | $this->mDTopen = false; |
| 40 | + $this->mStripState = false; |
37 | 41 | } |
38 | 42 | |
39 | 43 | # First pass--just handle <nowiki> sections, pass the rest off |
— | — | @@ -44,18 +48,6 @@ |
45 | 49 | { |
46 | 50 | $fname = "Parser::parse"; |
47 | 51 | wfProfileIn( $fname ); |
48 | | - $unique = "3iyZiyA7iMwg5rhxP0Dcc9oTnj8qD1jm1Sfv4"; |
49 | | - $unique2 = "4LIQ9nXtiYFPCSfitVwDw7EYwQlL4GeeQ7qSO"; |
50 | | - $unique3 = "fPaA8gDfdLBqzj68Yjg9Hil3qEF8JGO0uszIp"; |
51 | | - $nwlist = array(); |
52 | | - $nwsecs = 0; |
53 | | - $mathlist = array(); |
54 | | - $mathsecs = 0; |
55 | | - $prelist = array (); |
56 | | - $presecs = 0; |
57 | | - $stripped = ""; |
58 | | - $stripped2 = ""; |
59 | | - $stripped3 = ""; |
60 | 52 | |
61 | 53 | if ( $clearState ) { |
62 | 54 | $this->clearState(); |
— | — | @@ -64,20 +56,63 @@ |
65 | 57 | $this->mOptions = $options; |
66 | 58 | $this->mTitle =& $title; |
67 | 59 | |
| 60 | + $stripState = NULL; |
| 61 | + $text = $this->strip( $text, $this->mStripState, true ); |
| 62 | + $text = $this->doWikiPass2( $text, $linestart ); |
| 63 | + $text = $this->unstrip( $text, $this->mStripState ); |
| 64 | + |
| 65 | + $this->mOutput->setText( $text ); |
| 66 | + wfProfileOut( $fname ); |
| 67 | + return $this->mOutput; |
| 68 | + } |
| 69 | + |
| 70 | + /* static */ function getRandomString() |
| 71 | + { |
| 72 | + return dechex(mt_rand(0, 0x7fffffff)) . dechex(mt_rand(0, 0x7fffffff)); |
| 73 | + } |
| 74 | + |
| 75 | + # Strips <nowiki>, <pre> and <math> |
| 76 | + # Returns the text, and fills an array with data needed in unstrip() |
| 77 | + # |
| 78 | + function strip( $text, &$state, $render = true ) |
| 79 | + { |
| 80 | + $state = array( |
| 81 | + 'nwlist' => array(), |
| 82 | + 'nwsecs' => 0, |
| 83 | + 'nwunq' => Parser::getRandomString(), |
| 84 | + 'mathlist' => array(), |
| 85 | + 'mathsecs' => 0, |
| 86 | + 'mathunq' => Parser::getRandomString(), |
| 87 | + 'prelist' => array(), |
| 88 | + 'presecs' => 0, |
| 89 | + 'preunq' => Parser::getRandomString() |
| 90 | + ); |
| 91 | + |
| 92 | + $stripped = ""; |
| 93 | + $stripped2 = ""; |
| 94 | + $stripped3 = ""; |
| 95 | + |
68 | 96 | # Replace any instances of the placeholders |
69 | | - $text = str_replace( $unique, wfHtmlEscapeFirst( $unique ), $text ); |
70 | | - $text = str_replace( $unique2, wfHtmlEscapeFirst( $unique2 ), $text ); |
71 | | - $text = str_replace( $unique3, wfHtmlEscapeFirst( $unique3 ), $text ); |
72 | | - |
| 97 | + $text = str_replace( $state['nwunq'], wfHtmlEscapeFirst( $state['nwunq'] ), $text ); |
| 98 | + $text = str_replace( $state['mathunq'], wfHtmlEscapeFirst( $state['mathunq'] ), $text ); |
| 99 | + $text = str_replace( $state['preunq'], wfHtmlEscapeFirst( $state['preunq'] ), $text ); |
| 100 | + |
73 | 101 | while ( "" != $text ) { |
74 | 102 | $p = preg_split( "/<\\s*nowiki\\s*>/i", $text, 2 ); |
75 | 103 | $stripped .= $p[0]; |
76 | | - if ( ( count( $p ) < 2 ) || ( "" == $p[1] ) ) { $text = ""; } |
77 | | - else { |
| 104 | + if ( ( count( $p ) < 2 ) || ( "" == $p[1] ) ) { |
| 105 | + $text = ""; |
| 106 | + } else { |
78 | 107 | $q = preg_split( "/<\\/\\s*nowiki\\s*>/i", $p[1], 2 ); |
79 | | - ++$nwsecs; |
80 | | - $nwlist[$nwsecs] = wfEscapeHTMLTagsOnly($q[0]); |
81 | | - $stripped .= $unique . $nwsecs . "s"; |
| 108 | + ++$state['nwsecs']; |
| 109 | + |
| 110 | + if ( $render ) { |
| 111 | + $state['nwlist'][$state['nwsecs']] = wfEscapeHTMLTagsOnly($q[0]); |
| 112 | + } else { |
| 113 | + $state['nwlist'][$state['nwsecs']] = "<nowiki>{$q[0]}</nowiki>"; |
| 114 | + } |
| 115 | + |
| 116 | + $stripped .= $state['nwunq'] . sprintf("%08X", $state['nwsecs']); |
82 | 117 | $text = $q[1]; |
83 | 118 | } |
84 | 119 | } |
— | — | @@ -86,12 +121,19 @@ |
87 | 122 | while ( "" != $stripped ) { |
88 | 123 | $p = preg_split( "/<\\s*math\\s*>/i", $stripped, 2 ); |
89 | 124 | $stripped2 .= $p[0]; |
90 | | - if ( ( count( $p ) < 2 ) || ( "" == $p[1] ) ) { $stripped = ""; } |
91 | | - else { |
| 125 | + if ( ( count( $p ) < 2 ) || ( "" == $p[1] ) ) { |
| 126 | + $stripped = ""; |
| 127 | + } else { |
92 | 128 | $q = preg_split( "/<\\/\\s*math\\s*>/i", $p[1], 2 ); |
93 | | - ++$mathsecs; |
94 | | - $mathlist[$mathsecs] = renderMath($q[0]); |
95 | | - $stripped2 .= $unique2 . $mathsecs . "s"; |
| 129 | + ++$state['mathsecs']; |
| 130 | + |
| 131 | + if ( $render ) { |
| 132 | + $state['mathlist'][$state['mathsecs']] = renderMath($q[0]); |
| 133 | + } else { |
| 134 | + $state['mathlist'][$state['mathsecs']] = "<math>{$q[0]}</math>"; |
| 135 | + } |
| 136 | + |
| 137 | + $stripped2 .= $state['mathunq'] . sprintf("%08X", $state['mathsecs']); |
96 | 138 | $stripped = $q[1]; |
97 | 139 | } |
98 | 140 | } |
— | — | @@ -102,40 +144,39 @@ |
103 | 145 | while ( "" != $stripped2 ) { |
104 | 146 | $p = preg_split( "/<\\s*pre\\s*>/i", $stripped2, 2 ); |
105 | 147 | $stripped3 .= $p[0]; |
106 | | - if ( ( count( $p ) < 2 ) || ( "" == $p[1] ) ) { $stripped2 = ""; } |
107 | | - else { |
| 148 | + if ( ( count( $p ) < 2 ) || ( "" == $p[1] ) ) { |
| 149 | + $stripped2 = ""; |
| 150 | + } else { |
108 | 151 | $q = preg_split( "/<\\/\\s*pre\\s*>/i", $p[1], 2 ); |
109 | | - ++$presecs; |
110 | | - $prelist[$presecs] = "<pre>". wfEscapeHTMLTagsOnly($q[0]). "</pre>\n"; |
111 | | - $stripped3 .= $unique3 . $presecs . "s"; |
| 152 | + ++$state['presecs']; |
| 153 | + |
| 154 | + if ( $render ) { |
| 155 | + $state['prelist'][$state['presecs']] = "<pre>". wfEscapeHTMLTagsOnly($q[0]). "</pre>\n"; |
| 156 | + } else { |
| 157 | + $state['prelist'][$state['presecs']] = "<pre>{$q[0]}</pre>"; |
| 158 | + } |
| 159 | + |
| 160 | + $stripped3 .= $state['preunq'] . sprintf("%08X", $state['presecs']); |
112 | 161 | $stripped2 = $q[1]; |
113 | 162 | } |
114 | 163 | } |
| 164 | + return $stripped3; |
| 165 | + } |
115 | 166 | |
116 | | - $text = $this->doWikiPass2( $stripped3, $linestart ); |
117 | | - |
118 | | - $specialChars = array("\\", "$"); |
119 | | - $escapedChars = array("\\\\", "\\$"); |
120 | | - |
121 | | - # Go backwards so that {$unique1}1 doesn't overwrite {$unique1}10 |
122 | | - for ( $i = $presecs; $i >= 1; --$i ) { |
123 | | - $text = preg_replace( "/{$unique3}{$i}s/", str_replace( $specialChars, |
124 | | - $escapedChars, $prelist[$i] ), $text ); |
| 167 | + function unstrip( $text, &$state ) |
| 168 | + { |
| 169 | + for ( $i = 1; $i <= $state['presecs']; ++$i ) { |
| 170 | + $text = str_replace( $state['preunq'] . sprintf("%08X", $i), $state['prelist'][$i], $text ); |
125 | 171 | } |
126 | 172 | |
127 | | - for ( $i = $mathsecs; $i >= 1; --$i ) { |
128 | | - $text = preg_replace( "/{$unique2}{$i}s/", str_replace( $specialChars, |
129 | | - $escapedChars, $mathlist[$i] ), $text ); |
| 173 | + for ( $i = 1; $i <= $state['mathsecs']; ++$i ) { |
| 174 | + $text = str_replace( $state['mathunq'] . sprintf("%08X", $i), $state['mathlist'][$i], $text ); |
130 | 175 | } |
131 | 176 | |
132 | | - for ( $i = $nwsecs; $i >= 1; --$i ) { |
133 | | - $text = preg_replace( "/{$unique}{$i}s/", str_replace( $specialChars, |
134 | | - $escapedChars, $nwlist[$i] ), $text ); |
| 177 | + for ( $i = 1; $i <= $state['nwsecs']; ++$i ) { |
| 178 | + $text = str_replace( $state['nwunq'] . sprintf("%08X", $i), $state['nwlist'][$i], $text ); |
135 | 179 | } |
136 | | - |
137 | | - $this->mOutput->setText( $text ); |
138 | | - wfProfileOut( $fname ); |
139 | | - return $this->mOutput; |
| 180 | + return $text; |
140 | 181 | } |
141 | 182 | |
142 | 183 | function categoryMagic () |
— | — | @@ -1182,8 +1223,9 @@ |
1183 | 1224 | } |
1184 | 1225 | |
1185 | 1226 | // The canonized header is a version of the header text safe to use for links |
1186 | | - |
1187 | | - $canonized_headline=preg_replace("/<.*?>/","",$headline); // strip out HTML |
| 1227 | + // Avoid insertion of weird stuff like <math> by expanding the relevant sections |
| 1228 | + $canonized_headline=Parser::unstrip( $headline, $this->mStripState ); |
| 1229 | + $canonized_headline=preg_replace("/<.*?>/","",$canonized_headline); // strip out HTML |
1188 | 1230 | $tocline = trim( $canonized_headline ); |
1189 | 1231 | $canonized_headline=str_replace('"',"",$canonized_headline); |
1190 | 1232 | $canonized_headline=str_replace(" ","_",trim($canonized_headline)); |
— | — | @@ -1287,8 +1329,8 @@ |
1288 | 1330 | if ( "" == $num ) { |
1289 | 1331 | $text .= "ISBN $blank$x"; |
1290 | 1332 | } else { |
1291 | | - $text .= "<a href=\"" . wfLocalUrlE( $wgLang->specialPage( |
1292 | | - "Booksources"), "isbn={$num}" ) . "\" class=\"internal\">ISBN $isbn</a>"; |
| 1333 | + $titleObj = Title::makeTitle( NS_SPECIAL, "Booksources" ); |
| 1334 | + $text .= "<a href=\"" . $titleObj->getUrl( "isbn={$num}", false, true ) . "\" class=\"internal\">ISBN $isbn</a>"; |
1293 | 1335 | $text .= $x; |
1294 | 1336 | } |
1295 | 1337 | } |
— | — | @@ -1300,7 +1342,86 @@ |
1301 | 1343 | return $text; |
1302 | 1344 | } |
1303 | 1345 | |
| 1346 | + function preSaveTransform( $text, &$title, &$user, $options, $clearState = true ) |
| 1347 | + { |
| 1348 | + $this->mOptions = $options; |
| 1349 | + $this->mTitle = $title; |
| 1350 | + if ( $clearState ) { |
| 1351 | + $this->clearState; |
| 1352 | + } |
| 1353 | + |
| 1354 | + $stripState = false; |
| 1355 | + $text = $this->strip( $text, $stripState, false ); |
| 1356 | + $text = $this->pstPass2( $text, $user ); |
| 1357 | + $text = $this->unstrip( $text, $stripState ); |
| 1358 | + return $text; |
| 1359 | + } |
1304 | 1360 | |
| 1361 | + /* private */ function pstPass2( $text, &$user ) |
| 1362 | + { |
| 1363 | + global $wgLang, $wgLocaltimezone; |
| 1364 | + |
| 1365 | + # Signatures |
| 1366 | + # |
| 1367 | + $n = $user->getName(); |
| 1368 | + $k = $user->getOption( "nickname" ); |
| 1369 | + if ( "" == $k ) { $k = $n; } |
| 1370 | + if(isset($wgLocaltimezone)) { |
| 1371 | + $oldtz = getenv("TZ"); putenv("TZ=$wgLocaltimezone"); |
| 1372 | + } |
| 1373 | + /* Note: this is an ugly timezone hack for the European wikis */ |
| 1374 | + $d = $wgLang->timeanddate( date( "YmdHis" ), false ) . |
| 1375 | + " (" . date( "T" ) . ")"; |
| 1376 | + if(isset($wgLocaltimezone)) putenv("TZ=$oldtz"); |
| 1377 | + |
| 1378 | + $text = preg_replace( "/~~~~/", "[[" . $wgLang->getNsText( |
| 1379 | + Namespace::getUser() ) . ":$n|$k]] $d", $text ); |
| 1380 | + $text = preg_replace( "/~~~/", "[[" . $wgLang->getNsText( |
| 1381 | + Namespace::getUser() ) . ":$n|$k]]", $text ); |
| 1382 | + |
| 1383 | + # Context links: [[|name]] and [[name (context)|]] |
| 1384 | + # |
| 1385 | + $tc = "[&;%\\-,.\\(\\)' _0-9A-Za-z\\/:\\x80-\\xff]"; |
| 1386 | + $np = "[&;%\\-,.' _0-9A-Za-z\\/:\\x80-\\xff]"; # No parens |
| 1387 | + $namespacechar = '[ _0-9A-Za-z\x80-\xff]'; # Namespaces can use non-ascii! |
| 1388 | + $conpat = "/^({$np}+) \\(({$tc}+)\\)$/"; |
| 1389 | + |
| 1390 | + $p1 = "/\[\[({$np}+) \\(({$np}+)\\)\\|]]/"; # [[page (context)|]] |
| 1391 | + $p2 = "/\[\[\\|({$tc}+)]]/"; # [[|page]] |
| 1392 | + $p3 = "/\[\[($namespacechar+):({$np}+)\\|]]/"; # [[namespace:page|]] |
| 1393 | + $p4 = "/\[\[($namespacechar+):({$np}+) \\(({$np}+)\\)\\|]]/"; |
| 1394 | + # [[ns:page (cont)|]] |
| 1395 | + $context = ""; |
| 1396 | + $t = $this->mTitle->getText(); |
| 1397 | + if ( preg_match( $conpat, $t, $m ) ) { |
| 1398 | + $context = $m[2]; |
| 1399 | + } |
| 1400 | + $text = preg_replace( $p4, "[[\\1:\\2 (\\3)|\\2]]", $text ); |
| 1401 | + $text = preg_replace( $p1, "[[\\1 (\\2)|\\1]]", $text ); |
| 1402 | + $text = preg_replace( $p3, "[[\\1:\\2|\\2]]", $text ); |
| 1403 | + |
| 1404 | + if ( "" == $context ) { |
| 1405 | + $text = preg_replace( $p2, "[[\\1]]", $text ); |
| 1406 | + } else { |
| 1407 | + $text = preg_replace( $p2, "[[\\1 ({$context})|\\1]]", $text ); |
| 1408 | + } |
| 1409 | + |
| 1410 | + # {{SUBST:xxx}} variables |
| 1411 | + # |
| 1412 | + $mw =& MagicWord::get( MAG_SUBST ); |
| 1413 | + $text = $mw->substituteCallback( $text, "wfReplaceSubstVar" ); |
| 1414 | + |
| 1415 | + # Trim trailing whitespace |
| 1416 | + # MAG_END (__END__) tag allows for trailing |
| 1417 | + # whitespace to be deliberately included |
| 1418 | + $text = rtrim( $text ); |
| 1419 | + $mw =& MagicWord::get( MAG_END ); |
| 1420 | + $mw->matchAndRemove( $text ); |
| 1421 | + |
| 1422 | + return $text; |
| 1423 | + } |
| 1424 | + |
| 1425 | + |
1305 | 1426 | } |
1306 | 1427 | |
1307 | 1428 | class ParserOutput |
— | — | @@ -1398,6 +1519,8 @@ |
1399 | 1520 | $this->mNumberHeadings = $user->getOption( "numberheadings" ); |
1400 | 1521 | $this->mShowToc = $user->getOption( "showtoc" ); |
1401 | 1522 | } |
| 1523 | + |
| 1524 | + |
1402 | 1525 | } |
1403 | 1526 | |
1404 | 1527 | # Regex callbacks, used in OutputPage::replaceVariables |
Index: trunk/phase3/includes/PageHistory.php |
— | — | @@ -106,7 +106,7 @@ |
107 | 107 | global $wgTitle; |
108 | 108 | $this->lastdate = $this->lastline = ""; |
109 | 109 | $s = "\n<p>" . wfMsg( "histlegend" ) . "\n<ul>"; |
110 | | - $url = wfLocalUrl( $wgTitle->getPrefixedText(), "dummy=1"); |
| 110 | + $url = $wgTitle->getURL("-"); |
111 | 111 | $s .= "<SCRIPT> |
112 | 112 | var sel = -1; |
113 | 113 | function anysel(oid){ |
Index: trunk/phase3/includes/Setup.php |
— | — | @@ -74,7 +74,16 @@ |
75 | 75 | wfDebug( "$REQUEST_METHOD $REQUEST_URI\n" ); |
76 | 76 | } |
77 | 77 | |
| 78 | +# Fix "magic" quotes |
| 79 | +if ( get_magic_quotes_gpc() ) { |
| 80 | + foreach ( $_REQUEST as $field => $value ) { |
| 81 | + $_REQUEST[$field] = stripslashes( $value ); |
| 82 | + print "$field: $value -> {$_REQUEST[$field]}<br>\n"; |
| 83 | + } |
| 84 | +} |
78 | 85 | |
| 86 | +# Set up Memcached |
| 87 | +# |
79 | 88 | class MemCachedClientforWiki extends memcached { |
80 | 89 | function _debugprint( $text ) { |
81 | 90 | wfDebug( "memcached: $text\n" ); |
Index: trunk/phase3/includes/SkinSmarty.php |
— | — | @@ -75,12 +75,12 @@ |
76 | 76 | global $wgLang; |
77 | 77 | $action = ""; |
78 | 78 | $popup = ""; |
79 | | - $page = ""; |
| 79 | + $title = NULL; |
80 | 80 | |
81 | 81 | if($params['action']) $action = "action=" . $params['action']; |
82 | 82 | |
83 | 83 | if($params['special']) { |
84 | | - $page = $wgLang->specialPage( $params['special'] ); |
| 84 | + $title = Title::makeTitle( NS_SPECIAL, $params['special'] ); |
85 | 85 | #$text = $wgLang->getSpecialPageName( $params['special'] ); |
86 | 86 | $text = $popup = $params['special']; |
87 | 87 | if($params['target']) $action .= "target=" . urlencode( $params['target'] ); |
— | — | @@ -93,10 +93,9 @@ |
94 | 94 | $title = Title::makeTitle( $title->getNamespace() ^ 1, $title->getDbKey() ); |
95 | 95 | } |
96 | 96 | $text = $popup = $title->getPrefixedText(); |
97 | | - $page = urlencode( $title->getPrefixedUrl() ); |
98 | 97 | } |
99 | 98 | |
100 | | - $url = wfLocalUrlE( $page, $action ); |
| 99 | + $url = $title->getURL( $action, true ); |
101 | 100 | |
102 | 101 | if($params['text']) $text = $params['text']; |
103 | 102 | if($params['key']) $text = wfMsg( $params['key'] ); |
Index: trunk/phase3/includes/Skin.php |
— | — | @@ -175,14 +175,13 @@ |
176 | 176 | (!$wgTitle->isProtected() || $wgUser->isSysop()) |
177 | 177 | |
178 | 178 | ) { |
179 | | - $n = $wgTitle->getPrefixedURL(); |
180 | 179 | $t = wfMsg( "editthispage" ); |
181 | 180 | $oid = $red = ""; |
182 | 181 | if ( $redirect ) { $red = "&redirect={$redirect}"; } |
183 | 182 | if ( $oldid && ! isset( $diff ) ) { |
184 | 183 | $oid = "&oldid={$oldid}"; |
185 | 184 | } |
186 | | - $s = wfLocalUrlE($n,"action=edit{$oid}{$red}"); |
| 185 | + $s = $wgTitle->getUrl( "action=edit{$oid}{$red}", false, true ); |
187 | 186 | $s = "document.location = \"" .$s ."\";"; |
188 | 187 | $a += array ("ondblclick" => $s); |
189 | 188 | |
— | — | @@ -690,9 +689,10 @@ |
691 | 690 | { |
692 | 691 | if ( "" != $align ) { $a = " align='{$align}'"; } |
693 | 692 | else { $a = ""; } |
694 | | - |
| 693 | + |
695 | 694 | $mp = wfMsg( "mainpage" ); |
696 | | - $s = "<a href=\"" . wfLocalUrlE( urlencode( str_replace(' ','_',$mp) ) ) |
| 695 | + $titleObj = Title::newFromText( $mp ); |
| 696 | + $s = "<a href=\"" . $titleObj->getURL( "", true ) |
697 | 697 | . "\"><img{$a} border=0 src=\"" |
698 | 698 | . $this->getLogo() . "\" alt=\"" . "[{$mp}]\"></a>"; |
699 | 699 | return $s; |
— | — | @@ -1035,7 +1035,7 @@ |
1036 | 1036 | global $wgTitle, $wgLang; |
1037 | 1037 | |
1038 | 1038 | $s = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ), |
1039 | | - wfMsg( "contributions" ), "target=" . $wgTitle->getURL() ); |
| 1039 | + wfMsg( "contributions" ), "target=" . $wgTitle->getPartialURL() ); |
1040 | 1040 | return $s; |
1041 | 1041 | } |
1042 | 1042 | |
— | — | @@ -1044,7 +1044,7 @@ |
1045 | 1045 | global $wgTitle, $wgLang; |
1046 | 1046 | |
1047 | 1047 | $s = $this->makeKnownLink( $wgLang->specialPage( "Emailuser" ), |
1048 | | - wfMsg( "emailuser" ), "target=" . $wgTitle->getURL() ); |
| 1048 | + wfMsg( "emailuser" ), "target=" . $wgTitle->getPartialURL() ); |
1049 | 1049 | return $s; |
1050 | 1050 | } |
1051 | 1051 | |
— | — | @@ -1332,7 +1332,7 @@ |
1333 | 1333 | $u = ""; |
1334 | 1334 | if ( "" == $text ) { $text = $nt->getFragment(); } |
1335 | 1335 | } else { |
1336 | | - $u = wfLocalUrlE( $link, $query ); |
| 1336 | + $u = $nt->getURL( $query, true ); |
1337 | 1337 | } |
1338 | 1338 | if ( "" != $nt->getFragment() ) { |
1339 | 1339 | $u .= "#" . wfEscapeHTML( $nt->getFragment() ); |
— | — | @@ -1364,7 +1364,7 @@ |
1365 | 1365 | |
1366 | 1366 | if ( "" == $query ) { $q = "action=edit"; } |
1367 | 1367 | else { $q = "action=edit&{$query}"; } |
1368 | | - $u = wfLocalUrlE( $link, $q ); |
| 1368 | + $u = $nt->getURL( $q ); |
1369 | 1369 | |
1370 | 1370 | if ( "" == $text ) { $text = $nt->getPrefixedText(); } |
1371 | 1371 | $style = $this->getInternalLinkAttributesObj( $nt, $text, "yes" ); |
— | — | @@ -1394,7 +1394,7 @@ |
1395 | 1395 | |
1396 | 1396 | $link = $nt->getPrefixedURL(); |
1397 | 1397 | |
1398 | | - $u = wfLocalUrlE( $link, $query ); |
| 1398 | + $u = $nt->getURL( $query, true ); |
1399 | 1399 | |
1400 | 1400 | if ( "" == $text ) { $text = $nt->getPrefixedText(); } |
1401 | 1401 | $style = $this->getInternalLinkAttributesObj( $nt, $text, "stub" ); |
— | — | @@ -1439,7 +1439,6 @@ |
1440 | 1440 | |
1441 | 1441 | function makeImageLinkObj( $nt, $alt = "" ) { |
1442 | 1442 | global $wgLang, $wgUseImageResize; |
1443 | | - $link = $nt->getPrefixedURL(); |
1444 | 1443 | $name = $nt->getDBKey(); |
1445 | 1444 | $url = wfImageUrl( $name ); |
1446 | 1445 | $align = ""; |
— | — | @@ -1523,7 +1522,7 @@ |
1524 | 1523 | } |
1525 | 1524 | $alt = htmlspecialchars( $alt ); |
1526 | 1525 | |
1527 | | - $u = wfLocalUrlE( $link ); |
| 1526 | + $u = $nt->getURL( "", true ); |
1528 | 1527 | $s = "<a href=\"{$u}\" class='image' title=\"{$alt}\">" . |
1529 | 1528 | "<img border=\"0\" src=\"{$url}\" alt=\"{$alt}\"></a>"; |
1530 | 1529 | if ( "" != $align ) { |
— | — | @@ -1632,7 +1631,6 @@ |
1633 | 1632 | global $wgUploadPath; |
1634 | 1633 | $name = $nt->getDBKey(); |
1635 | 1634 | $image = Title::makeTitle( Namespace::getImage(), $name ); |
1636 | | - $link = $image->getPrefixedURL(); |
1637 | 1635 | $url = wfImageUrl( $name ); |
1638 | 1636 | $path = wfImagePath( $name ); |
1639 | 1637 | |
— | — | @@ -1649,7 +1647,7 @@ |
1650 | 1648 | |
1651 | 1649 | $thumbUrl = $this->createThumb( $name, $boxwidth ); |
1652 | 1650 | |
1653 | | - $u = wfLocalUrlE( $link ); |
| 1651 | + $u = $nt->getURL( "", true ); |
1654 | 1652 | |
1655 | 1653 | $more = htmlspecialchars(wfMsg( "thumbnail-more" )); |
1656 | 1654 | |
— | — | @@ -2150,8 +2148,8 @@ |
2151 | 2149 | $url = wfImageUrl( $img ); |
2152 | 2150 | $rlink = $cur; |
2153 | 2151 | if ( $wgUser->isSysop() ) { |
2154 | | - $link = wfLocalUrlE( $wgTitle->getPrefixedText(), "image=" . $wgTitle->getURL() . |
2155 | | - "&action=delete" ); |
| 2152 | + $link = $wgTitle->getURL( "image=" . $wgTitle->getPartialURL() . |
| 2153 | + "&action=delete", true ); |
2156 | 2154 | $style = $this->getInternalLinkAttributes( $link, $del ); |
2157 | 2155 | |
2158 | 2156 | $dlink = "<a href=\"{$link}\"{$style}>{$del}</a>"; |
— | — | @@ -2239,7 +2237,7 @@ |
2240 | 2238 | |
2241 | 2239 | global $wgTitle,$wgUser,$oldid; |
2242 | 2240 | if($oldid) return $head; |
2243 | | - $url = wfLocalUrlE(urlencode(str_replace(' ','_',$wgTitle->getPrefixedText())),"action=edit§ion=$section"); |
| 2241 | + $url = $wgTitle->getUrl( "action=edit§ion=$section", true ); |
2244 | 2242 | return "<span onContextMenu='document.location=\"".$url."\";return false;'>{$head}</span>"; |
2245 | 2243 | } |
2246 | 2244 | |
Index: trunk/phase3/includes/SpecialMakesysop.php |
— | — | @@ -42,8 +42,8 @@ |
43 | 43 | |
44 | 44 | $wgOut->addWikiText( wfMsg( "makesysoptext" ) ); |
45 | 45 | |
46 | | - $action = wfLocalUrlE( $wgLang->specialPage( "Makesysop" ), |
47 | | - "action=submit" ); |
| 46 | + $titleObj = Title::makeTitle( NS_SPECIAL, "Makesysop" ); |
| 47 | + $action = $titleObj->getURL( "action=submit", true ); |
48 | 48 | |
49 | 49 | if ( "" != $err ) { |
50 | 50 | $wgOut->setSubtitle( wfMsg( "formerror" ) ); |
Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -129,8 +129,7 @@ |
130 | 130 | # append them and the string comparison fails |
131 | 131 | if ( ( "" == $wpTextbox1 ) || |
132 | 132 | ( wfMsg( "newarticletext" ) == rtrim( preg_replace("/\r/","",$wpTextbox1) ) ) ) { |
133 | | - $wgOut->redirect( wfLocalUrl( |
134 | | - $this->mTitle->getPrefixedURL() ) ); |
| 133 | + $wgOut->redirect( $this->mTitle->getURL() ); |
135 | 134 | return; |
136 | 135 | } |
137 | 136 | $this->mArticle->insertNewArticle( $wpTextbox1, $wpSummary, $wpMinoredit, $wpWatchthis ); |
— | — | @@ -228,7 +227,7 @@ |
229 | 228 | |
230 | 229 | $q = "action=submit"; |
231 | 230 | if ( "no" == $redirect ) { $q .= "&redirect=no"; } |
232 | | - $action = wfEscapeHTML( wfLocalUrl( $this->mTitle->getPrefixedURL(), $q ) ); |
| 231 | + $action = $this->mTitle->getURL( $q, true ); |
233 | 232 | |
234 | 233 | $summary = wfMsg( "summary" ); |
235 | 234 | $subject = wfMsg("subject"); |
Index: trunk/phase3/includes/SpecialBlockip.php |
— | — | @@ -39,8 +39,8 @@ |
40 | 40 | $mIpbexpiry = wfMsg( "ipbexpiry" ); |
41 | 41 | $mIpbreason = wfMsg( "ipbreason" ); |
42 | 42 | $mIpbsubmit = wfMsg( "ipbsubmit" ); |
43 | | - $action = wfLocalUrlE( $wgLang->specialPage( "Blockip" ), |
44 | | - "action=submit" ); |
| 43 | + $titleObj = Title::makeTitle( NS_SPECIAL, "Blockip" ); |
| 44 | + $action = $titleObj->getURL( "action=submit", true ); |
45 | 45 | |
46 | 46 | if ( "" != $err ) { |
47 | 47 | $wgOut->setSubtitle( wfMsg( "formerror" ) ); |
— | — | @@ -145,9 +145,8 @@ |
146 | 146 | $log->addEntry( $action, $wpBlockReason ); |
147 | 147 | |
148 | 148 | # Report to the user |
149 | | - $success = wfLocalUrl( $wgLang->specialPage( "Blockip" ), |
150 | | - "action=success&ip={$wpBlockAddress}" ); |
151 | | - $wgOut->redirect( $success ); |
| 149 | + $titleObj = Title::makeTitle( NS_SPECIAL, "Blockip" ); |
| 150 | + $wgOut->redirect( $titleObj->getURL( "action=success&ip={$wpBlockAddress}" ) ); |
152 | 151 | } |
153 | 152 | |
154 | 153 | function showSuccess() |
Index: trunk/phase3/includes/SpecialUpload.php |
— | — | @@ -208,8 +208,8 @@ |
209 | 209 | $reupload = wfMsg( "reupload" ); |
210 | 210 | $iw = wfMsg( "ignorewarning" ); |
211 | 211 | $reup = wfMsg( "reuploaddesc" ); |
212 | | - $action = wfLocalUrlE( $wgLang->specialPage( "Upload" ), |
213 | | - "action=submit" ); |
| 212 | + $titleObj = Title::makeTitle( NS_SPECIAL, "Upload" ); |
| 213 | + $action = $titleObj->getURL( "action=submit", true ); |
214 | 214 | |
215 | 215 | if ( $wgUseCopyrightUpload ) |
216 | 216 | { |
— | — | @@ -267,7 +267,8 @@ |
268 | 268 | $ca = wfMsg( "affirmation", $clink ); |
269 | 269 | $iw = wfMsg( "ignorewarning" ); |
270 | 270 | |
271 | | - $action = wfLocalUrl( $wgLang->specialPage( "Upload" ) ); |
| 271 | + $titleObj = Title::makeTitle( NS_SPECIAL, "Upload" ); |
| 272 | + $action = $titleObj->getURL( "", true ); |
272 | 273 | |
273 | 274 | $source = " |
274 | 275 | <td align=right> |
Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -534,8 +534,8 @@ |
535 | 535 | |
536 | 536 | $r = wfMsg( "returnto", $link ); |
537 | 537 | if ( $auto ) { |
538 | | - $wgOut->addMeta( "http:Refresh", "10;url=" . |
539 | | - wfLocalUrlE( wfUrlencode( $returnto ) ) ); |
| 538 | + $titleObj = Title::newFromText( $returnto ); |
| 539 | + $wgOut->addMeta( "http:Refresh", "10;url=" . $titleObj->getUrl( "", true, true )); |
540 | 540 | } |
541 | 541 | $wgOut->addHTML( "\n<p>$r\n" ); |
542 | 542 | } |
Index: trunk/phase3/includes/SpecialWatchlist.php |
— | — | @@ -14,6 +14,8 @@ |
15 | 15 | $wgOut->setSubtitle( $sub ); |
16 | 16 | $wgOut->setRobotpolicy( "noindex,nofollow" ); |
17 | 17 | |
| 18 | + $specialTitle = Title::makeTitle( NS_SPECIAL, "Watchlist" ); |
| 19 | + |
18 | 20 | $uid = $wgUser->getID(); |
19 | 21 | if( $uid == 0 ) { |
20 | 22 | $wgOut->addHTML( wfMsg( "nowatchlist" ) ); |
— | — | @@ -91,7 +93,7 @@ |
92 | 94 | "<p>" . wfMsg( "watcheditlist" ) . "</p>\n" ); |
93 | 95 | |
94 | 96 | $wgOut->addHTML( "<form action='" . |
95 | | - wfLocalUrl( $wgLang->specialPage( "Watchlist" ), "action=submit" ) . |
| 97 | + $specialTitle->getURL( "action=submit", true ) . |
96 | 98 | "' method='post'>\n" . |
97 | 99 | "<ul>\n" ); |
98 | 100 | $sql = "SELECT wl_namespace,wl_title FROM watchlist WHERE wl_user=$uid"; |
— | — | @@ -130,8 +132,9 @@ |
131 | 133 | $z = "(wl_namespace=cur_namespace OR wl_namespace+1=cur_namespace)"; |
132 | 134 | } |
133 | 135 | |
| 136 | + |
134 | 137 | $wgOut->addHTML( "<i>" . wfMsg( "watchdetails", $nitems, $npages, $y, |
135 | | - wfLocalUrl( $wgLang->specialPage("Watchlist"),"magic=yes" ) ) . "</i><br>\n" ); |
| 138 | + $specialTitle->getURL( "magic=yes", true ) ) . "</i><br>\n" ); |
136 | 139 | |
137 | 140 | |
138 | 141 | $sql = "SELECT |
Index: trunk/phase3/includes/Database.php |
— | — | @@ -106,8 +106,8 @@ |
107 | 107 | $success = false; |
108 | 108 | } |
109 | 109 | } else { |
110 | | - # Delay USE |
111 | | - $success = true; |
| 110 | + # Delay USE query |
| 111 | + $success = !!$this->mConn; |
112 | 112 | } |
113 | 113 | |
114 | 114 | if ( !$success ) { |
Index: trunk/phase3/includes/SpecialMovepage.php |
— | — | @@ -3,7 +3,7 @@ |
4 | 4 | |
5 | 5 | function wfSpecialMovepage() |
6 | 6 | { |
7 | | - global $wgUser, $wgOut, $action, $target; |
| 7 | + global $wgUser, $wgOut; |
8 | 8 | |
9 | 9 | if ( 0 == $wgUser->getID() or $wgUser->isBlocked() ) { |
10 | 10 | $wgOut->errorpage( "movenologin", "movenologintext" ); |
— | — | @@ -18,8 +18,8 @@ |
19 | 19 | |
20 | 20 | $f = new MovePageForm(); |
21 | 21 | |
22 | | - if ( "success" == $action ) { $f->showSuccess(); } |
23 | | - else if ( "submit" == $action ) { $f->doSubmit(); } |
| 22 | + if ( "success" == $_REQUEST['action'] ) { $f->showSuccess(); } |
| 23 | + else if ( "submit" == $_REQUEST['action'] ) { $f->doSubmit(); } |
24 | 24 | else { $f->showForm( "" ); } |
25 | 25 | } |
26 | 26 | |
— | — | @@ -36,19 +36,22 @@ |
37 | 37 | function showForm( $err ) |
38 | 38 | { |
39 | 39 | global $wgOut, $wgUser, $wgLang; |
40 | | - global $wpNewTitle, $wpOldTitle, $wpMovetalk, $target; |
41 | 40 | |
42 | 41 | $wgOut->setPagetitle( wfMsg( "movepage" ) ); |
43 | 42 | |
44 | | - if ( ! $wpOldTitle ) { |
45 | | - $target = wfCleanQueryVar( $target ); |
46 | | - if ( "" == $target ) { |
| 43 | + if ( ! $_REQUEST['wpOldTitle'] ) { |
| 44 | + if ( "" == $_REQUEST['target'] ) { |
47 | 45 | $wgOut->errorpage( "notargettitle", "notargettext" ); |
48 | 46 | return; |
49 | 47 | } |
50 | | - $wpOldTitle = $target; |
| 48 | + $oldTitle = htmlspecialchars( $_REQUEST['target'] ); |
| 49 | + } else { |
| 50 | + $oldTitle = htmlspecialchars( $_REQUEST['wpOldTitle'] ); |
51 | 51 | } |
52 | | - $ot = Title::newFromURL( $wpOldTitle ); |
| 52 | + |
| 53 | + $encOldTitle = htmlspecialchars( $oldTitle ); |
| 54 | + $encNewTitle = htmlspecialchars( $_REQUEST['wpNewTitle'] ); |
| 55 | + $ot = Title::newFromURL( $oldTitle ); |
53 | 56 | $ott = $ot->getPrefixedText(); |
54 | 57 | |
55 | 58 | $wgOut->addWikiText( wfMsg( "movepagetext" ) ); |
— | — | @@ -60,8 +63,8 @@ |
61 | 64 | $mpb = wfMsg( "movepagebtn" ); |
62 | 65 | $movetalk = wfMsg( "movetalk" ); |
63 | 66 | |
64 | | - $action = wfLocalUrlE( $wgLang->specialPage( "Movepage" ), |
65 | | - "action=submit" ); |
| 67 | + $titleObj = Title::makeTitle( NS_SPECIAL, "Movepage" ); |
| 68 | + $action = $titleObj->getURL( "action=submit", true ); |
66 | 69 | |
67 | 70 | if ( "" != $err ) { |
68 | 71 | $wgOut->setSubtitle( wfMsg( "formerror" ) ); |
— | — | @@ -75,8 +78,8 @@ |
76 | 79 | </tr><tr> |
77 | 80 | <td align=right>{$newt}:</td> |
78 | 81 | <td align=left> |
79 | | -<input type=text size=40 name=\"wpNewTitle\" value=\"{$wpNewTitle}\"> |
80 | | -<input type=hidden name=\"wpOldTitle\" value=\"{$wpOldTitle}\"> |
| 82 | +<input type=text size=40 name=\"wpNewTitle\" value=\"{$encNewTitle}\"> |
| 83 | +<input type=hidden name=\"wpOldTitle\" value=\"{$encOldTitle}\"> |
81 | 84 | </td> |
82 | 85 | </tr>" ); |
83 | 86 | |
— | — | @@ -100,13 +103,12 @@ |
101 | 104 | function doSubmit() |
102 | 105 | { |
103 | 106 | global $wgOut, $wgUser, $wgLang; |
104 | | - global $wpNewTitle, $wpOldTitle, $wpMovetalk, $target; |
105 | 107 | global $wgDeferredUpdateList, $wgMessageCache; |
106 | 108 | global $wgUseSquid, $wgInternalServer; |
107 | 109 | $fname = "MovePageForm::doSubmit"; |
108 | 110 | |
109 | | - $this->ot = Title::newFromText( $wpOldTitle ); |
110 | | - $this->nt = Title::newFromText( $wpNewTitle ); |
| 111 | + $this->ot = Title::newFromText( $_REQUEST['wpOldTitle'] ); |
| 112 | + $this->nt = Title::newFromText( $_REQUEST['wpNewTitle'] ); |
111 | 113 | if( !$this->ot or !$this->nt ) { |
112 | 114 | $this->showForm( wfMsg( "badtitletext" ) ); |
113 | 115 | return; |
— | — | @@ -166,9 +168,9 @@ |
167 | 169 | /* this needs to be done after LinksUpdate */ |
168 | 170 | $urlArr = Array( |
169 | 171 | # purge new title |
170 | | - $wgInternalServer.wfLocalUrl( $this->nt->getPrefixedURL()), |
| 172 | + $wgInternalServer.$this->nt->getURL(), |
171 | 173 | # purge old title |
172 | | - $wgInternalServer.wfLocalUrl( $this->ot->getPrefixedURL()) |
| 174 | + $wgInternalServer.$this->ot->getURL()) |
173 | 175 | ); |
174 | 176 | wfPurgeSquidServers($urlArr); |
175 | 177 | # purge pages linking to new title |
— | — | @@ -185,7 +187,7 @@ |
186 | 188 | # and target namespaces are identical, (3) the namespaces are not |
187 | 189 | # themselves talk namespaces, and of course (4) it exists. |
188 | 190 | |
189 | | - if ( ( 1 == $wpMovetalk ) && |
| 191 | + if ( ( 1 == $_REQUEST['wpMovetalk'] ) && |
190 | 192 | ( ! Namespace::isTalk( $this->ons ) ) && |
191 | 193 | ( $this->ons == $this->nns ) ) { |
192 | 194 | |
— | — | @@ -223,9 +225,9 @@ |
224 | 226 | /* this needs to be done after LinksUpdate */ |
225 | 227 | $urlArr = Array( |
226 | 228 | # purge new title |
227 | | - $wgInternalServer.wfLocalUrl( $this->nt->getPrefixedURL()), |
| 229 | + $wgInternalServer.$nt->getURL()), |
228 | 230 | # purge old title |
229 | | - $wgInternalServer.wfLocalUrl( $this->ot->getPrefixedURL()) |
| 231 | + $wgInternalServer.$ot->getURL()) |
230 | 232 | ); |
231 | 233 | wfPurgeSquidServers($urlArr); |
232 | 234 | # purge pages linking to new title |
— | — | @@ -239,7 +241,8 @@ |
240 | 242 | } |
241 | 243 | } |
242 | 244 | } |
243 | | - $success = wfLocalUrl( $wgLang->specialPage( "Movepage" ), |
| 245 | + $titleObj = Title::makeTitle( NS_SPECIAL, "Movepage" ); |
| 246 | + $success = $titleObj->getURL( |
244 | 247 | "action=success&oldtitle=" . wfUrlencode( $this->ofx ) . |
245 | 248 | "&newtitle=" . wfUrlencode( $this->nfx ) . |
246 | 249 | "&talkmoved={$this->talkmoved}" ); |
— | — | @@ -250,23 +253,19 @@ |
251 | 254 | function showSuccess() |
252 | 255 | { |
253 | 256 | global $wgOut, $wgUser; |
254 | | - global $newtitle, $oldtitle, $talkmoved; |
255 | 257 | |
256 | 258 | $wgOut->setPagetitle( wfMsg( "movepage" ) ); |
257 | 259 | $wgOut->setSubtitle( wfMsg( "pagemovedsub" ) ); |
258 | | - |
259 | | - $fields = array( "oldtitle", "newtitle" ); |
260 | | - wfCleanFormFields( $fields ); |
261 | | - |
262 | | - $text = wfMsg( "pagemovedtext", $oldtitle, $newtitle ); |
| 260 | + |
| 261 | + $text = wfMsg( "pagemovedtext", $_REQUEST['oldtitle'], $_REQUEST['newtitle'] ); |
263 | 262 | $wgOut->addWikiText( $text ); |
264 | 263 | |
265 | | - if ( 1 == $talkmoved ) { |
| 264 | + if ( 1 == $_REQUEST['talkmoved'] ) { |
266 | 265 | $wgOut->addHTML( "\n<p>" . wfMsg( "talkpagemoved" ) ); |
267 | | - } elseif( 'invalid' == $talkmoved ) { |
| 266 | + } elseif( 'invalid' == $_REQUEST['talkmoved'] ) { |
268 | 267 | $wgOut->addHTML( "\n<p><strong>" . wfMsg( "talkexists" ) . "</strong>" ); |
269 | 268 | } else { |
270 | | - $ot = Title::newFromURL( $oldtitle ); |
| 269 | + $ot = Title::newFromURL( $_REQUEST['oldtitle'] ); |
271 | 270 | if ( ! Namespace::isTalk( $ot->getNamespace() ) ) { |
272 | 271 | $wgOut->addHTML( "\n<p>" . wfMsg( "talkpagenotmoved" ) ); |
273 | 272 | } |
Index: trunk/phase3/includes/SpecialEmailuser.php |
— | — | @@ -69,8 +69,8 @@ |
70 | 70 | $emm = wfMsg( "emailmessage" ); |
71 | 71 | $ems = wfMsg( "emailsend" ); |
72 | 72 | |
73 | | - $action = wfLocalUrlE( $wgLang->specialPage( "Emailuser" ), |
74 | | - "target={$target}&action=submit" ); |
| 73 | + $titleObj = Title::makeTitle( NS_SPECIAL, "Emailuser" ); |
| 74 | + $action = $titleObj->getURL( "target={$target}&action=submit", true ); |
75 | 75 | |
76 | 76 | if ( "" != $err ) { |
77 | 77 | $wgOut->setSubtitle( wfMsg( "formerror" ) ); |
— | — | @@ -114,9 +114,8 @@ |
115 | 115 | |
116 | 116 | if (! $mailResult) |
117 | 117 | { |
118 | | - $success = wfLocalUrl( $wgLang->specialPage( "Emailuser" ), |
119 | | - "target={$target}&action=success" ); |
120 | | - $wgOut->redirect( $success ); |
| 118 | + $titleObj = Title::makeTitle( NS_SPECIAL, "Emailuser" ); |
| 119 | + $wgOut->redirect( $titleObj->getURL( "target={$target}&action=success" ) ); |
121 | 120 | } |
122 | 121 | else |
123 | 122 | $wgOut->addHTML( wfMsg( "usermailererror" ) . $mailResult); |
Index: trunk/phase3/includes/SpecialAsksql.php |
— | — | @@ -36,8 +36,8 @@ |
37 | 37 | if ( ! $wpSqlQuery ) { $wpSqlQuery = "SELECT ... FROM ... WHERE ..."; } |
38 | 38 | $q = wfMsg( "sqlquery" ); |
39 | 39 | $qb = wfMsg( "querybtn" ); |
40 | | - $action = wfLocalUrlE( $wgLang->specialPage( "Asksql" ), |
41 | | - "action=submit" ); |
| 40 | + $titleObj = Title::makeTitle( NS_SPECIAL, "Asksql" ); |
| 41 | + $action = $titleObj->getURL( "action=submit", true ); |
42 | 42 | |
43 | 43 | $wgOut->addHTML( "<p> |
44 | 44 | <form id=\"asksql\" method=\"post\" action=\"{$action}\"> |
— | — | @@ -101,8 +101,6 @@ |
102 | 102 | if ( $titleList ) { |
103 | 103 | $r = ""; |
104 | 104 | foreach ( $a as $y ) { |
105 | | - $o = "<a href=\"" . wfLocalUrlE($o) . "\" class='internal'>" . |
106 | | - htmlspecialchars( $y->$x ) . "</a>" ; |
107 | 105 | $sTitle = htmlspecialchars( $y->cur_title ); |
108 | 106 | if ( $y->cur_namespace ) { |
109 | 107 | $sNamespace = $wgLang->getNsText( $y->cur_namespace ); |