/** * GBK转UTF8 * $content array||string 需要转换的内容. * $is_stripslashes bol 是否启用uc_stripslashes方法 * $old_charset string 转之前字符集 * $new_charset string 转之后字符集 * $is_enforce bol 是否强制转换.如false则先判断本地字符集是否与uc相等 */ function hg_gbktoutf8($content, $is_stripslashes = false, $old_charset = 'gbk', $new_charset = 'utf-8', $is_enforce = false) { if (strcasecmp(UC_CHARSET, $old_charset) == 0 || $is_enforce) { if ($content && !is_array($content)) { $content = $is_stripslashes ? uc_stripslashes($content) : $content; $content = iconv($old_charset, $new_charset . "//IGNORE", $content); } elseif (is_array($content)) { foreach ($content as $k => $v) { $content[$k] = hg_utf8togbk($v, $is_stripslashes, $old_charset, $new_charset, $is_enforce); } } } return $content; }
function uc_api_post($module, $action, $arg = array()) { $s = $sep = ''; foreach ($arg as $k => $v) { if (is_array($v)) { $s2 = $sep2 = ''; foreach ($v as $k2 => $v2) { $s2 .= "{$sep2}{$k}[{$k2}]=" . urlencode(uc_stripslashes($v2)); $sep2 = '&'; } $s .= $sep . $s2; } else { $s .= "{$sep}{$k}=" . urlencode(uc_stripslashes($v)); } $sep = '&'; } $postdata = uc_api_requestdata($module, $action, $s); return uc_fopen2(UC_API . '/index.php', 500000, $postdata, '', TRUE, UC_IP, 20); }
public function index() { $get = $post = array(); $code = @$_GET['code']; parse_str(uc_authcode($code, 'DECODE', UC_KEY), $get); if (get_magic_quotes_gpc()) { $get = uc_stripslashes($get); } $timestamp = time(); if ($timestamp - $get['time'] > 3600) { exit('Authracation has expiried'); } if (empty($get)) { exit('Invalid Request'); } $action = $get['action']; include_once APP_PATH . 'uc_client/lib/xml.class.php'; $post = xml_unserialize(file_get_contents('php://input')); if (in_array($get['action'], array('test', 'deleteuser', 'renameuser', 'gettag', 'synlogin', 'synlogout', 'updatepw', 'updatebadwords', 'updatehosts', 'updateapps', 'updateclient', 'updatecredit', 'getcreditsettings', 'updatecreditsettings'))) { exit($this->{$get}['action']($get, $post)); } else { exit(API_RETURN_FAILED); } }