summaryrefslogtreecommitdiff
path: root/classes/Notice.php
diff options
context:
space:
mode:
authorZach Copley <zach@controlyourself.ca>2008-12-10 14:13:37 -0500
committerZach Copley <zach@controlyourself.ca>2008-12-10 14:13:37 -0500
commit1e4e6eee32c48eaac7f606b5558b7214451de4c9 (patch)
treeaf45bd03aecfa14448ddca3e3d59bd7992c71cfb /classes/Notice.php
parent8b15411865b216f20b4f029a94310a12ab59ddc1 (diff)
Ban certain users from posting by nickname and/or ID
darcs-hash:20081210191337-7b5ce-f9a083596b3f5627405c9e233c1994d8338f5731.gz
Diffstat (limited to 'classes/Notice.php')
-rw-r--r--classes/Notice.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/classes/Notice.php b/classes/Notice.php
index 77e0948dc..031ccd583 100644
--- a/classes/Notice.php
+++ b/classes/Notice.php
@@ -92,7 +92,10 @@ class Notice extends Memcached_DataObject
}
static function saveNew($profile_id, $content, $source=NULL, $is_local=1, $reply_to=NULL, $uri=NULL) {
- if (!Profile::staticGet($profile_id)) {
+
+ $profile = Profile::staticGet($profile_id);
+
+ if (!$profile) {
common_log(LOG_ERR, 'Problem saving notice. Unknown user.');
return _('Problem saving notice. Unknown user.');
}
@@ -102,6 +105,13 @@ class Notice extends Memcached_DataObject
return _('Too many notices too fast; take a breather and post again in a few minutes.');
}
+ $banned = common_config('profile', 'banned');
+
+ if ( in_array($profile_id, $banned) || in_array($profile->nickname, $banned)) {
+ common_log(LOG_WARNING, "Attempted post from banned user: $profile->nickname (user id = $profile_id).");
+ return _('You are banned from posting notices on this site.');
+ }
+
$notice = new Notice();
$notice->profile_id = $profile_id;