Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x

This commit is contained in:
Evan Prodromou 2009-10-28 14:21:51 -04:00
commit 6c615f6801
17 changed files with 176 additions and 33 deletions

2
.gitignore vendored
View File

@ -24,4 +24,4 @@ config-*.php
good-config.php
lac08.log
php.log
.DS_Store

View File

@ -326,7 +326,7 @@ class EmailsettingsAction extends AccountSettingsAction
$this->showForm(_('Cannot normalize that email address'));
return;
}
if (!Validate::email($email, true)) {
if (!Validate::email($email, common_config('email', 'check_domain'))) {
$this->showForm(_('Not a valid email address'));
return;
} else if ($user->email == $email) {

View File

@ -68,7 +68,7 @@ class InviteAction extends CurrentUserDesignAction
foreach ($addresses as $email) {
$email = trim($email);
if (!Validate::email($email, true)) {
if (!Validate::email($email, common_config('email', 'check_domain'))) {
$this->showForm(sprintf(_('Invalid email address: %s'), $email));
return;
}

View File

@ -160,18 +160,12 @@ class NewnoticeAction extends Action
if (!$content) {
$this->clientError(_('No content!'));
} else {
$content_shortened = common_shorten_links($content);
if (Notice::contentTooLong($content_shortened)) {
$this->clientError(sprintf(_('That\'s too long. '.
'Max notice size is %d chars.'),
Notice::maxContent()));
}
return;
}
$inter = new CommandInterpreter();
$cmd = $inter->handle_command($user, $content_shortened);
$cmd = $inter->handle_command($user, $content);
if ($cmd) {
if ($this->boolean('ajax')) {
@ -182,6 +176,13 @@ class NewnoticeAction extends Action
return;
}
$content_shortened = common_shorten_links($content);
if (Notice::contentTooLong($content_shortened)) {
$this->clientError(sprintf(_('That\'s too long. '.
'Max notice size is %d chars.'),
Notice::maxContent()));
}
$replyto = $this->trimmed('inreplyto');
#If an ID of 0 is wrongly passed here, it will cause a database error,
#so override it...

View File

@ -191,7 +191,7 @@ class RegisterAction extends Action
if (!$this->boolean('license')) {
$this->showForm(_('You can\'t register if you don\'t '.
'agree to the license.'));
} else if ($email && !Validate::email($email, true)) {
} else if ($email && !Validate::email($email, common_config('email', 'check_domain'))) {
$this->showForm(_('Not a valid email address.'));
} else if (!Validate::string($nickname, array('min_length' => 1,
'max_length' => 64,

View File

@ -319,6 +319,7 @@ class User extends Memcached_DataObject
common_config('site', 'name'),
$user->nickname),
'system');
common_broadcast_notice($notice);
}
}

View File

@ -104,6 +104,10 @@ $config['sphinx']['port'] = 3312;
// $config['site']['timezone'] = 'Pacific/Auckland';
// $config['site']['language'] = 'en_NZ';
// When validating user supplied email addresses, validate if the domain
// is running an SMTP server.
// $config['mail']['check_domain'] = true;
// Email info, used for all outbound email
// $config['mail']['notifyfrom'] = 'microblog@example.net';
// $config['mail']['domain'] = 'microblog.example.net';

View File

@ -73,7 +73,7 @@ class UntrackCommand extends UnimplementedCommand
}
}
class NudgeCommand extends UnimplementedCommand
class NudgeCommand extends Command
{
var $other = null;
function __construct($user, $other)
@ -81,6 +81,26 @@ class NudgeCommand extends UnimplementedCommand
parent::__construct($user);
$this->other = $other;
}
function execute($channel)
{
$recipient = User::staticGet('nickname', $this->other);
if(! $recipient){
$channel->error($this->user, sprintf(_('Could not find a user with nickname %s'),
$this->other));
}else{
if ($recipient->id == $this->user->id) {
$channel->error($this->user, _('It does not make a lot of sense to nudge yourself!'));
}else{
if ($recipient->email && $recipient->emailnotifynudge) {
mail_notify_nudge($this->user, $recipient);
}
// XXX: notify by IM
// XXX: notify by SMS
$channel->output($this->user, sprintf(_('Nudge sent to %s'),
$recipient->nickname));
}
}
}
}
class InviteCommand extends UnimplementedCommand
@ -124,18 +144,30 @@ class FavCommand extends Command
function execute($channel)
{
if(substr($this->other,0,1)=='#'){
//favoriting a specific notice_id
$recipient =
common_relative_profile($this->user, common_canonical_nickname($this->other));
$notice = Notice::staticGet(substr($this->other,1));
if (!$notice) {
$channel->error($this->user, _('Notice with that id does not exist'));
return;
}
$recipient = $notice->getProfile();
}else{
//favoriting a given user's last notice
if (!$recipient) {
$channel->error($this->user, _('No such user.'));
return;
}
$notice = $recipient->getCurrentNotice();
if (!$notice) {
$channel->error($this->user, _('User has no last notice'));
return;
$recipient =
common_relative_profile($this->user, common_canonical_nickname($this->other));
if (!$recipient) {
$channel->error($this->user, _('No such user.'));
return;
}
$notice = $recipient->getCurrentNotice();
if (!$notice) {
$channel->error($this->user, _('User has no last notice'));
return;
}
}
$fave = Fave::addNew($this->user, $notice);
@ -347,6 +379,71 @@ class MessageCommand extends Command
}
}
class ReplyCommand extends Command
{
var $other = null;
var $text = null;
function __construct($user, $other, $text)
{
parent::__construct($user);
$this->other = $other;
$this->text = $text;
}
function execute($channel)
{
if(substr($this->other,0,1)=='#'){
//replying to a specific notice_id
$notice = Notice::staticGet(substr($this->other,1));
if (!$notice) {
$channel->error($this->user, _('Notice with that id does not exist'));
return;
}
$recipient = $notice->getProfile();
}else{
//replying to a given user's last notice
$recipient =
common_relative_profile($this->user, common_canonical_nickname($this->other));
if (!$recipient) {
$channel->error($this->user, _('No such user.'));
return;
}
$notice = $recipient->getCurrentNotice();
if (!$notice) {
$channel->error($this->user, _('User has no last notice'));
return;
}
}
$len = mb_strlen($this->text);
if ($len == 0) {
$channel->error($this->user, _('No content!'));
return;
}
$this->text = common_shorten_links($this->text);
if (Notice::contentTooLong($this->text)) {
$channel->error($this->user, sprintf(_('Notice too long - maximum is %d characters, you sent %d'),
Notice::maxContent(), mb_strlen($this->text)));
return;
}
$notice = Notice::saveNew($this->user->id, $this->text, $channel->source(), 1,
$notice->id);
if ($notice) {
$channel->output($this->user, sprintf(_('Reply to %s sent'), $recipient->nickname));
} else {
$channel->error($this->user, _('Error saving notice.'));
}
common_broadcast_notice($notice);
}
}
class GetCommand extends Command
{
@ -497,6 +594,9 @@ class HelpCommand extends Command
"get <nickname> - get last notice from user\n".
"whois <nickname> - get profile info on user\n".
"fav <nickname> - add user's last notice as a 'fave'\n".
"fav #<notice_id> - add notice with the given id as a 'fave'\n".
"reply #<notice_id> - reply to notice with a given id\n".
"reply <nickname> - reply to the last notice from user\n".
"join <group> - join group\n".
"drop <group> - leave group\n".
"stats - get your stats\n".
@ -507,7 +607,7 @@ class HelpCommand extends Command
"last <nickname> - same as 'get'\n".
"on <nickname> - not yet implemented.\n".
"off <nickname> - not yet implemented.\n".
"nudge <nickname> - not yet implemented.\n".
"nudge <nickname> - remind a user to update.\n".
"invite <phone number> - not yet implemented.\n".
"track <word> - not yet implemented.\n".
"untrack <word> - not yet implemented.\n".

View File

@ -134,6 +134,17 @@ class CommandInterpreter
} else {
return new MessageCommand($user, $other, $extra);
}
case 'r':
case 'reply':
if (!$arg) {
return null;
}
list($other, $extra) = $this->split_arg($arg);
if (!$extra) {
return null;
} else {
return new ReplyCommand($user, $other, $extra);
}
case 'whois':
if (!$arg) {
return null;

View File

@ -84,7 +84,8 @@ $default =
'image' => 'http://i.creativecommons.org/l/by/3.0/80x15.png'),
'mail' =>
array('backend' => 'mail',
'params' => null),
'params' => null,
'domain_check' => true),
'nickname' =>
array('blacklist' => array(),
'featured' => array()),

