示例#1
0
 protected function post_comment($r)
 {
     Input::ensureRequest($r, array("id"));
     $id = $r["id"];
     $posts = $this->jsonPost();
     Input::ensureRequest($posts, array("username", "mail", "content"));
     $comments = new CommentsModel();
     $comment = $comments->newRow();
     $comment->set(CommentsModel::POST_ID, $id);
     $comment->set(CommentsModel::USERNAME, $posts["username"]);
     $comment->set(CommentsModel::MAIL, $posts["mail"]);
     $comment->set(CommentsModel::CONTENT, $posts["content"]);
     $comment->save();
     $ret = $comment->getValues();
     $ret["gid"] = md5($ret[CommentsModel::MAIL]);
     unset($ret[CommentsModel::ID]);
     unset($ret[CommentsModel::POST_ID]);
     unset($ret[CommentsModel::MAIL]);
     Output::success($ret);
 }
示例#2
0
 public function parse()
 {
     $executor = StepExecutor::getInstance();
     $matches = array();
     while ($line = fgets($this->_file)) {
         $line = str_replace("\n", '', $line);
         if (preg_match(self::STEP_PATTERN, $line, $matches) == 1) {
             list($full, $step, $args) = $matches;
             try {
                 $result = $executor->call($step, $args);
                 if (S_SUCCESS === $result) {
                     Output::success($line);
                 } elseif (S_PENDING === $result) {
                     Output::pending($line);
                 }
             } catch (Exception $ex) {
                 Output::error($ex);
             }
         } else {
             Output::println($line);
         }
     }
 }
示例#3
0
<?php

include_once '/var/www/html/Lux/Core/Helper.php';
$DB = new Db("SocialNetwork");
$OUTPUT = new Output();
$collection = $DB->selectCollection("Notifications");
$REQUEST = new Request();
$RULES = new Rules(1, "social");
$permitted = array("subject", "body", "attachment", "attachment[]");
// to || thread
$update = Helper::updatePermitted($REQUEST, $permitted);
$update = Helper::subDocUpdate($update, "notification");
// insert a new notification
$update["to"] = $REQUEST->get("to");
$new = $collection->insert($update);
$OUTPUT->success(1, $new);
示例#4
0
<?php

// Helper functions and includes
include_once '/var/www/html/Lux/Core/Helper.php';
$OUTPUT = new Output();
$REQUEST = new Request();
$RULES = new Rules(1);
$DB = new Db("System");
$collection = $DB->selectCollection("Accounts");
// Send email verification if an email is provided
if ($REQUEST->avail("email")) {
    $eVC = bin2hex(openssl_random_pseudo_bytes(16));
    $query = array("system_info.access_token" => $REQUEST->get("access_token"));
    if ($REQUEST->avail("id")) {
        $RULES = new Rules(5, "accounts");
        $query = $REQUEST->get("id");
    }
    $collection->update($query, array('$set' => array("system_info.email" => $REQUEST->get("email"), "system_info.eVerified" => $eVC)), array('multiple' => false, 'upsert' => true));
    // Send Email
    $to = $REQUEST->get("email");
    $subject = 'Email Verification';
    $url = $_SERVER["HTTP_HOST"] . "/Lux/CAuth/eVerify/?email={$to}&eVC={$eVC}";
    $message = "Please click this link (or paste into browser) to verify email {$url}";
    $headers = 'From: no-reply@' . $_SERVER["HTTP_HOST"] . "\r\n" . 'X-Mailer: PHP/' . phpversion();
    mail($to, $subject, $message, $headers);
}
$OUTPUT->success(0, "Email Added to existing user");
示例#5
0
<?php

