コード例 #1
0
ファイル: donate.php プロジェクト: willies952002/mcstats.org
                MCStats serves over <span style="font-weight:bold; font-size: 20px;">550 requests per second</span> 24 hours a day, 7 days a week
            </p>
            <p style="font-size: 16px;">
                That is over <b><span style="font-size: 20px;">1.5 billion</span> requests per month</b> and over <b><span style="font-size: 20px;">50 million</span> requests each day</b> and it will only continue to rise.
            </p>
            <p>
                Every single server is tracked. To get useful data for plugins, every server needs to be identified and from there
                data is stored such as the plugins the server is using (that support MCStats), the amount of players online,
                and even the Minecraft version the server is on.
            </p>
            <p>
                This is no simple task. It requires a lot of power and it also needs room for growth. Right now the service
                is <b>entirely funded by myself, Hidendra</b>. MCStats has no sponsors or outside funding other than occasional donations.
            </p>';
// appeal to their plugins they have if they are logged in
if (is_loggedin() && ($pluginCount = count($plugins = get_accessible_plugins())) > 0) {
    // shuffle the plugins
    shuffle($plugins);
    // use the first one
    $plugin = $plugins[0];
    echo '
            <p>
                You have ' . $pluginCount . ' plugin' . ($pluginCount > 1 ? 's' : '') . ' that collect' . ($pluginCount > 1 ? '' : 's') . ' data using MCStats.
                Even if you only have one plugin, or a dozen, you have still helped MCStats in a tremendous way by helping
                it rise to where it is today. And I\'m sure this has also been mutual &mdash; this service has helped you
                see live, real world statistics about your plugin that download counters can\'t give you.
            </p>
        </div>
    </div>
</div>
<div class="row-fluid">
コード例 #2
0
ファイル: plugin.php プロジェクト: willies952002/mcstats.org
$plugin = loadPlugin(urldecode($_GET['plugin']));
// Doesn't exist
if ($plugin === null) {
    $page_title = 'MCStats :: Invalid Plugin';
    $breadcrumbs = '<a href="/" class="current">Invalid Plugin</a>';
    send_header();
    echo '<div class="alert alert-error" style="margin-top: 15px">Invalid plugin name provided!</div>';
    send_footer();
    exit;
}
// Get the plugin name
$pluginName = htmlentities($plugin->getName());
$encodedName = urlencode($pluginName);
// encoded name, for use in signature url
$more = '';
if (is_loggedin() && in_array($plugin, get_accessible_plugins(false))) {
    $more = '<li><a href="/admin/plugin/' . $encodedName . '/view">Edit in Admin Panel</a>';
}
/// Template hook
$page_title = 'MCStats :: ' . $pluginName;
$breadcrumbs = '<a href="/plugin/' . $encodedName . '" class="current">Plugin: ' . $pluginName . ' by ' . htmlentities($plugin->getAuthors()) . '</a>';
$sidebar_more = '
                <li class="submenu active open">
                    <a href="#"><i class="icon icon-star"></i> <span>Plugin: <strong>' . $pluginName . '</strong></span></a>
                    <ul>
                        ' . $more . '
                        <li><a>Added on: <strong>' . date('F d, Y', $plugin->getCreated()) . '</strong></a></li>
                        <li><a>Rank held for: <strong>' . epochToHumanString(time() - $plugin->getLastRankChange(), false) . '</strong></a></li>
                        <li><a>Global starts: <strong>' . number_format($plugin->getGlobalHits()) . '</strong></a></li>
                    </ul>
                </li>
コード例 #3
0
ファイル: header.php プロジェクト: willies952002/mcstats.org
<body>
<div id="header">
    <h1><a href="/">MCStats / Plugin Metrics</a></h1>
</div>

<div id="search">
    <form action="" method="post" onsubmit="window.location='/plugin/' + $('#goto').val(); return false;">
        <input type="text" id="goto" placeholder="Go to Plugin" autocomplete="off"/><button type="submit" class="tip-right" title="Go"><i class="icon-search"></i></button>
    </form>
</div>

<div id="user-nav">
    <?php 
if (is_loggedin()) {
    $accessible_plugins = get_accessible_plugins(false);
    $plugin_count = count($accessible_plugins);
    $plugins_html = '';
    foreach ($accessible_plugins as $plugin) {
        $safeName = htmlentities($plugin->getName());
        $plugins_html .= '<li><a href="/admin/plugin/' . $safeName . '/view">' . $safeName . '</a></li>';
    }
    if ($plugins_html == '') {
        $plugins_html = '<li><a href="#">No plugins</a></li>';
    }
    echo <<<END
            <ul class="btn-group">
                <li class="btn dropdown" id="menu-messages"><a href="#" data-toggle="dropdown" data-target="#menu-messages" class="dropdown-toggle"><i class="icon icon-envelope"></i> <span class="text">Plugins</span> <span class="label label-important">{$plugin_count}</span> <b class="caret"></b></a>
                    <ul class="dropdown-menu">
                        {$plugins_html}
                    </ul>
コード例 #4
0
ファイル: func.php プロジェクト: willies952002/mcstats.org
/**
 * Check if the given plugin can be accessed.
 *
 * @param $plugin Plugin or string
 * @return TRUE if the player can administrate the plugin
 */
function can_admin_plugin($plugin)
{
    if ($plugin instanceof Plugin) {
        $plugin_obj = $plugin;
    } else {
        if ($plugin instanceof string) {
            $plugin_obj = loadPlugin($plugin);
        }
    }
    // is it null??
    if ($plugin_obj == null) {
        return false;
    }
    // iterate through our accessible plugins
    foreach (get_accessible_plugins() as $a_plugin) {
        if ($a_plugin->getName() == $plugin_obj->getName()) {
            return $a_plugin->getPendingAccess() !== true;
        }
    }
    return false;
}
コード例 #5
0
require_once ROOT . '../private_html/includes/func.php';
ensure_loggedin();
// cacheCurrentPage();
$breadcrumbs = '<a href="/admin/">Administration</a> <a href="/admin/add-plugin/" class="current">Add Plugin</a>';
send_header();
if (isset($_POST['submit'])) {
    $pluginName = $_POST['pluginName'];
    $dbo = $_POST['dbo'];
    $email = $_POST['email'];
    $plugin = loadPlugin($pluginName);
    if ($plugin === null) {
        err('Invalid plugin.');
        send_add_plugin(htmlentities($pluginName), htmlentities($email), $dbo);
    } else {
        // check if they already have access to it
        $accessible = get_accessible_plugins();
        $hasPlugin = false;
        foreach ($accessible as $accessiblePlugin) {
            if ($plugin->getID() == $accessiblePlugin->getID()) {
                $hasPlugin = true;
                $plugin = $accessiblePlugin;
                break;
            }
        }
        // Check if it already has an acl
        $statement = get_slave_db_handle()->prepare('SELECT Author FROM AuthorACL WHERE Plugin = ? AND Pending = 0 LIMIT 1');
        $statement->execute(array($plugin->getID()));
        if ($statement->fetch()) {
            err('Someone already owns this plugin. It may be a duplicate plugin. If you are a secondary developer for this plugin email hidendra@mcstats.org or poke Hidendra in IRC.');
            send_add_plugin(htmlentities($plugin->getName()), htmlentities($email), $dbo);
        } else {