From 51ac34e80c5a99008b1a945b2c00b6dbfdde1529 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 26 Jul 2009 13:06:38 -0600 Subject: first version of deleting users --- classes/Profile.php | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++ classes/User.php | 43 ++++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+) diff --git a/classes/Profile.php b/classes/Profile.php index f926b2cef..0ee6fa657 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -461,4 +461,79 @@ class Profile extends Memcached_DataObject $c->delete(common_cache_key('profile:notice_count:'.$this->id)); } } + + function delete() + { + $this->_deleteNotices(); + $this->_deleteSubscriptions(); + $this->_deleteMessages(); + $this->_deleteTags(); + $this->_deleteBlocks(); + + $related = array('Avatar', + 'Reply', + 'Group_member', + ); + + foreach ($related as $cls) { + $inst = new $cls(); + $inst->profile_id = $this->id; + $inst->delete(); + } + + parent::delete(); + } + + function _deleteNotices() + { + $notice = new Notice(); + $notice->profile_id = $this->id; + + if ($notice->find()) { + while ($notice->fetch()) { + $other = clone($notice); + $other->delete(); + } + } + } + + function _deleteSubscriptions() + { + $sub = new Subscription(); + $sub->subscriber = $this->id; + $sub->delete(); + + $subd = new Subscription(); + $subd->subscribed = $this->id; + $subd->delete(); + } + + function _deleteMessages() + { + $msg = new Message(); + $msg->from_profile = $this->id; + $msg->delete(); + + $msg = new Message(); + $msg->to_profile = $this->id; + $msg->delete(); + } + + function _deleteTags() + { + $tag = new Profile_tag(); + $tag->tagged = $this->id; + $msg->delete(); + } + + function _deleteBlocks() + { + $block = new Profile_block(); + $block->blocked = $this->id; + $block->delete(); + + $block = new Group_block(); + $block->blocked = $this->id; + $block->delete(); + } } diff --git a/classes/User.php b/classes/User.php index bea47a3b0..991e9c18f 100644 --- a/classes/User.php +++ b/classes/User.php @@ -685,4 +685,47 @@ class User extends Memcached_DataObject { return Design::staticGet('id', $this->design_id); } + + function delete() + { + $profile = $this->getProfile(); + $profile->delete(); + + $related = array('Fave', + 'User_openid', + 'Confirm_address', + 'Remember_me', + 'Foreign_link', + 'Invitation', + ); + + if (common_config('inboxes', 'enabled')) { + $related[] = 'Notice_inbox'; + } + + foreach ($related as $cls) { + $inst = new $cls(); + $inst->user_id = $this->id; + $inst->delete(); + } + + $this->_deleteTags(); + + parent::delete(); + } + + function _deleteTags() + { + $tag = new Profile_tag(); + $tag->tagger = $this->id; + $tag->delete(); + } + + function _deleteBlocks() + { + $block = new Profile_block(); + $block->blocker = $this->id; + $block->delete(); + // XXX delete group block? Reset blocker? + } } -- cgit v1.2.3-54-g00ecf From 59f47fab4a00a4fc8f3dfd27367e248e4bcbd957 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 28 Aug 2009 10:42:34 -0700 Subject: Status_network had wrong ini file --- classes/Status_network.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/Status_network.php b/classes/Status_network.php index d526cb4d6..fe4f0b0c5 100644 --- a/classes/Status_network.php +++ b/classes/Status_network.php @@ -54,7 +54,7 @@ class Status_network extends DB_DataObject global $config; $config['db']['database_'.$dbname] = "mysqli://$dbuser:$dbpass@$dbhost/$dbname"; - $config['db']['ini_'.$dbname] = INSTALLDIR.'/classes/statusnet.ini'; + $config['db']['ini_'.$dbname] = INSTALLDIR.'/classes/status_network.ini'; $config['db']['table_status_network'] = $dbname; self::$cache = new Memcache(); -- cgit v1.2.3-54-g00ecf From 55972f59f6dd3048761f72c16e3fffac3fb29d47 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sat, 29 Aug 2009 11:59:54 -0700 Subject: remove Notice::gc() for now --- classes/Notice.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/classes/Notice.php b/classes/Notice.php index 89afe9d1d..7d0502626 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -897,7 +897,8 @@ class Notice extends Memcached_DataObject $qry .= '('.$id.', '.$this->id.', '.$source.", '".$this->created. "') "; $cnt++; if (rand() % NOTICE_INBOX_SOFT_LIMIT == 0) { - Notice_inbox::gc($id); + // FIXME: Causes lag in replicated servers + // Notice_inbox::gc($id); } if ($cnt >= MAX_BOXCARS) { $inbox = new Notice_inbox(); -- cgit v1.2.3-54-g00ecf From 84e11e8a1727404db558b2e9210f57b6f4f1786d Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Mon, 31 Aug 2009 15:33:23 -0400 Subject: Fix attachment saving --- lib/util.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/util.php b/lib/util.php index 87d5800f6..0b696662c 100644 --- a/lib/util.php +++ b/lib/util.php @@ -495,7 +495,7 @@ function callback_helper($matches, $callback, $notice_id) { if(empty($notice_id)){ $result = call_user_func_array($callback,$url); }else{ - $result = call_user_func_array($callback, array($url,$notice_id) ); + $result = call_user_func_array($callback, array(array($url,$notice_id)) ); } return substr($matches[0],0,$left) . $result . substr($matches[0],$right); } -- cgit v1.2.3-54-g00ecf From cae1072c0d5168c1e01c4ac00a8ee0ad735ff969 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Mon, 31 Aug 2009 15:49:11 -0400 Subject: Fix typo in Stomp Thanks Marcel|HSD --- extlib/Stomp.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extlib/Stomp.php b/extlib/Stomp.php index 9e1c97b3b..abd9cba62 100644 --- a/extlib/Stomp.php +++ b/extlib/Stomp.php @@ -454,7 +454,7 @@ class Stomp */ public function disconnect () { - $header = array(); + $headers = array(); if ($this->clientId != null) { $headers["client-id"] = $this->clientId; -- cgit v1.2.3-54-g00ecf From ba199ad4ec47e6b0c067a3b2a15882d3836ea009 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Mon, 31 Aug 2009 17:52:45 +0000 Subject: Removed
structure from MailboxAction::showMessage. Same as committ e0b877b26c5e93809b2a53b6c46326d5e31fa0e8. --- lib/mailbox.php | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/lib/mailbox.php b/lib/mailbox.php index a09bf1060..e1d384a06 100644 --- a/lib/mailbox.php +++ b/lib/mailbox.php @@ -213,26 +213,20 @@ class MailboxAction extends CurrentUserDesignAction } $this->elementStart('div', 'entry-content'); - $this->elementStart('dl', 'timestamp'); - $this->element('dt', null, _('Published')); - $this->elementStart('dd', null); - $dt = common_date_iso8601($message->created); $this->elementStart('a', array('rel' => 'bookmark', + 'class' => 'timestamp', 'href' => $messageurl)); + $dt = common_date_iso8601($message->created); $this->element('abbr', array('class' => 'published', 'title' => $dt), common_date_string($message->created)); $this->elementEnd('a'); - $this->elementEnd('dd'); - $this->elementEnd('dl'); if ($message->source) { - $this->elementStart('dl', 'device'); - $this->elementStart('dt'); - $this->text(_('From')); - $this->elementEnd('dt'); - $this->showSource($message->source); - $this->elementEnd('dl'); + $this->elementStart('span', 'source'); + $this->text(_('from')); + $this->element('span', 'device', $this->showSource($message->source)); + $this->elementEnd('span'); } $this->elementEnd('div'); @@ -277,18 +271,18 @@ class MailboxAction extends CurrentUserDesignAction case 'mail': case 'omb': case 'api': - $this->element('dd', null, $source_name); + $this->element('span', 'device', $source_name); break; default: $ns = Notice_source::staticGet($source); if ($ns) { - $this->elementStart('dd', null); + $this->elementStart('span', 'device'); $this->element('a', array('href' => $ns->url, - 'rel' => 'external'), - $ns->name); - $this->elementEnd('dd'); + 'rel' => 'external'), + $ns->name); + $this->elementEnd('span'); } else { - $this->element('dd', null, $source_name); + $this->out->element('span', 'device', $source_name); } break; } -- cgit v1.2.3-54-g00ecf From 0a922e0ba464975c2216f3df9163f08e786a5f3d Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Tue, 1 Sep 2009 19:00:18 +0000 Subject: Stop requeuing notices not bound for Twitter. --- lib/twitter.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/twitter.php b/lib/twitter.php index b734d22d8..e049dc8df 100644 --- a/lib/twitter.php +++ b/lib/twitter.php @@ -160,6 +160,8 @@ function broadcast_twitter($notice) return broadcast_basicauth($notice, $flink); } } + + return true; } function broadcast_oauth($notice, $flink) { -- cgit v1.2.3-54-g00ecf From 4c4fbd006d986bbc932938a37b7532d89a0e4166 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Sat, 29 Aug 2009 06:20:19 +0000 Subject: Fix error in log msg format specifier --- lib/twitter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/twitter.php b/lib/twitter.php index e049dc8df..455f7e7ef 100644 --- a/lib/twitter.php +++ b/lib/twitter.php @@ -196,7 +196,7 @@ function broadcast_oauth($notice, $flink) { $errmsg = sprintf('cURL error trying to send notice to Twitter ' . 'for user %1$s (user id: %2$s) - ' . - 'code: %3$s message: $4$s.', + 'code: %3$s message: %4$s.', $user->nickname, $user->id, $e->getCode(), $e->getMessage()); common_log(LOG_WARNING, $errmsg); @@ -254,7 +254,7 @@ function broadcast_basicauth($notice, $flink) $errmsg = sprintf('cURL error trying to send notice to Twitter ' . 'for user %1$s (user id: %2$s) - ' . - 'code: %3$s message: $4$s.', + 'code: %3$s message: %4$s.', $user->nickname, $user->id, $e->getCode(), $e->getMessage()); common_log(LOG_WARNING, $errmsg); -- cgit v1.2.3-54-g00ecf From e9bd6c8be5ffbc36f441fa9682c1fc608e33d3cf Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Wed, 2 Sep 2009 00:50:41 +0000 Subject: Better error handling --- lib/twitter.php | 100 ++++++++++++++++++++++++-------------------------------- 1 file changed, 42 insertions(+), 58 deletions(-) diff --git a/lib/twitter.php b/lib/twitter.php index 455f7e7ef..676c9b20a 100644 --- a/lib/twitter.php +++ b/lib/twitter.php @@ -175,34 +175,7 @@ function broadcast_oauth($notice, $flink) { try { $status = $client->statusesUpdate($statustxt); } catch (OAuthClientCurlException $e) { - - if ($e->getMessage() == 'The requested URL returned error: 401') { - - $errmsg = sprintf('User %1$s (user id: %2$s) has an invalid ' . - 'Twitter OAuth access token.', - $user->nickname, $user->id); - common_log(LOG_WARNING, $errmsg); - - // Bad auth token! We need to delete the foreign_link - // to Twitter and inform the user. - - remove_twitter_link($flink); - return true; - - } else { - - // Some other error happened, so we should probably - // try to send again later. - - $errmsg = sprintf('cURL error trying to send notice to Twitter ' . - 'for user %1$s (user id: %2$s) - ' . - 'code: %3$s message: %4$s.', - $user->nickname, $user->id, - $e->getCode(), $e->getMessage()); - common_log(LOG_WARNING, $errmsg); - - return false; - } + return process_error($e, $flink); } if (empty($status)) { @@ -210,9 +183,9 @@ function broadcast_oauth($notice, $flink) { // This could represent a failure posting, // or the Twitter API might just be behaving flakey. - $errmsg = sprintf('No data returned by Twitter API when ' . - 'trying to send update for %1$s (user id %2$s).', - $user->nickname, $user->id); + $errmsg = sprintf('Twitter bridge - No data returned by Twitter API when ' . + 'trying to send update for %1$s (user id %2$s).', + $user->nickname, $user->id); common_log(LOG_WARNING, $errmsg); return false; @@ -220,7 +193,7 @@ function broadcast_oauth($notice, $flink) { // Notice crossed the great divide - $msg = sprintf('Twitter bridge posted notice %s to Twitter using OAuth.', + $msg = sprintf('Twitter bridge - posted notice %s to Twitter using OAuth.', $notice->id); common_log(LOG_INFO, $msg); @@ -239,46 +212,57 @@ function broadcast_basicauth($notice, $flink) try { $status = $client->statusesUpdate($statustxt); } catch (BasicAuthCurlException $e) { - - if ($e->getMessage() == 'The requested URL returned error: 401') { - - $errmsg = sprintf('User %1$s (user id: %2$s) has an invalid ' . - 'Twitter screen_name/password combo.', - $user->nickname, $user->id); - common_log(LOG_WARNING, $errmsg); - - remove_twitter_link($flink); - return true; - - } else { - - $errmsg = sprintf('cURL error trying to send notice to Twitter ' . - 'for user %1$s (user id: %2$s) - ' . - 'code: %3$s message: %4$s.', - $user->nickname, $user->id, - $e->getCode(), $e->getMessage()); - common_log(LOG_WARNING, $errmsg); - - return false; - } + return process_error($e, $flink); } if (empty($status)) { - $errmsg = sprintf('No data returned by Twitter API when ' . - 'trying to send update for %1$s (user id %2$s).', - $user->nickname, $user->id); + $errmsg = sprintf('Twitter bridge - No data returned by Twitter API when ' . + 'trying to send update for %1$s (user id %2$s).', + $user->nickname, $user->id); common_log(LOG_WARNING, $errmsg); return false; } - $msg = sprintf('Twitter bridge posted notice %s to Twitter using basic auth.', + $msg = sprintf('Twitter bridge - posted notice %s to Twitter using basic auth.', $notice->id); common_log(LOG_INFO, $msg); return true; +} + +function process_error($e, $flink) +{ + $user = $flink->getUser(); + $errmsg = $e->getMessage(); + $delivered = false; + + switch($errmsg) { + case 'The requested URL returned error: 401': + $logmsg = sprintf('Twiter bridge - User %1$s (user id: %2$s) has an invalid ' . + 'Twitter screen_name/password combo or an invalid acesss token.', + $user->nickname, $user->id); + $delivered = true; + remove_twitter_link($flink); + break; + case 'The requested URL returned error: 403': + $logmsg = sprintf('Twitter bridge - User %1$s (user id: %2$s) has exceeded ' . + 'his/her Twitter request limit.', + $user->nickname, $user->id); + break; + default: + $logmsg = sprintf('Twitter bridge - cURL error trying to send notice to Twitter ' . + 'for user %1$s (user id: %2$s) - ' . + 'code: %3$s message: %4$s.', + $user->nickname, $user->id, + $e->getCode(), $e->getMessage()); + break; + } + + common_log(LOG_WARNING, $logmsg); + return $delivered; } function format_status($notice) -- cgit v1.2.3-54-g00ecf From aeef78b6ca9473f464bcd22cb9a56be373bdc845 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Wed, 2 Sep 2009 00:24:30 +0000 Subject: Fixed bug in which you cannot turn off importing friends timelines flag --- actions/twittersettings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actions/twittersettings.php b/actions/twittersettings.php index 563d867a4..89169941e 100644 --- a/actions/twittersettings.php +++ b/actions/twittersettings.php @@ -165,7 +165,7 @@ class TwittersettingsAction extends ConnectSettingsAction ($flink->noticesync & FOREIGN_NOTICE_RECV) : false); $this->elementEnd('li'); - + } else { // preserve setting even if bidrection bridge toggled off if ($flink && ($flink->noticesync & FOREIGN_NOTICE_RECV)) { -- cgit v1.2.3-54-g00ecf From 3504ef5721da743799776fb8c94c6416c2d1ba06 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Thu, 10 Sep 2009 12:11:33 -0400 Subject: Fix HTML validation --- doc-src/bookmarklet | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc-src/bookmarklet b/doc-src/bookmarklet index 6cd2c08f9..7958ea5e9 100644 --- a/doc-src/bookmarklet +++ b/doc-src/bookmarklet @@ -3,5 +3,5 @@ A bookmarklet is a small piece of javascript code used as a bookmark. This one w Drag-and-drop the following link to your bookmarks bar or right-click it and add it to your browser favorites to keep it handy. -Post to %%site.name%% +Post to %%site.name%% -- cgit v1.2.3-54-g00ecf From 584ea1b23c540cdd781f52eeecd6ad893f63c1a8 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Thu, 10 Sep 2009 12:13:43 -0400 Subject: Revert "If a shortened URL begins with http://, don't include it in the shortened url. Saves 7 characters, which is pretty awesome for 140 character max length notices." This reverts commit e2848eb8621dd645fa68cb1641c0af1df5530408. Downstream consumers of our notices (such as Friendfeed, Facebook, etc) don't have sophisticated URL detection, so a notice that reads: "check out ur1.ca/1" won't be linked. So the http:// prefix is mandatory. --- lib/util.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/util.php b/lib/util.php index 3e95d2bea..256acf199 100644 --- a/lib/util.php +++ b/lib/util.php @@ -1414,9 +1414,6 @@ function common_shorten_url($long_url) curl_close($curlh); - if(substr($short_url,0,7)=='http://'){ - $short_url = substr($short_url,7); - } return $short_url; } -- cgit v1.2.3-54-g00ecf From b46d2e7fe0b4129817d9c23006a5e2b7ffe5974c Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Thu, 10 Sep 2009 17:52:51 +0000 Subject: Markdown is not necessary --- doc-src/bookmarklet | 2 -- 1 file changed, 2 deletions(-) diff --git a/doc-src/bookmarklet b/doc-src/bookmarklet index 7958ea5e9..e5ded7702 100644 --- a/doc-src/bookmarklet +++ b/doc-src/bookmarklet @@ -2,6 +2,4 @@ A bookmarklet is a small piece of javascript code used as a bookmark. This one w Drag-and-drop the following link to your bookmarks bar or right-click it and add it to your browser favorites to keep it handy. - Post to %%site.name%% - -- cgit v1.2.3-54-g00ecf From 2a56245614f90221946ab918e820f6546133a212 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Thu, 10 Sep 2009 21:13:30 -0400 Subject: Re-use enclosure decision logic to decide if a link gets a paperclip/lightbox popup. --- lib/util.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/util.php b/lib/util.php index 256acf199..292045928 100644 --- a/lib/util.php +++ b/lib/util.php @@ -552,12 +552,13 @@ function common_linkify($url) { } if (!empty($f)) { - if (isset($f->filename)) { + if ($f->isEnclosure()) { $is_attachment = true; $attachment_id = $f->id; - } else { // if it has OEmbed info, it's an attachment, too + } else { $foe = File_oembed::staticGet('file_id', $f->id); if (!empty($foe)) { + // if it has OEmbed info, it's an attachment, too $is_attachment = true; $attachment_id = $f->id; -- cgit v1.2.3-54-g00ecf From 292bb7c4d8ca469447385e29a80f125e03284d70 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Thu, 10 Sep 2009 21:19:38 -0400 Subject: Allow @ signs in the path, querystring, and fragment parts of URLs --- lib/util.php | 6 +++--- tests/URLDetectionTest.php | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/util.php b/lib/util.php index 292045928..b831859e9 100644 --- a/lib/util.php +++ b/lib/util.php @@ -442,9 +442,9 @@ function common_replace_urls_callback($text, $callback, $notice_id = null) { ')'. '(?:'. '(?:\:\d+)?'. //:port - '(?:/[\pN\pL$\[\]\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\"]*)?'. // /path - '(?:\?[\pN\pL\$\[\]\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\"\/]*)?'. // ?query string - '(?:\#[\pN\pL$\[\]\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\"\/\?\#]*)?'. // #fragment + '(?:/[\pN\pL$\[\]\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\"@]*)?'. // /path + '(?:\?[\pN\pL\$\[\]\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\"@\/]*)?'. // ?query string + '(?:\#[\pN\pL$\[\]\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\"\@/\?\#]*)?'. // #fragment ')(?http://www.somesite.com/xyz/35637563@N00/52803365/ link'), array('http://127.0.0.1', 'http://127.0.0.1'), array('127.0.0.1', -- cgit v1.2.3-54-g00ecf From 2a06f2ac5bac02dea23b63c8d256a17f316039c1 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Thu, 10 Sep 2009 21:21:01 -0400 Subject: If there is no mimetype set, the file shouldn't be considered an enclosure --- classes/File.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/File.php b/classes/File.php index 96a4de6e8..308d0a771 100644 --- a/classes/File.php +++ b/classes/File.php @@ -201,7 +201,7 @@ class File extends Memcached_DataObject if(isset($this->filename)){ return true; } - $notEnclosureMimeTypes = array('text/html','application/xhtml+xml'); + $notEnclosureMimeTypes = array('text/html','application/xhtml+xml',null); $mimetype = strtolower($this->mimetype); $semicolon = strpos($mimetype,';'); if($semicolon){ -- cgit v1.2.3-54-g00ecf From 9e2705d9d3add426fae4ef998075dab72a736b34 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Fri, 11 Sep 2009 20:40:51 -0400 Subject: The site id was hardcoded inside the plugin code. Instead the piwikid is used now. Fixes http://status.net/trac/ticket/1864 Thanks zmf --- plugins/PiwikAnalyticsPlugin.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/PiwikAnalyticsPlugin.php b/plugins/PiwikAnalyticsPlugin.php index 85a24c132..45a11dfe4 100644 --- a/plugins/PiwikAnalyticsPlugin.php +++ b/plugins/PiwikAnalyticsPlugin.php @@ -96,7 +96,7 @@ document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/ja -EOT; - $action->raw($js_string); $action->script('plugins/Autocomplete/jquery-autocomplete/jquery.autocomplete.pack.js'); $action->script('plugins/Autocomplete/Autocomplete.js'); } @@ -59,5 +54,12 @@ EOT; } } + function onRouterInitialized($m) + { + if (common_logged_in()) { + $m->connect('plugins/Autocomplete/autocomplete.json', array('action'=>'autocomplete')); + } + } + } ?> diff --git a/plugins/Autocomplete/autocomplete.php b/plugins/Autocomplete/autocomplete.php new file mode 100644 index 000000000..96d54af8d --- /dev/null +++ b/plugins/Autocomplete/autocomplete.php @@ -0,0 +1,90 @@ +. + * + * @category Plugin + * @package StatusNet + * @author Craig Andrews + * @copyright 2008-2009 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +if (!defined('STATUSNET') && !defined('LACONICA')) { + exit(1); +} + +/** + * List users for autocompletion + * + * This is the form for adding a new g + * + * @category Plugin + * @package StatusNet + * @author Craig Andrews + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +class AutocompleteAction extends Action +{ + private $result; + + function prepare($args) + { + parent::prepare($args); + $this->results = array(); + $q = $this->arg('q'); + $limit = $this->arg('limit'); + if($limit > 200) $limit=200; //prevent DOS attacks + if(substr($q,0,1)=='@'){ + //user search + $q=substr($q,1); + $user = new User(); + $user->limit($limit); + $user->whereAdd('nickname like \'' . trim($user->escape($q), '\'') . '%\''); + $user->find(); + while($user->fetch()) { + $profile = Profile::pkeyGet(array('id' => $user->id)); + $this->results[]=array('nickname' => $user->nickname, 'fullname'=> $profile->fullname, 'type'=>'user'); + } + } + if(substr($q,0,1)=='!'){ + //group search + $q=substr($q,1); + $group = new User_group(); + $group->limit($limit); + $group->whereAdd('nickname like \'' . trim($group->escape($q), '\'') . '%\''); + $group->find(); + while($group->fetch()) { + $this->results[]=array('nickname' => $group->nickname, 'fullname'=> $group->fullname, 'type'=>'group'); + } + } + return true; + } + + function handle($args) + { + parent::handle($args); + foreach($this->results as $result) { + print json_encode($result) . "\n"; + } + } +} -- cgit v1.2.3-54-g00ecf From fe9473ac7810d317e001a0fec19cbacaafc0c909 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 1 Sep 2009 20:04:36 -0300 Subject: Check that 'dl' function is available and usable before trying to call it with error suppression; if it's disabled or unavailable we end up with mysterious failures during installation or loading of libraries. Fixed for StatusNet installer as well as some external libraries that should be fixed upstream if they haven't already been: * PEAR * Auth/OpenID * Auth/Yadis --- extlib/Auth/OpenID/BigMath.php | 2 +- extlib/Auth/Yadis/XML.php | 2 +- extlib/PEAR.php | 2 +- install.php | 17 ++++++++++++----- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/extlib/Auth/OpenID/BigMath.php b/extlib/Auth/OpenID/BigMath.php index 45104947d..b5fc627a0 100644 --- a/extlib/Auth/OpenID/BigMath.php +++ b/extlib/Auth/OpenID/BigMath.php @@ -376,7 +376,7 @@ function Auth_OpenID_detectMathLibrary($exts) // Try to load dynamic modules. if (!$loaded) { foreach ($extension['modules'] as $module) { - if (@dl($module . "." . PHP_SHLIB_SUFFIX)) { + if (function_exists('dl') && ini_get('enable_dl') && !ini_get('safe_mode') && @dl($module . "." . PHP_SHLIB_SUFFIX)) { $loaded = true; break; } diff --git a/extlib/Auth/Yadis/XML.php b/extlib/Auth/Yadis/XML.php index 4854f12bb..7232d6cbd 100644 --- a/extlib/Auth/Yadis/XML.php +++ b/extlib/Auth/Yadis/XML.php @@ -349,7 +349,7 @@ function &Auth_Yadis_getXMLParser() foreach ($extensions as $name => $params) { if (!extension_loaded($name)) { foreach ($params['libname'] as $libname) { - if (@dl($libname)) { + if (function_exists('dl') && ini_get('enable_dl') && !ini_get('safe_mode') && @dl($libname)) { $classname = $params['classname']; } } diff --git a/extlib/PEAR.php b/extlib/PEAR.php index 4c24c6006..fcefa964a 100644 --- a/extlib/PEAR.php +++ b/extlib/PEAR.php @@ -746,7 +746,7 @@ class PEAR { if (!extension_loaded($ext)) { // if either returns true dl() will produce a FATAL error, stop that - if ((ini_get('enable_dl') != 1) || (ini_get('safe_mode') == 1)) { + if ((ini_get('enable_dl') != 1) || (ini_get('safe_mode') == 1) || !function_exists('dl')) { return false; } if (OS_WINDOWS) { diff --git a/install.php b/install.php index c49043e5c..39984aa08 100644 --- a/install.php +++ b/install.php @@ -267,12 +267,19 @@ function checkPrereqs() function checkExtension($name) { - if (!extension_loaded($name)) { - if (!@dl($name.'.so')) { - return false; - } + if (extension_loaded($name)) { + return true; + } elseif (function_exists('dl') && ini_get('enable_dl') && !ini_get('safe_mode')) { + // dl will throw a fatal error if it's disabled or we're in safe mode. + // More fun, it may not even exist under some SAPIs in 5.3.0 or later... + $soname = $name . '.' . PHP_SHLIB_SUFFIX; + if (PHP_SHLIB_SUFFIX == 'dll') { + $soname = "php_" . $soname; + } + return @dl($soname); + } else { + return false; } - return true; } function showLibs() -- cgit v1.2.3-54-g00ecf From c93072ed8637d3686e071904f3247d2ddfc33ebe Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sun, 13 Sep 2009 18:15:49 -0700 Subject: Avoid or suppress E_NOTICE and E_WARNING messages related to the checklibs checks. * notice on main installer form checking for $_GET['checklibs'] * notices when seeing which module checks to run * warnings when attempting to load include files --- install.php | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/install.php b/install.php index 39984aa08..30dd34496 100644 --- a/install.php +++ b/install.php @@ -189,9 +189,9 @@ function main() return; } - if( $_GET['checklibs'] ){ + if (isset($_GET['checklibs'])) { showLibs(); - }else{ + } else { if ($_SERVER['REQUEST_METHOD'] == 'POST') { handlePost(); } else { @@ -202,7 +202,7 @@ function main() function haveExternalLibrary($external_library) { - if(isset($external_library['include']) && ! include_once($external_library['include'])){ + if(isset($external_library['include']) && ! haveIncludeFile($external_library['include'])){ return false; } if(isset($external_library['check_function']) && ! function_exists($external_library['check_function'])){ @@ -214,6 +214,15 @@ function haveExternalLibrary($external_library) return true; } +// Attempt to include a PHP file and report if it worked, while +// suppressing the annoying warning messages on failure. +function haveIncludeFile($filename) { + $old = error_reporting(error_reporting() & ~E_WARNING); + $ok = include_once($filename); + error_reporting($old); + return $ok; +} + function checkPrereqs() { $pass = true; @@ -308,19 +317,19 @@ E_O_T; foreach($absent_libraries as $library) { echo '
  • '; - if($library['url']){ + if(isset($library['url'])){ echo ''.htmlentities($library['name']).''; }else{ echo htmlentities($library['name']); } echo '
      '; - if($library['deb']){ + if(isset($library['deb'])){ echo '
    • deb: ' . htmlentities($library['deb']) . '
    • '; } - if($library['rpm']){ + if(isset($library['rpm'])){ echo '
    • rpm: ' . htmlentities($library['rpm']) . '
    • '; } - if($library['pear']){ + if(isset($library['pear'])){ echo '
    • pear: ' . htmlentities($library['pear']) . '
    • '; } echo '
    '; @@ -333,7 +342,7 @@ E_O_T; foreach($present_libraries as $library) { echo '
  • '; - if($library['url']){ + if(isset($library['url'])){ echo ''.htmlentities($library['name']).''; }else{ echo htmlentities($library['name']); -- cgit v1.2.3-54-g00ecf From bbab0c1fa6f6c14dec987a44700c09c157f1938d Mon Sep 17 00:00:00 2001 From: Christopher Vollick Date: Mon, 14 Sep 2009 08:44:58 -0400 Subject: Fixed Confusing Typo in Documentation. Subscribe != Unsubscribe. Also, my editor added a newline at the end because there wasn't one. --- doc-src/im | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc-src/im b/doc-src/im index c722a4e2c..631f6d9bb 100644 --- a/doc-src/im +++ b/doc-src/im @@ -37,10 +37,10 @@ currently-implemented commands: * **help**: Show this help. List available Jabber/XMPP commands * **follow <nickname>**: Subscribe to <nickname> * **sub <nickname>**: Same as follow -* **leave <nickname>**: Subscribe to <nickname> +* **leave <nickname>**: Unsubscribe from <nickname> * **unsub <nickname>**: Same as leave * **d <nickname> <text>**: Send direct message to <nickname> with message body <text> * **get <nickname>**: Get last notice from <nickname> * **last <nickname>**: Same as 'get' * **whois <nickname>**: Get Profile info on <nickname> -* **fav <nickname>**: Add user's last notice as a favorite \ No newline at end of file +* **fav <nickname>**: Add user's last notice as a favorite -- cgit v1.2.3-54-g00ecf From cf0d449fd8115313885a51ef02226d801cb952df Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Mon, 14 Sep 2009 15:14:48 +0200 Subject: Updated Cloudy theme --- theme/cloudy/css/display.css | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/theme/cloudy/css/display.css b/theme/cloudy/css/display.css index 3851bc057..3fe05eb3d 100644 --- a/theme/cloudy/css/display.css +++ b/theme/cloudy/css/display.css @@ -120,6 +120,10 @@ float:left; margin-left:11px; float:left; } +.form_settings .form_data textarea { +width:325px; +} + .form_settings .form_data input.submit { margin-left:0; } @@ -968,9 +972,6 @@ right:7px; top:47px; right:7px; } -.notice-options .notice_reply dt { -display:none; -} .notice-options input, .notice-options a { @@ -978,13 +979,13 @@ text-indent:-9999px; outline:none; } -.notice-options .notice_reply a, +.notice-options .notice_reply, .notice-options input.submit { display:block; border:0; } -.notice-options .notice_reply a, -.notice-options .notice_delete a { +.notice-options .notice_reply, +.notice-options .notice_delete { text-decoration:none; padding-left:16px; } @@ -1375,6 +1376,12 @@ padding-top:160px; #smssettings #form_notice, #twittersettings #form_notice, #imsettings #form_notice, +#userdesignsettings #form_notice, +#groupdesignsettings #form_notice, +#grouplogo #form_notice, +#editgroup #form_notice, +#blockedfromgroup #form_notice, +#groupmembers #form_notice, #doc #form_notice, #usergroups #form_notice, #invite #form_notice, @@ -1584,11 +1591,11 @@ background:transparent url(../../base/images/icons/twotone/green/clip-02.gif) no background:none; } -.notice-options .notice_reply a, +.notice-options .notice_reply, .notice-options form input.submit { background-color:transparent; } -.notice-options .notice_reply a { +.notice-options .notice_reply { background:transparent url(../images/icons/icon_reply.gif) no-repeat 0 45%; } .notice-options form.form_favor input.submit { @@ -1597,7 +1604,7 @@ background:transparent url(../images/icons/icon_favourite.gif) no-repeat 0 45%; .notice-options form.form_disfavor input.submit { background:transparent url(../images/icons/icon_disfavourite.gif) no-repeat 0 45%; } -.notice-options .notice_delete a { +.notice-options .notice_delete { background:transparent url(../images/icons/icon_trash.gif) no-repeat 0 45%; } -- cgit v1.2.3-54-g00ecf From a9cf185e692fdc9dea2a9b127826ea8e0f9f1021 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Tue, 15 Sep 2009 13:53:16 +0000 Subject: Updated XHR return markup for Realtime plugin --- plugins/Realtime/realtimeupdate.js | 42 +++++++++----------------------------- 1 file changed, 10 insertions(+), 32 deletions(-) diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index d55db5859..eba8ac1d9 100644 --- a/plugins/Realtime/realtimeupdate.js +++ b/plugins/Realtime/realtimeupdate.js @@ -1,8 +1,8 @@ // add a notice encoded as JSON into the current timeline // +// TODO: i18n RealtimeUpdate = { - _userid: 0, _replyurl: '', _favorurl: '', @@ -50,26 +50,15 @@ RealtimeUpdate = { "

    "+html+"

    "+ ""+ "
    "+ - "
    "+ - "
    Published
    "+ - "
    "+ - ""+ + ""+ "a few seconds ago"+ " "+ - "
    "+ - "
    "+ - "
    "+ - "
    From
    "+ - "
    "+source+"
    "+ // may have a link, I think - "
    "; - + ""+ + "from "+ + "+source+"++ // may have a link + ""; if (data['in_reply_to_status_id']) { - ni = ni+"
    "+ - "
    To
    "+ - "
    "+ - "in reply to"+ - "
    "+ - "
    "; + ni = ni+" in context"; } ni = ni+"
    "+ @@ -96,7 +85,7 @@ RealtimeUpdate = { ff = "
    "+ "
    "+ - "Favor this notice"+ // XXX: i18n + "Favor this notice"+ ""+ ""+ ""+ @@ -108,13 +97,7 @@ RealtimeUpdate = { makeReplyLink: function(id, nickname) { var rl; - rl = "
    "+ - "
    Reply to this notice
    "+ - "
    "+ - "Reply "+id+""+ - ""+ - "
    "+ - "
    "; + rl = "Reply "+id+""; return rl; }, @@ -123,12 +106,7 @@ RealtimeUpdate = { var dl, delurl; delurl = RealtimeUpdate._deleteurl.replace("0000000000", id); - dl = "
    "+ - "
    Delete this notice
    "+ - "
    "+ - "Delete"+ - "
    "+ - "
    "; + dl = "Delete"; return dl; }, -- cgit v1.2.3-54-g00ecf From 80ba0603c65e1f2365f019128b656a042a2b82d0 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Tue, 15 Sep 2009 12:59:32 -0700 Subject: Make it impossible to delete self-subscriptions via the API --- actions/twitapifriendships.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/actions/twitapifriendships.php b/actions/twitapifriendships.php index f2ea46910..eea8945c3 100644 --- a/actions/twitapifriendships.php +++ b/actions/twitapifriendships.php @@ -99,6 +99,12 @@ class TwitapifriendshipsAction extends TwitterapiAction $other = $this->get_profile($id); $user = $apidata['user']; // Alwyas the auth user + if ($user->id == $other->id) { + $this->clientError(_("You cannot unfollow yourself!"), + 403, $apidata['content-type']); + return; + } + $sub = new Subscription(); $sub->subscriber = $user->id; $sub->subscribed = $other->id; -- cgit v1.2.3-54-g00ecf From 12221f735eaf8a78b8a88841e38d9c7161afeb3c Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Tue, 15 Sep 2009 12:59:32 -0700 Subject: Make it impossible to delete self-subscriptions via the API --- actions/twitapifriendships.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/actions/twitapifriendships.php b/actions/twitapifriendships.php index f2ea46910..eea8945c3 100644 --- a/actions/twitapifriendships.php +++ b/actions/twitapifriendships.php @@ -99,6 +99,12 @@ class TwitapifriendshipsAction extends TwitterapiAction $other = $this->get_profile($id); $user = $apidata['user']; // Alwyas the auth user + if ($user->id == $other->id) { + $this->clientError(_("You cannot unfollow yourself!"), + 403, $apidata['content-type']); + return; + } + $sub = new Subscription(); $sub->subscriber = $user->id; $sub->subscribed = $other->id; -- cgit v1.2.3-54-g00ecf From 4a97ad9efeeb350159e1d0c82686d234ee0cdb12 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Tue, 15 Sep 2009 17:08:26 -0400 Subject: Remove unnecessary Profile::pkeyGet Thanks for the info, Evan. --- classes/Profile.php | 5 ----- plugins/Autocomplete/autocomplete.php | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/classes/Profile.php b/classes/Profile.php index c4fb3a543..6ad0e7a3a 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -47,11 +47,6 @@ class Profile extends Memcached_DataObject /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE - function &pkeyGet($kv) - { - return Memcached_DataObject::pkeyGet('Profile', $kv); - } - function getAvatar($width, $height=null) { if (is_null($height)) { diff --git a/plugins/Autocomplete/autocomplete.php b/plugins/Autocomplete/autocomplete.php index 96d54af8d..4379a86f2 100644 --- a/plugins/Autocomplete/autocomplete.php +++ b/plugins/Autocomplete/autocomplete.php @@ -62,7 +62,7 @@ class AutocompleteAction extends Action $user->whereAdd('nickname like \'' . trim($user->escape($q), '\'') . '%\''); $user->find(); while($user->fetch()) { - $profile = Profile::pkeyGet(array('id' => $user->id)); + $profile = Profile::staticGet($user->id); $this->results[]=array('nickname' => $user->nickname, 'fullname'=> $profile->fullname, 'type'=>'user'); } } -- cgit v1.2.3-54-g00ecf From 48565a2cdc9df329dee1ad327a1c632dd8f1d4c3 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 15 Sep 2009 17:08:27 -0400 Subject: Revert "Several fixes to make RabbitMQ a player." This reverts commit c04987018cd6c845c6da7a92d9857d8c651f7022. --- extlib/Stomp.php | 124 ++++++++++++++++++++-------------------------- extlib/Stomp/Frame.php | 87 ++++++++++++++++---------------- extlib/Stomp/Message.php | 6 +-- lib/stompqueuemanager.php | 5 +- 4 files changed, 99 insertions(+), 123 deletions(-) diff --git a/extlib/Stomp.php b/extlib/Stomp.php index c9e90629c..abd9cba62 100644 --- a/extlib/Stomp.php +++ b/extlib/Stomp.php @@ -26,7 +26,7 @@ require_once 'Stomp/Frame.php'; * * @package Stomp * @author Hiram Chirino - * @author Dejan Bosanac + * @author Dejan Bosanac * @author Michael Caplan * @version $Revision: 43 $ */ @@ -44,15 +44,15 @@ class Stomp * * @var int */ - public $prefetchSize = 1; - - /** + public $prefetchSize = 1; + + /** * Client id used for durable subscriptions * * @var string */ - public $clientId = null; - + public $clientId = null; + protected $_brokerUri = null; protected $_socket = null; protected $_hosts = array(); @@ -66,7 +66,7 @@ class Stomp protected $_sessionId; protected $_read_timeout_seconds = 60; protected $_read_timeout_milliseconds = 0; - + /** * Constructor * @@ -134,10 +134,10 @@ class Stomp require_once 'Stomp/Exception.php'; throw new Stomp_Exception("No broker defined"); } - + // force disconnect, if previous established connection exists $this->disconnect(); - + $i = $this->_currentHost; $att = 0; $connected = false; @@ -190,11 +190,11 @@ class Stomp if ($password != '') { $this->_password = $password; } - $headers = array('login' => $this->_username , 'passcode' => $this->_password); - if ($this->clientId != null) { - $headers["client-id"] = $this->clientId; - } - $frame = new Stomp_Frame("CONNECT", $headers); + $headers = array('login' => $this->_username , 'passcode' => $this->_password); + if ($this->clientId != null) { + $headers["client-id"] = $this->clientId; + } + $frame = new Stomp_Frame("CONNECT", $headers); $this->_writeFrame($frame); $frame = $this->readFrame(); if ($frame instanceof Stomp_Frame && $frame->command == 'CONNECTED') { @@ -209,7 +209,7 @@ class Stomp } } } - + /** * Check if client session has ben established * @@ -229,7 +229,7 @@ class Stomp return $this->_sessionId; } /** - * Send a message to a destination in the messaging system + * Send a message to a destination in the messaging system * * @param string $destination Destination queue * @param string|Stomp_Frame $msg Message @@ -237,7 +237,7 @@ class Stomp * @param boolean $sync Perform request synchronously * @return boolean */ - public function send ($destination, $msg, $properties = array(), $sync = null) + public function send ($destination, $msg, $properties = null, $sync = null) { if ($msg instanceof Stomp_Frame) { $msg->headers['destination'] = $destination; @@ -319,12 +319,10 @@ class Stomp public function subscribe ($destination, $properties = null, $sync = null) { $headers = array('ack' => 'client'); - // FIXME: this seems to be activemq specific, but not hurting rabbitmq? - $headers['activemq.prefetchSize'] = $this->prefetchSize; - if ($this->clientId != null) { - // FIXME: this seems to be activemq specific, but not hurting rabbitmq? - $headers["activemq.subcriptionName"] = $this->clientId; - } + $headers['activemq.prefetchSize'] = $this->prefetchSize; + if ($this->clientId != null) { + $headers["activemq.subcriptionName"] = $this->clientId; + } if (isset($properties)) { foreach ($properties as $name => $value) { $headers[$name] = $value; @@ -426,7 +424,7 @@ class Stomp } /** * Acknowledge consumption of a message from a subscription - * Note: This operation is always asynchronous + * Note: This operation is always asynchronous * * @param string|Stomp_Frame $messageMessage ID * @param string $transactionId @@ -435,26 +433,20 @@ class Stomp */ public function ack ($message, $transactionId = null) { - // Handle the headers, - $headers = array(); - if ($message instanceof Stomp_Frame) { - // Copy headers from the object - // FIXME: at least content-length can be wrong here (set to 3 sometimes). - $headers = $message->headers; + $frame = new Stomp_Frame('ACK', $message->headers); + $this->_writeFrame($frame); + return true; } else { + $headers = array(); if (isset($transactionId)) { $headers['transaction'] = $transactionId; } $headers['message-id'] = $message; + $frame = new Stomp_Frame('ACK', $headers); + $this->_writeFrame($frame); + return true; } - // An ACK has no content - $headers['content-length'] = 0; - - // Create it and write it out - $frame = new Stomp_Frame('ACK', $headers); - $this->_writeFrame($frame); - return true; } /** * Graceful disconnect from the server @@ -462,11 +454,11 @@ class Stomp */ public function disconnect () { - $headers = array(); + $headers = array(); - if ($this->clientId != null) { - $headers["client-id"] = $this->clientId; - } + if ($this->clientId != null) { + $headers["client-id"] = $this->clientId; + } if (is_resource($this->_socket)) { $this->_writeFrame(new Stomp_Frame('DISCONNECT', $headers)); @@ -498,19 +490,19 @@ class Stomp $this->_writeFrame($stompFrame); } } - + /** * Set timeout to wait for content to read * * @param int $seconds_to_wait Seconds to wait for a frame * @param int $milliseconds Milliseconds to wait for a frame */ - public function setReadTimeout($seconds, $milliseconds = 0) + public function setReadTimeout($seconds, $milliseconds = 0) { $this->_read_timeout_seconds = $seconds; $this->_read_timeout_milliseconds = $milliseconds; } - + /** * Read responce frame from server * @@ -521,29 +513,19 @@ class Stomp if (!$this->hasFrameToRead()) { return false; } - + $rb = 1024; $data = ''; - do { - $read = fread($this->_socket, $rb); - if ($read === false) { - $this->_reconnect(); - return $this->readFrame(); - } - $data .= $read; - $len = strlen($data); - - $continue = true; - // ActiveMq apparently add \n after 0 char - if($data[$len - 2] == "\x00" && $data[$len - 1] == "\n") { - $continue = false; - } - - // RabbitMq does not - if($data[$len - 1] == "\x00") { - $continue = false; - } - } while ( $continue ); + do { + $read = fgets($this->_socket, $rb); + if ($read === false) { + $this->_reconnect(); + return $this->readFrame(); + } + $data .= $read; + $len = strlen($data); + } while (($len < 2 || ! ($data[$len - 2] == "\x00" && $data[$len - 1] == "\n"))); + list ($header, $body) = explode("\n\n", $data, 2); $header = explode("\n", $header); $headers = array(); @@ -564,7 +546,7 @@ class Stomp return $frame; } } - + /** * Check if there is a frame to read * @@ -575,7 +557,7 @@ class Stomp $read = array($this->_socket); $write = null; $except = null; - + $has_frame_to_read = stream_select($read, $write, $except, $this->_read_timeout_seconds, $this->_read_timeout_milliseconds); if ($has_frame_to_read === false) { @@ -583,18 +565,18 @@ class Stomp } else if ($has_frame_to_read > 0) { return true; } else { - return false; + return false; } } - + /** * Reconnects and renews subscriptions (if there were any) - * Call this method when you detect connection problems + * Call this method when you detect connection problems */ protected function _reconnect () { $subscriptions = $this->_subscriptions; - + $this->connect($this->_username, $this->_password); foreach ($subscriptions as $dest => $properties) { $this->subscribe($dest, $properties); diff --git a/extlib/Stomp/Frame.php b/extlib/Stomp/Frame.php index 9fd97b4f5..dc59c1cb7 100644 --- a/extlib/Stomp/Frame.php +++ b/extlib/Stomp/Frame.php @@ -17,46 +17,46 @@ */ /* vim: set expandtab tabstop=3 shiftwidth=3: */ - -/** - * Stomp Frames are messages that are sent and received on a StompConnection. - * - * @package Stomp - * @author Hiram Chirino - * @author Dejan Bosanac - * @author Michael Caplan - * @version $Revision: 36 $ - */ -class Stomp_Frame -{ - public $command; - public $headers = array(); - public $body; - - /** - * Constructor - * - * @param string $command - * @param array $headers - * @param string $body - */ - public function __construct ($command = null, $headers = null, $body = null) - { - $this->_init($command, $headers, $body); - } - - protected function _init ($command = null, $headers = null, $body = null) - { - $this->command = $command; - if ($headers != null) { - $this->headers = $headers; - } - $this->body = $body; - - if ($this->command == 'ERROR') { - require_once 'Stomp/Exception.php'; - throw new Stomp_Exception($this->headers['message'], 0, $this->body); - } + +/** + * Stomp Frames are messages that are sent and received on a StompConnection. + * + * @package Stomp + * @author Hiram Chirino + * @author Dejan Bosanac + * @author Michael Caplan + * @version $Revision: 36 $ + */ +class Stomp_Frame +{ + public $command; + public $headers = array(); + public $body; + + /** + * Constructor + * + * @param string $command + * @param array $headers + * @param string $body + */ + public function __construct ($command = null, $headers = null, $body = null) + { + $this->_init($command, $headers, $body); + } + + protected function _init ($command = null, $headers = null, $body = null) + { + $this->command = $command; + if ($headers != null) { + $this->headers = $headers; + } + $this->body = $body; + + if ($this->command == 'ERROR') { + require_once 'Stomp/Exception.php'; + throw new Stomp_Exception($this->headers['message'], 0, $this->body); + } } /** @@ -74,8 +74,7 @@ class Stomp_Frame $data .= "\n"; $data .= $this->body; - $data .= "\x00\n"; // Should there really be a linefeed here? - return $data; - } -} + return $data .= "\x00\n"; + } +} ?> \ No newline at end of file diff --git a/extlib/Stomp/Message.php b/extlib/Stomp/Message.php index 055662133..6bcad3efd 100644 --- a/extlib/Stomp/Message.php +++ b/extlib/Stomp/Message.php @@ -29,12 +29,8 @@ require_once 'Stomp/Frame.php'; */ class Stomp_Message extends Stomp_Frame { - public function __construct ($body, $headers = array()) + public function __construct ($body, $headers = null) { - if(!isset($headers['content-length'])) { - // TODO: log this, to see if this is correct - $headers['content-length'] = strlen($body); - } $this->_init("SEND", $headers, $body); } } diff --git a/lib/stompqueuemanager.php b/lib/stompqueuemanager.php index 5d8b2996b..f059b42f0 100644 --- a/lib/stompqueuemanager.php +++ b/lib/stompqueuemanager.php @@ -141,11 +141,10 @@ class StompQueueManager $this->con->ack($frame); } else { if ($handler->handle_notice($notice)) { - $this->_log(LOG_INFO, 'Successfully handled notice '. $notice->id .' originally posted at ' . $notice->created . ' in queue '. $queue); - + $this->_log(LOG_INFO, 'Successfully handled notice '. $notice->id .' posted at ' . $frame->headers['created'] . ' in queue '. $queue); $this->con->ack($frame); } else { - $this->_log(LOG_WARNING, 'Failed handling notice '. $notice->id .' originally posted at ' . $notice->created . ' in queue '. $queue); + $this->_log(LOG_WARNING, 'Failed handling notice '. $notice->id .' posted at ' . $frame->headers['created'] . ' in queue '. $queue); // FIXME we probably shouldn't have to do // this kind of queue management ourselves $this->con->ack($frame); -- cgit v1.2.3-54-g00ecf From d7e13e847dbce55ad8ed017f02e1ac8420881e4e Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Tue, 15 Sep 2009 17:17:36 -0400 Subject: 304 responses should not have a Content-Length header. --- lib/action.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/action.php b/lib/action.php index 06cdbdfe0..ebef4f9e4 100644 --- a/lib/action.php +++ b/lib/action.php @@ -900,7 +900,6 @@ class Action extends HTMLOutputter // lawsuit !$etag || $this->_hasEtag($etag, $if_none_match)) { header('HTTP/1.1 304 Not Modified'); - header('Content-Length: 0'); // Better way to do this? exit(0); } @@ -919,7 +918,6 @@ class Action extends HTMLOutputter // lawsuit header('ETag: ' . $etag); if($if_none_match && $this->_hasEtag($etag, $if_none_match)) { header('HTTP/1.1 304 Not Modified'); - header('Content-Length: 0'); // Better way to do this? exit(0); } -- cgit v1.2.3-54-g00ecf From d2bf5761225835470d2dcc80fdba2149d1ed51cd Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Tue, 15 Sep 2009 14:37:11 -0700 Subject: Add Jiminy to notice sources --- db/notice_source.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/db/notice_source.sql b/db/notice_source.sql index f590d1b97..2657763f4 100644 --- a/db/notice_source.sql +++ b/db/notice_source.sql @@ -21,6 +21,7 @@ VALUES ('identichat','identichat','http://identichat.prosody.im/', now()), ('IdentiFox','IdentiFox','http://www.bitbucket.org/uncryptic/identifox/', now()), ('identitwitch','IdentiTwitch','http://richfish.org/identitwitch/', now()), + ('Jiminy','Jiminy','http://code.google.com/p/jiminy/', now()), ('LaTwit','LaTwit','http://latwit.mac65.com/', now()), ('LiveTweeter', 'LiveTweeter', 'http://addons.songbirdnest.com/addon/1204', now()), ('livetweeter', 'livetweeter', 'http://addons.songbirdnest.com/addon/1204', now()), -- cgit v1.2.3-54-g00ecf From c50ab7730acacd7a461e5509f7bcc259ac482a57 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Tue, 15 Sep 2009 14:37:11 -0700 Subject: Add Jiminy to notice sources --- db/notice_source.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/db/notice_source.sql b/db/notice_source.sql index f590d1b97..2657763f4 100644 --- a/db/notice_source.sql +++ b/db/notice_source.sql @@ -21,6 +21,7 @@ VALUES ('identichat','identichat','http://identichat.prosody.im/', now()), ('IdentiFox','IdentiFox','http://www.bitbucket.org/uncryptic/identifox/', now()), ('identitwitch','IdentiTwitch','http://richfish.org/identitwitch/', now()), + ('Jiminy','Jiminy','http://code.google.com/p/jiminy/', now()), ('LaTwit','LaTwit','http://latwit.mac65.com/', now()), ('LiveTweeter', 'LiveTweeter', 'http://addons.songbirdnest.com/addon/1204', now()), ('livetweeter', 'livetweeter', 'http://addons.songbirdnest.com/addon/1204', now()), -- cgit v1.2.3-54-g00ecf From c4ef2346b864b293fc4c4b02c72b07d18718d0cf Mon Sep 17 00:00:00 2001 From: Christopher Vollick Date: Wed, 16 Sep 2009 05:07:33 -0400 Subject: Pagination of user/tag was navigating to wrong page. Fixes bug #1736. --- actions/showstream.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/actions/showstream.php b/actions/showstream.php index 4d3067eed..89285b13c 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -380,8 +380,13 @@ class ShowstreamAction extends ProfileAction $this->showEmptyListMessage(); } + $args = array('nickname' => $this->user->nickname); + if (!empty($this->tag)) + { + $args['tag'] = $this->tag; + } $this->pagination($this->page>1, $cnt>NOTICES_PER_PAGE, $this->page, - 'showstream', array('nickname' => $this->user->nickname)); + 'showstream', $args); } function showAnonymousMessage() -- cgit v1.2.3-54-g00ecf From 6568a3202d3acfde694b359e2524d52d93dc83dd Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 16 Sep 2009 13:29:46 +0000 Subject: Fixed typo --- plugins/Realtime/realtimeupdate.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index eba8ac1d9..b2c8bb56d 100644 --- a/plugins/Realtime/realtimeupdate.js +++ b/plugins/Realtime/realtimeupdate.js @@ -55,7 +55,7 @@ RealtimeUpdate = { " "+ ""+ "from "+ - "+source+"++ // may have a link + "+source+"+ // may have a link ""; if (data['in_reply_to_status_id']) { ni = ni+" in context"; -- cgit v1.2.3-54-g00ecf From 75085a0df17c717ad7fd08334204885c75480076 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Fri, 11 Sep 2009 20:40:51 -0400 Subject: The site id was hardcoded inside the plugin code. Instead the piwikid is used now. Fixes http://status.net/trac/ticket/1864 Thanks zmf --- plugins/PiwikAnalyticsPlugin.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/PiwikAnalyticsPlugin.php b/plugins/PiwikAnalyticsPlugin.php index 85a24c132..45a11dfe4 100644 --- a/plugins/PiwikAnalyticsPlugin.php +++ b/plugins/PiwikAnalyticsPlugin.php @@ -96,7 +96,7 @@ document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/ja