// Helper functions and includs
include_once '/var/www/html/Lux/Core/Helper.php';
$db = new Db("Inventory");
$OUTPUT = new Output();
$REQUEST = new Request();
$collection = $db->selectCollection("Cart");
$RULES = new Rules(1, "cart");
$REQUEST = new Request();
// get the asset, push it into the cart that is selected
$collectionName = $REQUEST->get("collection", "Standard");
$cartName = $REQUEST->get("wishlist", "Default");
$document = $collection->findAndModify(array("user_id" => $RULES->getId()), array('$push' => array("wishlist." . $cartName => MongoDBRef::create($collectionName, $REQUEST->get("id"), "Assets"))));
// Used for analytics
$LOG = new Logging("Cart.order");
$LOG->log($RULES->getId(), 43, $REQUEST->get("id"), 100, "User Wished for item");
$OUTPUT->success(0, $document, null);
示例#6
0
<?php

// Helper functions and includes
include_once '/var/www/html/Lux/Core/Helper.php';
$DB = new Db("System");
$collection = $DB->selectCollection("Accounts");
$OUTPUT = new Output();
$REQUEST = new Request();
// get Password and Username from $REQUEST
$document = $collection->findOne(array('$or' => array(array("system_info.user" => $REQUEST->get("user")), array("system_info.email" => $REQUEST->get("user")))));
if (password_verify($REQUEST->get("password"), $document["system_info"]["hash"])) {
    $lAT = bin2hex(openssl_random_pseudo_bytes(16));
    // save $lAT into database
    if ($REQUEST->avail("response_type") && $REQUEST->get("response_type") == "code") {
        $collection->update(array("_id" => $document["_id"]), array('$addToSet' => array("system_info.OAuth_clients" => array("client_id" => $REQUEST->get("client_id"), "code" => $lAT))), array('multiple' => false, 'upsert' => true));
        $OUTPUT->success(1, array("code" => $lAT));
        die;
    }
    $collection->update(array("_id" => $document["_id"]), array('$set' => array("system_info.access_token" => $lAT)), array('multiple' => false, 'upsert' => true));
    $OUTPUT->success(1, array("access_token" => $lAT, "user" => $document["system_info"]["user"]));
} else {
    $OUTPUT->error(0, "Incorrect Username or Password");
}
示例#7
0
 protected function get_cat()
 {
     $list = CategoriesModel::getList();
     Output::success(array("list" => $list));
 }
示例#8
0
 protected function doApiLogin($r)
 {
     Input::ensureRequest($_REQUEST, array("token"));
     if (($apiid = $this->apiLogin($_REQUEST["token"])) !== false) {
         Session::Set(self::apiid, $apiid);
         Session::addRight(self::logged_api);
         Output::success();
     }
     ErrorHandler::error(401);
 }
示例#9
0
<?php

include_once '/var/www/html/Lux/Core/Helper.php';
$DB = new Db("System");
$collection = $DB->selectCollection("Users");
$RULES = new Rules(1);
$OUTPUT = new Output();
$REQUEST = new Request();
$document = $collection->findOne(array('$or' => array(array("system_info.user" => $REQUEST->get("user")), array("system_info.email" => $REQUEST->get("user")))));
if (!is_null($document) && isset($document["system_info"]["email"])) {
    $password = bin2hex(openssl_random_pseudo_bytes(8));
    $hash = password_hash($password, PASSWORD_DEFAULT);
    $collection->update($document["_id"], array('$set' => array("system_info.hash" => $hash)));
    $to = $document["system_info"]["email"];
    $subject = 'Email Verification';
    $message = "A password reset link was sent to your email address. Your new password is {$password}";
    $headers = 'From: no-reply@' . $_SERVER["HTTP_HOST"] . "\r\n" . 'X-Mailer: PHP/' . phpversion();
    mail($to, $subject, $message, $headers);
    $OUTPUT->success(0, "Password Reset Email Sent");
} else {
    $OUTPUT->error(1, "Username/Email was not found in the system");
}
示例#10
0
<?php