View File

@ -176,6 +176,7 @@ function jabber_format_entry($profile, $notice)
$xs = new XMLStringer();
$xs->elementStart('html', array('xmlns' => 'http://jabber.org/protocol/xhtml-im'));
$xs->elementStart('body', array('xmlns' => 'http://www.w3.org/1999/xhtml'));
$xs->element("img", array('src'=> $profile->avatarUrl(AVATAR_MINI_SIZE) , 'alt' => $profile->nickname));
$xs->element('a', array('href' => $profile->profileurl),
$profile->nickname);
$xs->text(": ");
@ -184,6 +185,11 @@ function jabber_format_entry($profile, $notice)
} else {
$xs->raw(common_render_content($notice->content, $notice));
}
$xs->raw(" ");
$xs->element('a', array(
'href'=>common_local_url('conversation',
array('id' => $notice->conversation)).'#notice-'.$notice->id
),sprintf(_('notice id: %s'),$notice->id));
$xs->elementEnd('body');
$xs->elementEnd('html');

View File

@ -83,8 +83,8 @@ class FacebookAction extends Action
function showStylesheets()
{
$this->cssLink('css/display.css', 'base');
$this->cssLink('css/display.css',null,'screen, projection, tv');
$this->cssLink('css/facebookapp.css', 'base');
$this->cssLink('css/display.css', null, 'screen, projection, tv');
$this->cssLink('plugins/Facebook/facebookapp.css');
}
function showScripts()

