diff options
author | Eric Helgeson <erichelgeson@gmail.com> | 2009-07-21 09:20:47 -0500 |
---|---|---|
committer | Eric Helgeson <erichelgeson@gmail.com> | 2009-07-21 09:20:47 -0500 |
commit | db19d61e68fcf8398579c2c4968e73db7f7ed93b (patch) | |
tree | ca64284fb8544823de4a120bca8d45b424fb65b8 /lib | |
parent | c32e494c0c480e30317b0f0a8dcae7103c4ff89e (diff) | |
parent | fbb0df9f5436e956c43ace372f625f08628c000f (diff) |
Merge commit 'origin/0.8.x' into 0.9.x
Diffstat (limited to 'lib')
-rw-r--r-- | lib/daemon.php | 11 | ||||
-rw-r--r-- | lib/groupsbymemberssection.php | 2 | ||||
-rw-r--r-- | lib/groupsbypostssection.php | 2 | ||||
-rw-r--r-- | lib/grouptagcloudsection.php | 2 | ||||
-rw-r--r-- | lib/messageform.php | 6 | ||||
-rw-r--r-- | lib/popularnoticesection.php | 6 | ||||
-rw-r--r-- | lib/queuehandler.php | 11 | ||||
-rw-r--r-- | lib/router.php | 9 | ||||
-rw-r--r-- | lib/rssaction.php | 16 | ||||
-rw-r--r-- | lib/twitterapi.php | 69 |
10 files changed, 100 insertions, 34 deletions
diff --git a/lib/daemon.php b/lib/daemon.php index 9d89c63e7..231f5414e 100644 --- a/lib/daemon.php +++ b/lib/daemon.php @@ -24,6 +24,7 @@ if (!defined('LACONICA')) { class Daemon { var $daemonize = true; + var $_id = 'generic'; function __construct($daemonize = true) { @@ -35,6 +36,16 @@ class Daemon return null; } + function get_id() + { + return $this->_id; + } + + function set_id($id) + { + $this->_id = $id; + } + function background() { $pid = pcntl_fork(); diff --git a/lib/groupsbymemberssection.php b/lib/groupsbymemberssection.php index 963e21f15..ad4884bf8 100644 --- a/lib/groupsbymemberssection.php +++ b/lib/groupsbymemberssection.php @@ -48,7 +48,7 @@ class GroupsByMembersSection extends GroupSection $qry = 'SELECT user_group.*, count(*) as value ' . 'FROM user_group JOIN group_member '. 'ON user_group.id = group_member.group_id ' . - 'GROUP BY user_group.id,user_group.nickname,user_group.fullname,user_group.homepage,user_group.description,user_group.location,user_group.original_logo,user_group.homepage_logo,user_group.stream_logo,user_group.mini_logo,user_group.created,user_group.modified ' . + 'GROUP BY user_group.id,user_group.nickname,user_group.fullname,user_group.homepage,user_group.description,user_group.location,user_group.original_logo,user_group.homepage_logo,user_group.stream_logo,user_group.mini_logo,user_group.created,user_group.modified,user_group.design_id ' . 'ORDER BY value DESC '; $limit = GROUPS_PER_SECTION; diff --git a/lib/groupsbypostssection.php b/lib/groupsbypostssection.php index 325b4033f..dc7925d5e 100644 --- a/lib/groupsbypostssection.php +++ b/lib/groupsbypostssection.php @@ -48,7 +48,7 @@ class GroupsByPostsSection extends GroupSection $qry = 'SELECT user_group.*, count(*) as value ' . 'FROM user_group JOIN group_inbox '. 'ON user_group.id = group_inbox.group_id ' . - 'GROUP BY user_group.id,user_group.nickname,user_group.fullname,user_group.homepage,user_group.description,user_group.location,user_group.original_logo,user_group.homepage_logo,user_group.stream_logo,user_group.mini_logo,user_group.created,user_group.modified ' . + 'GROUP BY user_group.id,user_group.nickname,user_group.fullname,user_group.homepage,user_group.description,user_group.location,user_group.original_logo,user_group.homepage_logo,user_group.stream_logo,user_group.mini_logo,user_group.created,user_group.modified,user_group.design_id ' . 'ORDER BY value DESC '; $limit = GROUPS_PER_SECTION; diff --git a/lib/grouptagcloudsection.php b/lib/grouptagcloudsection.php index 9b7a10f6b..0e0cbdd63 100644 --- a/lib/grouptagcloudsection.php +++ b/lib/grouptagcloudsection.php @@ -73,7 +73,7 @@ class GroupTagCloudSection extends TagCloudSection $quoted = array(); foreach ($names as $name) { - $quoted[] = "\"$name\""; + $quoted[] = "'$name'"; } $namestring = implode(',', $quoted); diff --git a/lib/messageform.php b/lib/messageform.php index b8878ec1f..8ea2b36c2 100644 --- a/lib/messageform.php +++ b/lib/messageform.php @@ -140,6 +140,12 @@ class MessageForm extends Form 'rows' => 4, 'name' => 'content'), ($this->content) ? $this->content : ''); + $this->out->elementStart('dl', 'form_note'); + $this->out->element('dt', null, _('Available characters')); + $this->out->element('dd', array('id' => 'notice_text-count'), + '140'); + $this->out->elementEnd('dl'); + } /** diff --git a/lib/popularnoticesection.php b/lib/popularnoticesection.php index e47c9b385..167a6ff8d 100644 --- a/lib/popularnoticesection.php +++ b/lib/popularnoticesection.php @@ -74,11 +74,7 @@ class PopularNoticeSection extends NoticeSection $offset = 0; $limit = NOTICES_PER_SECTION + 1; - if (common_config('db', 'type') == 'pgsql') { - $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset; - } else { - $qry .= ' LIMIT ' . $offset . ', ' . $limit; - } + $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset; $notice = Memcached_DataObject::cachedQuery('Notice', sprintf($qry, common_config('popular', 'dropoff')), diff --git a/lib/queuehandler.php b/lib/queuehandler.php index c2ff10f32..f11e5bd90 100644 --- a/lib/queuehandler.php +++ b/lib/queuehandler.php @@ -29,7 +29,6 @@ define('QUEUE_HANDLER_HIT_IDLE', 0); class QueueHandler extends Daemon { - var $_id = 'generic'; function __construct($id=null, $daemonize=true) { @@ -55,16 +54,6 @@ class QueueHandler extends Daemon return strtolower($this->class_name().'.'.$this->get_id()); } - function get_id() - { - return $this->_id; - } - - function set_id($id) - { - $this->_id = $id; - } - function transport() { return null; diff --git a/lib/router.php b/lib/router.php index e12138637..5e0fcfc94 100644 --- a/lib/router.php +++ b/lib/router.php @@ -129,6 +129,11 @@ class Router $m->connect('index.php?action=' . $action, array('action' => $action)); } + $m->connect('main/:method', + array('action' => 'api', + 'method' => 'oembed(.xml|.json)?', + 'apiaction' => 'oembed')); + // settings foreach (array('profile', 'avatar', 'password', 'openid', 'im', @@ -394,6 +399,10 @@ class Router array('action' => 'api', 'apiaction' => 'laconica')); + $m->connect('api/laconica/:method', + array('action' => 'api', + 'apiaction' => 'laconica')); + // Groups $m->connect('api/laconica/groups/:method/:argument', array('action' => 'api', diff --git a/lib/rssaction.php b/lib/rssaction.php index ffa1f9e99..901558943 100644 --- a/lib/rssaction.php +++ b/lib/rssaction.php @@ -39,6 +39,7 @@ class Rss10Action extends Action var $creators = array(); var $limit = DEFAULT_RSS_LIMIT; var $notices = null; + var $tags_already_output = array(); /** * Constructor @@ -234,6 +235,11 @@ class Rss10Action extends Action $replyurl = common_local_url('shownotice', array('notice' => $notice->reply_to)); $this->element('sioc:reply_of', array('rdf:resource' => $replyurl)); } + if (!empty($notice->conversation)) { + $conversationurl = common_local_url('conversation', + array('id' => $notice->conversation)); + $this->element('sioc:has_discussion', array('rdf:resource' => $conversationurl)); + } $attachments = $notice->attachments(); if($attachments){ foreach($attachments as $attachment){ @@ -268,6 +274,12 @@ class Rss10Action extends Action foreach ($tags as $tag) { $tagpage = common_local_url('tag', array('tag' => $tag)); + + if ( in_array($tag, $this->tags_already_output) ) { + $this->element('ctag:tagged', array('rdf:resource'=>$tagpage.'#concept')); + continue; + } + $tagrss = common_local_url('tagrss', array('tag' => $tag)); $this->elementStart('ctag:tagged'); $this->elementStart('ctag:Tag', array('rdf:about'=>$tagpage.'#concept', 'ctag:label'=>$tag)); @@ -275,6 +287,8 @@ class Rss10Action extends Action $this->element('rdfs:seeAlso', array('rdf:resource'=>$tagrss)); $this->elementEnd('ctag:Tag'); $this->elementEnd('ctag:tagged'); + + $this->tags_already_output[] = $tag; } } $this->elementEnd('item'); @@ -320,6 +334,8 @@ class Rss10Action extends Action 'http://rdfs.org/sioc/ns#', 'xmlns:sioct' => 'http://rdfs.org/sioc/types#', + 'xmlns:rdfs' => + 'http://www.w3.org/2000/01/rdf-schema#', 'xmlns:laconica' => 'http://laconi.ca/ont/', 'xmlns' => 'http://purl.org/rss/1.0/')); diff --git a/lib/twitterapi.php b/lib/twitterapi.php index 749083c7c..79da82a19 100644 --- a/lib/twitterapi.php +++ b/lib/twitterapi.php @@ -186,21 +186,24 @@ class TwitterapiAction extends Action $twitter_status['favorited'] = false; } - # Enclosures + // Enclosures $attachments = $notice->attachments(); - $twitter_status['attachments']=array(); - if($attachments){ - foreach($attachments as $attachment){ - if ($attachment->isEnclosure()) { - $enclosure=array(); - $enclosure['url']=$attachment->url; - $enclosure['mimetype']=$attachment->mimetype; - $enclosure['size']=$attachment->size; - $twitter_status['attachments'][]=$enclosure; - } + $enclosures = array(); + + foreach ($attachments as $attachment) { + if ($attachment->isEnclosure()) { + $enclosure = array(); + $enclosure['url'] = $attachment->url; + $enclosure['mimetype'] = $attachment->mimetype; + $enclosure['size'] = $attachment->size; + $enclosures[] = $enclosure; } } + if (!empty($enclosures)) { + $twitter_status['attachments'] = $enclosures; + } + if ($include_user) { # Don't get notice (recursive!) $twitter_user = $this->twitter_user_array($profile, false); @@ -215,7 +218,7 @@ class TwitterapiAction extends Action $profile = $notice->getProfile(); $entry = array(); - # We trim() to avoid extraneous whitespace in the output + // We trim() to avoid extraneous whitespace in the output $entry['content'] = common_xml_safe_str(trim($notice->rendered)); $entry['title'] = $profile->nickname . ': ' . common_xml_safe_str(trim($notice->content)); @@ -228,7 +231,26 @@ class TwitterapiAction extends Action $entry['updated'] = $entry['published']; $entry['author'] = $profile->getBestName(); - # Enclosure + // Enclosures + $attachments = $notice->attachments(); + $enclosures = array(); + + foreach ($attachments as $attachment) { + if ($attachment->isEnclosure()) { + $enclosure = array(); + $enclosure['url'] = $attachment->url; + $enclosure['mimetype'] = $attachment->mimetype; + $enclosure['size'] = $attachment->size; + $enclosures[] = $enclosure; + } + } + + if (!empty($enclosures)) { + $entry['enclosures'] = $enclosures; + } + +/* + // Enclosure $attachments = $notice->attachments(); if($attachments){ $entry['enclosures']=array(); @@ -242,8 +264,8 @@ class TwitterapiAction extends Action } } } - - # RSS Item specific +*/ + // RSS Item specific $entry['description'] = $entry['content']; $entry['pubDate'] = common_date_rfc2822($notice->created); $entry['guid'] = $entry['link']; @@ -369,6 +391,9 @@ class TwitterapiAction extends Action case 'text': $this->element($element, null, common_xml_safe_str($value)); break; + case 'attachments': + $this->show_xml_attachments($twitter_status['attachments']); + break; default: $this->element($element, null, $value); } @@ -389,6 +414,20 @@ class TwitterapiAction extends Action $this->elementEnd($role); } + function show_xml_attachments($attachments) { + if (!empty($attachments)) { + $this->elementStart('attachments', array('type' => 'array')); + foreach ($attachments as $attachment) { + $attrs = array(); + $attrs['url'] = $attachment['url']; + $attrs['mimetype'] = $attachment['mimetype']; + $attrs['size'] = $attachment['size']; + $this->element('enclosure', $attrs, ''); + } + $this->elementEnd('attachments'); + } + } + function show_twitter_rss_item($entry) { $this->elementStart('item'); |