// Helper fucntions and includes
include_once '/var/www/html/Lux/Core/Helper.php';
$DB = new Db("System");
$collection = $DB->selectCollection("Accounts");
$RULES = new Rules(1);
$OUTPUT = new Output();
$REQUEST = new Request();
$document = $collection->findOne(array("system_info.access_token" => $REQUEST->get("access_token")));
if (password_verify($REQUEST->get("password"), $document["system_info"]["hash"])) {
    $lAT = bin2hex(openssl_random_pseudo_bytes(16));
    $hash = password_hash($REQUEST->get("new_password"), PASSWORD_DEFAULT);
    if ($hash) {
        // save $lAT into database
        $collection->update(array("_id" => $document["_id"]), array('$set' => array("system_info.access_token" => $lAT, "system_info.hash" => $hash)), array('multiple' => false, 'upsert' => true));
        $OUTPUT->success(1, "Password Changed", array("access_token" => $lAT, "user" => $document["system_info"]["user"]));
    }
} else {
    $OUTPUT->error(0, "Incorrect Username or Password");
}
示例#11
0
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();
$RULES = new Rules(0, "session");
$collectionName = Helper::getCollectionName($REQUEST, "Session");
$collection = $DB->selectCollection($collectionName);
// Create new Session if none exists
if ($REQUEST->avail("sid")) {
    $SESSION = new Session($REQUEST->get("sid"));
} else {
    $SESSION = new Session();
}
// All values are accepted by the adjustment script
$permitted = array();
// Format Update and Options
$params = $REQUEST->getParameters();
unset($params["sid"]);
$update = Helper::udpatePermitted($REQUEST, $permitted);
$options = Helper::formatOptions($REQUEST);
// Add each variable to session
foreach ($params as $key => $value) {
    $SESSION->set($key, $value);
}
// Find and Modify Documents in Collection
$documents = $collection->findAndModify($query, $update, $options);
// Output
$OUTPUT->success(0, $SESSION->get(), $documents);
示例#12
0
<?php

include_once '/var/www/html/Lux/Core/Helper.php';
$DB = new Db("System");
$collection = $DB->selectCollection("Accounts");
$RULES = new Rules(1);
$OUTPUT = new Output();
$REQUEST = new Request();
if (!is_null($collection->findOne(array("system_info.access_token" => $REQUEST->get("access_token"), "system_info.eVerified" => true)))) {
    $OUTPUT->success(1, "Email is verified in the system");
} else {
    $OUTPUT->error(1, "Email is not verified");
}
示例#13
0
 protected function check($r)
 {
     Output::success(array("user" => null, "api" => null, "next" => Session::nextCheck()));
 }
示例#14
0
} else {
    $OUTPUT->error(2, "Service Could not be found");
}
$LF = new LuxFunctions();
$OUTPUT = new Output();
$DB = new Db("System");
$providers = $DB->selectCollection("providers");
$users = $DB->selectCollection("Users");
$provider_name = $LF->fetch_avail("provider");
$user = $users->findOne(array("lux_info.access_token" => $LF->fetch_avail("access_token")));
$access_token = $user["providers"][$provider_name]["access_token"];
$provider = $providers->findOne(array("provider_name" => $provider_name));
if (!$LF->is_avail("base")) {
    $base = $provider["base4"];
} else {
    $base = $LF->fetch_avail("base");
}
$params = $LF->getParameters();
unset($params["base"]);
unset($params["provider"]);
unset($params["path"]);
$params["access_token"] = $access_token;
$meDoc = json_decode(file_get_contents($base . $LF->fetch_avail("path") . "?" . http_build_query($params)), true);
if (is_null($meDoc) || isset($meDoc["error"])) {
    $meDoc = curl($base . $LF->fetch_avail("path"), $params, $access_token);
}
if (is_null($meDoc) || isset($meDoc["error"])) {
    $OUTPUT->error(1, "Unable to retrieve information from API", $meDoc);
}
$OUTPUT->success(1, $meDoc);
示例#15
0
        $apkupload_result = $service->edits_apks->upload($package, $transaction_id, $uploadData);
        Output::info("APK (url:{$_POST['apk']}) is added to the page");
        if (!empty($_POST['changes'])) {
            Output::info("Changes have been ommited for now");
            //            $listing = new Google_Service_AndroidPublisher_ApkListing();
            //            $listing->setRecentChanges($_POST['changes']);
            //            $listing->setLanguage($lang);
            //            Output::info("Changes has been updated to: ",$_POST['changes']);
            //            $result = $service->edits_apklistings->patch($package,$transaction_id,$apkupload_result->getVersionCode(), $lang,$listing);
        }
    } catch (Google_Service_Exception $e) {
        Output::error(sprintf("%s: %s: ERROR:", "APK Upload", $_POST['apk']), $e->getErrors());
    }
}
$result = $service->edits->commit($package, $transaction_id);
Output::success("Changes have been done");
/**
 * @param Google_Service_AndroidPublisher $service
 * @param $package string
 * @param $transaction_id int
 * @param $lang string
 * @param $type string
 * @param $url string
 * @return Google_Service_AndroidPublisher_ImagesUploadResponse|null
 */
