* Fixed magic quotes in $_REQUEST, in Setup.php
[lhc/web/wiklou.git] / includes / SkinSmarty.php
1 <?php
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 $title = NULL;
79
80 if($params['action']) $action = "action=" . $params['action'];
81
82 if($params['special']) {
83 $title = Title::makeTitle( NS_SPECIAL, $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 }
97
98 $url = $title->getURL( $action, true );
99
100 if($params['text']) $text = $params['text'];
101 if($params['key']) $text = wfMsg( $params['key'] );
102 if($popup) $popup = ' title="' . htmlspecialchars( $popup ) . '"';
103
104 return "<a href=\"$url\"$popup>$text</a>";
105 }
106
107 /*
108 function Skin()
109 function getSkinNames()
110 function getStylesheet()
111
112 function qbSetting()
113 function initPage()
114 function getHeadScripts() {
115 function getUserStyles()
116 function doGetUserStyles()
117 function getBodyOptions()
118 function getExternalLinkAttributes( $link, $text )
119 function getInternalLinkAttributes( $link, $text, $broken = false )
120
121 function getLogo()
122 function beforeContent()
123 function doBeforeContent()
124 function getQuickbarCompensator( $rows = 1 )
125 function afterContent()
126 function doAfterContent()
127 function pageTitleLinks()
128 function printableLink()
129 function pageTitle()
130 function pageSubtitle()
131 function nameAndLogin()
132 function searchForm()
133 function topLinks()
134 function bottomLinks()
135 function pageStats()
136 function lastModified()
137 function logoText( $align = "" )
138 function quickBar()
139 function specialPagesList()
140 function mainPageLink()
141 function copyrightLink()
142 function aboutLink()
143 function editThisPage()
144 function deleteThisPage()
145 function protectThisPage()
146 function watchThisPage()
147 function moveThisPage()
148 function historyLink()
149 function whatLinksHere()
150 function userContribsLink()
151 function emailUserLink()
152 function watchPageLinksLink()
153 function otherLanguages()
154 function bugReportsLink()
155 function dateLink()
156 function talkLink()
157 function transformContent( $text )
158
159 function makeLink( $title, $text= "", $query = "", $trail = "" )
160 function makeKnownLink( $title, $text = "", $query = "", $trail = "" )
161 function makeBrokenLink( $title, $text = "", $query = "", $trail = "" )
162 function makeStubLink( $title, $text = "", $query = "", $trail = "" )
163 function fnamePart( $url )
164 function makeImage( $url, $alt = "" )
165 function makeImageLink( $name, $url, $alt = "" )
166 function makeMediaLink( $name, $url, $alt = "" )
167 function specialLink( $name, $key = "" )
168
169 function beginHistoryList()
170 function beginImageHistoryList()
171 function endRecentChangesList()
172 function endHistoryList()
173 function endImageHistoryList()
174 function historyLine( $ts, $u, $ut, $ns, $ttl, $oid, $c, $isminor )
175 function imageHistoryLine( $iscur, $ts, $img, $u, $ut, $size, $c )
176
177
178 function beginRecentChangesList()
179 function recentChangesBlockLine ( $y ) {
180 function recentChangesBlockGroup ( $y ) {
181 function recentChangesBlock ()
182 function recentChangesLine( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched = false, $oldid = 0 , $diffid = 0 )
183 function recentChangesLineOld( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched = false, $oldid = 0, $diffid = 0 )
184 function recentChangesLineNew( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched = false, $oldid = 0 , $diffid = 0 )
185
186 function tocIndent($level) {
187 function tocUnindent($level) {
188 function tocLine($anchor,$tocline,$level) {
189 function tocTable($toc) {
190 function editSectionScript($section,$head) {
191 function editSectionLink($section) {
192 */
193
194 }
195
196 class SkinMontparnasse extends SkinSmarty {
197 function initPage() {
198 SkinSmarty::initPage();
199 $this->template = "montparnasse";
200 }
201 }
202
203 ?>