0) { $f = key($_GET); if (($_GET[$f] === '') && (preg_match('/[ \|<>\$\[\]]/', $f) == 0)) { $t = false; if (substr($f, -3) === '_js') { $t = 'text/javascript'; } else if (substr($f, -4) === '_css') { $t = 'text/css'; } else if (substr($f, -4) === '_ico') { $t = 'image/ico'; } else if (substr($f, -4) === '_gif') { $t = 'image/gif'; } else if (substr($f, -4) === '_png') { $t = 'image/png'; } else if (substr($f, -4) === '_xml') { $t = 'text/xml'; } else if (substr($f, -4) === '_rdf') { $t = 'application/rdf+xml'; } if ($t !== false) { $f = './'.str_replace('_', '.', $f); if (!file_exists($f)) { header('HTTP/1.0 404 Not Found'); die(' 404 - Not Found

404 - Not Found

'); } header('Content-Type: '.$t); if (isset($_GET['v']) && is_numeric($_GET['v'])) { header('ETag: "'.$_GET['v'].'"'); } header("Cache-Control: max-age=3600, private, must-revalidate"); header('Expires: '.gmdate('D, d M Y H:i:s', time() + 3600).' GMT'); if (isset($_SERVER['HTTP_ACCEPT_ENCODING']) && (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false)) { header('Vary: Accept-Encoding'); header('Content-Encoding: gzip'); echo gzencode(file_get_contents($f), 9); } else { echo file_get_contents($f); } die; } else { if ($f == 'collections') { require './collections.php'; die; } else if ($f == 'collection-add') { require './collection-add.php'; die; } else if ($f == 'js/collections') { require './collections.js.php'; die; } else if ($f == 'video-broken') { require './video-broken.php'; die; } else if ($f == 'collection-create') { require './collection-create.php'; die; } else if ($f == 'collection-remove') { require './collection-remove.php'; die; } else if ($f == 'video') { require './video.php'; die; } else if ($f == '2257') { require './2257.php'; die; } } } } if (isset($_GET['debug'])) { if ($_GET['debug'] == 1) { setcookie('debug', 1, time() + (2 * 24*60*60), '/', '.hoer.tv'); $_COOKIE['debug'] = 1; } else { setcookie('debug', 0, time(), '/', '.hoer.tv'); unset($_COOKIE['debug']); } } require './mysql.inc.php'; $inc_css = array('extended'); $inc_js = array('http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js', 'common', 'videos'); // $full will be the query we are searching for (everything included) // $search will be the full text search querty (added:... removed) // $plain will be the words we want to search for (added:..., -..., and special characters removed) // $rand will be true if want a random result set // $priv will be set if we are watching a private collection if (!isset($_GET['q'])) { /*require './ip.inc.php'; $query = ' SELECT search FROM searches WHERE results > 0 AND ip = INET_ATON("'.ip().'") ORDER BY time_added DESC LIMIT 10 '; $result = mysql_do_query($query); if (mysql_num_rows($result) > 0) { $full = array(); while ($row = mysql_fetch_row($result)) { $full[] = '('.$row[0].')'; } $full = implode($full, '|'); //echo '
',$full,'
'; } else { $full = 'babe | hot'; } mysql_free_result($result); $rand = true;*/ if (isset($_GET['rss'])) { $full = 'babe | hot'; $rand = true; } else { $inc_css[] = 'home'; require './templates/home.php'; die; } } else { $full = stripslashes($_GET['q']); $rand = isset($_GET['r']); } if (!$rand && isset($_GET['p']) && is_numeric($_GET['p'])) { $list_start = $_GET['p']; } else { $list_start = 0; } $time_from = false; $time_to = time(); $full = trim($full); $search = $full; // added: handler preg_match_all('/added:([a-z0-9\-]+)/i', $search, $m); if (!empty($m[1])) { $date = $m[1][0]; foreach ($m[0] as $s) { $search = str_replace($s, '', $search); } if ($date == 'today') { $time_from = mktime(0, 0, 0, date('m'), date('d') - 1, date('Y')); } else if ($date == 'yesterday') { $time_from = mktime(0, 0, 0, date('m'), date('d') - 2, date('Y')); $time_to = mktime(0, 0, 0, date('m'), date('d') - 1, date('Y')); } else if ($date == 'thisweek') { $time_from = mktime(0, 0, 0, date('m'), date('d') - 7, date('Y')); } else if ($date == 'lastweek') { $time_from = mktime(0, 0, 0, date('m'), date('d') - 7, date('Y')); $time_to = mktime(0, 0, 0, date('m'), date('d') - 14, date('Y')); } else { $date = explode('-', $date); $time_from = mktime(0, 0, 0, $date[1], $date[0] - 1, 2000 + ($date[2] % 2000)); $time_to = mktime(0, 0, 0, $date[1], $date[0] , 2000 + ($date[2] % 2000)); } } // age: handler if (preg_match('/age([<>=])([0-9]{2})/i', $search, $m)) { $query = ' SELECT id_collection FROM stars WHERE age IS NOT NULL AND age '.$m[1].' '.$m[2].' '; //echo '
',$query,'
'; $result = mysql_do_query($query); $star_filter = array(); while ($row = mysql_fetch_row($result)) { $star_filter[] = $row[0]; } $search = str_ireplace('age'.$m[1].$m[2], '', $search); } // breasts: handler if (preg_match('/breasts([<>=])([a-j]{1,2})/i', $search, $m)) { $cups = array( 'A' => 0, 'AA' => 1, 'B' => 2, 'BB' => 3, 'C' => 4, 'CC' => 5, 'D' => 6, 'DD' => 7, 'E' => 8, 'EE' => 9, 'F' => 10, 'FF' => 11, 'G' => 12, 'GG' => 13, 'H' => 14, 'HH' => 15, 'I' => 16, 'II' => 17, 'J' => 18, 'JJ' => 19 ); $cup = strtoupper($m[2]); if (isset($cups[$cup])) { $cup = $cups[$cup]; $query = ' SELECT id_collection FROM stars WHERE cup IS NOT NULL AND cup '.$m[1].' '.$cup.' '; if (isset($star_filter)) { $query .= ' AND id_collection IN ( '.implode(',', $star_filter).' ) '; } //echo '
',$query,'
'; $result = mysql_do_query($query); $star_filter = array(); while ($row = mysql_fetch_row($result)) { $star_filter[] = $row[0]; } } $search = str_ireplace('breasts'.$m[1].$m[2], '', $search); } // private: handler if (preg_match('/(^.*\+private:([a-z]*).*$)|(^\+?private:([a-z]*)$)/', $search, $m)) { if ($m[2] == '') { $priv = $m[4]; } else { $priv = $m[2]; } } $search = preg_replace('/private:([a-z]*)/i', 'prv$1prv', $search, -1, $privates); // nocollection handler if (stripos($search, 'nocollection') !== false) { $search = str_ireplace('nocollection', '', $search); $nocollection = true; } if (stripos($search, 'sss') !== false) { $search = str_ireplace('sss', '', $search); $sss = true; } $search = str_replace('18', 'eighteen', $search); $search = trim($search); $plain = str_replace(array('(', ')', '|'), array('', '', ''), $search); $plain = preg_replace('/-"[^"]*"/' , '' , $plain); $plain = preg_replace('/(( |^)-[^ ]*)|["\+\*\(\)]/' , '' , $plain); $plain = str_replace('-' , ' ', $plain); $plain = trim($plain); if (isset($star_filter)) { $collections = array(); if (!empty($star_filter)) { $query = ' SELECT id_video FROM collections_videos WHERE id_collection IN ( '.implode(',', $star_filter).' ) '; $result = mysql_do_query($query); while ($row = mysql_fetch_row($result)) { $collections[] = $row[0]; } } } $stars = array(); if ((isset($_GET['q']) && ($search != '')) || isset($star_filter)) { require './stars.inc.php'; } if ($rand == true) { $query = ' SELECT id '; } else { $query = 'SELECT SQL_CALC_FOUND_ROWS id, title, url, image, collections, site, '; if (empty($plain)) { $query .= '1 AS relevance'; } else { $query .= 'MATCH(title, hidden_static, collections, hidden_added) AGAINST ("'.addslashes($plain).'") AS relevance'; } } $query .= ' FROM videos '; if ($search != '()') { if (empty($plain)) { // only negative searches, remove the - and do a NOT MATCH $query .= ' WHERE NOT MATCH(title, hidden_static, collections, hidden_added) AGAINST ("'.addslashes(str_replace('-', '', $search)).'" IN BOOLEAN MODE) '; } else { $query .= ' WHERE MATCH(title, hidden_static, collections, hidden_added) AGAINST ("'.addslashes($search).'" IN BOOLEAN MODE) '; } } else { $query .= ' WHERE TRUE '; } if (isset($nocollection)) { $query .= ' AND collections = ",," '; } if (isset($collections)) { if (empty($collections)) { $query .= ' AND FALSE '; } else { $query .= ' AND id IN ( '.implode(',', $collections).' ) '; } } if ($time_from !== false) { $query .= ' AND time_added BETWEEN '.$time_from.' AND '.$time_to.' '; } if (isset($_GET['d']) || isset($_GET['rss'])) { $query .= ' ORDER BY time_added DESC '; } else if ($rand == true) { $query .= ' ORDER BY RAND() '; } else { $query .= ' ORDER BY relevance DESC '; } $query .= ' LIMIT '.($list_start * 60).', 60 '; //echo '
',$query,'
'; $result = mysql_do_query($query); if ($rand == true) { $ids = array(); while ($row = mysql_fetch_row($result)) { $ids[] = $row[0]; } mysql_free_result($result); if (empty($ids)) { $ids[] = 0; // video 0 never exists } $query = ' SELECT id, title, url, image, collections, site FROM videos WHERE id IN ('.implode(',', $ids).') ORDER BY RAND() '; $result = mysql_do_query($query); } $list = array(); while ($row = mysql_fetch_assoc($result)) { if (isset($_GET['rss'])) { $row['title'] = str_replace( array('&' , '<' , '>'), array('&', '<', '>'), html_entity_decode($row['title'])); } $list[] = $row; } mysql_free_result($result); if (isset($_GET['rss'])) { header('Content-Type: application/xml'); require './templates/rss.php'; } else { list($list_count) = mysql_fetch_row(mysql_do_query('SELECT FOUND_ROWS()')); if (($list_start == 0) && isset($_GET['q']) && !empty($search) && !empty($_SERVER['HTTP_USER_AGENT'])) { $spiders = array('Googlebot', 'Yammybot', 'Openbot', 'Yahoo', 'Slurp', 'msnbot', 'ia_archiver', 'Lycos', 'Scooter', 'AltaVista', 'Teoma', 'Gigabot', 'Googlebot-Mobile', 'panscient'); foreach ($spiders as $spider) { if (strpos($_SERVER['HTTP_USER_AGENT'], $spider) !== false) { $spider = true; break; } } if ($spider !== true) { require_once './ip.inc.php'; $query = ' INSERT INTO searches (ip, time_added, search, results, browser) VALUES(INET_ATON("'.ip().'"), UNIX_TIMESTAMP(), "'.$_GET['q'].'", '.$list_count.', "'.addslashes($_SERVER['HTTP_USER_AGENT']).'") '; mysql_do_query($query); } } $query = ' SELECT MAX(id) FROM collections WHERE type != "private" '; list($collections_max) = mysql_fetch_row(mysql_do_query($query)); if (isset($_GET['r'])) { if (isset($_GET['q']) && !empty($search)) { $title = 'Random videos for "'.htmlentities($plain).'" on PronVid'; } else { $title = 'Random videos on PronVid'; } } else if (isset($_GET['q']) && ($_GET['q'] == 'added:today')) { $title = 'Videos added today on PronVid'; } else if ($privates > 0) { // plain is used in templates/header.inc.php to create the title $plain = preg_replace('/prv([a-z]*)prv/', '$1', $plain); } $inc_css[] = 'videos'; $inc_css[] = 'index'; /*if (isset($_COOKIE['debug'])) { $inc_js[] = 'pixastic.custom'; $inc_js[] = 'debug'; }*/ require './templates/index.php'; }