function uploadNewImage(Google_Service_AndroidPublisher $service, $package, $transaction_id, $lang, $type, $url)
{
    $images = $service->edits_images->listEditsImages($package, $transaction_id, $lang, $type)->getImages();
    $sha1key = sha1_file($url);
    /* @var $images Google_Service_AndroidPublisher_ImagesListResponse */
    foreach ($images as $img) {
示例#16
0
$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 {
    $OUTPUT->success(1, $SESSION->get(), $documents);
}
?>

  
示例#17
0
 protected function get_user_count($r)
 {
     Input::ensureRequest($r, array("id"));
     $id = $r["id"];
     $cats = new UsersModel();
     $cat = $cats->getBy(UsersModel::USERNAME, $id);
     $col = Collection::Model($this->model);
     $col->whereEq(PostsModel::USER_ID, $cat->get("id"));
     $this->filterList($col);
     if (Input::has("q") && strlen(Input::get("q")) > 0) {
         $col->filter(Input::get("q"));
     }
     $count = $col->getCount();
     Output::success(array('count' => intVal($count), 'limit' => $this->options["limit"], 'pages' => ceil(intVal($count) / $this->options["limit"])));
 }
示例#18
0
$options = Helper::formatOptions($REQUEST);
// Get Old Document
$document_old = $collection->findOne($query);
// Used in Analytics
$LOG = new Logging("Accounts.adjust");
$LOG->log($RULES->getId(), 1, $RULES->getId(), 100, "User Modified Account");
// Find and Modify Documents in Collection
$results = $collection->findAndModify($query, $update, $options);
$document = $collection->findOne($query);
// Handle if an Admin is creating an account. Email is needed to notify Account Holder (with password).
if (is_null($document_old) && isset($document["system_info"]["email"])) {
    $password = bin2hex(openssl_random_pseudo_bytes(8));
    $hash = password_hash($password, PASSWORD_DEFAULT);
    // TODO: Change to $setOnInsert
    $collection->update($document["_id"], array('$set' => array("system_info.hash" => $hash)));
    // Send new Account holder an Email
    $user = $document["system_info"]["user"];
    $to = $document["system_info"]["email"];
    $subject = 'Email Verification';
    $message = "An account was created for you by an admistrator. Your user name is \n\n {$user} and password is \n\n {$password}";
    $headers = 'From: no-reply@' . $_SERVER["HTTP_HOST"] . "\r\n" . 'X-Mailer: PHP/' . phpversion();
    mail($to, $subject, $message, $headers);
    $OUTPUT->success(0, $document, $results);
} else {
    // if account exists
    // Shows an updated of information to the front-end
    $OUTPUT->success(0, $document, $results);
}
?>

示例#19
0
<?php

include_once '/var/www/html/Lux/Core/Helper.php';
$DB = new Db("System");
$collection = $DB->selectCollection("Accounts");
$OUTPUT = new Output();
$REQUEST = new Request();
if (is_null($collection->findOne(array("system_info.user" => $REQUEST->get("user"))))) {
    $OUTPUT->success(1, array("status" => "Username is free in the system"));
} else {
    $OUTPUT->error(1, "User exists with this Username");
}
示例#20
0
            echo '
			<br><br>
			Login Request POST Metod<br>
			Example parameters <br>
			email=adem.arass@gmail.com | password=123456<br>
			Url <br>
			http://basic-web-service.com/api/v1/api.php?request=login' . '<br>';
            exit;
            break;
        default:
            header('HTTP/1.1 405 Method Not Allowed');
            header('Allow: GET, PUT, DELETE');
            Output::error('Method not exist');
            break;
    }
    Output::success($data);
} else {
    header('HTTP/1.1 404 Not Found');
    Output::error('Method not exist');
}
/*
Examle Requests
Add user (api/v1/api.php?request=users)
{"name":"Adem","surname":"Aras","email":"*****@*****.**","phone":123456789,"password":123456}
User login (api/v1/api.php?request=login)
{"email":"*****@*****.**","password":123456}
User update (api/v1/api.php?request=users/2)
{"name":"Adem","surname":"Aras","email":"*****@*****.**","phone":123456789,"password":123456}
User get (api/v1/api.php?request=users/2)
User delete (api/v1/api.php?request=users/2)
*/
示例#21
0
<?php

