<?php /* Reformatted 12.11.2015 */ // Helpers and includes include_once '/var/www/html/Lux/Core/Helper.php'; // Create Database Connection $DB = new Db("Inventory"); $OUTPUT = new Output(); // Get Request Data $REQUEST = new Request(); // User needs to be logged in for access $RULES = new Rules(1, "cart"); // Select Collection from Connection $collectionName = Helper::getCollectionName($REQUEST, "Cart"); $collection = $DB->selectCollection($collectionName); // Format Query $query = array("user_id" => $RULES->getId()); // Used for anayltics $LOG = new Logging("OAuth.query"); $LOG->log($RULES->getId(), 72, $query, 100, "OAuth Providers Queried"); // Format Limits (Skip, Limit) $options = Helper::formatLimits($REQUEST); // Find Documents $documents = $collection->find($query, $options); // Output $OUTPUT->success(0, $documents); ?>
<?php /* Reformatted 12.11.2015 */ // helpers nad includes include_once '/var/www/html/Lux/Core/Helper.php'; // Create Database Connection $db = new Db("SocialNetwork"); $OUTPUT = new Output(); // Get Request Data $REQUEST = new Request(); // No privleges Required $RULES = new Rules(0, "profile"); // Selects collection from Database Connection $collectionName = Helper::getCollectionName($REQUEST, "Groups"); $collection = $db->selectCollection($collectionName); // Format Query $query = Helper::formatQuery($REQUEST, "group_id"); // Used for anayltics $LOG = new Logging("Groups.query"); $LOG->log($RULES->getId(), 72, $query, 100, "Groups Queried"); // Find Documents in Collection $documents = $collection->find($query); // Output $OUTPUT->success(1, $documents); ?>
<?php /* Reformatted 12.11.2015 */ // Helper and includes include_once '/var/www/html/Lux/Core/Helper.php'; // Create Database Connection $DB = new Db("System"); $OUTPUT = new Output(); // Get Request Variables $REQUEST = new Request(); // Admin Privleges needed $RULES = new Rules(5, "cms"); // Select Collection From Database Connection $collectionName = Helper::getCollectionName($REQUEST, "Content"); $collection = $DB->selectCollection($collectionName); // Format Query $query = Helper::formatQuery($REQUEST, "field_name"); // Values which are permitted by the Adjustment Script $permitted = array("field_name", "content.full", "content.short", "header.text", "header.sub", "header.url_safe", "picture.banner", "picture.other[]", "picture.slideshow[]"); // Format Update and options $update = Helper::updatePermitted($REQUEST, $permitted); $options = Helper::formatOptions($REQUEST); // Used for analytics $LOG = new Logging("CMS.adjust"); $LOG->log($RULES->getId(), 51, $query, 100, "Content Updated"); // Find And Modify Documents in Collection $document = $collection->findAndModify($query, $update, $options); // Output $OUTPUT->success(0, $document); ?>
<?php /* Reformatted 12.11.2015 */ // Helpers and inludes include_once '/var/www/html/Lux/Core/Helper.php'; // Create Database Connection $DB = new Db("SocialNetwork"); $OUTPUT = new Output(); // get Request Variables $REQUEST = new Request(); // Select Collection From Databse Connection $collectionName = Helper::getCollectionName($REQUEST, "Users"); $collection = $DB->selectCollection($collectionName); // Values which are accepted by the adjustment script $permitted = array("profile_name", "profile_picture", "bio", "images[]"); // Foramt Update and Options $update = Helper::updatePermitted($REQUEST, $permitted); $update = Helper::subDocUpdate($update, "providers.system"); $options = Helper::formatOptions($REQUEST); // Any profile can be changed by an admin, a normal user // can only change their own profile. if ($REQUEST->avail("id")) { $RULES = new Rules(5, "profile"); $document = $collection->findAndModify($REQUEST->get("id"), $update, $options); } else { $RULES = new Rules(1, "profile"); $document = $collection->findAndModify($RULES->getId(), $update, $options); } // Output $OUTPUT->success(0, $document, null);
<?php /* Reformatted 12.11.2015 */ // Helper functions adn includes include_once '/var/www/html/Lux/Core/Helper.php'; // Create Database Connection $DB = new Db("Auth"); $OUTPUT = new Output(); // Get Request Data $REQUEST = new Request(); // Admin Privleges required $RULES = new Rules(5, "providers"); // Selects Collection From Database Connection $collectionName = Helper::getCollectionName($REQUEST, "Providers"); $collection = $DB->selectCollection($collectionName); // provider name required for specific query (otherwise all will be returned) $query = Helper::formatQuery($REQUEST, "provider_name", null, array("protocol" => "OAuth2")); // Used for analytics $LOG = new Logging("Auth2.query"); $LOG->log($RULES->getId(), 112, $query, 100, "User viewed items in cart/wishlist"); // Find Documents in Collection $documents = $collection->find($query); // Output $OUTPUT->success(1, $documents);
<?php /* Reformatted 12.11.2015 */ // Helper script and includes include_once '/var/www/html/Lux/Core/Helper.php'; // Create Database Connection $DB = new Db("System"); $OUTPUT = new Output(); // Get Request Data $REQUEST = new Request(); // Admin privleges needed $RULES = new Rules(5, "accounts"); // Selects Collection from Databse Connection $collectionName = Helper::getCollectionName($REQUEST, "Accounts", false); $collection = $DB->selectCollection($collectionName); // Format Query $query = Helper::formatQuery($REQUEST, "user", "system_info.user"); // Used for Analytics $LOG = new Logging("Accounts.query"); $LOG->log($RULES->getId(), 2, $RULES->getId(), 100, "User Account Queried"); // Find Documents in Collection $documents = $collection->find($query); // Output $OUTPUT->success(0, $documents); ?>
<?php /* Reformatted 12.11.2015 */ // Helper script and include include_once '/var/www/html/Lux/Core/Helper.php'; // Create Database Connection $DB = new Db("System"); $OUTPUT = new Output(); // Get Request Data $REQUEST = new Request(); // No Privleges Needed $RULES = new Rules(0, "session"); // Selects Collection From Database Connection $collectionName = Helper::getCollectionName($REQUEST, "Sessions"); $collection = $DB->selectCollection($collectionName); // Format Query $query = Helper::formatQuery($REQUEST, "sid"); // Used for anayltics $LOG = new Logging("Session.query"); $LOG->log($RULES->getId(), 102, $query, 100, "Session Variable Queried"); // Find Documents in Collection $documents = $collection->find($query); // Only Available for Sessions: if ($REQUEST->avail("sid")) { $SESSION = new Session($REQUEST->get("sid")); } else { $SESSION = new Session(); } if ($REQUEST->avail("key")) { $OUTPUT->success(1, $SESSION->get($REQUEST->get("key")), $documents); } else {
<?php /* Reformatted 12.11.2015 */ // Helper script and includes include_once '/var/www/html/Lux/Core/Helper.php'; // Create Database Connection $DB = new Db("Auth"); $OUTPUT = new Output(); // Get Request Data $REQUEST = new Request(); // Admin Privleges Required $RULES = new Rules(5, "oauth"); // Selects Collection from Databse Connection $collectionName = Helper::getCollectionName($REQUEST, "Clients"); $collection = $DB->selectCollection($collectionName); // Format Query $query = Helper::formatQuery($REQUEST, "client_name"); // Used for anayltics $LOG = new Logging("OAuth.query"); $LOG->log($RULES->getId(), 72, $query, 100, "OAuth Providers Queried"); // Find Documents in Collection $documents = $collection->find($query); // Output $OUTPUT->success(0, $documents); ?>
<?php /* Reformatted 12.11.2015 */ // Helper function's and includes include_once '/var/www/html/Lux/Core/Helper.php'; // Create Database Connection $DB = new Db("Assets"); $OUTPUT = new Output(); // Get Request Variables $REQUEST = new Request(); // No privleges needed, Ownership rules apply $RULES = new Rules(0, "assets"); $OWNERSHIP = new Ownership($RULES); // Allows user to switch away from a standard collection $collectionName = Helper::getCollectionName($REQUEST, "Standard", true); $collection = $DB->selectCollection($collectionName); // Format Query $query = Helper::formatQuery($REQUEST); $query = $OWNERSHIP->adjust($collection, $query); // Values which are accepted by the Adjustment script $permitted = array(); // All values accepted // Format Update and Options $update = Helper::updatePermitted($REQUEST, $permitted); $options = Helper::formatOptions($REQUEST); // Used for Analytics $LOG = new Logging("Asset.adjust"); $LOG->log($RULES->getId(), 31, $query, 100, "User Modified Asset"); // Find and Modify documents in collection $documents = $collection->findAndModify($query, $update, $options); $documents = $OWNERSHIP->check($documents);