$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);
{
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();
common_log_db_error($reply, 'INSERT', __FILE__);
// TRANS: Server exception thrown when a reply cannot be saved.
// TRANS: %1$d is a notice ID, %2$d is the ID of the mentioned user.
- throw new ServerException(sprintf(_("Could not save reply for %1$d, %2$d."), $this->id, $mentioned->id));
+ throw new ServerException(sprintf(_('Could not save reply for %1$d, %2$d.'), $this->id, $mentioned->id));
} else {
$replied[$mentioned->id] = 1;
self::blow('reply:stream:%d', $mentioned->id);
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));
{
// We always insert for the author so they don't
// have to wait
+ Event::handle('StartNoticeDistribute', array($this));
$user = User::staticGet('id', $this->profile_id);
if (!empty($user)) {