Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 368 lines (319 sloc) 16.72 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367
<?php
/**
* Based on MonoBook nouveau
*
* Authors: Milos Dinic <milos@mozilla-europe.org>
* Zbigniew Braniecki <gandalf@mozilla.com>
* @todo document
* @file
* @ingroup Skins
*/

if( !defined( 'MEDIAWIKI' ) )
    die( -1 );

/**
* Inherit main code from SkinTemplate, set the CSS and template filter.
* @todo document
* @ingroup Skins
*/
class SkinGMO extends SkinTemplate {
    function initPage( OutputPage $out ) {
        parent::initPage( $out );
        $this->skinname = 'gmo';
        $this->stylename = 'gmo';
        $this->template = 'GMOTemplate';

    }

    function setupSkinUserCss( OutputPage $out ) {
        global $wgHandheldStyle;

        parent::setupSkinUserCss( $out );

        // Append to the default screen common & print styles...
        $out->addStyle( 'gmo/style/screen.css', 'screen, projection' );
        $out->addStyle( 'gmo/style/enhanced.css', 'screen, projection' );
        $out->addStyle( 'gmo/style/mediawiki.css', 'screen, projection' );
        $out->addStyle( 'gmo/style/ie.css', 'screen, projection', 'gte IE 6');
    }
}

/**
* @todo document
* @ingroup Skins
*/
class GMOTemplate extends QuickTemplate {
    var $skin;
    var $stylepath;
    /**
* Template filter callback for MonoBook skin.
* Takes an associative array of data set from a SkinTemplate-based
* class, and a wrapper for MediaWiki's localization database, and
* outputs a formatted page.
*
* @access private
*/
    function execute() {
        global $wgRequest;
        $this->skin = $skin = $this->data['skin'];
        $this->action = $wgRequest->getText( 'action' );
        $this->stylepath = $this->data['stylepath'].'/'.$this->data['stylename'];
        
        // Suppress warnings to prevent notices about missing indexes in $this->data
        wfSuppressWarnings();
        $this->drawpage();
        wfRestoreWarnings();
    } // end of execute() method

    
    /*************************************************************************************************/
    function drawpage() {
     $this->doctype();
     $this->head();
        $this->header();
        $this->body();
        $this->footer();
    }

    /*************************************************************************************************/
    function doctype($html5=false) {
        if ($html5 == true) {
            print('<!DOCTYPE HTML><html xml:lang="'
                .$this->data['lang'].'" lang="'
                .$this->data['lang'].'" dir="'
                .$this->data['dir'].'">');
        } else {
            $doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"';
            $doctype .= ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
            $doctype .= '<html xmlns="'.$this->data['xhtmldefaultnamespace'].'"';
            foreach($this->data['xhtmlnamespaces'] as $tag => $ns) {
                $doctype .= 'xmlns:'.$tag.'="'.$ns.'" ';
            }
            $doctype .= ' xml:lang="'.$this->data['lang'].'" lang="'.$this->data['lang'].'" dir="'.$this->data['dir'].'">';
            print($doctype);
        }
    }
    
