0)?"?":"").$parts['query']; if($path==""){ $path="/"; } $socket=fsockopen($host, 80, $errno, $errstr, 30); if($socket){ $header = 'GET '.$path.' HTTP/1.0'.$HTTP_CRLF; $header.= 'Host: '. $host.$HTTP_CRLF; $header.= 'Connection: Close'.$HTTP_CRLF; $header.= 'Pragma: no-cache'.$HTTP_CRLF; $header.= 'Cache-Control: no-cache'.$HTTP_CRLF; $header.= 'User-Agent: '.$agent.$HTTP_CRLF; $header.= 'Content-Type: application/x-www-form-urlencoded'.$HTTP_CRLF; if($usr != '') $header.= 'Authorization: Basic ' . base64_encode( $usr . ":" . $pwd ) . $HTTP_CRLF; if($cookie != '') $header.='Cookie: '.$cookie.$HTTP_CRLF; if($ref != '') $header.= 'Referer: '.$ref.$HTTP_CRLF; $header .= $HTTP_CRLF; fwrite($socket,$header); $header = ""; $output = ""; $fp = @fopen($file,"wb"); $start = false; while(!feof($socket)){ if(!$start){ $header .= fgets($socket,4096); $pos = strpos($header,$HTTP_CRLF.$HTTP_CRLF); if($pos!==false){ $start = true; $output = substr($header,$pos + strlen($HTTP_CRLF) * 2); $header = substr($header,0,$pos); } }else{ $output .= fgets($socket,4096); } } @fwrite($fp,$output); @fclose($fp); fclose($socket); return $file; } } function downloadContent($url, $usr='', $pwd='', $agent='CosmoHttp/1.1 (compatible; MSIE 5.5; Linux)', $cookie='', $ref=''){ global $HTTP_CRLF; $parts = parse_url($url); $host = $parts['host']; $path = $parts['path'].((strlen($parts['query'])>0)?"?":"").$parts['query']; if($path==""){ $path="/"; } $socket=fsockopen($host, 80, $errno, $errstr, 30); if($socket){ $header = 'GET '.$path.' HTTP/1.0'.$HTTP_CRLF; $header.= 'Host: '. $host.$HTTP_CRLF; $header.= 'Connection: Close'.$HTTP_CRLF; $header.= 'Pragma: no-cache'.$HTTP_CRLF; $header.= 'Cache-Control: no-cache'.$HTTP_CRLF; $header.= 'User-Agent: '.$agent.$HTTP_CRLF; $header.= 'Content-Type: application/x-www-form-urlencoded'.$HTTP_CRLF; if($usr != '') $header.= 'Authorization: Basic ' . base64_encode( $usr . ":" . $pwd ) . $HTTP_CRLF; if($cookie != '') $header.='Cookie: '.$cookie.$HTTP_CRLF; if($ref != '') $header.= 'Referer: '.$ref.$HTTP_CRLF; $header .= $HTTP_CRLF; fwrite($socket,$header); $header = ""; $output = ""; $start = false; while(!feof($socket)){ if(!$start){ $header .= fgets($socket,4096); $pos = strpos($header,$HTTP_CRLF.$HTTP_CRLF); if($pos!==false){ $start = true; $output = substr($header,$pos + strlen($HTTP_CRLF) * 2); $header = substr($header,0,$pos); } }else{ $output .= fgets($socket,4096); } } fclose($socket); return $output; } } ?>_XMLSource = ''; } /** * Get content from File **/ function setInputFile($file){ $this->_XMLSource = ''; $fp = @fopen($file,'rb'); if($fp){ while(!feof($fp)){ $this->_XMLSource .= fread($fp, 2048); } } @fclose($fp); } /** * Get content from URL **/ function setInputURL($url){ $this->_XMLSource = downloadContent($url); } /** * Get Tag **/ function tag($src, $pattern, $index=1){ preg_match('/<'.$pattern.'>([\w\W]*)<\/'.$pattern.'>/iU', $src, $out); return trim($out[$index]); } /** * Get URL Param **/ function param($src, $name){ $url = urldecode($src); $url = str_replace('&', '&', $url); preg_match('/(\?|\&)'.$name.'=([^\&\?]+)/i', $url, $out); return trim($out[2]); } /** * Parser * * Type = 'top amateurs' => 1, 'top movies' => 2, 'new movies and pics' => 3 **/ function parse($type, $limit, $check_preview_pic = true){ global $db; global $SITE_CNF; $_types = array('top amateurs' => 1, 'top movies' => 2, 'new movies and pics' => 3); $time = intval(date('ymd')); $count = 0; // get items preg_match_all('/([\w\W]*)<\/item>/iU', $this->_XMLSource, $items); for($i=0; $itag($items[1][$i], 'preview_url')); if($preview_url=='http://www.privatamateure.com/gfx/keinevorschaubig.gif' || $preview_url=='http://www.privatamateure.com/gfx/keinevorschau.gif' || $preview_url=='http://www.privatamateure.com//gfx/keinevorschau.gif'){ if($check_preview_pic){ continue; } } // get nickname $nickname = utf8_decode($this->tag($items[1][$i], '(amateur_|)nickname',2)); // get link $link = $this->tag($items[1][$i], 'link'); // get unique ID if($type == 'top amateurs'){ $rf_rss_id =intval( $this->tag($items[1][$i], 'userid') ); }else{ $rf_rss_id =intval( $this->param($link , 'set_id') ); } // get title $title = utf8_decode($this->tag($items[1][$i], 'title')); // get amateur link $amateur_link= $this->tag($items[1][$i], 'amateur_link'); // if F2F get only from privat-amateure.com if($SITE_CNF['SC']=='2'){ $link = preg_replace('/privatamateure\.com/i', 'privat-amateure.com', $link); $amateur_link = preg_replace('/privatamateure\.com/i', 'privat-amateure.com', $amateur_link); } // get description $description = utf8_decode($this->tag($items[1][$i], 'description')); // get zip $zip = $this->tag($items[1][$i], 'zip'); // get country $country = $this->tag($items[1][$i], 'country'); /** * Check unique ID **/ $db->query("rf","SELECT rf_id FROM rss_feeds WHERE rf_rss_id=".$rf_rss_id." AND rf_type=".$_types[$type]); if(!$db->next_record("rf")){ $db->query("ins","INSERT INTO rss_feeds SET rf_rss_id = ".$rf_rss_id.", rf_time = ".$time.", rf_type = ".$_types[$type].", rf_nickname = '".tosql($nickname)."', rf_link = '".tosql($link)."', rf_preview_url = '".tosql($preview_url)."', rf_title = '".tosql($title)."', rf_amateur_link= '".tosql($amateur_link)."', rf_description = '".tosql($description)."', rf_zip = '".tosql($zip)."', rf_country = '".tosql($country)."'"); }else{ $db->query("upd","UPDATE rss_feeds SET rf_rss_id = ".$rf_rss_id.", rf_time = ".$time.", rf_type = ".$_types[$type].", rf_nickname = '".tosql($nickname)."', rf_link = '".tosql($link)."', rf_preview_url = '".tosql($preview_url)."', rf_title = '".tosql($title)."', rf_amateur_link= '".tosql($amateur_link)."', rf_description = '".tosql($description)."', rf_zip = '".tosql($zip)."', rf_country = '".tosql($country)."' WHERE rf_id=".$db->f("rf","rf_id")); } $db->free("rf"); $count++; } return $count; } } ?> 'Andorra', 'AE' => 'United Arab Emirates', 'AF' => 'Afghanistan', 'AG' => 'Antigua and Barbuda', 'AI' => 'Anguilla', 'AL' => 'Albania', 'AM' => 'Armenia', 'AN' => 'Netherlands Antilles', 'AO' => 'Angola', 'AQ' => 'Antarctica', 'AR' => 'Argentina', 'AS' => 'American Samoa', 'AT' => 'Austria', 'AU' => 'Australia', 'AW' => 'Aruba', 'AZ' => 'Azerbaijan', 'BA' => 'Bosnia and Herzegowina', 'BB' => 'Barbados', 'BD' => 'Bangladesh', 'BE' => 'Belgium', 'BF' => 'Burkina Faso', 'BG' => 'Bulgaria', 'BH' => 'Bahrain', 'BI' => 'Burundi', 'BJ' => 'Benin', 'BM' => 'Bermuda', 'BN' => 'Brunei Darussalam', 'BO' => 'Bolivia', 'BR' => 'Brazil', 'BS' => 'Bahamas', 'BT' => 'Bhutan', 'BV' => 'Bouvet Island', 'BW' => 'Botswana', 'BY' => 'Belarus', 'BZ' => 'Belize', 'CA' => 'Canada', 'CC' => 'Cocos (Keeling) Islands', 'CF' => 'Central African Republic', 'CG' => 'Congo', 'CH' => 'Switzerland', 'CI' => 'Cote D\'ivoire', 'CK' => 'Cook Islands', 'CL' => 'Chile', 'CM' => 'Cameroon', 'CN' => 'China', 'CO' => 'Colombia', 'CR' => 'Costa Rica', 'CU' => 'Cuba', 'CV' => 'Cape Verde', 'CX' => 'Christmas Island', 'CY' => 'Cyprus', 'CZ' => 'Czech Republic', 'DE' => 'Germany', 'DJ' => 'Djibouti', 'DK' => 'Denmark', 'DM' => 'Dominica', 'DO' => 'Dominican Republic', 'DZ' => 'Algeria', 'EC' => 'Ecuador', 'EE' => 'Estonia', 'EG' => 'Egypt', 'EH' => 'Western Sahara', 'ER' => 'Eritrea', 'ES' => 'Spain', 'ET' => 'Ethiopia', 'FI' => 'Finland', 'FJ' => 'Fiji', 'FK' => 'Falkland Islands (Malvinas)', 'FM' => 'Micronesia', 'FO' => 'Faroe Islands', 'FR' => 'France', 'FX' => 'France, Metropolitan', 'GA' => 'Gabon', 'GB' => 'United Kingdom (Great Britain)', 'GD' => 'Grenada', 'GE' => 'Georgia', 'GF' => 'French Guiana', 'GH' => 'Ghana', 'GI' => 'Gibraltar', 'GL' => 'Greenland', 'GM' => 'Gambia', 'GN' => 'Guinea', 'GP' => 'Guadeloupe', 'GQ' => 'Equatorial Guinea', 'GR' => 'Greece', 'GT' => 'Guatemala', 'GU' => 'Guam', 'GW' => 'Guinea-Bissau', 'GY' => 'Guyana', 'HK' => 'Hong Kong', 'HM' => 'Heard and McDonald Islands', 'HN' => 'Honduras', 'HR' => 'Croatia', 'HT' => 'Haiti', 'HU' => 'Hungary', 'ID' => 'Indonesia', 'IE' => 'Ireland', 'IL' => 'Israel', 'IN' => 'India', 'IO' => 'British Indian Ocean Territory', 'IQ' => 'Iraq', 'IR' => 'Islamic Republic of Iran', 'IS' => 'Iceland', 'IT' => 'Italy', 'JM' => 'Jamaica', 'JO' => 'Jordan', 'JP' => 'Japan', 'KE' => 'Kenya', 'KG' => 'Kyrgyzstan', 'KH' => 'Cambodia', 'KI' => 'Kiribati', 'KM' => 'Comoros', 'KN' => 'St. Kitts and Nevis', 'KP' => 'Korea', 'KR' => 'Korea, Republic of', 'KW' => 'Kuwait', 'KY' => 'Cayman Islands', 'KZ' => 'Kazakhstan', 'LA' => 'Laos', 'LB' => 'Lebanon', 'LC' => 'Saint Lucia', 'LI' => 'Liechtenstein', 'LK' => 'Sri Lanka', 'LR' => 'Liberia', 'LS' => 'Lesotho', 'LT' => 'Lithuania', 'LU' => 'Luxembourg', 'LV' => 'Latvia', 'LY' => 'Libyan Arab Jamahiriya', 'MA' => 'Morocco', 'MC' => 'Monaco', 'MD' => 'Moldova, Republic of', 'MG' => 'Madagascar', 'MH' => 'Marshall Islands', 'MK' => 'Macedonia', 'ML' => 'Mali', 'MM' => 'Myanmar', 'MN' => 'Mongolia', 'MO' => 'Macau', 'MP' => 'Northern Mariana Islands', 'MQ' => 'Martinique', 'MR' => 'Mauritania', 'MS' => 'Montserrat', 'MT' => 'Malta', 'MU' => 'Mauritius', 'MV' => 'Maldives', 'MW' => 'Malawi', 'MX' => 'Mexico', 'MY' => 'Malaysia', 'MZ' => 'Mozambique', 'NA' => 'Namibia', 'NC' => 'New Caledonia', 'NE' => 'Niger', 'NF' => 'Norfolk Island', 'NG' => 'Nigeria', 'NI' => 'Nicaragua', 'NL' => 'Netherlands', 'NO' => 'Norway', 'NP' => 'Nepal', 'NR' => 'Nauru', 'NU' => 'Niue', 'NZ' => 'New Zealand', 'OM' => 'Oman', 'PA' => 'Panama', 'PE' => 'Peru', 'PF' => 'French Polynesia', 'PG' => 'Papua New Guinea', 'PH' => 'Philippines', 'PK' => 'Pakistan', 'PL' => 'Poland', 'PM' => 'St. Pierre and Miquelon', 'PN' => 'Pitcairn', 'PR' => 'Puerto Rico', 'PT' => 'Portugal', 'PW' => 'Palau', 'PY' => 'Paraguay', 'QA' => 'Qatar', 'RE' => 'Reunion', 'RO' => 'Romania', 'RU' => 'Russian Federation', 'RW' => 'Rwanda', 'SA' => 'Saudi Arabia', 'SB' => 'Solomon Islands', 'SC' => 'Seychelles', 'SD' => 'Sudan', 'SE' => 'Sweden', 'SG' => 'Singapore', 'SH' => 'St. Helena', 'SI' => 'Slovenia', 'SJ' => 'Svalbard and Jan Mayen Islands', 'SK' => 'Slovakia', 'SL' => 'Sierra Leone', 'SM' => 'San Marino', 'SN' => 'Senegal', 'SO' => 'Somalia', 'SR' => 'Suriname', 'ST' => 'Sao Tome and Principe', 'SV' => 'El Salvador', 'SY' => 'Syrian Arab Republic', 'SZ' => 'Swaziland', 'TC' => 'Turks and Caicos Islands', 'TD' => 'Chad', 'TF' => 'French Southern Territories', 'TG' => 'Togo', 'TH' => 'Thailand', 'TJ' => 'Tajikistan', 'TK' => 'Tokelau', 'TM' => 'Turkmenistan', 'TN' => 'Tunisia', 'TO' => 'Tonga', 'TP' => 'East Timor', 'TR' => 'Turkey', 'TT' => 'Trinidad and Tobago', 'TV' => 'Tuvalu', 'TW' => 'Taiwan', 'TZ' => 'Tanzania, United Republic of', 'UA' => 'Ukraine', 'UG' => 'Uganda', 'US' => 'United States', 'UY' => 'Uruguay', 'UZ' => 'Uzbekistan', 'VA' => 'Vatican City State', 'VC' => 'St. Vincent and the Grenadines', 'VE' => 'Venezuela', 'VG' => 'British Virgin Islands', 'VI' => 'United States Virgin Islands', 'VN' => 'Viet Nam', 'VU' => 'Vanuatu', 'WF' => 'Wallis And Futuna Islands', 'WS' => 'Samoa', 'YE' => 'Yemen', 'YT' => 'Mayotte', 'YU' => 'Yugoslavia', 'ZA' => 'South Africa', 'ZM' => 'Zambia', 'ZR' => 'Zaire', 'ZW' => 'Zimbabwe'); ?>Smarty(); $this->template_dir = './tmpl/'; $this->compile_dir = realpath(dirname(__FILE__).'/../../tmpl_c/'); $this->assign('app_name', 'Front-end'); } } ?>