summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-07-01 12:58:49 -0400
committerEvan Prodromou <evan@controlyourself.ca>2009-07-01 12:58:49 -0400
commit721ba6c88f3c89c3efcc8e5f0c9169d94911825d (patch)
treef1b07dfc50858d98258a3043e3c6dbf4f00a22e3 /lib
parent8a8390c1a78a2586bb2e9e10bfcb3502739d8d76 (diff)
parent6c28a07cf58120e271de6e0c9c89a1f9a6d0101e (diff)
Merge branch '0.8.x' of git@gitorious.org:+laconica-developers/laconica/dev into 0.8.x
Diffstat (limited to 'lib')
-rw-r--r--lib/Shorturl_api.php2
-rw-r--r--lib/action.php12
-rw-r--r--lib/common.php3
-rw-r--r--lib/facebookaction.php14
-rw-r--r--lib/groupeditform.php28
-rw-r--r--lib/jsonsearchresultslist.php1
-rw-r--r--lib/language.php2
-rw-r--r--lib/subgroupnav.php2
-rw-r--r--lib/util.php2
9 files changed, 45 insertions, 21 deletions
diff --git a/lib/Shorturl_api.php b/lib/Shorturl_api.php
index 29f4eb3a6..22d5b4cb5 100644
--- a/lib/Shorturl_api.php
+++ b/lib/Shorturl_api.php
@@ -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) {
diff --git a/lib/action.php b/lib/action.php
index 6a2f9b0f1..3bfa6ba15 100644
--- a/lib/action.php
+++ b/lib/action.php
@@ -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');
}
diff --git a/lib/common.php b/lib/common.php
index e2936f075..5d451463b 100644
--- a/lib/common.php
+++ b/lib/common.php
@@ -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',
diff --git a/lib/facebookaction.php b/lib/facebookaction.php
index a445750f7..1ae90d53b 100644
--- a/lib/facebookaction.php
+++ b/lib/facebookaction.php
@@ -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' =>
diff --git a/lib/groupeditform.php b/lib/groupeditform.php
index 7e8d6eea3..fbb39129b 100644
--- a/lib/groupeditform.php
+++ b/lib/groupeditform.php
@@ -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) {
diff --git a/lib/jsonsearchresultslist.php b/lib/jsonsearchresultslist.php
index f786c20a8..7beea9328 100644
--- a/lib/jsonsearchresultslist.php
+++ b/lib/jsonsearchresultslist.php
@@ -89,6 +89,7 @@ class JSONSearchResultsList
function show()
{
$cnt = 0;
+ $this->max_id = 0;
$time_start = microtime(true);
diff --git a/lib/language.php b/lib/language.php
index cd6498d30..3ea3dd2aa 100644
--- a/lib/language.php
+++ b/lib/language.php
@@ -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'),
diff --git a/lib/subgroupnav.php b/lib/subgroupnav.php
index 4a9b36ae8..520991923 100644
--- a/lib/subgroupnav.php
+++ b/lib/subgroupnav.php
@@ -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'),
diff --git a/lib/util.php b/lib/util.php
index 203506bbc..461ca15c1 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -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),