this-\>iseditable, fixes the doubleclick-on-edit-page-not working bug; false instead...
[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->iscontent = ($wgTitle->getNamespace() != Namespace::getSpecial() );
79 $this->iseditable = ($this->iscontent and !($action == 'edit' or $action == 'submit'));
80 $this->username = $wgUser->getName();
81 $this->userpage = $wgLang->getNsText( Namespace::getUser() ) . ":" . $wgUser->getName();
82 $this->userpageurl = $this->makeUrl($this->userpage);
83
84 if( $this->loggedin ) {
85 $this->usercss = $this->makeUrl($this->userpage.'/'.$this->skinname.'.css', 'action=raw&ctype=text/css');
86 $this->userjs = $this->makeUrl($this->userpage.'/'.$this->skinname.'.js', 'action=raw&ctype=text/javascript');
87 $this->userjse = htmlspecialchars($this->userjs);
88 } else {
89 $this->usercss = $this->userjs = $this->userjse = false;
90 }
91 $this->titletxt = $wgTitle->getPrefixedText();
92
93 $tpl->set( "title", $wgOut->getPageTitle() );
94 $tpl->set( "pagetitle", $wgOut->getHTMLTitle() );
95
96 $tpl->setRef( "thispage", &$this->thispage );
97 $subpagestr = $this->subPageSubtitle();
98 $tpl->set(
99 "subtitle", !empty($subpagestr)?
100 '<span class="subpages">'.$subpagestr.'</span>'.$out->getSubtitle():
101 $out->getSubtitle()
102 );
103 $tpl->set( 'catlinks', $this->getCategories());
104 if( $wgOut->isSyndicated() ) {
105 $feeds = array();
106 foreach( $wgFeedClasses as $format => $class ) {
107 $feeds[$format] = array(
108 'text' => $format,
109 'href' => $wgRequest->appendQuery( "feed=$format" ),
110 'ttip' => wfMsg('tooltip-'.$format)
111 );
112 }
113 $tpl->setRef( 'feeds', &$feeds );
114 }
115 $tpl->setRef( 'mimetype', &$wgMimeType );
116 $tpl->setRef( 'charset', &$wgOutputEncoding );
117 $tpl->set( 'headlinks', $out->getHeadLinks() );
118 $tpl->setRef( 'skinname', &$this->skinname );
119 $tpl->setRef( "loggedin", &$this->loggedin );
120 /* XXX currently unused, might get useful later
121 $tpl->set( "editable", ($wgTitle->getNamespace() != NS_SPECIAL ) );
122 $tpl->set( "exists", $wgTitle->getArticleID() != 0 );
123 $tpl->set( "watch", $wgTitle->userIsWatching() ? "unwatch" : "watch" );
124 $tpl->set( "protect", count($wgTitle->getRestrictions()) ? "unprotect" : "protect" );
125 $tpl->set( "helppage", wfMsg('helppage'));
126 $tpl->set( "sysop", $wgUser->isSysop() );
127 */
128 $tpl->set( "searchaction", $this->escapeSearchLink() );
129 $tpl->setRef( "stylepath", &$wgStylePath );
130 $tpl->setRef( "logopath", &$wgLogo );
131 $tpl->setRef( "lang", &$wgLanguageCode );
132 $tpl->set( "dir", $wgLang->isRTL() ? "rtl" : "ltr" );
133 $tpl->set( "rtl", $wgLang->isRTL() );
134 $tpl->set( "langname", $wgLang->getLanguageName( $wgLanguageCode ) );
135 $tpl->setRef( "username", &$this->username );
136 $tpl->setRef( "userpage", &$this->userpage);
137 $tpl->setRef( "userpageurl", &$this->userpageurl);
138 $tpl->setRef( "usercss", &$this->usercss);
139 $tpl->setRef( "userjs", &$this->userjs);
140 $tpl->setRef( "userjse", &$this->userjse);
141 if( $wgUser->getNewtalk() ) {
142 $usertitle = Title::newFromText( $this->userpage );
143 $usertalktitle = $usertitle->getTalkPage();
144 if($usertalktitle->getPrefixedDbKey() != $this->thispage){
145
146 $ntl = wfMsg( "newmessages",
147 $this->makeKnownLink(
148 $wgLang->getNsText( Namespace::getTalk( Namespace::getUser() ) )
149 . ":" . $this->username,
150 wfMsg("newmessageslink") )
151 );
152 }
153 } else {
154 $ntl = "";
155 }
156
157 $tpl->setRef( "newtalk", &$ntl );
158 $tpl->setRef( "skin", &$this);
159 $tpl->set( "logo", $this->logoText() );
160 if ( $wgOut->isArticle() and (!isset( $oldid ) or isset( $diff )) and 0 != $wgArticle->getID() ) {
161 if ( !$wgDisableCounters ) {
162 $viewcount = $wgLang->formatNum( $wgArticle->getCount() );
163 if ( $viewcount ) {
164 $tpl->set('viewcount', wfMsg( "viewcount", $viewcount ));
165 }
166 }
167 $tpl->set('lastmod', $this->lastModified());
168 $tpl->set('copyright',$this->getCopyright());
169 }
170 $tpl->set( "copyrightico", $this->getCopyrightIcon() );
171 $tpl->set( "poweredbyico", $this->getPoweredBy() );
172 $tpl->set( "disclaimer", $this->disclaimerLink() );
173 $tpl->set( "about", $this->aboutLink() );
174
175 $tpl->setRef( "debug", &$out->mDebugtext );
176 $tpl->set( "reporttime", $out->reportTime() );
177
178 $tpl->setRef( "bodytext", &$out->mBodytext );
179
180 $language_urls = array();
181 foreach( $wgOut->getLanguageLinks() as $l ) {
182 $nt = Title::newFromText( $l );
183 $language_urls[] = array('href' => $nt->getFullURL(),
184 'text' => ($wgLang->getLanguageName( $nt->getInterwiki()) != ''?$wgLang->getLanguageName( $nt->getInterwiki()) : $l),
185 'class' => $wgLang->isRTL() ? 'rtl' : 'ltr');
186 }
187 if(count($language_urls)) {
188 $tpl->setRef( 'language_urls', &$language_urls);
189 } else {
190 $tpl->set('language_urls', false);
191 }
192 $tpl->set('personal_urls', $this->buildPersonalUrls());
193 $content_actions = $this->buildContentActionUrls();
194 $tpl->setRef('content_actions', &$content_actions);
195 // XXX: attach this from javascript, same with section editing
196 if($this->iseditable && $wgUser->getOption("editondblclick") )
197 {
198 $tpl->set('body-ondblclick', 'document.location = "' .$content_actions['edit']['href'] .'";');
199 } else {
200 $tpl->set('body-ondblclick', false);
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 if( $this->iscontent ) {
301
302 $content_actions['article'] = array('class' => (!Namespace::isTalk( $wgTitle->getNamespace())) ? 'selected' : false,
303 'text' => wfMsg('article'),
304 'href' => $this->makeArticleUrl($this->thispage),
305 'ttip' => wfMsg('tooltip-article'),
306 'akey' => wfMsg('accesskey-article'));
307
308 /* set up the classes for the talk link */
309 $talk_class = (Namespace::isTalk( $wgTitle->getNamespace()) ? 'selected' : false);
310 $talktitle = Title::newFromText( $this->titletxt );
311 $talktitle = $talktitle->getTalkPage();
312 $this->checkTitle(&$talktitle, &$this->titletxt);
313 if($talktitle->getArticleId() != 0) {
314 $content_actions['talk'] = array(
315 'class' => $talk_class,
316 'text' => wfMsg('talk'),
317 'href' => $this->makeTalkUrl($this->titletxt),
318 'ttip' => wfMsg('tooltip-talk'),
319 'akey' => wfMsg('accesskey-talk')
320 );
321 } else {
322 $content_actions['talk'] = array(
323 'class' => $talk_class?$talk_class.' new':'new',
324 'text' => wfMsg('talk'),
325 'href' => $this->makeTalkUrl($this->titletxt,'action=edit'),
326 'ttip' => wfMsg('tooltip-talk'),
327 'akey' => wfMsg('accesskey-talk')
328 );
329 }
330
331 if ( $wgTitle->userCanEdit() ) {
332 $oid = ( $oldid && ! isset( $diff ) ) ? "&oldid={$oldid}" : false;
333 $istalk = ( Namespace::isTalk( $wgTitle->getNamespace()) );
334 $istalkclass = $istalk?' istalk':'';
335 $content_actions['edit'] = array(
336 'class' => (($this->iseditable and $section != 'new') ? 'selected' : '').$istalkclass,
337 'text' => wfMsg('edit'),
338 'href' => $this->makeUrl($this->thispage, 'action=edit'.$oid),
339 'ttip' => wfMsg('tooltip-edit'),
340 'akey' => wfMsg('accesskey-edit')
341 );
342 if ( $istalk ) {
343 $content_actions['addsection'] = array(
344 'class' => $section == 'new'?'selected':false,
345 'text' => wfMsg('addsection'),
346 'href' => $this->makeUrl($this->thispage, 'action=edit&section=new'),
347 'ttip' => wfMsg('tooltip-addsection'),
348 'akey' => wfMsg('accesskey-addsection')
349 );
350 }
351 } else {
352 $oid = ( $oldid && ! isset( $diff ) ) ? "&oldid={$oldid}" : '';
353 $content_actions['edit'] = array('class' => ($action == 'edit') ? 'selected' : false,
354 'text' => wfMsg('viewsource'),
355 'href' => $this->makeUrl($this->thispage, 'action=edit'.$oid),
356 'ttip' => wfMsg('tooltip-viewsource'),
357 'akey' => wfMsg('accesskey-viewsource'));
358 }
359
360 if ( $wgTitle->getArticleId() ) {
361
362 $content_actions['history'] = array('class' => ($action == 'history') ? 'selected' : false,
363 'text' => wfMsg('history_short'),
364 'href' => $this->makeUrl($this->thispage, 'action=history'),
365 'ttip' => wfMsg('tooltip-history'),
366 'akey' => wfMsg('accesskey-history'));
367
368 # XXX: is there a rollback action anywhere or is it planned?
369 # Don't recall where i got this from...
370 /*if( $wgUser->getNewtalk() ) {
371 $content_actions['rollback'] = array('class' => ($action == 'rollback') ? 'selected' : false,
372 'text' => wfMsg('rollback_short'),
373 'href' => $this->makeUrl($this->thispage, 'action=rollback'),
374 'ttip' => wfMsg('tooltip-rollback'),
375 'akey' => wfMsg('accesskey-rollback'));
376 }*/
377
378 if($wgUser->isSysop()){
379 if(!$wgTitle->isProtected()){
380 $content_actions['protect'] = array(
381 'class' => ($action == 'protect') ? 'selected' : false,
382 'text' => wfMsg('protect'),
383 'href' => $this->makeUrl($this->thispage, 'action=protect'),
384 'ttip' => wfMsg('tooltip-protect'),
385 'akey' => wfMsg('accesskey-protect')
386 );
387
388 } else {
389 $content_actions['unprotect'] = array(
390 'class' => ($action == 'unprotect') ? 'selected' : false,
391 'text' => wfMsg('unprotect'),
392 'href' => $this->makeUrl($this->thispage, 'action=unprotect'),
393 'ttip' => wfMsg('tooltip-protect'),
394 'akey' => wfMsg('accesskey-protect')
395 );
396 }
397 $content_actions['delete'] = array(
398 'class' => ($action == 'delete') ? 'selected' : false,
399 'text' => wfMsg('delete'),
400 'href' => $this->makeUrl($this->thispage, 'action=delete'),
401 'ttip' => wfMsg('tooltip-delete'),
402 'akey' => wfMsg('accesskey-delete')
403 );
404 }
405 if ( $wgUser->getID() != 0 ) {
406 if ( $wgTitle->userCanEdit()) {
407 $content_actions['move'] = array('class' => ($wgTitle->getDbKey() == 'Movepage' and $wgTitle->getNamespace == Namespace::getSpecial()) ? 'selected' : false,
408 'text' => wfMsg('move'),
409 'href' => $this->makeSpecialUrl('Movepage', 'target='.$this->thispage),
410 'ttip' => wfMsg('tooltip-move'),
411 'akey' => wfMsg('accesskey-move'));
412 } else {
413 $content_actions['move'] = array('class' => 'inactive',
414 'text' => wfMsg('move'),
415 'href' => false,
416 'ttip' => wfMsg('tooltip-nomove'),
417 'akey' => false);
418
419 }
420 }
421 } else {
422 //article doesn't exist or is deleted
423 if($wgUser->isSysop()){
424 if( $n = $wgTitle->isDeleted() ) {
425 $content_actions['delete'] = array(
426 'class' => false,
427 'text' => wfMsg( "undelete_short", $n ),
428 'href' => $this->makeSpecialUrl('Undelete/'.$this->thispage),
429 'ttip' => wfMsg('tooltip-undelete', $n),
430 'akey' => wfMsg('accesskey-undelete')
431 );
432 }
433 }
434 }
435
436 if ( $wgUser->getID() != 0 and $action != 'edit' and $action != 'submit' ) {
437 if( !$wgTitle->userIsWatching()) {
438 $content_actions['watch'] = array('class' => ($action == 'watch' or $action == 'unwatch') ? 'selected' : false,
439 'text' => wfMsg('watch'),
440 'href' => $this->makeUrl($this->thispage, 'action=watch'),
441 'ttip' => wfMsg('tooltip-watch'),
442 'akey' => wfMsg('accesskey-watch'));
443 } else {
444 $content_actions['watch'] = array('class' => ($action == 'unwatch' or $action == 'watch') ? 'selected' : false,
445 'text' => wfMsg('unwatch'),
446 'href' => $this->makeUrl($this->thispage, 'action=unwatch'),
447 'ttip' => wfMsg('tooltip-unwatch'),
448 'akey' => wfMsg('accesskey-unwatch'));
449
450 }
451 }
452 } else {
453 /* show special page tab */
454
455 $content_actions['article'] = array('class' => 'selected',
456 'text' => wfMsg('specialpage'),
457 'href' => false,
458 'ttip' => wfMsg('tooltip-specialpage'),
459 'akey' => false);
460 }
461
462 return $content_actions;
463 }
464
465 # build array of common navigation links
466 function buildNavUrls () {
467 global $wgTitle, $wgUser, $wgRequest;
468 global $wgSiteSupportPage;
469
470 $action = $wgRequest->getText( 'action' );
471 $oldid = $wgRequest->getVal( 'oldid' );
472 $diff = $wgRequest->getVal( 'diff' );
473 // XXX: remove htmlspecialchars when tal:attributes works with i18n:attributes
474 $nav_urls = array();
475 $nav_urls['mainpage'] = array('href' => htmlspecialchars( $this->makeI18nUrl('mainpage')));
476 $nav_urls['randompage'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Randompage')));
477 $nav_urls['recentchanges'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Recentchanges')));
478 $nav_urls['whatlinkshere'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Whatlinkshere', 'target='.$this->thispage)));
479 $nav_urls['currentevents'] = (wfMsg('currentevents') != '-') ? array('href' => htmlspecialchars( $this->makeI18nUrl('currentevents'))) : false;
480 $nav_urls['portal'] = (wfMsg('portal') != '-') ? array('href' => htmlspecialchars( $this->makeI18nUrl('portal-url'))) : false;
481 $nav_urls['recentchangeslinked'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Recentchangeslinked', 'target='.$this->thispage)));
482 $nav_urls['bugreports'] = array('href' => htmlspecialchars( $this->makeI18nUrl('bugreportspage')));
483 // $nav_urls['sitesupport'] = array('href' => htmlspecialchars( $this->makeI18nUrl('sitesupportpage')));
484 $nav_urls['sitesupport'] = array('href' => htmlspecialchars( $wgSiteSupportPage));
485 $nav_urls['help'] = array('href' => htmlspecialchars( $this->makeI18nUrl('helppage')));
486 $nav_urls['upload'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Upload')));
487 $nav_urls['specialpages'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Specialpages')));
488
489
490 $id=User::idFromName($wgTitle->getText());
491 $ip=User::isIP($wgTitle->getText());
492
493 if($id || $ip) { # both anons and non-anons have contri list
494 $nav_urls['contributions'] = array(
495 'href' => htmlspecialchars( $this->makeSpecialUrl('Contributions', "target=" . $wgTitle->getPartialURL() ) )
496 );
497 }
498 if ( 0 != $wgUser->getID() ) { # show only to signed in users
499 if($id) { # can only email non-anons
500 $nav_urls['emailuser'] = array(
501 'href' => htmlspecialchars( $this->makeSpecialUrl('Emailuser', "target=" . $wgTitle->getPartialURL() ) )
502 );
503 }
504 }
505
506
507 return $nav_urls;
508 }
509
510 /*static*/ function makeSpecialUrl( $name, $urlaction='' ) {
511 $title = Title::makeTitle( NS_SPECIAL, $name );
512 $this->checkTitle(&$title, &$name);
513 return $title->getLocalURL( $urlaction );
514 }
515 /*static*/ function makeTalkUrl ( $name, $urlaction='' ) {
516 $title = Title::newFromText( $name );
517 $title = $title->getTalkPage();
518 $this->checkTitle(&$title, &$name);
519 return $title->getLocalURL( $urlaction );
520 }
521 /*static*/ function makeArticleUrl ( $name, $urlaction='' ) {
522 $title = Title::newFromText( $name );
523 $title= $title->getSubjectPage();
524 $this->checkTitle(&$title, &$name);
525 return $title->getLocalURL( $urlaction );
526 }
527 /*static*/ function makeI18nUrl ( $name, $urlaction='' ) {
528 $title = Title::newFromText( wfMsg($name) );
529 $this->checkTitle(&$title, &$name);
530 return $title->getLocalURL( $urlaction );
531 }
532 /*static*/ function makeUrl ( $name, $urlaction='' ) {
533 $title = Title::newFromText( $name );
534 $this->checkTitle(&$title, &$name);
535 return $title->getLocalURL( $urlaction );
536 }
537
538 # make sure we have some title to operate on, mind the '&'
539 /*static*/ function checkTitle ( &$title, &$name ) {
540 if(!is_object($title)) {
541 $title = Title::newFromText( $name );
542 if(!is_object($title)) {
543 $title = Title::newFromText( '<error: link target missing>' );
544 }
545 }
546 }
547
548
549 }
550
551 class SkinDaVinci extends SkinPHPTal {
552 function initPage( &$out ) {
553 SkinPHPTal::initPage( $out );
554 $this->skinname = "davinci";
555 }
556 }
557
558 class SkinMono extends SkinPHPTal {
559 function initPage( &$out ) {
560 SkinPHPTal::initPage( $out );
561 $this->skinname = "mono";
562 }
563 }
564
565 class SkinMonoBook extends SkinPHPTal {
566 function initPage( &$out ) {
567 SkinPHPTal::initPage( $out );
568 $this->skinname = "monobook";
569 }
570 }
571
572 ?>