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"; foreach ($config as $key => $value) { $configfile .= "define('{$key}', '{$value}');\r\n"; } $configfile .= "?>"; $file = DISCUZ_ROOT . "./data/dzapp_haodai_config.php";