define('AT_INCLUDE_PATH', '../../../../include/'); require_once AT_INCLUDE_PATH . 'vitals.inc.php'; } require_once 'OAuthUtility.class.php'; require_once "OAuth.php"; global $msg, $_config; // check whether the transformable url is accessible if (!OAuthUtility::isAccessible(AT_TILE_OAUTH_REGISTER_CONSUMER_URL)) { $msg->addError(array('TILE_AUTHENTICATION_FAIL', _AT('tile_not_accessible'))); header('Location: ' . AT_BASE_HREF . 'mods/_core/imscp/index.php'); exit; } // check whether the last access token has expired. If not, return it, otherwise, get a new access token. // skip this step when this script is called by oauth server callback if (isset($_SESSION['member_id'])) { $access_token_key = OAuthUtility::getUnexpiredAccessToken(); } if ($access_token_key == '') { // initialize basic variables $sig_method = new OAuthSignatureMethod_HMAC_SHA1(); // use HMAC signature method as default if (!isset($_GET['oauth_token'])) { // 1. register consumer $sql = "SELECT * FROM %soauth_client_servers WHERE oauth_server='%s'"; $row = queryDB($sql, array(TABLE_PREFIX, $_config['transformable_uri']), TRUE); if (count($row) == 0) { $register_consumer_url = AT_TILE_OAUTH_REGISTER_CONSUMER_URL . '?consumer=' . urlencode(AT_BASE_HREF) . '&expire=' . $_config['transformable_oauth_expire']; $oauth_server_response = file_get_contents($register_consumer_url); // handle OAUTH response on register consumer foreach (explode('&', $oauth_server_response) as $rtn) { $rtn_pair = explode('=', $rtn);