Include undelete link in Monobook skin
[lhc/web/wiklou.git] / includes / SkinPHPTal.php
1 <?php
2 # Generic PHPTal (http://phptal.sourceforge.net/) skin
3 # Based on Brion's smarty skin
4 # Copyright (C) Gabriel Wicke -- http://www.aulinx.de/
5 #
6 # Todo: Needs some serious refactoring into functions that correspond
7 # to the computations individual esi snippets need. Most importantly no body
8 # parsing for most of those of course.
9 #
10 # Set this in LocalSettings to enable phptal:
11 # set_include_path(get_include_path() . ":" . $IP.'/PHPTAL-NP-0.7.0/libs');
12 # $wgUsePHPTal = true;
13 #
14 # This program is free software; you can redistribute it and/or modify
15 # it under the terms of the GNU General Public License as published by
16 # the Free Software Foundation; either version 2 of the License, or
17 # (at your option) any later version.
18 #
19 # This program is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU General Public License for more details.
23 #
24 # You should have received a copy of the GNU General Public License along
25 # with this program; if not, write to the Free Software Foundation, Inc.,
26 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 # http://www.gnu.org/copyleft/gpl.html
28
29 require_once "GlobalFunctions.php";
30 require_once $IP."/PHPTAL-NP-0.7.0/libs/PHPTAL.php";
31
32 class MediaWiki_I18N extends PHPTAL_I18N
33 {
34 var $_context = array();
35
36 function set($varName, $value) {
37 $this->_context[$varName] = $value;
38 }
39
40 function translate($value) {
41 $value = wfMsg( $value );
42 // interpolate variables
43 while (preg_match('/\$([0-9]*?)/sm', $value, $m)) {
44 list($src, $var) = $m;
45 $varValue = @$this->_context[$var];
46 $value = str_replace($src, $varValue, $value);
47 }
48 return $value;
49 }
50 }
51
52 class SkinPHPTal extends Skin {
53 var $template;
54
55 function initPage( &$out ) {
56 parent::initPage( $out );
57 $this->skinname = "davinci";
58 $this->template = "xhtml_slim";
59 }
60
61 function outputPage( &$out ) {
62 global $wgTitle, $wgArticle, $wgUser, $wgLang, $wgOut;
63 global $wgScript, $wgStylePath, $wgLanguageCode, $wgUseNewInterlanguage;
64 global $wgMimeType, $wgOutputEncoding, $wgUseDatabaseMessages, $wgRequest;
65 global $wgDisableCounters, $wgLogo, $action, $wgFeedClasses, $wgSiteNotice;
66
67 extract( $wgRequest->getValues( 'oldid', 'diff' ) );
68
69 $this->initPage( $out );
70 $tpl = new PHPTAL($this->template . '.pt', 'templates');
71
72 #if ( $wgUseDatabaseMessages ) { // uncomment this to fall back to GetText
73 $tpl->setTranslator(new MediaWiki_I18N());
74 #}
75
76 $this->thispage = $wgTitle->getPrefixedDbKey();
77 $this->thisurl = $wgTitle->getPrefixedURL();
78 $this->loggedin = $wgUser->getID() != 0;
79 $this->iscontent = ($wgTitle->getNamespace() != Namespace::getSpecial() );
80 $this->iseditable = ($this->iscontent and !($action == 'edit' or $action == 'submit'));
81 $this->username = $wgUser->getName();
82 $this->userpage = $wgLang->getNsText( Namespace::getUser() ) . ":" . $wgUser->getName();
83 $this->userpageUrlDetails = $this->makeUrlDetails($this->userpage);
84
85 $this->usercss = $this->userjs = $this->userjsprev = false;
86 if( $this->loggedin ) { $this->setupUserCssJs(); }
87
88 $this->titletxt = $wgTitle->getPrefixedText();
89
90 $tpl->set( "title", $wgOut->getPageTitle() );
91 $tpl->set( "pagetitle", $wgOut->getHTMLTitle() );
92
93 $tpl->setRef( "thispage", &$this->thispage );
94 $subpagestr = $this->subPageSubtitle();
95 $tpl->set(
96 "subtitle", !empty($subpagestr)?
97 '<span class="subpages">'.$subpagestr.'</span>'.$out->getSubtitle():
98 $out->getSubtitle()
99 );
100 $undelete = $this->getUndeleteLink();
101 $tpl->set(
102 "undelete", !empty($undelete)?
103 '<span class="subpages">'.$undelete.'</span>':
104 ''
105 );
106
107 $tpl->set( 'catlinks', $this->getCategories());
108 if( $wgOut->isSyndicated() ) {
109 $feeds = array();
110 foreach( $wgFeedClasses as $format => $class ) {
111 $feeds[$format] = array(
112 'text' => $format,
113 'href' => $wgRequest->appendQuery( "feed=$format" ),
114 'ttip' => wfMsg('tooltip-'.$format)
115 );
116 }
117 $tpl->setRef( 'feeds', &$feeds );
118 }
119 $tpl->setRef( 'mimetype', &$wgMimeType );
120 $tpl->setRef( 'charset', &$wgOutputEncoding );
121 $tpl->set( 'headlinks', $out->getHeadLinks() );
122 $tpl->setRef( 'skinname', &$this->skinname );
123 $tpl->setRef( "loggedin", &$this->loggedin );
124 $tpl->set('nsclass', 'ns-'.$wgTitle->getNamespace());
125 /* XXX currently unused, might get useful later
126 $tpl->set( "editable", ($wgTitle->getNamespace() != NS_SPECIAL ) );
127 $tpl->set( "exists", $wgTitle->getArticleID() != 0 );
128 $tpl->set( "watch", $wgTitle->userIsWatching() ? "unwatch" : "watch" );
129 $tpl->set( "protect", count($wgTitle->getRestrictions()) ? "unprotect" : "protect" );
130 $tpl->set( "helppage", wfMsg('helppage'));
131 $tpl->set( "sysop", $wgUser->isSysop() );
132 */
133 $tpl->set( "searchaction", $this->escapeSearchLink() );
134 $tpl->setRef( "stylepath", &$wgStylePath );
135 $tpl->setRef( "logopath", &$wgLogo );
136 $tpl->setRef( "lang", &$wgLanguageCode );
137 $tpl->set( "dir", $wgLang->isRTL() ? "rtl" : "ltr" );
138 $tpl->set( "rtl", $wgLang->isRTL() );
139 $tpl->set( "langname", $wgLang->getLanguageName( $wgLanguageCode ) );
140 $tpl->setRef( "username", &$this->username );
141 $tpl->setRef( "userpage", &$this->userpage);
142 $tpl->setRef( "userpageurl", &$this->userpageUrlDetails['href']);
143 $tpl->setRef( "usercss", &$this->usercss);
144 $tpl->setRef( "userjs", &$this->userjs);
145 $tpl->setRef( "userjsprev", &$this->userjsprev);
146 if( $wgUser->getNewtalk() ) {
147 $usertitle = Title::newFromText( $this->userpage );
148 $usertalktitle = $usertitle->getTalkPage();
149 if($usertalktitle->getPrefixedDbKey() != $this->thispage){
150
151 $ntl = wfMsg( "newmessages",
152 $this->makeKnownLink(
153 $wgLang->getNsText( Namespace::getTalk( Namespace::getUser() ) )
154 . ":" . $this->username,
155 wfMsg("newmessageslink") )
156 );
157 }
158 } else {
159 $ntl = "";
160 }
161
162 $tpl->setRef( "newtalk", &$ntl );
163 $tpl->setRef( "skin", &$this);
164 $tpl->set( "logo", $this->logoText() );
165 if ( $wgOut->isArticle() and (!isset( $oldid ) or isset( $diff )) and 0 != $wgArticle->getID() ) {
166 if ( !$wgDisableCounters ) {
167 $viewcount = $wgLang->formatNum( $wgArticle->getCount() );
168 if ( $viewcount ) {
169 $tpl->set('viewcount', wfMsg( "viewcount", $viewcount ));
170 }
171 }
172 $tpl->set('lastmod', $this->lastModified());
173 $tpl->set('copyright',$this->getCopyright());
174 }
175 $tpl->set( "copyrightico", $this->getCopyrightIcon() );
176 $tpl->set( "poweredbyico", $this->getPoweredBy() );
177 $tpl->set( "disclaimer", $this->disclaimerLink() );
178 $tpl->set( "about", $this->aboutLink() );
179
180 $tpl->setRef( "debug", &$out->mDebugtext );
181 $tpl->set( "reporttime", $out->reportTime() );
182 $tpl->set( "sitenotice", $wgSiteNotice );
183
184 $tpl->setRef( "bodytext", &$out->mBodytext );
185
186 $language_urls = array();
187 foreach( $wgOut->getLanguageLinks() as $l ) {
188 $nt = Title::newFromText( $l );
189 $language_urls[] = array('href' => $nt->getFullURL(),
190 'text' => ($wgLang->getLanguageName( $nt->getInterwiki()) != ''?$wgLang->getLanguageName( $nt->getInterwiki()) : $l),
191 'class' => $wgLang->isRTL() ? 'rtl' : 'ltr');
192 }
193 if(count($language_urls)) {
194 $tpl->setRef( 'language_urls', &$language_urls);
195 } else {
196 $tpl->set('language_urls', false);
197 }
198 $tpl->set('personal_urls', $this->buildPersonalUrls());
199 $content_actions = $this->buildContentActionUrls();
200 $tpl->setRef('content_actions', &$content_actions);
201 // XXX: attach this from javascript, same with section editing
202 if($this->iseditable && $wgUser->getOption("editondblclick") )
203 {
204 $tpl->set('body-ondblclick', 'document.location = "' .$content_actions['edit']['href'] .'";');
205 } else {
206 $tpl->set('body-ondblclick', false);
207 }
208 $tpl->set( "nav_urls", $this->buildNavUrls() );
209
210 // execute template
211 $res = $tpl->execute();
212 // result may be an error
213 if (PEAR::isError($res)) {
214 echo $res->toString(), "\n";
215 } else {
216 echo $res;
217 }
218
219 }
220
221 # build array of urls for personal toolbar
222 function buildPersonalUrls() {
223 /* set up the default links for the personal toolbar */
224 global $wgShowIPinHeader;
225 $personal_urls = array();
226 if ($this->loggedin) {
227 $personal_urls['userpage'] = array(
228 'text' => $this->username,
229 'href' => &$this->userpageUrlDetails['href'],
230 'class' => $this->userpageUrlDetails['exists']?false:'new',
231 'ttip' => wfMsg('tooltip-userpage'),
232 'akey' => wfMsg('accesskey-userpage')
233 );
234 $usertalkUrlDetails = $this->makeTalkUrlDetails($this->userpage);
235 $personal_urls['mytalk'] = array(
236 'text' => wfMsg('mytalk'),
237 'href' => &$usertalkUrlDetails['href'],
238 'class' => $usertalkUrlDetails['exists']?false:'new',
239 'ttip' => wfMsg('tooltip-mytalk'),
240 'akey' => wfMsg('accesskey-mytalk')
241 );
242 $personal_urls['preferences'] = array(
243 'text' => wfMsg('preferences'),
244 'href' => $this->makeSpecialUrl('Preferences'),
245 'ttip' => wfMsg('tooltip-preferences'),
246 'akey' => wfMsg('accesskey-preferences')
247 );
248 $personal_urls['watchlist'] = array(
249 'text' => wfMsg('watchlist'),
250 'href' => $this->makeSpecialUrl('Watchlist'),
251 'ttip' => wfMsg('tooltip-watchlist'),
252 'akey' => wfMsg('accesskey-watchlist')
253 );
254 $personal_urls['mycontris'] = array(
255 'text' => wfMsg('mycontris'),
256 'href' => $this->makeSpecialUrl('Contributions','target=' . urlencode( $this->username ) ),
257 'ttip' => wfMsg('tooltip-mycontris'),
258 'akey' => wfMsg('accesskey-mycontris')
259 );
260 $personal_urls['logout'] = array(
261 'text' => wfMsg('userlogout'),
262 'href' => $this->makeSpecialUrl('Userlogout','returnto=' . $this->thisurl ),
263 'ttip' => wfMsg('tooltip-logout'),
264 'akey' => wfMsg('accesskey-logout')
265 );
266 } else {
267 if( $wgShowIPinHeader && isset( $_COOKIE[ini_get("session.name")] ) ) {
268 $personal_urls['anonuserpage'] = array(
269 'text' => $this->username,
270 'href' => &$this->userpageUrlDetails['href'],
271 'class' => $this->userpageUrlDetails['exists']?false:'new',
272 'ttip' => wfMsg('tooltip-anonuserpage'),
273 'akey' => wfMsg('accesskey-anonuserpage')
274 );
275 $usertalkUrlDetails = $this->makeTalkUrlDetails($this->userpage);
276 $personal_urls['anontalk'] = array(
277 'text' => wfMsg('anontalk'),
278 'href' => &$usertalkUrlDetails['href'],
279 'class' => $usertalkUrlDetails['exists']?false:'new',
280 'ttip' => wfMsg('tooltip-anontalk'),
281 'akey' => wfMsg('accesskey-anontalk')
282 );
283 $personal_urls['anonlogin'] = array(
284 'text' => wfMsg('userlogin'),
285 'href' => $this->makeSpecialUrl('Userlogin', 'returnto=' . $this->thisurl ),
286 'ttip' => wfMsg('tooltip-login'),
287 'akey' => wfMsg('accesskey-login')
288 );
289 } else {
290
291 $personal_urls['login'] = array(
292 'text' => wfMsg('userlogin'),
293 'href' => $this->makeSpecialUrl('Userlogin', 'returnto=' . $this->thisurl ),
294 'ttip' => wfMsg('tooltip-login'),
295 'akey' => wfMsg('accesskey-login')
296 );
297 }
298 }
299
300 return $personal_urls;
301 }
302
303 # an array of edit links by default used for the tabs
304 function buildContentActionUrls () {
305 global $wgTitle, $wgUser, $wgRequest;
306 $action = $wgRequest->getText( 'action' );
307 $section = $wgRequest->getText( 'section' );
308 $oldid = $wgRequest->getVal( 'oldid' );
309 $diff = $wgRequest->getVal( 'diff' );
310 $content_actions = array();
311
312 if( $this->iscontent ) {
313
314 $content_actions['article'] = array('class' => (!Namespace::isTalk( $wgTitle->getNamespace())) ? 'selected' : false,
315 'text' => $this->getNameSpaceWord(),
316 'href' => $this->makeArticleUrl($this->thispage),
317 'ttip' => wfMsg('tooltip-article'),
318 'akey' => wfMsg('accesskey-article'));
319
320 /* set up the classes for the talk link */
321 $talk_class = (Namespace::isTalk( $wgTitle->getNamespace()) ? 'selected' : false);
322 $talktitle = Title::newFromText( $this->titletxt );
323 $talktitle = $talktitle->getTalkPage();
324 $this->checkTitle(&$talktitle, &$this->titletxt);
325 if($talktitle->getArticleId() != 0) {
326 $content_actions['talk'] = array(
327 'class' => $talk_class,
328 'text' => wfMsg('talk'),
329 'href' => $this->makeTalkUrl($this->titletxt),
330 'ttip' => wfMsg('tooltip-talk'),
331 'akey' => wfMsg('accesskey-talk')
332 );
333 } else {
334 $content_actions['talk'] = array(
335 'class' => $talk_class?$talk_class.' new':'new',
336 'text' => wfMsg('talk'),
337 'href' => $this->makeTalkUrl($this->titletxt,'action=edit'),
338 'ttip' => wfMsg('tooltip-talk'),
339 'akey' => wfMsg('accesskey-talk')
340 );
341 }
342
343 if ( $wgTitle->userCanEdit() ) {
344 $oid = ( $oldid && ! isset( $diff ) ) ? "&oldid={$oldid}" : false;
345 $istalk = ( Namespace::isTalk( $wgTitle->getNamespace()) );
346 $istalkclass = $istalk?' istalk':'';
347 $content_actions['edit'] = array(
348 'class' => ((($action == 'edit' or $action == 'submit') and $section != 'new') ? 'selected' : '').$istalkclass,
349 'text' => wfMsg('edit'),
350 'href' => $this->makeUrl($this->thispage, 'action=edit'.$oid),
351 'ttip' => wfMsg('tooltip-edit'),
352 'akey' => wfMsg('accesskey-edit')
353 );
354 if ( $istalk ) {
355 $content_actions['addsection'] = array(
356 'class' => $section == 'new'?'selected':false,
357 'text' => wfMsg('addsection'),
358 'href' => $this->makeUrl($this->thispage, 'action=edit&section=new'),
359 'ttip' => wfMsg('tooltip-addsection'),
360 'akey' => wfMsg('accesskey-addsection')
361 );
362 }
363 } else {
364 $oid = ( $oldid && ! isset( $diff ) ) ? "&oldid={$oldid}" : '';
365 $content_actions['edit'] = array('class' => ($action == 'edit') ? 'selected' : false,
366 'text' => wfMsg('viewsource'),
367 'href' => $this->makeUrl($this->thispage, 'action=edit'.$oid),
368 'ttip' => wfMsg('tooltip-viewsource'),
369 'akey' => wfMsg('accesskey-viewsource'));
370 }
371
372 if ( $wgTitle->getArticleId() ) {
373
374 $content_actions['history'] = array('class' => ($action == 'history') ? 'selected' : false,
375 'text' => wfMsg('history_short'),
376 'href' => $this->makeUrl($this->thispage, 'action=history'),
377 'ttip' => wfMsg('tooltip-history'),
378 'akey' => wfMsg('accesskey-history'));
379
380 # XXX: is there a rollback action anywhere or is it planned?
381 # Don't recall where i got this from...
382 /*if( $wgUser->getNewtalk() ) {
383 $content_actions['rollback'] = array('class' => ($action == 'rollback') ? 'selected' : false,
384 'text' => wfMsg('rollback_short'),
385 'href' => $this->makeUrl($this->thispage, 'action=rollback'),
386 'ttip' => wfMsg('tooltip-rollback'),
387 'akey' => wfMsg('accesskey-rollback'));
388 }*/
389
390 if($wgUser->isSysop()){
391 if(!$wgTitle->isProtected()){
392 $content_actions['protect'] = array(
393 'class' => ($action == 'protect') ? 'selected' : false,
394 'text' => wfMsg('protect'),
395 'href' => $this->makeUrl($this->thispage, 'action=protect'),
396 'ttip' => wfMsg('tooltip-protect'),
397 'akey' => wfMsg('accesskey-protect')
398 );
399
400 } else {
401 $content_actions['unprotect'] = array(
402 'class' => ($action == 'unprotect') ? 'selected' : false,
403 'text' => wfMsg('unprotect'),
404 'href' => $this->makeUrl($this->thispage, 'action=unprotect'),
405 'ttip' => wfMsg('tooltip-protect'),
406 'akey' => wfMsg('accesskey-protect')
407 );
408 }
409 $content_actions['delete'] = array(
410 'class' => ($action == 'delete') ? 'selected' : false,
411 'text' => wfMsg('delete'),
412 'href' => $this->makeUrl($this->thispage, 'action=delete'),
413 'ttip' => wfMsg('tooltip-delete'),
414 'akey' => wfMsg('accesskey-delete')
415 );
416 }
417 if ( $wgUser->getID() != 0 ) {
418 if ( $wgTitle->userCanEdit()) {
419 $content_actions['move'] = array('class' => ($wgTitle->getDbKey() == 'Movepage' and $wgTitle->getNamespace == Namespace::getSpecial()) ? 'selected' : false,
420 'text' => wfMsg('move'),
421 'href' => $this->makeSpecialUrl('Movepage', 'target='. urlencode( $this->thispage )),
422 'ttip' => wfMsg('tooltip-move'),
423 'akey' => wfMsg('accesskey-move'));
424 } else {
425 $content_actions['move'] = array('class' => 'inactive',
426 'text' => wfMsg('move'),
427 'href' => false,
428 'ttip' => wfMsg('tooltip-nomove'),
429 'akey' => false);
430
431 }
432 }
433 } else {
434 //article doesn't exist or is deleted
435 if($wgUser->isSysop()){
436 if( $n = $wgTitle->isDeleted() ) {
437 $content_actions['delete'] = array(
438 'class' => false,
439 'text' => wfMsg( "undelete_short", $n ),
440 'href' => $this->makeSpecialUrl('Undelete/'.$this->thispage),
441 'ttip' => wfMsg('tooltip-undelete', $n),
442 'akey' => wfMsg('accesskey-undelete')
443 );
444 }
445 }
446 }
447
448 if ( $wgUser->getID() != 0 and $action != 'edit' and $action != 'submit' ) {
449 if( !$wgTitle->userIsWatching()) {
450 $content_actions['watch'] = array('class' => ($action == 'watch' or $action == 'unwatch') ? 'selected' : false,
451 'text' => wfMsg('watch'),
452 'href' => $this->makeUrl($this->thispage, 'action=watch'),
453 'ttip' => wfMsg('tooltip-watch'),
454 'akey' => wfMsg('accesskey-watch'));
455 } else {
456 $content_actions['watch'] = array('class' => ($action == 'unwatch' or $action == 'watch') ? 'selected' : false,
457 'text' => wfMsg('unwatch'),
458 'href' => $this->makeUrl($this->thispage, 'action=unwatch'),
459 'ttip' => wfMsg('tooltip-unwatch'),
460 'akey' => wfMsg('accesskey-unwatch'));
461
462 }
463 }
464 } else {
465 /* show special page tab */
466
467 $content_actions['article'] = array('class' => 'selected',
468 'text' => wfMsg('specialpage'),
469 'href' => false,
470 'ttip' => wfMsg('tooltip-specialpage'),
471 'akey' => false);
472 }
473
474 return $content_actions;
475 }
476
477 # build array of common navigation links
478 function buildNavUrls () {
479 global $wgTitle, $wgUser, $wgRequest;
480 global $wgSiteSupportPage;
481
482 $action = $wgRequest->getText( 'action' );
483 $oldid = $wgRequest->getVal( 'oldid' );
484 $diff = $wgRequest->getVal( 'diff' );
485 // XXX: remove htmlspecialchars when tal:attributes works with i18n:attributes
486 $nav_urls = array();
487 $nav_urls['mainpage'] = array('href' => htmlspecialchars( $this->makeI18nUrl('mainpage')));
488 $nav_urls['randompage'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Randompage')));
489 $nav_urls['recentchanges'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Recentchanges')));
490 $nav_urls['whatlinkshere'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Whatlinkshere', 'target='.urlencode( $this->thispage ))));
491 $nav_urls['currentevents'] = (wfMsg('currentevents') != '-') ? array('href' => htmlspecialchars( $this->makeI18nUrl('currentevents'))) : false;
492 $nav_urls['portal'] = (wfMsg('portal') != '-') ? array('href' => htmlspecialchars( $this->makeI18nUrl('portal-url'))) : false;
493 $nav_urls['recentchangeslinked'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Recentchangeslinked', 'target='.urlencode( $this->thispage ))));
494 $nav_urls['bugreports'] = array('href' => htmlspecialchars( $this->makeI18nUrl('bugreportspage')));
495 // $nav_urls['sitesupport'] = array('href' => htmlspecialchars( $this->makeI18nUrl('sitesupportpage')));
496 $nav_urls['sitesupport'] = array('href' => htmlspecialchars( $wgSiteSupportPage));
497 $nav_urls['help'] = array('href' => htmlspecialchars( $this->makeI18nUrl('helppage')));
498 $nav_urls['upload'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Upload')));
499 $nav_urls['specialpages'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Specialpages')));
500
501 if( $wgTitle->getNamespace() == NS_USER || $wgTitle->getNamespace() == NS_USER_TALK ) {
502 $id = User::idFromName($wgTitle->getText());
503 $ip = User::isIP($wgTitle->getText());
504 } else {
505 $id = 0;
506 $ip = false;
507 }
508
509 if($id || $ip) { # both anons and non-anons have contri list
510 $nav_urls['contributions'] = array(
511 'href' => htmlspecialchars( $this->makeSpecialUrl('Contributions', "target=" . $wgTitle->getPartialURL() ) )
512 );
513 }
514 if ( 0 != $wgUser->getID() ) { # show only to signed in users
515 if($id) { # can only email non-anons
516 $nav_urls['emailuser'] = array(
517 'href' => htmlspecialchars( $this->makeSpecialUrl('Emailuser', "target=" . $wgTitle->getPartialURL() ) )
518 );
519 }
520 }
521
522
523 return $nav_urls;
524 }
525
526 function getNameSpaceWord () {
527 global $wgTitle;
528 switch ($wgTitle->getNamespace()) {
529 case NS_MAIN:
530 case NS_TALK:
531 return wfMsg('nstab-main');
532 case NS_USER:
533 case NS_USER_TALK:
534 return wfMsg('nstab-user');
535 case NS_MEDIA:
536 return wfMsg('nstab-media');
537 case NS_SPECIAL:
538 return wfMsg('nstab-special');
539 case NS_WP:
540 case NS_WP_TALK:
541 return wfMsg('nstab-wp');
542 case NS_IMAGE:
543 case NS_IMAGE_TALK:
544 return wfMsg('nstab-image');
545 case NS_MEDIAWIKI:
546 case NS_MEDIAWIKI_TALK:
547 return wfMsg('nstab-mediawiki');
548 case NS_TEMPLATE:
549 case NS_TEMPLATE_TALK:
550 return wfMsg('nstab-template');
551 case NS_HELP:
552 case NS_HELP_TALK:
553 return wfMsg('nstab-help');
554 case NS_CATEGORY:
555 case NS_CATEGORY_TALK:
556 return wfMsg('nstab-category');
557 default:
558 return wfMsg('nstab-main');
559 }
560 }
561 /* private */ function setupUserCssJs () {
562 global $wgRequest, $wgTitle;
563 $action = $wgRequest->getText('action');
564 if($wgTitle->isCssSubpage() and $action == 'submit' and $wgTitle->userCanEditCssJsSubpage()) {
565 // css preview
566 $this->usercss = $wgRequest->getText('wpTextbox1');
567 } else {
568 $this->usercss = '@import url('.
569 $this->makeUrl($this->userpage.'/'.$this->skinname.'.css', 'action=raw&ctype=text/css').');';
570 }
571 if($wgTitle->isJsSubpage() and $action == 'submit' and $wgTitle->userCanEditCssJsSubpage()) {
572 # XXX: additional security check/prompt?
573 $this->userjsprev = $wgRequest->getText('wpTextbox1');
574 } else {
575 $this->userjs = $this->makeUrl($this->userpage.'/'.$this->skinname.'.js', 'action=raw&ctype=text/javascript');
576 }
577 }
578 }
579
580 class SkinDaVinci extends SkinPHPTal {
581 function initPage( &$out ) {
582 SkinPHPTal::initPage( $out );
583 $this->skinname = "davinci";
584 }
585 }
586
587 class SkinMono extends SkinPHPTal {
588 function initPage( &$out ) {
589 SkinPHPTal::initPage( $out );
590 $this->skinname = "mono";
591 }
592 }
593
594 class SkinMonoBook extends SkinPHPTal {
595 function initPage( &$out ) {
596 SkinPHPTal::initPage( $out );
597 $this->skinname = "monobook";
598 }
599 }
600
601 ?>