View File

@ -5,8 +5,8 @@ font-family:"Lucida Sans Unicode", "Lucida Grande", sans-serif;
#wrap {
background-color:#F0F2F5;
padding-left:18px;
padding-right:18px;
padding-left:1.795%;
padding-right:1.795%;
width:auto;
}
@ -15,8 +15,16 @@ h1,h2,h3,h4,h5,h6 {
color:#000;
}
#header {
width:131%;
}
#content {
width:95%;
width:92.7%;
}
#aside_primary {
display:none;
}
#site_nav_local_views a {
@ -26,6 +34,16 @@ background-color:#D0DFE7;
background-color:#FAFBFC;
}
#form_notice .form_note + label,
#form_notice #notice_data-attach {
display:none;
}
#form_notice #notice_action-submit {
height:47px !important;
}
span.facebook-button {
border: 2px solid #aaa;
padding: 3px;

View File

@ -105,6 +105,7 @@ class FacebookinviteAction extends FacebookAction
$multi_params = array('showborder' => 'false');
$multi_params['actiontext'] = $actiontext;
$multi_params['bypass'] = 'cancel';
$multi_params['cols'] = 4;
// Get a list of users who are already using the app for exclusion
$exclude_ids = $this->facebook->api_client->friends_getAppUsers();

View File

@ -265,7 +265,7 @@ class FinishopenidloginAction extends Action
$fullname = '';
}
if (!empty($sreg['email']) && Validate::email($sreg['email'], true)) {
if (!empty($sreg['email']) && Validate::email($sreg['email'], common_config('email', 'check_domain'))) {
$email = $sreg['email'];
} else {
$email = '';

View File

@ -241,7 +241,7 @@ function oid_update_user(&$user, &$sreg)
$orig_user = clone($user);
if ($sreg['email'] && Validate::email($sreg['email'], true)) {
if ($sreg['email'] && Validate::email($sreg['email'], common_config('email', 'check_domain'))) {
$user->email = $sreg['email'];
}

View File

@ -18,7 +18,7 @@ font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
font-size:1em;
}
address {
margin-right:5.8%;
margin-right:5.7%;
}
input, textarea, select, option {