<?php
if( !defined( 'MEDIAWIKI' ) )
        die( -1 );
// TODO: Remove the hardcoded English to MediaWiki messages
// (that is, pages in the MediaWiki: namespace.)
require_once('skins/MonoBook.php');
class SkinOpenID extends SkinMonoBook {
        /** Using OpenID. */
        function initPage( &$out ) {
                SkinTemplate::initPage( $out );
                $this->skinname = 'openid';
                $this->stylename = 'openid';
                $this->template = 'OpenIDTemplate';
        }
}
class OpenIDTemplate extends MonoBookTemplate {
        function execute() {
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title><? $this->text('pagetitle') ?></title>
<link rel="stylesheet" type="text/css" href="http://www.openid.net/css/common.css" media="all" />
<link rel="stylesheet" type="text/css" href="http://www.openid.net/css/screen.css" media="screen" />
<link rel="stylesheet" type="text/css" href="http://www.openid.net/css/handheld.css" media="handheld" />
<link rel="stylesheet" type="text/css" href="http://www.openid.net/css/print.css" media="print" />
<? print Skin::makeGlobalVariablesScript( $this->data ); ?>
<?
        if (! empty($this->data['jsvarurl'])) {
                ?><script type="<? $this->text('jsmimetype') ?>" src="<? $this->text('jsvarurl') ?>"></script><?
        }
        
        if (! empty($this->data['pagecss'])) {
                ?><style type="text/css"><?php $this->html('pagecss') ?></style><?
        }
        if (! empty($this->data['usercss'])) {
                ?><style type="text/css"><?php $this->html('usercss') ?></style><?
        }
        
        $this->html('headscripts');
?>
</head>
<body<?
        if (isset($this->data['body_ondblclick'])) {
                ?> ondblclick="<? $this->text('body_ondblclick') ?>"<?
        }
        if (isset($this->data['body_onload'])) {
                ?> onload="<? $this->text('body_onload') ?>"<?
        }
?>>
<div id="container">
<div id="container2">
<h1>OpenID</h1>
<div id="container3">
<div id="main">
<h2><?php empty($this->data['displaytitle']) ? $this->text('title') : $this->html('title') ?></h2>
<? $this->html('bodytext'); ?>
</div>
<div id="sidebar">
<?
foreach ($this->data['sidebar'] as $bar => $cont) {
        $out = wfMsg($bar);
        
        ?><h2><?=wfEmptyMsg($bar, $out) ? $bar : $out?></h2><?
        ?><ul><?
        $this->linkList($cont);
        ?></ul><?
}
?>
</div>
<ul id="wikilinks">
<li><span class="wikilinksheader">This Page</span>
<ul>
<?
        $this->linkList($this->data['content_actions']);
?>
</ul>
</li>
<li><span class="wikilinksheader">You</span>
<ul>
<?
        $this->linkList($this->data['personal_urls']);
?>
</ul>
</li>
<?        if (! empty($this->data['language_urls'])) { ?>
<li><span class="wikilinksheader"><?=$this->msg('otherlanguages')?></span>
<ul>
<?
        $this->linkList($this->data['language_urls']);
?>
</ul>
</li>
<? } ?>
</ul>
<div id="foot">
</div>
</div>
</div>
</div>
</body>
</html>
<?
        
        }
        
        function linkList($list) {
                foreach ($list as $key => $val) {
                        $active = $val["href"] == $_SERVER["REQUEST_URI"] ? TRUE : FALSE;
                        ?><li<? if ($active) echo ' class="active"' ?>><a href="<?=htmlspecialchars($val["href"])?>"><?=htmlspecialchars($val["text"])?></a></li>
                        <?
                }
        
        }
}
?>