summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-01-22 12:35:25 +0100
committerEvan Prodromou <evan@controlyourself.ca>2009-01-22 12:35:25 +0100
commita2a2dd88b5a580715a1b8256a5d8b7743675711c (patch)
treed9daa558200526d52aec315ccd196bef7dd46d5a /actions
parent6a3204d08e035812cf111e20f72bf0c7ffb4c601 (diff)
parentf89f6a8eb0d16fc7c4114ba9279466189b857ea6 (diff)
Merge branch 'master' of evan@dev.controlyourself.ca:/var/www/trunk
Diffstat (limited to 'actions')
-rw-r--r--actions/accesstoken.php38
-rw-r--r--actions/allrss.php77
-rw-r--r--actions/avatarbynickname.php35
-rw-r--r--actions/avatarsettings.php47
-rw-r--r--actions/block.php94
-rw-r--r--actions/clienterror.php94
-rw-r--r--actions/disfavor.php61
-rw-r--r--actions/doc.php20
-rw-r--r--actions/editgroup.php19
-rw-r--r--actions/favor.php76
-rw-r--r--actions/leavegroup.php20
-rw-r--r--actions/newgroup.php3
-rw-r--r--actions/nudge.php3
-rw-r--r--actions/opensearch.php52
-rw-r--r--actions/passwordsettings.php20
-rw-r--r--actions/publicrss.php2
-rw-r--r--actions/register.php19
-rw-r--r--actions/requesttoken.php48
-rw-r--r--actions/servererror.php92
-rw-r--r--actions/showgroup.php35
-rw-r--r--actions/showstream.php57
21 files changed, 712 insertions, 200 deletions
diff --git a/actions/accesstoken.php b/actions/accesstoken.php
index ad03b7019..65c67c64e 100644
--- a/actions/accesstoken.php
+++ b/actions/accesstoken.php
@@ -1,5 +1,16 @@
<?php
-/*
+/**
+ * Access token class.
+ *
+ * PHP version 5
+ *
+ * @category Action
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @author Robin Millette <millette@controlyourself.ca>
+ * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
+ * @link http://laconi.ca/
+ *
* Laconica - a distributed open-source microblogging tool
* Copyright (C) 2008, Controlez-Vous, Inc.
*
@@ -17,12 +28,31 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-if (!defined('LACONICA')) { exit(1); }
+if (!defined('LACONICA')) {
+ exit(1);
+}
-require_once(INSTALLDIR.'/lib/omb.php');
+require_once INSTALLDIR.'/lib/omb.php';
+/**
+ * Access token class.
+ *
+ * @category Action
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @author Robin Millette <millette@controlyourself.ca>
+ * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
+ * @link http://laconi.ca/
+ */
class AccesstokenAction extends Action
{
+ /**
+ * Class handler.
+ *
+ * @param array $args query arguments
+ *
+ * @return boolean false if user doesn't exist
+ */
function handle($args)
{
parent::handle($args);
@@ -34,7 +64,7 @@ class AccesstokenAction extends Action
$server = omb_oauth_server();
common_debug('fetching the access token', __FILE__);
$token = $server->fetch_access_token($req);
- common_debug('got this token: "'.print_r($token,true).'"', __FILE__);
+ common_debug('got this token: "'.print_r($token, true).'"', __FILE__);
common_debug('printing the access token', __FILE__);
print $token;
} catch (OAuthException $e) {
diff --git a/actions/allrss.php b/actions/allrss.php
index 56818d605..e357d12f0 100644
--- a/actions/allrss.php
+++ b/actions/allrss.php
@@ -1,5 +1,17 @@
<?php
-/*
+
+/**
+ * RSS feed for user and friends timeline action class.
+ *
+ * PHP version 5
+ *
+ * @category Action
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @author Robin Millette <millette@controlyourself.ca>
+ * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
+ * @link http://laconi.ca/
+ *
* Laconica - a distributed open-source microblogging tool
* Copyright (C) 2008, Controlez-Vous, Inc.
*
@@ -17,20 +29,37 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-if (!defined('LACONICA')) { exit(1); }
-
-require_once(INSTALLDIR.'/lib/rssaction.php');
+if (!defined('LACONICA')) {
+ exit(1);
+}
-// Formatting of RSS handled by Rss10Action
+require_once INSTALLDIR.'/lib/rssaction.php';
+/**
+ * RSS feed for user and friends timeline.
+ *
+ * Formatting of RSS handled by Rss10Action
+ *
+ * @category Action
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @author Robin Millette <millette@controlyourself.ca>
+ * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
+ * @link http://laconi.ca/
+ */
class AllrssAction extends Rss10Action
{
var $user = null;
+ /**
+ * Initialization.
+ *
+ * @return boolean false if user doesn't exist
+ */
function init()
{
- $nickname = $this->trimmed('nickname');
+ $nickname = $this->trimmed('nickname');
$this->user = User::staticGet('nickname', $nickname);
if (!$this->user) {
@@ -41,11 +70,16 @@ class AllrssAction extends Rss10Action
}
}
- function get_notices($limit=0)
+ /**
+ * Get notices
+ *
+ * @param integer $limit max number of notices to return
+ *
+ * @return array notices
+ */
+ function getNotices($limit=0)
{
-
- $user = $this->user;
-
+ $user = $this->user;
$notice = $user->noticesWithFriends(0, $limit);
while ($notice->fetch()) {
@@ -55,10 +89,15 @@ class AllrssAction extends Rss10Action
return $notices;
}
- function get_channel()
+ /**
+ * Get channel.
+ *
+ * @return array associative array on channel information
+ */
+ function getChannel()
{
$user = $this->user;
- $c = array('url' => common_local_url('allrss',
+ $c = array('url' => common_local_url('allrss',
array('nickname' =>
$user->nickname)),
'title' => sprintf(_('%s and friends'), $user->nickname),
@@ -69,14 +108,20 @@ class AllrssAction extends Rss10Action
return $c;
}
- function get_image()
+ /**
+ * Get image.
+ *
+ * @return string user avatar URL or null
+ */
+ function getImage()
{
- $user = $this->user;
+ $user = $this->user;
$profile = $user->getProfile();
if (!$profile) {
return null;
}
$avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
- return ($avatar) ? $avatar->url : null;
+ return $avatar ? $avatar->url : null;
}
-} \ No newline at end of file
+}
+
diff --git a/actions/avatarbynickname.php b/actions/avatarbynickname.php
index d2d078b61..fec202016 100644
--- a/actions/avatarbynickname.php
+++ b/actions/avatarbynickname.php
@@ -1,5 +1,16 @@
<?php
-/*
+/**
+ * Retrieve user avatar by nickname action class.
+ *
+ * PHP version 5
+ *
+ * @category Action
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @author Robin Millette <millette@controlyourself.ca>
+ * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
+ * @link http://laconi.ca/
+ *
* Laconica - a distributed open-source microblogging tool
* Copyright (C) 2008, Controlez-Vous, Inc.
*
@@ -17,10 +28,29 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-if (!defined('LACONICA')) { exit(1); }
+if (!defined('LACONICA')) {
+ exit(1);
+}
+/**
+ * Retrieve user avatar by nickname action class.
+ *
+ * @category Action
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @author Robin Millette <millette@controlyourself.ca>
+ * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
+ * @link http://laconi.ca/
+ */
class AvatarbynicknameAction extends Action
{
+ /**
+ * Class handler.
+ *
+ * @param array $args query arguments
+ *
+ * @return boolean false if nickname or user isn't found
+ */
function handle($args)
{
parent::handle($args);
@@ -68,3 +98,4 @@ class AvatarbynicknameAction extends Action
common_redirect($url, 302);
}
}
+
diff --git a/actions/avatarsettings.php b/actions/avatarsettings.php
index b303fd2fd..2c7af9b7a 100644
--- a/actions/avatarsettings.php
+++ b/actions/avatarsettings.php
@@ -37,12 +37,13 @@ require_once INSTALLDIR.'/lib/accountsettingsaction.php';
/**
* Upload an avatar
*
- * We use jQuery to crop the image after upload.
+ * We use jCrop plugin for jQuery to crop the image after upload.
*
* @category Settings
* @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca>
* @author Zach Copley <zach@controlyourself.ca>
+ * @author Sarven Capadisli <csarven@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/
*/
@@ -94,42 +95,43 @@ class AvatarsettingsAction extends AccountSettingsAction
$original = $profile->getOriginalAvatar();
$this->elementStart('form', array('enctype' => 'multipart/form-data',
- 'method' => 'POST',
- 'id' => 'avatar',
+ 'method' => 'post',
+ 'id' => 'form_settings_avatar',
+ 'class' => 'form_settings',
'action' =>
common_local_url('avatarsettings')));
+ $this->elementStart('fieldset');
+ $this->element('legend', null, _('Avatar settings'));
$this->hidden('token', common_session_token());
+ $this->elementStart('ul', 'form_data');
if ($original) {
- $this->elementStart('div',
+ $this->elementStart('li',
array('id' => 'avatar_original',
'class' => 'avatar_view'));
- $this->element('h3', null, _("Original:"));
+ $this->element('h2', null, _("Original"));
$this->elementStart('div', array('id'=>'avatar_original_view'));
$this->element('img', array('src' => $original->url,
- 'class' => 'avatar original',
'width' => $original->width,
'height' => $original->height,
'alt' => $user->nickname));
$this->elementEnd('div');
- $this->elementEnd('div');
+ $this->elementEnd('li');
}
$avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
if ($avatar) {
- $this->elementStart('div',
+ $this->elementStart('li',
array('id' => 'avatar_preview',
'class' => 'avatar_view'));
- $this->element('h3', null, _("Preview:"));
+ $this->element('h2', null, _("Preview"));
$this->elementStart('div', array('id'=>'avatar_preview_view'));
$this->element('img', array('src' => $original->url,//$avatar->url,
- 'class' => 'avatar profile',
'width' => AVATAR_PROFILE_SIZE,
'height' => AVATAR_PROFILE_SIZE,
'alt' => $user->nickname));
$this->elementEnd('div');
- $this->elementEnd('div');
foreach (array('avatar_crop_x', 'avatar_crop_y',
'avatar_crop_w', 'avatar_crop_h') as $crop_info) {
@@ -138,21 +140,28 @@ class AvatarsettingsAction extends AccountSettingsAction
'id' => $crop_info));
}
$this->submit('crop', _('Crop'));
+
+ $this->elementEnd('li');
}
+ $this->elementStart('li', array ('id' => 'settings_attach'));
+ $this->element('input', array('name' => 'avatarfile',
+ 'type' => 'file',
+ 'id' => 'avatarfile'));
$this->element('input', array('name' => 'MAX_FILE_SIZE',
'type' => 'hidden',
'id' => 'MAX_FILE_SIZE',
'value' => MAX_AVATAR_SIZE));
+ $this->elementEnd('li');
+ $this->elementEnd('ul');
- $this->elementStart('p');
-
- $this->element('input', array('name' => 'avatarfile',
- 'type' => 'file',
- 'id' => 'avatarfile'));
- $this->elementEnd('p');
-
+ $this->elementStart('ul', 'form_actions');
+ $this->elementStart('li');
$this->submit('upload', _('Upload'));
+ $this->elementEnd('li');
+ $this->elementEnd('ul');
+
+ $this->elementEnd('fieldset');
$this->elementEnd('form');
}
@@ -250,7 +259,7 @@ class AvatarsettingsAction extends AccountSettingsAction
{
parent::showStylesheets();
$jcropStyle =
- common_path('js/jcrop/jquery.Jcrop.css?version='.LACONICA_VERSION);
+ common_path('theme/base/css/jquery.Jcrop.css?version='.LACONICA_VERSION);
$this->element('link', array('rel' => 'stylesheet',
'type' => 'text/css',
diff --git a/actions/block.php b/actions/block.php
index 738cbfbf7..64bd97a4f 100644
--- a/actions/block.php
+++ b/actions/block.php
@@ -1,5 +1,16 @@
<?php
-/*
+/**
+ * Block a user action class.
+ *
+ * PHP version 5
+ *
+ * @category Action
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @author Robin Millette <millette@controlyourself.ca>
+ * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
+ * @link http://laconi.ca/
+ *
* Laconica - a distributed open-source microblogging tool
* Copyright (C) 2008, Controlez-Vous, Inc.
*
@@ -17,121 +28,135 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-if (!defined('LACONICA')) { exit(1); }
+if (!defined('LACONICA')) {
+ exit(1);
+}
+/**
+ * Block a user action class.
+ *
+ * @category Action
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @author Robin Millette <millette@controlyourself.ca>
+ * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
+ * @link http://laconi.ca/
+ */
class BlockAction extends Action
{
-
var $profile = null;
-
+ /**
+ * Take arguments for running
+ *
+ * @param array $args $_REQUEST args
+ *
+ * @return boolean success flag
+ */
function prepare($args)
{
-
parent::prepare($args);
-
if (!common_logged_in()) {
$this->clientError(_('Not logged in.'));
return false;
}
-
$token = $this->trimmed('token');
-
if (!$token || $token != common_session_token()) {
$this->clientError(_('There was a problem with your session token. Try again, please.'));
return;
}
-
$id = $this->trimmed('blockto');
-
if (!$id) {
$this->clientError(_('No profile specified.'));
return false;
}
-
$this->profile = Profile::staticGet('id', $id);
-
if (!$this->profile) {
$this->clientError(_('No profile with that ID.'));
return false;
}
-
return true;
}
+ /**
+ * Handle request
+ *
+ * Shows a page with list of favorite notices
+ *
+ * @param array $args $_REQUEST args; handled in prepare()
+ *
+ * @return void
+ */
function handle($args)
{
parent::handle($args);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($this->arg('block')) {
- $this->are_you_sure_form();
+ $this->areYouSureForm();
} else if ($this->arg('no')) {
$cur = common_current_user();
- common_redirect(common_local_url('subscribers',
- array('nickname' => $cur->nickname)));
+ common_redirect(common_local_url('subscribers', array('nickname' => $cur->nickname)));
} else if ($this->arg('yes')) {
- $this->block_profile();
+ $this->blockProfile();
}
}
}
- function are_you_sure_form()
+ /**
+ * Confirm with user.
+ *
+ * Shows a confirmation form.
+ *
+ * @return void
+ */
+ function areYouSureForm()
{
-
$id = $this->profile->id;
-
common_show_header(_('Block user'));
-
$this->element('p', null,
_('Are you sure you want to block this user? '.
'Afterwards, they will be unsubscribed from you, '.
'unable to subscribe to you in the future, and '.
'you will not be notified of any @-replies from them.'));
-
$this->elementStart('form', array('id' => 'block-' . $id,
'method' => 'post',
'class' => 'block',
'action' => common_local_url('block')));
-
$this->hidden('token', common_session_token());
-
$this->element('input', array('id' => 'blockto-' . $id,
'name' => 'blockto',
'type' => 'hidden',
'value' => $id));
-
foreach ($this->args as $k => $v) {
if (substr($k, 0, 9) == 'returnto-') {
$this->hidden($k, $v);
}
}
-
$this->submit('no', _('No'));
$this->submit('yes', _('Yes'));
-
$this->elementEnd('form');
-
common_show_footer();
}
- function block_profile()
+ /**
+ * Actually block a user.
+ *
+ * @return void
+ */
+ function blockProfile()
{
-
$cur = common_current_user();
if ($cur->hasBlocked($this->profile)) {
$this->clientError(_('You have already blocked this user.'));
return;
}
-
$result = $cur->block($this->profile);
-
if (!$result) {
$this->serverError(_('Failed to save block information.'));
return;
}
- # Now, gotta figure where we go back to
-
+ // Now, gotta figure where we go back to
foreach ($this->args as $k => $v) {
if ($k == 'returnto-action') {
$action = $v;
@@ -148,3 +173,4 @@ class BlockAction extends Action
}
}
}
+
diff --git a/actions/clienterror.php b/actions/clienterror.php
new file mode 100644
index 000000000..ef6fd51df
--- /dev/null
+++ b/actions/clienterror.php
@@ -0,0 +1,94 @@
+<?php
+
+/**
+ * Client error action.
+ *
+ * PHP version 5
+ *
+ * @category Action
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @author Zach Copley <zach@controlyourself.ca>
+ * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
+ * @link http://laconi.ca/
+ *
+ * Laconica - a distributed open-source microblogging tool
+ * Copyright (C) 2008, Controlez-Vous, 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('LACONICA')) {
+ exit(1);
+}
+
+require_once INSTALLDIR.'/lib/error.php';
+
+/**
+ * Class for displaying HTTP client errors
+ *
+ * @category Action
+ * @package Laconica
+ * @author Zach Copley <zach@controlyourself.ca>
+ * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
+ * @link http://laconi.ca/
+ */
+class ClientErrorAction extends ErrorAction
+{
+ function __construct($message='Error', $code=400)
+ {
+ parent::__construct($message, $code);
+
+ $this->status = array(400 => 'Bad Request',
+ 401 => 'Unauthorized',
+ 402 => 'Payment Required',
+ 403 => 'Forbidden',
+ 404 => 'Not Found',
+ 405 => 'Method Not Allowed',
+ 406 => 'Not Acceptable',
+ 407 => 'Proxy Authentication Required',
+ 408 => 'Request Timeout',
+ 409 => 'Conflict',
+ 410 => 'Gone',
+ 411 => 'Length Required',
+ 412 => 'Precondition Failed',
+ 413 => 'Request Entity Too Large',
+ 414 => 'Request-URI Too Long',
+ 415 => 'Unsupported Media Type',
+ 416 => 'Requested Range Not Satisfiable',
+ 417 => 'Expectation Failed');
+ $this->default = 400;
+ }
+
+ // XXX: Should these error actions even be invokable via URI?
+
+ function handle($args)
+ {
+ parent::handle($args);
+
+ $this->code = $this->trimmed('code');
+
+ if (!$this->code || $code < 400 || $code > 499) {
+ $this->code = $this->default;
+ }
+
+ $this->message = $this->trimmed('message');
+
+ if (!$this->message) {
+ $this->message = "Client Error $this->code";
+ }
+
+ $this->showPage();
+ }
+}
diff --git a/actions/disfavor.php b/actions/disfavor.php
index d4a189d19..09b3bf18d 100644
--- a/actions/disfavor.php
+++ b/actions/disfavor.php
@@ -1,5 +1,17 @@
<?php
-/*
+
+/**
+ * Disfavor action.
+ *
+ * PHP version 5
+ *
+ * @category Action
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @author Robin Millette <millette@controlyourself.ca>
+ * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
+ * @link http://laconi.ca/
+ *
* Laconica - a distributed open-source microblogging tool
* Copyright (C) 2008, Controlez-Vous, Inc.
*
@@ -17,59 +29,65 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-if (!defined('LACONICA')) { exit(1); }
+if (!defined('LACONICA')) {
+ exit(1);
+}
require_once INSTALLDIR.'/lib/favorform.php';
+/**
+ * Disfavor class.
+ *
+ * @category Action
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @author Robin Millette <millette@controlyourself.ca>
+ * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
+ * @link http://laconi.ca/
+ */
class DisfavorAction extends Action
{
-
+ /**
+ * Class handler.
+ *
+ * @param array $args query arguments
+ *
+ * @return void
+ */
function handle($args)
{
-
parent::handle($args);
-
if (!common_logged_in()) {
$this->clientError(_('Not logged in.'));
return;
}
-
$user = common_current_user();
-
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
- common_redirect(common_local_url('showfavorites', array('nickname' => $user->nickname)));
+ common_redirect(common_local_url('showfavorites',
+ array('nickname' => $user->nickname)));
return;
}
-
- $id = $this->trimmed('notice');
-
+ $id = $this->trimmed('notice');
$notice = Notice::staticGet($id);
-
- $token = $this->trimmed('token-'.$notice->id);
-
+ $token = $this->trimmed('token-'.$notice->id);
if (!$token || $token != common_session_token()) {
$this->clientError(_("There was a problem with your session token. Try again, please."));
return;
}
-
- $fave = new Fave();
- $fave->user_id = $this->id;
+ $fave = new Fave();
+ $fave->user_id = $this->id;
$fave->notice_id = $notice->id;
if (!$fave->find(true)) {
$this->clientError(_('This notice is not a favorite!'));
return;
}
-
$result = $fave->delete();
-
if (!$result) {
common_log_db_error($fave, 'DELETE', __FILE__);
$this->serverError(_('Could not delete favorite.'));
return;
}
-
$user->blowFavesCache();
-
if ($this->boolean('ajax')) {
$this->startHTML('text/xml;charset=utf-8', true);
$this->elementStart('head');
@@ -86,3 +104,4 @@ class DisfavorAction extends Action
}
}
}
+
diff --git a/actions/doc.php b/actions/doc.php
index aaf006f07..3755bb051 100644
--- a/actions/doc.php
+++ b/actions/doc.php
@@ -67,6 +67,25 @@ class DocAction extends Action
$this->showPage();
}
+ // overrrided to add entry-title class
+ function showPageTitle() {
+ $this->element('h1', array('class' => 'entry-title'), $this->title());
+ }
+
+ // overrided to add hentry, and content-inner classes
+ 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');
+ }
+
/**
* Display content.
*
@@ -89,4 +108,3 @@ class DocAction extends Action
return ucfirst($this->title);
}
}
-
diff --git a/actions/editgroup.php b/actions/editgroup.php
index 82b78cc5c..98ebcb87a 100644
--- a/actions/editgroup.php
+++ b/actions/editgroup.php
@@ -88,7 +88,12 @@ class EditgroupAction extends Action
return false;
}
- $this->group = User_group::staticGet('nickname', $nickname);
+ $groupid = $this->trimmed('groupid');
+ if ($groupid) {
+ $this->group = User_group::staticGet('id', $groupid);
+ } else {
+ $this->group = User_group::staticGet('nickname', $nickname);
+ }
if (!$this->group) {
$this->clientError(_('No such group'), 404);
@@ -97,7 +102,7 @@ class EditgroupAction extends Action
$cur = common_current_user();
- if (!$cur->isAdmin($group)) {
+ if (!$cur->isAdmin($this->group)) {
$this->clientError(_('You must be an admin to edit the group'), 403);
return false;
}
@@ -155,6 +160,13 @@ class EditgroupAction extends Action
function trySave()
{
+ $cur = common_current_user();
+ if (!$cur->isAdmin($this->group)) {
+ $this->clientError(_('You must be an admin to edit the group'), 403);
+ return;
+ }
+
+
$nickname = common_canonical_nickname($this->trimmed('nickname'));
$fullname = $this->trimmed('fullname');
$homepage = $this->trimmed('homepage');
@@ -222,4 +234,5 @@ class EditgroupAction extends Action
$group != false &&
$group->id != $this->group->id);
}
-} \ No newline at end of file
+}
+
diff --git a/actions/favor.php b/actions/favor.php
index 92756366d..8ecde4b11 100644
--- a/actions/favor.php
+++ b/actions/favor.php
@@ -1,4 +1,18 @@
<?php
+
+/**
+ * Favor action.
+ *
+ * PHP version 5
+ *
+ * @category Action
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @author Robin Millette <millette@controlyourself.ca>
+ * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
+ * @link http://laconi.ca/
+ *
+
/*
* Laconica - a distributed open-source microblogging tool
* Copyright (C) 2008, Controlez-Vous, Inc.
@@ -17,57 +31,63 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-if (!defined('LACONICA')) { exit(1); }
+if (!defined('LACONICA')) {
+ exit(1);
+}
-require_once(INSTALLDIR.'/lib/mail.php');
+require_once INSTALLDIR.'/lib/mail.php';
require_once INSTALLDIR.'/lib/disfavorform.php';
+/**
+ * Favor class.
+ *
+ * @category Action
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @author Robin Millette <millette@controlyourself.ca>
+ * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
+ * @link http://laconi.ca/
+ */
class FavorAction extends Action
{
-
+ /**
+ * Class handler.
+ *
+ * @param array $args query arguments
+ *
+ * @return void
+ */
function handle($args)
{
parent::handle($args);
-
if (!common_logged_in()) {
$this->clientError(_('Not logged in.'));
return;
}
-
$user = common_current_user();
-
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
- common_redirect(common_local_url('showfavorites', array('nickname' => $user->nickname)));
+ common_redirect(common_local_url('showfavorites',
+ array('nickname' => $user->nickname)));
return;
}
-
- $id = $this->trimmed('notice');
-
+ $id = $this->trimmed('notice');
$notice = Notice::staticGet($id);
-
- # CSRF protection
-
- $token = $this->trimmed('token-'.$notice->id);
+ $token = $this->trimmed('token-'.$notice->id);
if (!$token || $token != common_session_token()) {
$this->clientError(_("There was a problem with your session token. Try again, please."));
return;
}
-
if ($user->hasFave($notice)) {
$this->clientError(_('This notice is already a favorite!'));
return;
}
-
$fave = Fave::addNew($user, $notice);
-
if (!$fave) {
$this->serverError(_('Could not create favorite.'));
return;
}
-
- $this->notify($fave, $notice, $user);
+ $this->notify($notice, $user);
$user->blowFavesCache();
-
if ($this->boolean('ajax')) {
$this->startHTML('text/xml;charset=utf-8', true);
$this->elementStart('head');
@@ -84,16 +104,24 @@ class FavorAction extends Action
}
}
- function notify($fave, $notice, $user)
+ /**
+ * Notifies a user when his notice is favorited.
+ *
+ * @param class $notice favorited notice
+ * @param class $user user declaring a favorite
+ *
+ * @return void
+ */
+ function notify($notice, $user)
{
$other = User::staticGet('id', $notice->profile_id);
if ($other && $other->id != $user->id) {
if ($other->email && $other->emailnotifyfav) {
mail_notify_fave($other, $user, $notice);
}
- # XXX: notify by IM
- # XXX: notify by SMS
+ // XXX: notify by IM
+ // XXX: notify by SMS
}
}
-
}
+
diff --git a/actions/leavegroup.php b/actions/leavegroup.php
index 587208b36..c7152e3c0 100644
--- a/actions/leavegroup.php
+++ b/actions/leavegroup.php
@@ -57,12 +57,12 @@ class LeavegroupAction extends Action
parent::prepare($args);
if (!common_config('inboxes','enabled')) {
- $this->serverError(_('Inboxes must be enabled for groups to work'));
+ $this->serverError(_('Inboxes must be enabled for groups to work.'));
return false;
}
if (!common_logged_in()) {
- $this->clientError(_('You must be logged in to join a group.'));
+ $this->clientError(_('You must be logged in to leave a group.'));
return false;
}
@@ -78,24 +78,30 @@ class LeavegroupAction extends Action
}
if (!$nickname) {
- $this->clientError(_('No nickname'), 404);
+ $this->clientError(_('No nickname.'), 404);
return false;
}
$this->group = User_group::staticGet('nickname', $nickname);
if (!$this->group) {
- $this->clientError(_('No such group'), 404);
+ $this->clientError(_('No such group.'), 404);
return false;
}
$cur = common_current_user();
- if (!$cur->isMember($group)) {
- $this->clientError(_('You are not a member of that group'), 403);
+ if (!$cur->isMember($this->group)) {
+ $this->clientError(_('You are not a member of that group.'), 403);
return false;
}
+ if ($cur->isAdmin($this->group)) {
+ $this->clientError(_('You may not leave a group while you are its administrator.'), 403);
+ return false;
+
+ }
+
return true;
}
@@ -150,4 +156,4 @@ class LeavegroupAction extends Action
$this->group->nickname)));
}
}
-} \ No newline at end of file
+}
diff --git a/actions/newgroup.php b/actions/newgroup.php
index 41c095ec0..42fd380df 100644
--- a/actions/newgroup.php
+++ b/actions/newgroup.php
@@ -201,4 +201,5 @@ class NewgroupAction extends Action
$group = User_group::staticGet('nickname', $nickname);
return (!is_null($group) && $group != false);
}
-} \ No newline at end of file
+}
+
diff --git a/actions/nudge.php b/actions/nudge.php
index 456106459..ca6fd3761 100644
--- a/actions/nudge.php
+++ b/actions/nudge.php
@@ -42,6 +42,7 @@ require_once INSTALLDIR.'/lib/mail.php';
* @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca>
* @author Robin Millette <millette@controlyourself.ca>
+ * @author Sarven Capadisli <csarven@controlyourself.ca>
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
* @link http://laconi.ca/
*/
@@ -93,7 +94,7 @@ class NudgeAction extends Action
$this->element('title', null, _('Nudge sent'));
$this->elementEnd('head');
$this->elementStart('body');
- common_nudge_response();
+ $this->element('p', array('id' => 'nudge_response'), _('Nudge sent!'));
$this->elementEnd('body');
$this->elementEnd('html');
} else {
diff --git a/actions/opensearch.php b/actions/opensearch.php
index 6e6e794e9..d7705972f 100644
--- a/actions/opensearch.php
+++ b/actions/opensearch.php
@@ -1,5 +1,17 @@
<?php
-/*
+
+/**
+ * Opensearch action class.
+ *
+ * PHP version 5
+ *
+ * @category Action
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @author Robin Millette <millette@controlyourself.ca>
+ * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
+ * @link http://laconi.ca/
+ *
* Laconica - a distributed open-source microblogging tool
* Copyright (C) 2008, Controlez-Vous, Inc.
*
@@ -17,32 +29,46 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-if (!defined('LACONICA')) { exit(1); }
+if (!defined('LACONICA')) {
+ exit(1);
+}
+/**
+ * Opensearch action class.
+ *
+ * Formatting of RSS handled by Rss10Action
+ *
+ * @category Action
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @author Robin Millette <millette@controlyourself.ca>
+ * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
+ * @link http://laconi.ca/
+ */
class OpensearchAction extends Action
{
-
+ /**
+ * Class handler.
+ *
+ * @param array $args query arguments
+ *
+ * @return boolean false if user doesn't exist
+ */
function handle($args)
{
-
parent::handle($args);
-
- $type = $this->trimmed('type');
-
+ $type = $this->trimmed('type');
$short_name = '';
if ($type == 'people') {
- $type = 'peoplesearch';
+ $type = 'peoplesearch';
$short_name = _('People Search');
} else {
+ $type = 'noticesearch';
$short_name = _('Notice Search');
- $type = 'noticesearch';
}
-
header('Content-Type: text/html');
-
common_start_xml();
$this->elementStart('OpenSearchDescription', array('xmlns' => 'http://a9.com/-/spec/opensearch/1.1/'));
-
$short_name = common_config('site', 'name').' '.$short_name;
$this->element('ShortName', null, $short_name);
$this->element('Contact', null, common_config('site', 'email'));
@@ -54,8 +80,8 @@ class OpensearchAction extends Action
$this->element('Language', null, common_language());
$this->element('OutputEncoding', null, 'UTF-8');
$this->element('InputEncoding', null, 'UTF-8');
-
$this->elementEnd('OpenSearchDescription');
common_end_xml();
}
}
+
diff --git a/actions/passwordsettings.php b/actions/passwordsettings.php
index f96da13bd..17b2de4e8 100644
--- a/actions/passwordsettings.php
+++ b/actions/passwordsettings.php
@@ -81,21 +81,35 @@ class PasswordsettingsAction extends AccountSettingsAction
{
$user = common_current_user();
$this->elementStart('form', array('method' => 'POST',
- 'id' => 'password',
+ 'id' => 'form_password',
+ 'class' => 'form_settings',
'action' =>
common_local_url('profilesettings')));
-
+ $this->elementStart('fieldset');
+ $this->element('legend', null, _('Password change'));
$this->hidden('token', common_session_token());
+
+ $this->elementStart('ul', 'form_data');
// Users who logged in with OpenID won't have a pwd
if ($user->password) {
+ $this->elementStart('li');
$this->password('oldpassword', _('Old password'));
+ $this->elementEnd('li');
}
+ $this->elementStart('li');
$this->password('newpassword', _('New password'),
_('6 or more characters'));
+ $this->elementEnd('li');
+ $this->elementStart('li');
$this->password('confirm', _('Confirm'),
_('same as password above'));
+ $this->elementEnd('li');
+ $this->elementEnd('ul');
+
$this->submit('changepass', _('Change'));
+
+ $this->elementEnd('fieldset');
$this->elementEnd('form');
}
@@ -158,4 +172,4 @@ class PasswordsettingsAction extends AccountSettingsAction
$this->showForm(_('Password saved.'), true);
}
-} \ No newline at end of file
+}
diff --git a/actions/publicrss.php b/actions/publicrss.php
index b98c27205..844c334be 100644
--- a/actions/publicrss.php
+++ b/actions/publicrss.php
@@ -36,6 +36,8 @@ if (!defined('LACONICA')) {
require_once INSTALLDIR.'/lib/rssaction.php';
/**
+ * RSS feed for public timeline.
+ *
* Formatting of RSS handled by Rss10Action
*
* @category Action
diff --git a/actions/register.php b/actions/register.php
index 159daaa73..a63da2e0f 100644
--- a/actions/register.php
+++ b/actions/register.php
@@ -248,6 +248,25 @@ class RegisterAction extends Action
return ($user !== false);
}
+ // overrrided to add entry-title class
+ function showPageTitle() {
+ $this->element('h1', array('class' => 'entry-title'), $this->title());
+ }
+
+ // overrided to add hentry, and content-inner class
+ 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');
+ }
+
/**
* Instructions or a notice for the page
*
diff --git a/actions/requesttoken.php b/actions/requesttoken.php
index 5058deedb..ca253b97a 100644
--- a/actions/requesttoken.php
+++ b/actions/requesttoken.php
@@ -1,5 +1,17 @@
<?php
-/*
+
+/**
+ * Request token action class.
+ *
+ * PHP version 5
+ *
+ * @category Action
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @author Robin Millette <millette@controlyourself.ca>
+ * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
+ * @link http://laconi.ca/
+ *
* Laconica - a distributed open-source microblogging tool
* Copyright (C) 2008, Controlez-Vous, Inc.
*
@@ -17,29 +29,53 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-if (!defined('LACONICA')) { exit(1); }
+if (!defined('LACONICA')) {
+ exit(1);
+}
-require_once(INSTALLDIR.'/lib/omb.php');
+require_once INSTALLDIR.'/lib/omb.php';
+/**
+ * Request token action class.
+ *
+ * @category Action
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @author Robin Millette <millette@controlyourself.ca>
+ * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
+ * @link http://laconi.ca/
+ */
class RequesttokenAction extends Action
{
-
+ /**
+ * Is read only?
+ *
+ * @return boolean false
+ */
function isReadOnly()
{
return false;
}
+ /**
+ * Class handler.
+ *
+ * @param array $args array of arguments
+ *
+ * @return void
+ */
function handle($args)
{
parent::handle($args);
try {
common_remove_magic_from_request();
- $req = OAuthRequest::from_request();
+ $req = OAuthRequest::from_request();
$server = omb_oauth_server();
- $token = $server->fetch_request_token($req);
+ $token = $server->fetch_request_token($req);
print $token;
} catch (OAuthException $e) {
$this->serverError($e->getMessage());
}
}
}
+
diff --git a/actions/servererror.php b/actions/servererror.php
new file mode 100644
index 000000000..a39886591
--- /dev/null
+++ b/actions/servererror.php
@@ -0,0 +1,92 @@
+<?php
+
+/**
+ * Server error action.
+ *
+ * PHP version 5
+ *
+ * @category Action
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @author Zach Copley <zach@controlyourself.ca>
+ * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
+ * @link http://laconi.ca/
+ *
+ * Laconica - a distributed open-source microblogging tool
+ * Copyright (C) 2008, Controlez-Vous, 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('LACONICA')) {
+ exit(1);
+}
+
+require_once INSTALLDIR.'/lib/error.php';
+
+/**
+ * Class for displaying HTTP server errors
+ *
+ * Note: The older util.php class simply printed a string, but the spec
+ * says that 500 errors should be treated similarly to 400 errors, and
+ * it's easier to give an HTML response. Maybe we can customize these
+ * to display some funny animal cartoons. If not, we can probably role
+ * these classes up into a single class.
+ *
+ * See: http://tools.ietf.org/html/rfc2616#section-10
+ *
+ * @category Action
+ * @package Laconica
+ * @author Zach Copley <zach@controlyourself.ca>
+ * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
+ * @link http://laconi.ca/
+ */
+class ServerErrorAction extends ErrorAction
+{
+ function __construct($message='Error', $code=500)
+ {
+ parent::__construct($message, $code);
+
+ $this->status = array(500 => 'Internal Server Error',
+ 501 => 'Not Implemented',
+ 502 => 'Bad Gateway',
+ 503 => 'Service Unavailable',
+ 504 => 'Gateway Timeout',
+ 505 => 'HTTP Version Not Supported');
+
+ $this->default = 500;
+ }
+
+ // XXX: Should these error actions even be invokable via URI?
+
+ function handle($args)
+ {
+ parent::handle($args);
+
+ $this->code = $this->trimmed('code');
+
+ if (!$this->code || $code < 500 || $code > 599) {
+ $this->code = $this->default;
+ }
+
+ $this->message = $this->trimmed('message');
+
+ if (!$this->message) {
+ $this->message = "Server Error $this->code";
+ }
+
+ $this->showPage();
+ }
+
+}
diff --git a/actions/showgroup.php b/actions/showgroup.php
index c0359f502..534043c24 100644
--- a/actions/showgroup.php
+++ b/actions/showgroup.php
@@ -201,13 +201,12 @@ class ShowgroupAction extends Action
function showGroupProfile()
{
- $this->elementStart('div', array('id' => 'group_profile',
- 'class' => 'vcard author'));
+ $this->elementStart('div', 'entity_profile vcard author');
$this->element('h2', null, _('Group profile'));
- $this->elementStart('dl', 'group_depiction');
- $this->element('dt', null, _('Photo'));
+ $this->elementStart('dl', 'entity_depiction');
+ $this->element('dt', null, _('Avatar'));
$this->elementStart('dd');
$logo = ($this->group->homepage_logo) ?
@@ -221,10 +220,10 @@ class ShowgroupAction extends Action
$this->elementEnd('dd');
$this->elementEnd('dl');
- $this->elementStart('dl', 'group_nickname');
+ $this->elementStart('dl', 'entity_nickname');
$this->element('dt', null, _('Nickname'));
$this->elementStart('dd');
- $hasFN = ($this->group->fullname) ? 'nickname url uid' : 'fn nickname url uid';
+ $hasFN = ($this->group->fullname) ? 'nickname url uid' : 'fn org nickname url uid';
$this->element('a', array('href' => $this->group->homeUrl(),
'rel' => 'me', 'class' => $hasFN),
$this->group->nickname);
@@ -232,23 +231,23 @@ class ShowgroupAction extends Action
$this->elementEnd('dl');
if ($this->group->fullname) {
- $this->elementStart('dl', 'group_fn');
+ $this->elementStart('dl', 'entity_fn');
$this->element('dt', null, _('Full name'));
$this->elementStart('dd');
- $this->element('span', 'fn', $this->group->fullname);
+ $this->element('span', 'fn org', $this->group->fullname);
$this->elementEnd('dd');
$this->elementEnd('dl');
}
if ($this->group->location) {
- $this->elementStart('dl', 'group_location');
+ $this->elementStart('dl', 'entity_location');
$this->element('dt', null, _('Location'));
$this->element('dd', 'location', $this->group->location);
$this->elementEnd('dl');
}
if ($this->group->homepage) {
- $this->elementStart('dl', 'group_url');
+ $this->elementStart('dl', 'entity_url');
$this->element('dt', null, _('URL'));
$this->elementStart('dd');
$this->element('a', array('href' => $this->group->homepage,
@@ -259,7 +258,7 @@ class ShowgroupAction extends Action
}
if ($this->group->description) {
- $this->elementStart('dl', 'group_note');
+ $this->elementStart('dl', 'entity_note');
$this->element('dt', null, _('Note'));
$this->element('dd', 'note', $this->group->description);
$this->elementEnd('dl');
@@ -267,15 +266,17 @@ class ShowgroupAction extends Action
$this->elementEnd('div');
- $this->elementStart('div', array('id' => 'group_actions'));
+ $this->elementStart('div', 'entity_actions');
$this->element('h2', null, _('Group actions'));
$this->elementStart('ul');
- $this->elementStart('li', array('id' => 'group_subscribe'));
+ $this->elementStart('li', array('id' => 'entity_subscribe'));
$cur = common_current_user();
if ($cur) {
if ($cur->isMember($this->group)) {
- $lf = new LeaveForm($this, $this->group);
- $lf->show();
+ if (!$cur->isAdmin($this->group)) {
+ $lf = new LeaveForm($this, $this->group);
+ $lf->show();
+ }
} else {
$jf = new JoinForm($this, $this->group);
$jf->show();
@@ -348,7 +349,7 @@ class ShowgroupAction extends Action
return;
}
- $this->elementStart('div', array('id' => 'user_subscriptions',
+ $this->elementStart('div', array('id' => 'entity_subscriptions',
'class' => 'section'));
$this->element('h2', null, _('Members'));
@@ -367,4 +368,4 @@ class ShowgroupAction extends Action
_('All members'));
}
}
-} \ No newline at end of file
+}
diff --git a/actions/showstream.php b/actions/showstream.php
index 9734c2907..1ea84cf21 100644
--- a/actions/showstream.php
+++ b/actions/showstream.php
@@ -169,14 +169,14 @@ class ShowstreamAction extends Action
$this->element('link', array('rel' => 'alternate',
'href' => common_local_url('api',
array('apiaction' => 'statuses',
- 'method' => 'user_timeline.rss',
+ 'method' => 'entity_timeline.rss',
'argument' => $this->user->nickname)),
'type' => 'application/rss+xml',
'title' => sprintf(_('Notice feed for %s'), $this->user->nickname)));
$this->element('link', array('rel' => 'alternate feed',
'href' => common_local_url('api',
array('apiaction' => 'statuses',
- 'method' => 'user_timeline.atom',
+ 'method' => 'entity_timeline.atom',
'argument' => $this->user->nickname)),
'type' => 'application/atom+xml',
'title' => sprintf(_('Notice feed for %s'), $this->user->nickname)));
@@ -227,11 +227,11 @@ class ShowstreamAction extends Action
function showProfile()
{
- $this->elementStart('div', array('id' => 'user_profile', 'class' => 'vcard author'));
+ $this->elementStart('div', 'entity_profile vcard author');
$this->element('h2', null, _('User profile'));
$avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE);
- $this->elementStart('dl', 'user_depiction');
+ $this->elementStart('dl', 'entity_depiction');
$this->element('dt', null, _('Photo'));
$this->elementStart('dd');
$this->element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_PROFILE_SIZE),
@@ -242,7 +242,7 @@ class ShowstreamAction extends Action
$this->elementEnd('dd');
$this->elementEnd('dl');
- $this->elementStart('dl', 'user_nickname');
+ $this->elementStart('dl', 'entity_nickname');
$this->element('dt', null, _('Nickname'));
$this->elementStart('dd');
$hasFN = ($this->profile->fullname) ? 'nickname url uid' : 'fn nickname url uid';
@@ -253,7 +253,7 @@ class ShowstreamAction extends Action
$this->elementEnd('dl');
if ($this->profile->fullname) {
- $this->elementStart('dl', 'user_fn');
+ $this->elementStart('dl', 'entity_fn');
$this->element('dt', null, _('Full name'));
$this->elementStart('dd');
$this->element('span', 'fn', $this->profile->fullname);
@@ -262,14 +262,14 @@ class ShowstreamAction extends Action
}
if ($this->profile->location) {
- $this->elementStart('dl', 'user_location');
+ $this->elementStart('dl', 'entity_location');
$this->element('dt', null, _('Location'));
$this->element('dd', 'location', $this->profile->location);
$this->elementEnd('dl');
}
if ($this->profile->homepage) {
- $this->elementStart('dl', 'user_url');
+ $this->elementStart('dl', 'entity_url');
$this->element('dt', null, _('URL'));
$this->elementStart('dd');
$this->element('a', array('href' => $this->profile->homepage,
@@ -280,7 +280,7 @@ class ShowstreamAction extends Action
}
if ($this->profile->bio) {
- $this->elementStart('dl', 'user_note');
+ $this->elementStart('dl', 'entity_note');
$this->element('dt', null, _('Note'));
$this->element('dd', 'note', $this->profile->bio);
$this->elementEnd('dl');
@@ -288,7 +288,7 @@ class ShowstreamAction extends Action
$tags = Profile_tag::getTags($this->profile->id, $this->profile->id);
if (count($tags) > 0) {
- $this->elementStart('dl', 'user_tags');
+ $this->elementStart('dl', 'entity_tags');
$this->element('dt', null, _('Tags'));
$this->elementStart('dd');
$this->elementStart('ul', 'tags xoxo');
@@ -307,10 +307,11 @@ class ShowstreamAction extends Action
}
$this->elementEnd('div');
- $this->elementStart('div', array('id' => 'user_actions'));
+ //XXX: entity_actions doesn't need to be outputted if entity is looking at their own profile
+ $this->elementStart('div', 'entity_actions');
$this->element('h2', null, _('User actions'));
$this->elementStart('ul');
- $this->elementStart('li', array('id' => 'user_subscribe'));
+ $this->elementStart('li', array('id' => 'entity_subscribe'));
$cur = common_current_user();
if ($cur) {
if ($cur->id != $this->profile->id) {
@@ -331,14 +332,14 @@ class ShowstreamAction extends Action
$user = User::staticGet('id', $this->profile->id);
if ($cur && $cur->id != $user->id && $cur->mutuallySubscribed($user)) {
- $this->elementStart('li', array('id' => 'user_send-a-message'));
+ $this->elementStart('li', array('id' => 'entity_send-a-message'));
$this->element('a', array('href' => common_local_url('newmessage', array('to' => $user->id)),
'title' => _('Send a direct message to this user')),
_('Message'));
$this->elementEnd('li');
if ($user->email && $user->emailnotifynudge) {
- $this->elementStart('li', array('id' => 'user_nudge'));
+ $this->elementStart('li', array('id' => 'entity_nudge'));
$nf = new NudgeForm($this, $user);
$nf->show();
$this->elementEnd('li');
@@ -347,7 +348,7 @@ class ShowstreamAction extends Action
if ($cur && $cur->id != $this->profile->id) {
$blocked = $cur->hasBlocked($this->profile);
- $this->elementStart('li', array('id' => 'user_block'));
+ $this->elementStart('li', array('id' => 'entity_block'));
if ($blocked) {
$ubf = new UnblockForm($this, $this->profile);
$ubf->show();
@@ -366,7 +367,7 @@ class ShowstreamAction extends Action
$url = common_local_url('remotesubscribe',
array('nickname' => $this->profile->nickname));
$this->element('a', array('href' => $url,
- 'id' => 'user_subscribe_remote'),
+ 'id' => 'entity_subscribe_remote'),
_('Subscribe'));
}
@@ -383,17 +384,17 @@ class ShowstreamAction extends Action
function showSections()
{
- $this->showStatistics();
$this->showSubscriptions();
$this->showSubscribers();
$this->showGroups();
+ $this->showStatistics();
}
function showSubscriptions()
{
$profile = $this->user->getSubscriptions(0, PROFILES_PER_MINILIST + 1);
- $this->elementStart('div', array('id' => 'user_subscriptions',
+ $this->elementStart('div', array('id' => 'entity_subscriptions',
'class' => 'section'));
$this->element('h2', null, _('Subscriptions'));
@@ -410,7 +411,7 @@ class ShowstreamAction extends Action
$this->elementStart('p');
$this->element('a', array('href' => common_local_url('subscriptions',
array('nickname' => $this->profile->nickname)),
- 'class' => 'mores'),
+ 'class' => 'more'),
_('All subscriptions'));
$this->elementEnd('p');
}
@@ -422,7 +423,7 @@ class ShowstreamAction extends Action
{
$profile = $this->user->getSubscribers(0, PROFILES_PER_MINILIST + 1);
- $this->elementStart('div', array('id' => 'user_subscribers',
+ $this->elementStart('div', array('id' => 'entity_subscribers',
'class' => 'section'));
$this->element('h2', null, _('Subscribers'));
@@ -439,7 +440,7 @@ class ShowstreamAction extends Action
$this->elementStart('p');
$this->element('a', array('href' => common_local_url('subscribers',
array('nickname' => $this->profile->nickname)),
- 'class' => 'mores'),
+ 'class' => 'more'),
_('All subscribers'));
$this->elementEnd('p');
}
@@ -462,19 +463,19 @@ class ShowstreamAction extends Action
$notices->profile_id = $this->profile->id;
$notice_count = (int) $notices->count();
- $this->elementStart('div', array('id' => 'user_statistics',
+ $this->elementStart('div', array('id' => 'entity_statistics',
'class' => 'section'));
$this->element('h2', null, _('Statistics'));
// Other stats...?
- $this->elementStart('dl', 'user_member-since');
+ $this->elementStart('dl', 'entity_member-since');
$this->element('dt', null, _('Member since'));
$this->element('dd', null, date('j M Y',
strtotime($this->profile->created)));
$this->elementEnd('dl');
- $this->elementStart('dl', 'user_subscriptions');
+ $this->elementStart('dl', 'entity_subscriptions');
$this->elementStart('dt');
$this->element('a', array('href' => common_local_url('subscriptions',
array('nickname' => $this->profile->nickname))),
@@ -483,7 +484,7 @@ class ShowstreamAction extends Action
$this->element('dd', null, (is_int($subs_count)) ? $subs_count : '0');
$this->elementEnd('dl');
- $this->elementStart('dl', 'user_subscribers');
+ $this->elementStart('dl', 'entity_subscribers');
$this->elementStart('dt');
$this->element('a', array('href' => common_local_url('subscribers',
array('nickname' => $this->profile->nickname))),
@@ -492,7 +493,7 @@ class ShowstreamAction extends Action
$this->element('dd', 'subscribers', (is_int($subbed_count)) ? $subbed_count : '0');
$this->elementEnd('dl');
- $this->elementStart('dl', 'user_notices');
+ $this->elementStart('dl', 'entity_notices');
$this->element('dt', null, _('Notices'));
$this->element('dd', null, (is_int($notice_count)) ? $notice_count : '0');
$this->elementEnd('dl');
@@ -504,7 +505,7 @@ class ShowstreamAction extends Action
{
$groups = $this->user->getGroups(0, GROUPS_PER_MINILIST + 1);
- $this->elementStart('div', array('id' => 'user_groups',
+ $this->elementStart('div', array('id' => 'entity_groups',
'class' => 'section'));
$this->element('h2', null, _('Groups'));
@@ -521,7 +522,7 @@ class ShowstreamAction extends Action
$this->elementStart('p');
$this->element('a', array('href' => common_local_url('usergroups',
array('nickname' => $this->profile->nickname)),
- 'class' => 'mores'),
+ 'class' => 'more'),
_('All groups'));
$this->elementEnd('p');
}