    /*************************************************************************************************/
    function head() {
?>
<head>
<meta http-equiv="Content-Type" content="<?php $this->text('mimetype') ?>; charset=<?php $this->text('charset') ?>" />
<?php $this->html('headlinks') ?>
<title><?php $this->text('pagetitle') ?></title>
<?php $this->html('csslinks') ?>

<link rel="stylesheet" type="text/css" media="print" href="<?php $this->text('stylepath') ?>/common/commonPrint.css" />
<?php print Skin::makeGlobalVariablesScript( $this->data ); ?>
<script type="text/javascript" src="<?php $this->text('stylepath' ) ?>/common/wikibits.js"></script>
<?php if($this->data['jsvarurl' ]) { ?><script type="text/javascript" src="<?php $this->text('jsvarurl' ) ?>"></script><?php } ?>
<?php if($this->data['pagecss']) { ?>
<style type="text/css"><?php $this->html('pagecss') ?></style>
<?php } ?>
<?php if($this->data['usercss' ]) { ?><style type="text/css"><?php $this->html('usercss' ) ?></style><?php } ?>
<?php if($this->data['userjs' ]) { ?><script type="text/javascript" src="<?php $this->text('userjs' ) ?>"></script><?php } ?>
<?php if($this->data['userjsprev']) { ?><script type="text/javascript"><?php $this->html('userjsprev') ?></script><?php } ?>
<?php $this->html('headscripts') ?>
<script src="/load.php?debug=false&amp;lang=en&amp;modules=startup&amp;only=scripts&amp;skin=gmo&amp;*"></script>
<script src="/load.php?debug=false&amp;lang=en&amp;modules=site&amp;only=scripts&amp;skin=gmo&amp;*"></script>
<script>if ( window.mediaWiki ) {

mediaWiki.loader.load(["mediawiki.util", "mediawiki.legacy.wikibits", "mediawiki.legacy.ajax", "ext.smw.sorttable"]);
mediaWiki.loader.go();
}
</script>
<script type="text/javascript"> if ( window.isMSIE55 ) fixalpha(); </script>
</head>
<?php
    }

    /*************************************************************************************************/
    function header() {
        global $wgStylePath;
    
?>
<body<?php if($this->data['body_ondblclick']) { ?> ondblclick="<?php $this->text('body_ondblclick') ?>"<?php } ?>
<?php if($this->data['body_onload']) { ?> onload="<?php $this->text('body_onload') ?>"<?php } ?>
class="mediawiki home <?php $this->text('dir') ?> <?php $this->text('pageclass') ?> <?php $this->text('skinnameclass') ?>">
<ul id="skip">
<li><a href="#q">Skip to Search</a></li>
<li><a href="#nav">Skip to Navigation</a></li>
<li><a href="#localnav">Skip to Sub Navigation</a></li>
<li><a href="#main">Skip to Content</a></li>
</ul>

<div id="header">
<h1 class="unitPng"><a href="/"><?=$GLOBALS['wgSitename'];?></a></h1>
<div id="header-contents">
<ul id="nav">
<?php foreach($this->data['content_actions'] as $key => $action) {
            ?><li id="ca-<?php echo htmlspecialchars($key) ?>"
<?php if($action['class']) { ?>class="<?php echo htmlspecialchars($action['class']) ?>"<?php } ?>
><a href="<?php echo htmlspecialchars($action['href']) ?>"><?php
                echo htmlspecialchars($action['text']) ?></a></li><?php
            } ?>
</ul>
<form action="<?php $this->text('searchaction') ?>" id="quick-search"><div>
<input id="q" name="search" type="text" />
<input type="image" id="quick-search-btn" alt="Search" src="<?=$wgStylePath?>/gmo/img/screen/template/search-submit.png">
</form>
</div>
</div>

</div>
</div>
<div id="main">
<?php
        }

