public function run($URL,$host=''){
		if(ROUTER_DEBUG){
			BLog::addToLog('[Router]: Router started! URL='.$URL.'; host='.$host);
			}
		$this->init();
		//bimport('ip.ban');
		//$r=BIpBan::check();
		//if($r===false){
		//	header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden');
		//	return $this->errorpage('ipban');
		//	}
		$this->url=$URL;
		$this->host=$host;

		$r=$this->parseurl($URL,$host);

		if(ROUTER_DEBUG){
			if($r){
				BLog::addToLog('[Router]: Rules successfully parsed.');
				}else{
				BLog::addToLog('[Router]: Error of parsing rules!',LL_ERROR);
				}
			}
		if($r===false){
			header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found');
			header('Content-type: text/html; charset=utf-8');
			return $this->errorpage('404');
			}
		if(ROUTER_DEBUG){
			BLog::addToLog('[Router]: rules:'.var_export($this->rules,true));
			}
		$this->render_positions();
		switch($this->ctype){
			case CTYPE_HTML:
				$this->generatepage_html();
				break;
			case CTYPE_PLAINHTML:
				$this->generatepage_plainhtml();
				break;
			case CTYPE_JSON:
				$this->generatepage_json();
				break;
			case CTYPE_XML:
				$this->generatepage_xml();
				break;
			case CTYPE_DOCX:
				$this->generatepage_docx();
				break;
			case CTYPE_CSV:
				$this->generatepage_csv();
				break;
			case CTYPE_PDF:
				$this->generatepage_pdf();
				break;
			case CTYPE_REDIRECT301:
				$this->redirect301($this->redirectURL);
				break;
			case CTYPE_REDIRECT302:
				$this->redirect302($this->redirectURL);
				break;
			default:
				echo('Unknown content type!');
				break;
			}
		}