function IAUTH_auth($appid, $uid, $rightStr, $state = '', $faile_t = '2036-12-31 23:59:59') { Check($appid, 'appid'); Check($uid, 'uid'); if (intval($uid) <= 0) { showError('use manage function instead'); } Check($faile_t, 'faile_t'); $rights = Check($rightStr, 'rights'); $appType = GetAppInfo($appid, 'app_type'); IAUTH_remove_auth($uid, $appid); if ($appType == 'WSC') { Check($state, 'state'); $callback = GetAppInfo($appid, 'call_back'); $verifier = newVerifier('auth', $appid, $uid, $rights, $faile_t, '', '', $state); accessLog('AUTH ' . $appid . ' ' . $uid . ' ' . $rightStr . ' ' . $faile_t . ' ' . $state); return URL($callback) . 'verifier=' . $verifier . '&state=' . $state; } if ($appType == 'UAC') { $verifier = newVerifier('auth', $appid, $uid, $rights, $faile_t); accessLog('AUTH ' . $appid . ' ' . $uid . ' ' . $rightStr . ' ' . $faile_t); return $verifier; } throw new IAuthException('db error'); }
$_SGLOBAL['db']->query("DELETE FROM " . tname('apps_users') . " WHERE appsid={$appsid} AND uid={$uid}"); //使用应用人数减一 $app['usernumber'] = $app_arr['usernumber'] = $app['usernumber'] - 1; updatetable('apps', $app_arr, array('id' => $appsid)); if ($app['category'] == 3) { //ini_set('display_errors',1); //第三方应用 if (!@(include_once S_ROOT . './plugin/iauth/IAuthManage.php')) { //echo 'notinclude'; exit(); header("Location:plugin.php?pluginid=apps&ac=detail&appsid={$appsid}"); exit; } if ($app['iauth_type'] == 'WSC' || $app['iauth_type'] == 'UAC') { //Web Site Client 登录 try { IAUTH_remove_auth($uid, $app['iauth_id']); } catch (IAuthException $e) { //echo $e->getMessage(); } } } echo "plugin.php?pluginid=apps&ac=detail&appsid={$appsid}"; exit; } // autoAuth $autoAuth = autoAuth($app['iauth_id']); //是否已经授权该应用 $isAuthorized = FALSE; $hasShortcut = 0; $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('apps_users') . " WHERE uid={$uid} AND appsid={$appsid}"); if ($value = $_SGLOBAL['db']->fetch_array($query)) {