Merge branch '1.0.x' of gitorious.org:statusnet/mainline into 1.0.x
This commit is contained in:
commit
1d2a3be88e
|
@ -159,7 +159,7 @@ class EditgroupAction extends GroupAction
|
|||
function showScripts()
|
||||
{
|
||||
parent::showScripts();
|
||||
$this->autofocus('nickname');
|
||||
$this->autofocus('newnickname');
|
||||
}
|
||||
|
||||
function trySave()
|
||||
|
@ -173,7 +173,7 @@ class EditgroupAction extends GroupAction
|
|||
|
||||
if (Event::handle('StartGroupSaveForm', array($this))) {
|
||||
|
||||
$nickname = Nickname::normalize($this->trimmed('nickname'));
|
||||
$nickname = Nickname::normalize($this->trimmed('newnickname'));
|
||||
$fullname = $this->trimmed('fullname');
|
||||
$homepage = $this->trimmed('homepage');
|
||||
$description = $this->trimmed('description');
|
||||
|
|
|
@ -122,7 +122,7 @@ class NewgroupAction extends Action
|
|||
{
|
||||
if (Event::handle('StartGroupSaveForm', array($this))) {
|
||||
try {
|
||||
$nickname = Nickname::normalize($this->trimmed('nickname'));
|
||||
$nickname = Nickname::normalize($this->trimmed('newnickname'));
|
||||
} catch (NicknameException $e) {
|
||||
$this->showForm($e->getMessage());
|
||||
}
|
||||
|
|
86
actions/top.php
Normal file
86
actions/top.php
Normal file
|
@ -0,0 +1,86 @@
|
|||
<?php
|
||||
/**
|
||||
* StatusNet - the distributed open-source microblogging tool
|
||||
* Copyright (C) 2011, StatusNet, Inc.
|
||||
*
|
||||
* Redirect to the appropriate top-of-site
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @category Top
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2010 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET')) {
|
||||
// This check helps protect against security problems;
|
||||
// your code file can't be executed directly from the web.
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* An action to redirect to the top of the site
|
||||
*
|
||||
* @category Action
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2010 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
class TopAction extends Action
|
||||
{
|
||||
/**
|
||||
* For initializing members of the class.
|
||||
*
|
||||
* @param array $argarray misc. arguments
|
||||
*
|
||||
* @return boolean true
|
||||
*/
|
||||
|
||||
function prepare($argarray)
|
||||
{
|
||||
parent::prepare($argarray);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler method
|
||||
*
|
||||
* @param array $argarray is ignored since it's now passed in in prepare()
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function handle($argarray=null)
|
||||
{
|
||||
if (common_config('singleuser', 'enabled')) {
|
||||
$url = common_local_url('showstream', array('nickname' => User::singleUserNickname()));
|
||||
} else {
|
||||
$url = common_local_url('public');
|
||||
}
|
||||
|
||||
// XXX: Permanent? I think so.
|
||||
|
||||
common_redirect($url, 301);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
|
@ -104,7 +104,7 @@ class UsergroupsAction extends ProfileAction
|
|||
return false;
|
||||
}
|
||||
|
||||
$this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
|
||||
$this->page = $this->trimmed('page', 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -85,14 +85,22 @@ class File extends Managed_DataObject
|
|||
* @return File
|
||||
*/
|
||||
function saveNew(array $redir_data, $given_url) {
|
||||
$x = new File;
|
||||
$x->url = $given_url;
|
||||
if (!empty($redir_data['protected'])) $x->protected = $redir_data['protected'];
|
||||
if (!empty($redir_data['title'])) $x->title = $redir_data['title'];
|
||||
if (!empty($redir_data['type'])) $x->mimetype = $redir_data['type'];
|
||||
if (!empty($redir_data['size'])) $x->size = intval($redir_data['size']);
|
||||
if (isset($redir_data['time']) && $redir_data['time'] > 0) $x->date = intval($redir_data['time']);
|
||||
$file_id = $x->insert();
|
||||
|
||||
// I don't know why we have to keep doing this but I'm adding this last check to avoid
|
||||
// uniqueness bugs.
|
||||
|
||||
$x = File::staticGet('url', $given_url);
|
||||
|
||||
if (empty($x)) {
|
||||
$x = new File;
|
||||
$x->url = $given_url;
|
||||
if (!empty($redir_data['protected'])) $x->protected = $redir_data['protected'];
|
||||
if (!empty($redir_data['title'])) $x->title = $redir_data['title'];
|
||||
if (!empty($redir_data['type'])) $x->mimetype = $redir_data['type'];
|
||||
if (!empty($redir_data['size'])) $x->size = intval($redir_data['size']);
|
||||
if (isset($redir_data['time']) && $redir_data['time'] > 0) $x->date = intval($redir_data['time']);
|
||||
$file_id = $x->insert();
|
||||
}
|
||||
|
||||
$x->saveOembed($redir_data, $given_url);
|
||||
return $x;
|
||||
|
@ -192,7 +200,7 @@ class File extends Managed_DataObject
|
|||
}
|
||||
|
||||
if (empty($x)) {
|
||||
$x = File::staticGet($file_id);
|
||||
$x = File::staticGet('id', $file_id);
|
||||
if (empty($x)) {
|
||||
// @todo FIXME: This could possibly be a clearer message :)
|
||||
// TRANS: Server exception thrown when... Robin thinks something is impossible!
|
||||
|
|
|
@ -350,6 +350,10 @@ class Profile extends Managed_DataObject
|
|||
self::cacheSet($keypart, implode(',', $ids));
|
||||
}
|
||||
|
||||
if (!is_null($offset) && !is_null($limit)) {
|
||||
$ids = array_slice($ids, $offset, $limit);
|
||||
}
|
||||
|
||||
return User_group::multiGet('id', $ids);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ Post a notice
|
|||
|
||||
If you have a question about how to do something, just post a notice
|
||||
with your question. People here like to answer messages. Watch the
|
||||
[public timeline](%%action.public%%) for answers; they'll usually start
|
||||
[public timeline](%%action.top%%) for answers; they'll usually start
|
||||
with "@" plus your user name.
|
||||
|
||||
Bugs
|
||||
|
|
|
@ -7,7 +7,7 @@ character) notices which are broadcast to their friends and fans using
|
|||
the Web, RSS, or instant messages.
|
||||
|
||||
If you'd like to try it out, first [register](%%action.register%%) a new account.
|
||||
Then, on the [public timeline](%%action.public%%), enter your message into
|
||||
Then, on the [public timeline](%%action.top%%), enter your message into
|
||||
the textbox at the top of the page, and click "Send". It will go out on the
|
||||
public timeline and to anyone who is subscribed to your notices (probably nobody,
|
||||
at first).
|
||||
|
|
|
@ -14,7 +14,7 @@ particular, make sure that none of the prohibited items listed below
|
|||
appear in your notice stream or get linked to from your notice stream (things
|
||||
like spam, viruses, or hate content).
|
||||
|
||||
You can review our [Public Stream](%%action.public%%) to get a sense
|
||||
You can review our [Public Stream](%%action.top%%) to get a sense
|
||||
of the types of notices that are welcome on our service (or not!). If
|
||||
you find a %%site.name%% account that you believe violates our terms
|
||||
of service, please check our [Contact](%%doc.contact%%) documentation.
|
||||
|
|
|
@ -20,12 +20,12 @@
|
|||
if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
|
||||
|
||||
define('STATUSNET_BASE_VERSION', '1.0.0');
|
||||
define('STATUSNET_LIFECYCLE', 'rc1'); // 'dev', 'alpha[0-9]+', 'beta[0-9]+', 'rc[0-9]+', 'release'
|
||||
define('STATUSNET_LIFECYCLE', ''); // 'dev', 'alpha[0-9]+', 'beta[0-9]+', 'rc[0-9]+', 'release'
|
||||
define('STATUSNET_VERSION', STATUSNET_BASE_VERSION . STATUSNET_LIFECYCLE);
|
||||
|
||||
define('LACONICA_VERSION', STATUSNET_VERSION); // compatibility
|
||||
|
||||
define('STATUSNET_CODENAME', 'The Sounds of Science');
|
||||
define('STATUSNET_CODENAME', 'It\'s the End of the World as We Know It');
|
||||
|
||||
define('AVATAR_PROFILE_SIZE', 96);
|
||||
define('AVATAR_STREAM_SIZE', 48);
|
||||
|
@ -151,10 +151,19 @@ function PEAR_ErrorToPEAR_Exception($err)
|
|||
if ($err->getCode() == DB_DATAOBJECT_ERROR_NODATA) {
|
||||
return;
|
||||
}
|
||||
|
||||
$msg = $err->getMessage();
|
||||
$userInfo = $err->getUserInfo();
|
||||
|
||||
// Log this; push the message up as an exception
|
||||
|
||||
common_log(LOG_ERR, "PEAR Error: $msg ($userInfo)");
|
||||
|
||||
if ($err->getCode()) {
|
||||
throw new PEAR_Exception($err->getMessage(), $err->getCode());
|
||||
throw new PEAR_Exception($msg, $err, $err->getCode());
|
||||
} else {
|
||||
throw new PEAR_Exception($msg, $err);
|
||||
}
|
||||
throw new PEAR_Exception($err->getMessage());
|
||||
}
|
||||
|
||||
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'PEAR_ErrorToPEAR_Exception');
|
||||
|
|
|
@ -144,8 +144,8 @@ class GroupEditForm extends Form
|
|||
$this->out->elementStart('li');
|
||||
$this->out->hidden('groupid', $id);
|
||||
// TRANS: Field label on group edit form.
|
||||
$this->out->input('nickname', _('Nickname'),
|
||||
($this->out->arg('nickname')) ? $this->out->arg('nickname') : $nickname,
|
||||
$this->out->input('newnickname', _('Nickname'),
|
||||
($this->out->arg('newnickname')) ? $this->out->arg('newnickname') : $nickname,
|
||||
// TRANS: Field title on group edit form.
|
||||
_('1-64 lowercase letters or numbers, no punctuation or spaces.'));
|
||||
$this->out->elementEnd('li');
|
||||
|
|
|
@ -153,4 +153,23 @@ class GroupProfileBlock extends ProfileBlock
|
|||
}
|
||||
$this->out->elementEnd('div');
|
||||
}
|
||||
|
||||
function showName()
|
||||
{
|
||||
parent::showName();
|
||||
$this->showAliases();
|
||||
}
|
||||
|
||||
function showAliases()
|
||||
{
|
||||
$aliases = $this->group->getAliases();
|
||||
|
||||
if (!empty($aliases)) {
|
||||
$this->out->elementStart('ul', 'group_aliases');
|
||||
foreach ($aliases as $alias) {
|
||||
$this->out->element('li', 'group_alias', $alias);
|
||||
}
|
||||
$this->out->elementEnd('ul');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -259,7 +259,7 @@ class ProfileAction extends Action
|
|||
// TRANS: H2 text for user group membership statistics.
|
||||
$this->statsSectionLink('usergroups', _('Groups'));
|
||||
$this->text(' ');
|
||||
$this->text($this->profile->getGroups()->N);
|
||||
$this->text($this->profile->getGroups(0, null)->N);
|
||||
$this->elementEnd('h2');
|
||||
|
||||
if ($groups) {
|
||||
|
|
|
@ -125,7 +125,10 @@ abstract class ProfileBlock extends Widget
|
|||
$homepage = $this->homepage();
|
||||
|
||||
if (!empty($homepage)) {
|
||||
$this->out->element('a', 'profile_block_homepage', $homepage);
|
||||
$this->out->element('a',
|
||||
array('href' => $homepage,
|
||||
'class' => 'profile_block_homepage'),
|
||||
$homepage);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ define('PROFILES_PER_MINILIST', 8);
|
|||
|
||||
class ProfileMiniList extends ProfileList
|
||||
{
|
||||
const MAX_PROFILES = PROFILES_PER_MINILIST; // put it in the class
|
||||
|
||||
function startList()
|
||||
{
|
||||
|
|
|
@ -156,6 +156,7 @@ class Router
|
|||
'backupaccount',
|
||||
'deleteaccount',
|
||||
'restoreaccount',
|
||||
'top',
|
||||
);
|
||||
|
||||
foreach ($main as $a) {
|
||||
|
@ -334,6 +335,10 @@ class Router
|
|||
array('action' => 'showgroup'),
|
||||
array('nickname' => Nickname::DISPLAY_FMT));
|
||||
|
||||
$m->connect('group/:nickname/',
|
||||
array('action' => 'showgroup'),
|
||||
array('nickname' => Nickname::DISPLAY_FMT));
|
||||
|
||||
$m->connect('group/', array('action' => 'groups'));
|
||||
$m->connect('group', array('action' => 'groups'));
|
||||
$m->connect('groups/', array('action' => 'groups'));
|
||||
|
@ -1068,6 +1073,10 @@ class Router
|
|||
$m->connect(':nickname',
|
||||
array('action' => 'showstream'),
|
||||
array('nickname' => Nickname::DISPLAY_FMT));
|
||||
|
||||
$m->connect(':nickname/',
|
||||
array('action' => 'showstream'),
|
||||
array('nickname' => Nickname::DISPLAY_FMT));
|
||||
}
|
||||
|
||||
// AtomPub API
|
||||
|
|
|
@ -569,17 +569,35 @@ class ThreadedNoticeListRepeatsItem extends NoticeListActorsItem
|
|||
return $profiles;
|
||||
}
|
||||
|
||||
function magicList($items)
|
||||
{
|
||||
if (count($items) > 4) {
|
||||
return parent::magicList(array_slice($items, 0, 3));
|
||||
} else {
|
||||
return parent::magicList($items);
|
||||
}
|
||||
}
|
||||
|
||||
function getListMessage($count, $you)
|
||||
{
|
||||
if ($count == 1 && $you) {
|
||||
// darn first person being different from third person!
|
||||
// TRANS: List message for notice repeated by logged in user.
|
||||
return _m('REPEATLIST', 'You have repeated this notice.');
|
||||
return _m('REPEATLIST', 'You repeated this.');
|
||||
} else if ($count > 4) {
|
||||
// TRANS: List message for when more than 4 people repeat something.
|
||||
// TRANS: %%s is a list of users liking a notice, %d is the number over 4 that like the notice.
|
||||
// TRANS: Plural is decided on the total number of users liking the notice (count of %%s + %d).
|
||||
return sprintf(_m('%%s and %d other repeated this.',
|
||||
'%%s and %d others repeated this.',
|
||||
$count - 3),
|
||||
$count - 3);
|
||||
} else {
|
||||
// TRANS: List message for repeated notices.
|
||||
// TRANS: %d is the number of users that have repeated a notice.
|
||||
return sprintf(_m('One person has repeated this notice.',
|
||||
'%d people have repeated this notice.',
|
||||
// TRANS: List message for favoured notices.
|
||||
// TRANS: %%s is a list of users liking a notice.
|
||||
// TRANS: Plural is based on the number of of users that have favoured a notice.
|
||||
return sprintf(_m('%%s repeated this.',
|
||||
'%%s repeated this.',
|
||||
$count),
|
||||
$count);
|
||||
}
|
||||
|
|
|
@ -78,7 +78,13 @@ class BookmarkforurlAction extends Action
|
|||
throw new ClientException(_('Invalid URL.'), 400);
|
||||
}
|
||||
|
||||
$f = File::processNew($this->url);
|
||||
$f = File::staticGet('url', $this->url);
|
||||
|
||||
if (empty($url)) {
|
||||
$f = File::processNew($this->url);
|
||||
}
|
||||
|
||||
// How about now?
|
||||
|
||||
if (!empty($f)) {
|
||||
$this->oembed = File_oembed::staticGet('file_id', $f->id);
|
||||
|
|
|
@ -6,4 +6,4 @@ A bookmarklet is a small piece of javascript code used as a bookmark. This one w
|
|||
|
||||
Drag-and-drop the following link to your bookmarks bar or right-click it and add it to your browser favorites to keep it handy.
|
||||
|
||||
<a href="javascript:(function(){var%20d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f='http://%%site.server%%/%%site.path%%/index.php?action=bookmarkpopup',l=d.location,e=encodeURIComponent,g=f+'&title='+((e(s))?e(s):e(document.title))+'&url='+e(l.href);function%20a(){if(!w.open(g,'t','toolbar=0,resizable=0,scrollbars=1,status=1,width=650,height=470')){l.href=g;}}a();})()">Bookmark on %%site.name%%</a>
|
||||
<a href="javascript:(function(){var%20d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f='http://%%site.server%%/%%site.path%%/index.php?action=bookmarkpopup',l=d.location,e=encodeURIComponent,g=f+'&title='+((e(s))?e(s):e(document.title))+'&url='+e(l.href);function%20a(){if(!w.open(g,'t','toolbar=0,resizable=0,scrollbars=1,status=1,width=650,height=520')){l.href=g;}}a();})()">Bookmark on %%site.name%%</a>
|
||||
|
|
|
@ -70,7 +70,7 @@ class BookmarkpopupAction extends NewbookmarkAction
|
|||
$this->elementStart('div', array('id' => 'header'));
|
||||
$this->elementStart('address');
|
||||
$this->element('a', array('class' => 'url',
|
||||
'href' => common_local_url('public')),
|
||||
'href' => common_local_url('top')),
|
||||
'');
|
||||
$this->elementEnd('address');
|
||||
if (common_logged_in()) {
|
||||
|
|
|
@ -174,9 +174,8 @@ class EventListItem extends NoticeListItemAdapter
|
|||
foreach ($responses as $response) {
|
||||
$ids[] = $response->profile_id;
|
||||
}
|
||||
common_debug("IDS = " . implode(',', $ids));
|
||||
$ids = array_slice($ids, 0, ProfileMiniList::MAX_PROFILES + 1);
|
||||
$profiles = Profile::pivotGet('id', $ids);
|
||||
common_debug("Profiles = " . print_r($profiles, true));
|
||||
$profile = new ArrayWrapper(array_values($profiles));
|
||||
$minilist = new ProfileMiniList($profile, $out);
|
||||
$minilist->show();
|
||||
|
|
|
@ -1976,6 +1976,12 @@ display:block;
|
|||
width:auto;
|
||||
}
|
||||
|
||||
.profile_block .group_aliases .group_alias {
|
||||
display:inline;
|
||||
list-style-type: none;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.profile_block .entity_tags dt {
|
||||
display: inline;
|
||||
margin-right: 3px;
|
||||
|
|
Loading…
Reference in New Issue
Block a user