function run() { // echo date('h:i:s A')." - just entered run<br>"; //echo microtime()."Main:run just entered run() <br>"; //$output_function = "output_template"; //$mss = new Main_SecuritySystem(); //if (!$mss->passed_security_check($this->xml_string) && $_REQUEST['target_function'][0] != "register_user") //handles login page post if (false) //won't be using this for now { $output_function = $mss->output_function; } //if (SecurityOperationsFacade::passed_security_check($this->xml_string, $this->xslt_file)) else { if (!isset($_REQUEST['target_component'])) { if (isset($_REQUEST['ntctf'])) { $this->setup_for_no_server_side_content(); } else if (isset($_REQUEST['pl'])) { $this->set_product_lookup_page(); } else { $this->set_default_site_page(); } } //echo microtime()."Main:run before new RequestProcessor() <br>"; $rp = new RequestProcessor(); //echo microtime()."Main:run after new RequestProcessor() <br>"; $output_function = $rp->process_request($this->xml_string, $this->xslt_file); //echo microtime()."Main:run after RequestProcessor::process_request <br>"; } //echo microtime()."Main:run before user_authorized_output_function_check <br>"; // echo date('h:i:s A')." - just got output function<br>"; /*if (!$mss->user_authorized_output_function_check($output_function)) { die ("Unauthorized Access Attempt!"); }*/ $oof = new ssc_OutputOperationsFacade; //echo microtime()."Main:run before output_function <br>"; if ($_REQUEST['OF_passthru']) { $oof->output_function_passthru($this->xml_string, $_REQUEST['OF_passthru']); //echo "<br>output function:".$_REQUEST['OF_passthru']; } else { $oof->$output_function($this->xml_string, $this->xslt_file); } //echo microtime()."Main:run after output_function <br>"; //echo date('h:i:s A')." - just exec'd output function<br>"; }
function processClient346543sdrgv24($thread, $socket, $rootDir, $serverName, $listeningPort) { socket_getpeername($socket, $address, $port); $lines = array(); $line = ""; while(true) { $line .= socket_read($socket, 3096, PHP_NORMAL_READ); if(endsWith($line, "\r")) continue; if(trim($line) === "") break; $lines[] = $line; $line = ""; } //print_r($lines); $out = implode("\n", $lines); RequestProcessor::process($address, $port, $socket, $out, $rootDir, $serverName, $listeningPort); socket_shutdown($socket); socket_close($socket); }
RequestProcessor::Authenticate(); } // Do the actual processing of the request if (Request::IsMethodGET()) { throw new NoPostRequestException("This is the Z-Push location and can only be accessed by Microsoft ActiveSync-capable devices", NoPostRequestException::GET_REQUEST); } // Do the actual request header(ZPush::GetServerHeader()); // announce the supported AS versions (if not already sent to device) if (ZPush::GetDeviceManager()->AnnounceASVersion()) { $versions = ZPush::GetSupportedProtocolVersions(true); ZLog::Write(LOGLEVEL_INFO, sprintf("Announcing latest AS version to device: %s", $versions)); header("X-MS-RP: " . $versions); } RequestProcessor::Initialize(); if (!RequestProcessor::HandleRequest()) { throw new WBXMLException(ZLog::GetWBXMLDebugInfo()); } // stream the data $len = ob_get_length(); $data = ob_get_contents(); ob_end_clean(); // log amount of data transferred // TODO check $len when streaming more data (e.g. Attachments), as the data will be send chunked ZPush::GetDeviceManager()->SentData($len); // Unfortunately, even though Z-Push can stream the data to the client // with a chunked encoding, using chunked encoding breaks the progress bar // on the PDA. So the data is de-chunk here, written a content-length header and // data send as a 'normal' packet. If the output packet exceeds 1MB (see ob_start) // then it will be sent as a chunked packet anyway because PHP will have to flush // the buffer.
/** * Returns the filename logs for a WBXML debug log user should be saved to * * @access private * @return string */ private static function logToUserFile() { global $specialLogUsers; if (self::$authUser === false) { if (RequestProcessor::isUserAuthenticated()) { $authuser = Request::GetAuthUser(); if ($authuser && in_array($authuser, $specialLogUsers)) { self::$authUser = preg_replace('/[^a-z0-9]/', '_', strtolower($authuser)); } } } return self::$authUser; }
/** * @param int $loglevel * @param string $message */ public function Log($loglevel, $message) { if ($loglevel <= LOGLEVEL) { $this->Write($loglevel, $message); } if ($loglevel <= LOGUSERLEVEL && $this->IsAuthUserInSpecialLogUsers()) { if (RequestProcessor::isUserAuthenticated()) { // something was logged before the user was authenticated, write this to the log if (!empty($this->unauthMessageCache)) { foreach ($this->unauthMessageCache as $authcache) { $this->WriteForUser($authcache[0], $authcache[1]); } $this->unauthMessageCache = array(); } $this->WriteForUser($loglevel, $message); } else { $this->unauthMessageCache[] = array($loglevel, $message); } } $this->afterLog($loglevel, $message); }
public function __construct() { parent::__construct(); }
/** * Initialize the RequestProcessor * * @access public * @return */ public static function Initialize() { self::$backend = ZPush::GetBackend(); self::$deviceManager = ZPush::GetDeviceManager(); self::$topCollector = ZPush::GetTopCollector(); if (!ZPush::CommandNeedsPlainInput(Request::GetCommandCode())) { self::$decoder = new WBXMLDecoder(Request::GetInputStream()); } self::$encoder = new WBXMLEncoder(Request::GetOutputStream(), Request::GetGETAcceptMultipart()); }
/** * Called at the end of the request * Statistics about received/sent data is saved here * * @access public * @return boolean */ public function Save() { // TODO save other stuff // check if previousily ignored messages were synchronized for the current folder // on multifolder operations of AS14 this is done by setLatestFolder() if ($this->latestFolder !== false) { $this->checkBrokenMessages($this->latestFolder); } // update the user agent and AS version on the device $this->device->SetUserAgent(Request::GetUserAgent()); $this->device->SetASVersion(Request::GetProtocolVersion()); // data to be saved $data = $this->device->GetData(); if ($data && Request::IsValidDeviceID()) { ZLog::Write(LOGLEVEL_DEBUG, "DeviceManager->Save(): Device data changed"); try { // check if this is the first time the device data is saved and it is authenticated. If so, link the user to the device id if ($this->device->IsNewDevice() && RequestProcessor::isUserAuthenticated()) { ZLog::Write(LOGLEVEL_INFO, sprintf("Linking device ID '%s' to user '%s'", $this->devid, $this->device->GetDeviceUser())); $this->statemachine->LinkUserDevice($this->device->GetDeviceUser(), $this->devid); } if (RequestProcessor::isUserAuthenticated() || $this->device->GetForceSave()) { $this->statemachine->SetState($data, $this->devid, IStateMachine::DEVICEDATA); ZLog::Write(LOGLEVEL_DEBUG, "DeviceManager->Save(): Device data saved"); } } catch (StateNotFoundException $snfex) { ZLog::Write(LOGLEVEL_ERROR, "DeviceManager->Save(): Exception: " . $snfex->getMessage()); } } // remove old search data $oldpid = $this->loopdetection->ProcessLoopDetectionGetOutdatedSearchPID(); if ($oldpid) { ZPush::GetBackend()->GetSearchProvider()->TerminateSearch($oldpid); } // we terminated this process if ($this->loopdetection) { $this->loopdetection->ProcessLoopDetectionTerminate(); } return true; }
throw new NoPostRequestException("This is the Z-Push location and can only be accessed by Microsoft ActiveSync-capable devices", NoPostRequestException::GET_REQUEST); } // Do the actual request header(ZPush::GetServerHeader()); // announce the supported AS versions (if not already sent to device) if (ZPush::GetDeviceManager()->AnnounceASVersion()) { $versions = ZPush::GetSupportedProtocolVersions(true); ZLog::Write(LOGLEVEL_INFO, sprintf("Announcing latest AS version to device: %s", $versions)); header("X-MS-RP: " . $versions); } RequestProcessor::Initialize(); if (!RequestProcessor::HandleRequest()) { throw new WBXMLException(ZLog::GetWBXMLDebugInfo()); } // eventually the RequestProcessor wants to send other headers to the mobile foreach (RequestProcessor::GetSpecialHeaders() as $header) { header($header); } // stream the data $len = ob_get_length(); $data = ob_get_contents(); ob_end_clean(); // log amount of data transferred // TODO check $len when streaming more data (e.g. Attachments), as the data will be send chunked ZPush::GetDeviceManager()->SentData($len); // Unfortunately, even though Z-Push can stream the data to the client // with a chunked encoding, using chunked encoding breaks the progress bar // on the PDA. So the data is de-chunk here, written a content-length header and // data send as a 'normal' packet. If the output packet exceeds 1MB (see ob_start) // then it will be sent as a chunked packet anyway because PHP will have to flush // the buffer.
<?php /* * Include all the files */ foreach (glob("lib/ArchiWikiConvertor/Interface/*.php") as $filename) { include $filename; } foreach (glob("lib/ArchiWikiConvertor/*.php") as $filename) { include $filename; } foreach (glob("lib/*.php") as $filename) { include $filename; } $c = new Convertor(); $c->connect('localhost', 'archiwiki', 'archi-dev', 'archi_v2'); $typeConversion = $_POST['typeConversion']; echo "<div><h2>{$typeConversion}</h2></div>"; //Using a strategy pattern $config = new ConfigOD('archi_u_preprod', 'archi_pwd_preprod', 'archi_dbname_preprod', 'localhost'); $rp = new RequestProcessor(NULL, $config); $rp->executeStrategy($typeConversion); /* $array =$c->processRequest('select * from historiqueAdresse'); $c->arrayToXML($array); */ ?> <p> <a href="index.php">back to index</a> </p>
function run() { // echo date('h:i:s A')." - just entered run<br>"; //echo microtime()."Main:run just entered run() <br>"; //$output_function = "output_template"; //echo "<br>Main, searcresrowcount".$_SESSION['search_res_row_cnt']; if ($_REQUEST['er']) { $un_encrypted_request = myedb_decrypt($_REQUEST['er']); if (!strstr($un_encrypted_request,"check_activation_password")) die ("error: bad link"); eval($un_encrypted_request); //echo $_REQUEST['id']." -yooo- ".$_REQUEST['activate']; } $mss = new Main_SecuritySystem(); $bypass_auth = in_array($_REQUEST['target_function'][0],$this->non_auth_target_functions) || in_array($_REQUEST['OF_passthru'],$this->non_auth_output_functions); if (!$mss->passed_security_check($this->xml_string) && !$bypass_auth) {//echo "didn't pass"; $output_function = $mss->output_function; } //if (SecurityOperationsFacade::passed_security_check($this->xml_string, $this->xslt_file)) else {// echo "did pass"; if (!isset($_REQUEST['target_component'])) { if (isset($_REQUEST['ntctf'])) { $this->setup_for_no_server_side_content(); } else if (isset($_REQUEST['pl'])) { $this->set_product_lookup_page(); } else { $this->set_default_site_page(); } } //echo microtime()."Main:run before new RequestProcessor() <br>"; flush(); $rp = new RequestProcessor(); //echo microtime()."Main:run after new RequestProcessor() <br>"; flush(); $output_function = $rp->process_request($this->xml_string, $this->xslt_file); //echo microtime()."Main:run after RequestProcessor::process_request <br>"; flush(); } //echo microtime()."Main:run before user_authorized_output_function_check <br>"; // echo date('h:i:s A')." - just got output function<br>"; if (!$mss->user_authorized_output_function_check($output_function)) { $cur_user_eid = Main_SecuritySystem::get_user_eid(); $subject = "unauthorized access attempt"; $message = "user with eid ".$cur_user_eid." attempted to access ".$output_function; NotificationSys::email_developer($subject,$message); die ("Unauthorized Access Attempt!"); } $oof = new OutputOperationsFacade; //echo microtime()."Main:run before output_function <br>"; if ($_REQUEST['OF_passthru'] && ($mss->authenticated || $bypass_auth)) { $oof->output_function_passthru($this->xml_string, $_REQUEST['OF_passthru']); //echo "<br>output function:".$_REQUEST['OF_passthru']; } else { $oof->$output_function($this->xml_string, $this->xslt_file); } //echo microtime()."Main:run after output_function <br>"; //echo date('h:i:s A')." - just exec'd output function<br>"; }
<?php foreach (glob("lib/ArchiWikiConvertor/Interface/*.php") as $filename) { var_dump(__DIR__); var_dump($filename); include __DIR__ . DIRECTORY_SEPARATOR . $filename; } foreach (glob("lib/ArchiWikiConvertor/*.php") as $filename) { var_dump(__DIR__); var_dump($filename); include __DIR__ . DIRECTORY_SEPARATOR . $filename; } foreach (glob("lib/*.php") as $filename) { var_dump(__DIR__); var_dump($filename); include __DIR__ . DIRECTORY_SEPARATOR . $filename; } ini_set('memory_limit', '-1'); set_time_limit(0); $config = new ConfigOD('archi_u_preprod', 'archi_pwd_preprod', 'archi_dbname_preprod', 'localhost'); $rp = new RequestProcessor(NULL, $config); $rp->executeAllStrategies(); ini_set('memory_limit', '128M'); set_time_limit(30);