summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
authorBrenda Wallace <shiny@cpan.org>2010-01-09 21:43:25 +0000
committerBrenda Wallace <shiny@cpan.org>2010-01-09 21:43:25 +0000
commit4de09d6bd4eab3259d42fa846e4dd31f2516a038 (patch)
treedf650402df1abcb64e1aa9640eeeb782b3c20f03 /actions
parentf4459dfedcdea2f2a6078bedf9530deb45b6d52c (diff)
parentf396701b6466749c09ce16b1e7f2f96c10b05cdd (diff)
Merge commit 'origin/0.9.x' into 0.9.x
Diffstat (limited to 'actions')
-rw-r--r--actions/apiblockcreate.php13
-rw-r--r--actions/apiblockdestroy.php13
-rw-r--r--actions/apigroupleave.php8
-rw-r--r--actions/apistatusesupdate.php20
-rw-r--r--actions/block.php8
-rw-r--r--actions/favorited.php8
-rw-r--r--actions/geocode.php98
-rw-r--r--actions/getfile.php66
-rw-r--r--actions/leavegroup.php4
-rw-r--r--actions/newnotice.php33
-rw-r--r--actions/profilesettings.php45
-rw-r--r--actions/publictagcloud.php15
-rw-r--r--actions/shownotice.php2
-rw-r--r--actions/twitapisearchatom.php9
-rw-r--r--actions/unblock.php13
-rw-r--r--actions/version.php270
16 files changed, 545 insertions, 80 deletions
diff --git a/actions/apiblockcreate.php b/actions/apiblockcreate.php
index e79dec32d..c26485f59 100644
--- a/actions/apiblockcreate.php
+++ b/actions/apiblockcreate.php
@@ -109,9 +109,16 @@ class ApiBlockCreateAction extends ApiAuthAction
return;
}
- if ($this->user->hasBlocked($this->other)
- || $this->user->block($this->other)
- ) {
+ if (!$this->user->hasBlocked($this->other)) {
+ if (Event::handle('StartBlockProfile', array($this->user, $this->other))) {
+ $result = $this->user->block($this->other);
+ if ($result) {
+ Event::handle('EndBlockProfile', array($this->user, $this->other));
+ }
+ }
+ }
+
+ if ($this->user->hasBlocked($this->other)) {
$this->initDocument($this->format);
$this->showProfile($this->other, $this->format);
$this->endDocument($this->format);
diff --git a/actions/apiblockdestroy.php b/actions/apiblockdestroy.php
index 328f18ab0..666f308f4 100644
--- a/actions/apiblockdestroy.php
+++ b/actions/apiblockdestroy.php
@@ -97,9 +97,16 @@ class ApiBlockDestroyAction extends ApiAuthAction
return;
}
- if (!$this->user->hasBlocked($this->other)
- || $this->user->unblock($this->other)
- ) {
+ if ($this->user->hasBlocked($this->other)) {
+ if (Event::handle('StartUnblockProfile', array($this->user, $this->other))) {
+ $result = $this->user->unblock($this->other);
+ if ($result) {
+ Event::handle('EndUnblockProfile', array($this->user, $this->other));
+ }
+ }
+ }
+
+ if (!$this->user->hasBlocked($this->other)) {
$this->initDocument($this->format);
$this->showProfile($this->other, $this->format);
$this->endDocument($this->format);
diff --git a/actions/apigroupleave.php b/actions/apigroupleave.php
index 514a3a557..5627bfc14 100644
--- a/actions/apigroupleave.php
+++ b/actions/apigroupleave.php
@@ -108,7 +108,7 @@ class ApiGroupLeaveAction extends ApiAuthAction
$member = new Group_member();
$member->group_id = $this->group->id;
- $member->profile_id = $this->auth->id;
+ $member->profile_id = $this->auth_user->id;
if (!$member->find(true)) {
$this->serverError(_('You are not a member of this group.'));
@@ -118,12 +118,12 @@ class ApiGroupLeaveAction extends ApiAuthAction
$result = $member->delete();
if (!$result) {
- common_log_db_error($member, 'INSERT', __FILE__);
+ common_log_db_error($member, 'DELETE', __FILE__);
$this->serverError(
sprintf(
- _('Could not remove user %s to group %s.'),
+ _('Could not remove user %s from group %s.'),
$this->user->nickname,
- $this->$group->nickname
+ $this->group->nickname
)
);
return;
diff --git a/actions/apistatusesupdate.php b/actions/apistatusesupdate.php
index dabbea92f..f594bbf39 100644
--- a/actions/apistatusesupdate.php
+++ b/actions/apistatusesupdate.php
@@ -203,12 +203,6 @@ class ApiStatusesUpdateAction extends ApiAuthAction
}
}
- $location = null;
-
- if (!empty($this->lat) && !empty($this->lon)) {
- $location = Location::fromLatLon($this->lat, $this->lon);
- }
-
$upload = null;
try {
@@ -235,11 +229,15 @@ class ApiStatusesUpdateAction extends ApiAuthAction
$options = array('reply_to' => $reply_to);
- if (!empty($location)) {
- $options['lat'] = $location->lat;
- $options['lon'] = $location->lon;
- $options['location_id'] = $location->location_id;
- $options['location_ns'] = $location->location_ns;
+ if ($this->user->shareLocation()) {
+
+ $locOptions = Notice::locationOptions($this->lat,
+ $this->lon,
+ null,
+ null,
+ $this->user->getProfile());
+
+ $options = array_merge($options, $locOptions);
}
$this->notice =
diff --git a/actions/block.php b/actions/block.php
index 71a34e087..5fae45dff 100644
--- a/actions/block.php
+++ b/actions/block.php
@@ -156,7 +156,12 @@ class BlockAction extends ProfileFormAction
{
$cur = common_current_user();
- $result = $cur->block($this->profile);
+ if (Event::handle('StartBlockProfile', array($cur, $this->profile))) {
+ $result = $cur->block($this->profile);
+ if ($result) {
+ Event::handle('EndBlockProfile', array($cur, $this->profile));
+ }
+ }
if (!$result) {
$this->serverError(_('Failed to save block information.'));
@@ -164,4 +169,3 @@ class BlockAction extends ProfileFormAction
}
}
}
-
diff --git a/actions/favorited.php b/actions/favorited.php
index 150b67b0b..9ffa5b844 100644
--- a/actions/favorited.php
+++ b/actions/favorited.php
@@ -185,11 +185,7 @@ class FavoritedAction extends Action
function showContent()
{
- if (common_config('db', 'type') == 'pgsql') {
- $weightexpr='sum(exp(-extract(epoch from (now() - fave.modified)) / %s))';
- } else {
- $weightexpr='sum(exp(-(now() - fave.modified) / %s))';
- }
+ $weightexpr = common_sql_weight('fave.modified', common_config('popular', 'dropoff'));
$qry = 'SELECT notice.*, '.
$weightexpr . ' as weight ' .
@@ -207,7 +203,7 @@ class FavoritedAction extends Action
}
$notice = Memcached_DataObject::cachedQuery('Notice',
- sprintf($qry, common_config('popular', 'dropoff')),
+ $qry,
600);
$nl = new NoticeList($notice, $this);
diff --git a/actions/geocode.php b/actions/geocode.php
new file mode 100644
index 000000000..9671d2c27
--- /dev/null
+++ b/actions/geocode.php
@@ -0,0 +1,98 @@
+<?php
+/**
+ * Geocode action class
+ *
+ * PHP version 5
+ *
+ * @category Action
+ * @package StatusNet
+ * @author Craig Andrews <candrews@integralblue.com>
+ * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
+ * @link http://status.net/
+ *
+ * StatusNet - the distributed open-source microblogging tool
+ * Copyright (C) 2008, 2009, StatusNet, Inc.
+ *
+ * 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/>.
+ */
+
+if (!defined('STATUSNET') && !defined('LACONICA')) {
+ exit(1);
+}
+
+/**
+ * Geocode action class
+ *
+ * @category Action
+ * @package StatusNet
+ * @author Craig Andrews <candrews@integralblue.com>
+ * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
+ * @link http://status.net/
+ */
+class GeocodeAction extends Action
+{
+ function prepare($args)
+ {
+ parent::prepare($args);
+ $token = $this->trimmed('token');
+ if (!$token || $token != common_session_token()) {
+ $this->clientError(_('There was a problem with your session token. '.
+ 'Try again, please.'));
+ }
+ $this->lat = $this->trimmed('lat');
+ $this->lon = $this->trimmed('lon');
+ $location = Location::fromLatLon($this->lat, $this->lon);
+ if ($location) {
+ $this->location = Location::fromId($location->location_id, $location->location_ns);
+ $this->lat = $this->location->lat;
+ $this->lon = $this->location->lon;
+ }
+ return true;
+ }
+
+ /**
+ * Class handler
+ *
+ * @param array $args query arguments
+ *
+ * @return nothing
+ *
+ **/
+ function handle($args)
+ {
+ header('Content-Type: application/json; charset=utf-8');
+ $location_object = array();
+ $location_object['lat']=$this->lat;
+ $location_object['lon']=$this->lon;
+ if($this->location) {
+ $location_object['location_id']=$this->location->location_id;
+ $location_object['location_ns']=$this->location->location_ns;
+ $location_object['name']=$this->location->getName();
+ $location_object['url']=$this->location->getUrl();
+ }
+ print(json_encode($location_object));
+ }
+
+ /**
+ * Is this action read-only?
+ *
+ * @return boolean true
+ */
+
+ function isReadOnly($args)
+ {
+ return true;
+ }
+}
+?>
diff --git a/actions/getfile.php b/actions/getfile.php
index ecda34c0f..cd327e410 100644
--- a/actions/getfile.php
+++ b/actions/getfile.php
@@ -1,13 +1,13 @@
<?php
/**
- * StatusNet, the distributed open-source microblogging tool
+ * StatusNet - the distributed open-source microblogging tool
+ * Copyright (C) 2009, StatusNet, Inc.
*
- * Returns a given file attachment, allowing private sites to only allow
- * access to file attachments after login.
+ * Return a requested file
*
* PHP version 5
*
- * LICENCE: This program is free software: you can redistribute it and/or modify
+ * 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.
@@ -20,28 +20,32 @@
* 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 Personal
+ * @category PrivateAttachments
* @package StatusNet
* @author Jeffery To <jeffery.to@gmail.com>
- * @copyright 2008-2009 StatusNet, Inc.
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @copyright 2009 StatusNet, Inc.
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
-if (!defined('STATUSNET') && !defined('LACONICA')) {
+if (!defined('STATUSNET')) {
exit(1);
}
require_once 'MIME/Type.php';
/**
- * Action for getting a file attachment
+ * An action for returning a requested file
*
- * @category Personal
- * @package StatusNet
- * @author Jeffery To <jeffery.to@gmail.com>
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link http://status.net/
+ * The StatusNet system will do an implicit user check if the site is
+ * private before allowing this to continue
+ *
+ * @category PrivateAttachments
+ * @package StatusNet
+ * @author Jeffery To <jeffery.to@gmail.com>
+ * @copyright 2009 StatusNet, Inc.
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
+ * @link http://status.net/
*/
class GetfileAction extends Action
@@ -68,7 +72,7 @@ class GetfileAction extends Action
$path = null;
if ($filename) {
- $path = common_config('attachments', 'dir') . $filename;
+ $path = File::path($filename);
}
if (empty($path) or !file_exists($path)) {
@@ -103,6 +107,10 @@ class GetfileAction extends Action
function lastModified()
{
+ if (common_config('site', 'use_x_sendfile')) {
+ return null;
+ }
+
return filemtime($this->path);
}
@@ -114,8 +122,24 @@ class GetfileAction extends Action
*
* @return string etag http header
*/
+
function etag()
{
+ if (common_config('site', 'use_x_sendfile')) {
+ return null;
+ }
+
+ $cache = common_memcache();
+ if($cache) {
+ $key = common_cache_key('attachments:etag:' . $this->path);
+ $etag = $cache->get($key);
+ if($etag === false) {
+ $etag = crc32(file_get_contents($this->path));
+ $cache->set($key,$etag);
+ }
+ return $etag;
+ }
+
$stat = stat($this->path);
return '"' . $stat['ino'] . '-' . $stat['size'] . '-' . $stat['mtime'] . '"';
}
@@ -133,13 +157,19 @@ class GetfileAction extends Action
// undo headers set by PHP sessions
$sec = session_cache_expire() * 60;
header('Expires: ' . date(DATE_RFC1123, time() + $sec));
- header('Cache-Control: public, max-age=' . $sec);
- header('Pragma: public');
+ header('Cache-Control: max-age=' . $sec);
parent::handle($args);
$path = $this->path;
+
header('Content-Type: ' . MIME_Type::autoDetect($path));
- readfile($path);
+
+ if (common_config('site', 'use_x_sendfile')) {
+ header('X-Sendfile: ' . $path);
+ } else {
+ header('Content-Length: ' . filesize($path));
+ readfile($path);
+ }
}
}
diff --git a/actions/leavegroup.php b/actions/leavegroup.php
index 08fce1509..90c85e1a4 100644
--- a/actions/leavegroup.php
+++ b/actions/leavegroup.php
@@ -123,8 +123,8 @@ class LeavegroupAction extends Action
$result = $member->delete();
if (!$result) {
- common_log_db_error($member, 'INSERT', __FILE__);
- $this->serverError(sprintf(_('Could not remove user %s to group %s'),
+ common_log_db_error($member, 'DELETE', __FILE__);
+ $this->serverError(sprintf(_('Could not remove user %s from group %s'),
$cur->nickname, $this->group->nickname));
}
diff --git a/actions/newnotice.php b/actions/newnotice.php
index c014f1781..a4ed87bb6 100644
--- a/actions/newnotice.php
+++ b/actions/newnotice.php
@@ -164,19 +164,6 @@ class NewnoticeAction extends Action
$replyto = 'false';
}
- $lat = $this->trimmed('lat');
- $lon = $this->trimmed('lon');
- $location_id = $this->trimmed('location_id');
- $location_ns = $this->trimmed('location_ns');
-
- if (!empty($lat) && !empty($lon) && empty($location_id)) {
- $location = Location::fromLatLon($lat, $lon);
- if (!empty($location)) {
- $location_id = $location->location_id;
- $location_ns = $location->location_ns;
- }
- }
-
$upload = null;
$upload = MediaFile::fromUpload('attach');
@@ -195,12 +182,20 @@ class NewnoticeAction extends Action
}
}
- $notice = Notice::saveNew($user->id, $content_shortened, 'web',
- array('reply_to' => ($replyto == 'false') ? null : $replyto,
- 'lat' => $lat,
- 'lon' => $lon,
- 'location_id' => $location_id,
- 'location_ns' => $location_ns));
+ $options = array('reply_to' => ($replyto == 'false') ? null : $replyto);
+
+ if ($user->shareLocation() && $this->arg('notice_data-geo')) {
+
+ $locOptions = Notice::locationOptions($this->trimmed('lat'),
+ $this->trimmed('lon'),
+ $this->trimmed('location_id'),
+ $this->trimmed('location_ns'),
+ $user->getProfile());
+
+ $options = array_merge($options, $locOptions);
+ }
+
+ $notice = Notice::saveNew($user->id, $content_shortened, 'web', $options);
if (isset($upload)) {
$upload->attachToNotice($notice);
diff --git a/actions/profilesettings.php b/actions/profilesettings.php
index acfcbcd00..0d6777879 100644
--- a/actions/profilesettings.php
+++ b/actions/profilesettings.php
@@ -133,6 +133,13 @@ class ProfilesettingsAction extends AccountSettingsAction
($this->arg('location')) ? $this->arg('location') : $profile->location,
_('Where you are, like "City, State (or Region), Country"'));
$this->elementEnd('li');
+ if (common_config('location', 'share') == 'user') {
+ $this->elementStart('li');
+ $this->checkbox('sharelocation', _('Share my current location when posting notices'),
+ ($this->arg('sharelocation')) ?
+ $this->arg('sharelocation') : $user->shareLocation());
+ $this->elementEnd('li');
+ }
Event::handle('EndProfileFormData', array($this));
$this->elementStart('li');
$this->input('tags', _('Tags'),
@@ -309,7 +316,12 @@ class ProfilesettingsAction extends AccountSettingsAction
$loc = Location::fromName($location);
- if (!empty($loc)) {
+ if (empty($loc)) {
+ $profile->lat = null;
+ $profile->lon = null;
+ $profile->location_id = null;
+ $profile->location_ns = null;
+ } else {
$profile->lat = $loc->lat;
$profile->lon = $loc->lon;
$profile->location_id = $loc->location_id;
@@ -318,6 +330,37 @@ class ProfilesettingsAction extends AccountSettingsAction
$profile->profileurl = common_profile_url($nickname);
+ if (common_config('location', 'share') == 'user') {
+
+ $exists = false;
+
+ $prefs = User_location_prefs::staticGet('user_id', $user->id);
+
+ if (empty($prefs)) {
+ $prefs = new User_location_prefs();
+
+ $prefs->user_id = $user->id;
+ $prefs->created = common_sql_now();
+ } else {
+ $exists = true;
+ $orig = clone($prefs);
+ }
+
+ $prefs->share_location = $this->boolean('sharelocation');
+
+ if ($exists) {
+ $result = $prefs->update($orig);
+ } else {
+ $result = $prefs->insert();
+ }
+
+ if ($result === false) {
+ common_log_db_error($prefs, ($exists) ? 'UPDATE' : 'INSERT', __FILE__);
+ $this->serverError(_('Couldn\'t save location prefs.'));
+ return;
+ }
+ }
+
common_debug('Old profile: ' . common_log_objstring($orig_profile), __FILE__);
common_debug('New profile: ' . common_log_objstring($profile), __FILE__);
diff --git a/actions/publictagcloud.php b/actions/publictagcloud.php
index e7f6ee36c..9e4478dbb 100644
--- a/actions/publictagcloud.php
+++ b/actions/publictagcloud.php
@@ -105,12 +105,8 @@ class PublictagcloudAction extends Action
#Add the aggregated columns...
$tags->selectAdd('max(notice_id) as last_notice_id');
- if(common_config('db','type')=='pgsql') {
- $calc='sum(exp(-extract(epoch from (now()-created))/%s)) as weight';
- } else {
- $calc='sum(exp(-(now() - created)/%s)) as weight';
- }
- $tags->selectAdd(sprintf($calc, common_config('tag', 'dropoff')));
+ $calc = common_sql_weight('created', common_config('tag', 'dropoff'));
+ $tags->selectAdd($calc . ' as weight');
$tags->groupBy('tag');
$tags->orderBy('weight DESC');
@@ -136,7 +132,12 @@ class PublictagcloudAction extends Action
$this->elementStart('dd');
$this->elementStart('ul', 'tags xoxo tag-cloud');
foreach ($tw as $tag => $weight) {
- $this->showTag($tag, $weight, $weight/$sum);
+ if ($sum) {
+ $weightedSum = $weight/$sum;
+ } else {
+ $weightedSum = 0.5;
+ }
+ $this->showTag($tag, $weight, $weightedSum);
}
$this->elementEnd('ul');
$this->elementEnd('dd');
diff --git a/actions/shownotice.php b/actions/shownotice.php
index 5d16fdad9..d09100f67 100644
--- a/actions/shownotice.php
+++ b/actions/shownotice.php
@@ -103,7 +103,7 @@ class ShownoticeAction extends OwnerDesignAction
$this->user = User::staticGet('id', $this->profile->id);
- if (! $this->notice->is_local) {
+ if ($this->notice->is_local == Notice::REMOTE_OMB) {
common_redirect($this->notice->uri);
return false;
}
diff --git a/actions/twitapisearchatom.php b/actions/twitapisearchatom.php
index 1cb8d7efe..baed2a0c7 100644
--- a/actions/twitapisearchatom.php
+++ b/actions/twitapisearchatom.php
@@ -208,7 +208,14 @@ class TwitapisearchatomAction extends ApiAction
$this->showFeed();
foreach ($notices as $n) {
- $this->showEntry($n);
+
+ $profile = $n->getProfile();
+
+ // Don't show notices from deleted users
+
+ if (!empty($profile)) {
+ $this->showEntry($n);
+ }
}
$this->endAtom();
diff --git a/actions/unblock.php b/actions/unblock.php
index c60458cd3..0f63e1dae 100644
--- a/actions/unblock.php
+++ b/actions/unblock.php
@@ -71,8 +71,17 @@ class UnblockAction extends ProfileFormAction
function handlePost()
{
- $cur = common_current_user();
- $result = $cur->unblock($this->profile);
+ $cur = common_current_user();
+
+ $result = false;
+
+ if (Event::handle('StartUnblockProfile', array($cur, $this->profile))) {
+ $result = $cur->unblock($this->profile);
+ if ($result) {
+ Event::handle('EndUnblockProfile', array($cur, $this->profile));
+ }
+ }
+
if (!$result) {
$this->serverError(_('Error removing the block.'));
return;
diff --git a/actions/version.php b/actions/version.php
new file mode 100644
index 000000000..2cf914296
--- /dev/null
+++ b/actions/version.php
@@ -0,0 +1,270 @@
+<?php
+/**
+ * StatusNet - the distributed open-source microblogging tool
+ * Copyright (C) 2008, 2009, StatusNet, Inc.
+ *
+ * Show version information for this software and plugins
+ *
+ * PHP version 5
+ *
+ * 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 Info
+ * @package StatusNet
+ * @author Evan Prodromou <evan@status.net>
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3
+ * @link http://status.net/
+ */
+
+if (!defined('STATUSNET')) {
+ exit(1);
+}
+
+/**
+ * Version info page
+ *
+ * A page that shows version information for this site. Helpful for
+ * debugging, for giving credit to authors, and for linking to more
+ * complete documentation for admins.
+ *
+ * @category Info
+ * @package StatusNet
+ * @author Evan Prodromou <evan@status.net>
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3
+ * @link http://status.net/
+ */
+
+class VersionAction extends Action
+{
+ var $pluginVersions = array();
+
+ /**
+ * Return true since we're read-only.
+ *
+ * @param array $args other arguments
+ *
+ * @return boolean is read only action?
+ */
+
+ function isReadOnly($args)
+ {
+ return true;
+ }
+
+ /**
+ * Returns the page title
+ *
+ * @return string page title
+ */
+
+ function title()
+ {
+ return sprintf(_("StatusNet %s"), STATUSNET_VERSION);
+ }
+
+ /**
+ * Prepare to run
+ *
+ * Fire off an event to let plugins report their
+ * versions.
+ *
+ * @param array $args array misc. arguments
+ *
+ * @return boolean true
+ */
+
+ function prepare($args)
+ {
+ parent::prepare($args);
+
+ Event::handle('PluginVersion', array(&$this->pluginVersions));
+
+ return true;
+ }
+
+ /**
+ * Execute the action
+ *
+ * Shows a page with the version information in the
+ * content area.
+ *
+ * @param array $args ignored.
+ *
+ * @return void
+ */
+
+ function handle($args)
+ {
+ parent::handle($args);
+ $this->showPage();
+ }
+
+
+ /*
+ * Override to add hentry, and content-inner classes
+ *
+ * @return void
+ */
+ function showContentBlock()
+ {
+ $this->elementStart('div', array('id' => 'content', 'class' => 'hentry'));
+ $this->showPageTitle();
+ $this->showPageNoticeBlock();
+ $this->elementStart('div', array('id' => 'content_inner',
+ 'class' => 'entry-content'));
+ // show the actual content (forms, lists, whatever)
+ $this->showContent();
+ $this->elementEnd('div');
+ $this->elementEnd('div');
+ }
+
+
+ /*
+ * Overrride to add entry-title class
+ *
+ * @return void
+ */
+ function showPageTitle() {
+ $this->element('h1', array('class' => 'entry-title'), $this->title());
+ }
+
+
+ /**
+ * Show version information
+ *
+ * @return void
+ */
+
+ function showContent()
+ {
+ $this->elementStart('p');
+
+ $this->raw(sprintf(_('This site is powered by %s version %s, '.
+ 'Copyright 2008-2010 StatusNet, Inc. '.
+ 'and contributors.'),
+ XMLStringer::estring('a', array('href' => 'http://status.net/'),
+ _('StatusNet')),
+ STATUSNET_VERSION));
+ $this->elementEnd('p');
+
+ $this->element('h2', null, _('Contributors'));
+
+ $this->element('p', null, implode(', ', $this->contributors));
+
+ $this->element('h2', null, _('License'));
+
+ $this->element('p', null,
+ _('StatusNet 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->element('p', null,
+ _('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. '));
+
+ $this->elementStart('p');
+ $this->raw(sprintf(_('You should have received a copy of the GNU Affero General Public License '.
+ 'along with this program. If not, see %s.'),
+ XMLStringer::estring('a', array('href' => 'http://www.gnu.org/licenses/agpl.html'),
+ 'http://www.gnu.org/licenses/agpl.html')));
+ $this->elementEnd('p');
+
+ // XXX: Theme information?
+
+ if (count($this->pluginVersions)) {
+ $this->element('h2', null, _('Plugins'));
+
+ $this->elementStart('table', array('id' => 'plugins_enabled'));
+
+ $this->elementStart('thead');
+ $this->elementStart('tr');
+ $this->element('th', array('id' => 'plugin_name'), _('Name'));
+ $this->element('th', array('id' => 'plugin_version'), _('Version'));
+ $this->element('th', array('id' => 'plugin_authors'), _('Author(s)'));
+ $this->element('th', array('id' => 'plugin_description'), _('Description'));
+ $this->elementEnd('tr');
+ $this->elementEnd('thead');
+
+ $this->elementStart('tbody');
+ foreach ($this->pluginVersions as $plugin) {
+ $this->elementStart('tr');
+ if (array_key_exists('homepage', $plugin)) {
+ $this->elementStart('th');
+ $this->element('a', array('href' => $plugin['homepage']),
+ $plugin['name']);
+ $this->elementEnd('th');
+ } else {
+ $this->element('th', null, $plugin['name']);
+ }
+
+ $this->element('td', null, $plugin['version']);
+
+ if (array_key_exists('author', $plugin)) {
+ $this->element('td', null, $plugin['author']);
+ }
+
+ if (array_key_exists('rawdescription', $plugin)) {
+ $this->elementStart('td');
+ $this->raw($plugin['rawdescription']);
+ $this->elementEnd('td');
+ } else if (array_key_exists('description', $plugin)) {
+ $this->element('td', null, $plugin['description']);
+ }
+ $this->elementEnd('tr');
+ }
+ $this->elementEnd('tbody');
+ $this->elementEnd('table');
+ }
+
+ }
+
+ var $contributors = array('Evan Prodromou (StatusNet)',
+ 'Zach Copley (StatusNet)',
+ 'Earle Martin (StatusNet)',
+ 'Marie-Claude Doyon (StatusNet)',
+ 'Sarven Capadisli (StatusNet)',
+ 'Robin Millette (StatusNet)',
+ 'Ciaran Gultnieks',
+ 'Michael Landers',
+ 'Ori Avtalion',
+ 'Garret Buell',
+ 'Mike Cochrane',
+ 'Matthew Gregg',
+ 'Florian Biree',
+ 'Erik Stambaugh',
+ 'drry',
+ 'Gina Haeussge',
+ 'Tryggvi Björgvinsson',
+ 'Adrian Lang',
+ 'Meitar Moscovitz',
+ 'Sean Murphy',
+ 'Leslie Michael Orchard',
+ 'Eric Helgeson',
+ 'Ken Sedgwick',
+ 'Brian Hendrickson',
+ 'Tobias Diekershoff',
+ 'Dan Moore',
+ 'Fil',
+ 'Jeff Mitchell',
+ 'Brenda Wallace',
+ 'Jeffery To',
+ 'Federico Marani',
+ 'Craig Andrews',
+ 'mEDI',
+ 'Brett Taylor',
+ 'Brigitte Schuster');
+}