summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
Diffstat (limited to 'actions')
-rw-r--r--actions/apidirectmessagenew.php2
-rw-r--r--actions/apifavoritecreate.php2
-rw-r--r--actions/apigroupcreate.php9
-rw-r--r--actions/editgroup.php5
-rw-r--r--actions/emailsettings.php2
-rw-r--r--actions/facebookhome.php275
-rw-r--r--actions/facebookinvite.php145
-rw-r--r--actions/facebooklogin.php101
-rw-r--r--actions/facebookremove.php67
-rw-r--r--actions/facebooksettings.php150
-rw-r--r--actions/groupbyid.php5
-rw-r--r--actions/groupdesignsettings.php5
-rw-r--r--actions/grouplogo.php5
-rw-r--r--actions/groupmembers.php9
-rw-r--r--actions/grouprss.php5
-rw-r--r--actions/invite.php2
-rw-r--r--actions/joingroup.php5
-rw-r--r--actions/leavegroup.php5
-rw-r--r--actions/newgroup.php5
-rw-r--r--actions/register.php2
-rw-r--r--actions/showgroup.php5
-rw-r--r--actions/showstream.php366
22 files changed, 240 insertions, 937 deletions
diff --git a/actions/apidirectmessagenew.php b/actions/apidirectmessagenew.php
index fa6cafbe8..ca1ee70dd 100644
--- a/actions/apidirectmessagenew.php
+++ b/actions/apidirectmessagenew.php
@@ -157,7 +157,7 @@ class ApiDirectMessageNewAction extends ApiAuthAction
// Note: sending msgs to yourself is allowed by Twitter
$errmsg = 'Don\'t send a message to yourself; ' .
- 'just say it to yourself quietly instead.'
+ 'just say it to yourself quietly instead.';
$this->clientError(_($errmsg), 403, $this->format);
return;
diff --git a/actions/apifavoritecreate.php b/actions/apifavoritecreate.php
index a80a6492e..436739770 100644
--- a/actions/apifavoritecreate.php
+++ b/actions/apifavoritecreate.php
@@ -127,7 +127,7 @@ class ApiFavoriteCreateAction extends ApiAuthAction
if (empty($fave)) {
$this->clientError(
- _('Could not create favorite.')
+ _('Could not create favorite.'),
403,
$this->format
);
diff --git a/actions/apigroupcreate.php b/actions/apigroupcreate.php
index cdb2afb5b..f66e83073 100644
--- a/actions/apigroupcreate.php
+++ b/actions/apigroupcreate.php
@@ -99,15 +99,6 @@ class ApiGroupCreateAction extends ApiAuthAction
{
parent::handle($args);
- if (!common_config('inboxes', 'enabled')) {
- $this->serverError(
- _('Inboxes must be enabled for groups to work'),
- 400,
- $this->format
- );
- return false;
- }
-
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
$this->clientError(
_('This method requires a POST.'),
diff --git a/actions/editgroup.php b/actions/editgroup.php
index 5dd039f8a..cf1608035 100644
--- a/actions/editgroup.php
+++ b/actions/editgroup.php
@@ -64,11 +64,6 @@ class EditgroupAction extends GroupDesignAction
{
parent::prepare($args);
- if (!common_config('inboxes','enabled')) {
- $this->serverError(_('Inboxes must be enabled for groups to work'));
- return false;
- }
-
if (!common_logged_in()) {
$this->clientError(_('You must be logged in to create a group.'));
return false;
diff --git a/actions/emailsettings.php b/actions/emailsettings.php
index 6eff06c0d..67b991cdc 100644
--- a/actions/emailsettings.php
+++ b/actions/emailsettings.php
@@ -326,7 +326,7 @@ class EmailsettingsAction extends AccountSettingsAction
$this->showForm(_('Cannot normalize that email address'));
return;
}
- if (!Validate::email($email, true)) {
+ if (!Validate::email($email, common_config('email', 'check_domain'))) {
$this->showForm(_('Not a valid email address'));
return;
} else if ($user->email == $email) {
diff --git a/actions/facebookhome.php b/actions/facebookhome.php
deleted file mode 100644
index 70f205205..000000000
--- a/actions/facebookhome.php
+++ /dev/null
@@ -1,275 +0,0 @@
-<?php
-/*
- * 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); }
-
-require_once INSTALLDIR.'/lib/facebookaction.php';
-
-class FacebookhomeAction extends FacebookAction
-{
-
- var $page = null;
-
- function prepare($argarray)
- {
- parent::prepare($argarray);
-
- $this->page = $this->trimmed('page');
-
- if (!$this->page) {
- $this->page = 1;
- }
-
- return true;
- }
-
- function handle($args)
- {
- parent::handle($args);
-
- // If the user has opted not to initially allow the app to have
- // Facebook status update permission, store that preference. Only
- // promt the user the first time she uses the app
- if ($this->arg('skip') || $args['fb_sig_request_method'] == 'GET') {
- $this->facebook->api_client->data_setUserPreference(
- FACEBOOK_PROMPTED_UPDATE_PREF, 'true');
- }
-
- if ($this->flink) {
-
- $this->user = $this->flink->getUser();
-
- // If this is the first time the user has started the app
- // prompt for Facebook status update permission
- if (!$this->facebook->api_client->users_hasAppPermission('publish_stream')) {
-
- if ($this->facebook->api_client->data_getUserPreference(
- FACEBOOK_PROMPTED_UPDATE_PREF) != 'true') {
- $this->getUpdatePermission();
- return;
- }
- }
-
- // Make sure the user's profile box has the lastest notice
- $notice = $this->user->getCurrentNotice();
- if ($notice) {
- $this->updateProfileBox($notice);
- }
-
- if ($this->arg('status_submit') == 'Send') {
- $this->saveNewNotice();
- }
-
- // User is authenticated and has already been prompted once for
- // Facebook status update permission? Then show the main page
- // of the app
- $this->showPage();
-
- } else {
-
- // User hasn't authenticated yet, prompt for creds
- $this->login();
- }
-
- }
-
- function login()
- {
-
- $this->showStylesheets();
-
- $nickname = common_canonical_nickname($this->trimmed('nickname'));
- $password = $this->arg('password');
-
- $msg = null;
-
- if ($nickname) {
-
- if (common_check_user($nickname, $password)) {
-
- $user = User::staticGet('nickname', $nickname);
-
- if (!$user) {
- $this->showLoginForm(_("Server error - couldn't get user!"));
- }
-
- $flink = DB_DataObject::factory('foreign_link');
- $flink->user_id = $user->id;
- $flink->foreign_id = $this->fbuid;
- $flink->service = FACEBOOK_SERVICE;
- $flink->created = common_sql_now();
- $flink->set_flags(true, false, false, false);
-
- $flink_id = $flink->insert();
-
- // XXX: Do some error handling here
-
- $this->setDefaults();
-
- $this->getUpdatePermission();
- return;
-
- } else {
- $msg = _('Incorrect username or password.');
- }
- }
-
- $this->showLoginForm($msg);
- $this->showFooter();
-
- }
-
- function setDefaults()
- {
- $this->facebook->api_client->data_setUserPreference(
- FACEBOOK_PROMPTED_UPDATE_PREF, 'false');
- }
-
- function showNoticeForm()
- {
- $post_action = "$this->app_uri/index.php";
-
- $notice_form = new FacebookNoticeForm($this, $post_action, null,
- $post_action, $this->user);
- $notice_form->show();
- }
-
- function title()
- {
- if ($this->page > 1) {
- return sprintf(_("%s and friends, page %d"), $this->user->nickname, $this->page);
- } else {
- return sprintf(_("%s and friends"), $this->user->nickname);
- }
- }
-
- function showContent()
- {
- $notice = $this->user->noticeInbox(($this->page-1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
-
- $nl = new NoticeList($notice, $this);
-
- $cnt = $nl->show();
-
- $this->pagination($this->page > 1, $cnt > NOTICES_PER_PAGE,
- $this->page, 'index.php', array('nickname' => $this->user->nickname));
- }
-
- function showNoticeList($notice)
- {
-
- $nl = new NoticeList($notice, $this);
- return $nl->show();
- }
-
- function getUpdatePermission() {
-
- $this->showStylesheets();
-
- $this->elementStart('div', array('class' => 'facebook_guide'));
-
- $instructions = sprintf(_('If you would like the %s app to automatically update ' .
- 'your Facebook status with your latest notice, you need ' .
- 'to give it permission.'), $this->app_name);
-
- $this->elementStart('p');
- $this->element('span', array('id' => 'permissions_notice'), $instructions);
- $this->elementEnd('p');
-
- $this->elementStart('form', array('method' => 'post',
- 'action' => "index.php",
- 'id' => 'facebook-skip-permissions'));
-
- $this->elementStart('ul', array('id' => 'fb-permissions-list'));
- $this->elementStart('li', array('id' => 'fb-permissions-item'));
-
- $next = urlencode("$this->app_uri/index.php");
- $api_key = common_config('facebook', 'apikey');
-
- $auth_url = 'http://www.facebook.com/authorize.php?api_key=' .
- $api_key . '&v=1.0&ext_perm=publish_stream&next=' . $next .
- '&next_cancel=' . $next . '&submit=skip';
-
- $this->elementStart('span', array('class' => 'facebook-button'));
- $this->element('a', array('href' => $auth_url),
- sprintf(_('Okay, do it!'), $this->app_name));
- $this->elementEnd('span');
-
- $this->elementEnd('li');
-
- $this->elementStart('li', array('id' => 'fb-permissions-item'));
- $this->submit('skip', _('Skip'));
- $this->elementEnd('li');
- $this->elementEnd('ul');
-
- $this->elementEnd('form');
- $this->elementEnd('div');
-
- }
-
- /**
- * Generate pagination links
- *
- * @param boolean $have_before is there something before?
- * @param boolean $have_after is there something after?
- * @param integer $page current page
- * @param string $action current action
- * @param array $args rest of query arguments
- *
- * @return nothing
- */
- function pagination($have_before, $have_after, $page, $action, $args=null)
- {
-
- // Does a little before-after block for next/prev page
-
- // XXX: Fix so this uses common_local_url() if possible.
-
- if ($have_before || $have_after) {
- $this->elementStart('div', array('class' => 'pagination'));
- $this->elementStart('dl', null);
- $this->element('dt', null, _('Pagination'));
- $this->elementStart('dd', null);
- $this->elementStart('ul', array('class' => 'nav'));
- }
- if ($have_before) {
- $pargs = array('page' => $page-1);
- $newargs = $args ? array_merge($args, $pargs) : $pargs;
- $this->elementStart('li', array('class' => 'nav_prev'));
- $this->element('a', array('href' => "$action?page=$newargs[page]", 'rel' => 'prev'),
- _('After'));
- $this->elementEnd('li');
- }
- if ($have_after) {
- $pargs = array('page' => $page+1);
- $newargs = $args ? array_merge($args, $pargs) : $pargs;
- $this->elementStart('li', array('class' => 'nav_next'));
- $this->element('a', array('href' => "$action?page=$newargs[page]", 'rel' => 'next'),
- _('Before'));
- $this->elementEnd('li');
- }
- if ($have_before || $have_after) {
- $this->elementEnd('ul');
- $this->elementEnd('dd');
- $this->elementEnd('dl');
- $this->elementEnd('div');
- }
- }
-
-}
diff --git a/actions/facebookinvite.php b/actions/facebookinvite.php
deleted file mode 100644
index 6dfc9d688..000000000
--- a/actions/facebookinvite.php
+++ /dev/null
@@ -1,145 +0,0 @@
-<?php
-/*
- * 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);
-}
-
-require_once(INSTALLDIR.'/lib/facebookaction.php');
-
-class FacebookinviteAction extends FacebookAction
-{
-
- function handle($args)
- {
- parent::handle($args);
- $this->showForm();
- }
-
- /**
- * Wrapper for showing a page
- *
- * Stores an error and shows the page
- *
- * @param string $error Error, if any
- *
- * @return void
- */
-
- function showForm($error=null)
- {
- $this->error = $error;
- $this->showPage();
- }
-
- /**
- * Show the page content
- *
- * Either shows the registration form or, if registration was successful,
- * instructions for using the site.
- *
- * @return void
- */
-
- function showContent()
- {
- if ($this->arg('ids')) {
- $this->showSuccessContent();
- } else {
- $this->showFormContent();
- }
- }
-
- function showSuccessContent()
- {
-
- $this->element('h2', null, sprintf(_('Thanks for inviting your friends to use %s'),
- common_config('site', 'name')));
- $this->element('p', null, _('Invitations have been sent to the following users:'));
-
- $friend_ids = $_POST['ids']; // XXX: Hmm... is this the best way to access the list?
-
- $this->elementStart('ul', array('id' => 'facebook-friends'));
-
- foreach ($friend_ids as $friend) {
- $this->elementStart('li');
- $this->element('fb:profile-pic', array('uid' => $friend, 'size' => 'square'));
- $this->element('fb:name', array('uid' => $friend,
- 'capitalize' => 'true'));
- $this->elementEnd('li');
- }
-
- $this->elementEnd("ul");
-
- }
-
- function showFormContent()
- {
- $content = sprintf(_('You have been invited to %s'), common_config('site', 'name')) .
- htmlentities('<fb:req-choice url="' . $this->app_uri . '" label="Add"/>');
-
- $this->elementStart('fb:request-form', array('action' => 'invite.php',
- 'method' => 'post',
- 'invite' => 'true',
- 'type' => common_config('site', 'name'),
- 'content' => $content));
- $this->hidden('invite', 'true');
- $actiontext = sprintf(_('Invite your friends to use %s'), common_config('site', 'name'));
-
- $multi_params = array('showborder' => 'false');
- $multi_params['actiontext'] = $actiontext;
- $multi_params['bypass'] = 'cancel';
-
- // Get a list of users who are already using the app for exclusion
- $exclude_ids = $this->facebook->api_client->friends_getAppUsers();
- $exclude_ids_csv = null;
-
- // fbml needs these as a csv string, not an array
- if ($exclude_ids) {
- $exclude_ids_csv = implode(',', $exclude_ids);
- $multi_params['exclude_ids'] = $exclude_ids_csv;
- }
-
- $this->element('fb:multi-friend-selector', $multi_params);
- $this->elementEnd('fb:request-form');
-
- if ($exclude_ids) {
-
- $this->element('h2', null, sprintf(_('Friends already using %s:'),
- common_config('site', 'name')));
- $this->elementStart('ul', array('id' => 'facebook-friends'));
-
- foreach ($exclude_ids as $friend) {
- $this->elementStart('li');
- $this->element('fb:profile-pic', array('uid' => $friend, 'size' => 'square'));
- $this->element('fb:name', array('uid' => $friend,
- 'capitalize' => 'true'));
- $this->elementEnd('li');
- }
-
- $this->elementEnd("ul");
- }
- }
-
- function title()
- {
- return sprintf(_('Send invitations'));
- }
-
-}
diff --git a/actions/facebooklogin.php b/actions/facebooklogin.php
deleted file mode 100644
index 8ac2477ab..000000000
--- a/actions/facebooklogin.php
+++ /dev/null
@@ -1,101 +0,0 @@
-<?php
-/*
- * 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); }
-
-require_once(INSTALLDIR.'/lib/facebookaction.php');
-
-class FacebookinviteAction extends FacebookAction
-{
-
- function handle($args)
- {
- parent::handle($args);
-
- $this->error = $error;
-
- if ($this->flink) {
- if (!$this->facebook->api_client->users_hasAppPermission('publish_stream') &&
- $this->facebook->api_client->data_getUserPreference(
- FACEBOOK_PROMPTED_UPDATE_PREF) == 'true') {
-
- echo '<h1>REDIRECT TO HOME</h1>';
- }
- } else {
- $this->showPage();
- }
- }
-
-
- function showContent()
- {
-
- // If the user has opted not to initially allow the app to have
- // Facebook status update permission, store that preference. Only
- // promt the user the first time she uses the app
- if ($this->arg('skip')) {
- $this->facebook->api_client->data_setUserPreference(
- FACEBOOK_PROMPTED_UPDATE_PREF, 'true');
- }
-
- if ($this->flink) {
-
- $this->user = $this->flink->getUser();
-
- // If this is the first time the user has started the app
- // prompt for Facebook status update permission
- if (!$this->facebook->api_client->users_hasAppPermission('publish_stream')) {
-
- if ($this->facebook->api_client->data_getUserPreference(
- FACEBOOK_PROMPTED_UPDATE_PREF) != 'true') {
- $this->getUpdatePermission();
- return;
- }
- }
-
- } else {
- $this->showLoginForm();
- }
-
- }
-
- function showSuccessContent()
- {
-
-
-
- }
-
- function showFormContent()
- {
-
-
- }
-
- function title()
- {
- return sprintf(_('Login'));
- }
-
- function redirectHome()
- {
-
- }
-
-}
diff --git a/actions/facebookremove.php b/actions/facebookremove.php
deleted file mode 100644
index ae231c0fb..000000000
--- a/actions/facebookremove.php
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-/*
- * 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); }
-
-require_once INSTALLDIR.'/lib/facebookaction.php';
-
-class FacebookremoveAction extends FacebookAction
-{
-
- function handle($args)
- {
- parent::handle($args);
-
- $secret = common_config('facebook', 'secret');
-
- $sig = '';
-
- ksort($_POST);
-
- foreach ($_POST as $key => $val) {
- if (substr($key, 0, 7) == 'fb_sig_') {
- $sig .= substr($key, 7) . '=' . $val;
- }
- }
-
- $sig .= $secret;
- $verify = md5($sig);
-
- if ($verify == $this->arg('fb_sig')) {
-
- $flink = Foreign_link::getByForeignID($this->arg('fb_sig_user'), 2);
-
- common_debug("Removing foreign link to Facebook - local user ID: $flink->user_id, Facebook ID: $flink->foreign_id");
-
- $result = $flink->delete();
-
- if (!$result) {
- common_log_db_error($flink, 'DELETE', __FILE__);
- $this->serverError(_('Couldn\'t remove Facebook user.'));
- return;
- }
-
- } else {
- # Someone bad tried to remove facebook link?
- common_log(LOG_ERR, "Someone from $_SERVER[REMOTE_ADDR] " .
- 'unsuccessfully tried to remove a foreign link to Facebook!');
- }
- }
-
-}
diff --git a/actions/facebooksettings.php b/actions/facebooksettings.php
deleted file mode 100644
index 84bdde910..000000000
--- a/actions/facebooksettings.php
+++ /dev/null
@@ -1,150 +0,0 @@
-<?php
-/*
- * 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); }
-
-require_once INSTALLDIR.'/lib/facebookaction.php';
-
-class FacebooksettingsAction extends FacebookAction
-{
-
- function handle($args)
- {
- parent::handle($args);
- $this->showPage();
- }
-
- /**
- * Show the page content
- *
- * Either shows the registration form or, if registration was successful,
- * instructions for using the site.
- *
- * @return void
- */
-
- function showContent()
- {
- if ($this->arg('save')) {
- $this->saveSettings();
- } else {
- $this->showForm();
- }
- }
-
- function saveSettings() {
-
- $noticesync = $this->arg('noticesync');
- $replysync = $this->arg('replysync');
- $prefix = $this->trimmed('prefix');
-
- $original = clone($this->flink);
- $this->flink->set_flags($noticesync, $replysync, false, false);
- $result = $this->flink->update($original);
-
- $this->facebook->api_client->data_setUserPreference(FACEBOOK_NOTICE_PREFIX,
- substr($prefix, 0, 128));
-
- if ($result === false) {
- $this->showForm(_('There was a problem saving your sync preferences!'));
- } else {
- $this->showForm(_('Sync preferences saved.'), true);
- }
- }
-
- function showForm($msg = null, $success = false) {
-
- if ($msg) {
- if ($success) {
- $this->element('fb:success', array('message' => $msg));
- } else {
- $this->element('fb:error', array('message' => $msg));
- }
- }
-
- if ($this->facebook->api_client->users_hasAppPermission('publish_stream')) {
-
- $this->elementStart('form', array('method' => 'post',
- 'id' => 'facebook_settings'));
-
- $this->elementStart('ul', 'form_data');
-
- $this->elementStart('li');
-
- $this->checkbox('noticesync', _('Automatically update my Facebook status with my notices.'),
- ($this->flink) ? ($this->flink->noticesync & FOREIGN_NOTICE_SEND) : true);
-
- $this->elementEnd('li');
-
- $this->elementStart('li');
-
- $this->checkbox('replysync', _('Send "@" replies to Facebook.'),
- ($this->flink) ? ($this->flink->noticesync & FOREIGN_NOTICE_SEND_REPLY) : true);
-
- $this->elementEnd('li');
-
- $this->elementStart('li');
-
- $prefix = $this->facebook->api_client->data_getUserPreference(FACEBOOK_NOTICE_PREFIX);
-
- $this->input('prefix', _('Prefix'),
- ($prefix) ? $prefix : null,
- _('A string to prefix notices with.'));
-
- $this->elementEnd('li');
-
- $this->elementStart('li');
-
- $this->submit('save', _('Save'));
-
- $this->elementEnd('li');
-
- $this->elementEnd('ul');
-
- $this->elementEnd('form');
-
- } else {
-
- $instructions = sprintf(_('If you would like %s to automatically update ' .
- 'your Facebook status with your latest notice, you need ' .
- 'to give it permission.'), $this->app_name);
-
- $this->elementStart('p');
- $this->element('span', array('id' => 'permissions_notice'), $instructions);
- $this->elementEnd('p');
-
- $this->elementStart('ul', array('id' => 'fb-permissions-list'));
- $this->elementStart('li', array('id' => 'fb-permissions-item'));
- $this->elementStart('fb:prompt-permission', array('perms' => 'publish_stream',
- 'next_fbjs' => 'document.setLocation(\'' . "$this->app_uri/settings.php" . '\')'));
- $this->element('span', array('class' => 'facebook-button'),
- sprintf(_('Allow %s to update my Facebook status'), common_config('site', 'name')));
- $this->elementEnd('fb:prompt-permission');
- $this->elementEnd('li');
- $this->elementEnd('ul');
- }
-
- }
-
- function title()
- {
- return _('Sync preferences');
- }
-
-}
diff --git a/actions/groupbyid.php b/actions/groupbyid.php
index 52cfaddfc..f65bf511a 100644
--- a/actions/groupbyid.php
+++ b/actions/groupbyid.php
@@ -68,11 +68,6 @@ class GroupbyidAction extends Action
{
parent::prepare($args);
- if (!common_config('inboxes','enabled')) {
- $this->serverError(_('Inboxes must be enabled for groups to work'));
- return false;
- }
-
$id = $this->arg('id');
if (!$id) {
diff --git a/actions/groupdesignsettings.php b/actions/groupdesignsettings.php
index cd86e3b05..b87b7d156 100644
--- a/actions/groupdesignsettings.php
+++ b/actions/groupdesignsettings.php
@@ -64,11 +64,6 @@ class GroupDesignSettingsAction extends DesignSettingsAction
{
parent::prepare($args);
- if (!common_config('inboxes', 'enabled')) {
- $this->serverError(_('Inboxes must be enabled for groups to work'));
- return false;
- }
-
if (!common_logged_in()) {
$this->clientError(_('You must be logged in to edit a group.'));
return false;
diff --git a/actions/grouplogo.php b/actions/grouplogo.php
index 63ba769c7..a9dc7eb1d 100644
--- a/actions/grouplogo.php
+++ b/actions/grouplogo.php
@@ -66,11 +66,6 @@ class GrouplogoAction extends GroupDesignAction
{
parent::prepare($args);
- if (!common_config('inboxes','enabled')) {
- $this->serverError(_('Inboxes must be enabled for groups to work'));
- return false;
- }
-
if (!common_logged_in()) {
$this->clientError(_('You must be logged in to create a group.'));
return false;
diff --git a/actions/groupmembers.php b/actions/groupmembers.php
index dcbdd3759..b326a0df7 100644
--- a/actions/groupmembers.php
+++ b/actions/groupmembers.php
@@ -179,9 +179,12 @@ class GroupMemberListItem extends ProfileListItem
function showActions()
{
$this->startActions();
- $this->showSubscribeButton();
- $this->showMakeAdminForm();
- $this->showGroupBlockForm();
+ if (Event::handle('StartProfileListItemActionElements', array($this))) {
+ $this->showSubscribeButton();
+ $this->showMakeAdminForm();
+ $this->showGroupBlockForm();
+ Event::handle('EndProfileListItemActionElements', array($this));
+ }
$this->endActions();
}
diff --git a/actions/grouprss.php b/actions/grouprss.php
index 6a6b55e78..50e48a67e 100644
--- a/actions/grouprss.php
+++ b/actions/grouprss.php
@@ -76,11 +76,6 @@ class groupRssAction extends Rss10Action
{
parent::prepare($args);
- if (!common_config('inboxes','enabled')) {
- $this->serverError(_('Inboxes must be enabled for groups to work'));
- return false;
- }
-
$nickname_arg = $this->arg('nickname');
$nickname = common_canonical_nickname($nickname_arg);
diff --git a/actions/invite.php b/actions/invite.php
index 788130c58..3015202e9 100644
--- a/actions/invite.php
+++ b/actions/invite.php
@@ -68,7 +68,7 @@ class InviteAction extends CurrentUserDesignAction
foreach ($addresses as $email) {
$email = trim($email);
- if (!Validate::email($email, true)) {
+ if (!Validate::email($email, common_config('email', 'check_domain'))) {
$this->showForm(sprintf(_('Invalid email address: %s'), $email));
return;
}
diff --git a/actions/joingroup.php b/actions/joingroup.php
index 0209dd43f..bf69b2ad1 100644
--- a/actions/joingroup.php
+++ b/actions/joingroup.php
@@ -56,11 +56,6 @@ class JoingroupAction extends Action
{
parent::prepare($args);
- if (!common_config('inboxes','enabled')) {
- $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.'));
return false;
diff --git a/actions/leavegroup.php b/actions/leavegroup.php
index 60b22e147..08fce1509 100644
--- a/actions/leavegroup.php
+++ b/actions/leavegroup.php
@@ -56,11 +56,6 @@ class LeavegroupAction extends Action
{
parent::prepare($args);
- if (!common_config('inboxes','enabled')) {
- $this->serverError(_('Inboxes must be enabled for groups to work.'));
- return false;
- }
-
if (!common_logged_in()) {
$this->clientError(_('You must be logged in to leave a group.'));
return false;
diff --git a/actions/newgroup.php b/actions/newgroup.php
index a2cf72528..80da9861a 100644
--- a/actions/newgroup.php
+++ b/actions/newgroup.php
@@ -61,11 +61,6 @@ class NewgroupAction extends Action
{
parent::prepare($args);
- if (!common_config('inboxes','enabled')) {
- $this->serverError(_('Inboxes must be enabled for groups to work'));
- return false;
- }
-
if (!common_logged_in()) {
$this->clientError(_('You must be logged in to create a group.'));
return false;
diff --git a/actions/register.php b/actions/register.php
index 100ab7424..a6c1a903a 100644
--- a/actions/register.php
+++ b/actions/register.php
@@ -191,7 +191,7 @@ class RegisterAction extends Action
if (!$this->boolean('license')) {
$this->showForm(_('You can\'t register if you don\'t '.
'agree to the license.'));
- } else if ($email && !Validate::email($email, true)) {
+ } else if ($email && !Validate::email($email, common_config('email', 'check_domain'))) {
$this->showForm(_('Not a valid email address.'));
} else if (!Validate::string($nickname, array('min_length' => 1,
'max_length' => 64,
diff --git a/actions/showgroup.php b/actions/showgroup.php
index a67765ce5..bfe45ddad 100644
--- a/actions/showgroup.php
+++ b/actions/showgroup.php
@@ -101,11 +101,6 @@ class ShowgroupAction extends GroupDesignAction
{
parent::prepare($args);
- if (!common_config('inboxes','enabled')) {
- $this->serverError(_('Inboxes must be enabled for groups to work'));
- return false;
- }
-
$this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
$nickname_arg = $this->arg('nickname');
diff --git a/actions/showstream.php b/actions/showstream.php
index cdac4f47b..b3a9b1f05 100644
--- a/actions/showstream.php
+++ b/actions/showstream.php
@@ -115,11 +115,11 @@ class ShowstreamAction extends ProfileAction
{
if (!empty($this->tag)) {
return array(new Feed(Feed::RSS1,
- common_local_url('userrss',
- array('nickname' => $this->user->nickname,
- 'tag' => $this->tag)),
- sprintf(_('Notice feed for %s tagged %s (RSS 1.0)'),
- $this->user->nickname, $this->tag)));
+ common_local_url('userrss',
+ array('nickname' => $this->user->nickname,
+ 'tag' => $this->tag)),
+ sprintf(_('Notice feed for %s tagged %s (RSS 1.0)'),
+ $this->user->nickname, $this->tag)));
}
return array(new Feed(Feed::RSS1,
@@ -181,159 +181,251 @@ class ShowstreamAction extends ProfileAction
function showProfile()
{
- $this->elementStart('div', 'entity_profile vcard author');
- $this->element('h2', null, _('User profile'));
-
- $avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE);
- $this->elementStart('dl', 'entity_depiction');
- $this->element('dt', null, _('Photo'));
- $this->elementStart('dd');
- $this->element('img', array('src' => ($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE),
- 'class' => 'photo avatar',
- 'width' => AVATAR_PROFILE_SIZE,
- 'height' => AVATAR_PROFILE_SIZE,
- 'alt' => $this->profile->nickname));
- $this->elementEnd('dd');
-
- $user = User::staticGet('id', $this->profile->id);
- $cur = common_current_user();
- if ($cur && $cur->id == $user->id) {
- $this->elementStart('dd');
- $this->element('a', array('href' => common_local_url('avatarsettings')), _('Edit Avatar'));
- $this->elementEnd('dd');
+ $this->showProfileData();
+ $this->showEntityActions();
+ }
+
+ function showProfileData()
+ {
+ if (Event::handle('StartProfilePageProfileSection', array(&$this, $this->profile))) {
+
+ $this->elementStart('div', 'entity_profile vcard author');
+ $this->element('h2', null, _('User profile'));
+
+ if (Event::handle('StartProfilePageProfileElements', array(&$this, $this->profile))) {
+
+ $this->showAvatar();
+ $this->showNickname();
+ $this->showFullName();
+ $this->showLocation();
+ $this->showHomepage();
+ $this->showBio();
+ $this->showProfileTags();
+
+ Event::handle('EndProfilePageProfileElements', array(&$this, $this->profile));
+ }
+
+ $this->elementEnd('div');
+ Event::handle('EndProfilePageProfileSection', array(&$this, $this->profile));
}
+ }
+
+ function showAvatar()
+ {
+ if (Event::handle('StartProfilePageAvatar', array($this, $this->profile))) {
+
+ $avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE);
- $this->elementEnd('dl');
-
- $this->elementStart('dl', 'entity_nickname');
- $this->element('dt', null, _('Nickname'));
- $this->elementStart('dd');
- $hasFN = ($this->profile->fullname) ? 'nickname url uid' : 'fn nickname url uid';
- $this->element('a', array('href' => $this->profile->profileurl,
- 'rel' => 'me', 'class' => $hasFN),
- $this->profile->nickname);
- $this->elementEnd('dd');
- $this->elementEnd('dl');
-
- if ($this->profile->fullname) {
- $this->elementStart('dl', 'entity_fn');
- $this->element('dt', null, _('Full name'));
+ $this->elementStart('dl', 'entity_depiction');
+ $this->element('dt', null, _('Photo'));
$this->elementStart('dd');
- $this->element('span', 'fn', $this->profile->fullname);
+ $this->element('img', array('src' => ($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE),
+ 'class' => 'photo avatar',
+ 'width' => AVATAR_PROFILE_SIZE,
+ 'height' => AVATAR_PROFILE_SIZE,
+ 'alt' => $this->profile->nickname));
$this->elementEnd('dd');
- $this->elementEnd('dl');
- }
- if ($this->profile->location) {
- $this->elementStart('dl', 'entity_location');
- $this->element('dt', null, _('Location'));
- $this->element('dd', 'label', $this->profile->location);
+ $user = User::staticGet('id', $this->profile->id);
+
+ $cur = common_current_user();
+ if ($cur && $cur->id == $user->id) {
+ $this->elementStart('dd');
+ $this->element('a', array('href' => common_local_url('avatarsettings')), _('Edit Avatar'));
+ $this->elementEnd('dd');
+ }
+
$this->elementEnd('dl');
+
+ Event::handle('EndProfilePageAvatar', array($this, $this->profile));
}
+ }
+
+ function showNickname()
+ {
+ if (Event::handle('StartProfilePageNickname', array($this, $this->profile))) {
- if ($this->profile->homepage) {
- $this->elementStart('dl', 'entity_url');
- $this->element('dt', null, _('URL'));
+ $this->elementStart('dl', 'entity_nickname');
+ $this->element('dt', null, _('Nickname'));
$this->elementStart('dd');
- $this->element('a', array('href' => $this->profile->homepage,
- 'rel' => 'me', 'class' => 'url'),
- $this->profile->homepage);
+ $hasFN = ($this->profile->fullname) ? 'nickname url uid' : 'fn nickname url uid';
+ $this->element('a', array('href' => $this->profile->profileurl,
+ 'rel' => 'me', 'class' => $hasFN),
+ $this->profile->nickname);
$this->elementEnd('dd');
$this->elementEnd('dl');
+
+ Event::handle('EndProfilePageNickname', array($this, $this->profile));
}
+ }
- if ($this->profile->bio) {
- $this->elementStart('dl', 'entity_note');
- $this->element('dt', null, _('Note'));
- $this->element('dd', 'note', $this->profile->bio);
- $this->elementEnd('dl');
+ function showFullName()
+ {
+ if (Event::handle('StartProfilePageFullName', array($this, $this->profile))) {
+ if ($this->profile->fullname) {
+ $this->elementStart('dl', 'entity_fn');
+ $this->element('dt', null, _('Full name'));
+ $this->elementStart('dd');
+ $this->element('span', 'fn', $this->profile->fullname);
+ $this->elementEnd('dd');
+ $this->elementEnd('dl');
+ }
+ Event::handle('EndProfilePageFullName', array($this, $this->profile));
}
+ }
- $tags = Profile_tag::getTags($this->profile->id, $this->profile->id);
- if (count($tags) > 0) {
- $this->elementStart('dl', 'entity_tags');
- $this->element('dt', null, _('Tags'));
- $this->elementStart('dd');
- $this->elementStart('ul', 'tags xoxo');
- foreach ($tags as $tag) {
- $this->elementStart('li');
- // Avoid space by using raw output.
- $pt = '<span class="mark_hash">#</span><a rel="tag" href="' .
- common_local_url('peopletag', array('tag' => $tag)) .
- '">' . $tag . '</a>';
- $this->raw($pt);
- $this->elementEnd('li');
+ function showLocation()
+ {
+ if (Event::handle('StartProfilePageLocation', array($this, $this->profile))) {
+ if ($this->profile->location) {
+ $this->elementStart('dl', 'entity_location');
+ $this->element('dt', null, _('Location'));
+ $this->element('dd', 'label', $this->profile->location);
+ $this->elementEnd('dl');
}
- $this->elementEnd('ul');
- $this->elementEnd('dd');
- $this->elementEnd('dl');
+ Event::handle('EndProfilePageLocation', array($this, $this->profile));
}
- $this->elementEnd('div');
+ }
- $this->elementStart('div', 'entity_actions');
- $this->element('h2', null, _('User actions'));
- $this->elementStart('ul');
- $cur = common_current_user();
-
- if ($cur && $cur->id == $this->profile->id) {
- $this->elementStart('li', 'entity_edit');
- $this->element('a', array('href' => common_local_url('profilesettings'),
- 'title' => _('Edit profile settings')),
- _('Edit'));
- $this->elementEnd('li');
+ function showHomepage()
+ {
+ if (Event::handle('StartProfilePageHomepage', array($this, $this->profile))) {
+ if ($this->profile->homepage) {
+ $this->elementStart('dl', 'entity_url');
+ $this->element('dt', null, _('URL'));
+ $this->elementStart('dd');
+ $this->element('a', array('href' => $this->profile->homepage,
+ 'rel' => 'me', 'class' => 'url'),
+ $this->profile->homepage);
+ $this->elementEnd('dd');
+ $this->elementEnd('dl');
+ }
+ Event::handle('EndProfilePageHomepage', array($this, $this->profile));
}
+ }
- if ($cur) {
- if ($cur->id != $this->profile->id) {
- $this->elementStart('li', 'entity_subscribe');
- if ($cur->isSubscribed($this->profile)) {
- $usf = new UnsubscribeForm($this, $this->profile);
- $usf->show();
- } else {
- $sf = new SubscribeForm($this, $this->profile);
- $sf->show();
- }
- $this->elementEnd('li');
+ function showBio()
+ {
+ if (Event::handle('StartProfilePageBio', array($this, $this->profile))) {
+ if ($this->profile->bio) {
+ $this->elementStart('dl', 'entity_note');
+ $this->element('dt', null, _('Note'));
+ $this->element('dd', 'note', $this->profile->bio);
+ $this->elementEnd('dl');
}
- } else {
- $this->elementStart('li', 'entity_subscribe');
- $this->showRemoteSubscribeLink();
- $this->elementEnd('li');
+ Event::handle('EndProfilePageBio', array($this, $this->profile));
}
+ }
- if ($cur && $cur->id != $user->id && $cur->mutuallySubscribed($user)) {
- $this->elementStart('li', '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', 'entity_nudge');
- $nf = new NudgeForm($this, $user);
- $nf->show();
- $this->elementEnd('li');
+ function showProfileTags()
+ {
+ if (Event::handle('StartProfilePageProfileTags', array($this, $this->profile))) {
+ $tags = Profile_tag::getTags($this->profile->id, $this->profile->id);
+
+ if (count($tags) > 0) {
+ $this->elementStart('dl', 'entity_tags');
+ $this->element('dt', null, _('Tags'));
+ $this->elementStart('dd');
+ $this->elementStart('ul', 'tags xoxo');
+ foreach ($tags as $tag) {
+ $this->elementStart('li');
+ // Avoid space by using raw output.
+ $pt = '<span class="mark_hash">#</span><a rel="tag" href="' .
+ common_local_url('peopletag', array('tag' => $tag)) .
+ '">' . $tag . '</a>';
+ $this->raw($pt);
+ $this->elementEnd('li');
+ }
+ $this->elementEnd('ul');
+ $this->elementEnd('dd');
+ $this->elementEnd('dl');
}
+ Event::handle('EndProfilePageProfileTags', array($this, $this->profile));
}
+ }
- if ($cur && $cur->id != $this->profile->id) {
- $blocked = $cur->hasBlocked($this->profile);
- $this->elementStart('li', 'entity_block');
- if ($blocked) {
- $ubf = new UnblockForm($this, $this->profile,
- array('action' => 'showstream',
- 'nickname' => $this->profile->nickname));
- $ubf->show();
- } else {
- $bf = new BlockForm($this, $this->profile,
- array('action' => 'showstream',
- 'nickname' => $this->profile->nickname));
- $bf->show();
+ function showEntityActions()
+ {
+ if (Event::handle('StartProfilePageActionsSection', array(&$this, $this->profile))) {
+
+ $this->elementStart('div', 'entity_actions');
+ $this->element('h2', null, _('User actions'));
+ $this->elementStart('ul');
+
+ if (Event::handle('StartProfilePageActionsElements', array(&$this, $this->profile))) {
+ if (empty($cur)) { // not logged in
+ $this->elementStart('li', 'entity_subscribe');
+ $this->showRemoteSubscribeLink();
+ $this->elementEnd('li');
+ } else {
+ if ($cur->id == $this->profile->id) { // your own page
+ $this->elementStart('li', 'entity_edit');
+ $this->element('a', array('href' => common_local_url('profilesettings'),
+ 'title' => _('Edit profile settings')),
+ _('Edit'));
+ $this->elementEnd('li');
+ } else { // someone else's page
+
+ // subscribe/unsubscribe button
+
+ $this->elementStart('li', 'entity_subscribe');
+
+ if ($cur->isSubscribed($this->profile)) {
+ $usf = new UnsubscribeForm($this, $this->profile);
+ $usf->show();
+ } else {
+ $sf = new SubscribeForm($this, $this->profile);
+ $sf->show();
+ }
+ $this->elementEnd('li');
+
+ if ($cur->mutuallySubscribed($user)) {
+
+ // message
+
+ $this->elementStart('li', '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');
+
+ // nudge
+
+ if ($user->email && $user->emailnotifynudge) {
+ $this->elementStart('li', 'entity_nudge');
+ $nf = new NudgeForm($this, $user);
+ $nf->show();
+ $this->elementEnd('li');
+ }
+ }
+
+ // block/unblock
+
+ $blocked = $cur->hasBlocked($this->profile);
+ $this->elementStart('li', 'entity_block');
+ if ($blocked) {
+ $ubf = new UnblockForm($this, $this->profile,
+ array('action' => 'showstream',
+ 'nickname' => $this->profile->nickname));
+ $ubf->show();
+ } else {
+ $bf = new BlockForm($this, $this->profile,
+ array('action' => 'showstream',
+ 'nickname' => $this->profile->nickname));
+ $bf->show();
+ }
+ $this->elementEnd('li');
+ }
+ }
+
+ Event::handle('EndProfilePageActionsElements', array(&$this, $this->profile));
}
- $this->elementEnd('li');
+
+ $this->elementEnd('ul');
+ $this->elementEnd('div');
+
+ Event::handle('EndProfilePageActionsSection', array(&$this, $this->profile));
}
- $this->elementEnd('ul');
- $this->elementEnd('div');
}
function showRemoteSubscribeLink()
@@ -369,7 +461,7 @@ class ShowstreamAction extends ProfileAction
function showNotices()
{
$notice = empty($this->tag)
- ? $this->user->getNotices(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1)
+ ? $this->user->getNotices(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1)
: $this->user->getTaggedNotices($this->tag, ($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1, 0, 0, null);
$pnl = new ProfileNoticeList($notice, $this);
@@ -391,14 +483,14 @@ class ShowstreamAction extends ProfileAction
{
if (!(common_config('site','closed') || common_config('site','inviteonly'))) {
$m = sprintf(_('**%s** has an account on %%%%site.name%%%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' .
- 'based on the Free Software [StatusNet](http://status.net/) tool. ' .
- '[Join now](%%%%action.register%%%%) to follow **%s**\'s notices and many more! ([Read more](%%%%doc.help%%%%))'),
- $this->user->nickname, $this->user->nickname);
+ 'based on the Free Software [StatusNet](http://status.net/) tool. ' .
+ '[Join now](%%%%action.register%%%%) to follow **%s**\'s notices and many more! ([Read more](%%%%doc.help%%%%))'),
+ $this->user->nickname, $this->user->nickname);
} else {
$m = sprintf(_('**%s** has an account on %%%%site.name%%%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' .
- 'based on the Free Software [StatusNet](http://status.net/) tool. '),
- $this->user->nickname, $this->user->nickname);
- }
+ 'based on the Free Software [StatusNet](http://status.net/) tool. '),
+ $this->user->nickname, $this->user->nickname);
+ }
$this->elementStart('div', array('id' => 'anon_notice'));
$this->raw(common_markup_to_html($m));
$this->elementEnd('div');