We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit f79aec36 authored by mattl's avatar mattl

Merge remote-tracking branch 'statusnet/master'

This merges GNU Social with current development of StatusNet. The only conflicts were some documentation, where GNU Social's versions were retained.

Conflicts:
	doc-src/about
	doc-src/faq
	plugins/OpenID/doc-src/openid
parents a1bcc79b 2a70ed27

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.
......@@ -5,6 +5,8 @@ file/*
local/*
_darcs/*
logs/*
log/*
run/*
config.php
.htaccess
httpd.conf
......@@ -27,3 +29,4 @@ php.log
.DS_Store
nbproject
*.mo
This diff is collapsed.
......@@ -1418,3 +1418,41 @@ StartShowInvitationSuccess: Right before showing invitations success msg
EndShowInvitationSuccess: After showing invitations success msg
- $action: invitation action
StartUpgrade: when starting a site upgrade
EndUpgrade: when ending a site upgrade; good place to do your own upgrades
HaveIMPlugin: is there an IM plugin loaded?
- &$haveIMPlugin: set me to true if you're loaded!
StartShowNoticeOptionItems: Before showing first controls in a notice list item; inside the div
- $nli: NoticeListItem being shown
EndShowNoticeOptionItems: After showing last controls in a notice list item; inside the div
- $nli: NoticeListItem being shown
StartNoticeInScope: Before checking if a notice should be visible to a user
- $notice: The notice to check
- $profile: The profile to check for scope
- &$bResult: The boolean result; fill this in if you want to skip
EndNoticeInScope: After checking if a notice should be visible to a user
- $notice: The notice to check
- $profile: The profile to check for scope
- &$bResult: The boolean result; overwrite this if you so desire
StartNoticeListPrefill: Before pre-filling a list of notices with extra data
- &$notices: Notices to be pre-filled
- $avatarSize: The avatar size for the list
EndNoticeListPrefill: After pre-filling a list of notices with extra data
- &$notices: Notices that were pre-filled
- &$profiles: Profiles that were pre-filled
- $avatarSize: The avatar size for the list
OtherAccountProfiles: Hook to add account profiles to a user account profile block
- $profile: the Profile being shown
- &$others: Modifiable array of profile info arrays. Each one has the following fields:
href: link to the profile
text: text for the profile
image: mini image for the profile
This diff is collapsed.
Plugins
=======
Beginning with the 0.7.x branch, StatusNet has supported a simple but
powerful plugin architecture. Important events in the code are named,
like 'StartNoticeSave', and other software can register interest
in those events. When the events happen, the other software is called
and has a choice of accepting or rejecting the events.
In the simplest case, you can add a function to config.php and use the
Event::addHandler() function to hook an event:
function AddGoogleLink($action)
{
$action->menuItem('http://www.google.com/', _('Google'), _('Search engine'));
return true;
}
Event::addHandler('EndPrimaryNav', 'AddGoogleLink');
This adds a menu item to the end of the main navigation menu. You can
see the list of existing events, and parameters that handlers must
implement, in EVENTS.txt.
The Plugin class in lib/plugin.php makes it easier to write more
complex plugins. Sub-classes can just create methods named
'onEventName', where 'EventName' is the name of the event (case
matters!). These methods will be automatically registered as event
handlers by the Plugin constructor (which you must call from your own
class's constructor).
Several example plugins are included in the plugins/ directory. You
can enable a plugin with the following line in config.php:
addPlugin('Example', array('param1' => 'value1',
'param2' => 'value2'));
This will look for and load files named 'ExamplePlugin.php' or
'Example/ExamplePlugin.php' either in the plugins/ directory (for
plugins that ship with StatusNet) or in the local/ directory (for
plugins you write yourself or that you get from somewhere else) or
local/plugins/.
Plugins are documented in their own directories.
This diff is collapsed.
Upgrading
=========
If you've been using StatusNet 1.0 or lower, or if you've
been tracking the "git" version of the software, you will probably
want to upgrade and keep your existing data. Try these step-by-step
instructions; read to the end first before trying them.
0. Download StatusNet and set up all the prerequisites as if you were
doing a new install.
1. Make backups of both your database and your Web directory. UNDER NO
CIRCUMSTANCES should you try to do an upgrade without a known-good
backup. You have been warned.
2. Shut down Web access to your site, either by turning off your Web
server or by redirecting all pages to a "sorry, under maintenance"
page.
3. Shut down XMPP access to your site, typically by shutting down the
xmppdaemon.php process and all other daemons that you're running.
If you've got "monit" or "cron" automatically restarting your
daemons, make sure to turn that off, too.
4. Shut down SMS and email access to your site. The easy way to do
this is to comment out the line piping incoming email to your
maildaemon.php file, and running something like "newaliases".
5. Once all writing processes to your site are turned off, make a
final backup of the Web directory and database.
6. Move your StatusNet directory to a backup spot, like "statusnet.bak".
7. Unpack your StatusNet 1.1.1 tarball and move it to "statusnet" or
wherever your code used to be.
8. Copy the config.php file and the contents of the avatar/, background/,
file/, and local/ subdirectories from your old directory to your new
directory.
9. Copy htaccess.sample to .htaccess in the new directory. Change the
RewriteBase to use the correct path.
10. Upgrade the database.
NOTE: this step is destructive and cannot be
reversed. YOU CAN EASILY DESTROY YOUR SITE WITH THIS STEP. Don't
do it without a known-good backup!
In your new StatusNet 1.1.1 directory and AFTER YOU MAKE A
BACKUP run the upgrade.php script like this:
php ./scripts/upgrade.php
11. Use mysql or psql client to log into your database and make sure that
the notice, user, profile, subscription etc. tables are non-empty.
12. Turn back on the Web server, and check that things still work.
13. Turn back on XMPP bots and email maildaemon.
NOTE: the 1.0.0 version of StatusNet changed the URLs for all admin
panels from /admin/* to /panel/*. This now allows the (popular)
username 'admin', but blocks the considerably less popular username
'panel'. If you have an existing user named 'panel', you should rename
them before upgrading.
UTF-8 Database
--------------
If you are upgrading from a 0.8.x or 0.9.x version, you can safely
skip this section.
StatusNet 0.7.4 introduced a fix for some incorrectly-stored
international characters ("UTF-8"). This fix is not
backwards-compatible; installations from before 0.7.4 will show
non-ASCII characters of old notices incorrectly. This section explains
what to do.
0. You can disable the new behaviour by setting the 'db''utf8' config
option to "false". You should only do this until you're ready to
convert your DB to the new format.
1. When you're ready to convert, you can run the fixup_utf8.php script
in the scripts/ subdirectory. If you've had the "new behaviour"
enabled (probably a good idea), you can give the ID of the first
"new" notice as a parameter, and only notices before that one will
be converted. Notices are converted in reverse chronological order,
so the most recent (and visible) ones will be converted first. The
script should work whether or not you have the 'db''utf8' config
option enabled.
2. When you're ready, set $config['db']['utf8'] to true, so that
new notices will be stored correctly.
Older versions
==============
IMPORTANT NOTE: StatusNet 0.7.4 introduced a fix for some
incorrectly-stored international characters ("UTF-8"). For new
installations, it will now store non-ASCII characters correctly.
However, older installations will have the incorrect storage, and will
consequently show up "wrong" in browsers. See below for how to deal
with this situation.
NOTE: the database definition file, laconica.ini, has been renamed to
statusnet.ini (since this is the recommended database name). If you
have a line in your config.php pointing to the old name, you'll need
to update it.
Note that the XMPP bots have changed since version 0.5; see above for
details.
Privacy
=======
With StatusNet 1.0, our default install profile is for private sites.
If you did not specify the privacy level of your site previously, it
was public. Now, it's private.
If you upgrade a public site, you will need to reset the privacy
level. You can do this in your config.php:
$config['site']['private'] = false;
...or with setconfig.php in the db:
php setconfig.php site private false
...or with the site admin panel.
......@@ -187,9 +187,9 @@ class AccessAdminPanelForm extends AdminForm
*/
function formActions()
{
// TRANS: Title for button to save access settings in site admin panel.
$title = _('Save access settings');
// TRANS: Tooltip for button to save access settings in site admin panel.
// TRANS: Button title to save access settings in site admin panel.
$title = _('Save access settings.');
// TRANS: Button text to save access settings in site admin panel.
$this->out->submit('submit', _m('BUTTON', 'Save'), 'submit', null, $title);
}
}
......@@ -111,18 +111,6 @@ class AddpeopletagAction extends Action
return false;
}
// OMB 0.1 doesn't have a mechanism for local-server-
// originated tag.
$omb01 = Remote_profile::staticGet('id', $tagged_id);
if (!empty($omb01)) {
// TRANS: Client error displayed when trying to add an OMB 0.1 remote profile to a list.
$this->clientError(_('You cannot list an OMB 0.1 '.
'remote profile with this action.'));
return false;
}
return true;
}
......
<?php
/**
* StatusNet - the distributed open-source microblogging tool
* Copyright (C) 2008, 2009, StatusNet, Inc.
* Copyright (C) 2008-2011, 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
......@@ -56,7 +56,13 @@ class AllAction extends ProfileAction
{
parent::prepare($args);
$stream = new ThreadingInboxNoticeStream($this->user, Profile::current());
$user = common_current_user();
if (!empty($user) && $user->streamModeOnly()) {
$stream = new InboxNoticeStream($this->user, Profile::current());
} else {
$stream = new ThreadingInboxNoticeStream($this->user, Profile::current());
}
$this->notice = $stream->getNotices(($this->page-1)*NOTICES_PER_PAGE,
NOTICES_PER_PAGE + 1);
......@@ -85,7 +91,7 @@ class AllAction extends ProfileAction
function title()
{
$user = common_current_user();
if ($user->id == $this->user->id) {
if (!empty($user) && $user->id == $this->user->id) {
// TRANS: Title of a user's own start page.
return _('Home timeline');
} else {
......@@ -99,6 +105,15 @@ class AllAction extends ProfileAction
function getFeeds()
{
return array(
new Feed(Feed::JSON,
common_local_url(
'ApiTimelineFriends', array(
'format' => 'as',
'id' => $this->user->nickname
)
),
// TRANS: %s is user nickname.
sprintf(_('Feed for friends of %s (Activity Streams JSON)'), $this->user->nickname)),
new Feed(Feed::RSS1,
common_local_url(
'allrss', array(
......@@ -145,7 +160,7 @@ class AllAction extends ProfileAction
$message .= sprintf(_('You can try to [nudge %1$s](../%2$s) from their profile or [post something to them](%%%%action.newnotice%%%%?status_textarea=%3$s).'), $this->user->nickname, $this->user->nickname, '@' . $this->user->nickname);
}
} else {
// TRANS: Encoutagement displayed on empty timeline user pages for anonymous users.
// TRANS: Encouragement displayed on empty timeline user pages for anonymous users.
// TRANS: %s is a user nickname. This message contains Markdown links. Keep "](" together.
$message .= sprintf(_('Why not [register an account](%%%%action.register%%%%) and then nudge %s or post a notice to them.'), $this->user->nickname);
}
......@@ -167,7 +182,11 @@ class AllAction extends ProfileAction
$profile = $current_user->getProfile();
}
$nl = new ThreadedNoticeList($this->notice, $this, $profile);
if (!empty($current_user) && $current_user->streamModeOnly()) {
$nl = new NoticeList($this->notice, $this);
} else {
$nl = new ThreadedNoticeList($this->notice, $this, $profile);
}
$cnt = $nl->show();
......@@ -186,12 +205,29 @@ class AllAction extends ProfileAction
function showSections()
{
$ibs = new InviteButtonSection($this);
$ibs->show();
$pop = new PopularNoticeSection($this);
$pop->show();
// $pop = new InboxTagCloudSection($this, $this->user);
// $pop->show();
// Show invite button, as long as site isn't closed, and
// we have a logged in user.
if (common_config('invite', 'enabled') && !common_config('site', 'closed') && common_logged_in()) {
if (!common_config('site', 'private')) {
$ibs = new InviteButtonSection(
$this,
// TRANS: Button text for inviting more users to the StatusNet instance.
// TRANS: Less business/enterprise-oriented language for public sites.
_m('BUTTON', 'Send invite')
);
} else {
$ibs = new InviteButtonSection($this);
}
$ibs->show();
}
// XXX: make this a little more convenient
if (!common_config('performance', 'high')) {
$pop = new PopularNoticeSection($this, Profile::current());
$pop->show();
$pop = new InboxTagCloudSection($this, $this->user);
$pop->show();
}
}
}
......
<?php
/**
* StatusNet, the distributed open-source microblogging tool
*
* Update the authenticating user's profile background image
*
* 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 API
* @package StatusNet
* @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://status.net/
*/
if (!defined('STATUSNET')) {
exit(1);
}
require_once INSTALLDIR . '/lib/apiauth.php';
/**
* Update the authenticating user's profile background image
*
* @category API
* @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://status.net/
*/
class ApiAccountUpdateProfileBackgroundImageAction extends ApiAuthAction
{
var $tile = false;
/**
* Take arguments for running
*
* @param array $args $_REQUEST args
*
* @return boolean success flag
*
*/
function prepare($args)
{
parent::prepare($args);
$this->user = $this->auth_user;
$this->tile = $this->arg('tile');
return true;
}
/**
* Handle the request
*
* Check whether the credentials are valid and output the result
*
* @param array $args $_REQUEST data (unused)
*
* @return void
*/
function handle($args)
{
parent::handle($args);
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
$this->clientError(
// TRANS: Client error. POST is a HTTP command. It should not be translated.
_('This method requires a POST.'),
400, $this->format
);
return;
}
if (!in_array($this->format, array('xml', 'json'))) {
$this->clientError(
// TRANS: Client error displayed when coming across a non-supported API method.
_('API method not found.'),
404,
$this->format
);
return;
}
// Workaround for PHP returning empty $_POST and $_FILES when POST
// length > post_max_size in php.ini
if (empty($_FILES)
&& empty($_POST)
&& ($_SERVER['CONTENT_LENGTH'] > 0)
) {
// TRANS: Client error displayed when the number of bytes in a POST request exceeds a limit.
// TRANS: %s is the number of bytes of the CONTENT_LENGTH.
$msg = _m('The server was unable to handle that much POST data (%s byte) due to its current configuration.',
'The server was unable to handle that much POST data (%s bytes) due to its current configuration.',
intval($_SERVER['CONTENT_LENGTH']));
$this->clientError(sprintf($msg, $_SERVER['CONTENT_LENGTH']));
return;
}
if (empty($this->user)) {
// TRANS: Client error when user not found updating a profile background image.
$this->clientError(_('No such user.'), 404, $this->format);
return;
}
$design = $this->user->getDesign();
// XXX: This is kinda gross, but before we can add a background
// img we have to make sure there's a Design because design ID
// is part of the img filename.
if (empty($design)) {
$this->user->query('BEGIN');
// save new design
$design = new Design();
$id = $design->insert();
if (empty($id)) {
common_log_db_error($id, 'INSERT', __FILE__);
// TRANS: Client error displayed when saving design settings fails because of an empty id.
$this->clientError(_('Unable to save your design settings.'));
return;
}
$original = clone($this->user);
$this->user->design_id = $id;
$result = $this->user->update($original);
if (empty($result)) {
common_log_db_error($original, 'UPDATE', __FILE__);
// TRANS: Client error displayed when saving design settings fails because of an empty result.
$this->clientError(_('Unable to save your design settings.'));
$this->user->query('ROLLBACK');
return;
}
$this->user->query('COMMIT');
}
// Okay, now get the image and add it to the design
try {
$imagefile = ImageFile::fromUpload('image');
} catch (Exception $e) {
$this->clientError($e->getMessage(), 400, $this->format);
return;
}
$filename = Design::filename(
$design->id,
image_type_to_extension($imagefile->type),
common_timestamp()
);
$filepath = Design::path($filename);
move_uploaded_file($imagefile->filepath, $filepath);
// delete any old backround img laying around
if (isset($design->backgroundimage)) {
@unlink(Design::path($design->backgroundimage));
}
$original = clone($design);
$design->backgroundimage = $filename;
$design->setDisposition(true, false, ($this->tile == 'true'));
$result = $design->update($original);
if ($result === false) {
common_log_db_error($design, 'UPDATE', __FILE__);
// TRANS: Error displayed when updating design settings fails.
$this->showForm(_('Could not update your design.'));
return;
}
$profile = $this->user->getProfile();
if (empty($profile)) {
// TRANS: Error message displayed when referring to a user without a profile.
$this->clientError(_('User has no profile.'));
return;
}
$twitter_user = $this->twitterUserArray($profile, true);
if ($this->format == 'xml') {
$this->initDocument('xml');
$this->showTwitterXmlUser($twitter_user, 'user', true);
$this->endDocument('xml');
} elseif ($this->format == 'json') {
$this->initDocument('json');
$this->showJsonObjects($twitter_user);
$this->endDocument('json');
}
}
}
</
<?php
/**
* StatusNet, the distributed open-source microblogging tool
*
* Update a user's design colors
*
* 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 API
* @package StatusNet
* @author Zach Copley <zach@status.net>