forked from GNUsocial/gnu-social
These same params are used in most API actions; moved to base API class
This commit is contained in:
parent
57dfad64be
commit
b08d16ef2b
@ -46,11 +46,6 @@ require_once INSTALLDIR.'/lib/apiauth.php';
|
||||
class ApiDirectMessageAction extends ApiAuthAction
|
||||
{
|
||||
var $messages = null;
|
||||
var $page = null;
|
||||
var $count = null;
|
||||
var $max_id = null;
|
||||
var $since_id = null;
|
||||
var $since = null;
|
||||
var $title = null;
|
||||
var $subtitle = null;
|
||||
var $link = null;
|
||||
@ -77,12 +72,6 @@ class ApiDirectMessageAction extends ApiAuthAction
|
||||
return;
|
||||
}
|
||||
|
||||
$this->page = (int)$this->arg('page', 1);
|
||||
$this->count = (int)$this->arg('count', 20);
|
||||
$this->max_id = (int)$this->arg('max_id', 0);
|
||||
$this->since_id = (int)$this->arg('since_id', 0);
|
||||
$this->since = $this->arg('since');
|
||||
|
||||
$server = common_root_url();
|
||||
$taguribase = common_config('integration', 'taguri');
|
||||
|
||||
|
@ -45,12 +45,6 @@ require_once INSTALLDIR . '/lib/apibareauth.php';
|
||||
|
||||
class ApiGroupListAction extends ApiBareAuthAction
|
||||
{
|
||||
var $user = null;
|
||||
var $page = null;
|
||||
var $count = null;
|
||||
var $max_id = null;
|
||||
var $since_id = null;
|
||||
var $since = null;
|
||||
var $groups = null;
|
||||
|
||||
/**
|
||||
@ -66,12 +60,6 @@ class ApiGroupListAction extends ApiBareAuthAction
|
||||
{
|
||||
parent::prepare($args);
|
||||
|
||||
$this->page = (int)$this->arg('page', 1);
|
||||
$this->count = (int)$this->arg('count', 20);
|
||||
$this->max_id = (int)$this->arg('max_id', 0);
|
||||
$this->since_id = (int)$this->arg('since_id', 0);
|
||||
$this->since = $this->arg('since');
|
||||
|
||||
$this->user = $this->getTargetUser($id);
|
||||
$this->groups = $this->getGroups();
|
||||
|
||||
|
@ -45,11 +45,6 @@ require_once INSTALLDIR . '/lib/api.php';
|
||||
|
||||
class ApiGroupListAllAction extends ApiAction
|
||||
{
|
||||
var $page = null;
|
||||
var $count = null;
|
||||
var $max_id = null;
|
||||
var $since_id = null;
|
||||
var $since = null;
|
||||
var $groups = null;
|
||||
|
||||
/**
|
||||
@ -65,12 +60,6 @@ class ApiGroupListAllAction extends ApiAction
|
||||
{
|
||||
parent::prepare($args);
|
||||
|
||||
$this->page = (int)$this->arg('page', 1);
|
||||
$this->count = (int)$this->arg('count', 20);
|
||||
$this->max_id = (int)$this->arg('max_id', 0);
|
||||
$this->since_id = (int)$this->arg('since_id', 0);
|
||||
$this->since = $this->arg('since');
|
||||
|
||||
$this->user = $this->getTargetUser($id);
|
||||
$this->groups = $this->getGroups();
|
||||
|
||||
|
@ -45,11 +45,6 @@ require_once INSTALLDIR . '/lib/api.php';
|
||||
|
||||
class ApiGroupMembershipAction extends ApiAction
|
||||
{
|
||||
var $page = null;
|
||||
var $count = null;
|
||||
var $max_id = null;
|
||||
var $since_id = null;
|
||||
var $since = null;
|
||||
var $group = null;
|
||||
var $profiles = null;
|
||||
|
||||
@ -66,14 +61,7 @@ class ApiGroupMembershipAction extends ApiAction
|
||||
{
|
||||
parent::prepare($args);
|
||||
|
||||
$this->page = (int)$this->arg('page', 1);
|
||||
$this->count = (int)$this->arg('count', 20);
|
||||
$this->max_id = (int)$this->arg('max_id', 0);
|
||||
$this->since_id = (int)$this->arg('since_id', 0);
|
||||
$this->since = $this->arg('since');
|
||||
|
||||
$this->group = $this->getTargetGroup($this->arg('id'));
|
||||
|
||||
$this->profiles = $this->getProfiles();
|
||||
|
||||
return true;
|
||||
|
@ -47,10 +47,6 @@ require_once INSTALLDIR.'/lib/apibareauth.php';
|
||||
|
||||
class ApiSubscriptionsAction extends ApiBareAuthAction
|
||||
{
|
||||
|
||||
var $page = null;
|
||||
var $count = null;
|
||||
var $user = null;
|
||||
var $profiles = null;
|
||||
var $tag = null;
|
||||
var $lite = null;
|
||||
@ -69,7 +65,6 @@ class ApiSubscriptionsAction extends ApiBareAuthAction
|
||||
{
|
||||
parent::prepare($args);
|
||||
|
||||
$this->page = (int)$this->arg('page', 1);
|
||||
$this->tag = $this->arg('tag');
|
||||
|
||||
// Note: Twitter no longer supports 'lite'
|
||||
|
@ -46,14 +46,7 @@ require_once INSTALLDIR.'/lib/apibareauth.php';
|
||||
|
||||
class ApiTimelineFavoritesAction extends ApiBareAuthAction
|
||||
{
|
||||
|
||||
var $user = null;
|
||||
var $notices = null;
|
||||
var $page = null;
|
||||
var $count = null;
|
||||
var $max_id = null;
|
||||
var $since_id = null;
|
||||
var $since = null;
|
||||
|
||||
/**
|
||||
* Take arguments for running
|
||||
@ -68,12 +61,6 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
|
||||
{
|
||||
parent::prepare($args);
|
||||
|
||||
$this->page = (int)$this->arg('page', 1);
|
||||
$this->count = (int)$this->arg('count', 20);
|
||||
$this->max_id = (int)$this->arg('max_id', 0);
|
||||
$this->since_id = (int)$this->arg('since_id', 0);
|
||||
$this->since = $this->arg('since');
|
||||
|
||||
$this->user = $this->getTargetUser($this->arg('id'));
|
||||
|
||||
if (empty($this->user)) {
|
||||
|
@ -46,13 +46,7 @@ require_once INSTALLDIR.'/lib/apibareauth.php';
|
||||
|
||||
class ApiTimelineFriendsAction extends ApiBareAuthAction
|
||||
{
|
||||
|
||||
var $user = null;
|
||||
var $notices = null;
|
||||
var $count = null;
|
||||
var $max_id = null;
|
||||
var $since_id = null;
|
||||
var $since = null;
|
||||
|
||||
/**
|
||||
* Take arguments for running
|
||||
@ -67,12 +61,6 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
|
||||
{
|
||||
parent::prepare($args);
|
||||
|
||||
$this->page = (int)$this->arg('page', 1);
|
||||
$this->count = (int)$this->arg('count', 20);
|
||||
$this->max_id = (int)$this->arg('max_id', 0);
|
||||
$this->since_id = (int)$this->arg('since_id', 0);
|
||||
$this->since = $this->arg('since');
|
||||
|
||||
$this->user = $this->getTargetUser($this->arg('id'));
|
||||
|
||||
if (empty($this->user)) {
|
||||
|
@ -62,14 +62,7 @@ class ApiTimelineGroupAction extends ApiAction
|
||||
{
|
||||
parent::prepare($args);
|
||||
|
||||
$this->page = (int)$this->arg('page', 1);
|
||||
$this->count = (int)$this->arg('count', 20);
|
||||
$this->max_id = (int)$this->arg('max_id', 0);
|
||||
$this->since_id = (int)$this->arg('since_id', 0);
|
||||
$this->since = $this->arg('since');
|
||||
|
||||
$this->group = $this->getTargetGroup($this->arg('id'));
|
||||
|
||||
$this->notices = $this->getNotices();
|
||||
|
||||
return true;
|
||||
|
@ -62,12 +62,6 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
|
||||
{
|
||||
parent::prepare($args);
|
||||
|
||||
$this->page = (int)$this->arg('page', 1);
|
||||
$this->count = (int)$this->arg('count', 20);
|
||||
$this->max_id = (int)$this->arg('max_id', 0);
|
||||
$this->since_id = (int)$this->arg('since_id', 0);
|
||||
$this->since = $this->arg('since');
|
||||
|
||||
$this->user = $this->getTargetUser($this->arg('id'));
|
||||
|
||||
if (empty($this->user)) {
|
||||
|
@ -61,12 +61,6 @@ class ApiTimelinePublicAction extends ApiAction
|
||||
{
|
||||
parent::prepare($args);
|
||||
|
||||
$this->page = (int)$this->arg('page', 1);
|
||||
$this->count = (int)$this->arg('count', 20);
|
||||
$this->max_id = (int)$this->arg('max_id', 0);
|
||||
$this->since_id = (int)$this->arg('since_id', 0);
|
||||
$this->since = $this->arg('since');
|
||||
|
||||
$this->notices = $this->getNotices();
|
||||
|
||||
return true;
|
||||
|
@ -61,10 +61,7 @@ class ApiTimelineTagAction extends ApiAction
|
||||
{
|
||||
parent::prepare($args);
|
||||
|
||||
$this->page = (int)$this->arg('page', 1);
|
||||
$this->count = (int)$this->arg('count', 20);
|
||||
$this->tag = $this->arg('tag');
|
||||
|
||||
$this->notices = $this->getNotices();
|
||||
|
||||
return true;
|
||||
|
@ -64,12 +64,6 @@ class ApiTimelineUserAction extends ApiBareAuthAction
|
||||
{
|
||||
parent::prepare($args);
|
||||
|
||||
$this->page = (int)$this->arg('page', 1);
|
||||
$this->count = (int)$this->arg('count', 20);
|
||||
$this->max_id = (int)$this->arg('max_id', 0);
|
||||
$this->since_id = (int)$this->arg('since_id', 0);
|
||||
$this->since = $this->arg('since');
|
||||
|
||||
$this->user = $this->getTargetUser($this->arg('id'));
|
||||
|
||||
if (empty($this->user)) {
|
||||
|
13
lib/api.php
13
lib/api.php
@ -44,6 +44,12 @@ if (!defined('STATUSNET')) {
|
||||
class ApiAction extends Action
|
||||
{
|
||||
var $format = null;
|
||||
var $user = null;
|
||||
var $page = null;
|
||||
var $count = null;
|
||||
var $max_id = null;
|
||||
var $since_id = null;
|
||||
var $since = null;
|
||||
|
||||
/**
|
||||
* Initialization.
|
||||
@ -56,7 +62,14 @@ class ApiAction extends Action
|
||||
function prepare($args)
|
||||
{
|
||||
parent::prepare($args);
|
||||
|
||||
$this->format = $this->arg('format');
|
||||
$this->page = (int)$this->arg('page', 1);
|
||||
$this->count = (int)$this->arg('count', 20);
|
||||
$this->max_id = (int)$this->arg('max_id', 0);
|
||||
$this->since_id = (int)$this->arg('since_id', 0);
|
||||
$this->since = $this->arg('since');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user