summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actions/apiaccountratelimitstatus.php21
-rw-r--r--actions/apiaccountverifycredentials.php21
-rw-r--r--actions/apiblockcreate.php6
-rw-r--r--actions/apiblockdestroy.php6
-rw-r--r--actions/apidirectmessage.php6
-rw-r--r--actions/apidirectmessagenew.php6
-rw-r--r--actions/apifavoritecreate.php6
-rw-r--r--actions/apifavoritedestroy.php6
-rw-r--r--actions/apifriendshipscreate.php6
-rw-r--r--actions/apifriendshipsdestroy.php6
-rw-r--r--actions/apifriendshipsshow.php6
-rw-r--r--actions/apigroupismember.php6
-rw-r--r--actions/apigroupjoin.php6
-rw-r--r--actions/apigroupleave.php6
-rw-r--r--actions/apigrouplist.php6
-rw-r--r--actions/apistatusesdestroy.php6
-rw-r--r--actions/apistatusesupdate.php6
-rw-r--r--actions/apisubscriptions.php6
-rw-r--r--actions/apitimelinefavorites.php6
-rw-r--r--actions/apitimelinefriends.php6
-rw-r--r--actions/apitimelinementions.php6
-rw-r--r--actions/apitimelineuser.php6
-rw-r--r--lib/apiauth.php24
-rw-r--r--lib/apibareauth.php16
24 files changed, 38 insertions, 164 deletions
diff --git a/actions/apiaccountratelimitstatus.php b/actions/apiaccountratelimitstatus.php
index 9eba5c55d..b823e1cd2 100644
--- a/actions/apiaccountratelimitstatus.php
+++ b/actions/apiaccountratelimitstatus.php
@@ -46,27 +46,6 @@ require_once INSTALLDIR.'/lib/apibareauth.php';
class ApiAccountRateLimitStatusAction extends ApiBareAuthAction
{
- /**
- * Take arguments for running
- *
- * @param array $args $_REQUEST args
- *
- * @return boolean success flag
- *
- */
-
- function prepare($args)
- {
- parent::prepare($args);
-
- if ($this->requiresAuth()) {
- if ($this->checkBasicAuthUser() == false) {
- return false;
- }
- }
-
- return true;
- }
/**
* Handle the request
diff --git a/actions/apiaccountverifycredentials.php b/actions/apiaccountverifycredentials.php
index 0d4928f6c..104b9867f 100644
--- a/actions/apiaccountverifycredentials.php
+++ b/actions/apiaccountverifycredentials.php
@@ -47,27 +47,6 @@ require_once INSTALLDIR.'/lib/apiauth.php';
class ApiAccountVerifyCredentialsAction extends ApiAuthAction
{
- /**
- * Take arguments for running
- *
- * @param array $args $_REQUEST args
- *
- * @return boolean success flag
- *
- */
-
- function prepare($args)
- {
- parent::prepare($args);
-
- if ($this->requiresAuth()) {
- if ($this->checkBasicAuthUser() == false) {
- return false;
- }
- }
-
- return true;
- }
/**
* Handle the request
diff --git a/actions/apiblockcreate.php b/actions/apiblockcreate.php
index 642171271..6dd28dd5e 100644
--- a/actions/apiblockcreate.php
+++ b/actions/apiblockcreate.php
@@ -63,12 +63,6 @@ class ApiBlockCreateAction extends ApiAuthAction
{
parent::prepare($args);
- if ($this->requiresAuth()) {
- if ($this->checkBasicAuthUser() == false) {
- return;
- }
- }
-
$this->user = $this->auth_user;
$this->other = $this->getTargetUser($this->arg('id'));
diff --git a/actions/apiblockdestroy.php b/actions/apiblockdestroy.php
index 109e66ac4..a869dfe46 100644
--- a/actions/apiblockdestroy.php
+++ b/actions/apiblockdestroy.php
@@ -62,12 +62,6 @@ class ApiBlockDestroyAction extends ApiAuthAction
{
parent::prepare($args);
- if ($this->requiresAuth()) {
- if ($this->checkBasicAuthUser() == false) {
- return;
- }
- }
-
$this->user = $this->auth_user;
$this->other = $this->getTargetUser($this->arg('id'));
diff --git a/actions/apidirectmessage.php b/actions/apidirectmessage.php
index fa6883311..cede4c072 100644
--- a/actions/apidirectmessage.php
+++ b/actions/apidirectmessage.php
@@ -70,12 +70,6 @@ class ApiDirectMessageAction extends ApiAuthAction
{
parent::prepare($args);
- if ($this->requiresAuth()) {
- if ($this->checkBasicAuthUser() == false) {
- return;
- }
- }
-
$this->user = $this->auth_user;
if (empty($this->user)) {
diff --git a/actions/apidirectmessagenew.php b/actions/apidirectmessagenew.php
index b531d7c5c..6984c8d10 100644
--- a/actions/apidirectmessagenew.php
+++ b/actions/apidirectmessagenew.php
@@ -64,12 +64,6 @@ class ApiDirectMessageNewAction extends ApiAuthAction
{
parent::prepare($args);
- if ($this->requiresAuth()) {
- if ($this->checkBasicAuthUser() == false) {
- return;
- }
- }
-
$this->user = $this->auth_user;
if (empty($this->user)) {
diff --git a/actions/apifavoritecreate.php b/actions/apifavoritecreate.php
index 6ee6960ba..db001561e 100644
--- a/actions/apifavoritecreate.php
+++ b/actions/apifavoritecreate.php
@@ -62,12 +62,6 @@ class ApiFavoriteCreateAction extends ApiAuthAction
{
parent::prepare($args);
- if ($this->requiresAuth()) {
- if ($this->checkBasicAuthUser() == false) {
- return;
- }
- }
-
$this->user = $this->auth_user;
$this->notice = Notice::staticGet($this->arg('id'));
diff --git a/actions/apifavoritedestroy.php b/actions/apifavoritedestroy.php
index 36946fbfb..3640459f9 100644
--- a/actions/apifavoritedestroy.php
+++ b/actions/apifavoritedestroy.php
@@ -63,12 +63,6 @@ class ApiFavoriteDestroyAction extends ApiAuthAction
{
parent::prepare($args);
- if ($this->requiresAuth()) {
- if ($this->checkBasicAuthUser() == false) {
- return;
- }
- }
-
$this->user = $this->auth_user;
$this->notice = Notice::staticGet($this->arg('id'));
diff --git a/actions/apifriendshipscreate.php b/actions/apifriendshipscreate.php
index 27bdbe062..85eaf3a29 100644
--- a/actions/apifriendshipscreate.php
+++ b/actions/apifriendshipscreate.php
@@ -63,12 +63,6 @@ class ApiFriendshipsCreateAction extends ApiAuthAction
{
parent::prepare($args);
- if ($this->requiresAuth()) {
- if ($this->checkBasicAuthUser() == false) {
- return;
- }
- }
-
$this->user = $this->auth_user;
$this->other = $this->getTargetUser($id);
diff --git a/actions/apifriendshipsdestroy.php b/actions/apifriendshipsdestroy.php
index 3ad12156d..274378051 100644
--- a/actions/apifriendshipsdestroy.php
+++ b/actions/apifriendshipsdestroy.php
@@ -63,12 +63,6 @@ class ApiFriendshipsDestroyAction extends ApiAuthAction
{
parent::prepare($args);
- if ($this->requiresAuth()) {
- if ($this->checkBasicAuthUser() == false) {
- return;
- }
- }
-
$this->user = $this->auth_user;
$this->other = $this->getTargetUser($id);
diff --git a/actions/apifriendshipsshow.php b/actions/apifriendshipsshow.php
index 2f975b121..0ae6a7b82 100644
--- a/actions/apifriendshipsshow.php
+++ b/actions/apifriendshipsshow.php
@@ -62,12 +62,6 @@ class ApiFriendshipsShowAction extends ApiBareAuthAction
{
parent::prepare($args);
- if ($this->requiresAuth()) {
- if ($this->checkBasicAuthUser() == false) {
- return;
- }
- }
-
$source_id = (int)$this->trimmed('source_id');
$source_screen_name = $this->trimmed('source_screen_name');
$target_id = (int)$this->trimmed('target_id');
diff --git a/actions/apigroupismember.php b/actions/apigroupismember.php
index facc58174..02079b6ff 100644
--- a/actions/apigroupismember.php
+++ b/actions/apigroupismember.php
@@ -62,12 +62,6 @@ class ApiGroupIsMemberAction extends ApiBareAuthAction
{
parent::prepare($args);
- if ($this->requiresAuth()) {
- if ($this->checkBasicAuthUser() == false) {
- return;
- }
- }
-
$this->user = $this->getTargetUser(null);
$this->group = $this->getTargetGroup(null);
$this->format = $this->arg('format');
diff --git a/actions/apigroupjoin.php b/actions/apigroupjoin.php
index c00d59463..7ab1b7272 100644
--- a/actions/apigroupjoin.php
+++ b/actions/apigroupjoin.php
@@ -62,12 +62,6 @@ class ApiGroupJoinAction extends ApiAuthAction
{
parent::prepare($args);
- if ($this->requiresAuth()) {
- if ($this->checkBasicAuthUser() == false) {
- return;
- }
- }
-
$this->user = $this->auth_user;
$this->group = $this->getTargetGroup($this->arg('id'));
diff --git a/actions/apigroupleave.php b/actions/apigroupleave.php
index 568b04b7c..86b56f5af 100644
--- a/actions/apigroupleave.php
+++ b/actions/apigroupleave.php
@@ -62,12 +62,6 @@ class ApiGroupLeaveAction extends ApiAuthAction
{
parent::prepare($args);
- if ($this->requiresAuth()) {
- if ($this->checkBasicAuthUser() == false) {
- return;
- }
- }
-
$this->user = $this->auth_user;
$this->group = $this->getTargetGroup($this->arg('id'));
diff --git a/actions/apigrouplist.php b/actions/apigrouplist.php
index 84b7fc1c8..69c347de1 100644
--- a/actions/apigrouplist.php
+++ b/actions/apigrouplist.php
@@ -67,12 +67,6 @@ class ApiGroupListAction extends ApiBareAuthAction
{
parent::prepare($args);
- if ($this->requiresAuth()) {
- if ($this->checkBasicAuthUser() == false) {
- return;
- }
- }
-
$this->page = (int)$this->arg('page', 1);
$this->count = (int)$this->arg('count', 20);
$this->max_id = (int)$this->arg('max_id', 0);
diff --git a/actions/apistatusesdestroy.php b/actions/apistatusesdestroy.php
index ae0f4c453..16a7cc376 100644
--- a/actions/apistatusesdestroy.php
+++ b/actions/apistatusesdestroy.php
@@ -63,12 +63,6 @@ class ApiStatusesDestroyAction extends ApiAuthAction
{
parent::prepare($args);
- if ($this->requiresAuth()) {
- if ($this->checkBasicAuthUser() == false) {
- return false;
- }
- }
-
$this->user = $this->auth_user;
$this->notice_id = (int)$this->trimmed('id');
diff --git a/actions/apistatusesupdate.php b/actions/apistatusesupdate.php
index fb1278559..ab33d8a3e 100644
--- a/actions/apistatusesupdate.php
+++ b/actions/apistatusesupdate.php
@@ -67,12 +67,6 @@ class ApiStatusesUpdateAction extends ApiAuthAction
{
parent::prepare($args);
- if ($this->requiresAuth()) {
- if ($this->checkBasicAuthUser() == false) {
- return false;
- }
- }
-
$this->user = $this->auth_user;
if (empty($this->user)) {
diff --git a/actions/apisubscriptions.php b/actions/apisubscriptions.php
index 78dcd722d..bdaa0ea39 100644
--- a/actions/apisubscriptions.php
+++ b/actions/apisubscriptions.php
@@ -84,12 +84,6 @@ class ApiSubscriptionsAction extends ApiBareAuthAction
$this->count = isset($this->ids_only) ?
5000 : (int)$this->arg('count', 100);
- if ($this->requiresAuth()) {
- if ($this->checkBasicAuthUser() == false) {
- return false;
- }
- }
-
$this->user = $this->getTargetUser($this->arg('id'));
if (empty($this->user)) {
diff --git a/actions/apitimelinefavorites.php b/actions/apitimelinefavorites.php
index 9ccee5cfa..35a996c9c 100644
--- a/actions/apitimelinefavorites.php
+++ b/actions/apitimelinefavorites.php
@@ -69,12 +69,6 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
{
parent::prepare($args);
- if ($this->requiresAuth()) {
- if ($this->checkBasicAuthUser() == false) {
- return;
- }
- }
-
$this->page = (int)$this->arg('page', 1);
$this->count = (int)$this->arg('count', 20);
$this->max_id = (int)$this->arg('max_id', 0);
diff --git a/actions/apitimelinefriends.php b/actions/apitimelinefriends.php
index 65bbb5a74..92a885293 100644
--- a/actions/apitimelinefriends.php
+++ b/actions/apitimelinefriends.php
@@ -75,12 +75,6 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
$this->since = $this->arg('since');
$this->format = $this->arg('format');
- if ($this->requiresAuth()) {
- if ($this->checkBasicAuthUser() == false) {
- return;
- }
- }
-
$this->user = $this->getTargetUser($this->arg('id'));
if (empty($this->user)) {
diff --git a/actions/apitimelinementions.php b/actions/apitimelinementions.php
index 93c6da307..ecead98cc 100644
--- a/actions/apitimelinementions.php
+++ b/actions/apitimelinementions.php
@@ -68,12 +68,6 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
$this->since_id = (int)$this->arg('since_id', 0);
$this->since = $this->arg('since');
- if ($this->requiresAuth()) {
- if ($this->checkBasicAuthUser() == false) {
- return;
- }
- }
-
$this->user = $this->getTargetUser($this->arg('id'));
if (empty($this->user)) {
diff --git a/actions/apitimelineuser.php b/actions/apitimelineuser.php
index c4d02bc62..d50648d7c 100644
--- a/actions/apitimelineuser.php
+++ b/actions/apitimelineuser.php
@@ -70,12 +70,6 @@ class ApiTimelineUserAction extends ApiBareAuthAction
$this->since_id = (int)$this->arg('since_id', 0);
$this->since = $this->arg('since');
- if ($this->requiresAuth()) {
- if ($this->checkBasicAuthUser() == false) {
- return;
- }
- }
-
$this->user = $this->getTargetUser($this->arg('id'));
if (empty($this->user)) {
diff --git a/lib/apiauth.php b/lib/apiauth.php
index d7f8017eb..9fc0e5712 100644
--- a/lib/apiauth.php
+++ b/lib/apiauth.php
@@ -49,6 +49,26 @@ class ApiAuthAction extends ApiAction
var $auth_user = null;
/**
+ * Take arguments for running, and output basic auth header if needed
+ *
+ * @param array $args $_REQUEST args
+ *
+ * @return boolean success flag
+ *
+ */
+
+ function prepare($args)
+ {
+ parent::prepare($args);
+
+ if ($this->requiresAuth()) {
+ $this->checkBasicAuthUser();
+ }
+
+ return true;
+ }
+
+ /**
* Does this API resource require authentication?
*
* @return boolean true
@@ -76,7 +96,7 @@ class ApiAuthAction extends ApiAction
// show error if the user clicks 'cancel'
$this->showBasicAuthError();
- return false;
+ exit;
} else {
$nickname = $this->auth_user;
@@ -94,7 +114,7 @@ class ApiAuthAction extends ApiAction
"$nickname, proxy = $proxy, ip = $ip."
);
$this->showBasicAuthError();
- return false;
+ exit;
}
}
return true;
diff --git a/lib/apibareauth.php b/lib/apibareauth.php
index a99d450ec..0ae477f46 100644
--- a/lib/apibareauth.php
+++ b/lib/apibareauth.php
@@ -48,6 +48,22 @@ require_once INSTALLDIR.'/lib/apiauth.php';
class ApiBareAuthAction extends ApiAuthAction
{
+
+ /**
+ * Take arguments for running
+ *
+ * @param array $args $_REQUEST args
+ *
+ * @return boolean success flag
+ *
+ */
+
+ function prepare($args)
+ {
+ parent::prepare($args);
+ return true;
+ }
+
/**
* Does this API resource require authentication?
*