diff options
author | Evan Prodromou <evan@status.net> | 2009-10-02 15:27:55 -0400 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2009-10-02 15:27:55 -0400 |
commit | b3b3af9a2eff10c272bb213eccd3dd3060bc5830 (patch) | |
tree | ff0ae9108bcb085015a8e9f286963ad9fe58c13c /actions | |
parent | 51ac34e80c5a99008b1a945b2c00b6dbfdde1529 (diff) | |
parent | 5309910b9b4dd2533ff5b2190f90bf415fd20113 (diff) |
Merge branch '0.8.x' into deleteuser
Diffstat (limited to 'actions')
117 files changed, 2053 insertions, 1561 deletions
diff --git a/actions/accesstoken.php b/actions/accesstoken.php index 2a8cd1713..c99aaeded 100644 --- a/actions/accesstoken.php +++ b/actions/accesstoken.php @@ -5,14 +5,14 @@ * PHP version 5 * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ * - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -28,7 +28,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -38,11 +38,11 @@ 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> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ */ class AccesstokenAction extends Action { diff --git a/actions/all.php b/actions/all.php index f06ead2a8..bfde3a7e4 100644 --- a/actions/all.php +++ b/actions/all.php @@ -1,7 +1,7 @@ <?php /* - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { exit(1); } +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } require_once INSTALLDIR.'/lib/personalgroupnav.php'; require_once INSTALLDIR.'/lib/noticelist.php'; @@ -25,11 +25,31 @@ require_once INSTALLDIR.'/lib/feedlist.php'; class AllAction extends ProfileAction { + var $notice; + function isReadOnly($args) { return true; } + function prepare($args) + { + parent::prepare($args); + $cur = common_current_user(); + + if (!empty($cur) && $cur->id == $this->user->id) { + $this->notice = $this->user->noticeInbox(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1); + } else { + $this->notice = $this->user->noticesWithFriends(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1); + } + + if($this->page > 1 && $this->notice->N == 0){ + $this->serverError(_('No such page'),$code=404); + } + + return true; + } + function handle($args) { parent::handle($args); @@ -88,7 +108,9 @@ class AllAction extends ProfileAction } } else { - $message .= sprintf(_('Why not [register an account](%%%%action.register%%%%) and then nudge %s or post a notice to his or her attention.'), $this->user->nickname); + $message .= sprintf(_('Why not [register an account](%%%%action.%s%%%%) and then nudge %s or post a notice to his or her attention.'), + (!common_config('site','openidonly')) ? 'register' : 'openidlogin', + $this->user->nickname); } $this->elementStart('div', 'guide'); @@ -98,15 +120,7 @@ class AllAction extends ProfileAction function showContent() { - $cur = common_current_user(); - - if (!empty($cur) && $cur->id == $this->user->id) { - $notice = $this->user->noticeInbox(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1); - } else { - $notice = $this->user->noticesWithFriends(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1); - } - - $nl = new NoticeList($notice, $this); + $nl = new NoticeList($this->notice, $this); $cnt = $nl->show(); diff --git a/actions/allrss.php b/actions/allrss.php index 885a67f61..57efb73f0 100644 --- a/actions/allrss.php +++ b/actions/allrss.php @@ -6,14 +6,14 @@ * PHP version 5 * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ * - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -29,7 +29,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -41,11 +41,11 @@ require_once INSTALLDIR.'/lib/rssaction.php'; * Formatting of RSS handled by Rss10Action * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ */ class AllrssAction extends Rss10Action { @@ -115,8 +115,8 @@ class AllrssAction extends Rss10Action 'link' => common_local_url('all', array('nickname' => $user->nickname)), - 'description' => sprintf(_('Feed for friends of %s'), - $user->nickname)); + 'description' => sprintf(_('Updates from %1$s and friends on %2$s!'), + $user->nickname, common_config('site', 'name'))); return $c; } diff --git a/actions/api.php b/actions/api.php index 8b92889f8..3705d035c 100644 --- a/actions/api.php +++ b/actions/api.php @@ -1,7 +1,7 @@ <?php /* - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { exit(1); } +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } class ApiAction extends Action { @@ -27,6 +27,8 @@ class ApiAction extends Action var $api_arg; var $api_method; var $api_action; + var $auth_user; + var $auth_pw; function handle($args) { @@ -35,6 +37,7 @@ class ApiAction extends Action $this->api_action = $this->arg('apiaction'); $method = $this->arg('method'); $argument = $this->arg('argument'); + $this->basic_auth_process_header(); if (isset($argument)) { $cmdext = explode('.', $argument); @@ -50,16 +53,16 @@ class ApiAction extends Action } if ($this->requires_auth()) { - if (!isset($_SERVER['PHP_AUTH_USER'])) { + if (!isset($this->auth_user)) { # This header makes basic auth go - header('WWW-Authenticate: Basic realm="Laconica API"'); + header('WWW-Authenticate: Basic realm="StatusNet API"'); # If the user hits cancel -- bam! $this->show_basic_auth_error(); } else { - $nickname = $_SERVER['PHP_AUTH_USER']; - $password = $_SERVER['PHP_AUTH_PW']; + $nickname = $this->auth_user; + $password = $this->auth_pw; $user = common_check_user($nickname, $password); if ($user) { @@ -76,8 +79,8 @@ class ApiAction extends Action } else { // Caller might give us a username even if not required - if (isset($_SERVER['PHP_AUTH_USER'])) { - $user = User::staticGet('nickname', $_SERVER['PHP_AUTH_USER']); + if (isset($this->auth_user)) { + $user = User::staticGet('nickname', $this->auth_user); if ($user) { $this->user = $user; } @@ -125,29 +128,36 @@ class ApiAction extends Action 'users/show', 'help/test', 'help/downtime_schedule', - 'laconica/version', - 'laconica/config', - 'laconica/wadl', + 'statusnet/version', + 'statusnet/config', + 'statusnet/wadl', 'tags/timeline', 'oembed/oembed', + 'groups/show', + 'groups/timeline', + 'groups/list_all', + 'groups/membership', + 'groups/is_member', 'groups/timeline'); static $bareauth = array('statuses/user_timeline', 'statuses/friends_timeline', + 'statuses/home_timeline', 'statuses/friends', 'statuses/replies', 'statuses/mentions', 'statuses/followers', 'favorites/favorites', - 'friendships/show'); + 'friendships/show', + 'groups/list_groups'); $fullname = "$this->api_action/$this->api_method"; - // If the site is "private", all API methods except laconica/config + // If the site is "private", all API methods except statusnet/config // need authentication if (common_config('site', 'private')) { - return $fullname != 'laconica/config' || false; + return $fullname != 'statusnet/config' || false; } // bareauth: only needs auth if without an argument or query param specifying user @@ -197,6 +207,39 @@ class ApiAction extends Action } } + function basic_auth_process_header() + { + if(isset($_SERVER['AUTHORIZATION']) || isset($_SERVER['HTTP_AUTHORIZATION'])) + { + $authorization_header = isset($_SERVER['HTTP_AUTHORIZATION'])?$_SERVER['HTTP_AUTHORIZATION']:$_SERVER['AUTHORIZATION']; + } + + if(isset($_SERVER['PHP_AUTH_USER'])) + { + $this->auth_user = $_SERVER['PHP_AUTH_USER']; + $this->auth_pw = $_SERVER['PHP_AUTH_PW']; + } + elseif ( isset($authorization_header) && strstr(substr($authorization_header, 0,5),'Basic') ) + { + // decode the HTTP_AUTHORIZATION header on php-cgi server self + // on fcgid server the header name is AUTHORIZATION + + $auth_hash = base64_decode( substr($authorization_header, 6) ); + list($this->auth_user, $this->auth_pw) = explode(':', $auth_hash); + + // set all to NULL on a empty basic auth request + if($this->auth_user == "") { + $this->auth_user = NULL; + $this->auth_pw = NULL; + } + } + else + { + $this->auth_user = NULL; + $this->auth_pw = NULL; + } + } + function show_basic_auth_error() { header('HTTP/1.1 401 Unauthorized'); diff --git a/actions/attachment.php b/actions/attachment.php index c6a5d0d52..6981354d1 100644 --- a/actions/attachment.php +++ b/actions/attachment.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * Show notice attachments * @@ -20,14 +20,14 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Personal - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -37,10 +37,10 @@ require_once INSTALLDIR.'/lib/attachmentlist.php'; * Show notice attachments * * @category Personal - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class AttachmentAction extends Action @@ -103,18 +103,18 @@ class AttachmentAction extends Action $this->element('link',array('rel'=>'alternate', 'type'=>'application/json+oembed', 'href'=>common_local_url( - 'api', - array('apiaction'=>'oembed','method'=>'oembed.json'), - array('url'=> + 'oembed', + array(), + array('format'=>'json', 'url'=> common_local_url('attachment', array('attachment' => $this->attachment->id)))), 'title'=>'oEmbed'),null); $this->element('link',array('rel'=>'alternate', 'type'=>'text/xml+oembed', 'href'=>common_local_url( - 'api', - array('apiaction'=>'oembed','method'=>'oembed.xml'), - array('url'=> + 'oembed', + array(), + array('format'=>'xml','url'=> common_local_url('attachment', array('attachment' => $this->attachment->id)))), 'title'=>'oEmbed'),null); diff --git a/actions/attachment_ajax.php b/actions/attachment_ajax.php index 4caa159f3..1e0728075 100644 --- a/actions/attachment_ajax.php +++ b/actions/attachment_ajax.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * Show notice attachments * @@ -20,14 +20,14 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Personal - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -37,10 +37,10 @@ require_once INSTALLDIR.'/actions/attachment.php'; * Show notice attachments * * @category Personal - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class Attachment_ajaxAction extends AttachmentAction diff --git a/actions/attachment_thumbnail.php b/actions/attachment_thumbnail.php index 248d16e38..7d0ac97a6 100644 --- a/actions/attachment_thumbnail.php +++ b/actions/attachment_thumbnail.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * Show notice attachments * @@ -20,14 +20,14 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Personal - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -37,10 +37,10 @@ require_once INSTALLDIR.'/actions/attachment.php'; * Show notice attachments * * @category Personal - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class Attachment_thumbnailAction extends AttachmentAction diff --git a/actions/avatarbynickname.php b/actions/avatarbynickname.php index 3e615261f..537950792 100644 --- a/actions/avatarbynickname.php +++ b/actions/avatarbynickname.php @@ -5,14 +5,14 @@ * PHP version 5 * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ * - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -28,7 +28,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -36,11 +36,11 @@ if (!defined('LACONICA')) { * Retrieve user avatar by nickname action class. * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ */ class AvatarbynicknameAction extends Action { diff --git a/actions/avatarsettings.php b/actions/avatarsettings.php index c2bb35a39..ded419dd7 100644 --- a/actions/avatarsettings.php +++ b/actions/avatarsettings.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * Upload an avatar * @@ -20,15 +20,15 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Settings - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Zach Copley <zach@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Zach Copley <zach@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -42,12 +42,12 @@ define('MAX_ORIGINAL', 480); * 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> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Zach Copley <zach@status.net> + * @author Sarven Capadisli <csarven@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class AvatarsettingsAction extends AccountSettingsAction @@ -362,13 +362,13 @@ class AvatarsettingsAction extends AccountSettingsAction $profile = $user->getProfile(); $avatar = $profile->getOriginalAvatar(); - $avatar->delete(); + if($avatar) $avatar->delete(); $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE); - $avatar->delete(); + if($avatar) $avatar->delete(); $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE); - $avatar->delete(); + if($avatar) $avatar->delete(); $avatar = $profile->getAvatar(AVATAR_MINI_SIZE); - $avatar->delete(); + if($avatar) $avatar->delete(); $this->showForm(_('Avatar deleted.'), true); } @@ -382,13 +382,7 @@ class AvatarsettingsAction extends AccountSettingsAction function showStylesheets() { parent::showStylesheets(); - $jcropStyle = - common_path('theme/base/css/jquery.Jcrop.css?version='.LACONICA_VERSION); - - $this->element('link', array('rel' => 'stylesheet', - 'type' => 'text/css', - 'href' => $jcropStyle, - 'media' => 'screen, projection, tv')); + $this->cssLink('css/jquery.Jcrop.css','base','screen, projection, tv'); } /** @@ -402,13 +396,10 @@ class AvatarsettingsAction extends AccountSettingsAction parent::showScripts(); if ($this->mode == 'crop') { - $jcropPack = common_path('js/jcrop/jquery.Jcrop.pack.js'); - $jcropGo = common_path('js/jcrop/jquery.Jcrop.go.js'); - - $this->element('script', array('type' => 'text/javascript', - 'src' => $jcropPack)); - $this->element('script', array('type' => 'text/javascript', - 'src' => $jcropGo)); + $this->script('js/jcrop/jquery.Jcrop.min.js'); + $this->script('js/jcrop/jquery.Jcrop.go.js'); } + + $this->autofocus('avatarfile'); } } diff --git a/actions/block.php b/actions/block.php index 06f92254e..408f16434 100644 --- a/actions/block.php +++ b/actions/block.php @@ -5,14 +5,14 @@ * PHP version 5 * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ * - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -28,7 +28,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -36,11 +36,11 @@ if (!defined('LACONICA')) { * Block a user action class. * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ */ class BlockAction extends Action { diff --git a/actions/blockedfromgroup.php b/actions/blockedfromgroup.php index 5c1eab354..ca4a711cb 100644 --- a/actions/blockedfromgroup.php +++ b/actions/blockedfromgroup.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * List of group members * @@ -20,14 +20,14 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Group - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -35,10 +35,10 @@ if (!defined('LACONICA')) { * List of profiles blocked from this group * * @category Group - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class BlockedfromgroupAction extends GroupDesignAction @@ -190,11 +190,11 @@ class GroupBlockListItem extends ProfileListItem * Form for unblocking a user from a group * * @category Form - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Sarven Capadisli <csarven@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Sarven Capadisli <csarven@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ * * @see UnblockForm */ diff --git a/actions/confirmaddress.php b/actions/confirmaddress.php index 725c1f1e3..201694286 100644 --- a/actions/confirmaddress.php +++ b/actions/confirmaddress.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * Confirm an address * @@ -20,14 +20,14 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Confirm - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -39,10 +39,10 @@ if (!defined('LACONICA')) { * accepts those codes. * * @category Confirm - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class ConfirmaddressAction extends Action @@ -67,7 +67,11 @@ class ConfirmaddressAction extends Action parent::handle($args); if (!common_logged_in()) { common_set_returnto($this->selfUrl()); - common_redirect(common_local_url('login')); + if (!common_config('site', 'openidonly')) { + common_redirect(common_local_url('login')); + } else { + common_redirect(common_local_url('openidlogin')); + } return; } $code = $this->trimmed('code'); diff --git a/actions/conversation.php b/actions/conversation.php index c8755ba6e..900a724ef 100644 --- a/actions/conversation.php +++ b/actions/conversation.php @@ -5,13 +5,13 @@ * PHP version 5 * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ * - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2009, Control Yourself, Inc. + * StatusNet - the distributed open-source microblogging tool + * Copyright (C) 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 @@ -27,7 +27,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -40,10 +40,10 @@ require_once INSTALLDIR.'/lib/noticelist.php'; * Conversation tree in the browser * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ */ class ConversationAction extends Action @@ -129,10 +129,10 @@ class ConversationAction extends Action * The widget class for displaying a hierarchical list of notices. * * @category Widget - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ */ class ConversationTree extends NoticeList @@ -167,6 +167,8 @@ class ConversationTree extends NoticeList function _buildTree() { + $cnt = 0; + $this->tree = array(); $this->table = array(); @@ -248,10 +250,10 @@ class ConversationTree extends NoticeList * Special class of NoticeListItem for use inside conversation trees. * * @category Widget - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ */ class ConversationTreeItem extends NoticeListItem diff --git a/actions/deletenotice.php b/actions/deletenotice.php index e733f9650..3d040f2fa 100644 --- a/actions/deletenotice.php +++ b/actions/deletenotice.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * Class for deleting a notice * @@ -20,15 +20,15 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Personal - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Sarven Capadisli <csarven@controlyourself.ca> - * @copyright 2008 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Sarven Capadisli <csarven@status.net> + * @copyright 2008 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } diff --git a/actions/disfavor.php b/actions/disfavor.php index 02e01d6e0..6269f1bd2 100644 --- a/actions/disfavor.php +++ b/actions/disfavor.php @@ -6,14 +6,14 @@ * PHP version 5 * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ * - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -29,7 +29,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -39,11 +39,11 @@ require_once INSTALLDIR.'/lib/favorform.php'; * Disfavor class. * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ */ class DisfavorAction extends Action { diff --git a/actions/doc.php b/actions/doc.php index 54ae13803..68295234c 100644 --- a/actions/doc.php +++ b/actions/doc.php @@ -6,14 +6,14 @@ * PHP version 5 * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ * - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -29,7 +29,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -37,11 +37,11 @@ if (!defined('LACONICA')) { * Documentation class. * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ */ class DocAction extends Action { diff --git a/actions/editgroup.php b/actions/editgroup.php index 6aa6f8b11..b8dac31cb 100644 --- a/actions/editgroup.php +++ b/actions/editgroup.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * Edit an existing group * @@ -20,16 +20,16 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Group - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Sarven Capadisli <csarven@controlyourself.ca> - * @author Zach Copley <zach@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Sarven Capadisli <csarven@status.net> + * @author Zach Copley <zach@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -39,11 +39,11 @@ if (!defined('LACONICA')) { * This is the form for adding a new group * * @category Group - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Zach Copley <zach@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Zach Copley <zach@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class EditgroupAction extends GroupDesignAction @@ -160,6 +160,12 @@ class EditgroupAction extends GroupDesignAction } } + function showScripts() + { + parent::showScripts(); + $this->autofocus('nickname'); + } + function trySave() { $cur = common_current_user(); @@ -244,7 +250,6 @@ class EditgroupAction extends GroupDesignAction $this->group->homepage = $homepage; $this->group->description = $description; $this->group->location = $location; - $this->group->created = common_sql_now(); $result = $this->group->update($orig); diff --git a/actions/emailsettings.php b/actions/emailsettings.php index 634388fdd..6eff06c0d 100644 --- a/actions/emailsettings.php +++ b/actions/emailsettings.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * Settings for email * @@ -20,15 +20,15 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Settings - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Zach Copley <zach@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Zach Copley <zach@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -38,11 +38,11 @@ require_once INSTALLDIR.'/lib/accountsettingsaction.php'; * Settings for email * * @category Settings - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Zach Copley <zach@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Zach Copley <zach@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ * * @see Widget */ @@ -71,6 +71,12 @@ class EmailsettingsAction extends AccountSettingsAction return _('Manage how you get email from %%site.name%%.'); } + function showScripts() + { + parent::showScripts(); + $this->autofocus('email'); + } + /** * Content area of the page * @@ -122,7 +128,7 @@ class EmailsettingsAction extends AccountSettingsAction } $this->elementEnd('fieldset'); - if ($user->email) { + if (common_config('emailpost', 'enabled') && $user->email) { $this->elementStart('fieldset', array('id' => 'settings_email_incoming')); $this->element('legend',_('Incoming email')); if ($user->incomingemail) { @@ -173,11 +179,13 @@ class EmailsettingsAction extends AccountSettingsAction _('Allow friends to nudge me and send me an email.'), $user->emailnotifynudge); $this->elementEnd('li'); - $this->elementStart('li'); - $this->checkbox('emailpost', - _('I want to post notices by email.'), - $user->emailpost); - $this->elementEnd('li'); + if (common_config('emailpost', 'enabled')) { + $this->elementStart('li'); + $this->checkbox('emailpost', + _('I want to post notices by email.'), + $user->emailpost); + $this->elementEnd('li'); + } $this->elementStart('li'); $this->checkbox('emailmicroid', _('Publish a MicroID for my email address.'), diff --git a/actions/facebookhome.php b/actions/facebookhome.php index 6d8d0745d..70f205205 100644 --- a/actions/facebookhome.php +++ b/actions/facebookhome.php @@ -1,7 +1,7 @@ <?php /* - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { exit(1); } +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } require_once INSTALLDIR.'/lib/facebookaction.php'; diff --git a/actions/facebookinvite.php b/actions/facebookinvite.php index f43d04e27..6dfc9d688 100644 --- a/actions/facebookinvite.php +++ b/actions/facebookinvite.php @@ -1,7 +1,7 @@ <?php /* - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } diff --git a/actions/facebooklogin.php b/actions/facebooklogin.php index aa86cfbc0..8ac2477ab 100644 --- a/actions/facebooklogin.php +++ b/actions/facebooklogin.php @@ -1,7 +1,7 @@ <?php /* - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { exit(1); } +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } require_once(INSTALLDIR.'/lib/facebookaction.php'); diff --git a/actions/facebookremove.php b/actions/facebookremove.php index 9ca7a77a8..ae231c0fb 100644 --- a/actions/facebookremove.php +++ b/actions/facebookremove.php @@ -1,7 +1,7 @@ <?php /* - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { exit(1); } +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } require_once INSTALLDIR.'/lib/facebookaction.php'; diff --git a/actions/facebooksettings.php b/actions/facebooksettings.php index c3b364743..84bdde910 100644 --- a/actions/facebooksettings.php +++ b/actions/facebooksettings.php @@ -1,7 +1,7 @@ <?php /* - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { exit(1); } +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } require_once INSTALLDIR.'/lib/facebookaction.php'; diff --git a/actions/favor.php b/actions/favor.php index fe51e34a2..2aeb1da61 100644 --- a/actions/favor.php +++ b/actions/favor.php @@ -6,14 +6,14 @@ * PHP version 5 * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ * - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -29,7 +29,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -40,11 +40,11 @@ require_once INSTALLDIR.'/lib/disfavorform.php'; * Favor class. * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ */ class FavorAction extends Action { diff --git a/actions/favorited.php b/actions/favorited.php index 156c7a700..5ba508cdf 100644 --- a/actions/favorited.php +++ b/actions/favorited.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * List of popular notices * @@ -20,15 +20,15 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Public - * @package Laconica - * @author Zach Copley <zach@controlyourself.ca> - * @author Evan Prodromou <evan@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Zach Copley <zach@status.net> + * @author Evan Prodromou <evan@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -42,11 +42,11 @@ require_once INSTALLDIR.'/lib/noticelist.php'; * is measured by * * @category Personal - * @package Laconica - * @author Zach Copley <zach@controlyourself.ca> - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Zach Copley <zach@status.net> + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class FavoritedAction extends Action @@ -153,7 +153,8 @@ class FavoritedAction extends Action $message .= _('Be the first to add a notice to your favorites by clicking the fave button next to any notice you like.'); } else { - $message .= _('Why not [register an account](%%action.register%%) and be the first to add a notice to your favorites!'); + $message .= sprintf(_('Why not [register an account](%%%%action.%s%%%%) and be the first to add a notice to your favorites!'), + (!common_config('site','openidonly')) ? 'register' : 'openidlogin'); } $this->elementStart('div', 'guide'); diff --git a/actions/favoritesrss.php b/actions/favoritesrss.php index c439a9a62..2d5ce9854 100644 --- a/actions/favoritesrss.php +++ b/actions/favoritesrss.php @@ -6,14 +6,14 @@ * PHP version 5 * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ * - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -29,7 +29,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -41,12 +41,12 @@ require_once INSTALLDIR.'/lib/rssaction.php'; * Formatting of RSS handled by Rss10Action * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> - * @author Zach Copley <zach@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> + * @author Zach Copley <zach@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ */ class FavoritesrssAction extends Rss10Action { @@ -111,8 +111,8 @@ class FavoritesrssAction extends Rss10Action 'link' => common_local_url('showfavorites', array('nickname' => $user->nickname)), - 'description' => sprintf(_('Feed of favorite notices of %s'), - $user->nickname)); + 'description' => sprintf(_('Updates favored by %1$s on %2$s!'), + $user->nickname, common_config('site', 'name'))); return $c; } diff --git a/actions/featured.php b/actions/featured.php index 04365687d..39bf09d8f 100644 --- a/actions/featured.php +++ b/actions/featured.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * List of featured users * @@ -20,15 +20,15 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Public - * @package Laconica - * @author Zach Copley <zach@controlyourself.ca> - * @author Evan Prodromou <evan@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Zach Copley <zach@status.net> + * @author Evan Prodromou <evan@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -39,11 +39,11 @@ require_once INSTALLDIR.'/lib/publicgroupnav.php'; * List of featured users * * @category Public - * @package Laconica - * @author Zach Copley <zach@controlyourself.ca> - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Zach Copley <zach@status.net> + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class FeaturedAction extends Action diff --git a/actions/file.php b/actions/file.php index 8310e48df..10c59a961 100644 --- a/actions/file.php +++ b/actions/file.php @@ -1,7 +1,7 @@ <?php /* - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { exit(1); } +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } require_once(INSTALLDIR.'/actions/shownotice.php'); diff --git a/actions/finishaddopenid.php b/actions/finishaddopenid.php index 32bceecfd..b6de4f244 100644 --- a/actions/finishaddopenid.php +++ b/actions/finishaddopenid.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * Complete adding an OpenID * @@ -20,14 +20,14 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Settings - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -39,10 +39,10 @@ require_once INSTALLDIR.'/lib/openid.php'; * Handle the return from an OpenID verification * * @category Settings - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class FinishaddopenidAction extends Action diff --git a/actions/finishopenidlogin.php b/actions/finishopenidlogin.php index ff0b35218..9ac036985 100644 --- a/actions/finishopenidlogin.php +++ b/actions/finishopenidlogin.php @@ -1,7 +1,7 @@ <?php /* - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { exit(1); } +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } require_once(INSTALLDIR.'/lib/openid.php'); @@ -30,7 +30,9 @@ class FinishopenidloginAction extends Action function handle($args) { parent::handle($args); - if (common_is_real_login()) { + if (!common_config('openid', 'enabled')) { + common_redirect(common_local_url('login')); + } else if (common_is_real_login()) { $this->clientError(_('Already logged in.')); } else if ($_SERVER['REQUEST_METHOD'] == 'POST') { $token = $this->trimmed('token'); @@ -217,7 +219,7 @@ class FinishopenidloginAction extends Action if (!Validate::string($nickname, array('min_length' => 1, 'max_length' => 64, - 'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) { + 'format' => NICKNAME_FMT))) { $this->showForm(_('Nickname must have only lowercase letters and numbers and no spaces.')); return; } @@ -389,7 +391,7 @@ class FinishopenidloginAction extends Action { if (!Validate::string($str, array('min_length' => 1, 'max_length' => 64, - 'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) { + 'format' => NICKNAME_FMT))) { return false; } if (!User::allowed_nickname($str)) { @@ -410,7 +412,7 @@ class FinishopenidloginAction extends Action } } - # We try to use an OpenID URL as a legal Laconica user name in this order + # We try to use an OpenID URL as a legal StatusNet user name in this order # 1. Plain hostname, like http://evanp.myopenid.com/ # 2. One element in path, like http://profile.typekey.com/EvanProdromou/ # or http://getopenid.com/evanprodromou diff --git a/actions/finishremotesubscribe.php b/actions/finishremotesubscribe.php index 5c764aeb0..871bc3d2d 100644 --- a/actions/finishremotesubscribe.php +++ b/actions/finishremotesubscribe.php @@ -1,7 +1,7 @@ <?php /* - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { exit(1); } +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } require_once(INSTALLDIR.'/lib/omb.php'); @@ -284,7 +284,7 @@ class FinishremotesubscribeAction extends Action $fetcher = Auth_Yadis_Yadis::getHTTPFetcher(); $result = $fetcher->post($req->get_normalized_http_url(), $req->to_postdata(), - array('User-Agent: Laconica/' . LACONICA_VERSION)); + array('User-Agent: StatusNet/' . STATUSNET_VERSION)); common_debug('got result: "'.print_r($result,true).'"', __FILE__); diff --git a/actions/foaf.php b/actions/foaf.php index b481b2437..356393304 100644 --- a/actions/foaf.php +++ b/actions/foaf.php @@ -1,7 +1,7 @@ <?php /* - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { exit(1); } +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } define('LISTENER', 1); define('LISTENEE', -1); @@ -146,8 +146,10 @@ class FoafAction extends Action while ($sub->fetch()) { if ($sub->token) { $other = Remote_profile::staticGet('id', $sub->subscriber); + $profile = Profile::staticGet('id', $sub->subscriber); } else { $other = User::staticGet('id', $sub->subscriber); + $profile = Profile::staticGet('id', $sub->subscriber); } if (!$other) { common_debug('Got a bad subscription: '.print_r($sub,true)); @@ -158,12 +160,15 @@ class FoafAction extends Action } else { $person[$other->uri] = array(LISTENER, $other->id, - $other->nickname, + $profile->nickname, (empty($sub->token)) ? 'User' : 'Remote_profile'); } $other->free(); $other = null; unset($other); + $profile->free(); + $profile = null; + unset($profile); } } @@ -254,8 +259,10 @@ class FoafAction extends Action while ($sub->fetch()) { if (!empty($sub->token)) { $other = Remote_profile::staticGet('id', $sub->subscribed); + $profile = Profile::staticGet('id', $sub->subscribed); } else { $other = User::staticGet('id', $sub->subscribed); + $profile = Profile::staticGet('id', $sub->subscribed); } if (empty($other)) { common_debug('Got a bad subscription: '.print_r($sub,true)); @@ -264,11 +271,14 @@ class FoafAction extends Action $this->element('sioc:follows', array('rdf:resource' => $other->uri.'#acct')); $person[$other->uri] = array(LISTENEE, $other->id, - $other->nickname, + $profile->nickname, (empty($sub->token)) ? 'User' : 'Remote_profile'); $other->free(); $other = null; unset($other); + $profile->free(); + $profile = null; + unset($profile); } } diff --git a/actions/groupblock.php b/actions/groupblock.php index ce2c6c144..979a56a81 100644 --- a/actions/groupblock.php +++ b/actions/groupblock.php @@ -5,13 +5,13 @@ * PHP version 5 * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ * - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -27,7 +27,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -35,10 +35,10 @@ if (!defined('LACONICA')) { * Block a user from a group * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ */ class GroupblockAction extends Action diff --git a/actions/groupbyid.php b/actions/groupbyid.php index 7d327d56c..52cfaddfc 100644 --- a/actions/groupbyid.php +++ b/actions/groupbyid.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * Permalink for group * @@ -20,15 +20,15 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Group - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Sarven Capadisli <csarven@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Sarven Capadisli <csarven@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -42,10 +42,10 @@ require_once INSTALLDIR.'/lib/feedlist.php'; * an URL with the ID in it as the permanent identifier. * * @category Group - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class GroupbyidAction extends Action diff --git a/actions/groupdesignsettings.php b/actions/groupdesignsettings.php index bb01243c6..cd86e3b05 100644 --- a/actions/groupdesignsettings.php +++ b/actions/groupdesignsettings.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * Change user password * @@ -20,15 +20,15 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Settings - * @package Laconica - * @author Sarven Capadisli <csarven@controlyourself.ca> - * @author Zach Copley <zach@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Sarven Capadisli <csarven@status.net> + * @author Zach Copley <zach@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -40,11 +40,11 @@ require_once INSTALLDIR . '/lib/designsettings.php'; * Saves a design for a given group * * @category Settings - * @package Laconica - * @author Zach Copley <zach@controlyourself.ca> - * @author Sarven Capadisli <csarven@controlyourself.ca> + * @package StatusNet + * @author Zach Copley <zach@status.net> + * @author Sarven Capadisli <csarven@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class GroupDesignSettingsAction extends DesignSettingsAction diff --git a/actions/grouplogo.php b/actions/grouplogo.php index 8f6158dac..63ba769c7 100644 --- a/actions/grouplogo.php +++ b/actions/grouplogo.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * Upload an avatar * @@ -20,15 +20,15 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Settings - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Zach Copley <zach@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Zach Copley <zach@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -42,12 +42,12 @@ define('MAX_ORIGINAL', 480); * 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> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Zach Copley <zach@status.net> + * @author Sarven Capadisli <csarven@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class GrouplogoAction extends GroupDesignAction @@ -428,13 +428,7 @@ class GrouplogoAction extends GroupDesignAction function showStylesheets() { parent::showStylesheets(); - $jcropStyle = - common_path('theme/base/css/jquery.Jcrop.css?version='.LACONICA_VERSION); - - $this->element('link', array('rel' => 'stylesheet', - 'type' => 'text/css', - 'href' => $jcropStyle, - 'media' => 'screen, projection, tv')); + $this->cssLink('css/jquery.Jcrop.css','base','screen, projection, tv'); } /** @@ -448,14 +442,11 @@ class GrouplogoAction extends GroupDesignAction parent::showScripts(); if ($this->mode == 'crop') { - $jcropPack = common_path('js/jcrop/jquery.Jcrop.pack.js'); - $jcropGo = common_path('js/jcrop/jquery.Jcrop.go.js'); - - $this->element('script', array('type' => 'text/javascript', - 'src' => $jcropPack)); - $this->element('script', array('type' => 'text/javascript', - 'src' => $jcropGo)); + $this->script('js/jcrop/jquery.Jcrop.min.js'); + $this->script('js/jcrop/jquery.Jcrop.go.js'); } + + $this->autofocus('avatarfile'); } function showLocalNav() diff --git a/actions/groupmembers.php b/actions/groupmembers.php index 14256526a..dcbdd3759 100644 --- a/actions/groupmembers.php +++ b/actions/groupmembers.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * List of group members * @@ -20,14 +20,14 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Group - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -38,10 +38,10 @@ require_once INSTALLDIR.'/lib/publicgroupnav.php'; * List of group members * * @category Group - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class GroupmembersAction extends GroupDesignAction @@ -220,11 +220,11 @@ class GroupMemberListItem extends ProfileListItem * Form for blocking a user from a group * * @category Form - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Sarven Capadisli <csarven@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Sarven Capadisli <csarven@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ * * @see BlockForm */ @@ -348,11 +348,11 @@ class GroupBlockForm extends Form * Form for making a user an admin for a group * * @category Form - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Sarven Capadisli <csarven@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Sarven Capadisli <csarven@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class MakeAdminForm extends Form diff --git a/actions/grouprss.php b/actions/grouprss.php index 2bdcaafb2..70c1ded48 100644 --- a/actions/grouprss.php +++ b/actions/grouprss.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * Group main page * @@ -20,15 +20,15 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Group - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Sarven Capadisli <csarven@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Sarven Capadisli <csarven@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -40,10 +40,10 @@ define('MEMBERS_PER_SECTION', 27); * Group RSS feed * * @category Group - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class groupRssAction extends Rss10Action @@ -132,9 +132,10 @@ class groupRssAction extends Rss10Action $c = array('url' => common_local_url('grouprss', array('nickname' => $group->nickname)), - 'title' => $group->nickname, + 'title' => sprintf(_('%s timeline'), $group->nickname), 'link' => common_local_url('showgroup', array('nickname' => $group->nickname)), - 'description' => sprintf(_('Microblog by %s group'), $group->nickname)); + 'description' => sprintf(_('Updates from members of %1$s on %2$s!'), + $group->nickname, common_config('site', 'name'))); return $c; } diff --git a/actions/groups.php b/actions/groups.php index 3d62843ed..10a1d5964 100644 --- a/actions/groups.php +++ b/actions/groups.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * Latest groups information * @@ -20,15 +20,15 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Personal - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Sarven Capadisli <csarven@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Sarven Capadisli <csarven@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -40,10 +40,10 @@ require_once INSTALLDIR.'/lib/grouplist.php'; * Show the latest groups on the site * * @category Personal - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class GroupsAction extends Action diff --git a/actions/groupsearch.php b/actions/groupsearch.php index c50466ce6..be15efc47 100644 --- a/actions/groupsearch.php +++ b/actions/groupsearch.php @@ -5,14 +5,14 @@ * PHP version 5 * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ * - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -28,7 +28,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -39,11 +39,11 @@ if (!defined('LACONICA')) { * Group search action class. * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ */ class GroupsearchAction extends SearchAction { @@ -82,7 +82,8 @@ class GroupsearchAction extends SearchAction $message = _('If you can\'t find the group you\'re looking for, you can [create it](%%action.newgroup%%) yourself.'); } else { - $message = _('Why not [register an account](%%action.register%%) and [create the group](%%action.newgroup%%) yourself!'); + $message = sprintf(_('Why not [register an account](%%%%action.%s%%%%) and [create the group](%%%%action.newgroup%%%%) yourself!'), + (!common_config('site','openidonly')) ? 'register' : 'openidlogin'); } $this->elementStart('div', 'guide'); $this->raw(common_markup_to_html($message)); @@ -90,6 +91,12 @@ class GroupsearchAction extends SearchAction $user_group->free(); } } + + function showScripts() + { + parent::showScripts(); + $this->autofocus('q'); + } } class GroupSearchResults extends GroupList diff --git a/actions/groupunblock.php b/actions/groupunblock.php index 6beb46352..dd6b15c26 100644 --- a/actions/groupunblock.php +++ b/actions/groupunblock.php @@ -5,13 +5,13 @@ * PHP version 5 * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ * - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -27,7 +27,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -35,10 +35,10 @@ if (!defined('LACONICA')) { * Unlock a user from a group * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ */ class GroupunblockAction extends Action diff --git a/actions/imsettings.php b/actions/imsettings.php index e0f5ede3a..f57933b43 100644 --- a/actions/imsettings.php +++ b/actions/imsettings.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * Settings for Jabber/XMPP integration * @@ -20,14 +20,14 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Settings - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -38,10 +38,10 @@ require_once INSTALLDIR.'/lib/jabber.php'; * Settings for Jabber/XMPP integration * * @category Settings - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ * * @see SettingsAction */ @@ -84,6 +84,12 @@ class ImsettingsAction extends ConnectSettingsAction function showContent() { + if (!common_config('xmpp', 'enabled')) { + $this->element('div', array('class' => 'error'), + _('IM is not available.')); + return; + } + $user = common_current_user(); $this->elementStart('form', array('method' => 'post', 'id' => 'form_settings_im', diff --git a/actions/inbox.php b/actions/inbox.php index f14ba631f..6cb7f9e15 100644 --- a/actions/inbox.php +++ b/actions/inbox.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * action handler for message inbox * @@ -20,14 +20,14 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Message - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @copyright 2008 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @copyright 2008 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -37,10 +37,10 @@ require_once INSTALLDIR.'/lib/mailbox.php'; * action handler for message inbox * * @category Message - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ * @see MailboxAction */ diff --git a/actions/invite.php b/actions/invite.php index bdea4807d..9fa6a76f6 100644 --- a/actions/invite.php +++ b/actions/invite.php @@ -1,7 +1,7 @@ <?php /* - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { exit(1); } +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } class InviteAction extends CurrentUserDesignAction { @@ -98,6 +98,12 @@ class InviteAction extends CurrentUserDesignAction $this->showPage(); } + function showScripts() + { + parent::showScripts(); + $this->autofocus('addresses'); + } + function title() { if ($this->mode == 'sent') { @@ -216,7 +222,7 @@ class InviteAction extends CurrentUserDesignAction $recipients = array($email); $headers['From'] = mail_notify_from(); - $headers['To'] = $email; + $headers['To'] = trim($email); $headers['Subject'] = sprintf(_('%1$s has invited you to join them on %2$s'), $bestname, $sitename); $body = sprintf(_("%1\$s has invited you to join them on %2\$s (%3\$s).\n\n". @@ -235,7 +241,7 @@ class InviteAction extends CurrentUserDesignAction common_root_url(), $personal, common_local_url('showstream', array('nickname' => $user->nickname)), - common_local_url('register', array('code' => $invite->code))); + common_local_url((!common_config('site', 'openidonly')) ? 'register' : 'openidlogin', array('code' => $invite->code))); mail_send($recipients, $headers, $body); } diff --git a/actions/joingroup.php b/actions/joingroup.php index 0e4f96eaf..0209dd43f 100644 --- a/actions/joingroup.php +++ b/actions/joingroup.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * Join a group * @@ -20,14 +20,14 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Group - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -38,10 +38,10 @@ if (!defined('LACONICA')) { * for users. * * @category Group - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class JoingroupAction extends Action diff --git a/actions/leavegroup.php b/actions/leavegroup.php index 215ccd901..60b22e147 100644 --- a/actions/leavegroup.php +++ b/actions/leavegroup.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * Leave a group * @@ -20,14 +20,14 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Group - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -38,10 +38,10 @@ if (!defined('LACONICA')) { * for users. * * @category Group - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class LeavegroupAction extends Action diff --git a/actions/login.php b/actions/login.php index 50de83f6f..ac8c40c3e 100644 --- a/actions/login.php +++ b/actions/login.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * Login form * @@ -20,14 +20,15 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Login - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Sarven Capadisli <csarven@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -35,10 +36,11 @@ if (!defined('LACONICA')) { * Login form * * @category Personal - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Sarven Capadisli <csarven@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class LoginAction extends Action @@ -65,6 +67,8 @@ class LoginAction extends Action * * Switches on request method; either shows the form or handles its input. * + * Checks if only OpenID is allowed and redirects to openidlogin if so. + * * @param array $args $_REQUEST data * * @return void @@ -73,7 +77,9 @@ class LoginAction extends Action function handle($args) { parent::handle($args); - if (common_is_real_login()) { + if (common_config('site', 'openidonly')) { + common_redirect(common_local_url('openidlogin')); + } else if (common_is_real_login()) { $this->clientError(_('Already logged in.')); } else if ($_SERVER['REQUEST_METHOD'] == 'POST') { $this->checkLogin(); @@ -158,6 +164,12 @@ class LoginAction extends Action $this->showPage(); } + function showScripts() + { + parent::showScripts(); + $this->autofocus('nickname'); + } + /** * Title of the page * @@ -247,11 +259,15 @@ class LoginAction extends Action return _('For security reasons, please re-enter your ' . 'user name and password ' . 'before changing your settings.'); - } else { + } else if (common_config('openid', 'enabled')) { return _('Login with your username and password. ' . 'Don\'t have a username yet? ' . '[Register](%%action.register%%) a new account, or ' . 'try [OpenID](%%action.openidlogin%%). '); + } else { + return _('Login with your username and password. ' . + 'Don\'t have a username yet? ' . + '[Register](%%action.register%%) a new account.'); } } diff --git a/actions/logout.php b/actions/logout.php index 3fcfb4f4e..298b2a484 100644 --- a/actions/logout.php +++ b/actions/logout.php @@ -5,14 +5,14 @@ * PHP version 5 * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ * - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -28,7 +28,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -38,11 +38,11 @@ require_once INSTALLDIR.'/lib/openid.php'; * Logout action class. * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ */ class LogoutAction extends Action { diff --git a/actions/makeadmin.php b/actions/makeadmin.php index 6fc2cf9ab..2dfddebc2 100644 --- a/actions/makeadmin.php +++ b/actions/makeadmin.php @@ -5,13 +5,13 @@ * PHP version 5 * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ * - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -27,7 +27,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -35,10 +35,10 @@ if (!defined('LACONICA')) { * Make another user an admin of a group * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ */ class MakeadminAction extends Action diff --git a/actions/microsummary.php b/actions/microsummary.php index 6884a919a..5c01a9ce0 100644 --- a/actions/microsummary.php +++ b/actions/microsummary.php @@ -5,14 +5,14 @@ * PHP version 5 * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ * - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -28,7 +28,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -36,11 +36,11 @@ if (!defined('LACONICA')) { * Microsummary action class. * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ */ class MicrosummaryAction extends Action { diff --git a/actions/newgroup.php b/actions/newgroup.php index 0289e77c2..01cb636aa 100644 --- a/actions/newgroup.php +++ b/actions/newgroup.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * Add a new group * @@ -20,15 +20,15 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Group - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Sarven Capadisli <csarven@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Sarven Capadisli <csarven@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -38,10 +38,10 @@ if (!defined('LACONICA')) { * This is the form for adding a new group * * @category Group - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class NewgroupAction extends Action diff --git a/actions/newmessage.php b/actions/newmessage.php index 52d4899ba..828a339cf 100644 --- a/actions/newmessage.php +++ b/actions/newmessage.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * Handler for posting new messages * @@ -20,16 +20,16 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Personal - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Zach Copley <zach@controlyourself.ca> - * @author Sarven Capadisli <csarven@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Zach Copley <zach@status.net> + * @author Sarven Capadisli <csarven@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -37,12 +37,12 @@ if (!defined('LACONICA')) { * Action for posting new direct messages * * @category Personal - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Zach Copley <zach@controlyourself.ca> - * @author Sarven Capadisli <csarven@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Zach Copley <zach@status.net> + * @author Sarven Capadisli <csarven@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class NewmessageAction extends Action diff --git a/actions/newnotice.php b/actions/newnotice.php index e254eac49..6e3720e09 100644 --- a/actions/newnotice.php +++ b/actions/newnotice.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * Handler for posting new notices * @@ -20,16 +20,16 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Personal - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Zach Copley <zach@controlyourself.ca> - * @author Sarven Capadisli <csarven@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Zach Copley <zach@status.net> + * @author Sarven Capadisli <csarven@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -39,12 +39,12 @@ require_once INSTALLDIR.'/lib/noticelist.php'; * Action for posting new notices * * @category Personal - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Zach Copley <zach@controlyourself.ca> - * @author Sarven Capadisli <csarven@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Zach Copley <zach@status.net> + * @author Sarven Capadisli <csarven@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class NewnoticeAction extends Action @@ -91,8 +91,8 @@ class NewnoticeAction extends Action // is losts when size is exceeded if (empty($_POST) && $_SERVER['CONTENT_LENGTH']) { $this->clientError(sprintf(_('The server was unable to handle ' . - 'that much POST data (%s bytes) due to its current configuration.'), - $_SERVER['CONTENT_LENGTH'])); + 'that much POST data (%s bytes) due to its current configuration.'), + $_SERVER['CONTENT_LENGTH'])); } parent::handle($args); @@ -130,7 +130,7 @@ class NewnoticeAction extends Action $hint = ''; } $this->clientError(sprintf( - _('%s is not a supported filetype on this server.'), $filetype) . $hint); + _('%s is not a supported filetype on this server.'), $filetype) . $hint); } function isRespectsQuota($user) { @@ -190,37 +190,37 @@ class NewnoticeAction extends Action if (isset($_FILES['attach']['error'])) { switch ($_FILES['attach']['error']) { - case UPLOAD_ERR_NO_FILE: - // no file uploaded, nothing to do - break; + case UPLOAD_ERR_NO_FILE: + // no file uploaded, nothing to do + break; - case UPLOAD_ERR_OK: - $mimetype = $this->getUploadedFileType(); - if (!$this->isRespectsQuota($user)) { - die('clientError() should trigger an exception before reaching here.'); - } - break; + case UPLOAD_ERR_OK: + $mimetype = $this->getUploadedFileType(); + if (!$this->isRespectsQuota($user)) { + die('clientError() should trigger an exception before reaching here.'); + } + break; - case UPLOAD_ERR_INI_SIZE: - $this->clientError(_('The uploaded file exceeds the upload_max_filesize directive in php.ini.')); + case UPLOAD_ERR_INI_SIZE: + $this->clientError(_('The uploaded file exceeds the upload_max_filesize directive in php.ini.')); - case UPLOAD_ERR_FORM_SIZE: - $this->clientError(_('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.')); + case UPLOAD_ERR_FORM_SIZE: + $this->clientError(_('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.')); - case UPLOAD_ERR_PARTIAL: - $this->clientError(_('The uploaded file was only partially uploaded.')); + case UPLOAD_ERR_PARTIAL: + $this->clientError(_('The uploaded file was only partially uploaded.')); - case UPLOAD_ERR_NO_TMP_DIR: - $this->clientError(_('Missing a temporary folder.')); + case UPLOAD_ERR_NO_TMP_DIR: + $this->clientError(_('Missing a temporary folder.')); - case UPLOAD_ERR_CANT_WRITE: - $this->clientError(_('Failed to write file to disk.')); + case UPLOAD_ERR_CANT_WRITE: + $this->clientError(_('Failed to write file to disk.')); - case UPLOAD_ERR_EXTENSION: - $this->clientError(_('File upload stopped by extension.')); + case UPLOAD_ERR_EXTENSION: + $this->clientError(_('File upload stopped by extension.')); - default: - die('Should never reach here.'); + default: + die('Should never reach here.'); } } @@ -233,7 +233,7 @@ class NewnoticeAction extends Action $fileRecord = $this->storeFile($filename, $mimetype); $fileurl = common_local_url('attachment', - array('attachment' => $fileRecord->id)); + array('attachment' => $fileRecord->id)); // not sure this is necessary -- Zach $this->maybeAddRedir($fileRecord->id, $fileurl); @@ -367,7 +367,7 @@ class NewnoticeAction extends Action File_to_post::processNew($filerec->id, $notice->id); $this->maybeAddRedir($filerec->id, - common_local_url('file', array('notice' => $notice->id))); + common_local_url('file', array('notice' => $notice->id))); } /** @@ -431,13 +431,14 @@ class NewnoticeAction extends Action $content = $this->trimmed('status_textarea'); if (!$content) { $replyto = $this->trimmed('replyto'); + $inreplyto = $this->trimmed('inreplyto'); $profile = Profile::staticGet('nickname', $replyto); if ($profile) { $content = '@' . $profile->nickname . ' '; } } - $notice_form = new NoticeForm($this, '', $content); + $notice_form = new NoticeForm($this, '', $content, null, $inreplyto); $notice_form->show(); } diff --git a/actions/noticesearch.php b/actions/noticesearch.php index 49b473d9e..69dcd1a46 100644 --- a/actions/noticesearch.php +++ b/actions/noticesearch.php @@ -5,15 +5,15 @@ * PHP version 5 * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> - * @author Sarven Capadisli <csarven@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> + * @author Sarven Capadisli <csarven@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ * - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -29,7 +29,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -39,11 +39,11 @@ require_once INSTALLDIR.'/lib/searchaction.php'; * Notice search action class. * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ * @todo common parent for people and content search? */ class NoticesearchAction extends SearchAction @@ -121,7 +121,9 @@ class NoticesearchAction extends SearchAction $message = sprintf(_('Be the first to [post on this topic](%%%%action.newnotice%%%%?status_textarea=%s)!'), urlencode($q)); } else { - $message = sprintf(_('Why not [register an account](%%%%action.register%%%%) and be the first to [post on this topic](%%%%action.newnotice%%%%?status_textarea=%s)!'), urlencode($q)); + $message = sprintf(_('Why not [register an account](%%%%action.%s%%%%) and be the first to [post on this topic](%%%%action.newnotice%%%%?status_textarea=%s)!'), + (!common_config('site','openidonly')) ? 'register' : 'openidlogin', + urlencode($q)); } $this->elementStart('div', 'guide'); @@ -135,6 +137,12 @@ class NoticesearchAction extends SearchAction $this->pagination($page > 1, $cnt > NOTICES_PER_PAGE, $page, 'noticesearch', array('q' => $q)); } + + function showScripts() + { + parent::showScripts(); + $this->autofocus('q'); + } } class SearchNoticeList extends NoticeList { @@ -190,7 +198,7 @@ class SearchNoticeListItem extends NoticeListItem { $result = preg_replace($pattern, '<strong>\\1</strong>', $text); /* Remove highlighting from inside links, loop incase multiple highlights in links */ - $pattern = '/(href="[^"]*)<strong>('.$options.')<\/strong>([^"]*")/iU'; + $pattern = '/(\w+="[^"]*)<strong>('.$options.')<\/strong>([^"]*")/iU'; do { $result = preg_replace($pattern, '\\1\\2\\3', $result, -1, $count); } while ($count); diff --git a/actions/noticesearchrss.php b/actions/noticesearchrss.php index 2a4b2060d..f59ad7962 100644 --- a/actions/noticesearchrss.php +++ b/actions/noticesearchrss.php @@ -5,14 +5,14 @@ * PHP version 5 * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ * - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -28,7 +28,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -40,11 +40,11 @@ require_once INSTALLDIR.'/lib/rssaction.php'; * Formatting of RSS handled by Rss10Action * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ */ class NoticesearchrssAction extends Rss10Action { @@ -86,9 +86,10 @@ class NoticesearchrssAction extends Rss10Action { $q = $this->trimmed('q'); $c = array('url' => common_local_url('noticesearchrss', array('q' => $q)), - 'title' => common_config('site', 'name') . sprintf(_(' Search Stream for "%s"'), $q), + 'title' => sprintf(_('Updates with "%s"'), $q), 'link' => common_local_url('noticesearch', array('q' => $q)), - 'description' => sprintf(_('All updates matching search term "%s"'), $q)); + 'description' => sprintf(_('Updates matching search term "%1$s" on %2$s!'), + $q, common_config('site', 'name'))); return $c; } diff --git a/actions/nudge.php b/actions/nudge.php index 78c0ee566..cf5f773e7 100644 --- a/actions/nudge.php +++ b/actions/nudge.php @@ -6,14 +6,14 @@ * PHP version 5 * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ * - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -29,7 +29,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -39,12 +39,12 @@ require_once INSTALLDIR.'/lib/mail.php'; * Nudge a user action class. * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> - * @author Sarven Capadisli <csarven@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> + * @author Sarven Capadisli <csarven@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ */ class NudgeAction extends Action { diff --git a/actions/twitapioembed.php b/actions/oembed.php index 3019e5878..e287b6ae2 100644 --- a/actions/twitapioembed.php +++ b/actions/oembed.php @@ -1,8 +1,8 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * - * Laconica-only extensions to the Twitter-like API + * StatusNet-only extensions to the Twitter-like API * * PHP version 5 * @@ -20,43 +20,37 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Twitter - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @copyright 2008 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @copyright 2008 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } -require_once INSTALLDIR.'/lib/twitterapi.php'; - /** * Oembed provider implementation * * This class handles all /main/oembed(.xml|.json)/ requests. * * @category oEmbed - * @package Laconica + * @package StatusNet * @author Craig Andrews <candrews@integralblue.com> - * @copyright 2008 Control Yourself, Inc. + * @copyright 2008 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -class TwitapioembedAction extends TwitterapiAction +class OembedAction extends Action { - function oembed($args, $apidata) + function handle($args) { - parent::handle($args); - common_debug("in oembed api action"); - $this->auth_user = $apidata['user']; - $url = $args['url']; if( substr(strtolower($url),0,strlen(common_root_url())) == strtolower(common_root_url()) ){ $path = substr($url,strlen(common_root_url())); @@ -131,8 +125,7 @@ class TwitapioembedAction extends TwitterapiAction default: $this->serverError(_("$path not supported for oembed requests"), 501); } - - switch($apidata['content-type']){ + switch($args['format']){ case 'xml': $this->init_document('xml'); $this->elementStart('oembed'); @@ -151,12 +144,11 @@ class TwitapioembedAction extends TwitterapiAction if($oembed['thumbnail_url']) $this->element('thumbnail_url',null,$oembed['thumbnail_url']); if($oembed['thumbnail_width']) $this->element('thumbnail_width',null,$oembed['thumbnail_width']); if($oembed['thumbnail_height']) $this->element('thumbnail_height',null,$oembed['thumbnail_height']); - $this->elementEnd('oembed'); $this->end_document('xml'); break; - case 'json': + case 'json': case '': $this->init_document('json'); print(json_encode($oembed)); $this->end_document('json'); @@ -164,10 +156,51 @@ class TwitapioembedAction extends TwitterapiAction default: $this->serverError(_('content type ' . $apidata['content-type'] . ' not supported'), 501); } - }else{ $this->serverError(_('Only ' . common_root_url() . ' urls over plain http please'), 404); } } -} + function init_document($type) + { + switch ($type) { + case 'xml': + header('Content-Type: application/xml; charset=utf-8'); + $this->startXML(); + break; + case 'json': + header('Content-Type: application/json; charset=utf-8'); + + // Check for JSONP callback + $callback = $this->arg('callback'); + if ($callback) { + print $callback . '('; + } + break; + default: + $this->serverError(_('Not a supported data format.'), 501); + break; + } + } + + function end_document($type='xml') + { + switch ($type) { + case 'xml': + $this->endXML(); + break; + case 'json': + // Check for JSONP callback + $callback = $this->arg('callback'); + if ($callback) { + print ')'; + } + break; + default: + $this->serverError(_('Not a supported data format.'), 501); + break; + } + return; + } + +} diff --git a/actions/openidlogin.php b/actions/openidlogin.php index a8d052096..9b7deefb6 100644 --- a/actions/openidlogin.php +++ b/actions/openidlogin.php @@ -1,7 +1,7 @@ <?php /* - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { exit(1); } +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } require_once(INSTALLDIR.'/lib/openid.php'); @@ -26,7 +26,9 @@ class OpenidloginAction extends Action function handle($args) { parent::handle($args); - if (common_is_real_login()) { + if (!common_config('openid', 'enabled')) { + common_redirect(common_local_url('login')); + } else if (common_is_real_login()) { $this->clientError(_('Already logged in.')); } else if ($_SERVER['REQUEST_METHOD'] == 'POST') { $openid_url = $this->trimmed('openid_url'); @@ -84,6 +86,12 @@ class OpenidloginAction extends Action } } + function showScripts() + { + parent::showScripts(); + $this->autofocus('openid_url'); + } + function title() { return _('OpenID Login'); diff --git a/actions/openidsettings.php b/actions/openidsettings.php index 5f59ebc01..30725fc1b 100644 --- a/actions/openidsettings.php +++ b/actions/openidsettings.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * Settings for OpenID * @@ -20,14 +20,14 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Settings - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -40,10 +40,10 @@ require_once INSTALLDIR.'/lib/openid.php'; * Lets users add, edit and delete OpenIDs from their account * * @category Settings - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class OpenidsettingsAction extends AccountSettingsAction @@ -72,6 +72,12 @@ class OpenidsettingsAction extends AccountSettingsAction ' Manage your associated OpenIDs from here.'); } + function showScripts() + { + parent::showScripts(); + $this->autofocus('openid_url'); + } + /** * Show the form for OpenID management * @@ -82,6 +88,12 @@ class OpenidsettingsAction extends AccountSettingsAction function showContent() { + if (!common_config('openid', 'enabled')) { + $this->element('div', array('class' => 'error'), + _('OpenID is not available.')); + return; + } + $user = common_current_user(); $this->elementStart('form', array('method' => 'post', diff --git a/actions/opensearch.php b/actions/opensearch.php index 4fe95c93b..d5e6698f3 100644 --- a/actions/opensearch.php +++ b/actions/opensearch.php @@ -6,14 +6,14 @@ * PHP version 5 * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ * - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -29,7 +29,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -39,11 +39,11 @@ if (!defined('LACONICA')) { * Formatting of RSS handled by Rss10Action * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ */ class OpensearchAction extends Action { @@ -66,7 +66,7 @@ class OpensearchAction extends Action $type = 'noticesearch'; $short_name = _('Notice Search'); } - header('Content-Type: text/html'); + header('Content-Type: application/opensearchdescription+xml'); $this->startXML(); $this->elementStart('OpenSearchDescription', array('xmlns' => 'http://a9.com/-/spec/opensearch/1.1/')); $short_name = common_config('site', 'name').' '.$short_name; diff --git a/actions/othersettings.php b/actions/othersettings.php index 1277f8052..f898e2207 100644 --- a/actions/othersettings.php +++ b/actions/othersettings.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * Miscellaneous settings * @@ -20,15 +20,15 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Settings - * @package Laconica - * @author Robin Millette <millette@controlyourself.ca> - * @author Evan Prodromou <evan@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Robin Millette <millette@status.net> + * @author Evan Prodromou <evan@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -40,11 +40,11 @@ require_once INSTALLDIR.'/lib/accountsettingsaction.php'; * Currently this just manages URL shortening. * * @category Settings - * @package Laconica - * @author Robin Millette <millette@controlyourself.ca> - * @author Zach Copley <zach@controlyourself.ca> + * @package StatusNet + * @author Robin Millette <millette@status.net> + * @author Zach Copley <zach@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class OthersettingsAction extends AccountSettingsAction @@ -71,6 +71,12 @@ class OthersettingsAction extends AccountSettingsAction return _('Manage various other options.'); } + function showScripts() + { + parent::showScripts(); + $this->autofocus('urlshorteningservice'); + } + /** * Content area of the page * diff --git a/actions/outbox.php b/actions/outbox.php index a875e9ad9..537fad3ef 100644 --- a/actions/outbox.php +++ b/actions/outbox.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * action handler for message inbox * @@ -20,14 +20,14 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Message - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @copyright 2008 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @copyright 2008 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -37,10 +37,10 @@ require_once INSTALLDIR.'/lib/mailbox.php'; * action handler for message outbox * * @category Message - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ * @see MailboxAction */ diff --git a/actions/passwordsettings.php b/actions/passwordsettings.php index bdce61035..cd4beac3f 100644 --- a/actions/passwordsettings.php +++ b/actions/passwordsettings.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * Change user password * @@ -20,15 +20,15 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Settings - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Zach Copley <zach@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Zach Copley <zach@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -38,11 +38,11 @@ require_once INSTALLDIR.'/lib/accountsettingsaction.php'; * Change password * * @category Settings - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Zach Copley <zach@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Zach Copley <zach@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class PasswordsettingsAction extends AccountSettingsAction @@ -69,6 +69,12 @@ class PasswordsettingsAction extends AccountSettingsAction return _('Change your password.'); } + function showScripts() + { + parent::showScripts(); + $this->autofocus('oldpassword'); + } + /** * Content area of the page * diff --git a/actions/peoplesearch.php b/actions/peoplesearch.php index 60ddb6a82..38135ecbd 100644 --- a/actions/peoplesearch.php +++ b/actions/peoplesearch.php @@ -5,14 +5,14 @@ * PHP version 5 * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ * - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -28,7 +28,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -39,11 +39,11 @@ require_once INSTALLDIR.'/lib/profilelist.php'; * People search action class. * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ */ class PeoplesearchAction extends SearchAction { @@ -85,6 +85,12 @@ class PeoplesearchAction extends SearchAction $profile->free(); } } + + function showScripts() + { + parent::showScripts(); + $this->autofocus('q'); + } } /** @@ -93,11 +99,11 @@ class PeoplesearchAction extends SearchAction * Derivative of ProfileList with specialization for highlighting search terms. * * @category Widget - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ * * @see PeoplesearchAction */ diff --git a/actions/peopletag.php b/actions/peopletag.php index dd3c1c089..6dbbc9261 100644 --- a/actions/peopletag.php +++ b/actions/peopletag.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * Action for showing profiles self-tagged with a given tag * @@ -20,15 +20,15 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Zach Copley <zach@controlyourself.ca> - * @copyright 2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Zach Copley <zach@status.net> + * @copyright 2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -38,11 +38,11 @@ require_once INSTALLDIR.'/lib/profilelist.php'; * This class outputs a paginated list of profiles self-tagged with a given tag * * @category Output - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Zach Copley <zach@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Zach Copley <zach@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ * * @see Action */ diff --git a/actions/postnotice.php b/actions/postnotice.php index eb2d63b61..e775ca17e 100644 --- a/actions/postnotice.php +++ b/actions/postnotice.php @@ -1,7 +1,7 @@ <?php /* - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { exit(1); } +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } require_once(INSTALLDIR.'/lib/omb.php'); diff --git a/actions/profilesettings.php b/actions/profilesettings.php index fb847680b..2d66e9946 100644 --- a/actions/profilesettings.php +++ b/actions/profilesettings.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * Change profile settings * @@ -20,15 +20,16 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Settings - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Zach Copley <zach@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Zach Copley <zach@status.net> + * @author Sarven Capadisli <csarven@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -38,11 +39,12 @@ require_once INSTALLDIR.'/lib/accountsettingsaction.php'; * Change profile settings * * @category Settings - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Zach Copley <zach@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Zach Copley <zach@status.net> + * @author Sarven Capadisli <csarven@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class ProfilesettingsAction extends AccountSettingsAction @@ -70,6 +72,12 @@ class ProfilesettingsAction extends AccountSettingsAction 'so people know more about you.'); } + function showScripts() + { + parent::showScripts(); + $this->autofocus('nickname'); + } + /** * Content area of the page * @@ -189,7 +197,7 @@ class ProfilesettingsAction extends AccountSettingsAction // Some validation if (!Validate::string($nickname, array('min_length' => 1, 'max_length' => 64, - 'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) { + 'format' => NICKNAME_FMT))) { $this->showForm(_('Nickname must have only lowercase letters and numbers and no spaces.')); return; } else if (!User::allowed_nickname($nickname)) { diff --git a/actions/public.php b/actions/public.php index ef9ef0d1a..d426648f3 100644 --- a/actions/public.php +++ b/actions/public.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * Action for displaying the public stream * @@ -20,14 +20,14 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Public - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -43,10 +43,10 @@ define('MAX_PUBLIC_PAGE', 100); * Action for displaying the public stream * * @category Public - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ * * @see PublicrssAction * @see PublicxrdsAction @@ -59,6 +59,7 @@ class PublicAction extends Action */ var $page = null; + var $notice; function isReadOnly($args) { @@ -84,6 +85,18 @@ class PublicAction extends Action common_set_returnto($this->selfUrl()); + $this->notice = Notice::publicStream(($this->page-1)*NOTICES_PER_PAGE, + NOTICES_PER_PAGE + 1); + + if (!$this->notice) { + $this->serverError(_('Could not retrieve public stream.')); + return; + } + + if($this->page > 1 && $this->notice->N == 0){ + $this->serverError(_('No such page'),$code=404); + } + return true; } @@ -183,7 +196,8 @@ class PublicAction extends Action } else { if (! (common_config('site','closed') || common_config('site','inviteonly'))) { - $message .= _('Why not [register an account](%%action.register%%) and be the first to post!'); + $message .= sprintf(_('Why not [register an account](%%%%action.%s%%%%) and be the first to post!'), + (!common_config('site','openidonly')) ? 'register' : 'openidlogin'); } } @@ -203,15 +217,7 @@ class PublicAction extends Action function showContent() { - $notice = Notice::publicStream(($this->page-1)*NOTICES_PER_PAGE, - NOTICES_PER_PAGE + 1); - - if (!$notice) { - $this->serverError(_('Could not retrieve public stream.')); - return; - } - - $nl = new NoticeList($notice, $this); + $nl = new NoticeList($this->notice, $this); $cnt = $nl->show(); @@ -229,7 +235,7 @@ class PublicAction extends Action // $top->show(); $pop = new PopularNoticeSection($this); $pop->show(); - $gbp = new GroupsByPostsSection($this); + $gbp = new GroupsByMembersSection($this); $gbp->show(); $feat = new FeaturedUsersSection($this); $feat->show(); @@ -238,12 +244,14 @@ class PublicAction extends Action function showAnonymousMessage() { if (! (common_config('site','closed') || common_config('site','inviteonly'))) { - $m = _('This is %%site.name%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' . - 'based on the Free Software [Laconica](http://laconi.ca/) tool. ' . - '[Join now](%%action.register%%) to share notices about yourself with friends, family, and colleagues! ([Read more](%%doc.help%%))'); + $m = sprintf(_('This is %%%%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.%s%%%%) to share notices about yourself with friends, family, and colleagues! ' . + '([Read more](%%%%doc.help%%%%))'), + (!common_config('site','openidonly')) ? 'register' : 'openidlogin'); } else { $m = _('This is %%site.name%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' . - 'based on the Free Software [Laconica](http://laconi.ca/) tool.'); + 'based on the Free Software [StatusNet](http://status.net/) tool.'); } $this->elementStart('div', array('id' => 'anon_notice')); $this->raw(common_markup_to_html($m)); diff --git a/actions/publicrss.php b/actions/publicrss.php index 7e8df9625..593888b9f 100644 --- a/actions/publicrss.php +++ b/actions/publicrss.php @@ -6,14 +6,14 @@ * PHP version 5 * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ * - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -29,7 +29,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -41,11 +41,11 @@ require_once INSTALLDIR.'/lib/rssaction.php'; * Formatting of RSS handled by Rss10Action * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ */ class PublicrssAction extends Rss10Action { @@ -86,9 +86,9 @@ class PublicrssAction extends Rss10Action { $c = array( 'url' => common_local_url('publicrss') - , 'title' => sprintf(_('%s Public Stream'), common_config('site', 'name')) + , 'title' => sprintf(_('%s public timeline'), common_config('site', 'name')) , 'link' => common_local_url('public') - , 'description' => sprintf(_('All updates for %s'), common_config('site', 'name'))); + , 'description' => sprintf(_('%s updates from everyone!'), common_config('site', 'name'))); return $c; } diff --git a/actions/publictagcloud.php b/actions/publictagcloud.php index e9f33d58b..60bb53e27 100644 --- a/actions/publictagcloud.php +++ b/actions/publictagcloud.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * Public tag cloud for notices * @@ -20,16 +20,16 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Public - * @package Laconica + * @package StatusNet * @author Mike Cochrane <mikec@mikenz.geek.nz> - * @author Evan Prodromou <evan@controlyourself.ca> + * @author Evan Prodromou <evan@status.net> * @copyright 2008 Mike Cochrane - * @copyright 2008-2009 Control Yourself, Inc. + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { exit(1); } +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } define('TAGS_PER_PAGE', 100); @@ -37,12 +37,12 @@ define('TAGS_PER_PAGE', 100); * Public tag cloud for notices * * @category Personal - * @package Laconica + * @package StatusNet * @author Mike Cochrane <mikec@mikenz.geek.nz> - * @author Evan Prodromou <evan@controlyourself.ca> + * @author Evan Prodromou <evan@status.net> * @copyright 2008 Mike Cochrane - * @copyright 2008-2009 Control Yourself, Inc. - * @link http://laconi.ca/ + * @copyright 2008-2009 StatusNet, Inc. + * @link http://status.net/ */ class PublictagcloudAction extends Action @@ -72,7 +72,8 @@ class PublictagcloudAction extends Action $message .= _('Be the first to post one!'); } else { - $message .= _('Why not [register an account](%%action.register%%) and be the first to post one!'); + $message .= sprintf(_('Why not [register an account](%%%%action.%s%%%%) and be the first to post one!'), + (!common_config('site','openidonly')) ? 'register' : 'openidlogin'); } $this->elementStart('div', 'guide'); diff --git a/actions/publicxrds.php b/actions/publicxrds.php index 0a1421550..209a10e3d 100644 --- a/actions/publicxrds.php +++ b/actions/publicxrds.php @@ -6,14 +6,14 @@ * PHP version 5 * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ * - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -29,7 +29,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -39,11 +39,11 @@ require_once INSTALLDIR.'/lib/openid.php'; * Public XRDS for OpenID * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ * * @todo factor out similarities with XrdsAction */ diff --git a/actions/recoverpassword.php b/actions/recoverpassword.php index 721edea7f..9776c1fb4 100644 --- a/actions/recoverpassword.php +++ b/actions/recoverpassword.php @@ -1,7 +1,7 @@ <?php /* - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { exit(1); } +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } # You have 24 hours to claim your password diff --git a/actions/register.php b/actions/register.php index dcbbbdb6a..eefbc340a 100644 --- a/actions/register.php +++ b/actions/register.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * Register a new user account * @@ -20,14 +20,14 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Login - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -35,10 +35,10 @@ if (!defined('LACONICA')) { * An action for registering a new user account * * @category Login - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class RegisterAction extends Action @@ -116,6 +116,8 @@ class RegisterAction extends Action * * Checks if registration is closed and shows an error if so. * + * Checks if only OpenID is allowed and redirects to openidlogin if so. + * * @param array $args $_REQUEST data * * @return void @@ -127,6 +129,8 @@ class RegisterAction extends Action if (common_config('site', 'closed')) { $this->clientError(_('Registration not allowed.')); + } else if (common_config('site', 'openidonly')) { + common_redirect(common_local_url('openidlogin')); } else if (common_logged_in()) { $this->clientError(_('Already logged in.')); } else if ($_SERVER['REQUEST_METHOD'] == 'POST') { @@ -136,6 +140,12 @@ class RegisterAction extends Action } } + function showScripts() + { + parent::showScripts(); + $this->autofocus('nickname'); + } + /** * Try to register a user * @@ -325,14 +335,22 @@ class RegisterAction extends Action } else if ($this->error) { $this->element('p', 'error', $this->error); } else { - $instr = - common_markup_to_html(_('With this form you can create '. - ' a new account. ' . - 'You can then post notices and '. - 'link up to friends and colleagues. '. - '(Have an [OpenID](http://openid.net/)? ' . - 'Try our [OpenID registration]'. - '(%%action.openidlogin%%)!)')); + if (common_config('openid', 'enabled')) { + $instr = + common_markup_to_html(_('With this form you can create '. + ' a new account. ' . + 'You can then post notices and '. + 'link up to friends and colleagues. '. + '(Have an [OpenID](http://openid.net/)? ' . + 'Try our [OpenID registration]'. + '(%%action.openidlogin%%)!)')); + } else { + $instr = + common_markup_to_html(_('With this form you can create '. + ' a new account. ' . + 'You can then post notices and '. + 'link up to friends and colleagues.')); + } $this->elementStart('div', 'instructions'); $this->raw($instr); diff --git a/actions/remotesubscribe.php b/actions/remotesubscribe.php index e658f8d37..374392d4a 100644 --- a/actions/remotesubscribe.php +++ b/actions/remotesubscribe.php @@ -1,7 +1,7 @@ <?php /* - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { exit(1); } +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } require_once(INSTALLDIR.'/lib/omb.php'); @@ -71,11 +71,13 @@ class RemotesubscribeAction extends Action if ($this->err) { $this->element('div', 'error', $this->err); } else { - $inst = _('To subscribe, you can [login](%%action.login%%),' . - ' or [register](%%action.register%%) a new ' . - ' account. If you already have an account ' . - ' on a [compatible microblogging site](%%doc.openmublog%%), ' . - ' enter your profile URL below.'); + $inst = sprintf(_('To subscribe, you can [login](%%%%action.%s%%%%),' . + ' or [register](%%%%action.%s%%%%) a new ' . + ' account. If you already have an account ' . + ' on a [compatible microblogging site](%%doc.openmublog%%), ' . + ' enter your profile URL below.'), + (!common_config('site','openidonly')) ? 'login' : 'openidlogin', + (!common_config('site','openidonly')) ? 'register' : 'openidlogin'); $output = common_markup_to_html($inst); $this->elementStart('div', 'instructions'); $this->raw($output); @@ -321,7 +323,7 @@ class RemotesubscribeAction extends Action $result = $fetcher->post($req->get_normalized_http_url(), $req->to_postdata(), - array('User-Agent: Laconica/' . LACONICA_VERSION)); + array('User-Agent: StatusNet/' . STATUSNET_VERSION)); if ($result->status != 200) { return null; } diff --git a/actions/replies.php b/actions/replies.php index d7ed440e9..cca430230 100644 --- a/actions/replies.php +++ b/actions/replies.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * List of replies * @@ -20,14 +20,14 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Personal - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -39,15 +39,16 @@ require_once INSTALLDIR.'/lib/feedlist.php'; * List of replies * * @category Personal - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class RepliesAction extends OwnerDesignAction { var $page = null; + var $notice; /** * Prepare the object @@ -84,6 +85,13 @@ class RepliesAction extends OwnerDesignAction common_set_returnto($this->selfUrl()); + $this->notice = $this->user->getReplies(($this->page-1) * NOTICES_PER_PAGE, + NOTICES_PER_PAGE + 1); + + if($this->page > 1 && $this->notice->N == 0){ + $this->serverError(_('No such page'),$code=404); + } + return true; } @@ -159,10 +167,7 @@ class RepliesAction extends OwnerDesignAction function showContent() { - $notice = $this->user->getReplies(($this->page-1) * NOTICES_PER_PAGE, - NOTICES_PER_PAGE + 1); - - $nl = new NoticeList($notice, $this); + $nl = new NoticeList($this->notice, $this); $cnt = $nl->show(); if (0 === $cnt) { @@ -187,7 +192,9 @@ class RepliesAction extends OwnerDesignAction } } else { - $message .= sprintf(_('Why not [register an account](%%%%action.register%%%%) and then nudge %s or post a notice to his or her attention.'), $this->user->nickname); + $message .= sprintf(_('Why not [register an account](%%%%action.%s%%%%) and then nudge %s or post a notice to his or her attention.'), + (!common_config('site','openidonly')) ? 'register' : 'openidlogin', + $this->user->nickname); } $this->elementStart('div', 'guide'); diff --git a/actions/repliesrss.php b/actions/repliesrss.php index a87e2870d..c71c9226f 100644 --- a/actions/repliesrss.php +++ b/actions/repliesrss.php @@ -1,7 +1,7 @@ <?php /* - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { exit(1); } +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } require_once(INSTALLDIR.'/lib/rssaction.php'); @@ -68,7 +68,8 @@ class RepliesrssAction extends Rss10Action 'link' => common_local_url('replies', array('nickname' => $user->nickname)), - 'description' => sprintf(_('Feed for replies to %s'), $user->nickname)); + 'description' => sprintf(_('Replies to %1$s on %2$s!'), + $user->nickname, common_config('site', 'name'))); return $c; } diff --git a/actions/requesttoken.php b/actions/requesttoken.php index 8d1e3f004..a17efcdd5 100644 --- a/actions/requesttoken.php +++ b/actions/requesttoken.php @@ -6,14 +6,14 @@ * PHP version 5 * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ * - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -29,7 +29,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -39,11 +39,11 @@ 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> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ */ class RequesttokenAction extends Action { @@ -72,7 +72,7 @@ class RequesttokenAction extends Action $req = OAuthRequest::from_request('POST', common_local_url('requesttoken')); $server = omb_oauth_server(); $token = $server->fetch_request_token($req); - print $token; + print $token.'&omb_version='.OMB_VERSION_01; } catch (OAuthException $e) { $this->serverError($e->getMessage()); } diff --git a/actions/showfavorites.php b/actions/showfavorites.php index 8efe9d30a..0f7a66330 100644 --- a/actions/showfavorites.php +++ b/actions/showfavorites.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * List of replies * @@ -20,14 +20,14 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Personal - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -39,10 +39,10 @@ require_once INSTALLDIR.'/lib/feedlist.php'; * List of replies * * @category Personal - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class ShowfavoritesAction extends OwnerDesignAction @@ -114,6 +114,29 @@ class ShowfavoritesAction extends OwnerDesignAction common_set_returnto($this->selfUrl()); + $cur = common_current_user(); + + if (!empty($cur) && $cur->id == $this->user->id) { + + // Show imported/gateway notices as well as local if + // the user is looking at his own favorites + + $this->notice = $this->user->favoriteNotices(($this->page-1)*NOTICES_PER_PAGE, + NOTICES_PER_PAGE + 1, true); + } else { + $this->notice = $this->user->favoriteNotices(($this->page-1)*NOTICES_PER_PAGE, + NOTICES_PER_PAGE + 1, false); + } + + if (empty($this->notice)) { + $this->serverError(_('Could not retrieve favorite notices.')); + return; + } + + if($this->page > 1 && $this->notice->N == 0){ + $this->serverError(_('No such page'),$code=404); + } + return true; } @@ -173,7 +196,9 @@ class ShowfavoritesAction extends OwnerDesignAction } } else { - $message = sprintf(_('%s hasn\'t added any notices to his favorites yet. Why not [register an account](%%%%action.register%%%%) and then post something interesting they would add to thier favorites :)'), $this->user->nickname); + $message = sprintf(_('%s hasn\'t added any notices to his favorites yet. Why not [register an account](%%%%action.%s%%%%) and then post something interesting they would add to their favorites :)'), + $this->user->nickname, + (!common_config('site','openidonly')) ? 'register' : 'openidlogin'); } $this->elementStart('div', 'guide'); @@ -191,26 +216,7 @@ class ShowfavoritesAction extends OwnerDesignAction function showContent() { - $cur = common_current_user(); - - if (!empty($cur) && $cur->id == $this->user->id) { - - // Show imported/gateway notices as well as local if - // the user is looking at his own favorites - - $notice = $this->user->favoriteNotices(($this->page-1)*NOTICES_PER_PAGE, - NOTICES_PER_PAGE + 1, true); - } else { - $notice = $this->user->favoriteNotices(($this->page-1)*NOTICES_PER_PAGE, - NOTICES_PER_PAGE + 1, false); - } - - if (empty($notice)) { - $this->serverError(_('Could not retrieve favorite notices.')); - return; - } - - $nl = new NoticeList($notice, $this); + $nl = new NoticeList($this->notice, $this); $cnt = $nl->show(); if (0 == $cnt) { diff --git a/actions/showgroup.php b/actions/showgroup.php index 32ec674a9..8157ee3c8 100644 --- a/actions/showgroup.php +++ b/actions/showgroup.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * Group main page * @@ -20,15 +20,15 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Group - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Sarven Capadisli <csarven@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Sarven Capadisli <csarven@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -41,10 +41,10 @@ define('MEMBERS_PER_SECTION', 27); * Group main page * * @category Group - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class ShowgroupAction extends GroupDesignAction @@ -130,8 +130,18 @@ class ShowgroupAction extends GroupDesignAction $this->group = User_group::staticGet('nickname', $nickname); if (!$this->group) { - $this->clientError(_('No such group'), 404); - return false; + $alias = Group_alias::staticGet('alias', $nickname); + if ($alias) { + $args = array('id' => $alias->group_id); + if ($this->page != 1) { + $args['page'] = $this->page; + } + common_redirect(common_local_url('groupbyid', $args), 301); + return false; + } else { + $this->clientError(_('No such group'), 404); + return false; + } } common_set_returnto($this->selfUrl()); @@ -438,13 +448,14 @@ class ShowgroupAction extends GroupDesignAction { if (!(common_config('site','closed') || common_config('site','inviteonly'))) { $m = sprintf(_('**%s** is a user group on %%%%site.name%%%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' . - 'based on the Free Software [Laconica](http://laconi.ca/) tool. Its members share ' . + 'based on the Free Software [StatusNet](http://status.net/) tool. Its members share ' . 'short messages about their life and interests. '. - '[Join now](%%%%action.register%%%%) to become part of this group and many more! ([Read more](%%%%doc.help%%%%))'), - $this->group->nickname); + '[Join now](%%%%action.%s%%%%) to become part of this group and many more! ([Read more](%%%%doc.help%%%%))'), + $this->group->nickname, + (!common_config('site','openidonly')) ? 'register' : 'openidlogin'); } else { $m = sprintf(_('**%s** is a user group on %%%%site.name%%%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' . - 'based on the Free Software [Laconica](http://laconi.ca/) tool. Its members share ' . + 'based on the Free Software [StatusNet](http://status.net/) tool. Its members share ' . 'short messages about their life and interests. '), $this->group->nickname); } diff --git a/actions/showmessage.php b/actions/showmessage.php index 4fcaadbe8..db757948b 100644 --- a/actions/showmessage.php +++ b/actions/showmessage.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * Show a single message * @@ -20,13 +20,13 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Personal - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -38,10 +38,10 @@ require_once INSTALLDIR.'/lib/mailbox.php'; * // XXX: It is totally weird how this works! * * @category Personal - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class ShowmessageAction extends MailboxAction diff --git a/actions/shownotice.php b/actions/shownotice.php index 8f73dc824..3bc52b2db 100644 --- a/actions/shownotice.php +++ b/actions/shownotice.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * Show a single notice * @@ -20,14 +20,14 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Personal - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -39,10 +39,10 @@ require_once INSTALLDIR.'/lib/feedlist.php'; * Show a single notice * * @category Personal - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class ShownoticeAction extends OwnerDesignAction @@ -97,8 +97,8 @@ class ShownoticeAction extends OwnerDesignAction $this->user = User::staticGet('id', $this->profile->id); - if (empty($this->user)) { - $this->serverError(_('Not a local notice'), 500); + if (! $this->notice->is_local) { + common_redirect($this->notice->uri); return false; } @@ -190,7 +190,7 @@ class ShownoticeAction extends OwnerDesignAction { parent::handle($args); - if ($this->notice->is_local == 0) { + if ($this->notice->is_local == Notice::REMOTE_OMB) { if (!empty($this->notice->url)) { common_redirect($this->notice->url, 301); } else if (!empty($this->notice->uri) && preg_match('/^https?:/', $this->notice->uri)) { @@ -278,16 +278,16 @@ class ShownoticeAction extends OwnerDesignAction $this->element('link',array('rel'=>'alternate', 'type'=>'application/json+oembed', 'href'=>common_local_url( - 'api', - array('apiaction'=>'oembed','method'=>'oembed.json'), - array('url'=>$this->notice->uri)), + 'oembed', + array(), + array('format'=>'json','url'=>$this->notice->uri)), 'title'=>'oEmbed'),null); $this->element('link',array('rel'=>'alternate', 'type'=>'text/xml+oembed', 'href'=>common_local_url( - 'api', - array('apiaction'=>'oembed','method'=>'oembed.xml'), - array('url'=>$this->notice->uri)), + 'oembed', + array(), + array('format'=>'xml','url'=>$this->notice->uri)), 'title'=>'oEmbed'),null); } } diff --git a/actions/showstream.php b/actions/showstream.php index cd5d4bb70..89285b13c 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * User profile page * @@ -20,15 +20,15 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Personal - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Sarven Capadisli <csarven@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Sarven Capadisli <csarven@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -48,10 +48,10 @@ require_once INSTALLDIR.'/lib/feedlist.php'; * to subscriptions and stuff, etc. * * @category Personal - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class ShowstreamAction extends ProfileAction @@ -358,7 +358,9 @@ class ShowstreamAction extends ProfileAction } } else { - $message .= sprintf(_('Why not [register an account](%%%%action.register%%%%) and then nudge %s or post a notice to his or her attention.'), $this->user->nickname); + $message .= sprintf(_('Why not [register an account](%%%%action.%s%%%%) and then nudge %s or post a notice to his or her attention.'), + (!common_config('site','openidonly')) ? 'register' : 'openidlogin', + $this->user->nickname); } $this->elementStart('div', 'guide'); @@ -378,20 +380,27 @@ class ShowstreamAction extends ProfileAction $this->showEmptyListMessage(); } + $args = array('nickname' => $this->user->nickname); + if (!empty($this->tag)) + { + $args['tag'] = $this->tag; + } $this->pagination($this->page>1, $cnt>NOTICES_PER_PAGE, $this->page, - 'showstream', array('nickname' => $this->user->nickname)); + 'showstream', $args); } function showAnonymousMessage() { 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 [Laconica](http://laconi.ca/) 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.%s%%%%) to follow **%s**\'s notices and many more! ([Read more](%%%%doc.help%%%%))'), + $this->user->nickname, + (!common_config('site','openidonly')) ? 'register' : 'openidlogin', + $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 [Laconica](http://laconi.ca/) tool. '), + 'based on the Free Software [StatusNet](http://status.net/) tool. '), $this->user->nickname, $this->user->nickname); } $this->elementStart('div', array('id' => 'anon_notice')); diff --git a/actions/smssettings.php b/actions/smssettings.php index 922bab9a4..672abcef8 100644 --- a/actions/smssettings.php +++ b/actions/smssettings.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * Settings for SMS * @@ -20,14 +20,14 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Settings - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -37,10 +37,10 @@ require_once INSTALLDIR.'/lib/connectsettingsaction.php'; * Settings for SMS * * @category Settings - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ * * @see SettingsAction */ @@ -69,6 +69,12 @@ class SmssettingsAction extends ConnectSettingsAction return _('You can receive SMS messages through email from %%site.name%%.'); } + function showScripts() + { + parent::showScripts(); + $this->autofocus('sms'); + } + /** * Content area of the page * @@ -80,6 +86,12 @@ class SmssettingsAction extends ConnectSettingsAction function showContent() { + if (!common_config('sms', 'enabled')) { + $this->element('div', array('class' => 'error'), + _('SMS is not available.')); + return; + } + $user = common_current_user(); $this->elementStart('form', array('method' => 'post', diff --git a/actions/subedit.php b/actions/subedit.php index 2e1bf5538..cf6589e50 100644 --- a/actions/subedit.php +++ b/actions/subedit.php @@ -1,7 +1,7 @@ <?php /* - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { exit(1); } +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } class SubeditAction extends Action { diff --git a/actions/subscribe.php b/actions/subscribe.php index 15b89a312..4c46806e4 100644 --- a/actions/subscribe.php +++ b/actions/subscribe.php @@ -1,7 +1,7 @@ <?php /* - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { exit(1); } +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } class SubscribeAction extends Action { diff --git a/actions/subscribers.php b/actions/subscribers.php index 66ac00fb1..f7d08d9d0 100644 --- a/actions/subscribers.php +++ b/actions/subscribers.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * List a user's subscribers * @@ -20,15 +20,15 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Social - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Sarven Capadisli <csarven@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Sarven Capadisli <csarven@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -36,10 +36,10 @@ if (!defined('LACONICA')) { * List a user's subscribers * * @category Social - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class SubscribersAction extends GalleryAction @@ -111,7 +111,9 @@ class SubscribersAction extends GalleryAction } } else { - $message = sprintf(_('%s has no subscribers. Why not [register an account](%%%%action.register%%%%) and be the first?'), $this->user->nickname); + $message = sprintf(_('%s has no subscribers. Why not [register an account](%%%%action.%s%%%%) and be the first?'), + $this->user->nickname, + (!common_config('site','openidonly')) ? 'register' : 'openidlogin'); } $this->elementStart('div', 'guide'); diff --git a/actions/subscriptions.php b/actions/subscriptions.php index 42bdae10f..cc7b38ee4 100644 --- a/actions/subscriptions.php +++ b/actions/subscriptions.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * List of a user's subscriptions * @@ -20,15 +20,15 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Social - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Sarven Capadisli <csarven@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Sarven Capadisli <csarven@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -36,13 +36,13 @@ if (!defined('LACONICA')) { * A list of the user's subscriptions * * @category Social - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { exit(1); } +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } class SubscriptionsAction extends GalleryAction { @@ -107,6 +107,12 @@ class SubscriptionsAction extends GalleryAction array('nickname' => $this->user->nickname)); } + function showScripts() + { + parent::showScripts(); + $this->autofocus('tag'); + } + function showEmptyListMessage() { if (common_logged_in()) { @@ -174,14 +180,26 @@ class SubscriptionsListItem extends SubscriptionListItem return; } + if (!common_config('xmpp', 'enabled') && !common_config('sms', 'enabled')) { + return; + } + $this->out->elementStart('form', array('id' => 'subedit-' . $this->profile->id, 'method' => 'post', 'class' => 'form_subscription_edit', 'action' => common_local_url('subedit'))); $this->out->hidden('token', common_session_token()); $this->out->hidden('profile', $this->profile->id); - $this->out->checkbox('jabber', _('Jabber'), $sub->jabber); - $this->out->checkbox('sms', _('SMS'), $sub->sms); + if (common_config('xmpp', 'enabled')) { + $this->out->checkbox('jabber', _('Jabber'), $sub->jabber); + } else { + $this->out->hidden('jabber', $sub->jabber); + } + if (common_config('sms', 'enabled')) { + $this->out->checkbox('sms', _('SMS'), $sub->sms); + } else { + $this->out->hidden('sms', $sub->sms); + } $this->out->submit('save', _('Save')); $this->out->elementEnd('form'); return; diff --git a/actions/sup.php b/actions/sup.php index a5b665562..5daf0a1c1 100644 --- a/actions/sup.php +++ b/actions/sup.php @@ -1,7 +1,7 @@ <?php /* - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { exit(1); } +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } class SupAction extends Action { diff --git a/actions/tag.php b/actions/tag.php index 020399d9e..f0ab30308 100644 --- a/actions/tag.php +++ b/actions/tag.php @@ -1,7 +1,7 @@ <?php /* - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -17,10 +17,13 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { exit(1); } +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } class TagAction extends Action { + + var $notice; + function prepare($args) { parent::prepare($args); @@ -42,6 +45,12 @@ class TagAction extends Action common_set_returnto($this->selfUrl()); + $this->notice = Notice_tag::getStream($this->tag, (($this->page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE + 1); + + if($this->page > 1 && $this->notice->N == 0){ + $this->serverError(_('No such page'),$code=404); + } + return true; } @@ -94,9 +103,7 @@ class TagAction extends Action function showContent() { - $notice = Notice_tag::getStream($this->tag, (($this->page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE + 1); - - $nl = new NoticeList($notice, $this); + $nl = new NoticeList($this->notice, $this); $cnt = $nl->show(); diff --git a/actions/tagother.php b/actions/tagother.php index 96246f799..c3f43be8b 100644 --- a/actions/tagother.php +++ b/actions/tagother.php @@ -1,7 +1,7 @@ <?php /* - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { exit(1); } +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } require_once(INSTALLDIR.'/lib/settingsaction.php'); diff --git a/actions/tagrss.php b/actions/tagrss.php index f69374fca..75cbfa274 100644 --- a/actions/tagrss.php +++ b/actions/tagrss.php @@ -1,7 +1,7 @@ <?php /* - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { exit(1); } +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } require_once(INSTALLDIR.'/lib/rssaction.php'); @@ -61,7 +61,8 @@ class TagrssAction extends Rss10Action $c = array('url' => common_local_url('tagrss', array('tag' => $tagname)), 'title' => $tagname, 'link' => common_local_url('tagrss', array('tag' => $tagname)), - 'description' => sprintf(_('Microblog tagged with %s'), $tagname)); + 'description' => sprintf(_('Updates tagged with %1$s on %2$s!'), + $tagname, common_config('site', 'name'))); return $c; } diff --git a/actions/twitapiaccount.php b/actions/twitapiaccount.php index f2a7534a2..93c8443c9 100644 --- a/actions/twitapiaccount.php +++ b/actions/twitapiaccount.php @@ -1,7 +1,7 @@ <?php /* - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } diff --git a/actions/twitapiblocks.php b/actions/twitapiblocks.php index d8e72efb1..ed17946ae 100644 --- a/actions/twitapiblocks.php +++ b/actions/twitapiblocks.php @@ -1,7 +1,7 @@ <?php /* - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } diff --git a/actions/twitapidirect_messages.php b/actions/twitapidirect_messages.php index bd27e9d20..dbe55804b 100644 --- a/actions/twitapidirect_messages.php +++ b/actions/twitapidirect_messages.php @@ -1,7 +1,7 @@ <?php /* - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } diff --git a/actions/twitapifavorites.php b/actions/twitapifavorites.php index 8256668f3..f8943fe2d 100644 --- a/actions/twitapifavorites.php +++ b/actions/twitapifavorites.php @@ -1,7 +1,7 @@ <?php /* - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -207,32 +207,10 @@ class TwitapifavoritesAction extends TwitterapiAction $other = User::staticGet('id', $notice->profile_id); if ($other && $other->id != $user->id) { if ($other->email && $other->emailnotifyfav) { - $this->notify_mail($other, $user, $notice); + mail_notify_fave($other, $user, $notice); } # XXX: notify by IM # XXX: notify by SMS } } - - function notify_mail($other, $user, $notice) - { - $profile = $user->getProfile(); - $bestname = $profile->getBestName(); - $subject = sprintf(_('%s added your notice as a favorite'), $bestname); - $body = sprintf(_("%1\$s just added your notice from %2\$s as one of their favorites.\n\n" . - "In case you forgot, you can see the text of your notice here:\n\n" . - "%3\$s\n\n" . - "You can see the list of %1\$s's favorites here:\n\n" . - "%4\$s\n\n" . - "Faithfully yours,\n" . - "%5\$s\n"), - $bestname, - common_exact_date($notice->created), - common_local_url('shownotice', array('notice' => $notice->id)), - common_local_url('showfavorites', array('nickname' => $user->nickname)), - common_config('site', 'name')); - - mail_to_user($other, $subject, $body); - } - -}
\ No newline at end of file +} diff --git a/actions/twitapifriendships.php b/actions/twitapifriendships.php index 5fb55e9ff..eea8945c3 100644 --- a/actions/twitapifriendships.php +++ b/actions/twitapifriendships.php @@ -1,7 +1,7 @@ <?php /* - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -99,6 +99,12 @@ class TwitapifriendshipsAction extends TwitterapiAction $other = $this->get_profile($id); $user = $apidata['user']; // Alwyas the auth user + if ($user->id == $other->id) { + $this->clientError(_("You cannot unfollow yourself!"), + 403, $apidata['content-type']); + return; + } + $sub = new Subscription(); $sub->subscriber = $user->id; $sub->subscribed = $other->id; diff --git a/actions/twitapigroups.php b/actions/twitapigroups.php index 71a0776f4..4deb1b764 100644 --- a/actions/twitapigroups.php +++ b/actions/twitapigroups.php @@ -1,8 +1,8 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * - * Laconica extensions to the Twitter-like API for groups + * StatusNet extensions to the Twitter-like API for groups * * PHP version 5 * @@ -20,15 +20,15 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Twitter - * @package Laconica - * @author Craig Andrews - * @author Zach Copley <zach@controlyourself.ca> - * @copyright 2009 Control Yourself, Inc. + * @package StatusNet + * @author Craig Andrews <candrews@integralblue.com> + * @author Zach Copley <zach@status.net> + * @copyright 2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -37,20 +37,143 @@ require_once INSTALLDIR.'/lib/twitterapi.php'; /** * Group-specific API methods * - * This class handles Laconica group API methods. + * This class handles StatusNet group API methods. * * @category Twitter - * @package Laconica - * @author Craig Andrews - * @author Zach Copley <zach@controlyourself.ca> - * @copyright 2009 Control Yourself, Inc. + * @package StatusNet + * @author Craig Andrews <candrews@integralblue.com> + * @author Zach Copley <zach@status.net> + * @copyright 2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class TwitapigroupsAction extends TwitterapiAction { + function list_groups($args, $apidata) + { + parent::handle($args); + + common_debug("in groups api action"); + + $this->auth_user = $apidata['user']; + $user = $this->get_user($apidata['api_arg'], $apidata); + + if (empty($user)) { + $this->clientError('Not Found', 404, $apidata['content-type']); + return; + } + + $page = (int)$this->arg('page', 1); + $count = (int)$this->arg('count', 20); + $max_id = (int)$this->arg('max_id', 0); + $since_id = (int)$this->arg('since_id', 0); + $since = $this->arg('since'); + $group = $user->getGroups(($page-1)*$count, + $count, $since_id, $max_id, $since); + + $sitename = common_config('site', 'name'); + $title = sprintf(_("%s's groups"), $user->nickname); + $taguribase = common_config('integration', 'taguri'); + $id = "tag:$taguribase:Groups"; + $link = common_root_url(); + $subtitle = sprintf(_("groups %s is a member of on %s"), $user->nickname, $sitename); + + switch($apidata['content-type']) { + case 'xml': + $this->show_xml_groups($group); + break; + case 'rss': + $this->show_rss_groups($group, $title, $link, $subtitle); + break; + case 'atom': + $selfuri = common_root_url() . 'api/statusnet/groups/list/' . $user->id . '.atom'; + $this->show_atom_groups($group, $title, $id, $link, + $subtitle, $selfuri); + break; + case 'json': + $this->show_json_groups($group); + break; + default: + $this->clientError(_('API method not found!'), $code = 404); + break; + } + } + + function list_all($args, $apidata) + { + parent::handle($args); + + common_debug("in groups api action"); + + $page = (int)$this->arg('page', 1); + $count = (int)$this->arg('count', 20); + $max_id = (int)$this->arg('max_id', 0); + $since_id = (int)$this->arg('since_id', 0); + $since = $this->arg('since'); + + /* TODO: + Use the $page, $count, $max_id, $since_id, and $since parameters + */ + $group = new User_group(); + $group->orderBy('created DESC'); + $group->find(); + + $sitename = common_config('site', 'name'); + $title = sprintf(_("%s groups"), $sitename); + $taguribase = common_config('integration', 'taguri'); + $id = "tag:$taguribase:Groups"; + $link = common_root_url(); + $subtitle = sprintf(_("groups on %s"), $sitename); + + switch($apidata['content-type']) { + case 'xml': + $this->show_xml_groups($group); + break; + case 'rss': + $this->show_rss_groups($group, $title, $link, $subtitle); + break; + case 'atom': + $selfuri = common_root_url() . 'api/statusnet/groups/list_all.atom'; + $this->show_atom_groups($group, $title, $id, $link, + $subtitle, $selfuri); + break; + case 'json': + $this->show_json_groups($group); + break; + default: + $this->clientError(_('API method not found!'), $code = 404); + break; + } + } + + function show($args, $apidata) + { + parent::handle($args); + + common_debug("in groups api action"); + + $this->auth_user = $apidata['user']; + $group = $this->get_group($apidata['api_arg'], $apidata); + + if (empty($group)) { + $this->clientError('Not Found', 404, $apidata['content-type']); + return; + } + + switch($apidata['content-type']) { + case 'xml': + $this->show_single_xml_group($group); + break; + case 'json': + $this->show_single_json_group($group); + break; + default: + $this->clientError(_('API method not found!'), $code = 404); + } + } + function timeline($args, $apidata) { parent::handle($args); @@ -88,20 +211,19 @@ require_once INSTALLDIR.'/lib/twitterapi.php'; $this->show_xml_timeline($notice); break; case 'rss': - $this->show_rss_timeline($notice, $title, $link, - $subtitle, $suplink); + $this->show_rss_timeline($notice, $title, $link, $subtitle); break; case 'atom': if (isset($apidata['api_arg'])) { $selfuri = common_root_url() . - 'api/laconica/groups/timeline/' . + 'api/statusnet/groups/timeline/' . $apidata['api_arg'] . '.atom'; } else { $selfuri = common_root_url() . - 'api/laconica/groups/timeline.atom'; + 'api/statusnet/groups/timeline.atom'; } $this->show_atom_timeline($notice, $title, $id, $link, - $subtitle, $suplink, $selfuri); + $subtitle, null, $selfuri); break; case 'json': $this->show_json_timeline($notice); @@ -111,4 +233,97 @@ require_once INSTALLDIR.'/lib/twitterapi.php'; } } + function membership($args, $apidata) + { + parent::handle($args); + + common_debug("in groups api action"); + + $this->auth_user = $apidata['user']; + $group = $this->get_group($apidata['api_arg'], $apidata); + + if (empty($group)) { + $this->clientError('Not Found', 404, $apidata['content-type']); + return; + } + + $sitename = common_config('site', 'name'); + $title = sprintf(_("Members of %s group"), $group->nickname); + $taguribase = common_config('integration', 'taguri'); + $id = "tag:$taguribase:GroupMembership:".$group->id; + $link = common_local_url('showgroup', + array('nickname' => $group->nickname)); + $subtitle = sprintf(_('Members of %1$s on %2$s'), + $group->nickname, $sitename); + + $page = (int)$this->arg('page', 1); + $count = (int)$this->arg('count', 20); + $max_id = (int)$this->arg('max_id', 0); + $since_id = (int)$this->arg('since_id', 0); + $since = $this->arg('since'); + + $member = $group->getMembers(($page-1)*$count, + $count, $since_id, $max_id, $since); + + switch($apidata['content-type']) { + case 'xml': + $this->show_twitter_xml_users($member); + break; + //TODO implement the RSS and ATOM content types + /*case 'rss': + $this->show_rss_users($member, $title, $link, $subtitle); + break;*/ + /*case 'atom': + if (isset($apidata['api_arg'])) { + $selfuri = common_root_url() . + 'api/statusnet/groups/membership/' . + $apidata['api_arg'] . '.atom'; + } else { + $selfuri = common_root_url() . + 'api/statusnet/groups/membership.atom'; + } + $this->show_atom_users($member, $title, $id, $link, + $subtitle, null, $selfuri); + break;*/ + case 'json': + $this->show_json_users($member); + break; + default: + $this->clientError(_('API method not found!'), $code = 404); + } + } + + function is_member($args, $apidata) + { + parent::handle($args); + + common_debug("in groups api action"); + + $this->auth_user = $apidata['user']; + $group = User_group::staticGet($args['group_id']); + if(! $group){ + $this->clientError(_('Group not found'), $code = 500); + } + $user = User::staticGet('id', $args['user_id']); + if(! $user){ + $this->clientError(_('User not found'), $code = 500); + } + + $is_member=$user->isMember($group); + + switch($apidata['content-type']) { + case 'xml': + $this->init_document('xml'); + $this->element('is_member', null, $is_member); + $this->end_document('xml'); + break; + case 'json': + $this->init_document('json'); + $this->show_json_objects(array('is_member'=>$is_member)); + $this->end_document('json'); + break; + default: + $this->clientError(_('API method not found!'), $code = 404); + } + } } diff --git a/actions/twitapihelp.php b/actions/twitapihelp.php index dab2b34f9..81381620e 100644 --- a/actions/twitapihelp.php +++ b/actions/twitapihelp.php @@ -1,7 +1,7 @@ <?php /* - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } diff --git a/actions/twitapinotifications.php b/actions/twitapinotifications.php index 09b11766b..0653e69ab 100644 --- a/actions/twitapinotifications.php +++ b/actions/twitapinotifications.php @@ -1,7 +1,7 @@ <?php /* - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { exit(1); } +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } require_once(INSTALLDIR.'/lib/twitterapi.php'); diff --git a/actions/twitapisearchatom.php b/actions/twitapisearchatom.php index 3678213c3..2f587d604 100644 --- a/actions/twitapisearchatom.php +++ b/actions/twitapisearchatom.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * Action for showing Twitter-like Atom search results * @@ -20,14 +20,14 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Search - * @package Laconica - * @author Zach Copley <zach@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Zach Copley <zach@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -41,10 +41,10 @@ require_once INSTALLDIR.'/lib/twitterapi.php'; * RSS10Action. * * @category Search - * @package Laconica - * @author Zach Copley <zach@controlyourself.ca> + * @package StatusNet + * @author Zach Copley <zach@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ * * @see TwitterapiAction */ @@ -227,7 +227,7 @@ class TwitapisearchatomAction extends TwitterapiAction $server = common_config('site', 'server'); $sitename = common_config('site', 'name'); - // XXX: Use xmlns:laconica instead? + // XXX: Use xmlns:statusnet instead? $this->elementStart('feed', array('xmlns' => 'http://www.w3.org/2005/Atom', diff --git a/actions/twitapisearchjson.php b/actions/twitapisearchjson.php index 27a717bfc..c628ee624 100644 --- a/actions/twitapisearchjson.php +++ b/actions/twitapisearchjson.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * Action for showing Twitter-like JSON search results * @@ -20,14 +20,14 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Search - * @package Laconica - * @author Zach Copley <zach@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Zach Copley <zach@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -38,10 +38,10 @@ require_once INSTALLDIR.'/lib/jsonsearchresultslist.php'; * Action handler for Twitter-compatible API search * * @category Search - * @package Laconica - * @author Zach Copley <zach@controlyourself.ca> + * @package StatusNet + * @author Zach Copley <zach@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ * @see TwitterapiAction */ diff --git a/actions/twitapistatuses.php b/actions/twitapistatuses.php index c9943698d..41887a68f 100644 --- a/actions/twitapistatuses.php +++ b/actions/twitapistatuses.php @@ -1,7 +1,7 @@ <?php /* - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -136,6 +136,11 @@ class TwitapistatusesAction extends TwitterapiAction } + function home_timeline($args, $apidata) + { + call_user_func(array($this, 'friends_timeline'), $args, $apidata); + } + function user_timeline($args, $apidata) { parent::handle($args); @@ -292,7 +297,7 @@ class TwitapistatusesAction extends TwitterapiAction $source, 1, $reply_to); if (is_string($notice)) { - $this->serverError($notice); + $this->serverError($notice, 500, $apidata['content-type']); return; } @@ -449,7 +454,8 @@ class TwitapistatusesAction extends TwitterapiAction function friends($args, $apidata) { parent::handle($args); - return $this->subscriptions($apidata, 'subscribed', 'subscriber'); + $includeStatuses=! (boolean) $args['lite']; + return $this->subscriptions($apidata, 'subscribed', 'subscriber', false, $includeStatuses); } function friendsIDs($args, $apidata) @@ -461,7 +467,8 @@ class TwitapistatusesAction extends TwitterapiAction function followers($args, $apidata) { parent::handle($args); - return $this->subscriptions($apidata, 'subscriber', 'subscribed'); + $includeStatuses=! (boolean) $args['lite']; + return $this->subscriptions($apidata, 'subscriber', 'subscribed', false, $includeStatuses); } function followersIDs($args, $apidata) @@ -470,7 +477,7 @@ class TwitapistatusesAction extends TwitterapiAction return $this->subscriptions($apidata, 'subscriber', 'subscribed', true); } - function subscriptions($apidata, $other_attr, $user_attr, $onlyIDs=false) + function subscriptions($apidata, $other_attr, $user_attr, $onlyIDs=false, $includeStatuses=true) { $this->auth_user = $apidata['user']; $user = $this->get_user($apidata['api_arg'], $apidata); @@ -526,26 +533,26 @@ class TwitapistatusesAction extends TwitterapiAction if ($onlyIDs) { $this->showIDs($others, $type); } else { - $this->show_profiles($others, $type); + $this->show_profiles($others, $type, $includeStatuses); } $this->end_document($type); } - function show_profiles($profiles, $type) + function show_profiles($profiles, $type, $includeStatuses) { switch ($type) { case 'xml': $this->elementStart('users', array('type' => 'array')); foreach ($profiles as $profile) { - $this->show_profile($profile); + $this->show_profile($profile,$type,null,$includeStatuses); } $this->elementEnd('users'); break; case 'json': $arrays = array(); foreach ($profiles as $profile) { - $arrays[] = $this->twitter_user_array($profile, true); + $arrays[] = $this->twitter_user_array($profile, $includeStatuses); } print json_encode($arrays); break; diff --git a/actions/twitapilaconica.php b/actions/twitapistatusnet.php index 442fdbcef..490f11dce 100644 --- a/actions/twitapilaconica.php +++ b/actions/twitapistatusnet.php @@ -1,8 +1,8 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * - * Laconica-only extensions to the Twitter-like API + * StatusNet-only extensions to the Twitter-like API * * PHP version 5 * @@ -20,40 +20,40 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Twitter - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @copyright 2008 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @copyright 2008 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } require_once INSTALLDIR.'/lib/twitterapi.php'; /** - * Laconica-specific API methods + * StatusNet-specific API methods * - * This class handles all /laconica/ API methods. + * This class handles all /statusnet/ API methods. * * @category Twitter - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @copyright 2008 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @copyright 2008 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -class TwitapilaconicaAction extends TwitterapiAction +class TwitapistatusnetAction extends TwitterapiAction { /** * A version stamp for the API * - * Returns a version number for this version of Laconica, which + * Returns a version number for this version of StatusNet, which * should make things a bit easier for upgrades. - * URL: http://identi.ca/api/laconica/version.(xml|json) + * URL: http://identi.ca/api/statusnet/version.(xml|json) * Formats: xml, json * * @param array $args Web arguments @@ -70,12 +70,12 @@ class TwitapilaconicaAction extends TwitterapiAction switch ($apidata['content-type']) { case 'xml': $this->init_document('xml'); - $this->element('version', null, LACONICA_VERSION); + $this->element('version', null, STATUSNET_VERSION); $this->end_document('xml'); break; case 'json': $this->init_document('json'); - print '"'.LACONICA_VERSION.'"'; + print '"'.STATUSNET_VERSION.'"'; $this->end_document('json'); break; default: @@ -87,9 +87,9 @@ class TwitapilaconicaAction extends TwitterapiAction * Dump of configuration variables * * Gives a full dump of configuration variables for this instance - * of Laconica, minus variables that may be security-sensitive (like + * of StatusNet, minus variables that may be security-sensitive (like * passwords). - * URL: http://identi.ca/api/laconica/config.(xml|json) + * URL: http://identi.ca/api/statusnet/config.(xml|json) * Formats: xml, json * * @param array $args Web arguments diff --git a/actions/twitapitags.php b/actions/twitapitags.php index 5c8527530..0bcc55d37 100644 --- a/actions/twitapitags.php +++ b/actions/twitapitags.php @@ -1,8 +1,8 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * - * Laconica extensions to the Twitter-like API for groups + * StatusNet extensions to the Twitter-like API for groups * * PHP version 5 * @@ -20,15 +20,15 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Twitter - * @package Laconica - * @author Craig Andrews - * @author Zach Copley <zach@controlyourself.ca> - * @copyright 2009 Control Yourself, Inc. + * @package StatusNet + * @author Craig Andrews <candrews@integralblue.com> + * @author Zach Copley <zach@status.net> + * @copyright 2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -37,15 +37,15 @@ require_once INSTALLDIR.'/lib/twitterapi.php'; /** * Group-specific API methods * - * This class handles Laconica group API methods. + * This class handles StatusNet group API methods. * * @category Twitter - * @package Laconica - * @author Craig Andrews - * @author Zach Copley <zach@controlyourself.ca> - * @copyright 2009 Control Yourself, Inc. + * @package StatusNet + * @author Craig Andrews <candrews@integralblue.com> + * @author Zach Copley <zach@status.net> + * @copyright 2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class TwitapitagsAction extends TwitterapiAction @@ -88,20 +88,19 @@ require_once INSTALLDIR.'/lib/twitterapi.php'; $this->show_xml_timeline($notice); break; case 'rss': - $this->show_rss_timeline($notice, $title, $link, - $subtitle, $suplink); + $this->show_rss_timeline($notice, $title, $link, $subtitle); break; case 'atom': if (isset($apidata['api_arg'])) { $selfuri = common_root_url() . - 'api/laconica/tags/timeline/' . + 'api/statusnet/tags/timeline/' . $apidata['api_arg'] . '.atom'; } else { $selfuri = common_root_url() . - 'api/laconica/tags/timeline.atom'; + 'api/statusnet/tags/timeline.atom'; } $this->show_atom_timeline($notice, $title, $id, $link, - $subtitle, $suplink, $selfuri); + $subtitle, null, $selfuri); break; case 'json': $this->show_json_timeline($notice); diff --git a/actions/twitapitrends.php b/actions/twitapitrends.php index c73d89446..83ab28f35 100644 --- a/actions/twitapitrends.php +++ b/actions/twitapitrends.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * List of replies * @@ -20,14 +20,14 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Search - * @package Laconica - * @author Zach Copley <zach@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Zach Copley <zach@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -37,10 +37,10 @@ require_once INSTALLDIR.'/lib/twitterapi.php'; * Returns the top ten queries that are currently trending * * @category Search - * @package Laconica - * @author Zach Copley <zach@controlyourself.ca> + * @package StatusNet + * @author Zach Copley <zach@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ * * @see TwitterapiAction */ diff --git a/actions/twitapiusers.php b/actions/twitapiusers.php index fea41b397..703fa6754 100644 --- a/actions/twitapiusers.php +++ b/actions/twitapiusers.php @@ -1,7 +1,7 @@ <?php /* - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } diff --git a/actions/twitterauthorization.php b/actions/twitterauthorization.php new file mode 100644 index 000000000..630ac426f --- /dev/null +++ b/actions/twitterauthorization.php @@ -0,0 +1,201 @@ +<?php +/** + * StatusNet, the distributed open-source microblogging tool + * + * Class for doing OAuth authentication against Twitter + * + * PHP version 5 + * + * LICENCE: This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @category TwitterauthorizationAction + * @package StatusNet + * @author Zach Copely <zach@status.net> + * @copyright 2009 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +if (!defined('STATUSNET') && !defined('LACONICA')) { + exit(1); +} + +class TwitterauthorizationAction extends Action +{ + + function prepare($args) + { + parent::prepare($args); + + $this->oauth_token = $this->arg('oauth_token'); + + return true; + } + + /** + * Handler method + * + * @param array $args is ignored since it's now passed in in prepare() + * + * @return nothing + */ + function handle($args) + { + parent::handle($args); + + if (!common_logged_in()) { + $this->clientError(_('Not logged in.'), 403); + } + + $user = common_current_user(); + $flink = Foreign_link::getByUserID($user->id, TWITTER_SERVICE); + + // If there's already a foreign link record, it means we already + // have an access token, and this is unecessary. So go back. + + if (isset($flink)) { + common_redirect(common_local_url('twittersettings')); + } + + // $this->oauth_token is only populated once Twitter authorizes our + // request token. If it's empty we're at the beginning of the auth + // process + + if (empty($this->oauth_token)) { + $this->authorizeRequestToken(); + } else { + $this->saveAccessToken(); + } + } + + /** + * Asks Twitter for a request token, and then redirects to Twitter + * to authorize it. + * + * @return nothing + */ + function authorizeRequestToken() + { + try { + + // Get a new request token and authorize it + + $client = new TwitterOAuthClient(); + $req_tok = + $client->getRequestToken(TwitterOAuthClient::$requestTokenURL); + + // Sock the request token away in the session temporarily + + $_SESSION['twitter_request_token'] = $req_tok->key; + $_SESSION['twitter_request_token_secret'] = $req_tok->secret; + + $auth_link = $client->getAuthorizeLink($req_tok); + + } catch (TwitterOAuthClientException $e) { + $msg = sprintf('OAuth client cURL error - code: %1s, msg: %2s', + $e->getCode(), $e->getMessage()); + $this->serverError(_('Couldn\'t link your Twitter account.')); + } + + common_redirect($auth_link); + } + + /** + * Called when Twitter returns an authorized request token. Exchanges + * it for an access token and stores it. + * + * @return nothing + */ + function saveAccessToken() + { + + // Check to make sure Twitter returned the same request + // token we sent them + + if ($_SESSION['twitter_request_token'] != $this->oauth_token) { + $this->serverError(_('Couldn\'t link your Twitter account.')); + } + + try { + + $client = new TwitterOAuthClient($_SESSION['twitter_request_token'], + $_SESSION['twitter_request_token_secret']); + + // Exchange the request token for an access token + + $atok = $client->getAccessToken(TwitterOAuthClient::$accessTokenURL); + + // Test the access token and get the user's Twitter info + + $client = new TwitterOAuthClient($atok->key, $atok->secret); + $twitter_user = $client->verifyCredentials(); + + } catch (OAuthClientException $e) { + $msg = sprintf('OAuth client cURL error - code: %1$s, msg: %2$s', + $e->getCode(), $e->getMessage()); + $this->serverError(_('Couldn\'t link your Twitter account.')); + } + + // Save the access token and Twitter user info + + $this->saveForeignLink($atok, $twitter_user); + + // Clean up the the mess we made in the session + + unset($_SESSION['twitter_request_token']); + unset($_SESSION['twitter_request_token_secret']); + + common_redirect(common_local_url('twittersettings')); + } + + /** + * Saves a Foreign_link between Twitter user and local user, + * which includes the access token and secret. + * + * @param OAuthToken $access_token the access token to save + * @param mixed $twitter_user twitter API user object + * + * @return nothing + */ + function saveForeignLink($access_token, $twitter_user) + { + $user = common_current_user(); + + $flink = new Foreign_link(); + + $flink->user_id = $user->id; + $flink->foreign_id = $twitter_user->id; + $flink->service = TWITTER_SERVICE; + + $creds = TwitterOAuthClient::packToken($access_token); + + $flink->credentials = $creds; + $flink->created = common_sql_now(); + + // Defaults: noticesync on, everything else off + + $flink->set_flags(true, false, false, false); + + $flink_id = $flink->insert(); + + if (empty($flink_id)) { + common_log_db_error($flink, 'INSERT', __FILE__); + $this->serverError(_('Couldn\'t link your Twitter account.')); + } + + save_twitter_user($twitter_user->id, $twitter_user->screen_name); + } + +} + diff --git a/actions/twittersettings.php b/actions/twittersettings.php index 2b742788e..89169941e 100644 --- a/actions/twittersettings.php +++ b/actions/twittersettings.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * Settings for Twitter integration * @@ -20,30 +20,28 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Settings - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } require_once INSTALLDIR.'/lib/connectsettingsaction.php'; require_once INSTALLDIR.'/lib/twitter.php'; -define('SUBSCRIPTIONS', 80); - /** * Settings for Twitter integration * * @category Settings - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ * * @see SettingsAction */ @@ -69,22 +67,27 @@ class TwittersettingsAction extends ConnectSettingsAction function getInstructions() { - return _('Add your Twitter account to automatically send '. - ' your notices to Twitter, ' . - 'and subscribe to Twitter friends already here.'); + return _('Connect your Twitter account to share your updates ' . + 'with your Twitter friends and vice-versa.'); } /** * Content area of the page * * Shows a form for associating a Twitter account with this - * Laconica account. Also lets the user set preferences. + * StatusNet account. Also lets the user set preferences. * * @return void */ function showContent() { + if (!common_config('twitter', 'enabled')) { + $this->element('div', array('class' => 'error'), + _('Twitter is not available.')); + return; + } + $user = common_current_user(); $profile = $user->getProfile(); @@ -93,7 +96,7 @@ class TwittersettingsAction extends ConnectSettingsAction $flink = Foreign_link::getByUserID($user->id, TWITTER_SERVICE); - if ($flink) { + if (!empty($flink)) { $fuser = $flink->getForeignUser(); } @@ -102,192 +105,86 @@ class TwittersettingsAction extends ConnectSettingsAction 'class' => 'form_settings', 'action' => common_local_url('twittersettings'))); - $this->elementStart('fieldset', array('id' => 'settings_twitter_account')); - $this->element('legend', null, _('Twitter Account')); + $this->hidden('token', common_session_token()); - if ($fuser) { + + $this->elementStart('fieldset', array('id' => 'settings_twitter_account')); + + if (empty($fuser)) { $this->elementStart('ul', 'form_data'); - $this->elementStart('li', array('id' => 'settings_twitter_remove')); - $this->element('span', 'twitter_user', $fuser->nickname); - $this->element('a', array('href' => $fuser->uri), $fuser->uri); - $this->element('p', 'form_note', - _('Current verified Twitter account.')); - $this->hidden('flink_foreign_id', $flink->foreign_id); + $this->elementStart('li', array('id' => 'settings_twitter_login_button')); + $this->element('a', array('href' => common_local_url('twitterauthorization')), + 'Connect my Twitter account'); $this->elementEnd('li'); $this->elementEnd('ul'); - $this->submit('remove', _('Remove')); + + $this->elementEnd('fieldset'); } else { + $this->element('legend', null, _('Twitter account')); + $this->elementStart('p', array('id' => 'form_confirmed')); + $this->element('a', array('href' => $fuser->uri), $fuser->nickname); + $this->elementEnd('p'); + $this->element('p', 'form_note', + _('Connected Twitter account')); + + $this->submit('remove', _('Remove')); + + $this->elementEnd('fieldset'); + + $this->elementStart('fieldset', array('id' => 'settings_twitter_preferences')); + + $this->element('legend', null, _('Preferences')); $this->elementStart('ul', 'form_data'); - $this->elementStart('li', array('id' => 'settings_twitter_login')); - $this->input('twitter_username', _('Twitter user name'), - ($this->arg('twitter_username')) ? - $this->arg('twitter_username') : - $profile->nickname, - _('No spaces, please.')); // hey, it's what Twitter says + $this->elementStart('li'); + $this->checkbox('noticesend', + _('Automatically send my notices to Twitter.'), + ($flink) ? + ($flink->noticesync & FOREIGN_NOTICE_SEND) : + true); $this->elementEnd('li'); $this->elementStart('li'); - $this->password('twitter_password', _('Twitter password')); - $this->elementend('li'); - $this->elementEnd('ul'); - } - $this->elementEnd('fieldset'); - - $this->elementStart('fieldset', - array('id' => 'settings_twitter_preferences')); - $this->element('legend', null, _('Preferences')); - - $this->elementStart('ul', 'form_data'); - $this->elementStart('li'); - $this->checkbox('noticesend', - _('Automatically send my notices to Twitter.'), - ($flink) ? - ($flink->noticesync & FOREIGN_NOTICE_SEND) : - true); - $this->elementEnd('li'); - $this->elementStart('li'); - $this->checkbox('replysync', - _('Send local "@" replies to Twitter.'), - ($flink) ? - ($flink->noticesync & FOREIGN_NOTICE_SEND_REPLY) : - true); - $this->elementEnd('li'); - $this->elementStart('li'); - $this->checkbox('friendsync', - _('Subscribe to my Twitter friends here.'), - ($flink) ? - ($flink->friendsync & FOREIGN_FRIEND_RECV) : - false); - $this->elementEnd('li'); - - if (common_config('twitterbridge','enabled')) { + $this->checkbox('replysync', + _('Send local "@" replies to Twitter.'), + ($flink) ? + ($flink->noticesync & FOREIGN_NOTICE_SEND_REPLY) : + true); + $this->elementEnd('li'); $this->elementStart('li'); - $this->checkbox('noticerecv', - _('Import my Friends Timeline.'), + $this->checkbox('friendsync', + _('Subscribe to my Twitter friends here.'), ($flink) ? - ($flink->noticesync & FOREIGN_NOTICE_RECV) : + ($flink->friendsync & FOREIGN_FRIEND_RECV) : false); $this->elementEnd('li'); - } else { - // preserve setting even if bidrection bridge toggled off - if ($flink && ($flink->noticesync & FOREIGN_NOTICE_RECV)) { - $this->hidden('noticerecv', true, 'noticerecv'); - } - } - - $this->elementEnd('ul'); - if ($flink) { - $this->submit('save', _('Save')); - } else { - $this->submit('add', _('Add')); - } - $this->elementEnd('fieldset'); - - $this->showTwitterSubscriptions(); - - $this->elementEnd('form'); - } - - /** - * Gets some of the user's Twitter friends - * - * Gets the number of Twitter friends that are on this - * instance of Laconica. - * - * @return array array of User objects - */ - - function subscribedTwitterUsers() - { - - $current_user = common_current_user(); - - $qry = 'SELECT "user".* ' . - 'FROM subscription ' . - 'JOIN "user" ON subscription.subscribed = "user".id ' . - 'JOIN foreign_link ON foreign_link.user_id = "user".id ' . - 'WHERE subscriber = %d ' . - 'ORDER BY "user".nickname'; - - $user = new User(); - - $user->query(sprintf($qry, $current_user->id)); - - $users = array(); - - while ($user->fetch()) { - - // Don't include the user's own self-subscription - if ($user->id != $current_user->id) { - $users[] = clone($user); - } - } - - return $users; - } - - /** - * Show user's Twitter friends - * - * Gets the number of Twitter friends that are on this - * instance of Laconica, and shows their mini-avatars. - * - * @return void - */ - - function showTwitterSubscriptions() - { - - $friends = $this->subscribedTwitterUsers(); - - $friends_count = count($friends); - - if ($friends_count > 0) { - $this->elementStart('div', array('id' => 'entity_subscriptions', - 'class' => 'section')); - $this->element('h2', null, _('Twitter Friends')); - $this->elementStart('ul', 'entities users xoxo'); - - for ($i = 0; $i < min($friends_count, SUBSCRIPTIONS); $i++) { - - $other = Profile::staticGet($friends[$i]->id); - - if (!$other) { - common_log_db_error($subs, 'SELECT', __FILE__); - continue; - } - - $this->elementStart('li', 'vcard'); - $this->elementStart('a', array('title' => ($other->fullname) ? - $other->fullname : - $other->nickname, - 'href' => $other->profileurl, - 'class' => 'url')); - - $avatar = $other->getAvatar(AVATAR_MINI_SIZE); - - $avatar_url = ($avatar) ? - $avatar->displayUrl() : - Avatar::defaultImage(AVATAR_MINI_SIZE); - - $this->element('img', array('src' => $avatar_url, - 'width' => AVATAR_MINI_SIZE, - 'height' => AVATAR_MINI_SIZE, - 'class' => 'avatar photo', - 'alt' => ($other->fullname) ? - $other->fullname : - $other->nickname)); - - $this->element('span', 'fn nickname', $other->nickname); - $this->elementEnd('a'); + if (common_config('twitterbridge','enabled')) { + $this->elementStart('li'); + $this->checkbox('noticerecv', + _('Import my Friends Timeline.'), + ($flink) ? + ($flink->noticesync & FOREIGN_NOTICE_RECV) : + false); $this->elementEnd('li'); + } else { + // preserve setting even if bidrection bridge toggled off + if ($flink && ($flink->noticesync & FOREIGN_NOTICE_RECV)) { + $this->hidden('noticerecv', true, 'noticerecv'); + } } $this->elementEnd('ul'); - $this->elementEnd('div'); + if ($flink) { + $this->submit('save', _('Save')); + } else { + $this->submit('add', _('Add')); + } + + $this->elementEnd('fieldset'); } + + $this->elementEnd('form'); } /** @@ -303,7 +200,6 @@ class TwittersettingsAction extends ConnectSettingsAction function handlePost() { - // CSRF protection $token = $this->trimmed('token'); if (!$token || $token != common_session_token()) { @@ -314,8 +210,6 @@ class TwittersettingsAction extends ConnectSettingsAction if ($this->arg('save')) { $this->savePreferences(); - } else if ($this->arg('add')) { - $this->addTwitterAccount(); } else if ($this->arg('remove')) { $this->removeTwitterAccount(); } else { @@ -324,82 +218,6 @@ class TwittersettingsAction extends ConnectSettingsAction } /** - * Associate a Twitter account with the user's account - * - * Validates post input; verifies it against Twitter; and if - * successful stores in the database. - * - * @return void - */ - - function addTwitterAccount() - { - $screen_name = $this->trimmed('twitter_username'); - $password = $this->trimmed('twitter_password'); - $noticesend = $this->boolean('noticesend'); - $noticerecv = $this->boolean('noticerecv'); - $replysync = $this->boolean('replysync'); - $friendsync = $this->boolean('friendsync'); - - if (!Validate::string($screen_name, - array('min_length' => 1, - 'max_length' => 15, - 'format' => VALIDATE_NUM.VALIDATE_ALPHA.'_'))) { - $this->showForm(_('Username must have only numbers, '. - 'upper- and lowercase letters, '. - 'and underscore (_). 15 chars max.')); - return; - } - - if (!$this->verifyCredentials($screen_name, $password)) { - $this->showForm(_('Could not verify your Twitter credentials!')); - return; - } - - $twit_user = twitter_user_info($screen_name, $password); - - if (!$twit_user) { - $this->showForm(sprintf(_('Unable to retrieve account information '. - 'For "%s" from Twitter.'), - $screen_name)); - return; - } - - if (!save_twitter_user($twit_user->id, $screen_name)) { - $this->showForm(_('Unable to save your Twitter settings!')); - return; - } - - $user = common_current_user(); - - $flink = new Foreign_link(); - - $flink->user_id = $user->id; - $flink->foreign_id = $twit_user->id; - $flink->service = TWITTER_SERVICE; - $flink->credentials = $password; - $flink->created = common_sql_now(); - - $flink->set_flags($noticesend, $noticerecv, $replysync, $friendsync); - - $flink_id = $flink->insert(); - - if (!$flink_id) { - common_log_db_error($flink, 'INSERT', __FILE__); - $this->showForm(_('Unable to save your Twitter settings!')); - return; - } - - if ($friendsync) { - save_twitter_friends($user, $twit_user->id, $screen_name, $password); - $flink->last_friendsync = common_sql_now(); - $flink->update(); - } - - $this->showForm(_('Twitter settings saved.'), true); - } - - /** * Disassociate an existing Twitter account from this account * * @return void @@ -408,20 +226,11 @@ class TwittersettingsAction extends ConnectSettingsAction function removeTwitterAccount() { $user = common_current_user(); - - $flink = Foreign_link::getByUserID($user->id, 1); - - $flink_foreign_id = $this->arg('flink_foreign_id'); - - // Maybe an old tab open...? - if ($flink->foreign_id != $flink_foreign_id) { - $this->showForm(_('That is not your Twitter account.')); - return; - } + $flink = Foreign_link::getByUserID($user->id, TWITTER_SERVICE); $result = $flink->delete(); - if (!$result) { + if (empty($result)) { common_log_db_error($flink, 'DELETE', __FILE__); $this->serverError(_('Couldn\'t remove Twitter user.')); return; @@ -444,32 +253,16 @@ class TwittersettingsAction extends ConnectSettingsAction $replysync = $this->boolean('replysync'); $user = common_current_user(); + $flink = Foreign_link::getByUserID($user->id, TWITTER_SERVICE); - $flink = Foreign_link::getByUserID($user->id, 1); - - if (!$flink) { + if (empty($flink)) { common_log_db_error($flink, 'SELECT', __FILE__); $this->showForm(_('Couldn\'t save Twitter preferences.')); return; } - $twitter_id = $flink->foreign_id; - $password = $flink->credentials; - - $fuser = $flink->getForeignUser(); - - if (!$fuser) { - common_log_db_error($fuser, 'SELECT', __FILE__); - $this->showForm(_('Couldn\'t save Twitter preferences.')); - return; - } - - $screen_name = $fuser->nickname; - $original = clone($flink); - $flink->set_flags($noticesend, $noticerecv, $replysync, $friendsync); - $result = $flink->update($original); if ($result === false) { @@ -478,45 +271,7 @@ class TwittersettingsAction extends ConnectSettingsAction return; } - if ($friendsync) { - save_twitter_friends($user, $flink->foreign_id, $screen_name, $password); - } - $this->showForm(_('Twitter preferences saved.'), true); } - /** - * Verifies a username and password against Twitter's API - * - * @param string $screen_name Twitter user name - * @param string $password Twitter password - * - * @return boolean success flag - */ - - function verifyCredentials($screen_name, $password) - { - $uri = 'http://twitter.com/account/verify_credentials.json'; - - $data = get_twitter_data($uri, $screen_name, $password); - - if (!$data) { - return false; - } - - $user = json_decode($data); - - if (!$user) { - return false; - } - - $twitter_id = $user->id; - - if ($twitter_id) { - return $twitter_id; - } - - return false; - } - } diff --git a/actions/unblock.php b/actions/unblock.php index 05d57c60d..dc28d5d54 100644 --- a/actions/unblock.php +++ b/actions/unblock.php @@ -5,14 +5,14 @@ * PHP version 5 * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ * - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -28,7 +28,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -36,11 +36,11 @@ if (!defined('LACONICA')) { * Unblock a user action class. * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ */ class UnblockAction extends Action { diff --git a/actions/unsubscribe.php b/actions/unsubscribe.php index 19275041a..4a5863489 100644 --- a/actions/unsubscribe.php +++ b/actions/unsubscribe.php @@ -1,7 +1,18 @@ <?php -/* - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. +/** + * Unsubscribe handler + * + * PHP version 5 + * + * @category Action + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> + * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 + * @link http://status.net/ + * + * StatusNet - the distributed open-source microblogging tool + * Copyright (C) 2008, 2009, StatusNet, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -17,6 +28,20 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +if (!defined('STATUSNET') && !defined('LACONICA')) { + exit(1); +} + +/** + * Unsubscribe handler + * + * @category Action + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> + * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 + * @link http://status.net/ + */ class UnsubscribeAction extends Action { @@ -31,16 +56,18 @@ class UnsubscribeAction extends Action $user = common_current_user(); if ($_SERVER['REQUEST_METHOD'] != 'POST') { - common_redirect(common_local_url('subscriptions', array('nickname' => $user->nickname))); + common_redirect(common_local_url('subscriptions', + array('nickname' => $user->nickname))); return; } - # CSRF protection + /* Use a session token for CSRF protection. */ $token = $this->trimmed('token'); if (!$token || $token != common_session_token()) { - $this->clientError(_('There was a problem with your session token. Try again, please.')); + $this->clientError(_('There was a problem with your session token. ' . + 'Try again, please.')); return; } @@ -53,7 +80,7 @@ class UnsubscribeAction extends Action $other = Profile::staticGet('id', $other_id); - if (!$other_id) { + if (!$other) { $this->clientError(_('No profile with that id.')); return; } @@ -76,8 +103,8 @@ class UnsubscribeAction extends Action $this->elementEnd('body'); $this->elementEnd('html'); } else { - common_redirect(common_local_url('subscriptions', array('nickname' => - $user->nickname)), + common_redirect(common_local_url('subscriptions', + array('nickname' => $user->nickname)), 303); } } diff --git a/actions/updateprofile.php b/actions/updateprofile.php index d8b62fb09..9a4cf8e46 100644 --- a/actions/updateprofile.php +++ b/actions/updateprofile.php @@ -1,7 +1,7 @@ <?php /* - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { exit(1); } +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } require_once(INSTALLDIR.'/lib/omb.php'); @@ -79,7 +79,7 @@ class UpdateprofileAction extends Action $nickname = $req->get_parameter('omb_listenee_nickname'); if ($nickname && !Validate::string($nickname, array('min_length' => 1, 'max_length' => 64, - 'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) { + 'format' => NICKNAME_FMT))) { $this->clientError(_('Nickname must have only lowercase letters and numbers and no spaces.')); return false; } diff --git a/actions/userauthorization.php b/actions/userauthorization.php index 8dc2c808d..a9ac1f256 100644 --- a/actions/userauthorization.php +++ b/actions/userauthorization.php @@ -1,7 +1,7 @@ <?php /* - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { exit(1); } +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } require_once(INSTALLDIR.'/lib/omb.php'); define('TIMESTAMP_THRESHOLD', 300); @@ -47,7 +47,11 @@ class UserauthorizationAction extends Action # Go log in, and then come back common_set_returnto($_SERVER['REQUEST_URI']); - common_redirect(common_local_url('login')); + if (!common_config('site', 'openidonly')) { + common_redirect(common_local_url('login')); + } else { + common_redirect(common_local_url('openidlogin')); + } return; } @@ -481,7 +485,7 @@ class UserauthorizationAction extends Action $nickname = $_GET['omb_listenee_nickname']; if (!Validate::string($nickname, array('min_length' => 1, 'max_length' => 64, - 'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) { + 'format' => NICKNAME_FMT))) { throw new OAuthException('Nickname must have only letters and numbers and no spaces.'); } $profile = $_GET['omb_listenee_profile']; diff --git a/actions/userbyid.php b/actions/userbyid.php index 8b686ae10..802bcb081 100644 --- a/actions/userbyid.php +++ b/actions/userbyid.php @@ -6,14 +6,14 @@ * PHP version 5 * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -29,7 +29,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -37,11 +37,11 @@ if (!defined('LACONICA')) { * User by ID action class. * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ */ class UserbyidAction extends Action { diff --git a/actions/userdesignsettings.php b/actions/userdesignsettings.php index d7949951a..568c1d624 100644 --- a/actions/userdesignsettings.php +++ b/actions/userdesignsettings.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * Change user password * @@ -20,15 +20,15 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Settings - * @package Laconica - * @author Sarven Capadisli <csarven@controlyourself.ca> - * @author Zach Copley <zach@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Sarven Capadisli <csarven@status.net> + * @author Zach Copley <zach@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -40,11 +40,11 @@ require_once INSTALLDIR . '/lib/designsettings.php'; * Saves a design for a given user * * @category Settings - * @package Laconica - * @author Zach Copley <zach@controlyourself.ca> - * @author Sarven Capadisli <csarven@controlyourself.ca> + * @package StatusNet + * @author Zach Copley <zach@status.net> + * @author Sarven Capadisli <csarven@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class UserDesignSettingsAction extends DesignSettingsAction diff --git a/actions/usergroups.php b/actions/usergroups.php index 7ead6e6e4..84e105153 100644 --- a/actions/usergroups.php +++ b/actions/usergroups.php @@ -1,6 +1,6 @@ <?php /** - * Laconica, the distributed open-source microblogging tool + * StatusNet, the distributed open-source microblogging tool * * User groups information * @@ -20,15 +20,15 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category Personal - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Sarven Capadisli <csarven@controlyourself.ca> - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Sarven Capadisli <csarven@status.net> + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -40,10 +40,10 @@ require_once INSTALLDIR.'/lib/grouplist.php'; * Show the groups a user belongs to * * @category Personal - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class UsergroupsAction extends OwnerDesignAction diff --git a/actions/userrss.php b/actions/userrss.php index 8a940865f..fa6d588cd 100644 --- a/actions/userrss.php +++ b/actions/userrss.php @@ -1,7 +1,7 @@ <?php /* - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { exit(1); } +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } require_once(INSTALLDIR.'/lib/rssaction.php'); @@ -88,9 +88,10 @@ class UserrssAction extends Rss10Action $c = array('url' => common_local_url('userrss', array('nickname' => $user->nickname)), - 'title' => $user->nickname, + 'title' => sprintf(_('%s timeline'), $user->nickname), 'link' => $profile->profileurl, - 'description' => sprintf(_('Microblog by %s'), $user->nickname)); + 'description' => sprintf(_('Updates from %1$s on %2$s!'), + $user->nickname, common_config('site', 'name'))); return $c; } diff --git a/actions/xrds.php b/actions/xrds.php index 9327a3c83..def10e4cf 100644 --- a/actions/xrds.php +++ b/actions/xrds.php @@ -6,14 +6,14 @@ * PHP version 5 * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ * - * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, 2009, Control Yourself, Inc. + * 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 @@ -29,7 +29,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -39,11 +39,11 @@ require_once INSTALLDIR.'/lib/omb.php'; * XRDS for OpenID * * @category Action - * @package Laconica - * @author Evan Prodromou <evan@controlyourself.ca> - * @author Robin Millette <millette@controlyourself.ca> + * @package StatusNet + * @author Evan Prodromou <evan@status.net> + * @author Robin Millette <millette@status.net> * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ */ class XrdsAction extends Action { |