diff options
author | redmatrix <redmatrix@redmatrix.me> | 2015-05-27 19:27:38 -0700 |
---|---|---|
committer | redmatrix <redmatrix@redmatrix.me> | 2015-05-27 19:27:38 -0700 |
commit | b381ec57346a6d7724b2317c120ce2e6e70edc37 (patch) | |
tree | e2cf66e01a87e438241e5bfac5daf6e7d3046b71 /include/api.php | |
parent | 675aa96f222877a5aa543b8409a2c580cf10d3aa (diff) | |
parent | 11301d51a58d04843ba3056b4c9e92d59ced1334 (diff) | |
download | volse-hubzilla-b381ec57346a6d7724b2317c120ce2e6e70edc37.tar.gz volse-hubzilla-b381ec57346a6d7724b2317c120ce2e6e70edc37.tar.bz2 volse-hubzilla-b381ec57346a6d7724b2317c120ce2e6e70edc37.zip |
Merge branch 'master' of https://github.com/redmatrix/redmatrix
Conflicts:
mod/impel.php
Diffstat (limited to 'include/api.php')
-rw-r--r-- | include/api.php | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/include/api.php b/include/api.php index e94266762..e4c4b5240 100644 --- a/include/api.php +++ b/include/api.php @@ -433,6 +433,38 @@ require_once('include/items.php'); } + function api_client_register(&$a,$type) { + + $ret = array(); + $key = random_string(16); + $secret = random_string(16); + $name = trim(escape_tags($_REQUEST['application_name'])); + if(! $name) + json_return_and_die($ret); + if(is_array($_REQUEST['redirect_uris'])) + $redirect = trim($_REQUEST['redirect_uris'][0]); + else + $redirect = trim($_REQUEST['redirect_uris']); + $icon = trim($_REQUEST['logo_uri']); + $r = q("INSERT INTO clients (client_id, pw, name, redirect_uri, icon, uid) + VALUES ('%s','%s','%s','%s','%s',%d)", + dbesc($key), + dbesc($secret), + dbesc($name), + dbesc($redirect), + dbesc($icon), + intval(0) + ); + + $ret['client_id'] = $key; + $ret['client_secret'] = $secret; + $ret['expires_at'] = 0; + json_return_and_die($ret); + } + + api_register_func('api/client/register','api_client_register', false); + + function api_item_get_user(&$a, $item) { global $usercache; |