117 Commits

Author SHA1 Message Date
sam marshall
e332d1849d MDL-72643 core: Improve display_size
Allows display_size to use a fixed unit for easy comparison of
multiple results, and fixed decimal places for the same reason.

Improves behaviour by using consistent decimal places and a
consistent space before the unit (the previous one only has a space
before 'bytes', not before 'KB').

Of existing uses, all the ones that displayed a 'maxbytes' type
configuration setting (which are likely to have an 'exact' size
and would be better shown as 512 KB rather than 512.0 KB) have been
changed to use 0 decimal places, to preserve previous behaviour.
All the uses which were showing an actual file or memory size have
been left as default (1 decimal place).
2021-09-27 16:52:33 +01:00
Shamim Rezaie
9c11ceac1f MDL-69028 repository: Put a rate limit on draft file uploads 2021-05-04 17:23:11 +02:00
Adrian Greeve
f1d1a60e0a MDL-61131 repositories: Added a key to verify incoming urls. 2018-01-09 11:34:37 +01:00
Damyon Wiese
af28b22892 MDL-58219 googledocs: Use google file extensions
Only rename on export for download.

Part of MDL-58220
2017-04-03 13:41:19 +08:00
Damyon Wiese
141ee541ca MDL-58219 repository: Change how controlled links work
Files are copied to the system user as soon as they are uploaded. Write access is then controlled when
serving links to the file.

Part of MDL-58220
2017-04-03 13:41:19 +08:00
Damyon Wiese
151b0f9409 MDL-58132 repositories: Controlled link file type
This introduces a new "controlled link" file type where the file is not
stored in Moodle - but Moodle will control the access permissions on the file.

Plugins can "freeze" a filearea which means Moodle will take ownership of all the remote
files of this type.

When accessing a file, if the "filebrowser" infomation indicates the current user can write to the file, they
will be granted temporary write access.

Part of MDL-58220
2017-04-03 13:40:13 +08:00
Damyon Wiese
989e14fea0 MDL-58128 googledocs: Support reference files.
Add options so the admin can control the types of files this repository can support (and the default).

Part of MDL-58220
2017-04-03 13:40:13 +08:00
Damyon Wiese
663640f5b3 MDL-40759 icons: convert uses of pix_url to pix_icon
Also change filepicker to use scaled svgs instead of sets of custom pngs. The svgs are taken from font-awesome.
2017-03-17 15:52:17 +08:00
Frederic Massart
048f8073d1
Revert "Merge branch 'MDL-54110_master' of https://github.com/marxjohnson/moodle"
This reverts commit 016e0abfbc1992f01eadfdef02de6e56ffad8e9f, reversing
changes made to 58a2f0ac40f24da9c9955110902f8e14cd0d8419.
2016-06-23 11:51:44 +08:00
Russell Smith
1fcf0ca8a5 MDL-35628 performance: Remove dirname() where possible.
dirname() is a slow function compared with __DIR__ and using
'/../'.  Moodle has a large number of legacy files that are included
each time a page loads and is not able to use an autoloader as it is
functional code.  This allows those required includes to perform as
best as possible in this situation.
2016-06-10 08:06:49 +10:00
Mark Johnson
121b67411f MDL-54110 repositories: Allow repositories to ignore post_max_size
Repositories can now override usespost() if they don't upload using POST
requests. This restores the ability of users with
moodle/course:ignorefilesizelimits to upload files of unlimited size
lost in MDL-44626.
2016-05-10 16:10:24 +01:00
Ben Tindell
a2fb838e82 MDL-53577 repository: Added maxbytes error message
Changing the error message that is displayed to users when they
upload a file that is greater than the maximum upload size. Does not
include all upload cases; focuses on those most used by students.
2016-04-04 15:33:40 -05:00
Marina Glancy
5ad3f3c61e MDL-45616 repositories: more clearly distinguish when we use source and when reference
Function repository::get_moodle_file() should always be called on packed reference and not on the source received from user.
Also added phpdocs to some other methods that were confusing source and reference
2014-07-07 14:41:20 +08:00
Tim Hunt
5bcfd504df MDL-45618 Fix @since PHPdoc tags. 2014-05-19 17:03:04 +01:00
Andrew Nicols
5329506f22 MDL-34182 Repositories: Check for and warn on invalid output in the file picker 2013-12-13 14:10:05 +08:00
sam marshall
3ef7279f26 MDL-42084 Core: Change set_time_limit to core_php_time_limit::raise everywhere
Exceptions (places where set_time_limit is still left) are:

