$lang = array_merge($lang, $scriptlang['dzapp_haodai']); if (!$_GET['want']) { showtableheader($lang['callback_info'] . ' <a href="admin.php?action=plugins&operation=config&identifier=dzapp_haodai&pmod=admincp_callback&want=import">[' . $lang['click_to_import'] . ']</a>'); showtablerow('', array('class="td24"'), array($lang['appkey'], HD_AKEY)); showtablerow('', array('class="td24"'), array($lang['appsecret'], HD_SKEY)); showtablerow('', array('class="td24"'), array($lang['ref'], HD_REF)); showtablerow('', array('class="td24"'), array($lang['callback_url'], HD_CALLBACK_URL)); showtablerow('', array('class="td24"'), array($lang['host_url'], HD_API_HOST)); if (!isset($hd_token)) { $oauth = new HaoDaiOAuth(HD_AKEY, HD_SKEY); $auth_url = $oauth->getAuthorizeURL(HD_CALLBACK_URL); showtablerow('', array('class="td24"'), array($lang['callback_status'], '<font color="red">' . $lang['callback_expired'] . '</font> <a href="' . $auth_url . '"><img src="source/plugin/dzapp_haodai/images/haodai_login.png" class="vmiddle"></a>')); } else { if (isset($hd_token['expires']) && TIMESTAMP > $hd_token['expires'] - 3600) { $client = new HaoDaiClient(HD_AKEY, HD_SKEY); $client->set_debug(0); $result = $client->haodai_check_AccessToken(); if ($result['rs_code'] != '1000') { if ($result['rs_code'] == '2100') { $new_hd_token = $client->oauth->getAccessToken('token', $hd_token); require_once libfile('function/cache'); writetocache('dzapp_haodai_setting', getcachevars(array('hd_token' => $new_hd_token))); showtablerow('', array('class="td24"'), array($lang['callback_status'], '<font color="green">' . $lang['valid'] . '</font>')); } else { $auth_url = $client->oauth->getAuthorizeURL(HD_CALLBACK_URL); showtablerow('', array('class="td24"'), array($lang['callback_status'], '<font color="red">' . $lang['callback_expired'] . '</font> <a href="' . $auth_url . '"><img src="source/plugin/dzapp_haodai/images/haodai_login.png" class="vmiddle"></a>')); } } else { showtablerow('', array('class="td24"'), array($lang['callback_status'], '<font color="green">' . $lang['valid'] . '</font>')); } } elseif (isset($hd_token['expires']) && TIMESTAMP < $hd_token['expires'] - 3600) {