summaryrefslogtreecommitdiff
path: root/lib/ping.php
diff options
context:
space:
mode:
authorSiebrand Mazeland <s.mazeland@xs4all.nl>2010-10-30 13:47:19 +0200
committerSiebrand Mazeland <s.mazeland@xs4all.nl>2010-10-30 13:47:19 +0200
commit8391058ea409f02d12060e62c919752b58ba9a0c (patch)
treecceab52fe986bae05c9f8b3e3ee884e6c1fb194a /lib/ping.php
parent0c64df8cd9723e15e6d0a6ca7b339cabf2cd93c3 (diff)
Tabs to spaces, superfluous whitespace removed.
Diffstat (limited to 'lib/ping.php')
-rw-r--r--lib/ping.php75
1 files changed, 36 insertions, 39 deletions
diff --git a/lib/ping.php b/lib/ping.php
index abf1c4048..e1c7c748e 100644
--- a/lib/ping.php
+++ b/lib/ping.php
@@ -20,13 +20,12 @@
if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
function ping_broadcast_notice($notice) {
+ if ($notice->is_local != Notice::LOCAL_PUBLIC && $notice->is_local != Notice::LOCAL_NONPUBLIC) {
+ return true;
+ }
- if ($notice->is_local != Notice::LOCAL_PUBLIC && $notice->is_local != Notice::LOCAL_NONPUBLIC) {
- return true;
- }
-
- # Array of servers, URL => type
- $notify = common_config('ping', 'notify');
+ # Array of servers, URL => type
+ $notify = common_config('ping', 'notify');
try {
$profile = $notice->getProfile();
} catch (Exception $e) {
@@ -35,21 +34,21 @@ function ping_broadcast_notice($notice) {
common_log(LOG_ERR, "Exception getting notice profile: " . $e->getMessage());
return true;
}
- $tags = ping_notice_tags($notice);
+ $tags = ping_notice_tags($notice);
- foreach ($notify as $notify_url => $type) {
- switch ($type) {
- case 'xmlrpc':
- case 'extended':
- $req = xmlrpc_encode_request('weblogUpdates.ping',
- array($profile->nickname, # site name
- common_local_url('showstream',
- array('nickname' => $profile->nickname)),
- common_local_url('shownotice',
- array('notice' => $notice->id)),
- common_local_url('userrss',
- array('nickname' => $profile->nickname)),
- $tags));
+ foreach ($notify as $notify_url => $type) {
+ switch ($type) {
+ case 'xmlrpc':
+ case 'extended':
+ $req = xmlrpc_encode_request('weblogUpdates.ping',
+ array($profile->nickname, # site name
+ common_local_url('showstream',
+ array('nickname' => $profile->nickname)),
+ common_local_url('shownotice',
+ array('notice' => $notice->id)),
+ common_local_url('userrss',
+ array('nickname' => $profile->nickname)),
+ $tags));
$request = HTTPClient::start();
$request->setConfig('connect_timeout', common_config('ping', 'timeout'));
@@ -79,9 +78,8 @@ function ping_broadcast_notice($notice) {
"Ping success for $notify_url $notice->id");
}
break;
-
- case 'get':
- case 'post':
+ case 'get':
+ case 'post':
$args = array('name' => $profile->nickname,
'url' => common_local_url('showstream',
array('nickname' => $profile->nickname)),
@@ -108,26 +106,25 @@ function ping_broadcast_notice($notice) {
"'$result->body'");
}
break;
-
- default:
- common_log(LOG_WARNING, 'Unknown notify type for ' . $notify_url . ': ' . $type);
+ default:
+ common_log(LOG_WARNING, 'Unknown notify type for ' . $notify_url . ': ' . $type);
}
- }
+ }
return true;
}
function ping_notice_tags($notice) {
- $tag = new Notice_tag();
- $tag->notice_id = $notice->id;
- $tags = array();
- if ($tag->find()) {
- while ($tag->fetch()) {
- $tags[] = $tag->tag;
- }
- $tag->free();
- unset($tag);
- return implode('|', $tags);
- }
- return NULL;
+ $tag = new Notice_tag();
+ $tag->notice_id = $notice->id;
+ $tags = array();
+ if ($tag->find()) {
+ while ($tag->fetch()) {
+ $tags[] = $tag->tag;
+ }
+ $tag->free();
+ unset($tag);
+ return implode('|', $tags);
+ }
+ return NULL;
}