summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
Diffstat (limited to 'actions')
-rw-r--r--actions/disfavor.php2
-rw-r--r--actions/favor.php2
-rw-r--r--actions/grouprss.php1
-rw-r--r--actions/groups.php1
-rw-r--r--actions/invite.php4
-rw-r--r--actions/noticesearchrss.php13
-rw-r--r--actions/public.php6
-rw-r--r--actions/twitapisearchatom.php28
-rw-r--r--actions/twitapisearchjson.php9
9 files changed, 42 insertions, 24 deletions
diff --git a/actions/disfavor.php b/actions/disfavor.php
index 740f7de93..02e01d6e0 100644
--- a/actions/disfavor.php
+++ b/actions/disfavor.php
@@ -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!'));
diff --git a/actions/favor.php b/actions/favor.php
index ec86b17e6..fe51e34a2 100644
--- a/actions/favor.php
+++ b/actions/favor.php
@@ -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.
*
diff --git a/actions/grouprss.php b/actions/grouprss.php
index 0b7280a11..2bdcaafb2 100644
--- a/actions/grouprss.php
+++ b/actions/grouprss.php
@@ -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()) {
diff --git a/actions/groups.php b/actions/groups.php
index b49d80f37..3d62843ed 100644
--- a/actions/groups.php
+++ b/actions/groups.php
@@ -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();
diff --git a/actions/invite.php b/actions/invite.php
index 5dcc83652..bdea4807d 100644
--- a/actions/invite.php
+++ b/actions/invite.php
@@ -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;
diff --git a/actions/noticesearchrss.php b/actions/noticesearchrss.php
index c1bf3bf5f..2a4b2060d 100644
--- a/actions/noticesearchrss.php
+++ b/actions/noticesearchrss.php
@@ -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;
diff --git a/actions/public.php b/actions/public.php
index 9851285c4..ef9ef0d1a 100644
--- a/actions/public.php
+++ b/actions/public.php
@@ -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));
diff --git a/actions/twitapisearchatom.php b/actions/twitapisearchatom.php
index eb9ab5d8e..3678213c3 100644
--- a/actions/twitapisearchatom.php
+++ b/actions/twitapisearchatom.php
@@ -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;
- }
+ if ($cnt > $this->rpp) {
+ break;
+ }
- $notices[] = clone($notice);
+ $notices[] = clone($notice);
+ }
}
return $notices;
diff --git a/actions/twitapisearchjson.php b/actions/twitapisearchjson.php
index b0e3be687..27a717bfc 100644
--- a/actions/twitapisearchjson.php
+++ b/actions/twitapisearchjson.php
@@ -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;
}
-} \ No newline at end of file
+}