Merge branch '0.8.x' of git@gitorious.org:+laconica-developers/laconica/dev into 0.8.x

This commit is contained in:
Evan Prodromou 2009-07-01 12:58:49 -04:00
commit 721ba6c88f
23 changed files with 118 additions and 56 deletions

10
README
View File

@ -906,6 +906,9 @@ sslserver: use an alternate server name for SSL URLs, like
parameters correctly so that both the SSL server and the
"normal" server can access the session cookie and
preferably other cookies as well.
shorturllength: Length of URL at which URLs in a message exceeding 140
characters will be sent to the user's chosen
shortening service.
db
--
@ -1081,6 +1084,13 @@ debug: if turned on, this will make the XMPP library blurt out all of
public: an array of JIDs to send _all_ notices to. This is useful for
participating in third-party search and archiving services.
invite
------
For configuring invites.
enabled: Whether to allow users to send invites. Default true.
tag
---

View File

@ -75,7 +75,7 @@ class DisfavorAction extends Action
return;
}
$fave = new Fave();
$fave->user_id = $this->id;
$fave->user_id = $user->id;
$fave->notice_id = $notice->id;
if (!$fave->find(true)) {
$this->clientError(_('This notice is not a favorite!'));

View File

@ -12,8 +12,6 @@
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
* @link http://laconi.ca/
*
/*
* Laconica - a distributed open-source microblogging tool
* Copyright (C) 2008, 2009, Control Yourself, Inc.
*

View File

@ -116,6 +116,7 @@ class groupRssAction extends Rss10Action
return null;
}
$notices = array();
$notice = $group->getNotices(0, ($limit == 0) ? NOTICES_PER_PAGE : $limit);
while ($notice->fetch()) {

View File

@ -115,6 +115,7 @@ class GroupsAction extends Action
$groups->orderBy('created DESC');
$groups->limit($offset, $limit);
$cnt = 0;
if ($groups->find()) {
$gl = new GroupList($groups, null, $this);
$cnt = $gl->show();

View File

@ -35,7 +35,9 @@ class InviteAction extends CurrentUserDesignAction
function handle($args)
{
parent::handle($args);
if (!common_logged_in()) {
if (!common_config('invite', 'enabled')) {
$this->clientError(_('Invites have been disabled.'));
} else if (!common_logged_in()) {
$this->clientError(sprintf(_('You must be logged in to invite other users to use %s'),
common_config('site', 'name')));
return;

View File

@ -67,11 +67,16 @@ class NoticesearchrssAction extends Rss10Action
if (!$limit) $limit = 20;
$search_engine->limit(0, $limit, true);
$search_engine->query($q);
$notice->find();
if (false === $search_engine->query($q)) {
$cnt = 0;
} else {
$cnt = $notice->find();
}
while ($notice->fetch()) {
$notices[] = clone($notice);
if ($cnt > 0) {
while ($notice->fetch()) {
$notices[] = clone($notice);
}
}
return $notices;

View File

@ -182,8 +182,10 @@ class PublicAction extends Action
$message .= _('Be the first to post!');
}
else {
$message .= _('Why not [register an account](%%action.register%%) and be the first to post!');
}
if (! (common_config('site','closed') || common_config('site','inviteonly'))) {
$message .= _('Why not [register an account](%%action.register%%) and be the first to post!');
}
}
$this->elementStart('div', 'guide');
$this->raw(common_markup_to_html($message));

View File

@ -165,24 +165,30 @@ class TwitapisearchatomAction extends TwitterapiAction
$search_engine->set_sort_mode('chron');
$search_engine->limit(($this->page - 1) * $this->rpp,
$this->rpp + 1, true);
$search_engine->query($q);
$this->cnt = $notice->find();
if (false === $search_engine->query($q)) {
$this->cnt = 0;
} else {
$this->cnt = $notice->find();
}
$cnt = 0;
$this->max_id = 0;
while ($notice->fetch()) {
if ($this->cnt > 0) {
while ($notice->fetch()) {
++$cnt;
++$cnt;
if (!$this->max_id) {
$this->max_id = $notice->id;
if (!$this->max_id) {
$this->max_id = $notice->id;
}
if ($cnt > $this->rpp) {
break;
}
$notices[] = clone($notice);
}
if ($cnt > $this->rpp) {
break;
}
$notices[] = clone($notice);
}
return $notices;

View File

@ -124,8 +124,11 @@ class TwitapisearchjsonAction extends TwitterapiAction
$search_engine = $notice->getSearchEngine('identica_notices');
$search_engine->set_sort_mode('chron');
$search_engine->limit(($this->page - 1) * $this->rpp, $this->rpp + 1, true);
$search_engine->query($q);
$cnt = $notice->find();
if (false === $search_engine->query($q)) {
$cnt = 0;
} else {
$cnt = $notice->find();
}
// TODO: since_id, lang, geocode
@ -146,4 +149,4 @@ class TwitapisearchjsonAction extends TwitterapiAction
{
return true;
}
}
}

View File

@ -86,6 +86,9 @@ $config['sphinx']['port'] = 3312;
// $config['xmpp']['public'][] = 'someindexer@example.net';
// $config['xmpp']['debug'] = false;
// Turn off invites
// $config['invite']['enabled'] = false;
// Default locale info
// $config['site']['timezone'] = 'Pacific/Auckland';
// $config['site']['language'] = 'en_NZ';

View File

@ -72,6 +72,12 @@ function checkPrereqs()
<?
$pass = false;
}
if (!is_writable(INSTALLDIR.'/background/')) {
?><p class="error">Cannot write background directory: <code><?php echo INSTALLDIR; ?>/background/</code></p>
<p>On your server, try this command: <code>chmod a+w <?php echo INSTALLDIR; ?>/background/</code></p>
<?
$pass = false;
}
return $pass;
}

View File

@ -40,7 +40,7 @@ class ShortUrlApi
}
private function is_long($url) {
return strlen($url) >= $this->long_limit;
return strlen($url) >= common_config('site', 'shorturllength');
}
protected function http_post($data) {

View File

@ -421,11 +421,13 @@ class Action extends HTMLOutputter // lawsuit
$this->menuItem(common_local_url('smssettings'),
_('Connect'), _('Connect to SMS, Twitter'), false, 'nav_connect');
}
$this->menuItem(common_local_url('invite'),
_('Invite'),
sprintf(_('Invite friends and colleagues to join you on %s'),
common_config('site', 'name')),
false, 'nav_invitecontact');
if (common_config('invite', 'enabled')) {
$this->menuItem(common_local_url('invite'),
_('Invite'),
sprintf(_('Invite friends and colleagues to join you on %s'),
common_config('site', 'name')),
false, 'nav_invitecontact');
}
$this->menuItem(common_local_url('logout'),
_('Logout'), _('Logout from the site'), false, 'nav_logout');
}

View File

@ -120,6 +120,7 @@ $config =
'private' => false,
'ssl' => 'never',
'sslserver' => null,
'shorturllength' => 30,
'dupelimit' => 60), # default for same person saying the same thing
'syslog' =>
array('appname' => 'laconica', # for syslog
@ -175,6 +176,8 @@ $config =
'host' => null, # only set if != server
'debug' => false, # print extra debug info
'public' => array()), # JIDs of users who want to receive the public stream
'invite' =>
array('enabled' => true),
'sphinx' =>
array('enabled' => false,
'server' => 'localhost',

View File

@ -213,12 +213,14 @@ class FacebookAction extends Action
array('href' => 'index.php', 'title' => _('Home')), _('Home'));
$this->elementEnd('li');
$this->elementStart('li',
array('class' =>
($this->action == 'facebookinvite') ? 'current' : 'facebook_invite'));
$this->element('a',
array('href' => 'invite.php', 'title' => _('Invite')), _('Invite'));
$this->elementEnd('li');
if (common_config('invite', 'enabled')) {
$this->elementStart('li',
array('class' =>
($this->action == 'facebookinvite') ? 'current' : 'facebook_invite'));
$this->element('a',
array('href' => 'invite.php', 'title' => _('Invite')), _('Invite'));
$this->elementEnd('li');
}
$this->elementStart('li',
array('class' =>

View File

@ -130,30 +130,46 @@ class GroupEditForm extends Form
function formData()
{
if ($this->group) {
$id = $this->group->id;
$nickname = $this->group->nickname;
$fullname = $this->group->fullname;
$homepage = $this->group->homepage;
$description = $this->group->description;
$location = $this->group->location;
} else {
$id = '';
$nickname = '';
$fullname = '';
$homepage = '';
$description = '';
$location = '';
}
$this->out->elementStart('ul', 'form_data');
$this->out->elementStart('li');
$this->out->hidden('groupid', $this->group->id);
$this->out->hidden('groupid', $id);
$this->out->input('nickname', _('Nickname'),
($this->out->arg('nickname')) ? $this->out->arg('nickname') : $this->group->nickname,
($this->out->arg('nickname')) ? $this->out->arg('nickname') : $nickname,
_('1-64 lowercase letters or numbers, no punctuation or spaces'));
$this->out->elementEnd('li');
$this->out->elementStart('li');
$this->out->input('fullname', _('Full name'),
($this->out->arg('fullname')) ? $this->out->arg('fullname') : $this->group->fullname);
($this->out->arg('fullname')) ? $this->out->arg('fullname') : $fullname);
$this->out->elementEnd('li');
$this->out->elementStart('li');
$this->out->input('homepage', _('Homepage'),
($this->out->arg('homepage')) ? $this->out->arg('homepage') : $this->group->homepage,
($this->out->arg('homepage')) ? $this->out->arg('homepage') : $homepage,
_('URL of the homepage or blog of the group or topic'));
$this->out->elementEnd('li');
$this->out->elementStart('li');
$this->out->textarea('description', _('Description'),
($this->out->arg('description')) ? $this->out->arg('description') : $this->group->description,
($this->out->arg('description')) ? $this->out->arg('description') : $description,
_('Describe the group or topic in 140 chars'));
$this->out->elementEnd('li');
$this->out->elementStart('li');
$this->out->input('location', _('Location'),
($this->out->arg('location')) ? $this->out->arg('location') : $this->group->location,
($this->out->arg('location')) ? $this->out->arg('location') : $location,
_('Location for the group, if any, like "City, State (or Region), Country"'));
$this->out->elementEnd('li');
if (common_config('group', 'maxaliases') > 0) {

View File

@ -89,6 +89,7 @@ class JSONSearchResultsList
function show()
{
$cnt = 0;
$this->max_id = 0;
$time_start = microtime(true);

View File

@ -108,7 +108,7 @@ function get_all_languages() {
'el' => array('q' => 0.1, 'lang' => 'el', 'name' => 'Greek', 'direction' => 'ltr'),
'en-us' => array('q' => 1, 'lang' => 'en_US', 'name' => 'English (US)', 'direction' => 'ltr'),
'en-gb' => array('q' => 1, 'lang' => 'en_GB', 'name' => 'English (British)', 'direction' => 'ltr'),
'en' => array('q' => 1, 'lang' => 'en', 'name' => 'English', 'direction' => 'ltr'),
'en' => array('q' => 1, 'lang' => 'en_US', 'name' => 'English (US)', 'direction' => 'ltr'),
'es' => array('q' => 1, 'lang' => 'es', 'name' => 'Spanish', 'direction' => 'ltr'),
'fi' => array('q' => 1, 'lang' => 'fi', 'name' => 'Finnish', 'direction' => 'ltr'),
'fr-fr' => array('q' => 1, 'lang' => 'fr_FR', 'name' => 'French', 'direction' => 'ltr'),

View File

@ -100,7 +100,7 @@ class SubGroupNav extends Widget
$this->user->nickname),
$action == 'usergroups',
'nav_usergroups');
if (!is_null($cur) && $this->user->id === $cur->id) {
if (common_config('invite', 'enabled') && !is_null($cur) && $this->user->id === $cur->id) {
$this->out->menuItem(common_local_url('invite'),
_('Invite'),
sprintf(_('Invite friends and colleagues to join you on %s'),

View File

@ -114,7 +114,7 @@ function common_check_user($nickname, $password)
return false;
}
$user = User::staticGet('nickname', $nickname);
if (is_null($user)) {
if (is_null($user) || $user === false) {
return false;
} else {
if (0 == strcmp(common_munge_password($password, $user->id),

View File

@ -10,13 +10,12 @@
#site_nav_global_primary #nav_fb {
position:relative;
margin-left:18px;
margin-right:-7px;
}
#nav_fb .fb_profile_pic_rendered img {
position:relative;
top:3px;
left:0;
position:absolute;
top:-3px;
left:-18px;
display:inline;
border:1px solid #3B5998;
padding:1px;
@ -25,7 +24,7 @@ padding:1px;
#nav_fb img {
position:absolute;
top:-13px;
left:-11px;
left:-25px;
display:inline;
}

View File

@ -273,11 +273,13 @@ class FBConnectPlugin extends Plugin
$action->menuItem(common_local_url('smssettings'),
_('Connect'), _('Connect to SMS, Twitter'), false, 'nav_connect');
}
$action->menuItem(common_local_url('invite'),
_('Invite'),
sprintf(_('Invite friends and colleagues to join you on %s'),
common_config('site', 'name')),
false, 'nav_invitecontact');
if (common_config('invite', 'enabled')) {
$action->menuItem(common_local_url('invite'),
_('Invite'),
sprintf(_('Invite friends and colleagues to join you on %s'),
common_config('site', 'name')),
false, 'nav_invitecontact');
}
// Need to override the Logout link to make it do FB stuff
if (!empty($fbuid)) {