Ensure that width and height fields are not null when we insert
[lhc/web/wiklou.git] / skins / CologneBlue.php
1 <?php
2 /**
3 * See skin.txt
4 *
5 * @todo document
6 * @package MediaWiki
7 * @subpackage Skins
8 */
9
10 if( !defined( 'MEDIAWIKI' ) )
11 die();
12
13 /**
14 * @todo document
15 * @package MediaWiki
16 * @subpackage Skins
17 */
18 class SkinCologneBlue extends Skin {
19
20 function getStylesheet() {
21 return "common/cologneblue.css";
22 }
23 function getSkinName() {
24 return "cologneblue";
25 }
26
27 function doBeforeContent() {
28 global $wgOut, $wgTitle;
29
30 $s = "";
31 $qb = $this->qbSetting();
32 $mainPageObj = Title::newMainPage();
33
34 $s .= "\n<div id='content'>\n<div id='topbar'>" .
35 "<table width='100%' border='0' cellspacing='0' cellpadding='8'><tr>";
36
37 $s .= "<td class='top' align='left' valign='middle' nowrap='nowrap'>";
38 $s .= "<a href=\"" . $mainPageObj->escapeLocalURL() . "\">";
39 $s .= "<span id='sitetitle'>" . wfMsg( "sitetitle" ) . "</span></a>";
40
41 $s .= "</td><td class='top' align='right' valign='bottom' width='100%'>";
42 $s .= $this->sysLinks();
43 $s .= "</td></tr><tr><td valign='top'>";
44
45 $s .= "<font size='-1'><span id='sitesub'>";
46 $s .= htmlspecialchars( wfMsg( "sitesubtitle" ) ) . "</span></font>";
47 $s .= "</td><td align='right'>" ;
48
49 $s .= "<font size='-1'><span id='langlinks'>" ;
50 $s .= str_replace ( "<br />" , "" , $this->otherLanguages() );
51 $cat = $this->getCategoryLinks();
52 if( $cat ) $s .= "<br />$cat\n";
53 $s .= "<br />" . $this->pageTitleLinks();
54 $s .= "</span></font>";
55
56 $s .= "</td></tr></table>\n";
57
58 $s .= "\n</div>\n<div id='article'>";
59
60 $notice = wfGetSiteNotice();
61 if( $notice ) {
62 $s .= "\n<div id='siteNotice'>$notice</div>\n";
63 }
64 $s .= $this->pageTitle();
65 $s .= $this->pageSubtitle() . "\n";
66 return $s;
67 }
68
69 function doAfterContent()
70 {
71 global $wgOut;
72
73 $s = "\n</div><br clear='all' />\n";
74
75 $s .= "\n<div id='footer'>";
76 $s .= "<table width='98%' border='0' cellspacing='0'><tr>";
77
78 $qb = $this->qbSetting();
79 if ( 1 == $qb || 3 == $qb ) { # Left
80 $s .= $this->getQuickbarCompensator();
81 }
82 $s .= "<td class='bottom' align='center' valign='top'>";
83
84 $s .= $this->bottomLinks();
85 $s .= "\n<br />" . $this->makeKnownLink( wfMsgForContent( "mainpage" ) ) . " | "
86 . $this->aboutLink() . " | "
87 . $this->searchForm( wfMsg( "qbfind" ) );
88
89 $s .= "\n<br />" . $this->pageStats();
90
91 $s .= "</td>";
92 if ( 2 == $qb ) { # Right
93 $s .= $this->getQuickbarCompensator();
94 }
95 $s .= "</tr></table>\n</div>\n</div>\n";
96
97 if ( 0 != $qb ) { $s .= $this->quickBar(); }
98 return $s;
99 }
100
101 function doGetUserStyles() {
102 global $wgOut, $wgStyleSheetPath;
103 $s = parent::doGetUserStyles();
104 $qb = $this->qbSetting();
105
106 if ( 2 == $qb ) { # Right
107 $s .= "#quickbar { position: absolute; right: 4px; }\n" .
108 "#article { margin-left: 4px; margin-right: 148px; }\n";
109 } else if ( 1 == $qb ) {
110 $s .= "#quickbar { position: absolute; left: 4px; }\n" .
111 "#article { margin-left: 148px; margin-right: 4px; }\n";
112 } else if ( 3 == $qb ) { # Floating
113 $s .= "#quickbar { position:absolute; left:4px } \n" .
114 "#topbar { margin-left: 148px }\n" .
115 "#article { margin-left:148px; margin-right: 4px; } \n" .
116 "body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto ;bottom:4px;} \n"; # Hides from IE
117 }
118 return $s;
119 }
120
121 function sysLinks() {
122 global $wgUser, $wgContLang, $wgTitle;
123 $li = $wgContLang->specialPage("Userlogin");
124 $lo = $wgContLang->specialPage("Userlogout");
125
126 $rt = $wgTitle->getPrefixedURL();
127 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
128 $q = "";
129 } else {
130 $q = "returnto={$rt}";
131 }
132
133 $s = "" .
134 $this->makeKnownLink( wfMsgForContent( "mainpage" ), wfMsg( "mainpage" ) )
135 . " | " .
136 $this->makeKnownLink( wfMsgForContent( "aboutpage" ), wfMsg( "about" ) )
137 . " | " .
138 $this->makeKnownLink( wfMsgForContent( "helppage" ), wfMsg( "help" ) )
139 . " | " .
140 $this->makeKnownLink( wfMsgForContent( "faqpage" ), wfMsg("faq") )
141 . " | " .
142 $this->specialLink( "specialpages" ) . " | ";
143
144 if ( $wgUser->isLoggedIn() ) {
145 $s .= $this->makeKnownLink( $lo, wfMsg( "logout" ), $q );
146 } else {
147 $s .= $this->makeKnownLink( $li, wfMsg( "login" ), $q );
148 }
149
150 /* show links to different language variants */
151 global $wgDisableLangConversion;
152 $variants = $wgContLang->getVariants();
153 if( !$wgDisableLangConversion && sizeof( $variants ) > 1 ) {
154 $actstr = '';
155 foreach( $variants as $code ) {
156 $varname = $wgContLang->getVariantname( $code );
157 if( $varname == 'disable' )
158 continue;
159 $s .= ' | <a href="' . $wgTitle->getLocalUrl( 'variant=' . $code ) . '">' . $varname . '</a>';
160 }
161 }
162
163
164
165 return $s;
166 }
167
168 /**
169 * Compute the sidebar
170 * @private
171 */
172 function quickBar()
173 {
174 global $wgOut, $wgTitle, $wgUser, $wgLang, $wgContLang, $wgEnableUploads;
175
176 $tns=$wgTitle->getNamespace();
177
178 $s = "\n<div id='quickbar'>";
179
180 $sep = "<br />";
181 $s .= $this->menuHead( "qbfind" );
182 $s .= $this->searchForm();
183
184 $s .= $this->menuHead( "qbbrowse" );
185
186 # Use the first heading from the Monobook sidebar as the "browse" section
187 $bar = $this->buildSidebar();
188 $browseLinks = reset( $bar );
189
190 foreach ( $browseLinks as $link ) {
191 if ( $link['text'] != '-' ) {
192 $s .= "<a href=\"{$link['href']}\">" .
193 htmlspecialchars( $link['text'] ) . '</a>' . $sep;
194 }
195 }
196
197 if ( $wgOut->isArticle() ) {
198 $s .= $this->menuHead( "qbedit" );
199 $s .= "<strong>" . $this->editThisPage() . "</strong>";
200
201 $s .= $sep . $this->makeKnownLink( wfMsgForContent( "edithelppage" ), wfMsg( "edithelp" ) );
202
203 if( $wgUser->isLoggedIn() ) {
204 $s .= $sep . $this->moveThisPage();
205 }
206 if ( $wgUser->isAllowed('delete') ) {
207 $dtp = $this->deleteThisPage();
208 if ( "" != $dtp ) {
209 $s .= $sep . $dtp;
210 }
211 }
212 if ( $wgUser->isAllowed('protect') ) {
213 $ptp = $this->protectThisPage();
214 if ( "" != $ptp ) {
215 $s .= $sep . $ptp;
216 }
217 }
218 $s .= $sep;
219
220 $s .= $this->menuHead( "qbpageoptions" );
221 $s .= $this->talkLink()
222 . $sep . $this->commentLink()
223 . $sep . $this->printableLink();
224 if ( $wgUser->isLoggedIn() ) {
225 $s .= $sep . $this->watchThisPage();
226 }
227
228 $s .= $sep;
229
230 $s .= $this->menuHead("qbpageinfo")
231 . $this->historyLink()
232 . $sep . $this->whatLinksHere()
233 . $sep . $this->watchPageLinksLink();
234
235 if( $tns == NS_USER || $tns == NS_USER_TALK ) {
236 $id=User::idFromName($wgTitle->getText());
237 if ($id != 0) {
238 $s .= $sep . $this->userContribsLink();
239 if( $this->showEmailUser( $id ) ) {
240 $s .= $sep . $this->emailUserLink();
241 }
242 }
243 }
244 $s .= $sep;
245 }
246
247 $s .= $this->menuHead( "qbmyoptions" );
248 if ( $wgUser->isLoggedIn() ) {
249 $name = $wgUser->getName();
250 $tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(),
251 wfMsg( 'mytalk' ) );
252 if ( $wgUser->getNewtalk() ) {
253 $tl .= " *";
254 }
255
256 $s .= $this->makeKnownLinkObj( $wgUser->getUserPage(),
257 wfMsg( "mypage" ) )
258 . $sep . $tl
259 . $sep . $this->specialLink( "watchlist" )
260 . $sep . $this->makeKnownLinkObj( Title::makeTitle( NS_SPECIAL, "Contributions" ),
261 wfMsg( "mycontris" ), "target=" . wfUrlencode($wgUser->getName() ) )
262 . $sep . $this->specialLink( "preferences" )
263 . $sep . $this->specialLink( "userlogout" );
264 } else {
265 $s .= $this->specialLink( "userlogin" );
266 }
267
268 $s .= $this->menuHead( "qbspecialpages" )
269 . $this->specialLink( "newpages" )
270 . $sep . $this->specialLink( "imagelist" )
271 . $sep . $this->specialLink( "statistics" )
272 . $sep . $this->bugReportsLink();
273 if ( $wgUser->isLoggedIn() && $wgEnableUploads ) {
274 $s .= $sep . $this->specialLink( "upload" );
275 }
276 global $wgSiteSupportPage;
277 if( $wgSiteSupportPage) {
278 $s .= $sep."<a href=\"".htmlspecialchars($wgSiteSupportPage)."\" class =\"internal\">"
279 .wfMsg( "sitesupport" )."</a>";
280 }
281
282 $s .= $sep . $this->makeKnownLinkObj(
283 Title::makeTitle( NS_SPECIAL, 'Specialpages' ),
284 wfMsg( 'moredotdotdot' ) );
285
286 $s .= $sep . "\n</div>\n";
287 return $s;
288 }
289
290 function menuHead( $key )
291 {
292 $s = "\n<h6>" . wfMsg( $key ) . "</h6>";
293 return $s;
294 }
295
296 function searchForm( $label = "" )
297 {
298 global $wgRequest;
299
300 $search = $wgRequest->getText( 'search' );
301 $action = $this->escapeSearchLink();
302 $s = "<form id=\"search\" method=\"get\" class=\"inline\" action=\"$action\">";
303 if ( "" != $label ) { $s .= "{$label}: "; }
304
305 $s .= "<input type='text' name=\"search\" size='14' value=\""
306 . htmlspecialchars(substr($search,0,256)) . "\" />"
307 . "<br /><input type='submit' name=\"go\" value=\"" . htmlspecialchars( wfMsg( "go" ) ) . "\" /> <input type='submit' name=\"fulltext\" value=\"" . htmlspecialchars( wfMsg( "search" ) ) . "\" /></form>";
308
309 return $s;
310 }
311 }
312
313 ?>