function make_pretty_hyperlink($matches)
{
    $uri = new Url(implode('', array_slice($matches, 1)));
    $homeUri = new Url(FrontController::fc()->homeURL());
    $isExternal = $uri->host() !== $homeUri->host();
    if (!$isExternal) {
        $uri->setScheme()->setHost();
    }
    return generateHyperlinkHTML($uri, $isExternal ? array('class' => 'link-external') : NULL, 40);
}
 public function populateGraphTemplate(&$tpl)
 {
     if (!is_array($tpl)) {
         throw new Exception('Invalid template argument, array expected');
     }
     parent::populateGraphTemplate($tpl);
     $build = FrontController::fc()->findPlugin('BuildRepository')->buildByUniqueId($this->buildId);
     if ($build instanceof BuildEvent) {
         $tpl['build_startdate'] = date(DATE_ATOM, $build->startDate());
         $tpl['build_uniqueid'] = $this->buildId;
     }
 }
    /**
     * Implements Actioner.
     */
    public function execute($args = NULL)
    {
        $fc =& FrontController::fc();
        $fc->outputHeader($this->title(), 'masterserver');
        $fc->beginPage($this->title(), 'masterserver');
        ?>
<div id="contentbox"><div class="masterbrowser block"><?php 
        // Output a "join us" foreword.
        includeHTML('joinus', self::$name);
        try {
            FrontController::contentCache()->import(self::$serverSummaryCacheName);
            $this->outputJavascript();
        } catch (Exception $e) {
            ?>
<p>A master server listing is not presently available. Please try again later.</p><?php 
        }
        // Output footnotes.
        includeHTML('footnotes', self::$name);
        ?>
</div><?php 
        ?>
<div class="block"><section><p>A server admin is not required to publish their server to this central list (located at <em>http://dengine.net/master.php</em>), however it will then only be findable by clients who enter the IP address manually. A server may be published here but remain "closed" (requiring a password to join). Further information about the master server is available <a href="/dew/index.php?title=Master_server" title="Documentation for the master server">here</a>.</p></section></div><?php 
        ?>
</div><?php 
        $fc->endPage();
    }
Example #4
0
/** @file index.php Entrypoint script for dengine.net
 *
 * @authors Copyright © 2009-2013 Daniel Swanson <*****@*****.**>
 *
 * @par License
 * GPL: http://www.gnu.org/licenses/gpl.html
 *
 * <small>This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2 of the License, or (at your
 * option) any later version. This program is distributed in the hope that it
 * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
 * Public License for more details. You should have received a copy of the GNU
 * General Public License along with this program; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA</small>
 */
require_once 'classes/frontcontroller.class.php';
try {
    FrontController::fc()->interpretRequest();
} catch (Exception $e) {
    // Last chance handler for uncaught exceptions.
    ?>
<h1>Unhandled exception</h1>
<p><?php 
    echo htmlspecialchars($e->getMessage());
    ?>
</p><?php 
}
    /**
     * Implements Actioner.
     */
    public function execute($args = NULL)
    {
        $fc =& FrontController::fc();
        // The autobuilder operates in Eastern European Time.
        date_default_timezone_set('EET');
        if (isset($args['getpackage'])) {
            $this->outputPackageRedirect($args['getpackage']);
            return;
        } else {
            if (isset($args['getgraph'])) {
                $this->outputPackageGraph($args['getgraph']);
                return;
            }
        }
        // Determine whether we are detailing a single build event or listing all events.
        $build = isset($args['build']) ? $this->buildByUniqueId($args['build']) : NULL;
        $pageTitle = $build instanceof BuildEvent ? $build->composeName(true) : 'Build Repository';
        // Output this page.
        $fc->outputHeader($pageTitle);
        $fc->beginPage($pageTitle);
        ?>
<div id="contentbox"><?php 
        if ($build instanceof BuildEvent) {
            // Detailing a single build event.
            $this->outputEventDetail($build);
        } else {
            // Show the entire build event index.
            $this->outputEventIndex();
        }
        ?>
</div><?php 
        $fc->endPage();
    }
    /**
     * Implements Actioner.
     */
    public function execute($args = NULL)
    {
        $fc =& FrontController::fc();
        // Build the add-ons collection.
        $addonListXml = file_get_contents(nativePath("plugins/addonrepository/addons.xml"));
        $this->addons = array();
        AddonsParser::parse($addonListXml, $this->addons);
        // Sort the collection.
        uasort($this->addons, array('self', 'packageSorter'));
        // Output the page.
        $fc->outputHeader($this->title(), 'addons');
        $fc->beginPage($this->title(), 'addons');
        ?>
<div id="contentbox" class="addons"><?php 
        includeHTML('overview', self::$name);
        $this->outputFeaturedAddons();
        ?>
<div class="block"><article><h1>DOOM</h1>
<p>The following add-ons are for use with <a href="/doom" title="Tell me more about DOOM">DOOM</a> or a variant of it such as <strong>DOOM2</strong> and <strong>Final Doom: The Plutonia Experiment</strong>.</p>
<?php 
        $this->outputAddonList(self::$doomGameModes);
        ?>
</article></div><?php 
        ?>
<div class="block"><article><h1>Heretic</h1>
<p>The following add-ons are for use with <a href="/heretic" title="Tell me more about Heretic">Heretic</a> and the <strong>Shadow of the Serpent Riders</strong> expansion pack.</p>
<?php 
        $this->outputAddonList(self::$hereticGameModes);
        ?>
</article></div><?php 
        ?>
<div class="block"><article><h1>Hexen</h1>
<p>The following add-ons are for use with <a href="/hexen" title="Tell me more about Hexen">Hexen</a> and the <strong>Deathkings of the Dark Citadel</strong> expansion pack.</p>
<?php 
        $this->outputAddonList(self::$hexenGameModes);
        ?>
</article></div><?php 
        ?>
</div><?php 
        $fc->endPage();
    }
Example #7
0
    /**
     * Implements Actioner.
     */
    public function execute($args = NULL)
    {
        $fc =& FrontController::fc();
        if (!is_array($args) && !array_key_exists('page', $args)) {
            throw new Exception('Unexpected arguments passed.');
        }
        $page = $args['page'];
        $mainHeading = ucwords(mb_ereg_replace('_', ' ', $page));
        $pageFile = 'pages/' . $args['page'] . '.html';
        $fc->outputHeader($mainHeading);
        $fc->beginPage($mainHeading, $page);
        ?>
              <div id="contentbox"><?php 
        try {
            FrontController::contentCache()->import($pageFile);
        } catch (Exception $e) {
            ?>
                <p>No content for this page</p>
<?php 
        }
        ?>
              </div><?php 
        $fc->endPage();
    }
    /**
     * Implements Actioner.
     */
    public function execute($args = NULL)
    {
        $fc =& FrontController::fc();
        $fc->outputHeader($this->title());
        $fc->beginPage($this->title());
        ?>
<div id="example_page" style="padding: 1em;background-color: white;"><p>Hello World!</p></div><?php 
        $fc->endPage();
    }
    /**
     * Implements Actioner.
     */
    public function execute($args = NULL)
    {
        $fc =& FrontController::fc();
        $fc->outputHeader($this->title());
        $imgDir = '/images/screenshots';
        $doomImages = array(array('url' => $imgDir . "/doom/1.jpg", 'caption' => "Title1"), array('url' => $imgDir . "/doom/2.jpg", 'caption' => "Title2"), array('url' => $imgDir . "/doom/3.jpg", 'caption' => "Title3"), array('url' => $imgDir . "/doom/4.jpg", 'caption' => "Title4"), array('url' => $imgDir . "/doom/5.jpg", 'caption' => "Title5"), array('url' => $imgDir . "/doom/6.jpg", 'caption' => "Title6"), array('url' => $imgDir . "/doom/7.jpg", 'caption' => "Title7"));
        $this->generateJavascript($doomImages, 'doomCarousel');
        $hereticImages = array(array('url' => $imgDir . "/heretic/1.jpg", 'caption' => "Title1"), array('url' => $imgDir . "/heretic/2.jpg", 'caption' => "Title2"), array('url' => $imgDir . "/heretic/3.jpg", 'caption' => "Title3"), array('url' => $imgDir . "/heretic/4.jpg", 'caption' => "Title4"));
        $this->generateJavascript($hereticImages, 'hereticCarousel');
        $hexenImages = array(array('url' => $imgDir . "/hexen/1.jpg", 'caption' => "Title1"));
        $this->generateJavascript($hexenImages, 'hexenCarousel');
        $fc->beginPage($this->title());
        ?>
<div id="screenshots">
<script type="text/javascript">
tb_pathToImage = "/external/thickbox/loading-thickbox.gif";
</script>
<?php 
        $this->generateHTML('Doom', 'doomCarousel');
        $this->generateHTML('Heretic', 'hereticCarousel');
        $this->generateHTML('Hexen', 'hexenCarousel');
        ?>
</div><?php 
        $fc->endPage();
    }
Example #10
0
    public function execute($args = NULL)
    {
        $fc =& FrontController::fc();
        $fc->outputHeader();
        $fc->beginPage($this->title());
        includeHTML('latestversion', 'z#home');
        ?>
<div id="contentbox"><?php 
        //includeHTML('introduction', 'z#home');
        ?>
<script>
(function (e) {
    e.fn.interpretMasterServerStatus = function (t) {
        var n = {
            serverUri: "http://dengine.net/master.php?xml",
            maxItems: 3,
            generateServerSummaryHtml: 0
        };
        if (t) {
            e.extend(n, t);
        }
        var r = e(this).attr("id");
        e.ajax({
            url: n.serverUri,
            dataType: 'xml',
            success: function (t) {
                e("#" + r).empty();
                var root = $('masterserver', t);
                var serverList = root.find('serverlist')[0];
                var serverCount = serverList.attributes.getNamedItem('size').nodeValue;

                var d = new Date(root.find('channel>pubdate').text());
                var niceDate = $.datepicker.formatDate('MM d, yy', d);
                var minItems = serverCount < n.maxItems? serverCount : n.maxItems;

                var announceTime = d.toLocaleTimeString();

                var html = '<header>'
                         + '<h1><a href="/masterserver" title="View the complete list in the server browser">'
                         + (serverCount > 0? ('Most active servers '
                                              + '<label title="Result limit">' + minItems + '</label>/<label title="Total number of servers">' + serverCount + '</label>')
                                           : 'No active servers')
                         + '</a></h1>'
                         + '<p>' + niceDate + ' @ <label title="' + announceTime + ' (time of the last server announcement)">' + announceTime + '</label></p></header>';

                if(serverCount) {
                    var idx = 0;
                    var playerCount = 0;

                    html += '<ol class="servers">';
                    for(var i = 0; i < serverList.childNodes.length; ++i) {
                        if(serverList.childNodes[i].nodeName != 'server')
                            continue;

                        var server = $(serverList.childNodes[i]);
                        if(n.maxItems <= 0 || idx < n.maxItems)
                        {
                            html += '<li>' + n.generateServerSummaryHtml(n, server) + '</li>';
                        }

                        playerCount += Number(server.find('gameinfo>numplayers').text());
                        idx++;
                    };

                    html += '</ol>';
                    //html += '<span class="summary"><a href="/masterserver" title="See the full listing in the server browser">' + serverCount + ' ' + (serverCount == 1? 'server':'servers') + ' in total, ' + playerCount + ' active ' + (playerCount == 1? 'player':'players') + '</a></span>';
                }

                e("#" + r).append(html);
            }
        })
    }
})(jQuery)

$(document).ready(function () {
    $('#activeservers').interpretMasterServerStatus({
        generateServerSummaryHtml: function (n, info) {

            var name = info.find('name').text();
            var status = info.children('open').text() == 'yes'? 'open' : 'locked';

            var serverMetadataLabel = 'I.P address ' + info.children('ip').text() + ', port ' + info.children('port').text()
                                    + ', ' + status;

            // Any required addons?.
            /*var addonArr = array_filter(explode(';', info['pwads']));
            if(count(addonArr))
            {
                serverMetadataLabel .= 'Add-ons: '. implode(' ', addonArr);
            }*/

            var gameInfo = $(info.children('gameinfo'));
            var gameMode = gameInfo.children('mode').text();

            var mapId = gameInfo.children('map').text();
            if(mapId.substring(0, 3) == 'MAP')
            {
                mapId = 'map ' + mapId.substring(3);
            }
            else if(mapId.substring(0, 1) == 'E' && mapId.substring(2, 3) == 'M')
            {
                mapId = 'episode ' + mapId.substring(1, 2) + ', map ' + mapId.substring(3, 4);
            }
            else
            {
                mapId = 'map \'' + mapId + '\'';
            }

            var gameRules = gameInfo.children('setupstring').text().split(/[ ,]+/);

            for(var i=0; i < gameRules.length; i++)
            {
                if(gameRules[i] == 'dm')
                    gameRules[i] = 'deathmatch';
                else if(gameRules[i] == 'coop')
                    gameRules[i] = 'co-operative';
                else if(gameRules[i] == 'nomonst')
                    gameRules[i] = 'no monsters';
                else if(gameRules[i] == 'jump')
                    gameRules[i] = 'jump enabled';
            }

            var gameRuleStr = gameRules.join(', ');

            var gameMetadataLabel = 'Game; ' + gameMode + '. Server configuration; ' + mapId + ', game-rules; ' + gameRuleStr;

            var playerCount = gameInfo.children('numplayers').text();
            var playerMax   = gameInfo.children('maxplayers').text();

            var playerCountLabel = playerCount + ' players currently in-game';
            var playerMaxLabel = playerMax + ' player limit';

            var html = '<span class="player-summary"><label title="' + playerCountLabel + '">' + playerCount + '</label> / <label title="' + playerMaxLabel + '">' + playerMax + '</label></span> ';

            html += '<span class="name"><label title="Server name \'' + name + '\', ' + serverMetadataLabel + '">' + name + '</label></span> ';
            html += '<span class="game-mode"><label title="' + gameMetadataLabel + '.">' + gameMode + '</label></span>';

            return '<span class="server">' + html + '</span>';
        }
    });
});

(function (e) {
    e.fn.interpretFeed = function (t) {
        var n = { feedUri:          'http://rss.cnn.com/rss/edition.rss',
                  dataType:         'xml',
                  maxItems:         5,
                  clearOnSuccess:   true,
                  useGoogleApi:     false,
                  generateItemHtml: 0
        };
        if(t) {
            e.extend(n, t);
        }
        var r = e(this).attr('id');

        if(n.useGoogleApi)
        {
            e.ajax({
                url: 'http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=' + n.maxItems + '&output=json&q=' + encodeURIComponent(n.feedUri) + '&hl=en&callback=?',
                dataType: n.dataType,
                success: function (t) {

                    if(n.clearOnSuccess)
                    {
                        e("#" + r).empty();
                    }

                    var html = "";
                    e.each(t.responseData.feed.entries, function (e, t) {
                        html += n.generateItemHtml(n, t);
                    });
                    e("#" + r).append('<ol style="list-style-type: none;">' + html + "</ol>");
                }
            });
        }
        else
        {
            e.ajax({
                url: n.feedUri,
                dataType: n.dataType,
                success: function (t) {

                    if(n.clearOnSuccess)
                    {
                        e("#" + r).empty();
                    }

                    var xml = $(t);

                    var html = "";
                    xml.find('item').slice(0, n.maxItems).each(function() {
                        var self = $(this),
                        item = { title:       self.children('title').text(),
                                 link:        self.children('link').text(),
                                 author:      self.children('author').text(),
                                 pubDate:     self.children('pubDate').text(),
                                 atomSummary: self.children('atom\\:summary').text(),
                                 description: self.children('description').text(),
                                 author:      self.children('author').text()
                        }
                        html += n.generateItemHtml(n, item);
                    });

                    e('#' + r).append('<ol style="list-style-type: none;">' + html + '</ol>');
                }
            });
        }
    }
})(jQuery)

$(document).ready(function () {
    $('#recentbuilds').interpretFeed({
        feedUri: 'http://files.dengine.net/builds/events.rss',
        dataType: 'xml',
        maxItems: 3,
        generateItemHtml : function(n, t) {
            var html = '<a href="' + t.link + '" title="' + t.title.toLowerCase() + ' (read more in the repository)">' + t.title + ' completed</a>';
            var d = new Date(t.pubDate);
            var niceDate = $.datepicker.formatDate('MM d, yy', d);
            html += ' ' + niceDate;
            d.setDate(d.getDate() + 2);
            var isNew = (new Date() < d);
            return '<li' + (isNew? ' class="new"' : '') + '>' + html + '</li>';
        }
    });

    /*$('#column1').interpretFeed({
        feedUri: 'http://files.dengine.net/builds/events.rss',
        dataType: 'xml',
        maxItems: 3,
        clearOnSuccess: false,
        generateItemHtml: function (n, t) {
            var html = '<div class="block"><article class="buildevent"><header><h1><a href="' + t.link + '" title="Read more about ' + t.title + ' in the repository">' + t.title + '</a></h1>';

            var d = new Date(t.pubDate);
            var niceDate = $.datepicker.formatDate('MM d, yy', d);
            html += '<p><time datetime="' + d.toISOString() + '" pubdate>' + niceDate + '</time></p>';

            html += '</header><br />';
            html += t.atomSummary;
            html += '</article>';
            html += '<div class="links"><a href="' + n.feedUri + '" class="link-rss" title="Doomsday Engine build events are reported via RSS">All builds</a></div></div>';
            return '<li>' + html + '</li>';
        }
    });*/

    $('#column1').interpretFeed({
        feedUri: 'http://dengine.net/blog/category/news/feed',
        dataType: 'json',
        clearOnSuccess: false,
        useGoogleApi: true,
        maxItems: 1,
        generateItemHtml: function (n, t) {
            var html = '<div class="block"><article class="newspost content"><header><h1><a href="' + t.link + '" title="&#39;' + t.title + '&#39; (full article in the blog)">' + t.title + '</a></h1>';

            var d = new Date(t.publishedDate);
            var niceDate = $.datepicker.formatDate('MM d, yy', d);
            html += '<p><time datetime="' + d.toISOString() + '" pubdate>' + niceDate + '</time></p>';

            html += '</header><br />';
            html += '<div class="articlecontent">' + t.content + '</div>';
            html += '</article>';
            html += '<div class="links"><a href="' + n.feedUri + '" class="link-rss" title="Doomsday Engine news via RSS">All news</a></div></div>';
            return '<li>' + html + '</li>';
        }
    });

    $('#column2').interpretFeed({
        feedUri: 'http://dengine.net/blog/category/dev/feed', 
        dataType: 'json',
        clearOnSuccess: false,
        useGoogleApi: true,
        maxItems: 1,
        generateItemHtml: function (n, t) {
            var html = '<div class="block"><article class="blogpost content"><header><h1><a href="' + t.link + '" title="&#39;' + t.title + '&#39; (full article in the blog)">' + t.title + '</a></h1>';

            var d = new Date(t.publishedDate);
            var niceDate = $.datepicker.formatDate('MM d, yy', d);
            html += '<p><time datetime="' + d.toISOString() + '" pubdate>' + niceDate + '</time></p>';

            html += '</header><br />';
            html += '<div class="articlecontent">' + t.content + '</div>';
            html += '</article>';
            html += '<div class="links"><a href="' + n.feedUri + '" class="link-rss" title="Doomsday Engine development blog via RSS">All blogs</a></div></div>';
            return '<li>' + html + '</li>';
        }
    });
});
</script>
<aside role="complementary" class="block">
<div id="status">
<div class="twocolumn"><article>
<header><h1><a href="/builds" title="View the complete index in the build repository">Most recent builds</a></h1>
<p><script>
<!--
var niceDate = $.datepicker.formatDate('MM d, yy', new Date());
document.write(niceDate);
//-->
</script></p></header><div id="recentbuilds">Contacting build repository...</div></article></div>
<div class="twocolumn"><article id="activeservers"></article></div>
<div class="clear"></div>
</div></aside>
<div id="column1" class="twocolumn collapsible"></div>
<div id="column2" class="twocolumn collapsible"></div>
<div class="clear"></div>
</div>
<?php 
        ?>
<div><div id="downloadbox" class="asidebox"><?php 
        includeHTML('getitnow', 'z#home');
        ?>
</div><?php 
        ?>
<div id="socialbookmarkbox" class="asidebox"><?php 
        includeHTML('socialbookmarks', 'z#home');
        ?>
</div></div><?php 
        $fc->endPage();
    }