You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

462 lines
20KB

  1. <?php
  2. global $smf_settings, $smf_user_info;
  3. if( !defined( 'MEDIAWIKI' ) )
  4. die( -1 );
  5. /**
  6. * Inherit main code from SkinTemplate, set the CSS and template filter.
  7. * @todo document
  8. * @ingroup Skins
  9. */
  10. class SkinGCL3 extends SkinTemplate {
  11. /** Using GCL3. */
  12. var $skinname = 'GCL3', $stylename = 'GCL3',
  13. $template = 'GCL3Template', $useHeadElement = true;
  14. function setupSkinUserCss( OutputPage $out ) {
  15. global $wgHandheldStyle;
  16. parent::setupSkinUserCss( $out );
  17. // Append to the default screen common & print styles...
  18. $out->addStyle( 'GCL3/main.css', 'screen' );
  19. $out->addStyle( 'GCL3/resources/print.css', 'print' );
  20. if( $wgHandheldStyle ) {
  21. // Currently in testing... try 'chick/main.css'
  22. $out->addStyle( $wgHandheldStyle, 'handheld' );
  23. }
  24. $out->addStyle( 'GCL3/IE50Fixes.css', 'screen', 'lt IE 5.5000' );
  25. $out->addStyle( 'GCL3/IE55Fixes.css', 'screen', 'IE 5.5000' );
  26. $out->addStyle( 'GCL3/IE60Fixes.css', 'screen', 'IE 6' );
  27. $out->addStyle( 'GCL3/IE70Fixes.css', 'screen', 'IE 7' );
  28. $out->addStyle( 'GCL3/rtl.css', 'screen', '', 'rtl' );
  29. }
  30. }
  31. /**
  32. * @todo document
  33. * @ingroup Skins
  34. */
  35. class GCL3Template extends QuickTemplate {
  36. var $skin;
  37. function head() {
  38. ob_start();
  39. $this->html( 'headelement' );
  40. $mw_head = ob_get_contents();
  41. ob_end_clean();
  42. ob_start();
  43. template_html_above();
  44. $smf_head = ob_get_contents();
  45. ob_end_clean();
  46. // merge mediawiki and smf heads together
  47. $smf_head = str_replace('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  48. <html xmlns="http://www.w3.org/1999/xhtml"><head>',"",$smf_head);
  49. $mw_head = str_replace("</head>",$smf_head,$mw_head);
  50. echo $mw_head;
  51. }
  52. /**
  53. * Template filter callback for GCL3 skin.
  54. * Takes an associative array of data set from a SkinTemplate-based
  55. * class, and a wrapper for MediaWiki's localization database, and
  56. * outputs a formatted page.
  57. *
  58. * @access private
  59. */
  60. function execute() {
  61. global $wgRequest, $wgScriptPath;
  62. $this->skin = $skin = $this->data['skin'];
  63. $action = $wgRequest->getText( 'action' );
  64. // Suppress warnings to prevent notices about missing indexes in $this->data
  65. wfSuppressWarnings();
  66. //$this->html( 'headelement' );
  67. $this->head();
  68. ?><div id="globalWrapper">
  69. <div id="column-content"><div id="content" <?php $this->html("specialpageattributes") ?>>
  70. <a id="top"></a>
  71. <?php
  72. if(!function_exists("template_main_above")) {
  73. //template_html_above();
  74. template_body_above();
  75. } else {
  76. template_main_above();
  77. }
  78. ?>
  79. <?php if($this->data['sitenotice']) { ?><div id="siteNotice"><?php $this->html('sitenotice') ?></div><?php } ?>
  80. <table id="metapod-table">
  81. <tr>
  82. <td id="metapod-menu">
  83. <?php
  84. $sidebar = $this->data['sidebar'];
  85. if ( !isset( $sidebar['SEARCH'] ) ) $sidebar['SEARCH'] = true;
  86. if ( !isset( $sidebar['TOOLBOX'] ) ) $sidebar['TOOLBOX'] = true;
  87. if ( !isset( $sidebar['LANGUAGES'] ) ) $sidebar['LANGUAGES'] = true;
  88. foreach ($sidebar as $boxName => $cont) {
  89. if ( $boxName == 'SEARCH' ) {
  90. $this->searchBox();
  91. } elseif ( $boxName == 'TOOLBOX' ) {
  92. $this->toolbox();
  93. } elseif ( $boxName == 'LANGUAGES' ) {
  94. $this->languageBox();
  95. } else {
  96. $this->customBox( $boxName, $cont );
  97. }
  98. }
  99. ?>
  100. </td>
  101. <td id="metapod-content">
  102. <!--<h1 id="firstHeading" class="firstHeading"><?php $this->html('title') ?></h1>-->
  103. <?php
  104. $linx = array();
  105. $page_url = array_values($this->data['content_actions'])[0]['href'];
  106. $page_url_pattern = '/' . str_replace(array("$1", '/'), array("(.*)", '\/'), $this->data['articlepath']) . '/';
  107. $page_url_matches = array();
  108. preg_match($page_url_pattern, $page_url, $page_url_matches);
  109. $page_path = $page_url_matches[1];
  110. $new_title = "<a href='$page_url'>" . $this->data['title'] . "</a>";
  111. if($page_path) {
  112. $tbits = explode("/",$this->data['title']);
  113. $urlbits = explode("/",$page_path);
  114. $linkzor2 = array();
  115. $linkTarget = "";
  116. for($i = 0; $i < count($tbits); $i++) {
  117. $linkTarget .= str_replace(" ","_", $linkTarget ? "/${urlbits[$i]}" : $urlbits[$i]);
  118. $linkzor2[] = "<a href=\"" . str_replace("$1", $linkTarget, $this->data['articlepath']) . "\">${tbits[$i]}</a>";
  119. }
  120. $new_title = implode("/",$linkzor2);
  121. }
  122. foreach($this->data['content_actions'] as $key => $tab) {
  123. $linx[] = '<a href="'.htmlspecialchars($tab['href']).'"'.Linker::tooltipAndAccesskeyAttribs('ca-'.$key).'>'.htmlspecialchars($tab['text']).'</a>';
  124. }
  125. ?>
  126. <?php begin_box3($this,$new_title,implode($linx," | ")); ?>
  127. <div id="bodyContent">
  128. <h3 id="siteSub"><?php $this->msg('tagline') ?></h3>
  129. <div id="contentSub"<?php $this->html('userlangattributes') ?>><?php $this->html('subtitle') ?></div>
  130. <?php if($this->data['undelete']) { ?>
  131. <div id="contentSub2"><?php $this->html('undelete') ?></div>
  132. <?php } ?><?php if($this->data['newtalk'] ) { ?>
  133. <div class="usermessage"><?php $this->html('newtalk') ?></div>
  134. <?php } ?><?php if($this->data['showjumplinks']) { ?>
  135. <div id="jump-to-nav"><?php $this->msg('jumpto') ?> <a href="#column-one"><?php $this->msg('jumptonavigation') ?></a>, <a href="#searchInput"><?php $this->msg('jumptosearch') ?></a></div>
  136. <?php } ?>
  137. <!-- start content -->
  138. <?php $this->html('bodytext') ?>
  139. <?php if($this->data['catlinks']) { $this->html('catlinks'); } ?>
  140. <!-- end content -->
  141. <?php end_box(); ?>
  142. <?php if($this->data['dataAfterContent']) { $this->html ('dataAfterContent'); } ?>
  143. <div class="visualClear"></div>
  144. </div>
  145. </div></div>
  146. </td>
  147. </tr>
  148. </table>
  149. <!-- <div id="column-one"<?php $this->html('userlangattributes') ?>>
  150. <div id="p-cactions" class="portlet">
  151. <h5><?php $this->msg('views') ?></h5>
  152. <div class="pBody">
  153. <ul><?php
  154. foreach($this->data['content_actions'] as $key => $tab) {
  155. echo '
  156. <li id="' . Sanitizer::escapeId( "ca-$key" ) . '"';
  157. if( $tab['class'] ) {
  158. echo ' class="'.htmlspecialchars($tab['class']).'"';
  159. }
  160. echo '><a href="'.htmlspecialchars($tab['href']).'"';
  161. # We don't want to give the watch tab an accesskey if the
  162. # page is being edited, because that conflicts with the
  163. # accesskey on the watch checkbox. We also don't want to
  164. # give the edit tab an accesskey, because that's fairly su-
  165. # perfluous and conflicts with an accesskey (Ctrl-E) often
  166. # used for editing in Safari.
  167. if( in_array( $action, array( 'edit', 'submit' ) )
  168. && in_array( $key, array( 'edit', 'watch', 'unwatch' ))) {
  169. echo Linker::tooltip( "ca-$key" );
  170. } else {
  171. echo Linker::tooltipAndAccesskeyAttribs( "ca-$key" );
  172. }
  173. echo '>'.htmlspecialchars($tab['text']).'</a></li>';
  174. } ?>
  175. </ul>
  176. </div>
  177. </div>
  178. <div class="portlet" id="p-personal">
  179. <h5><?php $this->msg('personaltools') ?></h5>
  180. <div class="pBody">
  181. <ul<?php $this->html('userlangattributes') ?>>
  182. <?php foreach($this->data['personal_urls'] as $key => $item) { ?>
  183. <li id="<?php echo Sanitizer::escapeId( "pt-$key" ) ?>"<?php
  184. if ($item['active']) { ?> class="active"<?php } ?>><a href="<?php
  185. echo htmlspecialchars($item['href']) ?>"<?php echo Linker::tooltipAndAccesskeyAttribs('pt-'.$key) ?><?php
  186. if(!empty($item['class'])) { ?> class="<?php
  187. echo htmlspecialchars($item['class']) ?>"<?php } ?>><?php
  188. echo htmlspecialchars($item['text']) ?></a></li>
  189. <?php } ?>
  190. </ul>
  191. </div>
  192. </div>
  193. <div class="portlet" id="p-logo">
  194. <a style="background-image: url(<?php $this->text('logopath') ?>);" <?php
  195. ?>href="<?php echo htmlspecialchars($this->data['nav_urls']['mainpage']['href'])?>"<?php
  196. echo Linker::tooltipAndAccesskeyAttribs('p-logo') ?>></a>
  197. </div>
  198. <script type="<?php $this->text('jsmimetype') ?>"> if (window.isMSIE55) fixalpha(); </script>
  199. </div>--><!-- end of the left (by default at least) column -->
  200. <div class="visualClear"></div>
  201. <div id="footer"<?php $this->html('userlangattributes') ?>>
  202. <?php
  203. if($this->data['poweredbyico']) { ?>
  204. <div id="f-poweredbyico"><?php $this->html('poweredbyico') ?></div>
  205. <?php }
  206. if($this->data['copyrightico']) { ?>
  207. <div id="f-copyrightico"><?php $this->html('copyrightico') ?></div>
  208. <?php }
  209. // Generate additional footer links
  210. $footerlinks = array(
  211. 'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright',
  212. 'privacy', 'about', 'disclaimer', 'tagline',
  213. );
  214. $validFooterLinks = array();
  215. foreach( $footerlinks as $aLink ) {
  216. if( isset( $this->data[$aLink] ) && $this->data[$aLink] ) {
  217. $validFooterLinks[] = $aLink;
  218. }
  219. }
  220. if ( count( $validFooterLinks ) > 0 ) {
  221. ?> <ul id="f-list">
  222. <?php
  223. foreach( $validFooterLinks as $aLink ) {
  224. if( isset( $this->data[$aLink] ) && $this->data[$aLink] ) {
  225. ?> <li id="<?php echo $aLink ?>"><?php $this->html($aLink) ?></li>
  226. <?php }
  227. }
  228. ?>
  229. </ul>
  230. <?php }
  231. ?>
  232. </div>
  233. </div>
  234. <?php $this->html('bottomscripts'); /* JS call to runBodyOnloadHook */ ?>
  235. <?php $this->html('reporttime') ?>
  236. <?php if ( $this->data['debug'] ): ?>
  237. <!-- Debug output:
  238. <?php $this->text( 'debug' ); ?>
  239. -->
  240. <?php endif; ?>
  241. </body></html>
  242. <?php
  243. wfRestoreWarnings();
  244. } // end of execute() method
  245. /*************************************************************************************************/
  246. function searchBox() {
  247. global $wgUseTwoButtonsSearchForm;
  248. ?>
  249. <?php begin_box("Search Wiki"); ?>
  250. <div id="p-search" class="portlet">
  251. <div id="searchBody" class="pBody">
  252. <form action="<?php $this->text('wgScript') ?>" id="searchform">
  253. <input type='hidden' name="title" value="<?php $this->text('searchtitle') ?>"/>
  254. <?php
  255. echo Html::input( 'search',
  256. isset( $this->data['search'] ) ? $this->data['search'] : '', 'search',
  257. array(
  258. 'id' => 'searchInput',
  259. 'title' => Linker::titleAttrib( 'search' ),
  260. 'accesskey' => Linker::accesskey( 'search' )
  261. ) ); ?>
  262. <input type='submit' name="go" class="searchButton" id="searchGoButton" value="<?php $this->msg('searcharticle') ?>"<?php echo Linker::tooltipAndAccesskeyAttribs( 'search-go' ); ?> /><?php if ($wgUseTwoButtonsSearchForm) { ?>&nbsp;
  263. <input type='submit' name="fulltext" class="searchButton" id="mw-searchButton" value="<?php $this->msg('searchbutton') ?>"<?php echo Linker::tooltipAndAccesskeyAttribs( 'search-fulltext' ); ?> /><?php } else { ?>
  264. <div><a href="<?php $this->text('searchaction') ?>" rel="search"><?php $this->msg('powersearch-legend') ?></a></div><?php } ?>
  265. </form>
  266. </div>
  267. </div>
  268. <?php end_box(); ?>
  269. <?php
  270. }
  271. /*************************************************************************************************/
  272. function toolbox() {
  273. ?>
  274. <?php begin_box("Toolbox"); ?>
  275. <div class="portlet" id="p-tb">
  276. <div class="pBody">
  277. <ul>
  278. <?php
  279. if($this->data['notspecialpage']) { ?>
  280. <li id="t-whatlinkshere"><a href="<?php
  281. echo htmlspecialchars($this->data['nav_urls']['whatlinkshere']['href'])
  282. ?>"<?php echo Linker::tooltipAndAccesskeyAttribs('t-whatlinkshere') ?>><?php $this->msg('whatlinkshere') ?></a></li>
  283. <?php
  284. if( $this->data['nav_urls']['recentchangeslinked'] ) { ?>
  285. <li id="t-recentchangeslinked"><a href="<?php
  286. echo htmlspecialchars($this->data['nav_urls']['recentchangeslinked']['href'])
  287. ?>"<?php echo Linker::tooltipAndAccesskeyAttribs('t-recentchangeslinked') ?>><?php $this->msg('recentchangeslinked-toolbox') ?></a></li>
  288. <?php }
  289. }
  290. if( isset( $this->data['nav_urls']['trackbacklink'] ) && $this->data['nav_urls']['trackbacklink'] ) { ?>
  291. <li id="t-trackbacklink"><a href="<?php
  292. echo htmlspecialchars($this->data['nav_urls']['trackbacklink']['href'])
  293. ?>"<?php echo Linker::tooltipAndAccesskeyAttribs('t-trackbacklink') ?>><?php $this->msg('trackbacklink') ?></a></li>
  294. <?php }
  295. if($this->data['feeds']) { ?>
  296. <li id="feedlinks"><?php foreach($this->data['feeds'] as $key => $feed) {
  297. ?><a id="<?php echo Sanitizer::escapeId( "feed-$key" ) ?>" href="<?php
  298. echo htmlspecialchars($feed['href']) ?>" rel="alternate" type="application/<?php echo $key ?>+xml" class="feedlink"<?php echo Linker::tooltipAndAccesskeyAttribs('feed-'.$key) ?>><?php echo htmlspecialchars($feed['text'])?></a>&nbsp;
  299. <?php } ?></li><?php
  300. }
  301. foreach( array('contributions', 'log', 'blockip', 'emailuser', 'upload', 'specialpages') as $special ) {
  302. if($this->data['nav_urls'][$special]) {
  303. ?><li id="t-<?php echo $special ?>"><a href="<?php echo htmlspecialchars($this->data['nav_urls'][$special]['href'])
  304. ?>"<?php echo Linker::tooltipAndAccesskeyAttribs('t-'.$special) ?>><?php $this->msg($special) ?></a></li>
  305. <?php }
  306. }
  307. if(!empty($this->data['nav_urls']['print']['href'])) { ?>
  308. <li id="t-print"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['print']['href'])
  309. ?>" rel="alternate"<?php echo Linker::tooltipAndAccesskeyAttribs('t-print') ?>><?php $this->msg('printableversion') ?></a></li><?php
  310. }
  311. if(!empty($this->data['nav_urls']['permalink']['href'])) { ?>
  312. <li id="t-permalink"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['permalink']['href'])
  313. ?>"<?php echo Linker::tooltipAndAccesskeyAttribs('t-permalink') ?>><?php $this->msg('permalink') ?></a></li><?php
  314. } elseif ($this->data['nav_urls']['permalink']['href'] === '') { ?>
  315. <li id="t-ispermalink"<?php echo Linker::tooltip('t-ispermalink') ?>><?php $this->msg('permalink') ?></li><?php
  316. }
  317. wfRunHooks( 'GCL3TemplateToolboxEnd', array( &$this ) );
  318. wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) );
  319. ?>
  320. </ul>
  321. </div>
  322. </div>
  323. <?php end_box(); ?>
  324. <?php
  325. }
  326. /*************************************************************************************************/
  327. function languageBox() {
  328. if( $this->data['language_urls'] ) {
  329. ?>
  330. <?php begin_box("Languages"); ?>
  331. <div id="p-lang" class="portlet">
  332. <div class="pBody">
  333. <ul>
  334. <?php foreach($this->data['language_urls'] as $langlink) { ?>
  335. <li class="<?php echo htmlspecialchars($langlink['class'])?>"><?php
  336. ?><a href="<?php echo htmlspecialchars($langlink['href']) ?>"><?php echo $langlink['text'] ?></a></li>
  337. <?php } ?>
  338. </ul>
  339. </div>
  340. </div>
  341. <?php end_box(); ?>
  342. <?php
  343. }
  344. }
  345. /*************************************************************************************************/
  346. function customBox( $bar, $cont ) {
  347. ?>
  348. <?php begin_box($bar); ?>
  349. <div class='generated-sidebar portlet' id='<?php echo Sanitizer::escapeId( "p-$bar" ) ?>'<?php echo Linker::tooltip('p-'.$bar) ?>>
  350. <div class='pBody'>
  351. <?php if ( is_array( $cont ) ) { ?>
  352. <ul>
  353. <?php foreach($cont as $key => $val) { ?>
  354. <li id="<?php echo Sanitizer::escapeId($val['id']) ?>"<?php
  355. if ( $val['active'] ) { ?> class="active" <?php }
  356. ?>><a href="<?php echo htmlspecialchars($val['href']) ?>"<?php echo Linker::tooltipAndAccesskeyAttribs($val['id']) ?>><?php echo htmlspecialchars($val['text']) ?></a></li>
  357. <?php } ?>
  358. </ul>
  359. <?php } else {
  360. # allow raw HTML block to be defined by extensions
  361. print $cont;
  362. }
  363. ?>
  364. </div>
  365. </div>
  366. <?php end_box(); ?>
  367. <?php
  368. }
  369. } // end of class
  370. function begin_box($title) {
  371. global $theme;
  372. echo <<<HERE
  373. <table cellspacing="1" cellpadding="4" border="0" width="100%" align="center" class="bordercolor">
  374. <tr>
  375. <td class="catbg"><strong>$title</strong></td>
  376. </tr>
  377. <tr>
  378. <td class="windowbg2">
  379. HERE;
  380. }
  381. function begin_box2($temp,$text,$sub="") {
  382. global $theme;
  383. echo <<<HERE
  384. <table cellspacing="1" cellpadding="4" border="0" width="100%" align="center" class="bordercolor">
  385. <tr>
  386. <td class="catbg"><strong>
  387. HERE;
  388. $temp->text($text);
  389. echo <<<HERE
  390. </strong></td>
  391. </tr>
  392. HERE;
  393. if($sub) echo '<tr><td class="titlebg">&nbsp;'.$sub.'</td></tr>';
  394. echo <<<HERE
  395. <tr>
  396. <td class="windowbg2">
  397. HERE;
  398. }
  399. function begin_box3($temp,$text,$sub="") {
  400. global $theme;
  401. echo <<<HERE
  402. <table cellspacing="1" cellpadding="4" border="0" width="100%" align="center" class="bordercolor">
  403. <tr>
  404. <td class="catbg"><strong>$text</strong></td>
  405. </tr>
  406. HERE;
  407. if($sub) echo '<tr><td class="titlebg">&nbsp;'.$sub.'</td></tr>';
  408. echo <<<HERE
  409. <tr>
  410. <td class="windowbg2">
  411. HERE;
  412. }
  413. function end_box() {
  414. echo <<<THERE
  415. </td></tr></table><br />
  416. THERE;
  417. }