@(include_once DISCUZ_ROOT . './data/sysdata/cache_dzapp_haodai_setting.php'); $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>')); }
if (!submitcheck('submit')) { showtips($installlang['hd_tip2']); showformheader("{$form_url}&step=install&modetype=2"); showtableheader($installlang['reg_header2']); showsetting($installlang['ref'], 'ref', '', 'text', '', '', $installlang['must_fill'] . $installlang['ref_summary']); showsubmit('submit', 'submit'); showtablefooter(); showformfooter(); } else { if (!$_GET['ref']) { cpmsg($installlang['not_fill'], '', 'error'); } define('HD_API_HOST', 'http://api.haodai.com/'); define('HD_REF', $_GET['ref']); include_once DISCUZ_ROOT . './source/plugin/dzapp_haodai/haodai.api.class.php'; $client = new HaoDaiClient('1000002', 'sLXuof1JgsqxssYSkJVXqci4MNHftaxB'); $client->set_debug(0); $config = array(); $config['HD_REF'] = $_GET['ref']; $data = array('app_name' => diconv($_G['setting']['sitename'] . ' ' . dgmdate($_G['timestamp'], 'Y-m-d-H:i'), CHARSET, 'UTF-8'), 'site_url' => $_G['siteurl'], 'desc' => diconv($_G['setting']['sitename'] . $installlang['hd_desc'], CHARSET, 'UTF-8'), 'callback_url' => $_G['siteurl'] . 'plugin.php?id=dzapp_haodai:callback'); $result = $client->haodai_app_register($data); if ($result['rs_code'] != '1000') { cpmsg($installlang['errmsg'] . "<br>" . diconv($result['rs_msg'], 'UTF-8', CHARSET), '', 'error'); } else { $config['HD_AKEY'] = $result['hd_akey']; $config['HD_SKEY'] = $result['hd_skey']; $config['HD_CALLBACK_URL'] = $result['hd_callback_url']; $config['HD_API_HOST'] = 'http://api.haodai.com/'; $config['HD_CITY'] = ''; $config = daddslashes($config); $configfile = "<?php \r\n";
$city = ''; break; } if (stripos($location, $value) !== FALSE) { $city = $key; break; } } if ($city) { dsetcookie('HD_CITY', $city); } else { $city = defined('HD_CITY') && HD_CITY !== '' ? HD_CITY : showmessage('dzapp_haodai:pleasechoosecity', 'admin.php?action=plugins&operation=config&identifier=dzapp_haodai&pmod=admincp_city'); dsetcookie('HD_CITY', HD_CITY); } } $client = new HaoDaiClient(HD_AKEY, HD_SKEY, $hd_token['access_token']); $client->set_debug(0); if (defined('IN_MOBILE')) { if (!@(include_once DISCUZ_ROOT . './data/sysdata/cache_dzapp_haodai_filter_mobile.php')) { $filter_raw = $filterm = $filtermn = array(); $rawtypes = array('gouche', 'goufang', 'qiye', 'xiaofei'); foreach ($rawtypes as $value) { $filter_raw[$value] = get_xindai_filter($value); foreach ($filter_raw[$value]['filter'] as $value1) { foreach ($value1['options'] as $value2) { $filterm[$value][$value1['key']][$value2['val']] = array('name' => $value2['name'], 'val' => $value2['val']); } $filtermn[$value][$value1['key']] = $value1['name']; } } unset($filter_raw);
<?php /** * DZAPP Haodai City Switcher * * @copyright (c) 2013-2014 DZAPP. (http://www.dzapp.cn) * @author BranchZero <*****@*****.**> */ !defined('IN_DISCUZ') && exit('Access Denied'); include_once DISCUZ_ROOT . './data/dzapp_haodai_config.php'; include_once DISCUZ_ROOT . './source/plugin/dzapp_haodai/haodai.api.class.php'; include_once DISCUZ_ROOT . './source/plugin/dzapp_haodai/dzapp_haodai.func.php'; @(include_once DISCUZ_ROOT . './data/sysdata/cache_dzapp_haodai_setting.php'); if (!@(include_once DISCUZ_ROOT . './data/sysdata/cache_dzapp_haodai_city.php' || TIMESTAMP - filemtime(DISCUZ_ROOT . './data/sysdata/cache_dzapp_haodai_city.php') > $var['refreshtime'])) { $client = new HaoDaiClient(HD_AKEY, HD_SKEY, $hd_token['access_token']); $client->set_debug(0); $result = $client->get_xindai_zones(); $zonelist = $result['items']; if (count($zonelist) > 0) { $zones = array(); foreach ($zonelist as $value) { if ($value['s_EN'] == 'www') { continue; } $value['zone_name'] = diconv($value['zone_name'], 'UTF-8', CHARSET); $value['Province'] = diconv($value['Province'], 'UTF-8', CHARSET); $value['area'] = diconv($value['area'], 'UTF-8', CHARSET); $zones[$value['s_EN']] = $value['zone_name']; $zonesort['provinces'][$value['Province']][$value['s_EN']] = $value['zone_name']; $zonesort['letter_raw'][$value['letter']][$value['s_EN']] = $value['zone_name']; $zonesort['area'][$value['area']][$value['s_EN']] = $value['zone_name'];