From 28d02ec8cdd0278c802c8fee30acddecca9ca01f Mon Sep 17 00:00:00 2001 From: Robin Millette Date: Wed, 17 Jun 2009 16:44:33 -0400 Subject: Make oohembed endpoint configurable. --- config.php.sample | 1 + 1 file changed, 1 insertion(+) (limited to 'config.php.sample') diff --git a/config.php.sample b/config.php.sample index 636f4cf8e..ed70f85fb 100644 --- a/config.php.sample +++ b/config.php.sample @@ -223,3 +223,4 @@ $config['sphinx']['port'] = 3312; // $config['attachments']['user_quota'] = 50000000; // $config['attachments']['monthly_quota'] = 15000000; +// $config['oohembed']['endpoint'] = 'http://oohembed.com/oohembed/'; -- cgit v1.2.3-54-g00ecf From b58dc5e96117bdb4de899d37c6eb94ebf1c3dfe6 Mon Sep 17 00:00:00 2001 From: Robin Millette Date: Wed, 17 Jun 2009 16:55:01 -0400 Subject: Added config option to enable or disable file uploads with notices. --- README | 1 + config.php.sample | 1 + lib/common.php | 1 + lib/noticeform.php | 18 +++++++++++------- 4 files changed, 14 insertions(+), 7 deletions(-) (limited to 'config.php.sample') diff --git a/README b/README index 7b22e3c5e..5aa7270ee 100644 --- 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 diff --git a/config.php.sample b/config.php.sample index ed70f85fb..7649c5262 100644 --- a/config.php.sample +++ b/config.php.sample @@ -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/'; diff --git a/lib/common.php b/lib/common.php index 9c015a15d..bbd9f78c3 100644 --- a/lib/common.php +++ b/lib/common.php @@ -200,6 +200,7 @@ $config = 'file_quota' => 5000000, 'user_quota' => 50000000, 'monthly_quota' => 15000000, + 'uploads' => true, ), 'group' => array('maxaliases' => 3), diff --git a/lib/noticeform.php b/lib/noticeform.php index 0ad365856..a36b7f31f 100644 --- a/lib/noticeform.php +++ b/lib/noticeform.php @@ -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'); } -- cgit v1.2.3-54-g00ecf From 65457e73bfc8fe04ad57acce7800cd7640f30e7e Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Thu, 18 Jun 2009 10:49:45 -0700 Subject: Config option for bidirectional Twitter bridge --- config.php.sample | 3 +++ 1 file changed, 3 insertions(+) (limited to 'config.php.sample') diff --git a/config.php.sample b/config.php.sample index 7649c5262..529164108 100644 --- a/config.php.sample +++ b/config.php.sample @@ -153,6 +153,9 @@ $config['sphinx']['port'] = 3312; // Twitter integration source attribute. Note: default is Laconica // $config['integration']['source'] = 'Laconica'; +// Enable bidirectional Twitter bridge +// $config['twitterbridge']['enabled'] = true; + // Edit throttling. Off by default. If turned on, you can only post 20 notices // every 10 minutes. Admins may want to play with the settings to minimize inconvenience for // real users without getting uncontrollable floods from spammers or runaway bots. -- cgit v1.2.3-54-g00ecf From e506f82cdf8d88186c425a3f58e15b5126fdb248 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Thu, 18 Jun 2009 16:51:06 -0700 Subject: Better avatar handling - pull in any missing Twitter avatars --- config.php.sample | 3 +++ scripts/twitterstatusfetcher.php | 23 ++++++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) (limited to 'config.php.sample') diff --git a/config.php.sample b/config.php.sample index 529164108..d42bac9a6 100644 --- a/config.php.sample +++ b/config.php.sample @@ -154,6 +154,9 @@ $config['sphinx']['port'] = 3312; // $config['integration']['source'] = 'Laconica'; // Enable bidirectional Twitter bridge +// +// NOTE: if you enable this you must also set $config['avatar']['path'] +// // $config['twitterbridge']['enabled'] = true; // Edit throttling. Off by default. If turned on, you can only post 20 notices diff --git a/scripts/twitterstatusfetcher.php b/scripts/twitterstatusfetcher.php index 9287b6d73..93a4ce92b 100755 --- a/scripts/twitterstatusfetcher.php +++ b/scripts/twitterstatusfetcher.php @@ -38,6 +38,9 @@ define('SCRIPT_DEBUG', true); require_once(INSTALLDIR . '/lib/common.php'); require_once(INSTALLDIR . '/lib/daemon.php'); +// NOTE: an Avatar path MUST be set in config.php for this +// script to work: e.g.: $config['avatar']['path'] = '/laconica/avatar'; + class TwitterStatusFetcher extends Daemon { @@ -358,11 +361,11 @@ class TwitterStatusFetcher extends Daemon $oldname = $profile->getAvatar(48)->filename; - if ($newname != $oldname) { + if ($newname != $oldname || $this->missingAvatarFile($profile)) { if (defined('SCRIPT_DEBUG')) { common_debug('Avatar for Twitter user ' . - "$profile->nickname has changed."); + "$profile->nickname has changed, or was missing locally."); common_debug("old: $oldname new: $newname"); } @@ -383,6 +386,21 @@ class TwitterStatusFetcher extends Daemon } } + function missingAvatarFile($profile) { + + foreach (array(24, 48, 73) as $size) { + + $filename = $profile->getAvatar($size)->filename; + $avatarpath = Avatar::path($filename); + + if (file_exists($avatarpath) == FALSE) { + return true; + } + } + + return false; + } + function getMediatype($ext) { $mediatype = null; @@ -447,7 +465,6 @@ class TwitterStatusFetcher extends Daemon if (defined('SCRIPT_DEBUG')) { common_debug("Deleting $size avatar for $profile->nickname."); } - @unlink(INSTALLDIR . '/avatar/' . $avatar->filename); $avatar->delete(); } -- cgit v1.2.3-54-g00ecf