Third-party libraries:
  ADODB
  PHPMailer

Moodle core:
  PHPUnit - not relevant (CLI mode)
2013-11-06 16:40:01 +00:00
Sam Hemelryk
df1d3e9115 Merge branch 'wip-MDL-27684-master' of git://github.com/satrun77/moodle 2013-09-16 10:27:16 +12:00
Mohamed Alsharaf
dca16fd76f MDL-27684 repository: make require_login() throws exception instead of redirect 2013-09-13 16:01:55 +12:00
Dan Poltawski
033d1634cc MDL-29954 repository: remove dead code
Also remove repository_attach_id() which was never used and not useful.
2013-08-28 10:52:42 +08:00
Ankit Agarwal
0601e0eef6 MDL-40402 libraries: Replace get_system_context() with context_system::instance() in core 2013-07-04 15:41:06 +08:00
Andrew Robert Nicols
28037331fb MDL-33680 JavaScript: Use the correct Content-Type for AJAX scripts
The repository_ajax.php script was returning a text/plain Content-Type and
user/selector/search.php was setting the content-type when this should be
handled by with the definition of AJAX_SCRIPT.
2013-03-16 10:52:02 +00:00
Frederic Massart
39bb9b1f00 MDL-36472 files: Improved file area uploads error messages. 2013-01-31 15:09:44 +08:00
Dan Poltawski
0e35ba6ffc MDL-36357 cleanup - remove double semicolons 2012-11-15 09:51:26 +08:00
Frederic Massart
68acd1157e MDL-33766 files: Improved validation of areamaxbytes 2012-11-01 16:47:06 +08:00
Frederic Massart
21e3ea77a3 MDL-33766 files: Support for userquota/size limit in draft areas 2012-11-01 16:46:42 +08:00
Eloy Lafuente (stronk7)
69689b4c3e Merge branch 'wip-MDL-34290-master' of git://github.com/marinaglancy/moodle 2012-08-29 12:11:00 +02:00
Marina Glancy
437f5dc4cf MDL-34290 Auto synchronise newly created references when possible 2012-08-29 11:56:17 +08:00
Marina Glancy
75dd40b265 MDL-34290 repository_dropbox reference handling
- When Dropbox file is inserted by reference, the shared link is created and stored
- Added a function to fix old references (containing access_key/secret) with the proper ones
- Added support for external links in Dropbox (FILE_EXTERNAL), using the shared link API
- Make sure that repository::get_link() receives reference and not source (other repositories than Dropbox have those fields identical)
- Function get_file_by_reference respects request timeouts, downloads only images (for thumbnail generation),
- Function get_file respects request timeout
- do not use cache_file class (content is cached in moodle filepool if needed)
- added parameter for maximum size of files to cache
- added 'Manage' link for Filepicker
- added user name to
- added user name (if different from current) to 'Original' field
- added/corrected phpdocs
2012-08-29 11:56:16 +08:00
Marina Glancy
59cb759850 MDL-34290 repository API: do not confuse source and reference
make sure that repository function get_file_source_info receives as argument the source of the file,
and get_file receives a reference;
reference is a value of DB field files_reference.reference and result of get_file_reference(source).
Fix dropbox as the only repository that have different values in those fields;
also added information about user in dropbox reference and original
2012-08-29 11:56:14 +08:00
Ankit Agarwal
d197ea4300 MDL-34549 libraries: Replace get_context_instance_by_id() by context::instance_by_id() 2012-08-24 11:30:10 +08:00
Rajesh Taneja
960f437972 MDL-30792 Files API: Cleaner approach to get maxbytes size in filepicker 2012-08-03 11:20:55 +08:00
Rajesh Taneja
7030756a98 MDL-30792 Files API: maxbytes will be set by get_max_upload_file_size if less then 0 or greater then max moodle limit 2012-08-03 11:06:00 +08:00
Frederic Massart
21c08c63ca MDL-34458 Librairies: Replaced deprecated get_context_instance() 2012-07-24 16:58:17 +08:00
Marina Glancy
6dc82385ab MDL-33950 Correctly initialise repository and check access in js and non-js filepicker 2012-07-06 09:44:07 +08:00
Marina Glancy
1bd0174743 MDL-33950 check if source file is accessible in repository_ajax.php
- repository::copy_to_area() does not check access any more, and repository_recent::copy_to_area() is unnecessary
- added repository::file_is_accessible() that checks access to the picked file (regardless of accessibility of the file it is referencing to)
2012-07-06 09:44:07 +08:00
Marina Glancy
adbb904b9c MDL-33837 picking file from server files should not copy 'Main file' property 2012-07-02 14:11:39 +08:00
Marina Glancy
83d2700ec9 MDL-33832 Fixed filling of files.source field
- also supress the error on unserialise (because people already may have broken files.source field)
- also display details about unparseable JSON error
- make source field look the same across repositories
2012-06-20 16:09:37 +08:00
Dongsheng Cai
d6453211b6 MDL-33513: Make files->source field consistent 2012-06-15 14:51:07 +08:00
Dan Poltawski
414ce30812 Revert MDL-33513
This reverts commit b2cf2b807f7a7c8d1a02ebb52038c61cc63a1494.
This reverts commit 24b96f01702571989fa77a05c5cd11b9fedc2745.
This reverts commit 39c60294a6a027ae56f4b9eda159bb589b60c0c0.
This reverts commit 8a288971e25eaaa4c8cbd67e450cee0e12435d4e.
2012-06-14 13:57:45 +08:00
Dan Poltawski
54588ca214 Merge branch 'MDL-27156_file_cap' of git://github.com/andyjdavis/moodle 2012-06-14 12:00:18 +08:00
Dan Poltawski
cd925ac79b Merge branch 'dev_MDL-33513_files_source' of git://github.com/danpoltawski/moodle 2012-06-14 11:12:21 +08:00
Andrew Davis
8ac95c279c MDL-27156 repository: Added a new capability so that select users can bypass file size restrictions 2012-06-14 09:19:25 +07:00
Marina Glancy
c0e8f211d3 MDL-33452 It must not possible to create an alias to another alias
- if the downloaded file is an alias we pretend that we operate with its source
2012-06-12 11:03:54 +08:00
Dongsheng Cai
8a288971e2 MDL-33513: Make files->source field consistent 2012-06-10 17:47:00 +10:00
Marina Glancy
6546a73dbb MDL-33445 reverted file size check for files inserted by reference 2012-06-05 13:57:16 +08:00
Marina Glancy
9945ec5e13 MDL-33445 Added file size check to files inserted by reference 2012-06-05 09:26:26 +08:00
Marina Glancy
2dfa16ef8a MDL-33409 Newly copied files should take on the userid of the current user, and dates reset
- changed function repository::copy_to_area so it accepts more file attributes, pass changed attributes to it
- changed file_info::copy_to_storage and file_info_stored::copy_to_storage to accept more file attributes
- simplified file size check for moodle files in repository/repository_ajax.php
- removed unused code in repository/repository_ajax.php
2012-06-05 09:26:26 +08:00
Dan Poltawski
f8e74b20f9 MDL-28666 repository - Switch usefilereference to PARAM_BOOL 2012-05-21 18:21:31 +08:00
Marina Glancy
559276b153 MDL-32247,MDL-32831,MDL-32900 Use correct url building of file type icons
- function get_mimetypes_array() now contains also information about filetype groups and language strings
- use 'smart' human-readable mimetype description
- never determine filetype group based on filetype icon image! remove function mimeinfo_from_icon()
- get rid of class filetype_parser and file lib/filestorage/file_types.mm, replaced with functions file_get_typegroup(), file_extension_in_typegroup() and file_mimetype_in_typegroup()
- support multiple icon sizes, not only 16 and 32
- retrieve filetype icon only using proper functions file_..._icon() from lib/filelib.php throughout the code
- increase size of repository thumbnails to 90 and icons to 24 (will take effect when new icons exist)
2012-05-21 16:01:04 +08:00
Dongsheng Cai
4712676dfa MDL-28666, Fixed source field when download a file using filepicker 2012-05-21 11:57:56 +08:00