// Can anyone can access this endpoint # Including our configuration require_once __DIR__ . '/_includes/config.php'; require_once __DIR__ . '/_includes/validate-app.php'; # Our return class $content = new stdClass(); $content->success = true; $content->env = PostParser::create_attribute($G_APP_ENVIRONMENT); $content->error_message = []; $content->replaced = []; $content->path = []; $content->url = []; $content->version = []; # Our target directory $G_PATH_DATA = parse_path($_CGET['dir'], $_ENDPOINT, $G_TOKEN_SESSION_DATA); $G_DIRECTORY_DATA = directory_hierarchy($G_STORAGE_CONTROLLER_DBLINK, $G_APP_DATA['id'], $G_APP_ENVIRONMENT, $G_PATH_DATA->absolute, $G_APP_DATA['file_auto_makedir'] == 1); # Getting our server where we are going to store the files $query = "\tSELECT\n\t\t\t\t*\n\t\t\tFROM\n\t\t\t\t" . NQ_SERVERS_TABLE . "\n\t\t\tWHERE\n\t\t\t\t`server_type`\t='file' AND\n\t\t\t\t`environment`\t='" . mysqli_escape_string($G_CONTROLLER_DBLINK, $G_APP_ENVIRONMENT) . "'\n\t\t\tORDER BY\n\t\t\t\t`tier` ASC,\n\t\t\t\t`available_space` DESC\n\t\t\tLIMIT 1"; $G_SERVER_DATA = mysqli_single_result_query($G_CONTROLLER_DBLINK, $query); # Combining our host properties into our path $G_SERVER_HOST = NQ_FILE_STORAGE_PROTOCOL . $G_SERVER_DATA['username'] . NQ_FILE_STORAGE_CRED_SEPARATOR . $G_SERVER_DATA['password'] . NQ_FILE_STORAGE_HOST_SEPARATOR . $G_SERVER_DATA['host'] . $G_SERVER_DATA['path']; # Tracking filesize changes $G_FILESIZE_ADDED = 0; # Looping through our files foreach ($_FILES as $file) { # Our names and tmp_name files $names = array(); $tmp_names = array(); $file_types = array(); # If we have an array or we don't we need to make it an array if (is_array($file['name'])) {
define('CACHEABLE', false); // Can this page be cached on the users browser define('PUBLIC_ENDPOINT', false); // Can anyone can access this endpoint define('INCLUDE_IMAGE_CLASS', false); // Are you going to be using the image class # Including our configuration require_once __DIR__ . '/_includes/config.php'; require_once __DIR__ . '/_includes/validate-app.php'; # Handling our global json parsing $_JPOST = PostParser::decode(); # Our return class $content = new stdClass(); # Creating our directory $G_PATH_DATA = parse_path($_JPOST->dir, $_ENDPOINT, $G_TOKEN_SESSION_DATA); $G_DIRECTORY_DATA = directory_hierarchy($G_STORAGE_CONTROLLER_DBLINK, $G_APP_DATA['id'], $G_APP_ENVIRONMENT, $G_PATH_DATA->absolute, true); # Our return values! $content->success = true; $content->env = PostParser::create_attribute($G_APP_ENVIRONMENT); $content->path = $G_PATH_DATA->urlpath; # How are we going to return our data PostParser::send($content); /* --- Connection closed wit PostParser::send --- Below this point things need to be tracked and cleaned up --- */ # Closing the storage connection mysqli_shared_close($G_STORAGE_CONTROLLER_DBLINK, $G_SHARED_DBLINKS); # Closing controller if tracking is different if (NQ_CONTROLLER_HOST != NQ_TRACKING_HOST) { mysqli_shared_close($G_CONTROLLER_DBLINK, $G_SHARED_DBLINKS); } # Adding our usage track_endpoint($G_SHARED_DBLINKS, $G_APP_DATA['id'], $G_APP_ENVIRONMENT, $_ENDPOINT);