}
$notice = Notice::staticGet('uri', $notice_uri);
if (!$notice) {
- $notice = Notice::saveNew($remote_profile->id, $content, 'omb', 0);
+ $notice = Notice::saveNew($remote_profile->id, $content, 'omb', 0, $notice_uri);
if (is_string($notice)) {
common_server_serror($notice, 500);
return false;
}
return true;
}
-
- static function saveNew($profile_id, $content, $source=NULL, $is_local=1, $reply_to=NULL) {
+
+ static function saveNew($profile_id, $content, $source=NULL, $is_local=1, $reply_to=NULL, $uri=NULL) {
$notice = new Notice();
$notice->profile_id = $profile_id;
}
$orig = clone($notice);
- $notice->uri = common_notice_uri($notice);
+ if ($uri) {
+ $notice->uri = $uri;
+ } else {
+ $notice->uri = common_notice_uri($notice);
+ }
if (!$notice->update($orig)) {
return _('Problem saving notice.');
}
+ # XXX: do we need to change this for remote users?
+
common_save_replies($notice);
$notice->saveTags();
}
common_element_end('p');
$noticeurl = common_local_url('shownotice', array('notice' => $notice->id));
- # XXX: we need to figure this out better
- if ($notice->uri != $noticeurl && preg_match('/^http/', $notice->uri)) {
+ # XXX: we need to figure this out better. Is this right?
+ if (strcmp($notice->uri, $noticeurl) != 0 && preg_match('/^http/', $notice->uri)) {
$noticeurl = $notice->uri;
}
common_element_start('p', 'time');