missing comma
[lhc/web/wiklou.git] / includes / SkinSmarty.php
1 <?
2
3 include_once( "Smarty.class.php" );
4
5 class SkinSmarty extends Skin {
6 var $template;
7
8 function SkinSmarty() {
9 }
10
11 function initPage() {
12 $this->template = "paddington";
13 }
14
15 function outputPage( &$out ) {
16 global $wgTitle, $wgArticle, $wgUser, $wgLang;
17 global $wgScriptPath, $wgStyleSheetPath, $wgLanguageCode;
18
19 $this->initPage();
20
21 $smarty = new Smarty();
22 $smarty->register_function( "wikimsg",
23 array( &$this,"smarty_function_wikimsg" ), true );
24 $smarty->register_function( "wikilink",
25 array( &$this, "smarty_function_wikilink" ) );
26
27 $smarty->assign( "title", $wgTitle->getPrefixedText() ); // ?
28 $smarty->assign( "thispage", $wgTitle->getPrefixedDbKey() );
29 $smarty->assign( "subtitle", $out->getSubtitle() );
30
31 $smarty->assign( "editable", ($wgTitle->getNamespace != Namespace::getSpecial() ) );
32 $smarty->assign( "exists", $wgTitle->getArticleID() != 0 );
33 $smarty->assign( "watch", $wgTitle->userIsWatching() ? "unwatch" : "watch" );
34 $smarty->assign( "protect", count($wgTitle->getRestrictions()) ? "unprotect" : "protect" );
35
36 $smarty->assign( "searchaction", $wgScriptPath );
37 $smarty->assign( "stylepath", $wgStyleSheetPath );
38 $smarty->assign( "lang", $wgLanguageCode );
39 $smarty->assign( "langname", $wgLang->getLanguageName( $wgLanguageCode ) );
40
41 $smarty->assign( "username", $wgUser->getName() );
42 $smarty->assign( "userpage", $wgLang->getNsText( Namespace::getUser() ) . ":" . $wgUser->getName() );
43 $smarty->assign( "loggedin", $wgUser->getID() != 0 );
44 $smarty->assign( "sysop", $wgUser->isSysop() );
45 if( $wgUser->getNewtalk() ) {
46 $ntl = wfMsg( "newmessages",
47 $this->makeKnownLink(
48 $wgLang->getNsText( Namespace::getTalk( Namespace::getUser() ) )
49 . ":" . $wgUser->getName(),
50 wfMsg("newmessageslink")
51 )
52 );
53 } else {
54 $ntl = "";
55 }
56 $smarty->assign( "newtalk", $ntl );
57
58 $smarty->assign( "logo", $this->logoText() );
59 $smarty->assign( "pagestats", $this->pageStats() );
60 $smarty->assign( "otherlanguages", $this->otherLanguages() );
61
62 $smarty->assign( "debug", $out->mDebugtext );
63 $smarty->assign( "reporttime", $out->reportTime() );
64
65 $smarty->assign( "bodytext", $out->mBodytext );
66
67 $smarty->display( $this->template . ".tpl" );
68 }
69
70 function smarty_function_wikimsg( $params, &$smarty ) {
71 return wfMsg( $params['key'] );
72 }
73
74 function smarty_function_wikilink( $params, &$smarty ) {
75 global $wgLang;
76 $action = "";
77 $popup = "";
78 $page = "";
79
80 if($params['action']) $action = "action=" . $params['action'];
81
82 if($params['special']) {
83 $page = $wgLang->specialPage( $params['special'] );
84 #$text = $wgLang->getSpecialPageName( $params['special'] );
85 $text = $popup = $params['special'];
86 if($params['target']) $action .= "target=" . urlencode( $params['target'] );
87 } else {
88 if( $params['keypage'] )
89 $title = Title::newFromText( wfMsg( $params['keypage'] ) );
90 else
91 $title = Title::newFromText( $params['name'] );
92 if(isset($params["talk"])) {
93 $title = Title::makeTitle( $title->getNamespace() ^ 1, $title->getDbKey() );
94 }
95 $text = $popup = $title->getPrefixedText();
96 $page = urlencode( $title->getPrefixedUrl() );
97 }
98
99 $url = wfLocalUrlE( $page, $action );
100
101 if($params['text']) $text = $params['text'];
102 if($params['key']) $text = wfMsg( $params['key'] );
103 if($popup) $popup = ' title="' . htmlspecialchars( $popup ) . '"';
104
105 return "<a href=\"$url\"$popup>$text</a>";
106 }
107
108 /*
109 function Skin()
110 function getSkinNames()
111 function getStylesheet()
112
113 function qbSetting()
114 function initPage()
115 function getHeadScripts() {
116 function getUserStyles()
117 function doGetUserStyles()
118 function getBodyOptions()
119 function getExternalLinkAttributes( $link, $text )
120 function getInternalLinkAttributes( $link, $text, $broken = false )
121
122 function getLogo()
123 function beforeContent()
124 function doBeforeContent()
125 function getQuickbarCompensator( $rows = 1 )
126 function afterContent()
127 function doAfterContent()
128 function pageTitleLinks()
129 function printableLink()
130 function pageTitle()
131 function pageSubtitle()
132 function nameAndLogin()
133 function searchForm()
134 function topLinks()
135 function bottomLinks()
136 function pageStats()
137 function lastModified()
138 function logoText( $align = "" )
139 function quickBar()
140 function specialPagesList()
141 function mainPageLink()
142 function copyrightLink()
143 function aboutLink()
144 function editThisPage()
145 function deleteThisPage()
146 function protectThisPage()
147 function watchThisPage()
148 function moveThisPage()
149 function historyLink()
150 function whatLinksHere()
151 function userContribsLink()
152 function emailUserLink()
153 function watchPageLinksLink()
154 function otherLanguages()
155 function bugReportsLink()
156 function dateLink()
157 function talkLink()
158 function transformContent( $text )
159
160 function makeLink( $title, $text= "", $query = "", $trail = "" )
161 function makeKnownLink( $title, $text = "", $query = "", $trail = "" )
162 function makeBrokenLink( $title, $text = "", $query = "", $trail = "" )
163 function makeStubLink( $title, $text = "", $query = "", $trail = "" )
164 function fnamePart( $url )
165 function makeImage( $url, $alt = "" )
166 function makeImageLink( $name, $url, $alt = "" )
167 function makeMediaLink( $name, $url, $alt = "" )
168 function specialLink( $name, $key = "" )
169
170 function beginHistoryList()
171 function beginImageHistoryList()
172 function endRecentChangesList()
173 function endHistoryList()
174 function endImageHistoryList()
175 function historyLine( $ts, $u, $ut, $ns, $ttl, $oid, $c, $isminor )
176 function imageHistoryLine( $iscur, $ts, $img, $u, $ut, $size, $c )
177
178
179 function beginRecentChangesList()
180 function recentChangesBlockLine ( $y ) {
181 function recentChangesBlockGroup ( $y ) {
182 function recentChangesBlock ()
183 function recentChangesLine( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched = false, $oldid = 0 , $diffid = 0 )
184 function recentChangesLineOld( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched = false, $oldid = 0, $diffid = 0 )
185 function recentChangesLineNew( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched = false, $oldid = 0 , $diffid = 0 )
186
187 function tocIndent($level) {
188 function tocUnindent($level) {
189 function tocLine($anchor,$tocline,$level) {
190 function tocTable($toc) {
191 function editSectionScript($section,$head) {
192 function editSectionLink($section) {
193 */
194
195 }
196
197 class SkinMontparnasse extends SkinSmarty {
198 function initPage() {
199 SkinSmarty::initPage();
200 $this->template = "montparnasse";
201 }
202 }
203
204 ?>