public function actionUc($code) { //$this->enableCsrfValidation = false; $get = $post = []; defined('MAGIC_QUOTES_GPC') || define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc()); parse_str(_authcode($code, 'DECODE', $this->module->uc_key), $get); //var_dump($get['time']);exit; Yii::trace($get); if (MAGIC_QUOTES_GPC) { $get = _stripslashes($get); } $timestamp = time(); /*if($timestamp - $get['time'] > 3600) { exit('Authracation has expiried'); }*/ if (empty($get)) { exit('Invalid Request'); } $postStr = Yii::$app->request->rawBody; /*if (get_magic_quotes_runtime()) { $postStr = stripslashes($postStr); }*/ $post = Xml::xml_unserialize($postStr); Yii::trace($post); if (empty($get['action'])) { return 1; } if (in_array($get['action'], array('test', 'deleteuser', 'renameuser', 'gettag', 'synlogin', 'synlogout', 'updatepw', 'updatebadwords', 'updatehosts', 'updateapps', 'updateclient', 'updatecredit', 'getcreditsettings', 'updatecreditsettings'))) { $ucReceiver = new UcReceiver(['get' => $get, 'post' => $post]); return $ucReceiver->response(); } return UcReceiver::API_RETURN_FAILED; }
/** * 此接口负责把应用程序的积分设置传递给 UCenter,以供 UCenter 在积分兑换设置中使用。 * 此接口无输入参数。输出的数组需经过 uc_serialize 处理。 * 输出的数组单条结构: [ '1' => ['威望', ''], '2' => ['金钱', '枚'], ] * @return string */ function getcreditsettings() { if (!self::API_GET_CREDIT_SETTINGS) { return self::API_RETURN_FORBIDDEN; } return Xml::xml_serialize([1 => ['积分', '']]); $credits = array(); foreach ($_G['setting']['extcredits'] as $id => $extcredits) { $credits[$id] = array(strip_tags($extcredits['title']), $extcredits['unit']); } return $this->_serialize($credits); }