Exemplo n.º 1
0
 * defined in the CPAL as a work which combines Covered Code or portions
 * thereof with code not governed by the terms of the CPAL.
 *******************************************************************************/
header("Content-Type: text/html; charset=utf-8");
include "./commonHeaders.php";
$sTimer->start('packetHandling');
function send_response($response)
{
    echo json_encode($response);
}
$request = json_decode((string) $_POST['request']);
$requestObj = new AjaxRequest($request);
$response = new Packet();
$handler = false;
$packetTable = array(CMSG_REPORT_ERROR => "CmsgReportError", CMSG_FOLLOW_QUESTION => "CmsgFollowQuestion", CMSG_UNFOLLOW_QUESTION => "CmsgUnfollowQuestion", CMSG_VOTE => "CmsgVote", CMSG_SELECT_FACTION => "CmsgSelectFaction");
if (@$packetTable[$requestObj->getString('opcode')]) {
    $handler = $packetTable[$requestObj->getString('opcode')];
}
if ($handler) {
    new $handler($requestObj, $response);
} else {
    die("INVALID_OPCODE");
}
$sTimer->stop('packetHandling');
$sTimer->start('serialization');
$sSession->serialize();
$sTimer->stop('serialization');
if ($sUser->group() >= USER_GROUP_ADMIN) {
    $debugData = new stdClass();
    $debugData->timeInit = $sTimer->getRuntimeByName('init');
    $debugData->timePackageHandling = $sTimer->getRuntimeByName('packetHandling');