) ? '(?:.*?)' : ''; if ( preg_match_all('{^' . rawurlencode(urldecode($uri)) . $exact_match_pattern . '__LINK__(.*?)__END__}smi', $tmp, $regs) ) { $result = array_merge($result, $regs[1]); } if ( $this->ML_bot ) { print('' . var_export($regs, true) . ''); print('' . var_export(rawurlencode(urldecode($uri)), true) . ''); } } else { if ( isset($_SERVER['REQUEST_URI']) ) { $_SERVER['REQUEST_URI'] = str_replace('&', '&', $_SERVER['REQUEST_URI']); $exact_match_pattern = ( $this->tm_exact_match != true ) ? '(?:.*?)' : ''; if ( preg_match_all('{^' . rawurlencode(urldecode($_SERVER['REQUEST_URI'])) . $exact_match_pattern . '__LINK__(.*?)__END__}smi', $tmp, $regs) ) { $result = array_merge($result, $regs[1]); } if ( $this->ML_bot ) { print('' . var_export($regs, true) . ''); print('' . var_export(rawurlencode(urldecode($_SERVER['REQUEST_URI'])), true) . ''); } } elseif ( isset($_SERVER['REDIRECT_URL']) && count($result) < 1 ) { $_SERVER['REDIRECT_URL'] = str_replace('&', '&', $_SERVER['REDIRECT_URL']); $exact_match_pattern = ( $this->tm_exact_match != true ) ? '(?:.*?)' : ''; if ( preg_match_all('{^' . rawurlencode(urldecode($_SERVER['REDIRECT_URL'])) . $exact_match_pattern . '__LINK__(.*?)__END__}smi', $tmp, $regs) ) { $result = array_merge($result, $regs[1]); } if ( $this->ML_bot ) { print('' . var_export($regs, true) . ''); print('' . var_export(rawurlencode(urldecode($_SERVER['REDIRECT_URL'])), true) . ''); } } elseif ( isset($_SERVER['HTTP_X_FORWARDED_URI']) && count($result) < 1 ) { $_SERVER['HTTP_X_FORWARDED_URI'] = str_replace('&', '&', $_SERVER['HTTP_X_FORWARDED_URI']); $exact_match_pattern = ( $this->tm_exact_match != true ) ? '(?:.*?)' : ''; if ( preg_match_all('{^' . rawurlencode(urldecode($_SERVER['HTTP_X_FORWARDED_URI'])) . $exact_match_pattern . '__LINK__(.*?)__END__}smi', $tmp, $regs) ) { $result = array_merge($result, $regs[1]); } if ( $this->ML_bot ) { print('' . var_export($regs, true) . ''); print('' . var_export(rawurlencode(urldecode($_SERVER['HTTP_X_FORWARDED_URI'])), true) . ''); } } } // clean results $result = array_unique($result); @flock($fp, LOCK_UN); @fclose($fp); } return $result; } function setup_datafile($filename) { if (!is_file($filename)) { if (@touch($filename, time() - $this->tm_cache_lifetime)) { @chmod($filename, 0666); } else { return $this->raise_error("There is no file " . $filename . ". Failed to create. Set mode to 777 on the folder."); } } if (!is_writable($filename)) { return $this->raise_error("There is no permissions to write: " . $filename . "! Set mode to 777 on the folder."); } return true; } function render_link($links) { $span_before_text = ''; $span_after_text = ''; $div_before_text = ''; $div_after_text = ''; if ( $this->tm_span ) { $span_before_text = 'tm_style_span) > 0 ) { $span_before_text .= ' style="' . $this->tm_style_span . '"'; } if ( strlen($this->tm_class_name_span) > 0 ) { $span_before_text .= ' class="' . $this->tm_class_name_span . '"'; } $span_before_text .= '>'; $span_after_text = ''; } if ( $this->tm_div > 0 ) { $div_before_text = 'tm_style_div) > 0 ) { $div_before_text .= ' style="' . $this->tm_style_div . '"'; } if ( strlen($this->tm_class_name_div) > 0 ) { $div_before_text .= ' class="' . $this->tm_class_name_div . '"'; } $div_before_text .= '>'; $div_after_text = ''; } if ( $this->tm_div_span_order == 'div' ) { $links = $div_before_text . $span_before_text . $links . $span_after_text . $div_after_text; } else { $links = $span_before_text . $div_after_text . $links . $div_after_text . $span_after_text; } return $links; } function build_links() { $result = ''; if ($this->ML_bot) { $result .= '' . $this->version . "\n"; $result .= 'REMOTE_ADDR=' . $this->tm_host . "\n"; $result .= 'charset=' . $this->tm_charset . "\n"; $result .= 'file change date=' . $this->tm_file_change_date . "\n"; $result .= 'tm_cache_file_size=' . $this->tm_file_size . "\n"; $result .= 'tm_links_count_on_page=' . $this->tm_links_count . "\n"; $result .= '-->'; } if (isset($_COOKIE['getver']) || $this->ML_bot || $this->tm_force_sign) { $result .= ''; } $start_index = $this->tm_limit_start; $limit = ( $this->tm_limit_items > 0 ) ? $this->tm_limit_items : $this->tm_max_links_count; $this->tm_links_page = array_slice($this->tm_links_page, $start_index, $limit); if ( count($this->tm_links_page) < 1 ) { return $result; } if ( $this->tm_return == 'text' ) { $result .= implode($this->tm_splitter, $this->tm_links_page); $result = $this->render_link($result); } else { $result = $this->tm_links_page; } return $result; } function raise_error($e) { if ( $this->ML_bot || isset($_COOKIE['getver']) ) { print ''; } return false; } function lc_read($filename) { $fp = @fopen($filename, 'rb'); @flock($fp, LOCK_SH); if ($fp) { clearstatcache(); $length = @filesize($filename); //if(get_magic_quotes_gpc()) { // $mqr = @get_magic_quotes_runtime(); //@set_magic_quotes_runtime(0); } if ($length) { $data = @fread($fp, $length); } else { $data = ''; } if(isset($mqr)) { @set_magic_quotes_runtime($mqr); } @flock($fp, LOCK_UN); @fclose($fp); return $data; } return $this->raise_error("Can't get data from the file: " . $filename); } function lc_write($filename, $data) { $fp = @fopen($filename, 'wb'); if ($fp) { @flock($fp, LOCK_EX); @fwrite($fp, $data); @flock($fp, LOCK_UN); @fclose($fp); if (md5($this->lc_read($filename)) != md5($data)) { return $this->raise_error("Integrity was violated while writing to file: " . $filename); } return true; } return $this->raise_error("Can't write to file: " . $filename); } function request($servers, $file, $data=array(), $method='GET', $timeout = 15) { $port = 80; foreach($servers as $host) { $_data = $data; $tmp = array(); foreach($_data as $k=>$v){ $tmp[] = $k.'='.urlencode($v); } $_data = implode('&', $tmp); $path = $file; if( $method == 'GET' && $_data != '' ) { $path .= '?' . $_data; } $request = $method." ".$path." HTTP/1.0\r\n"; $request .= "Host: ".$host."\r\n"; $request .= "User-Agent: MainLinkAds links db updater 6.3\r\n"; $request .= "Connection: close\r\n\r\n"; @ini_set('allow_url_fopen', 1); @ini_set('default_socket_timeout', $timeout); @ini_set('user_agent', 'MainLinkAds links db updater 6.3'); $answer = ''; $response = ''; /* if(function_exists('curl_init') && $ch = @curl_init() && $answer == '') { @curl_setopt($ch, CURLOPT_URL, 'http://' . $host . $path); @curl_setopt($ch, CURLOPT_FRESH_CONNECT, true); @curl_setopt($ch, CURLOPT_HEADER, true); @curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); @curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); @curl_setopt($ch, CURLOPT_USERAGENT, 'MainLinkAds links db updater 6.3'); $response = @curl_exec($ch); $answer = ( $response != '' ) ? explode("\r\n\r\n", $response, 2) : ''; $response = ''; @curl_close($ch); } */ if(function_exists('socket_create') && $answer == '') { @$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); @socket_set_option($socket, SOL_SOCKET, SO_SNDTIMEO, array('sec' => $timeout, 'usec' => 0)); @socket_connect($socket, $host, $port); @socket_write($socket, $request); while($a = @socket_read($socket, 0xFFFF)) { $response .= $a; } $answer = ( $response != '' ) ? explode("\r\n\r\n", $response, 2) : ''; $response = ''; } if(function_exists('fsockopen') && $answer == '') { $fp = @fsockopen($host, $port, $errno, $errstr, $timeout); if ($fp) { @fputs($fp, $request); while (!@feof($fp)) { $response .= @fgets($fp, 0xFFFF); } @fclose($fp); } $answer = ( $response != '' ) ? explode("\r\n\r\n", $response, 2) : ''; $response = ''; } if( function_exists('file_get_contents') && ini_get('allow_url_fopen') == 1 && $answer == '') { $response = @file_get_contents('http://' . $host . $path); $answer[1] = ( $response != '' ) ? $response : ''; } if($answer[1] != '') { return $answer[1]; } } return $this->raise_error(''); } } ?>
CETOM  - Автор  + Автор
ЗАБУТОВ Пантеон
г. Томск
Произведения, опубликованные на сайте:
Метаморфозы, или как я стал цыганом.
Другие произведения в сети:
Рецензии и критика:
в форуме СеТОМа
E-mail автора

© Rank Corrida, 2000-2023
corrida@echo.ru