include_once '/var/www/html/Lux/Core/Helper.php';
$DB = new Db("System");
$collection = $DB->selectCollection("Users");
$OUTPUT = new Output();
$REQUEST = new Request();
if ($REQUEST->avail("rule") && $REQUEST->avail("permissions")) {
    $RULES = new Rules($REQUEST->get("rule"), $REQUEST->get("permissions"));
} else {
    if ($REQUEST->avail("rule")) {
        $RULES = new Rules($REQUEST->get("rule"));
    } else {
        $RULES = new Rules(1);
    }
}
$OUTPUT->success(4, array("message" => "Access Permitted"));
示例#22
0
$collection = $DB->selectCollection("Accounts");
$OUTPUT = new Output();
$REQUEST = new Request();
// get Password and Username from $REQUEST
$hash = password_hash($REQUEST->get("password"), PASSWORD_DEFAULT);
if ($hash) {
    $lAT = bin2hex(openssl_random_pseudo_bytes(16));
    // save $lAT into database
    if ($REQUEST->avail("access_token")) {
        $collection->update(array("system_info.access_token" => $REQUEST->get("access_token")), array('$set' => array("system_info.access_token" => $lAT, "system_info.hash" => $hash, "system_info.user" => $REQUEST->get("user"))), array('multiple' => false, 'upsert' => true));
    } else {
        if (is_null($collection->findOne(array("system_info.user" => $REQUEST->get("user"))))) {
            $result = $collection->insert(array("system_info" => array("access_token" => $lAT, "hash" => $hash, "user" => $REQUEST->get("user"))));
        } else {
            $OUTPUT->error(1, "User exists with this Username");
        }
    }
    if ($REQUEST->avail("email")) {
        $eVC = bin2hex(openssl_random_pseudo_bytes(16));
        $collection->update(array("system_info.access_token" => $REQUEST->get("access_token")), array('$set' => array("system_info.email" => $REQUEST->get("email"), "system_info.eVerified" => $eVC)), array('multiple' => false, 'upsert' => true));
        $to = $REQUEST->get("email");
        $subject = 'Email Verification';
        $url = $_SERVER["HTTP_HOST"] . "/Lux/CAuth/eVerify/?email={$to}&eVC={$eVC}";
        $message = "Please click this link (or paste into browser) to verify email {$url}";
        $headers = 'From: no-reply@' . $_SERVER["HTTP_HOST"] . "\r\n" . 'X-Mailer: PHP/' . phpversion();
        mail($to, $subject, $message, $headers);
    }
    $OUTPUT->success(1, array("access_token" => $lAT, "user" => $REQUEST->get("user")));
} else {
    $OUTPUT->error(1, "Unable to save user/password");
}
示例#23
0
<?php

