summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/OStatus/classes/Ostatus_profile.php13
-rw-r--r--plugins/OpenID/User_openid.php14
-rw-r--r--plugins/TwitterBridge/twitter.php2
-rw-r--r--plugins/TwitterBridge/twitterauthorization.php13
-rw-r--r--plugins/TwitterBridge/twittersettings.php2
5 files changed, 38 insertions, 6 deletions
diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php
index fcca1a252..abc8100ce 100644
--- a/plugins/OStatus/classes/Ostatus_profile.php
+++ b/plugins/OStatus/classes/Ostatus_profile.php
@@ -428,10 +428,18 @@ class Ostatus_profile extends Memcached_DataObject
* Currently assumes that all items in the feed are new,
* coming from a PuSH hub.
*
- * @param DOMDocument $feed
+ * @param DOMDocument $doc
+ * @param string $source identifier ("push")
*/
- public function processFeed($feed, $source)
+ public function processFeed(DOMDocument $doc, $source)
{
+ $feed = $doc->documentElement;
+
+ if ($feed->localName != 'feed' || $feed->namespaceURI != Activity::ATOM) {
+ common_log(LOG_ERR, __METHOD__ . ": not an Atom feed, ignoring");
+ return;
+ }
+
$entries = $feed->getElementsByTagNameNS(Activity::ATOM, 'entry');
if ($entries->length == 0) {
common_log(LOG_ERR, __METHOD__ . ": no entries in feed update, ignoring");
@@ -449,6 +457,7 @@ class Ostatus_profile extends Memcached_DataObject
*
* @param DOMElement $entry
* @param DOMElement $feed for context
+ * @param string $source identifier ("push" or "salmon")
*/
public function processEntry($entry, $feed, $source)
{
diff --git a/plugins/OpenID/User_openid.php b/plugins/OpenID/User_openid.php
index 801b49ecc..5ef05b4c7 100644
--- a/plugins/OpenID/User_openid.php
+++ b/plugins/OpenID/User_openid.php
@@ -39,9 +39,21 @@ class User_openid extends Memcached_DataObject
);
}
+ /**
+ * List primary and unique keys in this table.
+ * Unique keys used for lookup *MUST* be listed to ensure proper caching.
+ */
function keys()
{
- return array('canonical' => 'K', 'display' => 'U');
+ return array('canonical' => 'K', 'display' => 'U', 'user_id' => 'U');
+ }
+
+ /**
+ * No sequence keys in this table.
+ */
+ function sequenceKey()
+ {
+ return array(false, false, false);
}
Static function hasOpenID($user_id)
diff --git a/plugins/TwitterBridge/twitter.php b/plugins/TwitterBridge/twitter.php
index ceb83b037..508699939 100644
--- a/plugins/TwitterBridge/twitter.php
+++ b/plugins/TwitterBridge/twitter.php
@@ -264,7 +264,7 @@ function remove_twitter_link($flink)
common_log(LOG_INFO, 'Removing Twitter bridge Foreign link for ' .
"user $user->nickname (user id: $user->id).");
- $result = $flink->delete();
+ $result = $flink->safeDelete();
if (empty($result)) {
common_log(LOG_ERR, 'Could not remove Twitter bridge ' .
diff --git a/plugins/TwitterBridge/twitterauthorization.php b/plugins/TwitterBridge/twitterauthorization.php
index c93f6666b..bc004cb95 100644
--- a/plugins/TwitterBridge/twitterauthorization.php
+++ b/plugins/TwitterBridge/twitterauthorization.php
@@ -273,7 +273,13 @@ class TwitterauthorizationAction extends Action
$flink->user_id = $user_id;
$flink->service = TWITTER_SERVICE;
- $flink->delete(); // delete stale flink, if any
+
+ // delete stale flink, if any
+ $result = $flink->find(true);
+
+ if (!empty($result)) {
+ $flink->safeDelete();
+ }
$flink->user_id = $user_id;
$flink->foreign_id = $twuid;
@@ -455,6 +461,11 @@ class TwitterauthorizationAction extends Action
$user = User::register($args);
+ if (empty($user)) {
+ $this->serverError(_('Error registering user.'));
+ return;
+ }
+
$result = $this->saveForeignLink($user->id,
$this->twuid,
$this->access_token);
diff --git a/plugins/TwitterBridge/twittersettings.php b/plugins/TwitterBridge/twittersettings.php
index 0137060e9..631b29f52 100644
--- a/plugins/TwitterBridge/twittersettings.php
+++ b/plugins/TwitterBridge/twittersettings.php
@@ -250,7 +250,7 @@ class TwittersettingsAction extends ConnectSettingsAction
$user = common_current_user();
$flink = Foreign_link::getByUserID($user->id, TWITTER_SERVICE);
- $result = $flink->delete();
+ $result = $flink->safeDelete();
if (empty($result)) {
common_log_db_error($flink, 'DELETE', __FILE__);