no escaped version of user css url
[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 "PHPTAL.php";
30
31 class MediaWiki_I18N extends PHPTAL_I18N
32 {
33 var $_context = array();
34
35 function set($varName, $value) {
36 $this->_context[$varName] = $value;
37 }
38
39 function translate($value) {
40 $value = wfMsg( $value );
41 // interpolate variables
42 while (preg_match('/\$([0-9]*?)/sm', $value, $m)) {
43 list($src, $var) = $m;
44 $varValue = @$this->_context[$var];
45 $value = str_replace($src, $varValue, $value);
46 }
47 return $value;
48 }
49 }
50
51 class SkinPHPTal extends Skin {
52 var $template;
53
54 function initPage( &$out ) {
55 parent::initPage( $out );
56 $this->skinname = "davinci";
57 $this->template = "xhtml_slim";
58 }
59
60 function outputPage( &$out ) {
61 global $wgTitle, $wgArticle, $wgUser, $wgLang, $wgOut;
62 global $wgScript, $wgStylePath, $wgLanguageCode, $wgUseNewInterlanguage;
63 global $wgMimeType, $wgOutputEncoding, $wgUseDatabaseMessages, $wgRequest;
64 global $wgDisableCounters, $wgLogo, $action, $wgFeedClasses;
65
66 extract( $wgRequest->getValues( 'oldid', 'diff' ) );
67
68 $this->initPage( $out );
69 $tpl = new PHPTAL($this->template . '.pt', 'templates');
70
71 #if ( $wgUseDatabaseMessages ) { // uncomment this to fall back to GetText
72 $tpl->setTranslator(new MediaWiki_I18N());
73 #}
74
75 $this->thispage = $wgTitle->getPrefixedDbKey();
76 $this->thisurl = $wgTitle->getPrefixedURL();
77 $this->loggedin = $wgUser->getID() != 0;
78 $this->username = $wgUser->getName();
79 $this->userpage = $wgLang->getNsText( Namespace::getUser() ) . ":" . $wgUser->getName();
80 $this->userpageurl = $this->makeUrl($this->userpage);
81
82 if( $this->loggedin ) {
83 $this->usercss = $this->makeUrl($this->userpage.'/'.$this->skinname.'.css', 'action=raw&ctype=text/css');
84 $this->userjs = $this->makeUrl($this->userpage.'/'.$this->skinname.'.js', 'action=raw&ctype=text/javascript');
85 $this->userjse = htmlspecialchars($this->userjs);
86 } else {
87 $this->usercss = $this->userjs = $this->userjse = false;
88 }
89 $this->titletxt = $wgTitle->getPrefixedText();
90
91 $tpl->set( "title", $wgOut->getPageTitle() );
92 $tpl->set( "pagetitle", $wgOut->getHTMLTitle() );
93
94 $tpl->setRef( "thispage", &$this->thispage );
95 $subpagestr = $this->subPageSubtitle();
96 $tpl->set(
97 "subtitle", !empty($subpagestr)?
98 '<span class="subpages">'.$subpagestr.'</span>'.$out->getSubtitle():
99 $out->getSubtitle()
100 );
101 $tpl->set( 'catlinks', $this->getCategories());
102 if( $wgOut->isSyndicated() ) {
103 $feeds = array();
104 foreach( $wgFeedClasses as $format => $class ) {
105 $feeds[$format] = array(
106 'text' => $format,
107 'href' => $wgRequest->appendQuery( "feed=$format" ),
108 'ttip' => wfMsg('tooltip-'.$format)
109 );
110 }
111 $tpl->setRef( 'feeds', &$feeds );
112 }
113 $tpl->setRef( 'mimetype', &$wgMimeType );
114 $tpl->setRef( 'charset', &$wgOutputEncoding );
115 $tpl->set( 'headlinks', $out->getHeadLinks() );
116 $tpl->setRef( 'skinname', &$this->skinname );
117 $tpl->setRef( "loggedin", &$this->loggedin );
118 /* XXX currently unused, might get useful later
119 $tpl->set( "editable", ($wgTitle->getNamespace() != NS_SPECIAL ) );
120 $tpl->set( "exists", $wgTitle->getArticleID() != 0 );
121 $tpl->set( "watch", $wgTitle->userIsWatching() ? "unwatch" : "watch" );
122 $tpl->set( "protect", count($wgTitle->getRestrictions()) ? "unprotect" : "protect" );
123 $tpl->set( "helppage", wfMsg('helppage'));
124 $tpl->set( "sysop", $wgUser->isSysop() );
125 */
126 $tpl->set( "searchaction", $this->escapeSearchLink() );
127 $tpl->setRef( "stylepath", &$wgStylePath );
128 $tpl->setRef( "logopath", &$wgLogo );
129 $tpl->setRef( "lang", &$wgLanguageCode );
130 $tpl->set( "dir", $wgLang->isRTL() ? "rtl" : "ltr" );
131 $tpl->set( "rtl", $wgLang->isRTL() );
132 $tpl->set( "langname", $wgLang->getLanguageName( $wgLanguageCode ) );
133 $tpl->setRef( "username", &$this->username );
134 $tpl->setRef( "userpage", &$this->userpage);
135 $tpl->setRef( "userpageurl", &$this->userpageurl);
136 $tpl->setRef( "usercss", &$this->usercss);
137 $tpl->setRef( "userjs", &$this->userjs);
138 $tpl->setRef( "userjse", &$this->userjse);
139 if( $wgUser->getNewtalk() ) {
140 $usertitle = Title::newFromText( $this->userpage );
141 $usertalktitle = $usertitle->getTalkPage();
142 if($usertalktitle->getPrefixedDbKey() != $this->thispage){
143
144 $ntl = wfMsg( "newmessages",
145 $this->makeKnownLink(
146 $wgLang->getNsText( Namespace::getTalk( Namespace::getUser() ) )
147 . ":" . $this->username,
148 wfMsg("newmessageslink") )
149 );
150 }
151 } else {
152 $ntl = "";
153 }
154
155 $tpl->setRef( "newtalk", &$ntl );
156 $tpl->setRef( "skin", &$this);
157 $tpl->set( "logo", $this->logoText() );
158 if ( $wgOut->isArticle() and (!isset( $oldid ) or isset( $diff )) and 0 != $wgArticle->getID() ) {
159 if ( !$wgDisableCounters ) {
160 $viewcount = $wgLang->formatNum( $wgArticle->getCount() );
161 if ( $viewcount ) {
162 $tpl->set('viewcount', wfMsg( "viewcount", $viewcount ));
163 }
164 }
165 $tpl->set('lastmod', $this->lastModified());
166 $tpl->set('copyright',$this->getCopyright());
167 }
168 $tpl->set( "copyrightico", $this->getCopyrightIcon() );
169 $tpl->set( "poweredbyico", $this->getPoweredBy() );
170 $tpl->set( "disclaimer", $this->disclaimerLink() );
171 $tpl->set( "about", $this->aboutLink() );
172
173 $tpl->setRef( "debug", &$out->mDebugtext );
174 $tpl->set( "reporttime", $out->reportTime() );
175
176 $tpl->setRef( "bodytext", &$out->mBodytext );
177
178 $language_urls = array();
179 foreach( $wgOut->getLanguageLinks() as $l ) {
180 $nt = Title::newFromText( $l );
181 $language_urls[] = array('href' => $nt->getFullURL(),
182 'text' => ($wgLang->getLanguageName( $nt->getInterwiki()) != ''?$wgLang->getLanguageName( $nt->getInterwiki()) : $l),
183 'class' => $wgLang->isRTL() ? 'rtl' : 'ltr');
184 }
185 if(count($language_urls)) {
186 $tpl->setRef( 'language_urls', &$language_urls);
187 } else {
188 $tpl->set('language_urls', false);
189 }
190 $tpl->set('personal_urls', $this->buildPersonalUrls());
191 $content_actions = $this->buildContentActionUrls();
192 $tpl->setRef('content_actions', &$content_actions);
193 // XXX: attach this from javascript, same with section editing
194 if(isset($content_actions['edit']['href']) &&
195 !(isset($content_actions['edit']['class']) && $content_actions['edit']['class'] != '') &&
196 $wgUser->getOption("editondblclick") )
197 {
198 $tpl->set('body-ondblclick', 'document.location = "' .$content_actions['edit']['href'] .'";');
199 } else {
200 $tpl->set('body-ondblclick', '');
201 }
202 $tpl->set( "nav_urls", $this->buildNavUrls() );
203
204 // execute template
205 $res = $tpl->execute();
206 // result may be an error
207 if (PEAR::isError($res)) {
208 echo $res->toString(), "\n";
209 } else {
210 echo $res;
211 }
212
213 }
214
215 # build array of urls for personal toolbar
216 function buildPersonalUrls() {
217 /* set up the default links for the personal toolbar */
218 global $wgShowIPinHeader;
219 $personal_urls = array();
220 if ($this->loggedin) {
221 $personal_urls['userpage'] = array(
222 'text' => $this->username,
223 'href' => &$this->userpageurl,
224 'ttip' => wfMsg('tooltip-userpage'),
225 'akey' => wfMsg('accesskey-userpage')
226 );
227 $personal_urls['mytalk'] = array(
228 'text' => wfMsg('mytalk'),
229 'href' => $this->makeTalkUrl($this->userpage),
230 'ttip' => wfMsg('tooltip-mytalk'),
231 'akey' => wfMsg('accesskey-mytalk')
232 );
233 $personal_urls['preferences'] = array(
234 'text' => wfMsg('preferences'),
235 'href' => $this->makeSpecialUrl('Preferences'),
236 'ttip' => wfMsg('tooltip-preferences'),
237 'akey' => wfMsg('accesskey-preferences')
238 );
239 $personal_urls['watchlist'] = array(
240 'text' => wfMsg('watchlist'),
241 'href' => $this->makeSpecialUrl('Watchlist'),
242 'ttip' => wfMsg('tooltip-watchlist'),
243 'akey' => wfMsg('accesskey-watchlist')
244 );
245 $personal_urls['mycontris'] = array(
246 'text' => wfMsg('mycontris'),
247 'href' => $this->makeSpecialUrl('Contributions','target=' . $this->username),
248 'ttip' => wfMsg('tooltip-mycontris'),
249 'akey' => wfMsg('accesskey-mycontris')
250 );
251 $personal_urls['logout'] = array(
252 'text' => wfMsg('userlogout'),
253 'href' => $this->makeSpecialUrl('Userlogout','returnto=' . $this->thisurl),
254 'ttip' => wfMsg('tooltip-logout'),
255 'akey' => wfMsg('accesskey-logout')
256 );
257 } else {
258 if( $wgShowIPinHeader && isset( $_COOKIE[ini_get("session.name")] ) ) {
259 $personal_urls['anonuserpage'] = array(
260 'text' => $this->username,
261 'href' => $this->makeUrl($this->userpage),
262 'ttip' => wfMsg('tooltip-anonuserpage'),
263 'akey' => wfMsg('accesskey-anonuserpage')
264 );
265 $personal_urls['anontalk'] = array(
266 'text' => wfMsg('anontalk'),
267 'href' => $this->makeTalkUrl($this->userpage),
268 'ttip' => wfMsg('tooltip-anontalk'),
269 'akey' => wfMsg('accesskey-anontalk')
270 );
271 $personal_urls['anonlogin'] = array(
272 'text' => wfMsg('userlogin'),
273 'href' => $this->makeSpecialUrl('Userlogin', 'returnto='.$this->thisurl),
274 'ttip' => wfMsg('tooltip-login'),
275 'akey' => wfMsg('accesskey-login')
276 );
277 } else {
278
279 $personal_urls['login'] = array(
280 'text' => wfMsg('userlogin'),
281 'href' => $this->makeSpecialUrl('Userlogin', 'returnto='.$this->thisurl),
282 'ttip' => wfMsg('tooltip-login'),
283 'akey' => wfMsg('accesskey-login')
284 );
285 }
286 }
287
288 return $personal_urls;
289 }
290
291 # an array of edit links by default used for the tabs
292 function buildContentActionUrls () {
293 global $wgTitle, $wgUser, $wgRequest;
294 $action = $wgRequest->getText( 'action' );
295 $section = $wgRequest->getText( 'section' );
296 $oldid = $wgRequest->getVal( 'oldid' );
297 $diff = $wgRequest->getVal( 'diff' );
298 $content_actions = array();
299
300 $iscontent = ($wgTitle->getNamespace() != Namespace::getSpecial() );
301 if( $iscontent) {
302
303 $content_actions['article'] = array('class' => (!Namespace::isTalk( $wgTitle->getNamespace())) ? 'selected' : '',
304 'text' => wfMsg('article'),
305 'href' => $this->makeArticleUrl($this->thispage),
306 'ttip' => wfMsg('tooltip-article'),
307 'akey' => wfMsg('accesskey-article'));
308
309 /* set up the classes for the talk link */
310 $talk_class = (Namespace::isTalk( $wgTitle->getNamespace()) ? 'selected' : '');
311 $talktitle = Title::newFromText( $this->titletxt );
312 $talktitle = $talktitle->getTalkPage();
313 $this->checkTitle(&$talktitle, &$this->titletxt);
314 if($talktitle->getArticleId() != 0) {
315 $content_actions['talk'] = array(
316 'class' => $talk_class,
317 'text' => wfMsg('talk'),
318 'href' => $this->makeTalkUrl($this->titletxt),
319 'ttip' => wfMsg('tooltip-talk'),
320 'akey' => wfMsg('accesskey-talk')
321 );
322 } else {
323 $content_actions['talk'] = array(
324 'class' => $talk_class?$talk_class.' new':'new',
325 'text' => wfMsg('talk'),
326 'href' => $this->makeTalkUrl($this->titletxt,'action=edit'),
327 'ttip' => wfMsg('tooltip-talk'),
328 'akey' => wfMsg('accesskey-talk')
329 );
330 }
331
332 if ( $wgTitle->userCanEdit() ) {
333 $oid = ( $oldid && ! isset( $diff ) ) ? "&oldid={$oldid}" : '';
334 $istalk = ( Namespace::isTalk( $wgTitle->getNamespace()) );
335 $istalkclass = $istalk?' istalk':'';
336 $content_actions['edit'] = array(
337 'class' => ((($action == 'edit' or $action == 'submit') and $section != 'new') ? 'selected' : '').$istalkclass,
338 'text' => wfMsg('edit'),
339 'href' => $this->makeUrl($this->thispage, 'action=edit'.$oid),
340 'ttip' => wfMsg('tooltip-edit'),
341 'akey' => wfMsg('accesskey-edit')
342 );
343 if ( $istalk ) {
344 $content_actions['addsection'] = array(
345 'class' => $section == 'new'?'selected':'',
346 'text' => wfMsg('addsection'),
347 'href' => $this->makeUrl($this->thispage, 'action=edit&section=new'),
348 'ttip' => wfMsg('tooltip-addsection'),
349 'akey' => wfMsg('accesskey-addsection')
350 );
351 }
352 } else {
353 $oid = ( $oldid && ! isset( $diff ) ) ? "&oldid={$oldid}" : '';
354 $content_actions['edit'] = array('class' => ($action == 'edit') ? 'selected' : '',
355 'text' => wfMsg('viewsource'),
356 'href' => $this->makeUrl($this->thispage, 'action=edit'.$oid),
357 'ttip' => wfMsg('tooltip-viewsource'),
358 'akey' => wfMsg('accesskey-viewsource'));
359 }
360
361 if ( $wgTitle->getArticleId() ) {
362
363 $content_actions['history'] = array('class' => ($action == 'history') ? 'selected' : '',
364 'text' => wfMsg('history_short'),
365 'href' => $this->makeUrl($this->thispage, 'action=history'),
366 'ttip' => wfMsg('tooltip-history'),
367 'akey' => wfMsg('accesskey-history'));
368
369 # XXX: is there a rollback action anywhere or is it planned?
370 # Don't recall where i got this from...
371 /*if( $wgUser->getNewtalk() ) {
372 $content_actions['rollback'] = array('class' => ($action == 'rollback') ? 'selected' : '',
373 'text' => wfMsg('rollback_short'),
374 'href' => $this->makeUrl($this->thispage, 'action=rollback'),
375 'ttip' => wfMsg('tooltip-rollback'),
376 'akey' => wfMsg('accesskey-rollback'));
377 }*/
378
379 if($wgUser->isSysop()){
380 if(!$wgTitle->isProtected()){
381 $content_actions['protect'] = array(
382 'class' => ($action == 'protect') ? 'selected' : '',
383 'text' => wfMsg('protect'),
384 'href' => $this->makeUrl($this->thispage, 'action=protect'),
385 'ttip' => wfMsg('tooltip-protect'),
386 'akey' => wfMsg('accesskey-protect')
387 );
388
389 } else {
390 $content_actions['unprotect'] = array(
391 'class' => ($action == 'unprotect') ? 'selected' : '',
392 'text' => wfMsg('unprotect'),
393 'href' => $this->makeUrl($this->thispage, 'action=unprotect'),
394 'ttip' => wfMsg('tooltip-protect'),
395 'akey' => wfMsg('accesskey-protect')
396 );
397 }
398 $content_actions['delete'] = array(
399 'class' => ($action == 'delete') ? 'selected' : '',
400 'text' => wfMsg('delete'),
401 'href' => $this->makeUrl($this->thispage, 'action=delete'),
402 'ttip' => wfMsg('tooltip-delete'),
403 'akey' => wfMsg('accesskey-delete')
404 );
405 }
406 if ( $wgUser->getID() != 0 ) {
407 if ( $wgTitle->userCanEdit()) {
408 $content_actions['move'] = array('class' => ($wgTitle->getDbKey() == 'Movepage' and $wgTitle->getNamespace == Namespace::getSpecial()) ? 'selected' : '',
409 'text' => wfMsg('move'),
410 'href' => $this->makeSpecialUrl('Movepage', 'target='.$this->thispage),
411 'ttip' => wfMsg('tooltip-move'),
412 'akey' => wfMsg('accesskey-move'));
413 } else {
414 $content_actions['move'] = array('class' => 'inactive',
415 'text' => wfMsg('move'),
416 'href' => false,
417 'ttip' => wfMsg('tooltip-nomove'),
418 'akey' => false);
419
420 }
421 }
422 } else {
423 //article doesn't exist or is deleted
424 if($wgUser->isSysop()){
425 if( $n = $wgTitle->isDeleted() ) {
426 $content_actions['delete'] = array(
427 'class' => '',
428 'text' => wfMsg( "undelete_short", $n ),
429 'href' => $this->makeSpecialUrl('Undelete/'.$this->thispage),
430 'ttip' => wfMsg('tooltip-undelete', $n),
431 'akey' => wfMsg('accesskey-undelete')
432 );
433 }
434 }
435 }
436
437 if ( $wgUser->getID() != 0 and $action != 'edit' and $action != 'submit' ) {
438 if( !$wgTitle->userIsWatching()) {
439 $content_actions['watch'] = array('class' => ($action == 'watch' or $action == 'unwatch') ? 'selected' : '',
440 'text' => wfMsg('watch'),
441 'href' => $this->makeUrl($this->thispage, 'action=watch'),
442 'ttip' => wfMsg('tooltip-watch'),
443 'akey' => wfMsg('accesskey-watch'));
444 } else {
445 $content_actions['watch'] = array('class' => ($action == 'unwatch' or $action == 'watch') ? 'selected' : '',
446 'text' => wfMsg('unwatch'),
447 'href' => $this->makeUrl($this->thispage, 'action=unwatch'),
448 'ttip' => wfMsg('tooltip-unwatch'),
449 'akey' => wfMsg('accesskey-unwatch'));
450
451 }
452 }
453 } else {
454 /* show special page tab */
455
456 $content_actions['article'] = array('class' => 'selected',
457 'text' => wfMsg('specialpage'),
458 'href' => false,
459 'ttip' => wfMsg('tooltip-specialpage'),
460 'akey' => false);
461 }
462
463 return $content_actions;
464 }
465
466 # build array of common navigation links
467 function buildNavUrls () {
468 global $wgTitle, $wgUser, $wgRequest;
469 global $wgSiteSupportPage;
470
471 $action = $wgRequest->getText( 'action' );
472 $oldid = $wgRequest->getVal( 'oldid' );
473 $diff = $wgRequest->getVal( 'diff' );
474 // XXX: remove htmlspecialchars when tal:attributes works with i18n:attributes
475 $nav_urls = array();
476 $nav_urls['mainpage'] = array('href' => htmlspecialchars( $this->makeI18nUrl('mainpage')));
477 $nav_urls['randompage'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Randompage')));
478 $nav_urls['recentchanges'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Recentchanges')));
479 $nav_urls['whatlinkshere'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Whatlinkshere', 'target='.$this->thispage)));
480 $nav_urls['currentevents'] = (wfMsg('currentevents') != '-') ? array('href' => htmlspecialchars( $this->makeI18nUrl('currentevents'))) : '';
481 $nav_urls['portal'] = (wfMsg('portal') != '-') ? array('href' => htmlspecialchars( $this->makeI18nUrl('portal-url'))) : '';
482 $nav_urls['recentchangeslinked'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Recentchangeslinked', 'target='.$this->thispage)));
483 $nav_urls['bugreports'] = array('href' => htmlspecialchars( $this->makeI18nUrl('bugreportspage')));
484 // $nav_urls['sitesupport'] = array('href' => htmlspecialchars( $this->makeI18nUrl('sitesupportpage')));
485 $nav_urls['sitesupport'] = array('href' => htmlspecialchars( $wgSiteSupportPage));
486 $nav_urls['help'] = array('href' => htmlspecialchars( $this->makeI18nUrl('helppage')));
487 $nav_urls['upload'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Upload')));
488 $nav_urls['specialpages'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Specialpages')));
489
490
491 $id=User::idFromName($wgTitle->getText());
492 $ip=User::isIP($wgTitle->getText());
493
494 if($id || $ip) { # both anons and non-anons have contri list
495 $nav_urls['contributions'] = array(
496 'href' => htmlspecialchars( $this->makeSpecialUrl('Contributions', "target=" . $wgTitle->getPartialURL() ) )
497 );
498 }
499 if ( 0 != $wgUser->getID() ) { # show only to signed in users
500 if($id) { # can only email non-anons
501 $nav_urls['emailuser'] = array(
502 'href' => htmlspecialchars( $this->makeSpecialUrl('Emailuser', "target=" . $wgTitle->getPartialURL() ) )
503 );
504 }
505 }
506
507
508 return $nav_urls;
509 }
510
511 /*static*/ function makeSpecialUrl( $name, $urlaction='' ) {
512 $title = Title::makeTitle( NS_SPECIAL, $name );
513 $this->checkTitle(&$title, &$name);
514 return $title->getLocalURL( $urlaction );
515 }
516 /*static*/ function makeTalkUrl ( $name, $urlaction='' ) {
517 $title = Title::newFromText( $name );
518 $title = $title->getTalkPage();
519 $this->checkTitle(&$title, &$name);
520 return $title->getLocalURL( $urlaction );
521 }
522 /*static*/ function makeArticleUrl ( $name, $urlaction='' ) {
523 $title = Title::newFromText( $name );
524 $title= $title->getSubjectPage();
525 $this->checkTitle(&$title, &$name);
526 return $title->getLocalURL( $urlaction );
527 }
528 /*static*/ function makeI18nUrl ( $name, $urlaction='' ) {
529 $title = Title::newFromText( wfMsg($name) );
530 $this->checkTitle(&$title, &$name);
531 return $title->getLocalURL( $urlaction );
532 }
533 /*static*/ function makeUrl ( $name, $urlaction='' ) {
534 $title = Title::newFromText( $name );
535 $this->checkTitle(&$title, &$name);
536 return $title->getLocalURL( $urlaction );
537 }
538
539 # make sure we have some title to operate on, mind the '&'
540 /*static*/ function checkTitle ( &$title, &$name ) {
541 if(!is_object($title)) {
542 $title = Title::newFromText( $name );
543 if(!is_object($title)) {
544 $title = Title::newFromText( '<error: link target missing>' );
545 }
546 }
547 }
548
549
550 }
551
552 class SkinDaVinci extends SkinPHPTal {
553 function initPage( &$out ) {
554 SkinPHPTal::initPage( $out );
555 $this->skinname = "davinci";
556 }
557 }
558
559 class SkinMono extends SkinPHPTal {
560 function initPage( &$out ) {
561 SkinPHPTal::initPage( $out );
562 $this->skinname = "mono";
563 }
564 }
565
566 class SkinMonoBook extends SkinPHPTal {
567 function initPage( &$out ) {
568 SkinPHPTal::initPage( $out );
569 $this->skinname = "monobook";
570 }
571 }
572
573 ?>