summaryrefslogtreecommitdiffstats
path: root/application/models/mfile.php
AgeCommit message (Collapse)AuthorFilesLines
2016-08-21mfile->add_file: Take userid via argumentFlorian Pritz1-3/+1
This allows for easier testing. Signed-off-by: Florian Pritz <bluewind@xinu.at>
2016-07-13Fix typoFlorian Pritz1-1/+1
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2016-05-24mfile/valid_id: Remove duplicate codeFlorian Pritz1-1/+1
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2016-05-24Fix TypeError when getting thumbnail for invalid IDFlorian Pritz1-0/+5
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2015-08-10Increase thumbnail cache ttlFlorian Pritz1-0/+1
Also try to clean up when files are deleted since 1 month is a rather long time. Granted, thumbnails are small, but whatever Signed-off-by: Florian Pritz <bluewind@xinu.at>
2015-08-09Improve performance of thumbnail historyFlorian Pritz1-12/+16
- Use the filedata we already have in c/file->upload_history_thumbnails() rather than fetching it per id in m/mfile->valid_id - Construct the config array for s/f::valid_id only once and not for every validation. Signed-off-by: Florian Pritz <bluewind@xinu.at>
2015-05-21Support multiple files with the same hashFlorian Pritz1-45/+38
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2015-04-08Cache filedataFlorian Pritz1-12/+15
This brings down render time of a multipaste with 180 items from ~180ms to ~80ms. Signed-off-by: Florian Pritz <bluewind@xinu.at>
2015-04-01Refactor lexer code into dedicated classFlorian Pritz1-183/+0
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2015-03-21Highlight application/postscriptFlorian Pritz1-0/+1
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2015-03-16Map .pp files to puppet lexerFlorian Pritz1-0/+1
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2015-03-08Unify file/cron and mfile->valid_idFlorian Pritz1-25/+18
Create a testable function doing all the verification/removal, add tests and use it for both cases. Signed-off-by: Florian Pritz <bluewind@xinu.at>
2015-03-02Add imagemagick supportFlorian Pritz1-9/+1
Adds additional support for imagemagick if GD doesn't support a file type and extends the files displayed as thumbnails to all images and pdf files. Signed-off-by: Florian Pritz <bluewind@xinu.at>
2015-02-19Add claiming of multipastesFlorian Pritz1-0/+2
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2015-02-03Use exceptions instead of show_errorFlorian Pritz1-1/+1
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-11-08mfile->delete_id: Forgive if a dir doesn't existFlorian Pritz1-2/+4
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-11-03mfile->delete_id: Check for file before trying to unlinkFlorian Pritz1-1/+3
file->cron unlinks the file and then deletes the hash which causes an error in mfile->delete_id because the file no longer exists. Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-11-03Simplify mfile->delete_hashFlorian Pritz1-31/+3
This probably increases the database queries a bit, but greatly simplifies the code and fixes the missing deletion of multipaste tarballs (delete_id handles that). Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-11-03Properly delete multipastes when deleting a single pasteFlorian Pritz1-4/+4
mmultipaste->delete_id() also deletes multipaste tarballs which would otherwise be left over Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-10-19Clean up the postgres changesFlorian Pritz1-6/+10
Style cleanup and some regression fixes Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-10-10Merge remote-tracking branch 'rafi/master' into rafiFlorian Pritz1-42/+57
2014-10-03Move thumbnail code to dedicated classFlorian Pritz1-172/+0
This also moves the code from mfile->image_dimension() to the only place where it was called. Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-09-20thumbnails: Handle EXIF orientationFlorian Pritz1-0/+63
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-09-19Fixing multipaste delete queriesRafael Bodill1-25/+31
2014-09-19WIP: Cascading deleteRafael Bodill1-14/+27
2014-09-18Integrating query builder in modelsRafael Bodill1-28/+24
2014-09-11Fix black background in thumbnails with transparencyFlorian Pritz1-0/+6
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-08-29add multipaste supportFlorian Pritz1-32/+86
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-01-21Disable automatic code display for SVG filesFlorian Pritz1-1/+0
People usually want to view them rather than read the code. Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-01-10let GD itself determine what it can readFlorian Pritz1-14/+5
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2013-11-09use cache_function() everywhereFlorian Pritz1-6/+3
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2013-09-22Add some more file extension -> lexer mappingsFlorian Pritz1-0/+18
Mimetype detection doesn't always properly detect code (I saw javascript as plain text, c as asm) and if there is an extension we can likely get better result by using that. Signed-off-by: Florian Pritz <bluewind@xinu.at>
2013-09-02mfile/delete_id: Remove require_access callFlorian Pritz1-1/+0
We expect the controller to take care of that, no need to double check. Signed-off-by: Florian Pritz <bluewind@xinu.at>
2013-08-22Add comment about ID blacklistFlorian Pritz1-0/+2
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2013-08-15Switch to CI's caching classFlorian Pritz1-3/+3
This supports more caching backends and doesn't force users to install the memcache extension. Signed-off-by: Florian Pritz <bluewind@xinu.at>
2013-08-13Coding style fixesFlorian Pritz1-4/+4
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2013-08-11Add API key supportFlorian Pritz1-1/+1
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2013-08-05Add history page with thumbnails of imagesFlorian Pritz1-0/+112
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2013-07-16Fix handling of upload_max_age = 0Florian Pritz1-0/+3
cron code already handled this correctly, valid() didn't. Signed-off-by: Florian Pritz <bluewind@xinu.at>
2013-07-07Add .coffee extension mappingFlorian Pritz1-0/+1
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2013-06-27mfile: Add some more ocaml extension mappingsFlorian Pritz1-0/+3
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2013-06-22mfile: extension -> lexer mapping; mark some functions publicFlorian Pritz1-4/+20
Also assure that autodetect_lexer always returns false if the file can't be highlit. Signed-off-by: Florian Pritz <bluewind@xinu.at>
2013-06-08mfile/new_id(): rewrite as loop and make min/max parametersFlorian Pritz1-6/+12
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2013-05-09Change description for "text" in lexer listFlorian Pritz1-0/+1
Pygments calls it "Text only", but users are more likely to search for "plain" than "only" so won't find it in the dropdown. Signed-off-by: Florian Pritz <bluewind@xinu.at>
2013-04-18new_id(): improve id blacklistFlorian Pritz1-1/+9
We shouldn't use dir or filenames from the top directory as IDs because they won't work if you use mod_rewrite. Signed-off-by: Florian Pritz <bluewind@xinu.at>
2013-02-23CLI: update_file_metadata: also update mimetypesFlorian Pritz1-2/+9
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2013-02-13Change license to AGPLFlorian Pritz1-1/+1
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2013-02-08Add some mimetypes and sort the listFlorian Pritz1-32/+41
fileinfo uses some different mimetypes than File::MimeInfo. This tries to add most of those that are currently on paste.xinu.at. Signed-off-by: Florian Pritz <bluewind@xinu.at>
2013-02-04Handle text/x-diff MIME typeFlorian Pritz1-0/+1
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2013-02-03Use php's fileinfo instead of perl to detect mimetypeFlorian Pritz1-1/+3
Signed-off-by: Florian Pritz <bluewind@xinu.at>