diff options
author | Sarven Capadisli <csarven@csarven-laptop.(none)> | 2009-05-18 16:13:13 -0400 |
---|---|---|
committer | Sarven Capadisli <csarven@csarven-laptop.(none)> | 2009-05-18 16:13:13 -0400 |
commit | 0c28fdda62676bea352b58f05f66d83a92353a14 (patch) | |
tree | 281a51499fc26dc1e938799e2ce2dd88758cd747 /classes/Notice.php | |
parent | c25f8f29fa2a40be2aa36d332c4cfa6754f3333f (diff) | |
parent | 806200379d2e35a5cbf5ce4940474e1cbdd1f1a0 (diff) |
Merge branch '0.8.x' of git://gitorious.org/laconica/dev into 0.8.x
Diffstat (limited to 'classes/Notice.php')
-rw-r--r-- | classes/Notice.php | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/classes/Notice.php b/classes/Notice.php index 382d160ab..f6ac4f780 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -124,8 +124,6 @@ class Notice extends Memcached_DataObject $profile = Profile::staticGet($profile_id); - $final = common_shorten_links($content); - if (!$profile) { common_log(LOG_ERR, 'Problem saving notice. Unknown user.'); return _('Problem saving notice. Unknown user.'); @@ -136,7 +134,7 @@ class Notice extends Memcached_DataObject return _('Too many notices too fast; take a breather and post again in a few minutes.'); } - if (common_config('site', 'dupelimit') > 0 && !Notice::checkDupes($profile_id, $final)) { + if (common_config('site', 'dupelimit') > 0 && !Notice::checkDupes($profile_id, $content)) { common_log(LOG_WARNING, 'Dupe posting by profile #' . $profile_id . '; throttled.'); return _('Too many duplicate messages too quickly; take a breather and post again in a few minutes.'); } @@ -167,8 +165,8 @@ class Notice extends Memcached_DataObject $notice->reply_to = $reply_to; $notice->created = common_sql_now(); - $notice->content = $final; - $notice->rendered = common_render_content($final, $notice); + $notice->content = $content; + $notice->rendered = common_render_content($content, $notice); $notice->source = $source; $notice->uri = $uri; @@ -279,6 +277,16 @@ class Notice extends Memcached_DataObject return true; } + function hasAttachments() { + $post = clone $this; + $query = "select count(file_id) as n_attachments from file join file_to_post on (file_id = file.id) join notice on (post_id = notice.id) where post_id = " . $post->escape($post->id); + $post->query($query); + $post->fetch(); + $n_attachments = intval($post->n_attachments); + $post->free(); + return $n_attachments; + } + function blowCaches($blowLast=false) { $this->blowSubsCache($blowLast); |