        function body() {
            $title = $this->data['title'];
            $menu = $toc?True:False;

            if($this->data['sitenotice']) { ?><div id="siteNotice"><?php $this->html('sitenotice') ?></div><?php }
    ?>
<div id="wiki-tools">
<script type="<?php $this->text('jsmimetype') ?>"> if (window.isMSIE55) fixalpha(); </script>
<?php foreach ($this->data['sidebar'] as $bar => $cont) {
                if($bar=='navigation') { ?>
<div class='portlet' id='p-<?php echo htmlspecialchars($bar) ?>'>
<h2><?php $out = wfMsg( $bar ); if (wfEmptyMsg($bar, $out)) echo $bar; else echo $out; ?></h2>
<div class='pBody'>
<ul>
<?php foreach($cont as $key => $val) { ?>
<li id="<?php echo htmlspecialchars($val['id']) ?>"><a href="<?php echo htmlspecialchars($val['href']) ?>"><?php echo htmlspecialchars($val['text'])?></a></li>
<?php } ?>
</ul>
</div>
</div>
<div class="portlet" id="p-personal">
<h2><?php $this->msg('personaltools') ?></h2>
<div class="pBody">
<ul>
<?php foreach($this->data['personal_urls'] as $key => $item) {
                           ?><li id="pt-<?php echo htmlspecialchars($key) ?>"><a href="<?php
                           echo htmlspecialchars($item['href']) ?>"<?php
                           if(!empty($item['class'])) { ?> class="<?php
                           echo htmlspecialchars($item['class']) ?>"<?php } ?>><?php
                           echo htmlspecialchars($item['text']) ?></a></li><?php
                        } ?>
</ul>
</div>
</div>
<div class="portlet" id="p-tb">
<h2><?php $this->msg('toolbox') ?></h2>
<div class="pBody">
<ul>
<?php if($this->data['notspecialpage']) { foreach( array( 'whatlinkshere', 'recentchangeslinked' ) as $special ) { ?>
<li id="t-<?php echo $special?>"><a href="<?php
echo htmlspecialchars($this->data['nav_urls'][$special]['href'])
?>"><?php echo $this->msg($special) ?></a></li>
<?php } } ?>
<?php if($this->data['feeds']) { ?><li id="feedlinks"><?php foreach($this->data['feeds'] as $key => $feed) {
?><span id="feed-<?php echo htmlspecialchars($key) ?>"><a href="<?php
echo htmlspecialchars($feed['href']) ?>"><?php echo htmlspecialchars($feed['text'])?></a>&nbsp;</span>
<?php } ?></li><?php } ?>
<?php foreach( array('contributions', 'emailuser', 'upload', 'specialpages') as $special ) { ?>
<?php if($this->data['nav_urls'][$special]) {?><li id="t-<?php echo $special ?>"><a href="<?php
echo htmlspecialchars($this->data['nav_urls'][$special]['href'])
?>"><?php $this->msg($special) ?></a></li><?php } ?>
<?php }
wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) );
?>
</ul>
</div>
</div> <?php }} ?>
</div>
<div id="main-content"<?php if($menu)print(' class="with-menu"');?>>
<h1 id="page-title"><?php print($title);?></h1>
<div id="breadcrumbs">
<?php
                        if(isset($_SERVER['HTTPS'])) {
                            $protocol = 'https://';
                        } else {$protocol = 'http://';}
                    
                        $this->createBreadcrumbs($protocol); ?>
</div>
<h3 id="siteSub"><?php $this->msg('tagline') ?></h3>
<div id="contentSub"><?php $this->html('subtitle') ?></div>
<?php if($this->data['undelete']) { ?><div id="contentSub2"><?php $this->html('undelete') ?></div><?php } ?>
<?php if($this->data['newtalk'] ) { ?><div class="usermessage"><?php $this->html('newtalk') ?></div><?php } ?>
<?php if($this->data['showjumplinks']) { ?><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><?php } ?>
<!-- start content -->
<?php $this->html('bodytext') ?>
<?php if($this->data['catlinks']) { $this->html('catlinks'); } ?>
<!-- end content -->
<?php if($this->data['dataAfterContent']) { $this->html ('dataAfterContent'); } ?>
<div class="visualClear"></div>
</div>

<?php

        }

        /*************************************************************************************************/
        
