Merged my changes from REL1_4
[lhc/web/wiklou.git] / includes / Skin.php
1 <?php
2
3 /**
4 *
5 * @package MediaWiki
6 * @subpackage Skins
7 */
8
9 /**
10 * This is not a valid entry point, perform no further processing unless MEDIAWIKI is defined
11 */
12 if( defined( "MEDIAWIKI" ) ) {
13
14 # See skin.doc
15 require_once( 'Linker.php' );
16 require_once( 'Image.php' );
17
18 # Get a list of all skins available in /skins/
19 # Build using the regular expression '^(.*).php$'
20 # Array keys are all lower case, array value keep the case used by filename
21 #
22
23 $skinDir = dir($IP.'/skins');
24
25 # while code from www.php.net
26 while (false !== ($file = $skinDir->read())) {
27 if(preg_match('/^([^.].*)\.php$/',$file, $matches)) {
28 $aSkin = $matches[1];
29 $wgValidSkinNames[strtolower($aSkin)] = $aSkin;
30 }
31 }
32 $skinDir->close();
33 unset($matches);
34
35 require_once( 'RecentChange.php' );
36
37 global $wgLinkHolders;
38 $wgLinkHolders = array(
39 'namespaces' => array(),
40 'dbkeys' => array(),
41 'queries' => array(),
42 'texts' => array(),
43 'titles' => array()
44 );
45 global $wgInterwikiLinkHolders;
46 $wgInterwikiLinkHolders = array();
47
48 /**
49 * @todo document
50 * @package MediaWiki
51 */
52 class RCCacheEntry extends RecentChange
53 {
54 var $secureName, $link;
55 var $curlink , $difflink, $lastlink , $usertalklink , $versionlink ;
56 var $userlink, $timestamp, $watched;
57
58 function newFromParent( $rc )
59 {
60 $rc2 = new RCCacheEntry;
61 $rc2->mAttribs = $rc->mAttribs;
62 $rc2->mExtra = $rc->mExtra;
63 return $rc2;
64 }
65 } ;
66
67
68 /**
69 * The main skin class that provide methods and properties for all other skins
70 * including PHPTal skins.
71 * This base class is also the "Standard" skin.
72 * @package MediaWiki
73 */
74 class Skin extends Linker {
75 /**#@+
76 * @access private
77 */
78 var $lastdate, $lastline;
79 var $rc_cache ; # Cache for Enhanced Recent Changes
80 var $rcCacheIndex ; # Recent Changes Cache Counter for visibility toggle
81 var $rcMoveIndex;
82 /**#@-*/
83
84 function Skin() {
85 parent::Linker();
86 }
87
88 function getSkinNames() {
89 global $wgValidSkinNames;
90 return $wgValidSkinNames;
91 }
92
93 function getStylesheet() {
94 return 'common/wikistandard.css';
95 }
96
97 function getSkinName() {
98 return 'standard';
99 }
100
101 function qbSetting() {
102 global $wgOut, $wgUser;
103
104 if ( $wgOut->isQuickbarSuppressed() ) { return 0; }
105 $q = $wgUser->getOption( 'quickbar' );
106 if ( '' == $q ) { $q = 0; }
107 return $q;
108 }
109
110 function initPage( &$out ) {
111 $fname = 'Skin::initPage';
112 wfProfileIn( $fname );
113
114 $out->addLink( array( 'rel' => 'shortcut icon', 'href' => '/favicon.ico' ) );
115
116 $this->addMetadataLinks($out);
117
118 wfProfileOut( $fname );
119 }
120
121 function addMetadataLinks( &$out ) {
122 global $wgTitle, $wgEnableDublinCoreRdf, $wgEnableCreativeCommonsRdf, $wgRdfMimeType, $action;
123 global $wgRightsPage, $wgRightsUrl;
124
125 if( $out->isArticleRelated() ) {
126 # note: buggy CC software only reads first "meta" link
127 if( $wgEnableCreativeCommonsRdf ) {
128 $out->addMetadataLink( array(
129 'title' => 'Creative Commons',
130 'type' => 'application/rdf+xml',
131 'href' => $wgTitle->getLocalURL( 'action=creativecommons') ) );
132 }
133 if( $wgEnableDublinCoreRdf ) {
134 $out->addMetadataLink( array(
135 'title' => 'Dublin Core',
136 'type' => 'application/rdf+xml',
137 'href' => $wgTitle->getLocalURL( 'action=dublincore' ) ) );
138 }
139 }
140 $copyright = '';
141 if( $wgRightsPage ) {
142 $copy = Title::newFromText( $wgRightsPage );
143 if( $copy ) {
144 $copyright = $copy->getLocalURL();
145 }
146 }
147 if( !$copyright && $wgRightsUrl ) {
148 $copyright = $wgRightsUrl;
149 }
150 if( $copyright ) {
151 $out->addLink( array(
152 'rel' => 'copyright',
153 'href' => $copyright ) );
154 }
155 }
156
157 function outputPage( &$out ) {
158 global $wgDebugComments;
159
160 wfProfileIn( 'Skin::outputPage' );
161 $this->initPage( $out );
162 $out->out( $out->headElement() );
163
164 $out->out( "\n<body" );
165 $ops = $this->getBodyOptions();
166 foreach ( $ops as $name => $val ) {
167 $out->out( " $name='$val'" );
168 }
169 $out->out( ">\n" );
170 if ( $wgDebugComments ) {
171 $out->out( "<!-- Wiki debugging output:\n" .
172 $out->mDebugtext . "-->\n" );
173 }
174 $out->out( $this->beforeContent() );
175
176 $out->out( $out->mBodytext . "\n" );
177
178 $out->out( $this->afterContent() );
179
180 wfProfileClose();
181 $out->out( $out->reportTime() );
182
183 $out->out( "\n</body></html>" );
184 }
185
186 function getHeadScripts() {
187 global $wgStylePath, $wgUser, $wgContLang, $wgAllowUserJs;
188 $r = "<script type=\"text/javascript\" src=\"{$wgStylePath}/common/wikibits.js\"></script>\n";
189 if( $wgAllowUserJs && $wgUser->getID() != 0 ) { # logged in
190 $userpage = $wgContLang->getNsText( Namespace::getUser() ) . ":" . $wgUser->getName();
191 $userjs = htmlspecialchars($this->makeUrl($userpage.'/'.$this->getSkinName().'.js', 'action=raw&ctype=text/javascript'));
192 $r .= '<script type="text/javascript" src="'.$userjs."\"></script>\n";
193 }
194 return $r;
195 }
196
197 # get the user/site-specific stylesheet, SkinPHPTal called from RawPage.php (settings are cached that way)
198 function getUserStylesheet() {
199 global $wgOut, $wgStylePath, $wgContLang, $wgUser, $wgRequest, $wgTitle, $wgAllowUserCss;
200 $sheet = $this->getStylesheet();
201 $action = $wgRequest->getText('action');
202 $s = "@import \"$wgStylePath/$sheet\";\n";
203 if($wgContLang->isRTL()) $s .= "@import \"$wgStylePath/common/common_rtl.css\";\n";
204 if( $wgAllowUserCss && $wgUser->getID() != 0 ) { # logged in
205 if($wgTitle->isCssSubpage() and $action == 'submit' and $wgTitle->userCanEditCssJsSubpage()) {
206 $s .= $wgRequest->getText('wpTextbox1');
207 } else {
208 $userpage = $wgContLang->getNsText( Namespace::getUser() ) . ":" . $wgUser->getName();
209 $s.= '@import "'.$this->makeUrl($userpage.'/'.$this->getSkinName().'.css', 'action=raw&ctype=text/css').'";'."\n";
210 }
211 }
212 $s .= $this->doGetUserStyles();
213 return $s."\n";
214 }
215
216 /**
217 * placeholder, returns generated js in monobook
218 */
219 function getUserJs() { return; }
220
221 /**
222 * Return html code that include User stylesheets
223 */
224 function getUserStyles() {
225 global $wgOut, $wgStylePath, $wgLang;
226 $s = "<style type='text/css'>\n";
227 $s .= "/*/*/ /*<![CDATA[*/\n"; # <-- Hide the styles from Netscape 4 without hiding them from IE/Mac
228 $s .= $this->getUserStylesheet();
229 $s .= "/*]]>*/ /* */\n";
230 $s .= "</style>\n";
231 return $s;
232 }
233
234 /**
235 * Some styles that are set by user through the user settings interface.
236 */
237 function doGetUserStyles() {
238 global $wgUser, $wgContLang;
239
240 $csspage = $wgContLang->getNsText( NS_MEDIAWIKI ) . ':' . $this->getSkinName() . '.css';
241 $s = '@import "'.$this->makeUrl($csspage, 'action=raw&ctype=text/css')."\";\n";
242
243 if ( 1 == $wgUser->getOption( 'underline' ) ) {
244 # Don't override browser settings
245 } else {
246 # CHECK MERGE @@@
247 # Force no underline
248 $s .= "a { text-decoration: none; }\n";
249 }
250 if ( 1 == $this->mOptions['highlightbroken'] ) {
251 $s .= "a.new, #quickbar a.new { color: #CC2200; }\n";
252 }
253 if ( 1 == $wgUser->getOption( 'justify' ) ) {
254 $s .= "#article { text-align: justify; }\n";
255 }
256 return $s;
257 }
258
259 function getBodyOptions() {
260 global $wgUser, $wgTitle, $wgNamespaceBackgrounds, $wgOut, $wgRequest;
261
262 extract( $wgRequest->getValues( 'oldid', 'redirect', 'diff' ) );
263
264 if ( 0 != $wgTitle->getNamespace() ) {
265 $a = array( 'bgcolor' => '#ffffec' );
266 }
267 else $a = array( 'bgcolor' => '#FFFFFF' );
268 if($wgOut->isArticle() && $wgUser->getOption('editondblclick') &&
269 (!$wgTitle->isProtected() || $wgUser->isAllowed('protect')) ) {
270 $t = wfMsg( 'editthispage' );
271 $oid = $red = '';
272 if ( !empty($redirect) && $redirect == 'no' ) {
273 $red = "&redirect={$redirect}";
274 }
275 if ( !empty($oldid) && ! isset( $diff ) ) {
276 $oid = "&oldid=" . IntVal( $oldid );
277 }
278 $s = $wgTitle->getFullURL( "action=edit{$oid}{$red}" );
279 $s = 'document.location = "' .$s .'";';
280 $a += array ('ondblclick' => $s);
281
282 }
283 $a['onload'] = $wgOut->getOnloadHandler();
284 return $a;
285 }
286
287 /**
288 * URL to the logo
289 */
290 function getLogo() {
291 global $wgLogo;
292 return $wgLogo;
293 }
294
295 /**
296 * This will be called immediately after the <body> tag. Split into
297 * two functions to make it easier to subclass.
298 */
299 function beforeContent() {
300 global $wgUser, $wgOut;
301
302 return $this->doBeforeContent();
303 }
304
305 function doBeforeContent() {
306 global $wgUser, $wgOut, $wgTitle, $wgContLang, $wgSiteNotice;
307 $fname = 'Skin::doBeforeContent';
308 wfProfileIn( $fname );
309
310 $s = '';
311 $qb = $this->qbSetting();
312
313 if( $langlinks = $this->otherLanguages() ) {
314 $rows = 2;
315 $borderhack = '';
316 } else {
317 $rows = 1;
318 $langlinks = false;
319 $borderhack = 'class="top"';
320 }
321
322 $s .= "\n<div id='content'>\n<div id='topbar'>\n" .
323 "<table border='0' cellspacing='0' width='98%'>\n<tr>\n";
324
325 $shove = ($qb != 0);
326 $left = ($qb == 1 || $qb == 3);
327 if($wgContLang->isRTL()) $left = !$left;
328
329 if ( !$shove ) {
330 $s .= "<td class='top' align='left' valign='top' rowspan='{$rows}'>\n" .
331 $this->logoText() . '</td>';
332 } elseif( $left ) {
333 $s .= $this->getQuickbarCompensator( $rows );
334 }
335 $l = $wgContLang->isRTL() ? 'right' : 'left';
336 $s .= "<td {$borderhack} align='$l' valign='top'>\n";
337
338 $s .= $this->topLinks() ;
339 $s .= "<p class='subtitle'>" . $this->pageTitleLinks() . "</p>\n";
340
341 $r = $wgContLang->isRTL() ? "left" : "right";
342 $s .= "</td>\n<td {$borderhack} valign='top' align='$r' nowrap='nowrap'>";
343 $s .= $this->nameAndLogin();
344 $s .= "\n<br />" . $this->searchForm() . "</td>";
345
346 if ( $langlinks ) {
347 $s .= "</tr>\n<tr>\n<td class='top' colspan=\"2\">$langlinks</td>\n";
348 }
349
350 if ( $shove && !$left ) { # Right
351 $s .= $this->getQuickbarCompensator( $rows );
352 }
353 $s .= "</tr>\n</table>\n</div>\n";
354 $s .= "\n<div id='article'>\n";
355
356 if( $wgSiteNotice ) {
357 $s .= "\n<div id='siteNotice'>$wgSiteNotice</div>\n";
358 }
359 $s .= $this->pageTitle();
360 $s .= $this->pageSubtitle() ;
361 $s .= $this->getCategories();
362 wfProfileOut( $fname );
363 return $s;
364 }
365
366
367 function getCategoryLinks () {
368 global $wgOut, $wgTitle, $wgUser, $wgParser;
369 global $wgUseCategoryMagic, $wgUseCategoryBrowser, $wgLang;
370
371 if( !$wgUseCategoryMagic ) return '' ;
372 if( count( $wgOut->mCategoryLinks ) == 0 ) return '';
373
374 # Taken out so that they will be displayed in previews -- TS
375 #if( !$wgOut->isArticle() ) return '';
376
377 $t = implode ( ' | ' , $wgOut->mCategoryLinks ) ;
378 $s = $this->makeKnownLink( 'Special:Categories',
379 wfMsg( 'categories' ), 'article=' . urlencode( $wgTitle->getPrefixedDBkey() ) )
380 . ': ' . $t;
381
382 # optional 'dmoz-like' category browser. Will be shown under the list
383 # of categories an article belong to
384 if($wgUseCategoryBrowser) {
385 $s .= '<br/><hr/>';
386
387 # get a big array of the parents tree
388 $parenttree = $wgTitle->getParentCategoryTree();
389
390 # Render the array as a serie of links
391 function walkThrough ($tree) {
392 global $wgUser;
393 $sk = $wgUser->getSkin();
394 $return = '';
395 foreach($tree as $element => $parent) {
396 if(empty($parent)) {
397 # element start a new list
398 $return .= '<br />';
399 } else {
400 # grab the others elements
401 $return .= walkThrough($parent);
402 }
403 # add our current element to the list
404 $eltitle = Title::NewFromText($element);
405 # FIXME : should be makeLink() [AV]
406 $return .= $sk->makeLink($element, $eltitle->getText()).' &gt; ';
407 }
408 return $return;
409 }
410
411 $s .= walkThrough($parenttree);
412 }
413
414 return $s;
415 }
416
417 function getCategories() {
418 $catlinks=$this->getCategoryLinks();
419 if(!empty($catlinks)) {
420 return "<p class='catlinks'>{$catlinks}</p>";
421 }
422 }
423
424 function getQuickbarCompensator( $rows = 1 ) {
425 return "<td width='152' rowspan='{$rows}'>&nbsp;</td>";
426 }
427
428 # This gets called immediately before the </body> tag.
429 #
430 function afterContent() {
431 global $wgUser, $wgOut, $wgServer;
432 global $wgTitle, $wgLang;
433
434 $printfooter = "<div class=\"printfooter\">\n" . $this->printFooter() . "</div>\n";
435 return $printfooter . $this->doAfterContent();
436 }
437
438 function printSource() {
439 global $wgTitle;
440 $url = htmlspecialchars( $wgTitle->getFullURL() );
441 return wfMsg( "retrievedfrom", "<a href=\"$url\">$url</a>" );
442 }
443
444 function printFooter() {
445 return "<p>" . $this->printSource() .
446 "</p>\n\n<p>" . $this->pageStats() . "</p>\n";
447 }
448
449 function doAfterContent() {
450 # overloaded by derived classes
451 }
452
453 function pageTitleLinks() {
454 global $wgOut, $wgTitle, $wgUser, $wgContLang, $wgUseApproval, $wgRequest;
455
456 extract( $wgRequest->getValues( 'oldid', 'diff' ) );
457 $action = $wgRequest->getText( 'action' );
458
459 $s = $this->printableLink();
460 $disclaimer = $this->disclaimerLink(); # may be empty
461 if( $disclaimer ) {
462 $s .= ' | ' . $disclaimer;
463 }
464
465 if ( $wgOut->isArticleRelated() ) {
466 if ( $wgTitle->getNamespace() == Namespace::getImage() ) {
467 $name = $wgTitle->getDBkey();
468 $image = new Image( $wgTitle->getDBkey() );
469 if( $image->exists() ) {
470 $link = htmlspecialchars( $image->getURL() );
471 $style = $this->getInternalLinkAttributes( $link, $name );
472 $s .= " | <a href=\"{$link}\"{$style}>{$name}</a>";
473 }
474 }
475 # This will show the "Approve" link if $wgUseApproval=true;
476 if ( isset ( $wgUseApproval ) && $wgUseApproval )
477 {
478 $t = $wgTitle->getDBkey();
479 $name = 'Approve this article' ;
480 $link = "http://test.wikipedia.org/w/magnus/wiki.phtml?title={$t}&action=submit&doit=1" ;
481 #htmlspecialchars( wfImageUrl( $name ) );
482 $style = $this->getExternalLinkAttributes( $link, $name );
483 $s .= " | <a href=\"{$link}\"{$style}>{$name}</a>" ;
484 }
485 }
486 if ( 'history' == $action || isset( $diff ) || isset( $oldid ) ) {
487 $s .= ' | ' . $this->makeKnownLink( $wgTitle->getPrefixedText(),
488 wfMsg( 'currentrev' ) );
489 }
490
491 if ( $wgUser->getNewtalk() ) {
492 # do not show "You have new messages" text when we are viewing our
493 # own talk page
494
495 if(!(strcmp($wgTitle->getText(),$wgUser->getName()) == 0 &&
496 $wgTitle->getNamespace()==Namespace::getTalk(Namespace::getUser()))) {
497 $n =$wgUser->getName();
498 $tl = $this->makeKnownLink( $wgContLang->getNsText(
499 Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
500 wfMsg('newmessageslink') );
501 $s.= ' | <strong>'. wfMsg( 'newmessages', $tl ) . '</strong>';
502 # disable caching
503 $wgOut->setSquidMaxage(0);
504 $wgOut->enableClientCache(false);
505 }
506 }
507
508 $undelete = $this->getUndeleteLink();
509 if( !empty( $undelete ) ) {
510 $s .= ' | '.$undelete;
511 }
512 return $s;
513 }
514
515 function getUndeleteLink() {
516 global $wgUser, $wgTitle, $wgContLang, $action;
517 if( $wgUser->isAllowed('rollback') &&
518 (($wgTitle->getArticleId() == 0) || ($action == "history")) &&
519 ($n = $wgTitle->isDeleted() ) ) {
520 return wfMsg( 'thisisdeleted',
521 $this->makeKnownLink(
522 $wgContLang->SpecialPage( 'Undelete/' . $wgTitle->getPrefixedDBkey() ),
523 wfMsg( 'restorelink', $n ) ) );
524 }
525 return '';
526 }
527
528 function printableLink() {
529 global $wgOut, $wgFeedClasses, $wgRequest;
530
531 $baseurl = $_SERVER['REQUEST_URI'];
532 if( strpos( '?', $baseurl ) == false ) {
533 $baseurl .= '?';
534 } else {
535 $baseurl .= '&';
536 }
537 $baseurl = htmlspecialchars( $baseurl );
538 $printurl = $wgRequest->escapeAppendQuery( 'printable=yes' );
539
540 $s = "<a href=\"$printurl\">" . wfMsg( 'printableversion' ) . '</a>';
541 if( $wgOut->isSyndicated() ) {
542 foreach( $wgFeedClasses as $format => $class ) {
543 $feedurl = $wgRequest->escapeAppendQuery( "feed=$format" );
544 $s .= " | <a href=\"$feedurl\">{$format}</a>";
545 }
546 }
547 return $s;
548 }
549
550 function pageTitle() {
551 global $wgOut, $wgTitle, $wgUser;
552
553 $s = '<h1 class="pagetitle">' . htmlspecialchars( $wgOut->getPageTitle() ) . '</h1>';
554 if($wgUser->getOption( 'editsectiononrightclick' ) && $wgTitle->userCanEdit()) { $s=$this->editSectionScript($wgTitle, 0,$s);}
555 return $s;
556 }
557
558 function pageSubtitle() {
559 global $wgOut;
560
561 $sub = $wgOut->getSubtitle();
562 if ( '' == $sub ) {
563 global $wgExtraSubtitle;
564 $sub = wfMsg( 'tagline' ) . $wgExtraSubtitle;
565 }
566 $subpages = $this->subPageSubtitle();
567 $sub .= !empty($subpages)?"</p><p class='subpages'>$subpages":'';
568 $s = "<p class='subtitle'>{$sub}</p>\n";
569 return $s;
570 }
571
572 function subPageSubtitle() {
573 global $wgOut,$wgTitle,$wgNamespacesWithSubpages;
574 $subpages = '';
575 if($wgOut->isArticle() && !empty($wgNamespacesWithSubpages[$wgTitle->getNamespace()])) {
576 $ptext=$wgTitle->getPrefixedText();
577 if(preg_match('/\//',$ptext)) {
578 $links = explode('/',$ptext);
579 $c = 0;
580 $growinglink = '';
581 foreach($links as $link) {
582 $c++;
583 if ($c<count($links)) {
584 $growinglink .= $link;
585 $getlink = $this->makeLink( $growinglink, $link );
586 if(preg_match('/class="new"/i',$getlink)) { break; } # this is a hack, but it saves time
587 if ($c>1) {
588 $subpages .= ' | ';
589 } else {
590 $subpages .= '&lt; ';
591 }
592 $subpages .= $getlink;
593 $growinglink .= '/';
594 }
595 }
596 }
597 }
598 return $subpages;
599 }
600
601 function nameAndLogin() {
602 global $wgUser, $wgTitle, $wgLang, $wgContLang, $wgShowIPinHeader, $wgIP;
603
604 $li = $wgContLang->specialPage( 'Userlogin' );
605 $lo = $wgContLang->specialPage( 'Userlogout' );
606
607 $s = '';
608 if ( 0 == $wgUser->getID() ) {
609 if( $wgShowIPinHeader && isset( $_COOKIE[ini_get('session.name')] ) ) {
610 $n = $wgIP;
611
612 $tl = $this->makeKnownLink( $wgContLang->getNsText(
613 Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
614 $wgContLang->getNsText( Namespace::getTalk( 0 ) ) );
615
616 $s .= $n . ' ('.$tl.')';
617 } else {
618 $s .= wfMsg('notloggedin');
619 }
620
621 $rt = $wgTitle->getPrefixedURL();
622 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
623 $q = '';
624 } else { $q = "returnto={$rt}"; }
625
626 $s .= "\n<br />" . $this->makeKnownLink( $li,
627 wfMsg( 'login' ), $q );
628 } else {
629 $n = $wgUser->getName();
630 $rt = $wgTitle->getPrefixedURL();
631 $tl = $this->makeKnownLink( $wgContLang->getNsText(
632 Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
633 $wgContLang->getNsText( Namespace::getTalk( 0 ) ) );
634
635 $tl = " ({$tl})";
636
637 $s .= $this->makeKnownLink( $wgContLang->getNsText(
638 Namespace::getUser() ) . ":{$n}", $n ) . "{$tl}<br />" .
639 $this->makeKnownLink( $lo, wfMsg( 'logout' ),
640 "returnto={$rt}" ) . ' | ' .
641 $this->specialLink( 'preferences' );
642 }
643 $s .= ' | ' . $this->makeKnownLink( wfMsgForContent( 'helppage' ),
644 wfMsg( 'help' ) );
645
646 return $s;
647 }
648
649 function getSearchLink() {
650 $searchPage =& Title::makeTitle( NS_SPECIAL, 'Search' );
651 return $searchPage->getLocalURL();
652 }
653
654 function escapeSearchLink() {
655 return htmlspecialchars( $this->getSearchLink() );
656 }
657
658 function searchForm() {
659 global $wgRequest;
660 $search = $wgRequest->getText( 'search' );
661
662 $s = '<form name="search" class="inline" method="post" action="'
663 . $this->escapeSearchLink() . "\">\n"
664 . '<input type="text" name="search" size="19" value="'
665 . htmlspecialchars(substr($search,0,256)) . "\" />\n"
666 . '<input type="submit" name="go" value="' . wfMsg ('go') . '" />&nbsp;'
667 . '<input type="submit" name="fulltext" value="' . wfMsg ('search') . "\" />\n</form>";
668
669 return $s;
670 }
671
672 function topLinks() {
673 global $wgOut;
674 $sep = " |\n";
675
676 $s = $this->mainPageLink() . $sep
677 . $this->specialLink( 'recentchanges' );
678
679 if ( $wgOut->isArticleRelated() ) {
680 $s .= $sep . $this->editThisPage()
681 . $sep . $this->historyLink();
682 }
683 # Many people don't like this dropdown box
684 #$s .= $sep . $this->specialPagesList();
685
686 /* show links to different language variants */
687 global $wgDisableLangConversion, $wgContLang, $wgTitle;
688 $variants = $wgContLang->getVariants();
689 if( !$wgDisableLangConversion && sizeof( $variants ) > 1 ) {
690 foreach( $variants as $code ) {
691 $varname = $wgContLang->getVariantname( $code );
692 if( $varname == 'disable' )
693 continue;
694 $s .= ' | <a href="' . $wgTitle->getLocalUrl( 'variant=' . $code ) . '">' . $varname . '</a>';
695 }
696 }
697
698
699
700 return $s;
701 }
702
703 function bottomLinks() {
704 global $wgOut, $wgUser, $wgTitle;
705 $sep = " |\n";
706
707 $s = '';
708 if ( $wgOut->isArticleRelated() ) {
709 $s .= '<strong>' . $this->editThisPage() . '</strong>';
710 if ( 0 != $wgUser->getID() ) {
711 $s .= $sep . $this->watchThisPage();
712 }
713 $s .= $sep . $this->talkLink()
714 . $sep . $this->historyLink()
715 . $sep . $this->whatLinksHere()
716 . $sep . $this->watchPageLinksLink();
717
718 if ( $wgTitle->getNamespace() == Namespace::getUser()
719 || $wgTitle->getNamespace() == Namespace::getTalk(Namespace::getUser()) )
720
721 {
722 $id=User::idFromName($wgTitle->getText());
723 $ip=User::isIP($wgTitle->getText());
724
725 if($id || $ip) { # both anons and non-anons have contri list
726 $s .= $sep . $this->userContribsLink();
727 }
728 if( $this->showEmailUser( $id ) ) {
729 $s .= $sep . $this->emailUserLink();
730 }
731 }
732 if ( $wgTitle->getArticleId() ) {
733 $s .= "\n<br />";
734 if($wgUser->isAllowed('delete')) { $s .= $this->deleteThisPage(); }
735 if($wgUser->isAllowed('protect')) { $s .= $sep . $this->protectThisPage(); }
736 if($wgUser->isAllowed('move')) { $s .= $sep . $this->moveThisPage(); }
737 }
738 $s .= "<br />\n" . $this->otherLanguages();
739 }
740 return $s;
741 }
742
743 function pageStats() {
744 global $wgOut, $wgLang, $wgArticle, $wgRequest, $wgUser;
745 global $wgDisableCounters, $wgMaxCredits, $wgShowCreditsIfMax, $wgTitle, $wgPageShowWatchingUsers;
746
747 extract( $wgRequest->getValues( 'oldid', 'diff' ) );
748 if ( ! $wgOut->isArticle() ) { return ''; }
749 if ( isset( $oldid ) || isset( $diff ) ) { return ''; }
750 if ( 0 == $wgArticle->getID() ) { return ''; }
751
752 $s = '';
753 if ( !$wgDisableCounters ) {
754 $count = $wgLang->formatNum( $wgArticle->getCount() );
755 if ( $count ) {
756 $s = wfMsg( 'viewcount', $count );
757 }
758 }
759
760 if (isset($wgMaxCredits) && $wgMaxCredits != 0) {
761 require_once("Credits.php");
762 $s .= ' ' . getCredits($wgArticle, $wgMaxCredits, $wgShowCreditsIfMax);
763 } else {
764 $s .= $this->lastModified();
765 }
766
767 if ($wgPageShowWatchingUsers && $wgUser->getOption( 'shownumberswatching' )) {
768 $dbr =& wfGetDB( DB_SLAVE );
769 extract( $dbr->tableNames( 'watchlist' ) );
770 $sql = "SELECT COUNT(*) AS n FROM $watchlist
771 WHERE wl_title='" . $dbr->strencode($wgTitle->getDBKey()) .
772 "' AND wl_namespace=" . $wgTitle->getNamespace() ;
773 $res = $dbr->query( $sql, 'Skin::pageStats');
774 $x = $dbr->fetchObject( $res );
775 $s .= ' ' . wfMsg('number_of_watching_users_pageview', $x->n );
776 }
777
778 return $s . ' ' . $this->getCopyright();
779 }
780
781 function getCopyright() {
782 global $wgRightsPage, $wgRightsUrl, $wgRightsText, $wgRequest;
783
784
785 $oldid = $wgRequest->getVal( 'oldid' );
786 $diff = $wgRequest->getVal( 'diff' );
787
788 if ( !is_null( $oldid ) && is_null( $diff ) && wfMsgForContent( 'history_copyright' ) !== '-' ) {
789 $msg = 'history_copyright';
790 } else {
791 $msg = 'copyright';
792 }
793
794 $out = '';
795 if( $wgRightsPage ) {
796 $link = $this->makeKnownLink( $wgRightsPage, $wgRightsText );
797 } elseif( $wgRightsUrl ) {
798 $link = $this->makeExternalLink( $wgRightsUrl, $wgRightsText );
799 } else {
800 # Give up now
801 return $out;
802 }
803 $out .= wfMsgForContent( $msg, $link );
804 return $out;
805 }
806
807 function getCopyrightIcon() {
808 global $wgRightsPage, $wgRightsUrl, $wgRightsText, $wgRightsIcon;
809 $out = '';
810 if( $wgRightsIcon ) {
811 $icon = htmlspecialchars( $wgRightsIcon );
812 if( $wgRightsUrl ) {
813 $url = htmlspecialchars( $wgRightsUrl );
814 $out .= '<a href="'.$url.'">';
815 }
816 $text = htmlspecialchars( $wgRightsText );
817 $out .= "<img src=\"$icon\" alt='$text' />";
818 if( $wgRightsUrl ) {
819 $out .= '</a>';
820 }
821 }
822 return $out;
823 }
824
825 function getPoweredBy() {
826 global $wgStylePath;
827 $url = htmlspecialchars( "$wgStylePath/common/images/poweredby_mediawiki_88x31.png" );
828 $img = '<a href="http://www.mediawiki.org/"><img src="'.$url.'" alt="MediaWiki" /></a>';
829 return $img;
830 }
831
832 function lastModified() {
833 global $wgLang, $wgArticle;
834
835 $timestamp = $wgArticle->getTimestamp();
836 if ( $timestamp ) {
837 $d = $wgLang->timeanddate( $wgArticle->getTimestamp(), true );
838 $s = ' ' . wfMsg( 'lastmodified', $d );
839 } else {
840 $s = '';
841 }
842 return $s;
843 }
844
845 function logoText( $align = '' ) {
846 if ( '' != $align ) { $a = " align='{$align}'"; }
847 else { $a = ''; }
848
849 $mp = wfMsg( 'mainpage' );
850 $titleObj = Title::newFromText( $mp );
851 if ( is_object( $titleObj ) ) {
852 $url = $titleObj->escapeLocalURL();
853 } else {
854 $url = '';
855 }
856
857 $logourl = $this->getLogo();
858 $s = "<a href='{$url}'><img{$a} src='{$logourl}' alt='[{$mp}]' /></a>";
859 return $s;
860 }
861
862 /**
863 * show a drop-down box of special pages
864 * @TODO crash bug913. Need to be rewrote completly.
865 */
866 function specialPagesList() {
867 global $wgUser, $wgOut, $wgContLang, $wgServer, $wgRedirectScript;
868 require_once('SpecialPage.php');
869 $a = array();
870 $pages = SpecialPage::getPages();
871
872 foreach ( $pages[''] as $name => $page ) {
873 $a[$name] = $page->getDescription();
874 }
875 if ( $wgUser->isSysop() )
876 {
877 foreach ( $pages['sysop'] as $name => $page ) {
878 $a[$name] = $page->getDescription();
879 }
880 }
881 if ( $wgUser->isDeveloper() )
882 {
883 foreach ( $pages['developer'] as $name => $page ) {
884 $a[$name] = $page->getDescription() ;
885 }
886 }
887 $go = wfMsg( 'go' );
888 $sp = wfMsg( 'specialpages' );
889 $spp = $wgContLang->specialPage( 'Specialpages' );
890
891 $s = '<form id="specialpages" method="get" class="inline" ' .
892 'action="' . htmlspecialchars( "{$wgServer}{$wgRedirectScript}" ) . "\">\n";
893 $s .= "<select name=\"wpDropdown\">\n";
894 $s .= "<option value=\"{$spp}\">{$sp}</option>\n";
895
896 foreach ( $a as $name => $desc ) {
897 $p = $wgContLang->specialPage( $name );
898 $s .= "<option value=\"{$p}\">{$desc}</option>\n";
899 }
900 $s .= "</select>\n";
901 $s .= "<input type='submit' value=\"{$go}\" name='redirect' />\n";
902 $s .= "</form>\n";
903 return $s;
904 }
905
906 function mainPageLink() {
907 $mp = wfMsgForContent( 'mainpage' );
908 $mptxt = wfMsg( 'mainpage');
909 $s = $this->makeKnownLink( $mp, $mptxt );
910 return $s;
911 }
912
913 function copyrightLink() {
914 $s = $this->makeKnownLink( wfMsgForContent( 'copyrightpage' ),
915 wfMsg( 'copyrightpagename' ) );
916 return $s;
917 }
918
919 function aboutLink() {
920 $s = $this->makeKnownLink( wfMsgForContent( 'aboutpage' ),
921 wfMsg( 'aboutsite' ) );
922 return $s;
923 }
924
925
926 function disclaimerLink() {
927 $disclaimers = wfMsg( 'disclaimers' );
928 if ($disclaimers == '-') {
929 return "";
930 } else {
931 return $this->makeKnownLink( wfMsgForContent( 'disclaimerpage' ),
932 $disclaimers );
933 }
934 }
935
936 function editThisPage() {
937 global $wgOut, $wgTitle, $wgRequest;
938
939 $oldid = $wgRequest->getVal( 'oldid' );
940 $diff = $wgRequest->getVal( 'diff' );
941 $redirect = $wgRequest->getVal( 'redirect' );
942
943 if ( ! $wgOut->isArticleRelated() ) {
944 $s = wfMsg( 'protectedpage' );
945 } else {
946 $n = $wgTitle->getPrefixedText();
947 if ( $wgTitle->userCanEdit() ) {
948 $t = wfMsg( 'editthispage' );
949 } else {
950 #$t = wfMsg( "protectedpage" );
951 $t = wfMsg( 'viewsource' );
952 }
953 $oid = $red = '';
954
955 if ( !is_null( $redirect ) ) { $red = "&redirect={$redirect}"; }
956 if ( $oldid && ! isset( $diff ) ) {
957 $oid = '&oldid='.$oldid;
958 }
959 $s = $this->makeKnownLink( $n, $t, "action=edit{$oid}{$red}" );
960 }
961 return $s;
962 }
963
964 function deleteThisPage() {
965 global $wgUser, $wgOut, $wgTitle, $wgRequest;
966
967 $diff = $wgRequest->getVal( 'diff' );
968 if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isAllowed('delete') ) {
969 $n = $wgTitle->getPrefixedText();
970 $t = wfMsg( 'deletethispage' );
971
972 $s = $this->makeKnownLink( $n, $t, 'action=delete' );
973 } else {
974 $s = '';
975 }
976 return $s;
977 }
978
979 function protectThisPage() {
980 global $wgUser, $wgOut, $wgTitle, $wgRequest;
981
982 $diff = $wgRequest->getVal( 'diff' );
983 if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isAllowed('protect') ) {
984 $n = $wgTitle->getPrefixedText();
985
986 if ( $wgTitle->isProtected() ) {
987 $t = wfMsg( 'unprotectthispage' );
988 $q = 'action=unprotect';
989 } else {
990 $t = wfMsg( 'protectthispage' );
991 $q = 'action=protect';
992 }
993 $s = $this->makeKnownLink( $n, $t, $q );
994 } else {
995 $s = '';
996 }
997 return $s;
998 }
999
1000 function watchThisPage() {
1001 global $wgUser, $wgOut, $wgTitle;
1002
1003 if ( $wgOut->isArticleRelated() ) {
1004 $n = $wgTitle->getPrefixedText();
1005
1006 if ( $wgTitle->userIsWatching() ) {
1007 $t = wfMsg( 'unwatchthispage' );
1008 $q = 'action=unwatch';
1009 } else {
1010 $t = wfMsg( 'watchthispage' );
1011 $q = 'action=watch';
1012 }
1013 $s = $this->makeKnownLink( $n, $t, $q );
1014 } else {
1015 $s = wfMsg( 'notanarticle' );
1016 }
1017 return $s;
1018 }
1019
1020 function moveThisPage() {
1021 global $wgTitle, $wgContLang;
1022
1023 if ( $wgTitle->userCanMove() ) {
1024 $s = $this->makeKnownLink( $wgContLang->specialPage( 'Movepage' ),
1025 wfMsg( 'movethispage' ), 'target=' . $wgTitle->getPrefixedURL() );
1026 } // no message if page is protected - would be redundant
1027 return $s;
1028 }
1029
1030 function historyLink() {
1031 global $wgTitle;
1032
1033 $s = $this->makeKnownLink( $wgTitle->getPrefixedText(),
1034 wfMsg( 'history' ), 'action=history' );
1035 return $s;
1036 }
1037
1038 function whatLinksHere() {
1039 global $wgTitle, $wgContLang;
1040
1041 $s = $this->makeKnownLink( $wgContLang->specialPage( 'Whatlinkshere' ),
1042 wfMsg( 'whatlinkshere' ), 'target=' . $wgTitle->getPrefixedURL() );
1043 return $s;
1044 }
1045
1046 function userContribsLink() {
1047 global $wgTitle, $wgContLang;
1048
1049 $s = $this->makeKnownLink( $wgContLang->specialPage( 'Contributions' ),
1050 wfMsg( 'contributions' ), 'target=' . $wgTitle->getPartialURL() );
1051 return $s;
1052 }
1053
1054 function showEmailUser( $id ) {
1055 global $wgEnableEmail, $wgEnableUserEmail, $wgUser;
1056 return $wgEnableEmail &&
1057 $wgEnableUserEmail &&
1058 0 != $wgUser->getID() && # show only to signed in users
1059 0 != $id; # we can only email to non-anons ..
1060 # '' != $id->getEmail() && # who must have an email address stored ..
1061 # 0 != $id->getEmailauthenticationtimestamp() && # .. which is authenticated
1062 # 1 != $wgUser->getOption('disablemail'); # and not disabled
1063 }
1064
1065 function emailUserLink() {
1066 global $wgTitle, $wgContLang;
1067
1068 $s = $this->makeKnownLink( $wgContLang->specialPage( 'Emailuser' ),
1069 wfMsg( 'emailuser' ), 'target=' . $wgTitle->getPartialURL() );
1070 return $s;
1071 }
1072
1073 function watchPageLinksLink() {
1074 global $wgOut, $wgTitle, $wgContLang;
1075
1076 if ( ! $wgOut->isArticleRelated() ) {
1077 $s = '(' . wfMsg( 'notanarticle' ) . ')';
1078 } else {
1079 $s = $this->makeKnownLink( $wgContLang->specialPage(
1080 'Recentchangeslinked' ), wfMsg( 'recentchangeslinked' ),
1081 'target=' . $wgTitle->getPrefixedURL() );
1082 }
1083 return $s;
1084 }
1085
1086 function otherLanguages() {
1087 global $wgOut, $wgContLang, $wgTitle, $wgUseNewInterlanguage;
1088
1089 $a = $wgOut->getLanguageLinks();
1090 if ( 0 == count( $a ) ) {
1091 if ( !$wgUseNewInterlanguage ) return '';
1092 $ns = $wgContLang->getNsIndex ( $wgTitle->getNamespace () ) ;
1093 if ( $ns != 0 AND $ns != 1 ) return '' ;
1094 $pn = 'Intl' ;
1095 $x = 'mode=addlink&xt='.$wgTitle->getDBkey() ;
1096 return $this->makeKnownLink( $wgContLang->specialPage( $pn ),
1097 wfMsg( 'intl' ) , $x );
1098 }
1099
1100 if ( !$wgUseNewInterlanguage ) {
1101 $s = wfMsg( 'otherlanguages' ) . ': ';
1102 } else {
1103 global $wgContLanguageCode ;
1104 $x = 'mode=zoom&xt='.$wgTitle->getDBkey() ;
1105 $x .= '&xl='.$wgContLanguageCode ;
1106 $s = $this->makeKnownLink( $wgContLang->specialPage( 'Intl' ),
1107 wfMsg( 'otherlanguages' ) , $x ) . ': ' ;
1108 }
1109
1110 $s = wfMsg( 'otherlanguages' ) . ': ';
1111 $first = true;
1112 if($wgContLang->isRTL()) $s .= '<span dir="LTR">';
1113 foreach( $a as $l ) {
1114 if ( ! $first ) { $s .= ' | '; }
1115 $first = false;
1116
1117 $nt = Title::newFromText( $l );
1118 $url = $nt->getFullURL();
1119 $text = $wgContLang->getLanguageName( $nt->getInterwiki() );
1120
1121 if ( '' == $text ) { $text = $l; }
1122 $style = $this->getExternalLinkAttributes( $l, $text );
1123 $s .= "<a href=\"{$url}\"{$style}>{$text}</a>";
1124 }
1125 if($wgContLang->isRTL()) $s .= '</span>';
1126 return $s;
1127 }
1128
1129 function bugReportsLink() {
1130 $s = $this->makeKnownLink( wfMsgForContent( 'bugreportspage' ),
1131 wfMsg( 'bugreports' ) );
1132 return $s;
1133 }
1134
1135 function dateLink() {
1136 global $wgLinkCache;
1137 $t1 = Title::newFromText( gmdate( 'F j' ) );
1138 $t2 = Title::newFromText( gmdate( 'Y' ) );
1139
1140 $wgLinkCache->suspend();
1141 $id = $t1->getArticleID();
1142 $wgLinkCache->resume();
1143
1144 if ( 0 == $id ) {
1145 $s = $this->makeBrokenLink( $t1->getText() );
1146 } else {
1147 $s = $this->makeKnownLink( $t1->getText() );
1148 }
1149 $s .= ', ';
1150
1151 $wgLinkCache->suspend();
1152 $id = $t2->getArticleID();
1153 $wgLinkCache->resume();
1154
1155 if ( 0 == $id ) {
1156 $s .= $this->makeBrokenLink( $t2->getText() );
1157 } else {
1158 $s .= $this->makeKnownLink( $t2->getText() );
1159 }
1160 return $s;
1161 }
1162
1163 function talkLink() {
1164 global $wgContLang, $wgTitle, $wgLinkCache;
1165
1166 $tns = $wgTitle->getNamespace();
1167 if ( -1 == $tns ) { return ''; }
1168
1169 $pn = $wgTitle->getText();
1170 $tp = wfMsg( 'talkpage' );
1171 if ( Namespace::isTalk( $tns ) ) {
1172 $lns = Namespace::getSubject( $tns );
1173 switch($tns) {
1174 case 1:
1175 $text = wfMsg('articlepage');
1176 break;
1177 case 3:
1178 $text = wfMsg('userpage');
1179 break;
1180 case 5:
1181 $text = wfMsg('wikipediapage');
1182 break;
1183 case 7:
1184 $text = wfMsg('imagepage');
1185 break;
1186 default:
1187 $text= wfMsg('articlepage');
1188 }
1189 } else {
1190
1191 $lns = Namespace::getTalk( $tns );
1192 $text=$tp;
1193 }
1194 $n = $wgContLang->getNsText( $lns );
1195 if ( '' == $n ) { $link = $pn; }
1196 else { $link = $n.':'.$pn; }
1197
1198 $wgLinkCache->suspend();
1199 $s = $this->makeLink( $link, $text );
1200 $wgLinkCache->resume();
1201
1202 return $s;
1203 }
1204
1205 function commentLink() {
1206 global $wgContLang, $wgTitle, $wgLinkCache;
1207
1208 $tns = $wgTitle->getNamespace();
1209 if ( -1 == $tns ) { return ''; }
1210
1211 $lns = ( Namespace::isTalk( $tns ) ) ? $tns : Namespace::getTalk( $tns );
1212
1213 # assert Namespace::isTalk( $lns )
1214
1215 $n = $wgContLang->getNsText( $lns );
1216 $pn = $wgTitle->getText();
1217
1218 $link = $n.':'.$pn;
1219
1220 $wgLinkCache->suspend();
1221 $s = $this->makeKnownLink($link, wfMsg('postcomment'), 'action=edit&section=new');
1222 $wgLinkCache->resume();
1223
1224 return $s;
1225 }
1226
1227 /* these are used extensively in SkinPHPTal, but also some other places */
1228 /*static*/ function makeSpecialUrl( $name, $urlaction='' ) {
1229 $title = Title::makeTitle( NS_SPECIAL, $name );
1230 $this->checkTitle($title, $name);
1231 return $title->getLocalURL( $urlaction );
1232 }
1233 /*static*/ function makeTalkUrl ( $name, $urlaction='' ) {
1234 $title = Title::newFromText( $name );
1235 $title = $title->getTalkPage();
1236 $this->checkTitle($title, $name);
1237 return $title->getLocalURL( $urlaction );
1238 }
1239 /*static*/ function makeArticleUrl ( $name, $urlaction='' ) {
1240 $title = Title::newFromText( $name );
1241 $title= $title->getSubjectPage();
1242 $this->checkTitle($title, $name);
1243 return $title->getLocalURL( $urlaction );
1244 }
1245 /*static*/ function makeI18nUrl ( $name, $urlaction='' ) {
1246 $title = Title::newFromText( wfMsgForContent($name) );
1247 $this->checkTitle($title, $name);
1248 return $title->getLocalURL( $urlaction );
1249 }
1250 /*static*/ function makeUrl ( $name, $urlaction='' ) {
1251 $title = Title::newFromText( $name );
1252 $this->checkTitle($title, $name);
1253 return $title->getLocalURL( $urlaction );
1254 }
1255
1256 # If url string starts with http, consider as external URL, else
1257 # internal
1258 /*static*/ function makeInternalOrExternalUrl( $name ) {
1259 if ( strncmp( $name, 'http', 4 ) == 0 ) {
1260 return $name;
1261 } else {
1262 return $this->makeUrl( $name );
1263 }
1264 }
1265
1266 # this can be passed the NS number as defined in Language.php
1267 /*static*/ function makeNSUrl( $name, $urlaction='', $namespace=0 ) {
1268 $title = Title::makeTitleSafe( $namespace, $name );
1269 $this->checkTitle($title, $name);
1270 return $title->getLocalURL( $urlaction );
1271 }
1272
1273 /* these return an array with the 'href' and boolean 'exists' */
1274 /*static*/ function makeUrlDetails ( $name, $urlaction='' ) {
1275 $title = Title::newFromText( $name );
1276 $this->checkTitle($title, $name);
1277 return array(
1278 'href' => $title->getLocalURL( $urlaction ),
1279 'exists' => $title->getArticleID() != 0?true:false
1280 );
1281 }
1282 /*static*/ function makeTalkUrlDetails ( $name, $urlaction='' ) {
1283 $title = Title::newFromText( $name );
1284 $title = $title->getTalkPage();
1285 $this->checkTitle($title, $name);
1286 return array(
1287 'href' => $title->getLocalURL( $urlaction ),
1288 'exists' => $title->getArticleID() != 0?true:false
1289 );
1290 }
1291 /*static*/ function makeArticleUrlDetails ( $name, $urlaction='' ) {
1292 $title = Title::newFromText( $name );
1293 $title= $title->getSubjectPage();
1294 $this->checkTitle($title, $name);
1295 return array(
1296 'href' => $title->getLocalURL( $urlaction ),
1297 'exists' => $title->getArticleID() != 0?true:false
1298 );
1299 }
1300 /*static*/ function makeI18nUrlDetails ( $name, $urlaction='' ) {
1301 $title = Title::newFromText( wfMsgForContent($name) );
1302 $this->checkTitle($title, $name);
1303 return array(
1304 'href' => $title->getLocalURL( $urlaction ),
1305 'exists' => $title->getArticleID() != 0?true:false
1306 );
1307 }
1308
1309 # make sure we have some title to operate on
1310 /*static*/ function checkTitle ( &$title, &$name ) {
1311 if(!is_object($title)) {
1312 $title = Title::newFromText( $name );
1313 if(!is_object($title)) {
1314 $title = Title::newFromText( '--error: link target missing--' );
1315 }
1316 }
1317 }
1318
1319 }
1320
1321 }
1322 ?>