$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; } /// Templating $page_title = 'MCStats :: Secure'; send_header(); echo ' <div class="row" style="margin-left: 5%;"> <table class="table table-striped" style="width: 90%;"> <thead> <tr> <th> Author (ID) (# ACLs) </th> <th> Plugin (ID) (# ACLs) </th> <th> DBO </th>
$delta = $statement->fetch()['delta']; $auto_approved = false; if ($delta < 86400) { $auto_approved = true; } // Auto deny if they have too many plugins if (count($accessible) > 10) { $auto_approved = false; } if ($auto_approved) { $statement = $master_db_handle->prepare('INSERT INTO PluginRequest (Author, Plugin, Email, DBO, Created, Complete) VALUES (?, ?, ?, ?, UNIX_TIMESTAMP(), 1)'); $statement->execute(array($uid, $plugin->getID(), $email, $dbo)); $statement = $master_db_handle->prepare('INSERT INTO AuthorACL (Author, Plugin, Pending) VALUES (?, ?, 0)'); $statement->execute(array($uid, $plugin->getID())); if (!empty($email)) { sendPluginRequestEmail($email, $plugin, true); } } else { $statement = $master_db_handle->prepare('INSERT INTO PluginRequest (Author, Plugin, Email, DBO, Created, Complete) VALUES (?, ?, ?, ?, UNIX_TIMESTAMP(), 0)'); $statement->execute(array($uid, $plugin->getID(), $email, $dbo)); $statement = $master_db_handle->prepare('INSERT INTO AuthorACL (Author, Plugin, Pending) VALUES (?, ?, 1)'); $statement->execute(array($uid, $plugin->getID())); } success(sprintf('Successfully requested ownership of the plugin <b>%s</b>!', htmlentities($plugin->getName()))); } } } } } else { send_add_plugin(); }