2 # This program is free software; you can redistribute it and/or modify
3 # it under the terms of the GNU General Public License as published by
4 # the Free Software Foundation; either version 2 of the License, or
5 # (at your option) any later version.
7 # This program is distributed in the hope that it will be useful,
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 # GNU General Public License for more details.
12 # You should have received a copy of the GNU General Public License along
13 # with this program; if not, write to the Free Software Foundation, Inc.,
14 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15 # http://www.gnu.org/copyleft/gpl.html
18 * Generic PHPTal (http://phptal.sourceforge.net/) skin
19 * Based on Brion's smarty skin
20 * Copyright (C) Gabriel Wicke -- http://www.aulinx.de/
22 * Todo: Needs some serious refactoring into functions that correspond
23 * to the computations individual esi snippets need. Most importantly no body
24 * parsing for most of those of course.
26 * Set this in LocalSettings to enable phptal:
27 * set_include_path(get_include_path() . ":" . $IP.'/PHPTAL-NP-0.7.0/libs');
28 * $wgUsePHPTal = true;
34 * This is not a valid entry point, perform no further processing unless
35 * MEDIAWIKI is defined
37 if( defined( 'MEDIAWIKI' ) ) {
39 require_once 'GlobalFunctions.php';
41 require_once $IP.'/PHPTAL-NP-0.7.0/libs/PHPTAL.php';
47 class MediaWiki_I18N
extends PHPTAL_I18N
{
48 var $_context = array();
50 function set($varName, $value) {
51 $this->_context
[$varName] = $value;
54 function translate($value) {
55 $value = wfMsg( $value );
56 // interpolate variables
57 while (preg_match('/\$([0-9]*?)/sm', $value, $m)) {
58 list($src, $var) = $m;
60 $varValue = $this->_context
[$var];
62 $value = str_replace($src, $varValue, $value);
72 class SkinPHPTal
extends Skin
{
78 * Name of our skin, set in initPage()
79 * It probably need to be all lower case.
84 * Stylesheets set to use
85 * Sub directory in ./skins/ where various stylesheets are located
90 * PHPTal template to be used.
91 * '.pt' will be automaticly added to it on PHPTAL object creation
98 function initPage( &$out ) {
99 parent
::initPage( $out );
100 $this->skinname
= 'monobook';
101 $this->stylename
= 'monobook';
102 $this->template
= 'MonoBook';
106 * initialize various variables and generate the template
108 function outputPage( &$out ) {
109 global $wgTitle, $wgArticle, $wgUser, $wgLang, $wgOut;
110 global $wgScript, $wgStylePath, $wgLanguageCode, $wgUseNewInterlanguage;
111 global $wgMimeType, $wgOutputEncoding, $wgUseDatabaseMessages, $wgRequest;
112 global $wgDisableCounters, $wgLogo, $action, $wgFeedClasses, $wgSiteNotice;
113 global $wgMaxCredits, $wgShowCreditsIfMax;
115 extract( $wgRequest->getValues( 'oldid', 'diff' ) );
117 $this->initPage( $out );
118 $tpl = new PHPTAL($this->template
. '.pt', 'skins');
120 #if ( $wgUseDatabaseMessages ) { // uncomment this to fall back to GetText
121 $tpl->setTranslator(new MediaWiki_I18N());
124 $this->thispage
= $wgTitle->getPrefixedDbKey();
125 $this->thisurl
= $wgTitle->getPrefixedURL();
126 $this->loggedin
= $wgUser->getID() != 0;
127 $this->iscontent
= ($wgTitle->getNamespace() != Namespace::getSpecial() );
128 $this->iseditable
= ($this->iscontent
and !($action == 'edit' or $action == 'submit'));
129 $this->username
= $wgUser->getName();
130 $this->userpage
= $wgLang->getNsText( Namespace::getUser() ) . ":" . $wgUser->getName();
131 $this->userpageUrlDetails
= $this->makeUrlDetails($this->userpage
);
133 $this->usercss
= $this->userjs
= $this->userjsprev
= false;
134 $this->setupUserCssJs();
136 $this->titletxt
= $wgTitle->getPrefixedText();
138 $tpl->set( 'title', $wgOut->getPageTitle() );
139 $tpl->set( 'pagetitle', $wgOut->getHTMLTitle() );
141 $tpl->setRef( "thispage", $this->thispage
);
142 $subpagestr = $this->subPageSubtitle();
144 'subtitle', !empty($subpagestr)?
145 '<span class="subpages">'.$subpagestr.'</span>'.$out->getSubtitle():
148 $undelete = $this->getUndeleteLink();
150 "undelete", !empty($undelete)?
151 '<span class="subpages">'.$undelete.'</span>':
155 $tpl->set( 'catlinks', $this->getCategories());
156 if( $wgOut->isSyndicated() ) {
158 foreach( $wgFeedClasses as $format => $class ) {
159 $feeds[$format] = array(
161 'href' => $wgRequest->appendQuery( "feed=$format" ),
162 'ttip' => wfMsg('tooltip-'.$format)
165 $tpl->setRef( 'feeds', $feeds );
167 $tpl->setRef( 'mimetype', $wgMimeType );
168 $tpl->setRef( 'charset', $wgOutputEncoding );
169 $tpl->set( 'headlinks', $out->getHeadLinks() );
170 $tpl->setRef( 'wgScript', $wgScript );
171 $tpl->setRef( 'skinname', $this->skinname
);
172 $tpl->setRef( 'stylename', $this->stylename
);
173 $tpl->setRef( 'loggedin', $this->loggedin
);
174 $tpl->set('nsclass', 'ns-'.$wgTitle->getNamespace());
175 /* XXX currently unused, might get useful later
176 $tpl->set( "editable", ($wgTitle->getNamespace() != NS_SPECIAL ) );
177 $tpl->set( "exists", $wgTitle->getArticleID() != 0 );
178 $tpl->set( "watch", $wgTitle->userIsWatching() ? "unwatch" : "watch" );
179 $tpl->set( "protect", count($wgTitle->getRestrictions()) ? "unprotect" : "protect" );
180 $tpl->set( "helppage", wfMsg('helppage'));
181 $tpl->set( "sysop", $wgUser->isSysop() );
183 $tpl->set( 'searchaction', $this->escapeSearchLink() );
184 $tpl->setRef( 'stylepath', $wgStylePath );
185 $tpl->setRef( 'logopath', $wgLogo );
186 $tpl->setRef( "lang", $wgLanguageCode );
187 $tpl->set( 'dir', $wgLang->isRTL() ?
"rtl" : "ltr" );
188 $tpl->set( 'rtl', $wgLang->isRTL() );
189 $tpl->set( 'langname', $wgLang->getLanguageName( $wgLanguageCode ) );
190 $tpl->setRef( 'username', $this->username
);
191 $tpl->setRef( 'userpage', $this->userpage
);
192 $tpl->setRef( 'userpageurl', $this->userpageUrlDetails
['href']);
193 $tpl->setRef( 'usercss', $this->usercss
);
194 $tpl->setRef( 'userjs', $this->userjs
);
195 $tpl->setRef( 'userjsprev', $this->userjsprev
);
196 if($this->loggedin
) {
197 $tpl->set( 'jsvarurl', $this->makeUrl('-','action=raw&smaxage=0&gen=js') );
199 $tpl->set( 'jsvarurl', $this->makeUrl('-','action=raw&gen=js') );
201 if( $wgUser->getNewtalk() ) {
202 $usertitle = Title
::newFromText( $this->userpage
);
203 $usertalktitle = $usertitle->getTalkPage();
204 if($usertalktitle->getPrefixedDbKey() != $this->thispage
){
206 $ntl = wfMsg( 'newmessages',
207 $this->makeKnownLink(
208 $wgLang->getNsText( Namespace::getTalk( Namespace::getUser() ) )
209 . ':' . $this->username
,
210 wfMsg('newmessageslink') )
213 $wgOut->setSquidMaxage(0);
219 $tpl->setRef( 'newtalk', $ntl );
220 $tpl->setRef( 'skin', $this);
221 $tpl->set( 'logo', $this->logoText() );
222 if ( $wgOut->isArticle() and (!isset( $oldid ) or isset( $diff )) and 0 != $wgArticle->getID() ) {
223 if ( !$wgDisableCounters ) {
224 $viewcount = $wgLang->formatNum( $wgArticle->getCount() );
226 $tpl->set('viewcount', wfMsg( "viewcount", $viewcount ));
229 $tpl->set('lastmod', $this->lastModified());
230 $tpl->set('copyright',$this->getCopyright());
232 $this->credits
= false;
234 if (isset($wgMaxCredits) && $wgMaxCredits != 0) {
235 require_once("Credits.php");
236 $this->credits
= getCredits($wgArticle, $wgMaxCredits, $wgShowCreditsIfMax);
239 $tpl->setRef( 'credits', $this->credits
);
241 } elseif ( isset( $oldid ) && !isset( $diff ) ) {
242 $tpl->set('copyright', $this->getCopyright());
245 $tpl->set( 'copyrightico', $this->getCopyrightIcon() );
246 $tpl->set( 'poweredbyico', $this->getPoweredBy() );
247 $tpl->set( 'disclaimer', $this->disclaimerLink() );
248 $tpl->set( 'about', $this->aboutLink() );
250 $tpl->setRef( 'debug', $out->mDebugtext
);
251 $tpl->set( 'reporttime', $out->reportTime() );
252 $tpl->set( 'sitenotice', $wgSiteNotice );
254 $printfooter = "<div class=\"printfooter\">\n" . $this->printSource() . "</div>\n";
255 $out->mBodytext
.= $printfooter ;
256 $tpl->setRef( 'bodytext', $out->mBodytext
);
258 $language_urls = array();
259 foreach( $wgOut->getLanguageLinks() as $l ) {
260 $nt = Title
::newFromText( $l );
261 $language_urls[] = array('href' => $nt->getFullURL(),
262 'text' => ($wgLang->getLanguageName( $nt->getInterwiki()) != ''?
$wgLang->getLanguageName( $nt->getInterwiki()) : $l),
263 'class' => $wgLang->isRTL() ?
'rtl' : 'ltr');
265 if(count($language_urls)) {
266 $tpl->setRef( 'language_urls', $language_urls);
268 $tpl->set('language_urls', false);
270 $tpl->set('personal_urls', $this->buildPersonalUrls());
271 $content_actions = $this->buildContentActionUrls();
272 $tpl->setRef('content_actions', $content_actions);
273 // XXX: attach this from javascript, same with section editing
274 if($this->iseditable
&& $wgUser->getOption("editondblclick") )
276 $tpl->set('body-ondblclick', 'document.location = "' .$content_actions['edit']['href'] .'";');
278 $tpl->set('body-ondblclick', false);
280 $tpl->set( 'nav_urls', $this->buildNavUrls() );
283 $res = $tpl->execute();
284 // result may be an error
285 if (PEAR
::isError($res)) {
286 echo $res->toString(), "\n";
294 * build array of urls for personal toolbar
296 function buildPersonalUrls() {
297 /* set up the default links for the personal toolbar */
298 global $wgShowIPinHeader;
299 $personal_urls = array();
300 if ($this->loggedin
) {
301 $personal_urls['userpage'] = array(
302 'text' => $this->username
,
303 'href' => &$this->userpageUrlDetails
['href'],
304 'class' => $this->userpageUrlDetails
['exists']?
false:'new'
306 $usertalkUrlDetails = $this->makeTalkUrlDetails($this->userpage
);
307 $personal_urls['mytalk'] = array(
308 'text' => wfMsg('mytalk'),
309 'href' => &$usertalkUrlDetails['href'],
310 'class' => $usertalkUrlDetails['exists']?
false:'new'
312 $personal_urls['preferences'] = array(
313 'text' => wfMsg('preferences'),
314 'href' => $this->makeSpecialUrl('Preferences')
316 $personal_urls['watchlist'] = array(
317 'text' => wfMsg('watchlist'),
318 'href' => $this->makeSpecialUrl('Watchlist')
320 $personal_urls['mycontris'] = array(
321 'text' => wfMsg('mycontris'),
322 'href' => $this->makeSpecialUrl('Contributions','target=' . urlencode( $this->username
) )
324 $personal_urls['logout'] = array(
325 'text' => wfMsg('userlogout'),
326 'href' => $this->makeSpecialUrl('Userlogout','returnto=' . $this->thisurl
)
329 if( $wgShowIPinHeader && isset( $_COOKIE[ini_get("session.name")] ) ) {
330 $personal_urls['anonuserpage'] = array(
331 'text' => $this->username
,
332 'href' => &$this->userpageUrlDetails
['href'],
333 'class' => $this->userpageUrlDetails
['exists']?
false:'new'
335 $usertalkUrlDetails = $this->makeTalkUrlDetails($this->userpage
);
336 $personal_urls['anontalk'] = array(
337 'text' => wfMsg('anontalk'),
338 'href' => &$usertalkUrlDetails['href'],
339 'class' => $usertalkUrlDetails['exists']?
false:'new'
341 $personal_urls['anonlogin'] = array(
342 'text' => wfMsg('userlogin'),
343 'href' => $this->makeSpecialUrl('Userlogin', 'returnto=' . $this->thisurl
)
347 $personal_urls['login'] = array(
348 'text' => wfMsg('userlogin'),
349 'href' => $this->makeSpecialUrl('Userlogin', 'returnto=' . $this->thisurl
)
354 return $personal_urls;
358 * an array of edit links by default used for the tabs
360 function buildContentActionUrls () {
361 global $wgTitle, $wgUser, $wgRequest, $wgUseValidation;
362 $action = $wgRequest->getText( 'action' );
363 $section = $wgRequest->getText( 'section' );
364 $oldid = $wgRequest->getVal( 'oldid' );
365 $diff = $wgRequest->getVal( 'diff' );
366 $content_actions = array();
368 if( $this->iscontent
) {
370 $nskey = $this->getNameSpaceKey();
371 $is_active = !Namespace::isTalk( $wgTitle->getNamespace()) ;
372 if ( $action == 'validate' ) $is_active = false ; # Show article tab deselected when validating
373 $content_actions[$nskey] = array('class' => ($is_active) ?
'selected' : false,
374 'text' => wfMsg($nskey),
375 'href' => $this->makeArticleUrl($this->thispage
));
377 /* set up the classes for the talk link */
378 $talk_class = (Namespace::isTalk( $wgTitle->getNamespace()) ?
'selected' : false);
379 $talktitle = Title
::newFromText( $this->titletxt
);
380 $talktitle = $talktitle->getTalkPage();
381 $this->checkTitle($talktitle, $this->titletxt
);
382 if($talktitle->getArticleId() != 0) {
383 $content_actions['talk'] = array(
384 'class' => $talk_class,
385 'text' => wfMsg('talk'),
386 'href' => $this->makeTalkUrl($this->titletxt
)
389 $content_actions['talk'] = array(
390 'class' => $talk_class?
$talk_class.' new':'new',
391 'text' => wfMsg('talk'),
392 'href' => $this->makeTalkUrl($this->titletxt
,'action=edit')
396 if ( $wgTitle->userCanEdit() ) {
397 $oid = ( $oldid && ! isset( $diff ) ) ?
'&oldid='.$oldid : false;
398 $istalk = ( Namespace::isTalk( $wgTitle->getNamespace()) );
399 $istalkclass = $istalk?
' istalk':'';
400 $content_actions['edit'] = array(
401 'class' => ((($action == 'edit' or $action == 'submit') and $section != 'new') ?
'selected' : '').$istalkclass,
402 'text' => wfMsg('edit'),
403 'href' => $this->makeUrl($this->thispage
, 'action=edit'.$oid)
406 $content_actions['addsection'] = array(
407 'class' => $section == 'new'?
'selected':false,
408 'text' => wfMsg('addsection'),
409 'href' => $this->makeUrl($this->thispage
, 'action=edit§ion=new')
413 $oid = ( $oldid && ! isset( $diff ) ) ?
'&oldid='.$oldid : '';
414 $content_actions['viewsource'] = array('class' => ($action == 'edit') ?
'selected' : false,
415 'text' => wfMsg('viewsource'),
416 'href' => $this->makeUrl($this->thispage
, 'action=edit'.$oid));
419 if ( $wgTitle->getArticleId() ) {
421 $content_actions['history'] = array('class' => ($action == 'history') ?
'selected' : false,
422 'text' => wfMsg('history_short'),
423 'href' => $this->makeUrl($this->thispage
, 'action=history'));
425 # XXX: is there a rollback action anywhere or is it planned?
426 # Don't recall where i got this from...
427 /*if( $wgUser->getNewtalk() ) {
428 $content_actions['rollback'] = array('class' => ($action == 'rollback') ? 'selected' : false,
429 'text' => wfMsg('rollback_short'),
430 'href' => $this->makeUrl($this->thispage, 'action=rollback'),
431 'ttip' => wfMsg('tooltip-rollback'),
432 'akey' => wfMsg('accesskey-rollback'));
435 if($wgUser->isSysop()){
436 if(!$wgTitle->isProtected()){
437 $content_actions['protect'] = array(
438 'class' => ($action == 'protect') ?
'selected' : false,
439 'text' => wfMsg('protect'),
440 'href' => $this->makeUrl($this->thispage
, 'action=protect')
444 $content_actions['unprotect'] = array(
445 'class' => ($action == 'unprotect') ?
'selected' : false,
446 'text' => wfMsg('unprotect'),
447 'href' => $this->makeUrl($this->thispage
, 'action=unprotect')
450 $content_actions['delete'] = array(
451 'class' => ($action == 'delete') ?
'selected' : false,
452 'text' => wfMsg('delete'),
453 'href' => $this->makeUrl($this->thispage
, 'action=delete')
456 if ( $wgUser->getID() != 0 ) {
457 if ( $wgTitle->userCanEdit()) {
458 $content_actions['move'] = array('class' => ($wgTitle->getDbKey() == 'Movepage' and $wgTitle->getNamespace
== Namespace::getSpecial()) ?
'selected' : false,
459 'text' => wfMsg('move'),
460 'href' => $this->makeSpecialUrl('Movepage', 'target='. urlencode( $this->thispage
))
463 $content_actions['move'] = array('class' => 'inactive',
464 'text' => wfMsg('move'),
470 //article doesn't exist or is deleted
471 if($wgUser->isSysop()){
472 if( $n = $wgTitle->isDeleted() ) {
473 $content_actions['delete'] = array(
475 'text' => wfMsg( "undelete_short", $n ),
476 'href' => $this->makeSpecialUrl('Undelete/'.$this->thispage
)
482 if ( $wgUser->getID() != 0 and $action != 'submit' ) {
483 if( !$wgTitle->userIsWatching()) {
484 $content_actions['watch'] = array('class' => ($action == 'watch' or $action == 'unwatch') ?
'selected' : false,
485 'text' => wfMsg('watch'),
486 'href' => $this->makeUrl($this->thispage
, 'action=watch'));
488 $content_actions['unwatch'] = array('class' => ($action == 'unwatch' or $action == 'watch') ?
'selected' : false,
489 'text' => wfMsg('unwatch'),
490 'href' => $this->makeUrl($this->thispage
, 'action=unwatch'));
495 if ( $wgUseValidation && $wgTitle->getArticleId() && $wgTitle->getNamespace() == 0 ) {
497 $article_time = "×tamp=" . $wgArticle->mTimestamp
;
498 $content_actions['validate'] = array('class' => ($action == 'validate') ?
'selected' : false ,
499 'text' => wfMsg('val_tab'),
500 'href' => $this->makeUrl($this->thispage
, 'action=validate'.$article_time));
504 /* show special page tab */
506 $content_actions['article'] = array('class' => 'selected',
507 'text' => wfMsg('specialpage'),
511 return $content_actions;
515 * build array of common navigation links
517 function buildNavUrls () {
518 global $wgTitle, $wgUser, $wgRequest;
519 global $wgSiteSupportPage, $wgDisableUploads;
521 $action = $wgRequest->getText( 'action' );
522 $oldid = $wgRequest->getVal( 'oldid' );
523 $diff = $wgRequest->getVal( 'diff' );
524 // XXX: remove htmlspecialchars when tal:attributes works with i18n:attributes
526 $nav_urls['mainpage'] = array('href' => htmlspecialchars( $this->makeI18nUrl('mainpage')));
527 $nav_urls['randompage'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Randompage')));
528 $nav_urls['recentchanges'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Recentchanges')));
529 $nav_urls['whatlinkshere'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Whatlinkshere', 'target='.urlencode( $this->thispage
))));
530 $nav_urls['currentevents'] = (wfMsg('currentevents') != '-') ?
array('href' => htmlspecialchars( $this->makeI18nUrl('currentevents'))) : false;
531 $nav_urls['portal'] = (wfMsg('portal') != '-') ?
array('href' => htmlspecialchars( $this->makeI18nUrl('portal-url'))) : false;
532 $nav_urls['recentchangeslinked'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Recentchangeslinked', 'target='.urlencode( $this->thispage
))));
533 $nav_urls['bugreports'] = array('href' => htmlspecialchars( $this->makeI18nUrl('bugreportspage')));
534 // $nav_urls['sitesupport'] = array('href' => htmlspecialchars( $this->makeI18nUrl('sitesupportpage')));
535 $nav_urls['sitesupport'] = array('href' => htmlspecialchars( $wgSiteSupportPage));
536 $nav_urls['help'] = array('href' => htmlspecialchars( $this->makeI18nUrl('helppage')));
537 if( $this->loggedin
&& !$wgDisableUploads ) {
538 $nav_urls['upload'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Upload')));
540 $nav_urls['specialpages'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Specialpages')));
542 if( $wgTitle->getNamespace() == NS_USER ||
$wgTitle->getNamespace() == NS_USER_TALK
) {
543 $id = User
::idFromName($wgTitle->getText());
544 $ip = User
::isIP($wgTitle->getText());
550 if($id ||
$ip) { # both anons and non-anons have contri list
551 $nav_urls['contributions'] = array(
552 'href' => htmlspecialchars( $this->makeSpecialUrl('Contributions', "target=" . $wgTitle->getPartialURL() ) )
555 if ( 0 != $wgUser->getID() ) { # show only to signed in users
556 if($id) { # can only email non-anons
557 $nav_urls['emailuser'] = array(
558 'href' => htmlspecialchars( $this->makeSpecialUrl('Emailuser', "target=" . $wgTitle->getPartialURL() ) )
568 * Generate strings used for xml 'id' names
570 function getNameSpaceKey () {
572 switch ($wgTitle->getNamespace()) {
580 return 'nstab-media';
582 return 'nstab-special';
584 case NS_PROJECT_TALK
:
588 return 'nstab-image';
590 case NS_MEDIAWIKI_TALK
:
591 return 'nstab-mediawiki';
593 case NS_TEMPLATE_TALK
:
594 return 'nstab-template';
599 case NS_CATEGORY_TALK
:
600 return 'nstab-category';
610 function setupUserCssJs () {
611 global $wgRequest, $wgTitle;
612 $action = $wgRequest->getText('action');
614 $this->usercss
= '@import "'.$this->makeUrl('-','action=raw&gen=css').'";'."\n";
616 if( $this->loggedin
) {
617 if($wgTitle->isCssSubpage() and $action == 'submit' and $wgTitle->userCanEditCssJsSubpage()) {
619 $this->usercss
= '@import "'.$this->makeUrl('-','action=raw&smaxage=0&maxage=0&gen=css').'";'."\n";
621 $this->usercss
.= $wgRequest->getText('wpTextbox1');
624 $this->usercss
.= '@import "'.$this->makeUrl('-','action=raw&smaxage=0&gen=css').'";'."\n";
625 # import user stylesheet
626 $this->usercss
.= '@import "'.
627 $this->makeUrl($this->userpage
.'/'.$this->skinname
.'.css', 'action=raw&ctype=text/css').'";'."\n";
629 if($wgTitle->isJsSubpage() and $action == 'submit' and $wgTitle->userCanEditCssJsSubpage()) {
630 # XXX: additional security check/prompt?
631 $this->userjsprev
= $wgRequest->getText('wpTextbox1');
633 $this->userjs
= $this->makeUrl($this->userpage
.'/'.$this->skinname
.'.js', 'action=raw&ctype=text/javascript&dontcountme=s');
639 * returns css with user-specific options
641 function getUserStylesheet() {
642 global $wgUser, $wgRequest, $wgTitle, $wgLang, $wgSquidMaxage, $wgStylePath;
643 $action = $wgRequest->getText('action');
644 $maxage = $wgRequest->getText('maxage');
645 $s = "/* generated user stylesheet */\n";
646 if($wgLang->isRTL()) $s .= '@import "'.$wgStylePath.'/'.$this->stylename
.'/rtl.css";'."\n";
648 $this->makeNSUrl(ucfirst($this->skinname
).'.css', 'action=raw&ctype=text/css&smaxage='.$wgSquidMaxage, NS_MEDIAWIKI
)."\";\n";
649 if($wgUser->getID() != 0) {
650 if ( 1 == $wgUser->getOption( "underline" ) ) {
651 $s .= "a { text-decoration: underline; }\n";
653 $s .= "a { text-decoration: none; }\n";
656 if ( 1 != $wgUser->getOption( "highlightbroken" ) ) {
657 $s .= "a.new, #quickbar a.new { color: #CC2200; }\n";
659 if ( 1 == $wgUser->getOption( "justify" ) ) {
660 $s .= "#bodyContent { text-align: justify; }\n";
668 function getUserJs() {
669 global $wgUser, $wgStylePath;
670 $s = '/* generated javascript */';
671 $s .= "var skin = '{$this->skinname}';\nvar stylepath = '{$wgStylePath}';";
672 $s .= '/* MediaWiki:'.ucfirst($this->skinname
)." */\n";
673 $s .= wfMsg(ucfirst($this->skinname
).'.js');
678 } // end of if( defined( 'MEDIAWIKI' ) )