        function footer() {
            global $wgStylePath;
    ?>
</div><!-- end #main -->
</div>
<div id="footer-wrap">
<div class="cols" id="footer">
<div class="six-col">
<a href="/" id="logo-footer"><img src="<?=$wgStylePath?>/gmo/img/screen/template/screen/logo_footer.png"></a>
</div>
<div class="col-span">
<?php if($this->data['copyrightico']) { ?><div id="f-copyrightico"><?php $this->html('copyrightico') ?></div><?php } ?>
<?php if($this->data['lastmod' ]) { ?><span id="f-lastmod"><?php $this->html('lastmod') ?></span><?php } ?>
<?php if($this->data['viewcount' ]) { ?><span id="f-viewcount"><?php $this->html('viewcount') ?> </span><?php } ?>
<ul id="f-list">
<?php if($this->data['credits' ]) { ?><li id="f-credits"><?php $this->html('credits') ?></li><?php } ?>
<?php if($this->data['copyright' ]) { ?><li id="f-copyright"><?php $this->html('copyright') ?></li><?php } ?>
<?php if($this->data['about' ]) { ?><li id="f-about"><?php $this->html('about') ?></li><?php } ?>
<?php if($this->data['disclaimer']) { ?><li id="f-disclaimer"><?php $this->html('disclaimer') ?></li><?php } ?>
<li><a href="http://www.mozilla.org/about/policies/privacy-policy.html">Privacy Policy</a></li>
</ul>
<?php if($this->data['poweredbyico']) { ?><div id="f-poweredbyico"><?php $this->html('poweredbyico') ?></div><?php } ?>
</div>
</div><!-- end #footer -->
</div>

<?php
    }
    
    /*************************************************************************************************/
    function menu($toc) {
?>
<div id="localnav">
<ul class="first">
<li class="first"><a href="http://www.mozilla.org/community/">Community</a>
<ul>
<li class="first"><a href="http://www.mozilla.org/community/blogs.html">Blogs and Feeds</a></li>
<li><a href="/community/chat.html">Chat Servers</a></li>

<li><a href="http://www.mozilla.org/community/events.html">Events and Parties</a></li>
<li><a href="http://www.mozilla.org/community/intl/">International Pages</a></li>
<li><a href="http://www.mozilla.org/community/developer-forums.html">Official Developer Forums</a></li>
<li><a href="http://www.mozilla.org/community/other-forums.html">Other Community Forums</a></li>
<li><a href="http://www.mozilla.org/community/social.html">Social Networking</a></li>
<li><a href="http://www.mozilla.org/community/websites.html">Websites</a></li>

<li><a href="http://www.mozilla.org/community/wikis.html">Wikis</a></li>
</ul>
</li>
</ul>
</div>
<?php
    }
    
    function createBreadcrumbs($protocol) {
        $str = $protocol.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
        $query = parse_url($str, PHP_URL_QUERY);
        parse_str($query, $search_params);
        
        $pieces = explode("/", $_SERVER['REQUEST_URI']);
        unset($pieces[0]); /* remove the first (empty item) from the array) */
        $last_piece = end($pieces); /* define a last item in the array */
        
        /* define url pieces we don't want displayed in breadcrumbs
breadcrumb parts will be made of url parts again made by exploding url with `slash`
when items in this array are inside breadrumb, we'll strip it and update breadcrumb
*/
        
        $unwanted = array(0 => 'index.php?title=', 1 => '&action=edit', 2 => '&redlink=1');
        
        /* create base url */
        
        $base_url = $protocol;
        $base_url .= $_SERVER['SERVER_NAME'];
        $base_url = htmlspecialchars($base_url, ENT_QUOTES);
        $item_url = $base_url;
        echo "<a href=\"" . $base_url . "\">Home</a>";
        foreach($pieces as $part) {
            /* check if there's unwanted url part */
            foreach($unwanted as $bogus_part) {
                $pos = strpos($part, $bogus_part);
                if($pos !== false) {
                    $part = str_replace($bogus_part, '', $part);
                }
            
            }
            $part = htmlspecialchars($part, ENT_QUOTES);
            $item_url .= "/" . $part;
            if(strpos($part, 'search=') !== false) {
                $item_url = html_entity_decode($item_url);
                $_params = htmlspecialchars($search_params['search'], ENT_QUOTES);
                echo "&nbsp;&raquo;&nbsp;<a href=\"$item_url\"> Search: " . $_params . "</a>";
            } else {
                $item_url = htmlspecialchars($item_url, ENT_QUOTES);
                echo "&nbsp;&raquo;&nbsp;<a href=\"$item_url\">" . $part . "</a>";
            }
            
        }
  
    
    }
    
} // end of class


Something went wrong with that request. Please try again.