From 349e9f6dc7da0c44ee80d0a73963c1c5cef87131 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 26 Oct 2014 21:39:58 +0100 Subject: misc Signed-off-by: Florian Pritz --- application/controllers/api/v1.php | 83 -------------------------------------- 1 file changed, 83 deletions(-) delete mode 100644 application/controllers/api/v1.php (limited to 'application/controllers/api/v1.php') diff --git a/application/controllers/api/v1.php b/application/controllers/api/v1.php deleted file mode 100644 index e6d3c56fe..000000000 --- a/application/controllers/api/v1.php +++ /dev/null @@ -1,83 +0,0 @@ - - * - * Licensed under AGPLv3 - * (see COPYING for full license text) - * - */ -namespace controllers\api; - -class v1 extends api_controller { - protected $json_enabled_functions = array( - "upload", - "get_config", - "history", - ); - - static public function get_version() - { - return "1.0.1"; - } - - public function __construct() - { - parent::__construct(); - - $this->load->model('mfile'); - $this->load->model('mmultipaste'); - } - - public function upload() - { - $this->muser->require_access("basic"); - - $files = getNormalizedFILES(); - - if (empty($files)) { - show_error("No file was uploaded or unknown error occured."); - } - - $errors = service\files::verify_uploaded_files($files); - if (!empty($errors)) { - return send_json_reply($errors, "upload-error"); - } - - $limits = $this->muser->get_upload_id_limits(); - $urls = array(); - - foreach ($files as $file) { - $id = $this->mfile->new_id($limits[0], $limits[1]); - service\files::add_file($id, $file["tmp_name"], $file["name"]); - $ids[] = $id; - $urls[] = site_url($id).'/'; - } - - return send_json_reply(array( - "ids" => $ids, - "urls" => $urls, - )); - } - - public function get_config() - { - return send_json_reply(array( - "upload_max_size" => $this->config->item("upload_max_size"), - )); - } - - public function history() - { - $this->muser->require_access("apikey"); - $history = service\files::history($this->muser->get_userid()); - return send_json_reply($history); - } - - public function delete() - { - $this->muser->require_access("apikey"); - - - } -} -# vim: set noet: -- cgit v1.2.3-24-g4f1b