[Openupload-svn-update] SF.net SVN: openupload:[187] trunk/plugins/filesize.inc.php
Status: Beta
Brought to you by:
tsdogs
|
From: <ts...@us...> - 2008-12-11 11:05:53
|
Revision: 187
http://openupload.svn.sourceforge.net/openupload/?rev=187&view=rev
Author: tsdogs
Date: 2008-12-11 11:05:48 +0000 (Thu, 11 Dec 2008)
Log Message:
-----------
File size limiting plugins per group
Added Paths:
-----------
trunk/plugins/filesize.inc.php
Added: trunk/plugins/filesize.inc.php
===================================================================
--- trunk/plugins/filesize.inc.php (rev 0)
+++ trunk/plugins/filesize.inc.php 2008-12-11 11:05:48 UTC (rev 187)
@@ -0,0 +1,38 @@
+<?php
+
+/* handles different file size upload per group */
+
+class filesizePlugin extends OpenUploadPlugin {
+
+ function filesizePlugin() {
+ $this->description = tr('Limit the maximum size of a uploaded file');
+ $this->options = array(
+ array('name' => 'maxsize', 'description' => tr('Maximum File Size'), 'type' => 'text'),
+ );
+ }
+
+ function init() {
+ /* check if it's enabled */
+ $group = $this->getGroup('maxsize');
+ $acl = 'disable'; /* disabled by default */
+ if (isset(app()->pluginAcl[$this->name])) {
+ $acl = app()->pluginAcl[$this->name]['access'];
+ }
+ if ($acl!='enable') {
+ /* reset to default */
+ app()->user->setInfo('max_upload_size',app()->config['max_upload_size']*1024*1024);
+ } else {
+ $this->loadConfig();
+
+ if (!isset($this->config['maxsize'][$group]) and isset($this->config['maxsize']['*'])>0) {
+ $this->config['maxsize'][$group]=$this->config['maxsize']['*'];
+ }
+ if ($this->config['maxsize'][$group]>0) {
+ app()->user->setInfo('max_upload_size',$this->config['maxsize'][$group]*1024*1024);
+ }
+ }
+ ini_set('max_upload_size',app()->user->info('max_upload_size'));
+ ini_set('post_max_size',app()->user->info('max_upload_size'));
+ }
+}
+?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|