/** * Get all of the plugins the currently logged in user can access * * @param $selectFromPendingPool If returned plugins can include plugins from the pending pool * @return array Plugin */ function get_accessible_plugins($selectFromPendingPool = true) { global $_SESSION, $master_db_handle; // The plugins we can access $plugins = array(); // Make sure they are plugged in if (!is_loggedin()) { return $plugins; } // Query for all of the plugins $statement = $master_db_handle->prepare('SELECT Plugin, ID, Name, Parent, Plugin.Author, Hidden, GlobalHits, Created, Pending, Rank, LastRank, LastRankChange, LastUpdated, ServerCount30 FROM AuthorACL LEFT OUTER JOIN Plugin ON Plugin.ID = Plugin WHERE AuthorACL.Author = ? ORDER BY Name ASC'); $statement->execute(array($_SESSION['uid'])); while ($row = $statement->fetch()) { if ($selectFromPendingPool == false && $row['Pending'] == 1) { continue; } $plugin = resolvePlugin($row); $plugin->setPendingAccess($row['Pending'] == 1); $plugins[] = $plugin; } return $plugins; }
-- Generic Email, DBO, PluginRequest.Created AS RequestCreated FROM PluginRequest LEFT OUTER JOIN Author on Author.ID = PluginRequest.Author LEFT OUTER JOIN Plugin ON Plugin.ID = PluginRequest.Plugin WHERE PluginRequest.Complete = 0 ORDER BY PluginRequest.Created ASC'); $statement->execute(); while ($row = $statement->fetch()) { $authorID = $row['AuthorID']; $authorName = $row['AuthorName']; $email = $row['Email']; $dbo = $row['DBO']; $created = $row['RequestCreated']; // resolve the plugin $plugin = resolvePlugin($row); if (strstr($dbo, 'http') !== false || strstr($dbo, 'com') !== false || strstr($dbo, 'org')) { $dbo_link = '<a href="' . htmlentities($dbo) . '" target="_blank">' . htmlentities($dbo) . '</a>'; } else { $dbo_link = htmlentities($dbo); } $authorsStatement = get_slave_db_handle()->prepare('SELECT COUNT(*) FROM AuthorACL WHERE Plugin = ? AND Pending = 0'); $authorsStatement->execute(array($plugin->getID())); $existingAuthors = $authorsStatement->fetch()[0]; $authorsStatement = get_slave_db_handle()->prepare('SELECT COUNT(*) FROM AuthorACL WHERE Author = ? AND Pending = 0'); $authorsStatement->execute(array($authorID)); $existingOwnedPlugins = $authorsStatement->fetch()[0]; echo ' <tr> <td> ' . htmlentities($authorName) . ' (' . $authorID . ') (' . $existingOwnedPlugins . ')