├── inc
├── common.inc.php
├── base60.inc.php
└── file.inc.php
├── cfg
└── config.inc.php.dist
├── www
├── put.php
└── index.php
├── README.md
└── LICENSE
/inc/common.inc.php:
--------------------------------------------------------------------------------
1 | __DIR__ . '/../www/files',
7 |
8 | // this is the address from which the uploaded
9 | // files will be available, you should use a
10 | // subdomain if you can, something like:
11 | //'upload_server' => 'https://files.example.com',
12 | // but if you can't, this will do:
13 | 'upload_server' => 'files',
14 |
15 | // max acceptable size, in bytes:
16 | 'max_size' => 50*1024*1024,
17 | ];
18 |
19 |
--------------------------------------------------------------------------------
/inc/base60.inc.php:
--------------------------------------------------------------------------------
1 | = $tobase) {
32 | $number[$newlen++] = (int)($divide / $tobase);
33 | $divide = $divide % $tobase;
34 | } elseif ($newlen > 0) {
35 | $number[$newlen++] = 0;
36 | }
37 | }
38 | $length = $newlen;
39 | $result = mb_substr($toalphabet, $divide, 1) . $result;
40 | } while ($newlen != 0);
41 |
42 | return $result;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/www/put.php:
--------------------------------------------------------------------------------
1 | $GLOBALS['config']['max_size']) {
8 | header("HTTP/1.0 413 Request Entity Too Large");
9 | echo "Upload size is limited to ".bytes_to_human($GLOBALS['config']['max_size'])."\n";
10 | die();
11 | }
12 |
13 | $file = new File();
14 |
15 | $directory = $GLOBALS['config']['upload_directory']."/".date("Y-m-d");
16 | $file->path = $file->create_name($directory, null);
17 |
18 | $fp = fopen($file->path, "w");
19 |
20 | while ($data = fread($putdata, 1024)) {
21 | fwrite($fp, $data);
22 |
23 | if (filesize($file->path) > $GLOBALS['config']['max_size']) {
24 | header("HTTP/1.0 413 Request Entity Too Large");
25 | echo "Upload size is limited to ".bytes_to_human($GLOBALS['config']['max_size'])."\n";
26 | fclose($fp);
27 | fclose($putdata);
28 | unlink($file->path);
29 | die();
30 | }
31 | }
32 |
33 | fclose($fp);
34 | fclose($putdata);
35 |
36 | $extension = $file->extension();
37 | $final_path = $file->create_name($directory, $extension);
38 |
39 | rename($file->path, $final_path);
40 | $file->path = $final_path;
41 |
42 | if (!empty($_REQUEST['clean-metadata'])) {
43 | $file->clean_metadata();
44 | }
45 |
46 | echo $file->url()."\n";
47 | }
48 |
49 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # jus - Just Upload Stuff
2 |
3 | jus is a file upload/sharing system made to be effective and simple both for its users and its
4 | admins, without requiring Javascript, databases, or relying on redirects or extra unnecessary hoops.
5 |
6 | Users can just upload one or multiple files, get a direct link to them and share it.
7 |
8 | Admins can just put the source wherever they want, configure the two or three options, and clean up the
9 | old files any way they like.
10 |
11 | ## Installation
12 |
13 | Source and configuration should ideally live outside your document root, but if you don't know what this
14 | means just put everything in your web directory.
15 |
16 | You can then rename the `www` directory to whatever you like, as well as the `index.php` file provided
17 | they stay at the same place relative to `inc/` and `cfg/`.
18 |
19 | Copy `cfg/config.inc.php.dist` to `cfg/config.inc.php` and tweak it (more on this later).
20 |
21 | #### PUT
22 |
23 | If you want to be able to use PUT queries to upload files with `curl`, you will have to set `put.php` as
24 | the PUT handler script for Apache (it can work with Nginx as well, but you will have to research it yourself).
25 | This means enabling `mod_actions` and adding `Script PUT /put.php` in your virtual host section.
26 |
27 | #### Free.fr
28 |
29 | If you're going to host this on Free.fr's free hosting, you should first put the following in a file
30 | named `.htaccess` in your web directory:
31 |
32 | ```
33 |
34 | php56 1
35 |
36 | ```
37 |
38 | ## Configuration
39 |
40 | Then you should probably change the configuration defaults:
41 |
42 | `upload_directory` is where the uploaded files with be saved. Use `__DIR__` to be sure to have a
43 | path relative to this config file. Ideally, this should be outside of the document root for jus.
44 |
45 | `upload_server` is the prefix that will be given to uploaded files. If you have a different virtual host
46 | for serving uploaded files, which I recommend in order to make sure nobody messes up with your jus
47 | by uploading Javascript or HTML which will get executed in the browser security context of the main site,
48 | then this option should have the name of this file serving virtual host. In my case, jus lives at `up.ÿ.fr`
49 | and my `upload_server` is `down.ÿ.fr`, configured to have `upload_directory` as its document root.
50 |
51 | `max_size` is the maximum size to accept for files. Don't forget to adjust your `php.ini` settings as well,
52 | relevant options are `post_max_size`, `upload_max_filesize` and `max_file_uploads`.
53 |
54 | ## Usage
55 |
56 | There are three different ways for a user to upload a file on jus.
57 |
58 | The most obvious is clicking the *Select your file* button, selecting one or more files, and clicking *Up*.
59 | Once the upload is finished, the links to the files are shown.
60 |
61 | If `PUT` is correctly configured on your server, another way is to type this from command-line:
62 | `curl -T https://url-to-jus`
63 |
64 | If it is not, curl can still upload easily enough using `POST`:
65 | `curl -F "file[]"=@ https://url-to-jus`
66 |
67 | When using `curl`, the output will just contain the paths to the upload files, one by line.
68 |
69 | ## Administration
70 |
71 | jus will put files in `upload_directory` under subdirectories, one for each day. So something uploaded
72 | on the 18th of August in 2017 would be in `files/2017-08-18`. If you want to limit the duration the files
73 | are available on your server, it should be easy enough to have a cron that every day removes the folder of
74 | today minus 30 days, or minus 365 or 12 000 days.
75 |
76 | Something like:
77 | `rm -rf "/path/to/jus/files/$(date --date='30 days ago' +'%Y-%m-%d')"`
78 | in your cron.
79 |
80 |
--------------------------------------------------------------------------------
/www/index.php:
--------------------------------------------------------------------------------
1 | move_uploaded_file($destination_directory)) {
25 | $uploaded_files[] = $file;
26 | } else {
27 | $errors['file'] = "Could not upload file.";
28 | }
29 | }
30 | } else if (!empty($_POST['url']) and preg_match("/https?:/", $_POST['url'])) {
31 | $file = new File();
32 |
33 | $directory = $GLOBALS['config']['upload_directory']."/".date("Y-m-d");
34 | $file->path = $file->create_name($directory, null);
35 | $putdata = fopen($_POST['url'], "r");
36 |
37 | $fp = fopen($file->path, "w");
38 | foreach ($http_response_header as $header) {
39 | if (strpos($header, ':') !== FALSE) {
40 | list($key, $value) = explode(':', $header, 2);
41 |
42 | if (strtolower(trim($key)) === 'content-length') {
43 | if ($value > $GLOBALS['config']['max_size']) {
44 | $file_size_human = bytes_to_human($value);
45 | $errors['url'] = "File larger than {$max_size_text} ({$file_size_human}).";
46 | }
47 | }
48 | }
49 | }
50 |
51 | if (!count($errors)) {
52 | $readsize = 1024;
53 | $size = 0;
54 | while ($data = fread($putdata, $readsize)) {
55 | $size += $readsize;
56 | fwrite($fp, $data);
57 |
58 | if ($size > $GLOBALS['config']['max_size']) {
59 | fclose($fp);
60 | fclose($putdata);
61 | unlink($file->path);
62 | $errors['url'] = "File larger than {$max_size_text}.";
63 | break;
64 | }
65 | }
66 | }
67 |
68 | if (!count($errors)) {
69 | fclose($fp);
70 | fclose($putdata);
71 |
72 | $extension = $file->extension();
73 | $final_path = $file->create_name($directory, $extension);
74 |
75 | rename($file->path, $final_path);
76 | $file->path = $final_path;
77 |
78 | $uploaded_files[] = $file;
79 | }
80 | }
81 |
82 | if (!empty($_REQUEST['clean-metadata'])) {
83 | foreach ($uploaded_files as $file) {
84 | $file->clean_metadata();
85 | }
86 | }
87 |
88 | if ($_SERVER['HTTP_ACCEPT'] == 'text/plain' or
89 | (count($uploaded_files) && strpos($_SERVER['HTTP_USER_AGENT'], 'curl/') === 0)) {
90 | foreach ($uploaded_files as $file) {
91 | echo $file->url()."\n";
92 | }
93 |
94 | die();
95 | }
96 |
97 | $errors_text = "";
98 |
99 | if (count($errors)) {
100 | $list_html = implode('
306 |
310 |
311 |
312 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 | {one line to give the program's name and a brief idea of what it does.}
635 | Copyright (C) {year} {name of author}
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | {project} Copyright (C) {year} {fullname}
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/inc/file.inc.php:
--------------------------------------------------------------------------------
1 | 'ez',
6 | 'application/applixware' => 'aw',
7 | 'application/atom+xml' => 'atom',
8 | 'application/atomcat+xml' => 'atomcat',
9 | 'application/atomsvc+xml' => 'atomsvc',
10 | 'application/ccxml+xml' => 'ccxml',
11 | 'application/cdmi-capability' => 'cdmia',
12 | 'application/cdmi-container' => 'cdmic',
13 | 'application/cdmi-domain' => 'cdmid',
14 | 'application/cdmi-object' => 'cdmio',
15 | 'application/cdmi-queue' => 'cdmiq',
16 | 'application/cu-seeme' => 'cu',
17 | 'application/davmount+xml' => 'davmount',
18 | 'application/docbook+xml' => 'dbk',
19 | 'application/dssc+der' => 'dssc',
20 | 'application/dssc+xml' => 'xdssc',
21 | 'application/ecmascript' => 'ecma',
22 | 'application/emma+xml' => 'emma',
23 | 'application/epub+zip' => 'epub',
24 | 'application/exi' => 'exi',
25 | 'application/font-tdpfr' => 'pfr',
26 | 'application/font-woff' => 'woff',
27 | 'application/gml+xml' => 'gml',
28 | 'application/gpx+xml' => 'gpx',
29 | 'application/gxf' => 'gxf',
30 | 'application/hyperstudio' => 'stk',
31 | 'application/inkml+xml' => 'ink',
32 | 'application/ipfix' => 'ipfix',
33 | 'application/java-archive' => 'jar',
34 | 'application/java-serialized-object' => 'ser',
35 | 'application/java-vm' => 'class',
36 | 'application/javascript' => 'js',
37 | 'application/json' => 'json',
38 | 'application/jsonml+json' => 'jsonml',
39 | 'application/lost+xml' => 'lostxml',
40 | 'application/mac-binhex40' => 'hqx',
41 | 'application/mac-compactpro' => 'cpt',
42 | 'application/mads+xml' => 'mads',
43 | 'application/marc' => 'mrc',
44 | 'application/marcxml+xml' => 'mrcx',
45 | 'application/mathematica' => 'ma',
46 | 'application/mathml+xml' => 'mathml',
47 | 'application/mbox' => 'mbox',
48 | 'application/mediaservercontrol+xml' => 'mscml',
49 | 'application/metalink+xml' => 'metalink',
50 | 'application/metalink4+xml' => 'meta4',
51 | 'application/mets+xml' => 'mets',
52 | 'application/mods+xml' => 'mods',
53 | 'application/mp21' => 'm21',
54 | 'application/mp4' => 'mp4s',
55 | 'application/msword' => 'doc',
56 | 'application/mxf' => 'mxf',
57 | 'application/octet-stream' => 'bin',
58 | 'application/oda' => 'oda',
59 | 'application/oebps-package+xml' => 'opf',
60 | 'application/ogg' => 'ogx',
61 | 'application/omdoc+xml' => 'omdoc',
62 | 'application/onenote' => 'onetoc',
63 | 'application/oxps' => 'oxps',
64 | 'application/patch-ops-error+xml' => 'xer',
65 | 'application/pdf' => 'pdf',
66 | 'application/pgp-encrypted' => 'pgp',
67 | 'application/pgp-signature' => 'asc',
68 | 'application/pics-rules' => 'prf',
69 | 'application/pkcs10' => 'p10',
70 | 'application/pkcs7-mime' => 'p7m',
71 | 'application/pkcs7-signature' => 'p7s',
72 | 'application/pkcs8' => 'p8',
73 | 'application/pkix-attr-cert' => 'ac',
74 | 'application/pkix-cert' => 'cer',
75 | 'application/pkix-crl' => 'crl',
76 | 'application/pkix-pkipath' => 'pkipath',
77 | 'application/pkixcmp' => 'pki',
78 | 'application/pls+xml' => 'pls',
79 | 'application/postscript' => 'ai',
80 | 'application/prs.cww' => 'cww',
81 | 'application/pskc+xml' => 'pskcxml',
82 | 'application/rdf+xml' => 'rdf',
83 | 'application/reginfo+xml' => 'rif',
84 | 'application/relax-ng-compact-syntax' => 'rnc',
85 | 'application/resource-lists+xml' => 'rl',
86 | 'application/resource-lists-diff+xml' => 'rld',
87 | 'application/rls-services+xml' => 'rs',
88 | 'application/rpki-ghostbusters' => 'gbr',
89 | 'application/rpki-manifest' => 'mft',
90 | 'application/rpki-roa' => 'roa',
91 | 'application/rsd+xml' => 'rsd',
92 | 'application/rss+xml' => 'rss',
93 | 'application/rtf' => 'rtf',
94 | 'application/sbml+xml' => 'sbml',
95 | 'application/scvp-cv-request' => 'scq',
96 | 'application/scvp-cv-response' => 'scs',
97 | 'application/scvp-vp-request' => 'spq',
98 | 'application/scvp-vp-response' => 'spp',
99 | 'application/sdp' => 'sdp',
100 | 'application/set-payment-initiation' => 'setpay',
101 | 'application/set-registration-initiation' => 'setreg',
102 | 'application/shf+xml' => 'shf',
103 | 'application/smil+xml' => 'smi',
104 | 'application/sparql-query' => 'rq',
105 | 'application/sparql-results+xml' => 'srx',
106 | 'application/srgs' => 'gram',
107 | 'application/srgs+xml' => 'grxml',
108 | 'application/sru+xml' => 'sru',
109 | 'application/ssdl+xml' => 'ssdl',
110 | 'application/ssml+xml' => 'ssml',
111 | 'application/tei+xml' => 'tei',
112 | 'application/thraud+xml' => 'tfi',
113 | 'application/timestamped-data' => 'tsd',
114 | 'application/vnd.3gpp.pic-bw-large' => 'plb',
115 | 'application/vnd.3gpp.pic-bw-small' => 'psb',
116 | 'application/vnd.3gpp.pic-bw-var' => 'pvb',
117 | 'application/vnd.3gpp2.tcap' => 'tcap',
118 | 'application/vnd.3m.post-it-notes' => 'pwn',
119 | 'application/vnd.accpac.simply.aso' => 'aso',
120 | 'application/vnd.accpac.simply.imp' => 'imp',
121 | 'application/vnd.acucobol' => 'acu',
122 | 'application/vnd.acucorp' => 'atc',
123 | 'application/vnd.adobe.air-application-installer-package+zip' => 'air',
124 | 'application/vnd.adobe.formscentral.fcdt' => 'fcdt',
125 | 'application/vnd.adobe.fxp' => 'fxp',
126 | 'application/vnd.adobe.xdp+xml' => 'xdp',
127 | 'application/vnd.adobe.xfdf' => 'xfdf',
128 | 'application/vnd.ahead.space' => 'ahead',
129 | 'application/vnd.airzip.filesecure.azf' => 'azf',
130 | 'application/vnd.airzip.filesecure.azs' => 'azs',
131 | 'application/vnd.amazon.ebook' => 'azw',
132 | 'application/vnd.americandynamics.acc' => 'acc',
133 | 'application/vnd.amiga.ami' => 'ami',
134 | 'application/vnd.android.package-archive' => 'apk',
135 | 'application/vnd.anser-web-certificate-issue-initiation' => 'cii',
136 | 'application/vnd.anser-web-funds-transfer-initiation' => 'fti',
137 | 'application/vnd.antix.game-component' => 'atx',
138 | 'application/vnd.apple.installer+xml' => 'mpkg',
139 | 'application/vnd.apple.mpegurl' => 'm3u8',
140 | 'application/vnd.aristanetworks.swi' => 'swi',
141 | 'application/vnd.astraea-software.iota' => 'iota',
142 | 'application/vnd.audiograph' => 'aep',
143 | 'application/vnd.blueice.multipass' => 'mpm',
144 | 'application/vnd.bmi' => 'bmi',
145 | 'application/vnd.businessobjects' => 'rep',
146 | 'application/vnd.chemdraw+xml' => 'cdxml',
147 | 'application/vnd.chipnuts.karaoke-mmd' => 'mmd',
148 | 'application/vnd.cinderella' => 'cdy',
149 | 'application/vnd.claymore' => 'cla',
150 | 'application/vnd.cloanto.rp9' => 'rp9',
151 | 'application/vnd.clonk.c4group' => 'c4g',
152 | 'application/vnd.cluetrust.cartomobile-config' => 'c11amc',
153 | 'application/vnd.cluetrust.cartomobile-config-pkg' => 'c11amz',
154 | 'application/vnd.commonspace' => 'csp',
155 | 'application/vnd.contact.cmsg' => 'cdbcmsg',
156 | 'application/vnd.cosmocaller' => 'cmc',
157 | 'application/vnd.crick.clicker' => 'clkx',
158 | 'application/vnd.crick.clicker.keyboard' => 'clkk',
159 | 'application/vnd.crick.clicker.palette' => 'clkp',
160 | 'application/vnd.crick.clicker.template' => 'clkt',
161 | 'application/vnd.crick.clicker.wordbank' => 'clkw',
162 | 'application/vnd.criticaltools.wbs+xml' => 'wbs',
163 | 'application/vnd.ctc-posml' => 'pml',
164 | 'application/vnd.cups-ppd' => 'ppd',
165 | 'application/vnd.curl.car' => 'car',
166 | 'application/vnd.curl.pcurl' => 'pcurl',
167 | 'application/vnd.dart' => 'dart',
168 | 'application/vnd.data-vision.rdz' => 'rdz',
169 | 'application/vnd.dece.data' => 'uvf',
170 | 'application/vnd.dece.ttml+xml' => 'uvt',
171 | 'application/vnd.dece.unspecified' => 'uvx',
172 | 'application/vnd.dece.zip' => 'uvz',
173 | 'application/vnd.denovo.fcselayout-link' => 'fe_launch',
174 | 'application/vnd.dna' => 'dna',
175 | 'application/vnd.dolby.mlp' => 'mlp',
176 | 'application/vnd.dpgraph' => 'dpg',
177 | 'application/vnd.dreamfactory' => 'dfac',
178 | 'application/vnd.ds-keypoint' => 'kpxx',
179 | 'application/vnd.dvb.ait' => 'ait',
180 | 'application/vnd.dvb.service' => 'svc',
181 | 'application/vnd.dynageo' => 'geo',
182 | 'application/vnd.ecowin.chart' => 'mag',
183 | 'application/vnd.enliven' => 'nml',
184 | 'application/vnd.epson.esf' => 'esf',
185 | 'application/vnd.epson.msf' => 'msf',
186 | 'application/vnd.epson.quickanime' => 'qam',
187 | 'application/vnd.epson.salt' => 'slt',
188 | 'application/vnd.epson.ssf' => 'ssf',
189 | 'application/vnd.eszigno3+xml' => 'es3',
190 | 'application/vnd.ezpix-album' => 'ez2',
191 | 'application/vnd.ezpix-package' => 'ez3',
192 | 'application/vnd.fdf' => 'fdf',
193 | 'application/vnd.fdsn.mseed' => 'mseed',
194 | 'application/vnd.fdsn.seed' => 'seed',
195 | 'application/vnd.flographit' => 'gph',
196 | 'application/vnd.fluxtime.clip' => 'ftc',
197 | 'application/vnd.framemaker' => 'fm',
198 | 'application/vnd.frogans.fnc' => 'fnc',
199 | 'application/vnd.frogans.ltf' => 'ltf',
200 | 'application/vnd.fsc.weblaunch' => 'fsc',
201 | 'application/vnd.fujitsu.oasys' => 'oas',
202 | 'application/vnd.fujitsu.oasys2' => 'oa2',
203 | 'application/vnd.fujitsu.oasys3' => 'oa3',
204 | 'application/vnd.fujitsu.oasysgp' => 'fg5',
205 | 'application/vnd.fujitsu.oasysprs' => 'bh2',
206 | 'application/vnd.fujixerox.ddd' => 'ddd',
207 | 'application/vnd.fujixerox.docuworks' => 'xdw',
208 | 'application/vnd.fujixerox.docuworks.binder' => 'xbd',
209 | 'application/vnd.fuzzysheet' => 'fzs',
210 | 'application/vnd.genomatix.tuxedo' => 'txd',
211 | 'application/vnd.geogebra.file' => 'ggb',
212 | 'application/vnd.geogebra.tool' => 'ggt',
213 | 'application/vnd.geometry-explorer' => 'gex',
214 | 'application/vnd.geonext' => 'gxt',
215 | 'application/vnd.geoplan' => 'g2w',
216 | 'application/vnd.geospace' => 'g3w',
217 | 'application/vnd.gmx' => 'gmx',
218 | 'application/vnd.google-earth.kml+xml' => 'kml',
219 | 'application/vnd.google-earth.kmz' => 'kmz',
220 | 'application/vnd.grafeq' => 'gqf',
221 | 'application/vnd.groove-account' => 'gac',
222 | 'application/vnd.groove-help' => 'ghf',
223 | 'application/vnd.groove-identity-message' => 'gim',
224 | 'application/vnd.groove-injector' => 'grv',
225 | 'application/vnd.groove-tool-message' => 'gtm',
226 | 'application/vnd.groove-tool-template' => 'tpl',
227 | 'application/vnd.groove-vcard' => 'vcg',
228 | 'application/vnd.hal+xml' => 'hal',
229 | 'application/vnd.handheld-entertainment+xml' => 'zmm',
230 | 'application/vnd.hbci' => 'hbci',
231 | 'application/vnd.hhe.lesson-player' => 'les',
232 | 'application/vnd.hp-hpgl' => 'hpgl',
233 | 'application/vnd.hp-hpid' => 'hpid',
234 | 'application/vnd.hp-hps' => 'hps',
235 | 'application/vnd.hp-jlyt' => 'jlt',
236 | 'application/vnd.hp-pcl' => 'pcl',
237 | 'application/vnd.hp-pclxl' => 'pclxl',
238 | 'application/vnd.hydrostatix.sof-data' => 'sfd-hdstx',
239 | 'application/vnd.ibm.minipay' => 'mpy',
240 | 'application/vnd.ibm.modcap' => 'afp',
241 | 'application/vnd.ibm.rights-management' => 'irm',
242 | 'application/vnd.ibm.secure-container' => 'sc',
243 | 'application/vnd.iccprofile' => 'icc',
244 | 'application/vnd.igloader' => 'igl',
245 | 'application/vnd.immervision-ivp' => 'ivp',
246 | 'application/vnd.immervision-ivu' => 'ivu',
247 | 'application/vnd.insors.igm' => 'igm',
248 | 'application/vnd.intercon.formnet' => 'xpw',
249 | 'application/vnd.intergeo' => 'i2g',
250 | 'application/vnd.intu.qbo' => 'qbo',
251 | 'application/vnd.intu.qfx' => 'qfx',
252 | 'application/vnd.ipunplugged.rcprofile' => 'rcprofile',
253 | 'application/vnd.irepository.package+xml' => 'irp',
254 | 'application/vnd.is-xpr' => 'xpr',
255 | 'application/vnd.isac.fcs' => 'fcs',
256 | 'application/vnd.jam' => 'jam',
257 | 'application/vnd.jcp.javame.midlet-rms' => 'rms',
258 | 'application/vnd.jisp' => 'jisp',
259 | 'application/vnd.joost.joda-archive' => 'joda',
260 | 'application/vnd.kahootz' => 'ktz',
261 | 'application/vnd.kde.karbon' => 'karbon',
262 | 'application/vnd.kde.kchart' => 'chrt',
263 | 'application/vnd.kde.kformula' => 'kfo',
264 | 'application/vnd.kde.kivio' => 'flw',
265 | 'application/vnd.kde.kontour' => 'kon',
266 | 'application/vnd.kde.kpresenter' => 'kpr',
267 | 'application/vnd.kde.kspread' => 'ksp',
268 | 'application/vnd.kde.kword' => 'kwd',
269 | 'application/vnd.kenameaapp' => 'htke',
270 | 'application/vnd.kidspiration' => 'kia',
271 | 'application/vnd.kinar' => 'kne',
272 | 'application/vnd.koan' => 'skp',
273 | 'application/vnd.kodak-descriptor' => 'sse',
274 | 'application/vnd.las.las+xml' => 'lasxml',
275 | 'application/vnd.llamagraphics.life-balance.desktop' => 'lbd',
276 | 'application/vnd.llamagraphics.life-balance.exchange+xml' => 'lbe',
277 | 'application/vnd.lotus-1-2-3' => '123',
278 | 'application/vnd.lotus-approach' => 'apr',
279 | 'application/vnd.lotus-freelance' => 'pre',
280 | 'application/vnd.lotus-notes' => 'nsf',
281 | 'application/vnd.lotus-organizer' => 'org',
282 | 'application/vnd.lotus-screencam' => 'scm',
283 | 'application/vnd.lotus-wordpro' => 'lwp',
284 | 'application/vnd.macports.portpkg' => 'portpkg',
285 | 'application/vnd.mcd' => 'mcd',
286 | 'application/vnd.medcalcdata' => 'mc1',
287 | 'application/vnd.mediastation.cdkey' => 'cdkey',
288 | 'application/vnd.mfer' => 'mwf',
289 | 'application/vnd.mfmp' => 'mfm',
290 | 'application/vnd.micrografx.flo' => 'flo',
291 | 'application/vnd.micrografx.igx' => 'igx',
292 | 'application/vnd.mif' => 'mif',
293 | 'application/vnd.mobius.daf' => 'daf',
294 | 'application/vnd.mobius.dis' => 'dis',
295 | 'application/vnd.mobius.mbk' => 'mbk',
296 | 'application/vnd.mobius.mqy' => 'mqy',
297 | 'application/vnd.mobius.msl' => 'msl',
298 | 'application/vnd.mobius.plc' => 'plc',
299 | 'application/vnd.mobius.txf' => 'txf',
300 | 'application/vnd.mophun.application' => 'mpn',
301 | 'application/vnd.mophun.certificate' => 'mpc',
302 | 'application/vnd.mozilla.xul+xml' => 'xul',
303 | 'application/vnd.ms-artgalry' => 'cil',
304 | 'application/vnd.ms-cab-compressed' => 'cab',
305 | 'application/vnd.ms-excel' => 'xls',
306 | 'application/vnd.ms-excel.addin.macroenabled.12' => 'xlam',
307 | 'application/vnd.ms-excel.sheet.binary.macroenabled.12' => 'xlsb',
308 | 'application/vnd.ms-excel.sheet.macroenabled.12' => 'xlsm',
309 | 'application/vnd.ms-excel.template.macroenabled.12' => 'xltm',
310 | 'application/vnd.ms-fontobject' => 'eot',
311 | 'application/vnd.ms-htmlhelp' => 'chm',
312 | 'application/vnd.ms-ims' => 'ims',
313 | 'application/vnd.ms-lrm' => 'lrm',
314 | 'application/vnd.ms-officetheme' => 'thmx',
315 | 'application/vnd.ms-pki.seccat' => 'cat',
316 | 'application/vnd.ms-pki.stl' => 'stl',
317 | 'application/vnd.ms-powerpoint' => 'ppt',
318 | 'application/vnd.ms-powerpoint.addin.macroenabled.12' => 'ppam',
319 | 'application/vnd.ms-powerpoint.presentation.macroenabled.12' => 'pptm',
320 | 'application/vnd.ms-powerpoint.slide.macroenabled.12' => 'sldm',
321 | 'application/vnd.ms-powerpoint.slideshow.macroenabled.12' => 'ppsm',
322 | 'application/vnd.ms-powerpoint.template.macroenabled.12' => 'potm',
323 | 'application/vnd.ms-project' => 'mpp',
324 | 'application/vnd.ms-word.document.macroenabled.12' => 'docm',
325 | 'application/vnd.ms-word.template.macroenabled.12' => 'dotm',
326 | 'application/vnd.ms-works' => 'wps',
327 | 'application/vnd.ms-wpl' => 'wpl',
328 | 'application/vnd.ms-xpsdocument' => 'xps',
329 | 'application/vnd.mseq' => 'mseq',
330 | 'application/vnd.musician' => 'mus',
331 | 'application/vnd.muvee.style' => 'msty',
332 | 'application/vnd.mynfc' => 'taglet',
333 | 'application/vnd.neurolanguage.nlu' => 'nlu',
334 | 'application/vnd.nitf' => 'ntf',
335 | 'application/vnd.noblenet-directory' => 'nnd',
336 | 'application/vnd.noblenet-sealer' => 'nns',
337 | 'application/vnd.noblenet-web' => 'nnw',
338 | 'application/vnd.nokia.n-gage.data' => 'ngdat',
339 | 'application/vnd.nokia.n-gage.symbian.install' => 'n-gage',
340 | 'application/vnd.nokia.radio-preset' => 'rpst',
341 | 'application/vnd.nokia.radio-presets' => 'rpss',
342 | 'application/vnd.novadigm.edm' => 'edm',
343 | 'application/vnd.novadigm.edx' => 'edx',
344 | 'application/vnd.novadigm.ext' => 'ext',
345 | 'application/vnd.oasis.opendocument.chart' => 'odc',
346 | 'application/vnd.oasis.opendocument.chart-template' => 'otc',
347 | 'application/vnd.oasis.opendocument.database' => 'odb',
348 | 'application/vnd.oasis.opendocument.formula' => 'odf',
349 | 'application/vnd.oasis.opendocument.formula-template' => 'odft',
350 | 'application/vnd.oasis.opendocument.graphics' => 'odg',
351 | 'application/vnd.oasis.opendocument.graphics-template' => 'otg',
352 | 'application/vnd.oasis.opendocument.image' => 'odi',
353 | 'application/vnd.oasis.opendocument.image-template' => 'oti',
354 | 'application/vnd.oasis.opendocument.presentation' => 'odp',
355 | 'application/vnd.oasis.opendocument.presentation-template' => 'otp',
356 | 'application/vnd.oasis.opendocument.spreadsheet' => 'ods',
357 | 'application/vnd.oasis.opendocument.spreadsheet-template' => 'ots',
358 | 'application/vnd.oasis.opendocument.text' => 'odt',
359 | 'application/vnd.oasis.opendocument.text-master' => 'odm',
360 | 'application/vnd.oasis.opendocument.text-template' => 'ott',
361 | 'application/vnd.oasis.opendocument.text-web' => 'oth',
362 | 'application/vnd.olpc-sugar' => 'xo',
363 | 'application/vnd.oma.dd2+xml' => 'dd2',
364 | 'application/vnd.openofficeorg.extension' => 'oxt',
365 | 'application/vnd.openxmlformats-officedocument.presentationml.presentation' => 'pptx',
366 | 'application/vnd.openxmlformats-officedocument.presentationml.slide' => 'sldx',
367 | 'application/vnd.openxmlformats-officedocument.presentationml.slideshow' => 'ppsx',
368 | 'application/vnd.openxmlformats-officedocument.presentationml.template' => 'potx',
369 | 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 'xlsx',
370 | 'application/vnd.openxmlformats-officedocument.spreadsheetml.template' => 'xltx',
371 | 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => 'docx',
372 | 'application/vnd.openxmlformats-officedocument.wordprocessingml.template' => 'dotx',
373 | 'application/vnd.osgeo.mapguide.package' => 'mgp',
374 | 'application/vnd.osgi.dp' => 'dp',
375 | 'application/vnd.osgi.subsystem' => 'esa',
376 | 'application/vnd.palm' => 'pdb',
377 | 'application/vnd.pawaafile' => 'paw',
378 | 'application/vnd.pg.format' => 'str',
379 | 'application/vnd.pg.osasli' => 'ei6',
380 | 'application/vnd.picsel' => 'efif',
381 | 'application/vnd.pmi.widget' => 'wg',
382 | 'application/vnd.pocketlearn' => 'plf',
383 | 'application/vnd.powerbuilder6' => 'pbd',
384 | 'application/vnd.previewsystems.box' => 'box',
385 | 'application/vnd.proteus.magazine' => 'mgz',
386 | 'application/vnd.publishare-delta-tree' => 'qps',
387 | 'application/vnd.pvi.ptid1' => 'ptid',
388 | 'application/vnd.quark.quarkxpress' => 'qxd',
389 | 'application/vnd.realvnc.bed' => 'bed',
390 | 'application/vnd.recordare.musicxml' => 'mxl',
391 | 'application/vnd.recordare.musicxml+xml' => 'musicxml',
392 | 'application/vnd.rig.cryptonote' => 'cryptonote',
393 | 'application/vnd.rim.cod' => 'cod',
394 | 'application/vnd.rn-realmedia' => 'rm',
395 | 'application/vnd.rn-realmedia-vbr' => 'rmvb',
396 | 'application/vnd.route66.link66+xml' => 'link66',
397 | 'application/vnd.sailingtracker.track' => 'st',
398 | 'application/vnd.seemail' => 'see',
399 | 'application/vnd.sema' => 'sema',
400 | 'application/vnd.semd' => 'semd',
401 | 'application/vnd.semf' => 'semf',
402 | 'application/vnd.shana.informed.formdata' => 'ifm',
403 | 'application/vnd.shana.informed.formtemplate' => 'itp',
404 | 'application/vnd.shana.informed.interchange' => 'iif',
405 | 'application/vnd.shana.informed.package' => 'ipk',
406 | 'application/vnd.simtech-mindmapper' => 'twd',
407 | 'application/vnd.smaf' => 'mmf',
408 | 'application/vnd.smart.teacher' => 'teacher',
409 | 'application/vnd.solent.sdkm+xml' => 'sdkm',
410 | 'application/vnd.spotfire.dxp' => 'dxp',
411 | 'application/vnd.spotfire.sfs' => 'sfs',
412 | 'application/vnd.stardivision.calc' => 'sdc',
413 | 'application/vnd.stardivision.draw' => 'sda',
414 | 'application/vnd.stardivision.impress' => 'sdd',
415 | 'application/vnd.stardivision.math' => 'smf',
416 | 'application/vnd.stardivision.writer' => 'sdw',
417 | 'application/vnd.stardivision.writer-global' => 'sgl',
418 | 'application/vnd.stepmania.package' => 'smzip',
419 | 'application/vnd.stepmania.stepchart' => 'sm',
420 | 'application/vnd.sun.xml.calc' => 'sxc',
421 | 'application/vnd.sun.xml.calc.template' => 'stc',
422 | 'application/vnd.sun.xml.draw' => 'sxd',
423 | 'application/vnd.sun.xml.draw.template' => 'std',
424 | 'application/vnd.sun.xml.impress' => 'sxi',
425 | 'application/vnd.sun.xml.impress.template' => 'sti',
426 | 'application/vnd.sun.xml.math' => 'sxm',
427 | 'application/vnd.sun.xml.writer' => 'sxw',
428 | 'application/vnd.sun.xml.writer.global' => 'sxg',
429 | 'application/vnd.sun.xml.writer.template' => 'stw',
430 | 'application/vnd.sus-calendar' => 'sus',
431 | 'application/vnd.svd' => 'svd',
432 | 'application/vnd.symbian.install' => 'sis',
433 | 'application/vnd.syncml+xml' => 'xsm',
434 | 'application/vnd.syncml.dm+wbxml' => 'bdm',
435 | 'application/vnd.syncml.dm+xml' => 'xdm',
436 | 'application/vnd.tao.intent-module-archive' => 'tao',
437 | 'application/vnd.tcpdump.pcap' => 'pcap',
438 | 'application/vnd.tmobile-livetv' => 'tmo',
439 | 'application/vnd.trid.tpt' => 'tpt',
440 | 'application/vnd.triscape.mxs' => 'mxs',
441 | 'application/vnd.trueapp' => 'tra',
442 | 'application/vnd.ufdl' => 'ufd',
443 | 'application/vnd.uiq.theme' => 'utz',
444 | 'application/vnd.umajin' => 'umj',
445 | 'application/vnd.unity' => 'unityweb',
446 | 'application/vnd.uoml+xml' => 'uoml',
447 | 'application/vnd.vcx' => 'vcx',
448 | 'application/vnd.visio' => 'vsd',
449 | 'application/vnd.visionary' => 'vis',
450 | 'application/vnd.vsf' => 'vsf',
451 | 'application/vnd.wap.wbxml' => 'wbxml',
452 | 'application/vnd.wap.wmlc' => 'wmlc',
453 | 'application/vnd.wap.wmlscriptc' => 'wmlsc',
454 | 'application/vnd.webturbo' => 'wtb',
455 | 'application/vnd.wolfram.player' => 'nbp',
456 | 'application/vnd.wordperfect' => 'wpd',
457 | 'application/vnd.wqd' => 'wqd',
458 | 'application/vnd.wt.stf' => 'stf',
459 | 'application/vnd.xara' => 'xar',
460 | 'application/vnd.xfdl' => 'xfdl',
461 | 'application/vnd.yamaha.hv-dic' => 'hvd',
462 | 'application/vnd.yamaha.hv-script' => 'hvs',
463 | 'application/vnd.yamaha.hv-voice' => 'hvp',
464 | 'application/vnd.yamaha.openscoreformat' => 'osf',
465 | 'application/vnd.yamaha.openscoreformat.osfpvg+xml' => 'osfpvg',
466 | 'application/vnd.yamaha.smaf-audio' => 'saf',
467 | 'application/vnd.yamaha.smaf-phrase' => 'spf',
468 | 'application/vnd.yellowriver-custom-menu' => 'cmp',
469 | 'application/vnd.zul' => 'zir',
470 | 'application/vnd.zzazz.deck+xml' => 'zaz',
471 | 'application/voicexml+xml' => 'vxml',
472 | 'application/widget' => 'wgt',
473 | 'application/winhlp' => 'hlp',
474 | 'application/wsdl+xml' => 'wsdl',
475 | 'application/wspolicy+xml' => 'wspolicy',
476 | 'application/x-7z-compressed' => '7z',
477 | 'application/x-abiword' => 'abw',
478 | 'application/x-ace-compressed' => 'ace',
479 | 'application/x-apple-diskimage' => 'dmg',
480 | 'application/x-authorware-bin' => 'aab',
481 | 'application/x-authorware-map' => 'aam',
482 | 'application/x-authorware-seg' => 'aas',
483 | 'application/x-bcpio' => 'bcpio',
484 | 'application/x-bittorrent' => 'torrent',
485 | 'application/x-blorb' => 'blb',
486 | 'application/x-bzip' => 'bz',
487 | 'application/x-bzip2' => 'bz2',
488 | 'application/x-cbr' => 'cbr',
489 | 'application/x-cdlink' => 'vcd',
490 | 'application/x-cfs-compressed' => 'cfs',
491 | 'application/x-chat' => 'chat',
492 | 'application/x-chess-pgn' => 'pgn',
493 | 'application/x-conference' => 'nsc',
494 | 'application/x-cpio' => 'cpio',
495 | 'application/x-csh' => 'csh',
496 | 'application/x-debian-package' => 'deb',
497 | 'application/x-dgc-compressed' => 'dgc',
498 | 'application/x-director' => 'dir',
499 | 'application/x-doom' => 'wad',
500 | 'application/x-dtbncx+xml' => 'ncx',
501 | 'application/x-dtbook+xml' => 'dtb',
502 | 'application/x-dtbresource+xml' => 'res',
503 | 'application/x-dvi' => 'dvi',
504 | 'application/x-envoy' => 'evy',
505 | 'application/x-eva' => 'eva',
506 | 'application/x-font-bdf' => 'bdf',
507 | 'application/x-font-ghostscript' => 'gsf',
508 | 'application/x-font-linux-psf' => 'psf',
509 | 'application/x-font-otf' => 'otf',
510 | 'application/x-font-pcf' => 'pcf',
511 | 'application/x-font-snf' => 'snf',
512 | 'application/x-font-ttf' => 'ttf',
513 | 'application/x-font-type1' => 'pfa',
514 | 'application/x-freearc' => 'arc',
515 | 'application/x-futuresplash' => 'spl',
516 | 'application/x-gca-compressed' => 'gca',
517 | 'application/x-glulx' => 'ulx',
518 | 'application/x-gnumeric' => 'gnumeric',
519 | 'application/x-gramps-xml' => 'gramps',
520 | 'application/x-gtar' => 'gtar',
521 | 'application/x-hdf' => 'hdf',
522 | 'application/x-install-instructions' => 'install',
523 | 'application/x-iso9660-image' => 'iso',
524 | 'application/x-java-jnlp-file' => 'jnlp',
525 | 'application/x-latex' => 'latex',
526 | 'application/x-lzh-compressed' => 'lzh',
527 | 'application/x-mie' => 'mie',
528 | 'application/x-mobipocket-ebook' => 'prc',
529 | 'application/x-ms-application' => 'application',
530 | 'application/x-ms-shortcut' => 'lnk',
531 | 'application/x-ms-wmd' => 'wmd',
532 | 'application/x-ms-wmz' => 'wmz',
533 | 'application/x-ms-xbap' => 'xbap',
534 | 'application/x-msaccess' => 'mdb',
535 | 'application/x-msbinder' => 'obd',
536 | 'application/x-mscardfile' => 'crd',
537 | 'application/x-msclip' => 'clp',
538 | 'application/x-msdownload' => 'exe',
539 | 'application/x-msmediaview' => 'mvb',
540 | 'application/x-msmetafile' => 'wmf',
541 | 'application/x-msmoney' => 'mny',
542 | 'application/x-mspublisher' => 'pub',
543 | 'application/x-msschedule' => 'scd',
544 | 'application/x-msterminal' => 'trm',
545 | 'application/x-mswrite' => 'wri',
546 | 'application/x-netcdf' => 'nc',
547 | 'application/x-nzb' => 'nzb',
548 | 'application/x-pkcs12' => 'p12',
549 | 'application/x-pkcs7-certificates' => 'p7b',
550 | 'application/x-pkcs7-certreqresp' => 'p7r',
551 | 'application/x-rar-compressed' => 'rar',
552 | 'application/x-research-info-systems' => 'ris',
553 | 'application/x-sh' => 'sh',
554 | 'application/x-shar' => 'shar',
555 | 'application/x-shockwave-flash' => 'swf',
556 | 'application/x-silverlight-app' => 'xap',
557 | 'application/x-sql' => 'sql',
558 | 'application/x-stuffit' => 'sit',
559 | 'application/x-stuffitx' => 'sitx',
560 | 'application/x-subrip' => 'srt',
561 | 'application/x-sv4cpio' => 'sv4cpio',
562 | 'application/x-sv4crc' => 'sv4crc',
563 | 'application/x-t3vm-image' => 't3',
564 | 'application/x-tads' => 'gam',
565 | 'application/x-tar' => 'tar',
566 | 'application/x-tcl' => 'tcl',
567 | 'application/x-tex' => 'tex',
568 | 'application/x-tex-tfm' => 'tfm',
569 | 'application/x-texinfo' => 'texinfo',
570 | 'application/x-tgif' => 'obj',
571 | 'application/x-ustar' => 'ustar',
572 | 'application/x-wais-source' => 'src',
573 | 'application/x-x509-ca-cert' => 'der',
574 | 'application/x-xfig' => 'fig',
575 | 'application/x-xliff+xml' => 'xlf',
576 | 'application/x-xpinstall' => 'xpi',
577 | 'application/x-xz' => 'xz',
578 | 'application/x-zmachine' => 'z1',
579 | 'application/xaml+xml' => 'xaml',
580 | 'application/xcap-diff+xml' => 'xdf',
581 | 'application/xenc+xml' => 'xenc',
582 | 'application/xhtml+xml' => 'xhtml',
583 | 'application/xml' => 'xml',
584 | 'application/xml-dtd' => 'dtd',
585 | 'application/xop+xml' => 'xop',
586 | 'application/xproc+xml' => 'xpl',
587 | 'application/xslt+xml' => 'xslt',
588 | 'application/xspf+xml' => 'xspf',
589 | 'application/xv+xml' => 'mxml',
590 | 'application/yang' => 'yang',
591 | 'application/yin+xml' => 'yin',
592 | 'application/zip' => 'zip',
593 | 'audio/adpcm' => 'adp',
594 | 'audio/basic' => 'au',
595 | 'audio/midi' => 'mid',
596 | 'audio/mp4' => 'm4a',
597 | 'audio/mpeg' => 'mpga',
598 | 'audio/ogg' => 'oga',
599 | 'audio/s3m' => 's3m',
600 | 'audio/silk' => 'sil',
601 | 'audio/vnd.dece.audio' => 'uva',
602 | 'audio/vnd.digital-winds' => 'eol',
603 | 'audio/vnd.dra' => 'dra',
604 | 'audio/vnd.dts' => 'dts',
605 | 'audio/vnd.dts.hd' => 'dtshd',
606 | 'audio/vnd.lucent.voice' => 'lvp',
607 | 'audio/vnd.ms-playready.media.pya' => 'pya',
608 | 'audio/vnd.nuera.ecelp4800' => 'ecelp4800',
609 | 'audio/vnd.nuera.ecelp7470' => 'ecelp7470',
610 | 'audio/vnd.nuera.ecelp9600' => 'ecelp9600',
611 | 'audio/vnd.rip' => 'rip',
612 | 'audio/webm' => 'weba',
613 | 'audio/x-aac' => 'aac',
614 | 'audio/x-aiff' => 'aif',
615 | 'audio/x-caf' => 'caf',
616 | 'audio/x-flac' => 'flac',
617 | 'audio/x-matroska' => 'mka',
618 | 'audio/x-mpegurl' => 'm3u',
619 | 'audio/x-ms-wax' => 'wax',
620 | 'audio/x-ms-wma' => 'wma',
621 | 'audio/x-pn-realaudio' => 'ram',
622 | 'audio/x-pn-realaudio-plugin' => 'rmp',
623 | 'audio/x-wav' => 'wav',
624 | 'audio/xm' => 'xm',
625 | 'chemical/x-cdx' => 'cdx',
626 | 'chemical/x-cif' => 'cif',
627 | 'chemical/x-cmdf' => 'cmdf',
628 | 'chemical/x-cml' => 'cml',
629 | 'chemical/x-csml' => 'csml',
630 | 'chemical/x-xyz' => 'xyz',
631 | 'image/bmp' => 'bmp',
632 | 'image/cgm' => 'cgm',
633 | 'image/g3fax' => 'g3',
634 | 'image/gif' => 'gif',
635 | 'image/ief' => 'ief',
636 | 'image/jpeg' => 'jpeg',
637 | 'image/ktx' => 'ktx',
638 | 'image/png' => 'png',
639 | 'image/prs.btif' => 'btif',
640 | 'image/sgi' => 'sgi',
641 | 'image/svg+xml' => 'svg',
642 | 'image/tiff' => 'tiff',
643 | 'image/vnd.adobe.photoshop' => 'psd',
644 | 'image/vnd.dece.graphic' => 'uvi',
645 | 'image/vnd.djvu' => 'djvu',
646 | 'image/vnd.dvb.subtitle' => 'sub',
647 | 'image/vnd.dwg' => 'dwg',
648 | 'image/vnd.dxf' => 'dxf',
649 | 'image/vnd.fastbidsheet' => 'fbs',
650 | 'image/vnd.fpx' => 'fpx',
651 | 'image/vnd.fst' => 'fst',
652 | 'image/vnd.fujixerox.edmics-mmr' => 'mmr',
653 | 'image/vnd.fujixerox.edmics-rlc' => 'rlc',
654 | 'image/vnd.ms-modi' => 'mdi',
655 | 'image/vnd.ms-photo' => 'wdp',
656 | 'image/vnd.net-fpx' => 'npx',
657 | 'image/vnd.wap.wbmp' => 'wbmp',
658 | 'image/vnd.xiff' => 'xif',
659 | 'image/webp' => 'webp',
660 | 'image/x-3ds' => '3ds',
661 | 'image/x-cmu-raster' => 'ras',
662 | 'image/x-cmx' => 'cmx',
663 | 'image/x-freehand' => 'fh',
664 | 'image/x-icon' => 'ico',
665 | 'image/x-mrsid-image' => 'sid',
666 | 'image/x-pcx' => 'pcx',
667 | 'image/x-pict' => 'pic',
668 | 'image/x-portable-anymap' => 'pnm',
669 | 'image/x-portable-bitmap' => 'pbm',
670 | 'image/x-portable-graymap' => 'pgm',
671 | 'image/x-portable-pixmap' => 'ppm',
672 | 'image/x-rgb' => 'rgb',
673 | 'image/x-tga' => 'tga',
674 | 'image/x-xbitmap' => 'xbm',
675 | 'image/x-xpixmap' => 'xpm',
676 | 'image/x-xwindowdump' => 'xwd',
677 | 'message/rfc822' => 'eml',
678 | 'model/iges' => 'igs',
679 | 'model/mesh' => 'msh',
680 | 'model/vnd.collada+xml' => 'dae',
681 | 'model/vnd.dwf' => 'dwf',
682 | 'model/vnd.gdl' => 'gdl',
683 | 'model/vnd.gtw' => 'gtw',
684 | 'model/vnd.mts' => 'mts',
685 | 'model/vnd.vtu' => 'vtu',
686 | 'model/vrml' => 'wrl',
687 | 'model/x3d+binary' => 'x3db',
688 | 'model/x3d+vrml' => 'x3dv',
689 | 'model/x3d+xml' => 'x3d',
690 | 'text/cache-manifest' => 'appcache',
691 | 'text/calendar' => 'ics',
692 | 'text/css' => 'css',
693 | 'text/csv' => 'csv',
694 | 'text/html' => 'html',
695 | 'text/n3' => 'n3',
696 | 'text/plain' => 'txt',
697 | 'text/prs.lines.tag' => 'dsc',
698 | 'text/richtext' => 'rtx',
699 | 'text/sgml' => 'sgml',
700 | 'text/tab-separated-values' => 'tsv',
701 | 'text/troff' => 't',
702 | 'text/turtle' => 'ttl',
703 | 'text/uri-list' => 'uri',
704 | 'text/vcard' => 'vcard',
705 | 'text/vnd.curl' => 'curl',
706 | 'text/vnd.curl.dcurl' => 'dcurl',
707 | 'text/vnd.curl.mcurl' => 'mcurl',
708 | 'text/vnd.curl.scurl' => 'scurl',
709 | 'text/vnd.dvb.subtitle' => 'sub',
710 | 'text/vnd.fly' => 'fly',
711 | 'text/vnd.fmi.flexstor' => 'flx',
712 | 'text/vnd.graphviz' => 'gv',
713 | 'text/vnd.in3d.3dml' => '3dml',
714 | 'text/vnd.in3d.spot' => 'spot',
715 | 'text/vnd.sun.j2me.app-descriptor' => 'jad',
716 | 'text/vnd.wap.wml' => 'wml',
717 | 'text/vnd.wap.wmlscript' => 'wmls',
718 | 'text/x-asm' => 's',
719 | 'text/x-c' => 'c',
720 | 'text/x-fortran' => 'f',
721 | 'text/x-java-source' => 'java',
722 | 'text/x-nfo' => 'nfo',
723 | 'text/x-opml' => 'opml',
724 | 'text/x-pascal' => 'p',
725 | 'text/x-setext' => 'etx',
726 | 'text/x-sfv' => 'sfv',
727 | 'text/x-uuencode' => 'uu',
728 | 'text/x-vcalendar' => 'vcs',
729 | 'text/x-vcard' => 'vcf',
730 | 'video/3gpp' => '3gp',
731 | 'video/3gpp2' => '3g2',
732 | 'video/h261' => 'h261',
733 | 'video/h263' => 'h263',
734 | 'video/h264' => 'h264',
735 | 'video/jpeg' => 'jpgv',
736 | 'video/jpm' => 'jpm',
737 | 'video/mj2' => 'mj2',
738 | 'video/mp4' => 'mp4',
739 | 'video/mpeg' => 'mpeg',
740 | 'video/ogg' => 'ogv',
741 | 'video/quicktime' => 'qt',
742 | 'video/vnd.dece.hd' => 'uvh',
743 | 'video/vnd.dece.mobile' => 'uvm',
744 | 'video/vnd.dece.pd' => 'uvp',
745 | 'video/vnd.dece.sd' => 'uvs',
746 | 'video/vnd.dece.video' => 'uvv',
747 | 'video/vnd.dvb.file' => 'dvb',
748 | 'video/vnd.fvt' => 'fvt',
749 | 'video/vnd.mpegurl' => 'mxu',
750 | 'video/vnd.ms-playready.media.pyv' => 'pyv',
751 | 'video/vnd.uvvu.mp4' => 'uvu',
752 | 'video/vnd.vivo' => 'viv',
753 | 'video/webm' => 'webm',
754 | 'video/x-f4v' => 'f4v',
755 | 'video/x-fli' => 'fli',
756 | 'video/x-flv' => 'flv',
757 | 'video/x-m4v' => 'm4v',
758 | 'video/x-matroska' => 'mkv',
759 | 'video/x-mng' => 'mng',
760 | 'video/x-ms-asf' => 'asf',
761 | 'video/x-ms-vob' => 'vob',
762 | 'video/x-ms-wm' => 'wm',
763 | 'video/x-ms-wmv' => 'wmv',
764 | 'video/x-ms-wmx' => 'wmx',
765 | 'video/x-ms-wvx' => 'wvx',
766 | 'video/x-msvideo' => 'avi',
767 | 'video/x-sgi-movie' => 'movie',
768 | 'video/x-smv' => 'smv',
769 | 'x-conference/x-cooltalk' => 'ice',
770 | );
771 |
772 | public $mime = null;
773 | public $extension = null;
774 | public $path = null;
775 |
776 | public function __construct($path = null) {
777 | if ($path) {
778 | $this->path = $path;
779 | }
780 | }
781 |
782 | public function mime() {
783 | if (!isset($this->mime)) {
784 | $finfo = finfo_open(FILEINFO_MIME_TYPE);
785 | $this->mime = finfo_file($finfo, $this->path);
786 | }
787 |
788 | return $this->mime;
789 | }
790 |
791 | public function extension() {
792 | if (!isset($this->extension)) {
793 | $this->extension = self::mime_to_ext($this->mime());
794 | }
795 |
796 | return $this->extension;
797 | }
798 |
799 | public static function random_hex($length) {
800 | if (function_exists('random_bytes')) {
801 | return bin2hex(random_bytes($length));
802 | } else {
803 | return substr(md5(rand(0, getrandmax())), 0, $length * 2);
804 | }
805 | }
806 |
807 | public function create_name($directory, $extension) {
808 | if (!file_exists($directory)) {
809 | mkdir($directory, 0777, TRUE);
810 | }
811 |
812 | do {
813 | $name = Base60::encode(base_convert(self::random_hex(7), 16, 10));
814 |
815 | if ($extension) {
816 | $name = $name.".".$extension;
817 | }
818 |
819 | $path = $directory."/".$name;
820 | } while (file_exists($path));
821 |
822 | // Yes, there exists a small chance that a file with
823 | // the same random name will be created while executing
824 | // this comment before we have the chance to create
825 | // the dummy file below. Who cares really.
826 |
827 | touch($path);
828 |
829 | return $path;
830 | }
831 |
832 | public function move_uploaded_file($directory, $extension = null) {
833 | if (!isset($extension)) {
834 | $extension = $this->extension();
835 | }
836 |
837 | $path = $this->create_name($directory, $extension);
838 |
839 | if (move_uploaded_file($this->path, $path)) {
840 | $this->path = $path;
841 | return true;
842 | } else {
843 | return false;
844 | }
845 | }
846 |
847 | public function url() {
848 | $file_path = realpath($this->path);
849 |
850 | $url_part = str_replace(realpath($GLOBALS['config']['upload_directory']), "", $file_path);
851 |
852 | return $GLOBALS['config']['upload_server'].$url_part;
853 | }
854 |
855 | public function mime_to_ext($file_mime) {
856 | foreach (self::$mimes as $mime_type => $ext) {
857 | if ($mime_type === $file_mime) {
858 | return $ext;
859 | }
860 | }
861 |
862 | return null;
863 | }
864 |
865 | public function clean_metadata() {
866 | if ($this->mime() === 'image/jpeg') {
867 | $handle = fopen($this->path, "rb");
868 | $segment[] = fread($handle, 2);
869 |
870 | if ($segment[0] === "\xFF\xD8") {
871 |
872 | $segment[] = fread($handle, 1);
873 | if ($segment[1] === "\xFF") {
874 |
875 | rewind($handle);
876 |
877 | while (!feof($handle)) {
878 | $data = fread($handle, 2);
879 | if ((preg_match("/FFE[1-9a-zA-Z]{1,1}/i", bin2hex($data))) || ($data === "\xFF\xFE")) {
880 | $position = ftell($handle);
881 | $size = fread($handle, 2);
882 | $newsize = 256 * ord($size{0}) + ord($size{1});
883 | $newpos = $position + $newsize;
884 | fseek($handle, $newpos);
885 | } else {
886 | $newfile[] = $data;
887 | }
888 | }
889 | fclose($handle);
890 | $newfile = implode('', $newfile);
891 | $handle = fopen($this->path, "wb");
892 |
893 | fwrite($handle, $newfile);
894 | fclose($handle);
895 |
896 | return TRUE;
897 | } else {
898 | return FALSE;
899 | }
900 | } else {
901 | return FALSE;
902 | }
903 | }
904 |
905 | return FALSE;
906 | }
907 | }
908 |
--------------------------------------------------------------------------------