<?php define('ROOT', '../'); session_start(); require_once ROOT . '../private_html/config.php'; require_once ROOT . '../private_html/includes/database.php'; require_once ROOT . '../private_html/includes/func.php'; if (isset($_POST['submit'])) { $authorID = $_POST['author']; $pluginID = $_POST['plugin']; $email = trim($_POST['email']); $action = $_POST['submit']; $approved = $action == 'Accept'; // load the plugin $plugin = loadPluginByID($pluginID); if ($approved) { $statement = $master_db_handle->prepare('UPDATE AuthorACL SET Pending = 0 WHERE Author = ? AND Plugin = ?'); $statement->execute(array($authorID, $pluginID)); } else { $statement = $master_db_handle->prepare('DELETE FROM AuthorACL WHERE Author = ? and Plugin = ?'); $statement->execute(array($authorID, $pluginID)); } // both actions require the request to become fulfilled $statement = $master_db_handle->prepare('UPDATE PluginRequest SET Complete = 1 WHERE Author = ? and Plugin = ? AND Complete = 0'); $statement->execute(array($authorID, $pluginID)); // Should we send an email ? if (!empty($email)) { sendPluginRequestEmail($email, $plugin, $approved); } header('Location: /secure/plugin-requests.php'); exit;
/** * Load a plugin * * @param $plugin string The plugin's name * @return Plugin if it exists otherwise NULL */ function loadPlugin($plugin) { $statement = get_slave_db_handle()->prepare('SELECT ID, Parent, Name, Author, Hidden, GlobalHits, Created, Rank, LastRank, LastRankChange, LastUpdated, ServerCount30 FROM Plugin WHERE Name = :Name'); $statement->execute(array(':Name' => $plugin)); if ($row = $statement->fetch()) { $plugin = resolvePlugin($row); // check for parent if ($plugin->getParent() != -1) { $parent = loadPluginByID($plugin->getParent()); if ($parent != null) { return $parent; } } return $plugin; } return null; }
<?php define('ROOT', './'); session_start(); require_once ROOT . '../private_html/config.php'; require_once ROOT . '../private_html/includes/database.php'; require_once ROOT . '../private_html/includes/func.php'; /// Templating $page_title = 'MCStats :: Homepage'; $container_class = 'container'; send_header(); $plugin = loadPluginByID(GLOBAL_PLUGIN_ID); $graph = $plugin->getOrCreateGraph('Global Statistics'); $serverCount = number_format($plugin->getTimelineCustomLast($graph->getColumnID('Servers'), $graph)); $playerCount = number_format($plugin->getTimelineCustomLast($graph->getColumnID('Players'), $graph)); $statement = get_slave_db_handle()->prepare('SELECT COUNT(*) FROM Plugin where LastUpdated >= ?'); $statement->execute(array(normalizeTime() - SECONDS_IN_DAY)); $row = $statement->fetch(); $pluginCount = $row ? $row[0] : 0; echo <<<END <script type="text/javascript"> \$(document).ready(function() { \$("#players-popover").popover(); }); </script> <div class="row-fluid"> <div class="col-xs-12"> <h1 style="margin-bottom:10px; font-size:57px;">Glorious plugin stats!</h1>