ceil($select_sub[0]['sites_active']/$GLOBALS['cfg']['sub_site'])) redirect_home(); elseif ($_GET['page'] == 1) $check_url = url('sub', $select_sub[0]['title'], $select_sub[0]['id'], $select_sub[0]['id_cat']); else $check_url = url('sub', $select_sub[0]['title'], $select_sub[0]['id'], $select_sub[0]['id_cat'], $_GET['page']); if (rawurldecode($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']) != $check_url) { header("HTTP/1.1 301 Moved Permanently"); header('Location: http://'.$check_url); header("Connection: close"); exit(); } } else redirect_home(); } elseif ($_GET['action'] == 'site') { $select_site = select('sites', 'id, title', 'id = "'.validator($_GET['id']).'" && active = "1"', '', ''); if ($select_site[0]['title'] != '') { $check_url = url('site', $select_site[0]['title'], $select_site[0]['id']); if (rawurldecode($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']) != $check_url) { header("HTTP/1.1 301 Moved Permanently"); header('Location: http://'.$check_url); header("Connection: close"); exit(); } } else redirect_home(); } } } } } function update_file() { if (file_exists('../update/update.php')) require_once('../update/update.php'); else $_SESSION['error'] = $GLOBALS['lang'][936].'
'; } function validator($validator, $pass = 0, $str = 350) { if ($validator != '') { $validator = htmlspecialchars_decode($validator); if ($pass != '1') $validator = strip_tags($validator); $validator = substr($validator,0,$str); $validator = rtrim($validator); if ($pass != '3') $validator = htmlspecialchars($validator); if ($pass != '4') $validator = str_replace(array(' ,', "\n", "\r"), array(', ', '
', ''), $validator); $validator = str_replace($GLOBALS['prefix'], '', $validator); //$validator = str_replace(',', ', ', $validator); $validator = preg_replace('/([[:space:]]+)/i', ' ', $validator); $validator = trim($validator); $validator = stripslashes($validator); if ($pass != '7') $validator = addslashes($validator); } return $validator; } function bb_email($m){return str_replace(array(".", ","), array("#dot#", "#sbquo#"), $m[1]);} function bb_url($m){return str_replace(array(".", ",", "?"), array("#dot#", "#sbquo#", "#pyt#"), "[url=".$m[1]."]".$m[2]."[/url]");} function bb_img($m){return str_replace(array(".", ","), array("#dot#", "#sbquo#"), "[img]".$m[1]."[/img]");} function validator_descr($validator) { if ($validator != '') { $validator = preg_replace_callback('/([A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4})/i', 'bb_email', $validator); $validator = preg_replace_callback('/\[url=(.*?)\](.*?)\[\/url\]/i', 'bb_url', $validator); $validator = preg_replace_callback('/\[img\](.*?)\[\/img\]/i', 'bb_img', $validator); $validator = str_replace(array(',', '.', '!', '?'), array(', ', '. ', '! ', '? '), $validator); $validator = preg_replace("/\s([\,\.!?]+)/", "\\1", $validator); $validator = str_replace(array('#dot#', '#sbquo#', '#pyt#'), array('.', ',', '?'), $validator); $validator = preg_replace('/([[:space:]]+)/i', ' ', $validator); } return $validator; } function remove_dups($array, $row_element, $check) { $new_array[0] = $array[0]; foreach ($array as $current) { if ($current[$check] != '') { $add_flag = 1; foreach ($new_array as $tmp) { if ($row_element != '') { if ($current[$row_element]==$tmp[$row_element]) { $add_flag = 0; break; } } } if ($add_flag) $new_array[] = $current; } } return $new_array; } function ucfirst_utf8($str) { if (mb_check_encoding($str, $GLOBALS['lang'][0])) { $first = mb_substr(mb_strtoupper($str, $GLOBALS['lang'][0]), 0, 1, $GLOBALS['lang'][0]); return $first.mb_substr($str, 1, mb_strlen($str), $GLOBALS['lang'][0]); } else { return ucfirst($str); } } function arr_search ( $array, $expression ) { $result = array(); $expression = preg_replace ( "/([^\s]+?)(=|<|>|!)/", "\$a['$1']$2", $expression ); foreach ( $array as $a ) if ( eval ( "return $expression;" ) ) $result[] = $a; return $result; } function deletedir($dir) { $fd = opendir($dir); if(!$fd) return false; while (($file = readdir($fd))!== false) { if($file =="." || $file== "..") continue; if(is_dir($dir."/".$file)) { deletedir($dir."/".$file); rmdir($dir."/".$file); } else { unlink("$dir/$file"); } } closedir($fd); } function replace($in, $out, $text) { $replace = str_replace($in, $out, $text); return $replace; } function replace_url($in) { $url = str_replace(array('http://', 'https://'), array('', ''), $in); $url = explode('/', $url); $count = count($url); $_uri = ''; for ($i=0; $i<$count; $i++) { if ($url[$i] != '') $_uri[] = $url[$i]; } if ($_uri[0] != '') { if ($count > 3 && !strpos($_uri[$count-1], '.')) $add_url = '/'; $replace_url = str_replace('&', '&', implode('/', $_uri)).$add_url; } return $replace_url; } function get_content($url, $f = 0) { if ($GLOBALS['cfg']['get'] == '1' && $f == '0') { $get_content = str_replace(array('?', '$', '&'), array('', '', ''), @file_get_contents($url)); } elseif ($GLOBALS['cfg']['get'] == '2' && $f == '0') { $userAgent = Array( "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021204", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.19 (KHTML, like Gecko) Chrome/0.2.153.1 Safari/525.19", "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506; Media Center PC 5.0)", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)", "Opera/9.63 (Windows NT 6.0; U; ru) Presto/2.1.1", "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5", "Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.8.1.18) Gecko/20081203 Firefox/2.0.0.18", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.16) Gecko/20080702 Firefox/2.0.0.16", "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1" ); $cookie = '../files/cookie2.txt'; $ch = curl_init(); curl_setopt($ch, CURLOPT_COOKIE, $cookie); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie); curl_setopt($ch, CURLOPT_POST, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HTTPGET, true); if (preg_match('#seokatalogi.pl#i', $url)) { curl_setopt($ch, CURLOPT_URL, $url); } else { curl_setopt($ch, CURLOPT_USERAGENT, $userAgent[rand(0, count($userAgent)-1)]); if ($GLOBALS['cfg']['proxy'] != '') { $proxy = explode('
', $GLOBALS['cfg']['proxy']); $proxy_url = $proxy[mt_rand(0,count($proxy)-1)]; if (preg_match('#localhost#i', $proxy_url)) { curl_setopt($ch, CURLOPT_URL, $url); } elseif (preg_match('#http://#i', $proxy_url)) { curl_setopt($ch, CURLOPT_URL, $proxy_url.'get.php?url='.$url); } else { curl_setopt($ch, CURLOPT_PROXY, $proxy_url); curl_setopt($ch, CURLOPT_URL, $url); } } else curl_setopt($ch, CURLOPT_URL, $url); if ($GLOBALS['cfg']['curlopt_interface'] != '') { $curlopt_interface_ip = explode('
', $GLOBALS['cfg']['curlopt_interface']); curl_setopt($ch, CURLOPT_INTERFACE, $curlopt_interface_ip[mt_rand(0,count($curlopt_interface_ip)-1)]); } } $get_content = str_replace(array('?', '$', '&'), array('', '', ''), curl_exec($ch)); curl_close($ch); unset($cookie); } elseif ($GLOBALS['cfg']['get'] == '3' || $f == '1') { $z = @fopen($url, "r"); while ($buff = fread($z, 1024)) { if ($f == 1) $get_content .= $buff; else $get_content .= str_replace(array('?', '$', '&'), array('', '', ''), $buff); } fclose($z); } return $get_content; } function check_admin($nick, $pass) { if (!isset($_POST['update']) && !isset($_GET['update'])) $add_sql = ', spell'; $check_admin = select('users', 'id'.$add_sql, 'nick = "'.validator($nick, 0, 100).'" && pass = "'.validator($pass, 0, 100).'" && admin = "1"', '', ''); return $check_admin; } function check_user($nick, $pass) { $check_user = select('users', 'id, spell', 'nick = "'.validator($nick, 0, 100).'" && pass = "'.validator($pass, 0, 100).'"', '', ''); return $check_user; } function decode($text) { $text = preg_replace('#\[([a-z0-9=]+)\]
(.*?)\[/([a-z]+)\]#si', '[\\1]\\2[/\\3]', $text); $text = str_replace(array('

[list', '
[list'), array('[list', '[list'), $text); $text = str_replace(array('[/list]

', '[/list]
'), array('[/list]', '[/list]'), $text); $text = preg_replace('#\[url=(.*?)\](.*?)\[/url\]#si', '\\2', $text); $text = preg_replace('#\[b\](.*?)\[/b\]#si', '\\1', $text); $text = preg_replace('#\[i\](.*?)\[/i\]#si', '\\1', $text); $text = preg_replace('#\[u\](.*?)\[/u\]#si', '\\1', $text); $text = preg_replace('#(\[quote\]|\[quote\]
)(.*?)(\[/quote\]
|\[/quote\])#si', '
\\1
', $text); $text = preg_replace('#\[img\](.*?)\[/img\]#si', '', $text); $text = preg_replace('#\[size=(.*?)\](.*?)\[/size\]#si', '\\2', $text); $text = preg_replace('#\[list=(.*?)\](.*?)\[/list\]#si', '
    \\2
', $text); $text = preg_replace('#\[list\](.*?)\[/list\]#si', '', $text); $text = preg_replace('#\[\*\](.*?)
#si', '
  • \\1
  • ', $text); return $text; } function encode($text) { $text = preg_replace('#\[([a-z0-9=]+)\]
    (.*?)\[/([a-z]+)\]#si', '[\\1]\\2[/\\3]', $text); $text = str_replace('
    [list', '[list', $text); $text = str_replace('[/list]
    ', '[/list]', $text); $text = preg_replace('#\[([a-z0-9=]+)\]
    (.*?)\[/([a-z]+)\]#si', '\\2', $text); $text = preg_replace('#\[url=(.*?)\](.*?)\[/url\]#si', '\\2', $text); $text = preg_replace('#\[b\](.*?)\[/b\]#si', '\\1', $text); $text = preg_replace('#\[i\](.*?)\[/i\]#si', '\\1', $text); $text = preg_replace('#\[u\](.*?)\[/u\]#si', '\\1', $text); $text = preg_replace('#(\[quote\]|\[quote\]
    )(.*?)(\[/quote\]
    |\[/quote\])#si', '\\1', $text); $text = preg_replace('#\[img\](.*?)\[/img\]#si', '', $text); $text = preg_replace('#\[size=(.*?)\](.*?)\[/size\]#si', '\\2', $text); $text = preg_replace('#\[list=(.*?)\](.*?)\[/list\]#si', '\\2', $text); $text = preg_replace('#\[list\](.*?)\[/list\]#si', '\\1', $text); $text = preg_replace('#\[\*\](.*?)
    #si', '\\1
    ', $text); return $text; } function click() { $click = validator($_GET['click']); if (is_numeric($click)) { $query = update('sites', 'clicks = clicks+1', 'id = "'.$click.'"'); $select_url = select('sites', 'url', 'id = "'.$click.'"', '', ''); if ($select_url[0]['url'] != '') { $IDN = new idna_convert(); header('Location: http://'.$IDN->encode($select_url[0]['url'])); exit(); } } } function views() { if ($_GET['action'] == 'cat') { $query = update('categories', 'views = views+1', 'id = "'.validator($_GET['id']).'"'); } elseif ($_GET['action'] == 'sub') { $query = update('subcategories', 'views = views+1', 'id = "'.validator($_GET['id']).'"'); } elseif ($_GET['action'] == 'site') { $query = update('sites', 'views = views+1', 'id = "'.validator($_GET['id']).'"'); } } function getRealIpAddr() { if (!empty($_SERVER['HTTP_CLIENT_IP'])) $ip = $_SERVER['HTTP_CLIENT_IP']; elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; else $ip = $_SERVER['REMOTE_ADDR']; return $ip; } function sessions($session) { $host = validator($_SERVER['HTTP_HOST']); $ip = validator(getRealIpAddr()); $referer = str_replace('http://', '', validator($_SERVER['HTTP_REFERER'], 5, 350)); $user_agent = validator($_SERVER['HTTP_USER_AGENT']); $request_url = validator($_SERVER['REQUEST_URI'], 5, 350); $query_del = delete('sessions', 'time < "'.(time()-5*60).'"'); $check_user = select('sessions', 'session', 'session = "'.$session.'"', '', ''); if ($check_user[0]['session'] != '') { $query = update('sessions', 'referer = "'.$referer.'", request_url = "'.$request_url.'", time = "'.time().'"', 'session = "'.$session.'"'); } else { $query = insert('sessions', 'host = "'.$host.'", ip = "'.$ip.'", referer = "'.$referer.'", user_agent = "'.$user_agent.'", request_url = "'.$request_url.'", time = "'.time().'", session = "'.$session.'"'); } if ($GLOBALS['cfg']['bot'] == 1) { $RobotArray = explode('
    ', $GLOBALS['cfg']['bot_robots']); $CurrentPage = md5($request_url); $CurrentBot = strtolower($user_agent); foreach ($RobotArray as $key => $value) { if (preg_match(sprintf("/%s/", trim($value)), $CurrentBot)) { $bot = $value; break; } } if (isset($bot)) { $check_bot = select_count('robots', 'bot = "'.$bot.'" && url = "'.$CurrentPage.'"', 1); if ($check_bot > 0) $query = update('robots', '`count`=`count`+1', 'bot = "'.$bot.'" && url = "'.$CurrentPage.'"'); else $query = insert('robots', 'bot = "'.$bot.'", url = "'.$CurrentPage.'", `count` = "1"'); } $select_bot = select('robots', 'bot, `count`', 'url = "'.$CurrentPage.'" && bot != ""', 'bot desc', ''); } else $select_bot = array(); return $select_bot; } function filter($text) { if ($GLOBALS['cfg']['filter'] != '') { $words = explode(' ',str_replace(array(',','.','?','!'),array(' ',' ',' ',' '),strtolower($text))); $keyword=explode('
    ',str_replace("\r", '', strtolower($GLOBALS['cfg']['filter']))); for($i=0; $i 1) { if (strpos($text, $keyword[$i])) $check[$i] = 1; } else { if(in_array($keyword[$i],$words)) $check[$i]= 1; } if ($check[$i] == 1) $filter_keywords .= '\''.$keyword[$i].'\' '; } } return $filter_keywords; } function filter_spam($name, $type) { $select_spam = select('spam', $type, $type.' != ""', '', ''); for ($i=0; $i', '#', '%'), array('', '', ''), $desc))); if ($explode_desc[0] == '') $explode_desc[0] = $sites[$i]['description']; $j=0; $s=0; $rand_desc = ''; while (mb_strlen($rand_desc, $GLOBALS['lang'][0]) < 150) { if ($j==0) { $j = rand(0, count($explode_desc)-1); $rand_desc = $explode_desc[$j].'. '; $j+=1; } else { if ($explode_desc[$j] != '') { $rand_desc .= $explode_desc[$j].'. '; $j+=1; } else $j=0; } $s+=1; if ($s > 20) break; } if ($s > 20) $_SESSION['error'] = $GLOBALS['lang'][757]; else { header('Location: http://www.google.pl/search?hl=pl&q='.urlencode(htmlspecialchars_decode($rand_desc))); header("Connection: close"); exit(); } } else $_SESSION['error'] = $GLOBALS['lang'][984]; } ?>