remove string-checks from code using Notice::saveNew()
This commit is contained in:
parent
0a57d1ccee
commit
89ac81c344
@ -255,13 +255,6 @@ class NewnoticeAction extends Action
|
|||||||
$notice = Notice::saveNew($user->id, $content_shortened, 'web', 1,
|
$notice = Notice::saveNew($user->id, $content_shortened, 'web', 1,
|
||||||
($replyto == 'false') ? null : $replyto);
|
($replyto == 'false') ? null : $replyto);
|
||||||
|
|
||||||
if (is_string($notice)) {
|
|
||||||
if (isset($filename)) {
|
|
||||||
$this->deleteFile($filename);
|
|
||||||
}
|
|
||||||
$this->clientError($notice);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($mimetype)) {
|
if (isset($mimetype)) {
|
||||||
$this->attachFile($notice, $fileRecord);
|
$this->attachFile($notice, $fileRecord);
|
||||||
}
|
}
|
||||||
|
@ -297,11 +297,6 @@ class TwitapistatusesAction extends TwitterapiAction
|
|||||||
html_entity_decode($status, ENT_NOQUOTES, 'UTF-8'),
|
html_entity_decode($status, ENT_NOQUOTES, 'UTF-8'),
|
||||||
$source, 1, $reply_to);
|
$source, 1, $reply_to);
|
||||||
|
|
||||||
if (is_string($notice)) {
|
|
||||||
$this->serverError($notice);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
common_broadcast_notice($notice);
|
common_broadcast_notice($notice);
|
||||||
$apidata['api_arg'] = $notice->id;
|
$apidata['api_arg'] = $notice->id;
|
||||||
}
|
}
|
||||||
|
@ -468,11 +468,11 @@ class FacebookAction extends Action
|
|||||||
|
|
||||||
$replyto = $this->trimmed('inreplyto');
|
$replyto = $this->trimmed('inreplyto');
|
||||||
|
|
||||||
|
try {
|
||||||
$notice = Notice::saveNew($user->id, $content,
|
$notice = Notice::saveNew($user->id, $content,
|
||||||
'web', 1, ($replyto == 'false') ? null : $replyto);
|
'web', 1, ($replyto == 'false') ? null : $replyto);
|
||||||
|
} catch (Exception $e) {
|
||||||
if (is_string($notice)) {
|
$this->showPage($e->getMessage());
|
||||||
$this->showPage($notice);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +156,6 @@ class StatusNetOAuthDataStore extends OAuthDataStore
|
|||||||
return $this->new_access_token($consumer);
|
return $this->new_access_token($consumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Revoke specified OAuth token
|
* Revoke specified OAuth token
|
||||||
*
|
*
|
||||||
@ -363,9 +362,7 @@ class StatusNetOAuthDataStore extends OAuthDataStore
|
|||||||
false,
|
false,
|
||||||
null,
|
null,
|
||||||
$omb_notice->getIdentifierURI());
|
$omb_notice->getIdentifierURI());
|
||||||
if (is_string($notice)) {
|
|
||||||
throw new Exception($notice);
|
|
||||||
}
|
|
||||||
common_broadcast_notice($notice, true);
|
common_broadcast_notice($notice, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,10 +260,11 @@ class MailerDaemon
|
|||||||
|
|
||||||
function add_notice($user, $msg, $fileRecords)
|
function add_notice($user, $msg, $fileRecords)
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
$notice = Notice::saveNew($user->id, $msg, 'mail');
|
$notice = Notice::saveNew($user->id, $msg, 'mail');
|
||||||
if (is_string($notice)) {
|
} catch (Exception $e) {
|
||||||
$this->log(LOG_ERR, $notice);
|
$this->log(LOG_ERR, $e->getMessage());
|
||||||
return $notice;
|
return $e->getMessage();
|
||||||
}
|
}
|
||||||
foreach($fileRecords as $fileRecord){
|
foreach($fileRecords as $fileRecord){
|
||||||
$this->attachFile($notice, $fileRecord);
|
$this->attachFile($notice, $fileRecord);
|
||||||
|
@ -323,12 +323,15 @@ class XMPPDaemon extends Daemon
|
|||||||
mb_strlen($content_shortened)));
|
mb_strlen($content_shortened)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
$notice = Notice::saveNew($user->id, $content_shortened, 'xmpp');
|
$notice = Notice::saveNew($user->id, $content_shortened, 'xmpp');
|
||||||
if (is_string($notice)) {
|
} catch (Exception $e) {
|
||||||
$this->log(LOG_ERR, $notice);
|
$this->log(LOG_ERR, $e->getMessage());
|
||||||
$this->from_site($user->jabber, $notice);
|
$this->from_site($user->jabber, $e->getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
common_broadcast_notice($notice);
|
common_broadcast_notice($notice);
|
||||||
$this->log(LOG_INFO,
|
$this->log(LOG_INFO,
|
||||||
'Added notice ' . $notice->id . ' from user ' . $user->nickname);
|
'Added notice ' . $notice->id . ' from user ' . $user->nickname);
|
||||||
|
Loading…
Reference in New Issue
Block a user