The page you are looking at now is at this URL: http://pastoid.com/bl8
This paste was last updated on January 16, 2009 at 1:29 pm.
protected function get_file( $file_name ) { if( $this->is_local_file( $file_name ) ) { return $this->get_local( $file_name ); } else if( ini_get( 'allow_url_fopen' ) ) { return $this->get_with_streams( $file_name ); } else if( function_exists( 'curl_init' ) && ! ( ini_get( 'safe_mode' ) && ini_get( 'open_basedir' ) ) ) { return $this->get_with_curl( $file_name ); } } protected function is_local_file( $file_name = '' ) { $parsed = InputFilter::parse_url( $file_name ); $parsed_home = InputFilter::parse_url( Site::get_url( 'habari' ) ); return $parsed['host'] == $parsed_home['host']; } protected function get_local( $file_name = '' ) { $parsed = InputFilter::parse_url( $file_name ); return HABARI_PATH . $parsed['path']; } protected function get_with_streams( $file_name = '' ) { $tmp = tempnam( '/user/cache', 'RR' ); $temph = fopen( $tmp, 'wb' ); $fp = fopen( $file_name, 'rb' ); stream_copy_to_stream( $fp, $temph ); fclose( $temph ); fclose( $fp ); return $tmp; } protected function get_with_curl( $file_name = '' ) { $headers = array(); $timeout = 180; $method = 'GET'; $tmp = tempnam( '/user/cache', 'RR' ); $headers[] = "User-Agent: Habari"; $ch = curl_init(); curl_setopt( $ch, CURLOPT_URL, $file_name ); // The URL. curl_setopt( $ch, CURLOPT_MAXREDIRS, 5 ); // Maximum number of redirections to follow. curl_setopt( $ch, CURLOPT_CRLF, true ); // Convert UNIX newlines to \r\n. curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true ); // Follow 302's and the like. curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout ); curl_setopt( $ch, CURLOPT_TIMEOUT, $timeout ); curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers ); // headers to send $th = fopen( $tmp, 'wb' ); curl_setopt( $ch, CURLOPT_FILE, $th ); $success = curl_exec( $ch ); fclose( $th ); if( ! $success || curl_errno($ch) != 0 || curl_getinfo( $ch, CURLINFO_HTTP_CODE ) !== 200 ) { curl_close( $ch ); unlink( $tmp ); return FALSE; } curl_close( $ch ); return $tmp; }
| Referring Domain | Hits |
|---|---|
| Unknown Referer | 127 |
| pastoid.com | 5 |
Tip: Use Pastoid to shorten URLs with this bookmarklet: Pastoid This