// Helper and includes
include_once '/var/www/html/Lux/Core/Helper.php';
$db = new Db("System");
$OUTPUT = new Output();
$collection = $db->selectCollection("Contact");
$REQUEST = new Request();
$query = array("email_id" => $REQUEST->get("email_id"));
$document = $collection->findOne($query);
// Send mail
$to = trim(implode(" , ", $document["address"]), ' , ');
$subject = $REQUEST->get("subject");
$message = $REQUEST->get("body");
$sender = $REQUEST->avail("sender") ? $REQUEST->get("sender") : ($document["sender"] ? $document["sender"] : "noreply@" . $_SERVER["HTTP_HOST"]);
$headers = 'From: ' . $sender . "\r\n" . 'Reply-To: ' . $sender . "\r\n" . 'X-Mailer: PHP/' . phpversion();
$result = mail($to, $subject, $message, $headers);
if ($result == 1) {
    $OUTPUT->success(0, null, null);
} else {
    $OUTPUT->error(2, "An Error occured in the mail function");
}
?>

  
示例#24
0
<?php

include_once '/var/www/html/Lux/Core/Helper.php';
$DB = new Db("SocialNetwork");
$OUTPUT = new Output();
$collection = $DB->selectCollection("Notifications");
$REQUEST = new Request();
$RULES = new Rules(1, "social");
$query = array("user_id" => $RULES->getId());
$update = array("status.seen" => 1);
$options = Helper::formatLimits($REQUEST);
$options["upsert"] = false;
$document = $collection->findAndModify($query, $update, $options);
$OUTPUT->success(0, $document);
?>

示例#25
0
<?php

include_once '/var/www/html/Lux/Core/Helper.php';
$DB = new Db("System");
$collection = $DB->selectCollection("Accounts");
$OUTPUT = new Output();
$REQUEST = new Request();
$db2 = new Db("Auth");
$OUTPUT = new Output();
$clients = $db2->selectCollection("Clients");
$client_id = $REQUEST->get("client_id");
$redirect_uri = $REQUEST->get("redirect_uri");
$client_secret = $REQUEST->get("client_secret");
$client_doc = $clients->findOne(array("client_id" => $client_id, "client_secret" => $client_secret, "redirect_uri" => array('$elemMatch' => array('$in' => array($redirect_uri)))));
// get Password and Username from $REQUEST
// /client_id	/redirect_uri	/client_secret	/code	/grant_type:authorization_code
if ($REQUEST->get("grant_type") != "authorization_code") {
    $OUTPUT->error(1, "Grant_type must equal authorization code in this context");
}
// find where there is a match
$uDoc = $collection->findOne(array('system_info.OAuth_clients' => array('$elemMatch' => array('$in' => array(array("client_id" => $REQUEST->get("client_id"), "code" => $REQUEST->get("code")))))));
if (is_null($uDoc)) {
    $OUTPUT->error(1, "This code is either invalid or has already been redeemed");
}
$lAT = bin2hex(openssl_random_pseudo_bytes(16));
$document = $collection->update(array('_id' => $uDoc["_id"]), array('$pull' => array('system_info.OAuth_clients' => array("client_id" => $REQUEST->get("client_id"), "code" => $REQUEST->get("code")))), array('multiple' => false, 'upsert' => true));
$document = $collection->update(array('_id' => $uDoc["_id"]), array('$addToSet' => array('system_info.OAuth_clients' => array("client_id" => $REQUEST->get("client_id"), "access_token" => $lAT))), array('multiple' => false, 'upsert' => true));
$OUTPUT->success(1, array("access_token" => $lAT));
die;
示例#26
0
<?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);
?>

  
示例#27
0
<?php

// Helpers and includes
include_once '/var/www/html/Lux/Core/Helper.php';
$FILES = new Files();
$REQUEST = new Request();
$OUTPUT = new Output();
if ($REQUEST->avail("admin") && $REQUEST->get("admin")) {
    $RULES = new Rules(5, "files");
    $structure = $FILES->ls($REQUEST, '/var/www/html' . $REQUEST->get("admin_base", "/"));
} else {
    $RULES = new Rules(0, "files");
    $structure = $FILES->ls($REQUEST, '/var/www/html/uploads/');
}
$OUTPUT->success(1, $structure);
?>