summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/action.php7
-rw-r--r--lib/router.php11
-rw-r--r--lib/twitter.php14
3 files changed, 19 insertions, 13 deletions
diff --git a/lib/action.php b/lib/action.php
index 9c71a153d..2ba877c9c 100644
--- a/lib/action.php
+++ b/lib/action.php
@@ -819,11 +819,12 @@ class Action extends HTMLOutputter // lawsuit
}
if ($lm) {
header('Last-Modified: ' . date(DATE_RFC1123, $lm));
- $if_modified_since = $_SERVER['HTTP_IF_MODIFIED_SINCE'];
- if ($if_modified_since) {
+ if (array_key_exists('HTTP_IF_MODIFIED_SINCE', $_SERVER)) {
+ $if_modified_since = $_SERVER['HTTP_IF_MODIFIED_SINCE'];
$ims = strtotime($if_modified_since);
if ($lm <= $ims) {
- $if_none_match = $_SERVER['HTTP_IF_NONE_MATCH'];
+ $if_none_match = (array_key_exists('HTTP_IF_NONE_MATCH', $_SERVER)) ?
+ $_SERVER['HTTP_IF_NONE_MATCH'] : null;
if (!$if_none_match ||
!$etag ||
$this->_hasEtag($etag, $if_none_match)) {
diff --git a/lib/router.php b/lib/router.php
index 4b70c0150..1d1a5ba4c 100644
--- a/lib/router.php
+++ b/lib/router.php
@@ -153,6 +153,12 @@ class Router
array('action' => 'deletenotice'),
array('notice' => '[0-9]+'));
+ // conversation
+
+ $m->connect('conversation/:id',
+ array('action' => 'conversation'),
+ array('id' => '[0-9]+'));
+
$m->connect('message/new', array('action' => 'newmessage'));
$m->connect('message/new?to=:to', array('action' => 'newmessage'), array('to' => '[A-Za-z0-9_-]'));
$m->connect('message/:message',
@@ -276,21 +282,20 @@ class Router
'apiaction' => 'friendships'),
array('method' => 'exists(\.(xml|json|rss|atom))'));
-
// Social graph
$m->connect('api/friends/ids/:argument',
array('action' => 'api',
'apiaction' => 'statuses',
'method' => 'friendsIDs'));
-
+
foreach (array('xml', 'json') as $e) {
$m->connect('api/friends/ids.'.$e,
array('action' => 'api',
'apiaction' => 'statuses',
'method' => 'friendsIDs.'.$e));
}
-
+
$m->connect('api/followers/ids/:argument',
array('action' => 'api',
'apiaction' => 'statuses',
diff --git a/lib/twitter.php b/lib/twitter.php
index deb6fd276..8a54afb9c 100644
--- a/lib/twitter.php
+++ b/lib/twitter.php
@@ -210,7 +210,7 @@ function save_twitter_friends($user, $twitter_id, $screen_name, $password)
function is_twitter_bound($notice, $flink) {
// Check to see if notice should go to Twitter
- if (($flink->noticesync & FOREIGN_NOTICE_SEND)) {
+ if (!empty($flink) && ($flink->noticesync & FOREIGN_NOTICE_SEND)) {
// If it's not a Twitter-style reply, or if the user WANTS to send replies.
if (!preg_match('/^@[a-zA-Z0-9_]{1,15}\b/u', $notice->content) ||
@@ -218,7 +218,7 @@ function is_twitter_bound($notice, $flink) {
return true;
}
}
-
+
return false;
}
@@ -227,10 +227,10 @@ function broadcast_twitter($notice)
global $config;
$success = true;
- $flink = Foreign_link::getByUserID($notice->profile_id,
+ $flink = Foreign_link::getByUserID($notice->profile_id,
TWITTER_SERVICE);
-
- // XXX: Not sure WHERE to check whether a notice should go to
+
+ // XXX: Not sure WHERE to check whether a notice should go to
// Twitter. Should we even put in the queue if it shouldn't? --Zach
if (is_twitter_bound($notice, $flink)) {
@@ -245,7 +245,7 @@ function broadcast_twitter($notice)
$options = array(
CURLOPT_USERPWD => "$twitter_user:$twitter_password",
CURLOPT_POST => true,
- CURLOPT_POSTFIELDS =>
+ CURLOPT_POSTFIELDS =>
array(
'status' => $statustxt,
'source' => $config['integration']['source']
@@ -293,7 +293,7 @@ function broadcast_twitter($notice)
$success = false;
}
}
-
+
return $success;
}