]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Added config option to enable or disable file uploads with notices.
authorRobin Millette <millette@controlyourself.ca>
Wed, 17 Jun 2009 20:55:01 +0000 (16:55 -0400)
committerRobin Millette <millette@controlyourself.ca>
Wed, 17 Jun 2009 20:55:01 +0000 (16:55 -0400)
README
config.php.sample
lib/common.php
lib/noticeform.php

diff --git a/README b/README
index 7b22e3c5e80369c6f6c45ebd72cf9e4b94115275..5aa7270eece7c2bf6ea98823c223e9c62b4e6668 100644 (file)
--- a/README
+++ b/README
@@ -1223,6 +1223,7 @@ supported: an array of mime types you accept to store and distribute,
            like 'image/gif', 'video/mpeg', 'audio/mpeg', etc. Make sure you
            setup your server to properly reckognize the types you want to
            support.
+uploads:   false to disable uploading files with notices (true by default).
 
 For quotas, be sure you've set the upload_max_filesize and post_max_size
 in php.ini to be large enough to handle your upload. In httpd.conf
index ed70f85fbbdfa53b4a737ca34cd47873c835f31f..7649c52623ca09ba1d7dc3fdda16dc9ad90239b3 100644 (file)
@@ -222,5 +222,6 @@ $config['sphinx']['port'] = 3312;
 // $config['attachments']['file_quota'] = 5000000;
 // $config['attachments']['user_quota'] = 50000000;
 // $config['attachments']['monthly_quota'] = 15000000;
+// $config['attachments']['uploads'] = true;
 
 // $config['oohembed']['endpoint'] = 'http://oohembed.com/oohembed/';
index 9c015a15d2b6fa4d33f4a1b8ce45f09f70b12869..bbd9f78c3e1df660ff6c37fc9302a3da7a57b317 100644 (file)
@@ -200,6 +200,7 @@ $config =
         'file_quota' => 5000000,
         'user_quota' => 50000000,
         'monthly_quota' => 15000000,
+        'uploads' => true,
         ),
         'group' =>
         array('maxaliases' => 3),
index 0ad36585662c3f9bf83baf730231b14b16150031..a36b7f31f752047e733f9d5fd41865923e283522 100644 (file)
@@ -90,7 +90,9 @@ class NoticeForm extends Form
             $this->user = common_current_user();
         }
 
-        $this->enctype = 'multipart/form-data';
+        if (common_config('attachments', 'uploads')) {
+            $this->enctype = 'multipart/form-data';
+        }
     }
 
     /**
@@ -148,12 +150,14 @@ class NoticeForm extends Form
         $this->out->element('dd', array('id' => 'notice_text-count'),
                             '140');
         $this->out->elementEnd('dl');
-        $this->out->element('label', array('for' => 'notice_data-attach'),_('Attach'));
-        $this->out->element('input', array('id' => 'notice_data-attach',
-                                           'type' => 'file',
-                                           'name' => 'attach',
-                                           'title' => _('Attach a file')));
-        $this->out->hidden('MAX_FILE_SIZE', common_config('attachments', 'file_quota'));
+        if (common_config('attachments', 'uploads')) {
+            $this->out->hidden('MAX_FILE_SIZE', common_config('attachments', 'file_quota'));
+            $this->out->element('label', array('for' => 'notice_data-attach'),_('Attach'));
+            $this->out->element('input', array('id' => 'notice_data-attach',
+                                               'type' => 'file',
+                                               'name' => 'attach',
+                                               'title' => _('Attach a file')));
+        }
         if ($this->action) {
             $this->out->hidden('notice_return-to', $this->action, 'returnto');
         }