some more api work

This commit is contained in:
zotlabs 2016-10-12 15:31:14 -07:00
parent 4f7d14dfb2
commit fc7d29edd3
2 changed files with 10 additions and 10 deletions

View file

@ -17,13 +17,13 @@ class Api extends \Zotlabs\Web\Controller {
function get() { function get() {
if(\App::$cmd=='api/oauth/authorize'){ if(\App::$cmd === 'api/oauth/authorize'){
/* /*
* api/oauth/authorize interact with the user. return a standard page * api/oauth/authorize interact with the user. return a standard page
*/ */
\App::$page['template'] = "minimal"; \App::$page['template'] = 'minimal';
// get consumer/client from request token // get consumer/client from request token
try { try {
@ -42,8 +42,8 @@ class Api extends \Zotlabs\Web\Controller {
$consumer = new OAuth1Consumer($app['client_id'], $app['pw'], $app['redirect_uri']); $consumer = new OAuth1Consumer($app['client_id'], $app['pw'], $app['redirect_uri']);
$verifier = md5($app['secret'].local_channel()); $verifier = md5($app['secret'] . local_channel());
set_config("oauth", $verifier, local_channel()); set_config('oauth', $verifier, local_channel());
if($consumer->callback_url != null) { if($consumer->callback_url != null) {
@ -78,11 +78,11 @@ class Api extends \Zotlabs\Web\Controller {
$tpl = get_markup_template('oauth_authorize.tpl'); $tpl = get_markup_template('oauth_authorize.tpl');
$o = replace_macros($tpl, array( $o = replace_macros($tpl, array(
'$title' => t('Authorize application connection'), '$title' => t('Authorize application connection'),
'$app' => $app, '$app' => $app,
'$authorize' => t('Do you want to authorize this application to access your posts and contacts, and/or create new posts for you?'), '$authorize' => t('Do you want to authorize this application to access your posts and contacts, and/or create new posts for you?'),
'$yes' => t('Yes'), '$yes' => t('Yes'),
'$no' => t('No'), '$no' => t('No'),
)); ));
//echo "<pre>"; var_dump($app); killme(); //echo "<pre>"; var_dump($app); killme();

View file

@ -229,7 +229,7 @@ require_once('include/api_zot.php');
$r = q("SELECT COUNT(id) as total FROM item $r = q("SELECT COUNT(id) as total FROM item
WHERE uid = %d WHERE uid = %d
AND item_wall = 1 $item_normal AND item_wall = 1 $item_normal
AND allow_cid='' AND allow_gid='' AND deny_cid='' AND deny_gid='' AND allow_cid = '' AND allow_gid = '' AND deny_cid = '' AND deny_gid = ''
AND item_private = 0 ", AND item_private = 0 ",
intval($usr[0]['channel_id']) intval($usr[0]['channel_id'])
); );
@ -241,7 +241,7 @@ require_once('include/api_zot.php');
else { else {
$r = q("SELECT COUNT(id) as total FROM item $r = q("SELECT COUNT(id) as total FROM item
WHERE author_xchan = '%s' WHERE author_xchan = '%s'
AND allow_cid='' AND allow_gid='' AND deny_cid='' AND deny_gid='' AND allow_cid = '' AND allow_gid = '' AND deny_cid = '' AND deny_gid = ''
AND item_private = 0 ", AND item_private = 0 ",
intval($uinfo[0]['xchan_hash']) intval($uinfo[0]['xchan_hash'])
); );