3600) { exit('Authracation has expiried'); } if(empty($get)) { exit('Invalid Request'); } $action = $get['action']; $post = uc_unserialize(file_get_contents('php://input')); if(in_array($get['action'], array('test', 'synlogin', 'synlogout', 'updatehosts', 'updateapps', 'updateclient'))) { $uc_note = new uc_note(); exit($uc_note->$get['action']($get, $post)); } else { exit(API_RETURN_FAILED); } } else { exit(API_RETURN_FAILED); } class uc_note { var $db = ''; function uc_note() { $this->db = $GLOBALS['db']; } function test($get, $post) { return API_RETURN_SUCCEED; } function synlogin($get, $post) { $uid = $get['uid']; $username = $get['username']; if(!API_SYNLOGIN) { return API_RETURN_FORBIDDEN; } header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"'); // _setcookie('Example_auth', _authcode($uid."\t".$username, 'ENCODE')); } function synlogout($get, $post) { if(!API_SYNLOGOUT) { return API_RETURN_FORBIDDEN; } //note 同步登出 API 接口 header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"'); // _setcookie('Example_auth', '', -86400 * 365); } function updatehosts($get, $post) { if(!API_UPDATEHOSTS) { return API_RETURN_FORBIDDEN; } $cachefile = ROOT_PATH.'plugins/uc_client/data/cache/hosts.php'; $fp = fopen($cachefile, 'w'); $s = "' ? substr($configfile, 0, -2) : $configfile; $configfile = preg_replace("/define\('UC_API',\s*'.*?'\);/i", "define('UC_API', '$UC_API');", $configfile); if($fp = @fopen(ROOT_PATH.'plugins/uc_client/config.inc.php', 'w')) { @fwrite($fp, trim($configfile)); @fclose($fp); } } return API_RETURN_SUCCEED; } function updateclient($get, $post) { if(!API_UPDATECLIENT) { return API_RETURN_FORBIDDEN; } $cachefile = ROOT_PATH.'plugins/uc_client/data/cache/settings.php'; $fp = fopen($cachefile, 'w'); $s = "