diff options
author | redmatrix <redmatrix@redmatrix.me> | 2015-11-11 18:08:03 +1100 |
---|---|---|
committer | redmatrix <redmatrix@redmatrix.me> | 2015-11-11 18:08:03 +1100 |
commit | f1492945ecacc545f7286698cc4b7e1d19e6dbb7 (patch) | |
tree | ce34635c4ec2702b2ed20ac063d2a82d42932645 /include/api.php | |
parent | d68357340232502cbf365187cc260565e327e33e (diff) | |
parent | 741afeea4140acf7ae66dfca43738a4b2fe97db6 (diff) | |
download | volse-hubzilla-f1492945ecacc545f7286698cc4b7e1d19e6dbb7.tar.gz volse-hubzilla-f1492945ecacc545f7286698cc4b7e1d19e6dbb7.tar.bz2 volse-hubzilla-f1492945ecacc545f7286698cc4b7e1d19e6dbb7.zip |
Merge pull request #140 from kenrestivo/move-export-to-plugin
Moving this out into a plugin; hopefully one that will work with RM
Diffstat (limited to 'include/api.php')
-rw-r--r-- | include/api.php | 89 |
1 files changed, 0 insertions, 89 deletions
diff --git a/include/api.php b/include/api.php index c8ba65992..24176884c 100644 --- a/include/api.php +++ b/include/api.php @@ -2327,95 +2327,6 @@ logger('Req: ' . var_export($req,true)); api_register_func('api/oauth/access_token', 'api_oauth_access_token', false); - -function api_export_users(&$a,$type) { - - if (! is_site_admin()){ - header('HTTP/1.0 401 Unauthorized'); - die('Only admin accounts may use this endpoint.'); - } - - $r = q("SELECT * FROM account"); - - // TODO: paginating! - - $ret = array(); - foreach($r as $u){ - $ret[] = $u; - } - - json_return_and_die(array('status' => 'OK', - 'users' => $u)); -} -api_register_func('api/export/users','api_export_users', true); - - - -function api_export_channel_hashes(&$a, $type) { - - if (! is_site_admin()){ - header('HTTP/1.0 401 Unauthorized'); - die('Only admin accounts may use this endpoint.'); - } - - if( $_REQUEST['account_id'] == ''){ - header('HTTP/1.0 422 Unprocessable Entity'); - die('Must supply account_id parameter.'); - - } - - $c = q("select * from channel where channel_account_id = '%d'", - intval($_REQUEST['account_id'])); - - if(! $c){ - header('HTTP/1.0 404 Not Found'); - die('No such account_id '. $_REQUEST['account_id']); - - } - - $ret = array(); - foreach ($c as $r){ - $ret[] = $r['channel_hash']; - } - json_return_and_die(array('status' => 'OK', - 'channel_hashes' => $ret)); -} -api_register_func('api/export/channels','api_export_channel_hashes', true); - - - - -function api_export_identity(&$a, $type) { - - if (! is_site_admin()){ - header('HTTP/1.0 401 Unauthorized'); - die('Only admin accounts may use this endpoint.'); - } - - if( $_REQUEST['channel_hash'] == ''){ - header('HTTP/1.0 422 Unprocessable Entity'); - die('Must supply channel_hash parameter.'); - - } - - require_once('include/identity.php'); - - $c = q("select channel_id from channel where channel_hash = '%s' LIMIT 1", - dbesc($_REQUEST['channel_hash'])); - - if(! $c){ - header('HTTP/1.0 404 Not Found'); - die('No such channel '. $_REQUEST['channel_hash']); - - } - json_return_and_die( - identity_basic_export($c[0]['channel_id'], - (($_REQUEST['posts']) ? intval($_REQUEST['posts']) : 0 ))); -} -api_register_func('api/export/identity','api_export_identity', true); - - - /* Not implemented by now: statuses/retweets_of_me |