diff options
Diffstat (limited to 'classes/Notice.php')
-rw-r--r-- | classes/Notice.php | 49 |
1 files changed, 40 insertions, 9 deletions
diff --git a/classes/Notice.php b/classes/Notice.php index 60989f9ba..dd9438f16 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -476,7 +476,9 @@ class Notice extends Memcached_DataObject * @return void */ function saveUrls() { - common_replace_urls_callback($this->content, array($this, 'saveUrl'), $this->id); + if (common_config('attachments', 'process_links')) { + common_replace_urls_callback($this->content, array($this, 'saveUrl'), $this->id); + } } /** @@ -489,9 +491,11 @@ class Notice extends Memcached_DataObject */ function saveKnownUrls($urls) { - // @fixme validation? - foreach (array_unique($urls) as $url) { - File::processNew($url, $this->id); + if (common_config('attachments', 'process_links')) { + // @fixme validation? + foreach (array_unique($urls) as $url) { + File::processNew($url, $this->id); + } } } @@ -524,10 +528,8 @@ class Notice extends Memcached_DataObject $notice = new Notice(); $notice->profile_id = $profile_id; $notice->content = $content; - if (common_config('db','type') == 'pgsql') - $notice->whereAdd('extract(epoch from now() - created) < ' . common_config('site', 'dupelimit')); - else - $notice->whereAdd('now() - created < ' . common_config('site', 'dupelimit')); + $threshold = common_sql_date(time() - common_config('site', 'dupelimit')); + $notice->whereAdd(sprintf("created > '%s'", $notice->escape($threshold))); $cnt = $notice->count(); return ($cnt == 0); @@ -904,7 +906,7 @@ class Notice extends Memcached_DataObject { if (!is_array($group_ids)) { // TRANS: Server exception thrown when no array is provided to the method saveKnownGroups(). - throw new ServerException(_("Bad type provided to saveKnownGroups")); + throw new ServerException(_('Bad type provided to saveKnownGroups.')); } $groups = array(); @@ -1613,6 +1615,35 @@ class Notice extends Memcached_DataObject Event::handle('EndActivityGeo', array(&$this, &$xs, $lat, $lon)); } + // @fixme check this logic + + if ($this->isLocal()) { + + $selfUrl = common_local_url('ApiStatusesShow', array('id' => $this->id, + 'format' => 'atom')); + + if (Event::handle('StartActivityRelSelf', array(&$this, &$xs, &$selfUrl))) { + $xs->element('link', array('rel' => 'self', + 'type' => 'application/atom+xml', + 'href' => $selfUrl)); + Event::handle('EndActivityRelSelf', array(&$this, &$xs, $selfUrl)); + } + + if (!empty($cur) && $cur->id == $this->profile_id) { + + // note: $selfUrl may have been changed by a plugin + $relEditUrl = common_local_url('ApiStatusesShow', array('id' => $this->id, + 'format' => 'atom')); + + if (Event::handle('StartActivityRelEdit', array(&$this, &$xs, &$relEditUrl))) { + $xs->element('link', array('rel' => 'edit', + 'type' => 'application/atom+xml', + 'href' => $relEditUrl)); + Event::handle('EndActivityRelEdit', array(&$this, &$xs, $relEditUrl)); + } + } + } + if (Event::handle('StartActivityEnd', array(&$this, &$xs))) { $xs->elementEnd('entry'); Event::handle('EndActivityEnd', array(&$this, &$xs)); |