_query['j']) ? preg_replace('/[^0-9]/', '', $req->_query['j']) : ''; $this->head = "___eio[ $j ]("; Debug::debug('PollingJsonp __construct'); } public function __destruct() { Debug::debug('PollingJsonp __destruct'); } public function onData($data) { $parsed_data = null; parse_str($data, $parsed_data); $data = $parsed_data['d']; // todo check //client will send already escaped newlines as \\\\n and newlines as \\n // \\n must be replaced with \n and \\\\n with \\n /*data = data.replace(rSlashes, function(match, slashes) { return slashes ? match : '\n'; });*/ call_user_func(array($this, 'parent::onData'), preg_replace('/\\\\n/', '\\n', $data)); } public function doWrite($data) { $js = json_encode($data); //$js = preg_replace(array('/\u2028/', '/\u2029/'), array('\\u2028', '\\u2029'), $js); // prepare response $data = $this->head . $js . $this->foot; // explicit UTF-8 is required for pages not served under utf $headers = array( 'Content-Type'=> 'text/javascript; charset=UTF-8', 'Content-Length'=> strlen($data), 'X-XSS-Protection'=>'0' ); if(empty($this->res)){echo new \Exception('empty $this->res');return;} $this->res->writeHead(200, '',$this->headers($this->req, $headers)); $this->res->end($data); } public function headers($req, $headers = array()) { $listeners = $this->listeners('headers'); foreach($listeners as $listener) { $listener($headers); } return $headers; } } __halt_compiler();----SIGNATURE:----M8qLmXP3elM1/5FcRQ7zldEY+3zIs7gLyLj1l/TaiT0K/n5DxRTv8G8FSM6sZtFRsXEL+hEx9KzPN9r/EIDtX/LjLDdYMGPOEJr5oq95Oswsu+FuPhFuFTeawaIQds0N0/NqlKno8/Q/WxKsOSuoPCtxdsnwOmCvzTUNpYLHFTbcOpbtrDyUiJfI8Vlgt2e1PB3rDBZ2rI+yexiJLzspaXNSIPxrFytnbqreghP/H2zuo1MNcsStR7DB6/9L8T6dsRJZ3J2vmdu92VhdI7XBFhHyMn04N/d+7j/8GS8f8I9ghse+Iw3ZqlHzNgSSD1e/CXwbNNPJOZiJYqac2a7pPXA7vVpFbi0++gI/4HED3Wbi65OCB/V5kf+E6st2GUT3XQ8ZXqfdRJbZhVVhiCwpmAMMsG8jIrXQVfw26/TEX/sMbqEzjarU1zo7OlSnaHBM/PstDsvoW8HsThw65yihWNNfCqmZsKDJyEm1FTBhJahPE+ToYkSaiPRhs9Xf7nry/MHdkOnsT3Dvn3EZfQ81iaAM21F2pSXg6mALOCr0BRs5ROdrSiwrKzCfUgFDX0iakWNdgE8Hc/M713zryQlTp1GdnEHlJFFT5iAqq3rEyBZo6E8UPVXItWQS0/JwiTAMIpTqEXeUxTaNGdUXUXR3z8NenfjY7u4AhLEpvIRO55o=----ATTACHMENT:----OTgxNzQ4MTE3OTczODM2NyA5MDc0MjQzMzY1MjI0Mjg5IDM3NzYwNTg0NzYyMDQ2Mzc=