function FrameWork($var) { global $tbl_error_msg, $sys_config; $gm = "gm"; if ($sys_config["NeedAuth"]) { if (!Authenticate($var, $gm)) { PrintNotice("<p>You have none login.</p>"); return; } if (!CheckPrevilege($var)) { PrintNotice($tbl_error_msg["NoPriv"]); return; } } if (!HandleRequest($var, $gm)) { PrintNotice($tbl_error_msg["ActionFail"]); return; } return; }
header("WWW-Authenticate: Basic realm=\"ZPush\""); print "Access denied or user '{$user}' unknown."; return; } // Do the actual request switch ($_SERVER["REQUEST_METHOD"]) { case 'OPTIONS': header("MS-Server-ActiveSync: 6.5.7638.1"); header("MS-ASProtocolVersions: 1.0,2.0,2.1,2.5"); header("MS-ASProtocolCommands: Sync,SendMail,SmartForward,SmartReply,GetAttachment,GetHierarchy,CreateCollection,DeleteCollection,MoveCollection,FolderSync,FolderCreate,FolderDelete,FolderUpdate,MoveItems,GetItemEstimate,MeetingResponse,ResolveRecipipents,ValidateCert,Provision,Search,Ping"); break; case 'POST': header("MS-Server-ActiveSync: 6.5.7638.1"); debugLog("POST cmd: {$cmd}"); // Do the actual request if (!HandleRequest($backend, $cmd, $devid, $protocolversion)) { // Request failed. Try to output some kind of error information. We can only do this if // output had not started yet. If it has started already, we can't show the user the error, and // the device will give its own (useless) error message. if (!headers_sent()) { header("Content-type: text/html"); print "<BODY>\n"; print "<h3>Error</h3><p>\n"; print "There was a problem processing the <i>{$cmd}</i> command from your PDA.\n"; print "</BODY>\n"; } } break; case 'GET': header("Content-type: text/html"); ?>
// dw2412 changed to support AS14 Protocol // header("MS-Server-ActiveSync: 14.0"); header("MS-Server-ActiveSync: 14.1"); debugLog("POST cmd: {$cmd}"); // Update X-MS-RP In case version changed include_once 'statemachine.php'; $protstate = new StateMachine($devid, $user); $protsupp = $protstate->getProtocolState(); if ($protsupp !== false && $protsupp != "2.0,2.1,2.5,12.0,12.1,14.0,14.1") { header("X-MS-RP: 2.0,2.1,2.5,12.0,12.1,14.0,14.1"); debugLog("Sending X-MS-RP to update Protocol Version on Device"); $protstate->setProtocolState("2.0,2.1,2.5,12.0,12.1,14.0,14.1"); } unset($protstate); // Do the actual request if (!HandleRequest($backend, $cmd, $devid, $protocolversion, $multipart)) { // Request failed. Try to output some kind of error information. We can only do this if // output had not started yet. If it has started already, we can't show the user the error, and // the device will give its own (useless) error message. if (!headers_sent()) { header("Content-type: text/html"); print "<BODY>\n"; print "<h3>Error</h3><p>\n"; print "There was a problem processing the <i>{$cmd}</i> command from your PDA.\n"; print "<p>Here is the debug output:<p><pre>\n"; print getDebugInfo(); print "</pre>\n"; print "</BODY>\n"; } } break;