summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-04-23 03:22:37 -0400
committerEvan Prodromou <evan@controlyourself.ca>2009-04-23 03:22:37 -0400
commit77c5aecaf5764ad0bfc6f95e5320def61d859c37 (patch)
treea4d6573e99081f3e4bafdac56a95f432d1c00692 /lib
parent546ab05dba507b67f40eff9aa17f684e2f9f244b (diff)
parentaf89dcadee63f4de1546abc6cebd50948b4bc42c (diff)
Merge branch 'dev/0.8.x' into 0.8.x
Diffstat (limited to 'lib')
-rw-r--r--lib/personalgroupnav.php68
-rw-r--r--lib/searchaction.php2
-rw-r--r--lib/subpeopletagcloudsection.php76
-rw-r--r--lib/subscriberspeopleselftagcloudsection.php54
-rw-r--r--lib/subscriberspeopletagcloudsection.php60
-rw-r--r--lib/subscriptionspeopleselftagcloudsection.php54
-rw-r--r--lib/subscriptionspeopletagcloudsection.php59
-rw-r--r--lib/twitterapi.php2
-rw-r--r--lib/util.php1
9 files changed, 341 insertions, 35 deletions
diff --git a/lib/personalgroupnav.php b/lib/personalgroupnav.php
index 63e6138df..acc033667 100644
--- a/lib/personalgroupnav.php
+++ b/lib/personalgroupnav.php
@@ -93,43 +93,45 @@ class PersonalGroupNav extends Widget
$this->out->elementStart('ul', array('class' => 'nav'));
- $this->out->menuItem(common_local_url('all', array('nickname' =>
- $nickname)),
- _('Personal'),
- sprintf(_('%s and friends'), (($user_profile && $user_profile->fullname) ? $user_profile->fullname : $nickname)),
- $action == 'all', 'nav_timeline_personal');
- $this->out->menuItem(common_local_url('replies', array('nickname' =>
- $nickname)),
- _('Replies'),
- sprintf(_('Replies to %s'), (($user_profile && $user_profile->fullname) ? $user_profile->fullname : $nickname)),
- $action == 'replies', 'nav_timeline_replies');
- $this->out->menuItem(common_local_url('showstream', array('nickname' =>
- $nickname)),
- _('Profile'),
- ($user_profile && $user_profile->fullname) ? $user_profile->fullname : $nickname,
- $action == 'showstream', 'nav_profile');
- $this->out->menuItem(common_local_url('showfavorites', array('nickname' =>
- $nickname)),
- _('Favorites'),
- sprintf(_('%s\'s favorite notices'), ($user_profile) ? $user_profile->getBestName() : _('User')),
- $action == 'showfavorites', 'nav_timeline_favorites');
+ if (Event::handle('StartPersonalGroupNav', array($this))) {
+ $this->out->menuItem(common_local_url('all', array('nickname' =>
+ $nickname)),
+ _('Personal'),
+ sprintf(_('%s and friends'), (($user_profile && $user_profile->fullname) ? $user_profile->fullname : $nickname)),
+ $action == 'all', 'nav_timeline_personal');
+ $this->out->menuItem(common_local_url('replies', array('nickname' =>
+ $nickname)),
+ _('Replies'),
+ sprintf(_('Replies to %s'), (($user_profile && $user_profile->fullname) ? $user_profile->fullname : $nickname)),
+ $action == 'replies', 'nav_timeline_replies');
+ $this->out->menuItem(common_local_url('showstream', array('nickname' =>
+ $nickname)),
+ _('Profile'),
+ ($user_profile && $user_profile->fullname) ? $user_profile->fullname : $nickname,
+ $action == 'showstream', 'nav_profile');
+ $this->out->menuItem(common_local_url('showfavorites', array('nickname' =>
+ $nickname)),
+ _('Favorites'),
+ sprintf(_('%s\'s favorite notices'), ($user_profile) ? $user_profile->getBestName() : _('User')),
+ $action == 'showfavorites', 'nav_timeline_favorites');
- $cur = common_current_user();
+ $cur = common_current_user();
- if ($cur && $cur->id == $user->id) {
+ if ($cur && $cur->id == $user->id) {
- $this->out->menuItem(common_local_url('inbox', array('nickname' =>
- $nickname)),
- _('Inbox'),
- _('Your incoming messages'),
- $action == 'inbox');
- $this->out->menuItem(common_local_url('outbox', array('nickname' =>
- $nickname)),
- _('Outbox'),
- _('Your sent messages'),
- $action == 'outbox');
+ $this->out->menuItem(common_local_url('inbox', array('nickname' =>
+ $nickname)),
+ _('Inbox'),
+ _('Your incoming messages'),
+ $action == 'inbox');
+ $this->out->menuItem(common_local_url('outbox', array('nickname' =>
+ $nickname)),
+ _('Outbox'),
+ _('Your sent messages'),
+ $action == 'outbox');
+ }
+ Event::handle('EndPersonalGroupNav', array($this));
}
-
$this->out->elementEnd('ul');
}
}
diff --git a/lib/searchaction.php b/lib/searchaction.php
index e74450e11..e7ad4affd 100644
--- a/lib/searchaction.php
+++ b/lib/searchaction.php
@@ -51,7 +51,7 @@ class SearchAction extends Action
*
* @return boolean true
*/
- function isReadOnly($args)
+ function isReadOnly()
{
return true;
}
diff --git a/lib/subpeopletagcloudsection.php b/lib/subpeopletagcloudsection.php
new file mode 100644
index 000000000..d98f28afa
--- /dev/null
+++ b/lib/subpeopletagcloudsection.php
@@ -0,0 +1,76 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Personal tag cloud section
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category Widget
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @copyright 2009 Control Yourself, Inc.
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+ exit(1);
+}
+
+/**
+ * Personal tag cloud section
+ *
+ * @category Widget
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link http://laconi.ca/
+ */
+
+class SubPeopleTagCloudSection extends TagCloudSection
+{
+ function getTags()
+ {
+ $qry = $this->query();
+ $limit = TAGS_PER_SECTION;
+ $offset = 0;
+
+ if (common_config('db','type') == 'pgsql') {
+ $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
+ } else {
+ $qry .= ' LIMIT ' . $offset . ', ' . $limit;
+ }
+
+ $profile_tag = Memcached_DataObject::cachedQuery('Profile_tag',
+ sprintf($qry,
+ $this->out->user->id));
+ return $profile_tag;
+ }
+
+ function tagUrl($tag) {
+ return common_local_url('peopletag', array('tag' => $tag));
+ }
+
+ function showTag($tag, $weight, $relative) {
+ $rel = 'tag-cloud-';
+ $rel .= 1+intval(7 * $relative * $weight - 0.01);
+
+ $this->out->elementStart('li', $rel);
+ $this->out->element('a', array('href' => $this->tagUrl($tag)), $tag);
+ $this->out->elementEnd('li');
+ }
+}
diff --git a/lib/subscriberspeopleselftagcloudsection.php b/lib/subscriberspeopleselftagcloudsection.php
new file mode 100644
index 000000000..b5a39c6de
--- /dev/null
+++ b/lib/subscriberspeopleselftagcloudsection.php
@@ -0,0 +1,54 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Personal tag cloud section
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category Widget
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @copyright 2009 Control Yourself, Inc.
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+ exit(1);
+}
+
+/**
+ * Personal tag cloud section
+ *
+ * @category Widget
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link http://laconi.ca/
+ */
+
+class SubscribersPeopleSelfTagCloudSection extends SubPeopleTagCloudSection
+{
+ function title()
+ {
+ return _('People Tagcloud as self-tagged');
+ }
+
+ function query() {
+ return 'select tag, count(tag) as weight from subscription left join profile_tag on tagger = subscriber where subscribed=%d and subscribed != subscriber and tagger = tagged group by tag order by weight desc';
+ }
+}
diff --git a/lib/subscriberspeopletagcloudsection.php b/lib/subscriberspeopletagcloudsection.php
new file mode 100644
index 000000000..23011efdd
--- /dev/null
+++ b/lib/subscriberspeopletagcloudsection.php
@@ -0,0 +1,60 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Personal tag cloud section
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category Widget
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @copyright 2009 Control Yourself, Inc.
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+ exit(1);
+}
+
+/**
+ * Personal tag cloud section
+ *
+ * @category Widget
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link http://laconi.ca/
+ */
+
+class SubscribersPeopleTagCloudSection extends SubPeopleTagCloudSection
+{
+ function title()
+ {
+ return _('People Tagcloud as tagged');
+ }
+
+ function tagUrl($tag) {
+ $nickname = $this->out->profile->nickname;
+ return common_local_url('subscribers', array('nickname' => $nickname, 'tag' => $tag));
+ }
+
+
+ function query() {
+ return 'select tag, count(tag) as weight from subscription left join profile_tag on subscriber=tagged and subscribed=tagger where subscribed=%d and subscriber != subscribed group by tag order by weight desc';
+ }
+}
diff --git a/lib/subscriptionspeopleselftagcloudsection.php b/lib/subscriptionspeopleselftagcloudsection.php
new file mode 100644
index 000000000..8ac65adb0
--- /dev/null
+++ b/lib/subscriptionspeopleselftagcloudsection.php
@@ -0,0 +1,54 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Personal tag cloud section
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category Widget
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @copyright 2009 Control Yourself, Inc.
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+ exit(1);
+}
+
+/**
+ * Personal tag cloud section
+ *
+ * @category Widget
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link http://laconi.ca/
+ */
+
+class SubscriptionsPeopleSelfTagCloudSection extends SubPeopleTagCloudSection
+{
+ function title()
+ {
+ return _('People Tagcloud as self-tagged');
+ }
+
+ function query() {
+ return 'select tag, count(tag) as weight from subscription left join profile_tag on tagger = subscriber where subscribed=%d and subscriber != subscribed and tagger = tagged group by tag order by weight desc';
+ }
+}
diff --git a/lib/subscriptionspeopletagcloudsection.php b/lib/subscriptionspeopletagcloudsection.php
new file mode 100644
index 000000000..c3f7d1763
--- /dev/null
+++ b/lib/subscriptionspeopletagcloudsection.php
@@ -0,0 +1,59 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Personal tag cloud section
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category Widget
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @copyright 2009 Control Yourself, Inc.
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+ exit(1);
+}
+
+/**
+ * Personal tag cloud section
+ *
+ * @category Widget
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link http://laconi.ca/
+ */
+
+class SubscriptionsPeopleTagCloudSection extends SubPeopleTagCloudSection
+{
+ function title()
+ {
+ return _('People Tagcloud as tagged');
+ }
+
+ function tagUrl($tag) {
+ $nickname = $this->out->profile->nickname;
+ return common_local_url('subscriptions', array('nickname' => $nickname, 'tag' => $tag));
+ }
+
+ function query() {
+ return 'select tag, count(tag) as weight from subscription left join profile_tag on subscriber=tagger and subscribed=tagged where subscriber=%d and subscriber != subscribed group by tag order by weight desc';
+ }
+}
diff --git a/lib/twitterapi.php b/lib/twitterapi.php
index b8357c688..6a90b4e28 100644
--- a/lib/twitterapi.php
+++ b/lib/twitterapi.php
@@ -418,7 +418,7 @@ class TwitterapiAction extends Action
function date_twitter($dt)
{
$t = strtotime($dt);
- return date("D M d G:i:s O Y", $t);
+ return date("D M d H:i:s O Y", $t);
}
// XXX: Candidate for a general utility method somewhere?
diff --git a/lib/util.php b/lib/util.php
index 888765548..da009682b 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -1392,3 +1392,4 @@ function common_database_tablename($tablename)
//table prefixes could be added here later
return $tablename;
}
+