<?php
session_start();
if (isset($_SESSION['LAST_ACTIVITY']) && (time() - $_SESSION['LAST_ACTIVITY'] > 300)) {
// last request was more than 30 minutes ago
session_unset(); // unset $_SESSION variable for the run-time
session_destroy(); // destroy session data in storage
}
$_SESSION['LAST_ACTIVITY'] = time(); // update last activity time stamp
// $remoteip="82.235.57.72"; // french test ip
// $remoteip="75.151.73.2"; // us test ip
//$remoteip="88.84.94.87"; // es test ip
//$remoteip="95.174.21.26"; // it test ip
//$remoteip="192.64.7.32"; //ca test ip
//$remoteip="84.16.80.94"; //ch test ip
//$remoteip="193.191.209.5"; //be test ip
//$remoteip="178.208.175.66"; //gb test ip
//$remoteip="217.115.130.230"; //de test ip
//$remoteip="83.175.120.14"; //at test ip
//$remoteip="145.247.195.5"; //fi test ip
//$remoteip="40.83.13.140"; // mexico test ip
//$remoteip="66.249.66.1"; // GOOGLE BOT test ip
if (strpos($_SERVER['HTTP_HOST'],"vulcan-preview.com") !== false) {
putenv(sprintf('%s=%s', 'APP_ENV', "staging"));
putenv(sprintf('%s=%s', 'RBO_URL', "https://rbo.vulcan-preview.com"));
} else {
putenv(sprintf('%s=%s', 'RBO_URL', "http://www.bonus-casino-en-ligne.info"));
}
if (strpos($_SERVER['HTTP_HOST'], ".") === false) {
$localmode = true;
} else {
$localmode = false;
}
if ($localmode) {
error_reporting(E_ALL & ~E_NOTICE);
} else {
error_reporting(0);
}
@include_once("checkmobile.php");
if (isset($_SERVER['HTTP_USER_AGENT']) and stripos($_SERVER['HTTP_USER_AGENT'], "Lighthouse") !== false) {
$no_3rd_party = 1;
}
if (isset($isrealphone) and $isrealphone) {
$univ_device_type = "dv_mobile";
} elseif (isset($istablet) and $istablet) {
$univ_device_type = "dv_tablet";
} else {
$univ_device_type = "dv_general";
}
if ($_GET['dev'] and univ_isbot()) {
die("for developers only");
}
if (!isset($_SERVER['HTTPS']) or $_SERVER['HTTPS'] == "off") {
$site_protocol = "http://";
} else {
$site_protocol = "https://";
}
$rootpath = $site_protocol . $_SERVER['HTTP_HOST'];
if (preg_match("@([^\?]+)(.*)@", $_SERVER['REQUEST_URI'], $matches)) {
$s1111 = preg_replace("@^(/[^/\.]+)$@", "$1/", $matches[1], -1, $count);
if ($count) {
header("Location: $site_protocol{$_SERVER['HTTP_HOST']}$s1111{$matches[2]}", TRUE, 301);
exit;
}
}
$real_redirect_url = $_SERVER['REDIRECT_URL'];
$_SERVER['REDIRECT_URL'] = preg_replace("@\?.*$@", "", $_SERVER['REQUEST_URI']);
if (!preg_match("@^/[a-zA-Z0-9\-_\!/\.]*$@", $_SERVER['REDIRECT_URL'])) {
die; // to avoid mysql injection
}
if ($_GET) {
foreach ($_GET as $gett) {
if (strpos($gett, "'") !== false) {
die;
}
}
}
$exclusivebonusorder["casino"] = array(0 => "bcel", 1 => "clf",2=>'pel',3=>'gr2'); // bin 1=bcel, 10=clf
$exclusivebonusorder["sport"] = array(0 => "pel");
$alt_ips = array(
"bl" => "fr",
"gf" => "fr",
"gp" => "fr",
"mf" => "fr",
"mq" => "fr",
"nc" => "fr",
"pf" => "fr",
"pm" => "fr",
"re" => "fr",
"tf" => "fr",
"wf" => "fr",
"yt" => "fr"
);
$dont_use_general_when_top_missing = array("fr", "be", "ch", "ca");
mysqli_query($mysqlilink, "set time_zone = '+1:00'"); // set to french time in winter
if ($localmode) $devsource = "http://bcel";
else $devsource = $devsource = getenv('RBO_URL');
$sitedata = sitedata();
$sitelan = $sitedata['lan'];
$mastershort = $sitedata['parent_site'] or $mastershort = $sitedata['samerootas'] or $mastershort = $sitedata['short'];
$master_short = $mastershort;
if (function_exists("dict")) $dict = dict();
//$all301=array();
//$all301freegames=array();
if ($sitedata['using_template'] == "bcel") {
$lansandfreegameurl = array("fr" => "jeux-gratuits",
"en" => "free-games",
"de" => "gratis-casino-spiele",
"es" => "juegos-gratis",
"fi" => "ilmaispelit",
"sv" => "gratis-casinospel",
"no" => "gratis-kasinospill",
"pt" => "jogos-gratis",
"ie" => "free-games"
);
$freegamesurlpattern = $lansandfreegameurl[$sitelan];
$freegamesurllen = strlen($freegamesurlpattern);
}
if ($sitedata['wholesite301']) {
header("Location: {$sitedata['wholesite301']}", TRUE, 301);
die;
}
process_special_text_file();
switch ($_GET['function']) {
case "siteip":
echo $_SERVER['SERVER_ADDR'];
die;
case "getfile":
switch ($_GET['type']) {
case "css":
$uname = $_GET['file'];
preg_match("@(.+/)(.+)@", $uname, $matches);
$uname = $matches[1] . strtr(urlencode($matches[2]), array("+" => "%20"));
$fileg = file_get_contents($uname);
$fileg = preg_replace("@(\.\.)?/devimg/@", "$devsource/dev/{$sitedata['using_template']}/devimg/", $fileg);
if ($dictforcss) {
$fileg = strtr($fileg, $dictforcss);
}
header("Content-type: text/css");
echo $fileg;
die;
case "js":
$uname = $_GET['file'];
preg_match("@(.+/)(.+)@", $uname, $matches);
$uname = $matches[1] . strtr(urlencode($matches[2]), array("+" => "%20"));
$fileg = file_get_contents($uname);
header("Content-type: application/javascript");
echo $fileg;
die;
}
}
$sitetypegeneral = sitetypegeneral();
general_setup();
if ($_GET['dev'] == '0') {
SetCookie("dev", 0, 0, "/");
SetCookie("devcss", "", 0, "/");
SetCookie("devjs", "", 0, "/");
$_COOKIE['dev'] = 0;
} elseif ($_GET['dev'] == '1') {
SetCookie("dev", 1, 0, "/");
$_COOKIE['dev'] = 1;
}
if ($_COOKIE['dev']) {
$devmode = 1;
$no_3rd_party = 1;
if ($_GET['css']) {
SetCookie("devcss", $_GET['css'], 0, "/");
$_COOKIE['devcss'] = $_GET['css'];
}
if ($_COOKIE['devcss']) {
$srccss = urlencode("$devsource/dev/{$sitedata['using_template']}/devcss/" . $_COOKIE['devcss']);
$univ_csspath = "/?function=getfile&type=css&file=$srccss";
}
if ($_GET['js']) {
SetCookie("devjs", $_GET['js'], 0, "/");
$_COOKIE['devjs'] = $_GET['js'];
}
if ($_COOKIE['devjs']) {
$srcjs = urlencode("$devsource/dev/{$sitedata['using_template']}/devjs/" . $_COOKIE['devjs']);
$univ_jspath = "/?function=getfile&type=js&file=$srcjs";
}
$devsticker = <<<A
<div id='devsticker' style='z-index: 999; background:green;opacity: 0.8;position: fixed;width: 100px;padding:5px 5px 20px; color:#fff; border-radius:10px;top:5px;left:5px; padding:5px 10px; border:1px #fff solid;'>
<a style='position:absolute; top:0; right:3px; display:block; color:#fff; text-decoration:none;' onclick='document.getElementById("devsticker").style.display = "none";' href='#'>X</a>
<p>css: {$_COOKIE['devcss']}</p>
<p>js: {$_COOKIE['devjs']}</p>
<a style='color:#fff;' href='/?dev=0'>exit dev</a>
</div>
A;
}
if (!$maintable) $maintable = $sitedata['db_tables'];
if ($sitelan == "fr") {
$colon = " :";
} else {
$colon = ":";
}
if ($ismobilephone) {
$freegamenewvar = array("folder" => "t", "maindb" => "freegamenewtouch", "datadb" => "freegamenew_mobile", "src" => "freegamenewtouch_src");
$platform = "mobile";
} else {
$freegamenewvar = array("folder" => "f", "maindb" => "freegamenew", "datadb" => "freegamenew_pc", "src" => "freegamenew_src");
$platform = "pc";
}
if (is_array($exclusivebonusorder[$sitetypegeneral]) and in_array($sitedata['using_template'], $exclusivebonusorder[$sitetypegeneral])) {
$exclusivecri_t = array_search($sitedata['using_template'], $exclusivebonusorder[$sitetypegeneral]);
$exclusivecri_t = pow(2, $exclusivecri_t);
$exclusivecri = " AND (is_exclusive_bonus =0 OR is_exclusive_bonus & $exclusivecri_t = $exclusivecri_t )";
$exclusivecrionly = " AND is_exclusive_bonus & $exclusivecri_t = $exclusivecri_t";
} else {
$exclusivecri = " AND (is_exclusive_bonus =0 OR is_exclusive_bonus & 64 = 64 )"; // for others sites 1000000 = exclusive
$exclusivecrionly = "";
}
// do redirection to https if the site is set as https
if (!$localmode and (!isset($_SERVER['HTTPS']) or $_SERVER['HTTPS'] == "off") and $sitedata['protocol'] == "https") {
$urinq = preg_replace("@\?.*$@", "", $_SERVER['REQUEST_URI']);
if ($_SERVER['QUERY_STRING']) $uriquery = "?{$_SERVER['QUERY_STRING']}";
header("Location: https://{$sitedata['url']}$urinq$uriquery", TRUE, 301);
}
if (preg_match("@^/robots\.txt(\?.*|)$@", $_SERVER['REQUEST_URI'])) {
if ($master_short == "bcel") {
if ($sitedata['short'] == "bcel") $lan = "fr";
else $lan = substr($sitedata['short'], 4);
$robotstext = <<<A
User-Agent: *
Disallow: /casino/
Disallow: /tc/
Disallow: /thankyou.html
Disallow: /showgames.php
Disallow: /adminpreview.html
Disallow: /sitesearch.php
A;
} else {
if (preg_match("@^(/.+/)@U", $sitedata['vlink_format'], $matches)) $vl = $matches[1];
else $vl = "/go/";
$vm = "/tc/";
if ($sitedata['children_suffix']) {
$ex = "";
$e = explode(",", $sitedata['children_suffix']);
foreach ($e as $ee) {
$ex .= "\r\nDisallow: $ee$vl";
$ex .= "\r\nDisallow: $ee$vm";
}
}
$robotstext = <<<A
User-agent: *
Disallow: $vl
Disallow: $vm$ex
A;
}
$morerobotstext = trim($sitedata['robotstxt']);
if ($morerobotstext) $robotstext .= "\r\n$morerobotstext";
$robotstext .= "\r\nSitemap: $site_protocol{$_SERVER['HTTP_HOST']}/sitemap.xml";
header("Content-Type: text/plain");
echo $robotstext;
exit;
}
if ($_GET['testip']) {
$remoteip = $_GET['testip'];
$istest = 1;
} else {
if ( isset( $_SERVER['CF-Connecting-IP'] ) ) {
$http_x_headers = explode( ',', $_SERVER['CF-Connecting-IP'] );
$_SERVER['REMOTE_ADDR'] = $http_x_headers[0];
}
else if ( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
$http_x_headers = explode( ',', $_SERVER['HTTP_X_FORWARDED_FOR'] );
$_SERVER['REMOTE_ADDR'] = $http_x_headers[0];
}
$remoteip = $_SERVER['REMOTE_ADDR'];
}
if (preg_match("@^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$@", $remoteip))
$useipv4 = 1;
elseif (preg_match("@^[0-9a-f]+\:[0-9a-f]+\:[0-9a-f]+\:[0-9a-f]+\:[0-9a-f]+\:[0-9a-f]+\:[0-9a-f]+\:[0-9a-f]+$@i", $remoteip))
$useipv6 = 1;
else $ipisinvalid = 1;
$nightmode = false;
if ($_GET['admin'] == "1" and $_GET['time'] and preg_match("@([0-9][0-9])([0-9][0-9])@", $_GET['time'], $matches)) {
$nowstring = "TIMESTAMP(date(now()),'{$matches[1]}:{$matches[2]}')";
if ($matches[1] >= 20 or $matches[1] < 7) $nightmode = true;
} else {
$nowstring = "NOW()";
if (in_array(date("N"), array(6, 7)) or date("G") < 7 or date("G") >= 20) $nightmode = true;
}
if (!$dontcheckcountry) univ_ipcountry();
if (file_exists("{$sitedata['short']}_301.txt")) {
$requestUri = $_SERVER["REQUEST_URI"];
$lines = file("{$sitedata['short']}_301.txt", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
global $ipcountry;
foreach ($lines as $line) {
list($originalUrl, $targetUrl, $country) = explode('=>', $line, 3);
if (!$country) {
$country = $ipcountry;
}
if (strtolower($originalUrl) === strtolower($requestUri) && $country === $ipcountry) {
switch ($targetUrl) {
case "410":
header($_SERVER["SERVER_PROTOCOL"] . " 410 Gone");
if ($sitedata['using_template'] == "bcel") {
$_SERVER['REQUEST_URI'] = "/404.html";
} else {
die;
}
break;
default:
header("Location: $targetUrl", TRUE, 301);
die;
}
}
}
}
settimezone();
delete_useless_files();
$all_good_cbp = all_good_cbp();
if ($sitelan == "de" and $ipcountry == "de") {
$univ_popup_closebuttonnoshow = " style='display:none;'";
$univ_popup_overlay_opaque = " style='opacity:1.0;'";
}
$block_popup = block_popup();
if ($sitedata['using_template'] == "bcel") {
$cbp = cbp($sitetypegeneral);
}
$univ_orders = univ_orders();
// block these ips in working time only
$citiestoblock = array(
"franconville",
"franconville la garenne",
"saint-leu-la-forêt",
"le plessis-bouchard",
"delacroix",
"mare des noues",
"saint-prix",
"fontaine bertin",
"beauchamp",
"cormeilles-en-parisis",
"argenteuil",
"ermont",
"eaubonne",
"sannois",
"montigny-lès-cormeilles",
"la frette-sur-seine",
"herblay",
"soisy-sous-montmorency",
"montmorency",
"pierrelaye",
"taverny",
"saint-gratien",
"asnières",
"vert",
"clichy",
"nanterre",
"garges-lès-gonesse",
"la garenne-colombes",
"saint-cloud",
"nanterre",
"sarcelles",
"omerville",
"viesly",
"hazebrouck",
"le quesnoy-en-artois",
"villejuif",
"annoeullin",
"fontenay-le-fleury",
"asnieres-sur-seine",
"vert",
"clichy",
"neuilly-sur-seine",
"jouy-le-moutier",
"melun",
"montrouge",
"meudon",
"vanves",
"issy-les-moulineaux",
"malakoff",
"boulogne-billancourt",
"saint-cloud",
"clamart",
"châtillon",
"bagneux",
"sèvres",
"fontenay-aux-roses",
"paris"
);
$regionstoblock = array("idf"); // lower case
if (should_block($remoteip)) {
univ_text_for_blocking();
exit;
global $blockreason;
global $istest;
$c = mres($blockreason);
$url = mres($_SERVER['REQUEST_URI']);
if (!$istest) {
$istest = "NULL";
}
$p = "INSERT INTO live_block_history (short,url,ip,reason,istest,visittime)
VALUES ('{$sitedata['short']}', '$url', '$remoteip', '$c', $istest, NOW())";
$getraysdb = getenv('GETRAYSDB') ?: 'getraysdb.php';
$path = getenv('RBO_URL').'/'.$getraysdb;
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible;)");
curl_setopt($ch, CURLOPT_URL, $path);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
$post['mycode'] = "0fsqr&^hhl@*&^ddONPPdeafdazvqwre1289de09Lhhkqlr";
$post['mysql'] = $p;
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$response = curl_exec($ch);
$errr = curl_error($ch);
curl_close($ch);
exit;
}
if (preg_match("@/univemail\.html$@", $_SERVER['REQUEST_URI'])) {
if (!$_POST) {
die;
}
$_POST = univ_stripslashes_deep($_POST);
$sitename = $sitedata['url'];
$name = $_POST['name'];
$mailTo = "{$sitename} <website@bluewindowltd.com>";
$mailFrom = $_POST['email'];
$mailFrom = $name . " <" . $mailFrom . ">";
$message = $_POST['message'];
$message = preg_replace("/(.+)/", "$1<br /><br />", $message);
$subject = $_POST['subject'];
// subject
if (!$subject) {
$subject = "A message regarding $sitename";
}
// message
$message = '
<html>
<head>
<title> </title>
</head>
<body style="font-family:Verdana, Geneva, sans-serif; font-size:12px; color:#222222;">
<p>' . $message . '</p>
<br /><br /><br />
</body>
</html>
';
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-type: text/html; charset="utf-8";' . "\n";
$headers .= 'Content-Transfer-Encoding: 8bit' . "\n";
// Additional headers
$headers .= 'To: ' . $mailTo . "\n";
$headers .= 'From: ' . $mailFrom . "\n";
$headers .= "\n";
// Mail it
mail($mailTo, $subject, $message, $headers);
die;
}
if (preg_match("@/go2/(.+)/@U", $_SERVER['REQUEST_URI'], $matches)) {
if ($_GET['delay']) {
$delay = $_GET['delay'];
} else {
$delay = 0;
}
if ($_GET['special']) {
$special = $_GET['special'];
} else {
$special = "";
}
gotovisit_real($matches[1], $delay, $special);
die;
}
if (preg_match("@^/4-0-4\.html@", $_SERVER['REQUEST_URI']) or preg_match("@^/4-0-4\.html@", $real_redirect_url)) {
univ_process404();
}
if (preg_match("@^/check_something\.html@", $_SERVER['REQUEST_URI']) or preg_match("@^/check_something\.html@", $real_redirect_url)) {
check_something();
}
if (preg_match("@/sitemap\.xml$@", $_SERVER['REQUEST_URI'])) {
if (function_exists("sitemapxmlbcel")) {
sitemapxmlbcel();
} elseif (function_exists("sitemapxmlclf")) {
sitemapxmlclf();
} elseif (function_exists("sitemapxmltcc")) {
sitemapxmltcc();
} else {
sitemapxml();
}
exit;
}
if (preg_match("@adminpreview\.html@", $_SERVER['REQUEST_URI'])) {
array_walk_recursive($_POST, "admin_mystripslashes");
array_walk_recursive($_POST, "admin_mytrim");
$previewmode = true;
$tablename = $_POST['tablename'];
$draftid = $_POST['draftid'];
if (!$_POST['table_id']) {
$newarticle = 1;
}
$previewtail[$tablename] = "_temp" . time() . rand(0, 9999999);
mnq("CREATE TEMPORARY TABLE {$tablename}{$previewtail[$tablename]} LIKE $tablename");
$u = array();
$query = "SHOW COLUMNS FROM {$tablename}{$previewtail[$tablename]}";
$result = mnq($query);
while ($r = mfs($result)) {
$u[$r['Field']] = $_POST['f_' . $r['Field']];;
}
if ($newarticle) {
switch ($tablename) {
case "news":
$u['page_url'] = "/news/1.html";
break;
default:
if (!$u['page_url']) $u['page_url'] = "/1.html";
}
}
// images and quote need to change
if (array_key_exists("quotes", $u)) {
$u['quotes'] = getquotesfromarray($_POST);
}
if (array_key_exists("images", $u)) {
$u['images'] = getimagesfromarray($_POST, $u['images']);
}
switch ($_POST['imgselect0']) {
case "":
if (array_key_exists('image', $u)) {
$u['image'] = "";
} elseif (array_key_exists('pic_url', $u)) {
$u['pic_url'] = "";
}
break;
case "ori":
break;
default:
if (array_key_exists('image', $u)) {
$u['image'] = "~~temp~~$draftid~{$_POST['imgselect0']}";
} elseif (array_key_exists('pic_url', $u)) {
$u['pic_url'] = "~~temp~~$draftid~{$_POST['imgselect0']}";
}
}
if ($_POST['imgwidth0'] and array_key_exists("picmain_width", $u)) {
$u['picmain_width'] = $_POST['imgwidth0'];
}
if ($_POST['imgheight0'] and array_key_exists("picmain_height", $u)) {
$u['picmain_height'] = $_POST['imgheight0'];
}
$_SERVER['REQUEST_URI'] = $u['page_url'];
$_SERVER['REDIRECT_URL'] = $u['page_url'];
$sitetypegeneral = sitetypegeneral();
// put data into the temp table
$ff = array();
//unset($u['id']);
$u['id'] = 1;
if ($sitedata['parent_site']) {
$u['subsite'] = substr($sitedata['root'], 0, -1);
}
foreach ($u as $ui => $un) {
if ($un) {
$ff[] = "`$ui`='" . mres($un) . "'";
}else{
$ff[] = "`$ui`=NULL";
}
}
$ffs = implode(",", $ff);
$q = "INSERT INTO {$tablename}{$previewtail[$tablename]} SET $ffs";
if (!mnq($q)) {
die("Error updating DB: $q " . mer());
}
} elseif (preg_match("@^\/admin\.html@", $_SERVER['REQUEST_URI'])) {
if ($_GET['updatemd5']) {
$update_md5 = update_md5($_GET['updatemd5']);
header("Content-Type: text/plain");
echo $update_md5;
} elseif ($_GET['updatefreegameimages']) {
$query = "SELECT t1.* FROM freegamenew AS t1 LEFT JOIN freegamenew_pc AS t2 ON t1.id_unique=t2.id_unique WHERE t2.status=1";
$result = mnq($query);
$gameswithimages = array();
while ($r = mfs($result)) {
if ($r['md5']) {
if (@md5_file($_SERVER['DOCUMENT_ROOT'] . "/img/f/{$r['id_unique']}.jpg") != $r['md5']) {
$f = @file_get_contents_https(getenv('RBO_URL')."/img/f/{$r['id_unique']}.jpg");
if ($f) {
if (file_put_contents( $_SERVER['DOCUMENT_ROOT'] . "/img/f/{$r['id_unique']}.jpg", $f) !== false) {
$gameswithimages[] = $r['id_unique'];
}
}
} else {
$gameswithimages[] = $r['id_unique'];
}
}
}
$gameswithimages = implode(",", $gameswithimages);
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/freegamenew.txt", $gameswithimages);
$query = "SELECT t1.* FROM freegamenewtouch AS t1 LEFT JOIN freegamenew_mobile AS t2 ON t1.id_unique=t2.id_unique WHERE t2.status=1";
$result = mnq($query);
$gameswithimages = array();
while ($r = mfs($result)) {
if ($r['md5']) {
if (@md5_file($_SERVER['DOCUMENT_ROOT'] . "/img/t/{$r['id_unique']}.jpg") != $r['md5']) {
$f = @file_get_contents_https(getenv('RBO_URL')."/img/t/{$r['id_unique']}.jpg");
if ($f) {
if (file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/img/t/{$r['id_unique']}.jpg", $f) !== false) {
$gameswithimages[] = $r['id_unique'];
}
}
} else {
$gameswithimages[] = $r['id_unique'];
}
}
}
$gameswithimages = implode(",", $gameswithimages);
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/freegamenewtouch.txt", $gameswithimages);
echo "done";
} elseif ($_GET['sync_old_rating']) {
if ( isset( $_SERVER['CF-Connecting-IP'] ) ) {
$http_x_headers = explode( ',', $_SERVER['CF-Connecting-IP'] );
$_SERVER['REMOTE_ADDR'] = $http_x_headers[0];
}
else if ( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
$http_x_headers = explode( ',', $_SERVER['HTTP_X_FORWARDED_FOR'] );
$_SERVER['REMOTE_ADDR'] = $http_x_headers[0];
}
$remoteip = $_SERVER['REMOTE_ADDR'];
if ($remoteip != "212.175.114.34") {
die;
}
$s = array();
$query = "SELECT * FROM {$sitedata['short']}_rating_live WHERE cat IS NOT NULL and howmanyvotes is not null and votessum is not null";
$result = mnq($query);
if ($result) {
while ($r = mfs($result)) {
$s[$r['cat']] .= "{$r['rating_id']} {$r['votessum']} {$r['howmanyvotes']}\n";
}
if (!$s) die("no data");
foreach ($s as $c => $o) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible;)");
curl_setopt($ch, CURLOPT_URL, getenv('RBO_URL')."/sync_old_rating.php");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
$post['mycode'] = "zMdq2#a!iq^#jqP092MnUdejJd^d128dYumwII0)sqjWudWbl(";
$post['short'] = $sitedata['short'];
$post['data'] = $o;
$post['cat'] = $c;
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$response = curl_exec($ch);
$errr = curl_error($ch);
curl_close($ch);
echo $response;
}
} else die("$query: n/a");
}
die;
}
if ($ipcountry and $ipcountry != "others")
$bonus_ipcontrol = " AND (NULLIF(ipcontrol,'') IS NULL or if (instr(ipcontrol, 'not for'), FIND_IN_SET('{$GLOBALS['ipcountry']}',replace(ipcontrol,'not for ',''))=0, FIND_IN_SET('{$GLOBALS['ipcountry']}',ipcontrol)))";
if ($sitedata['lan'] == "en" and $ipcountry == "gb") {
$nofreegame = 1;
}
if (preg_match("@/sitemap\.html\?*@", $_SERVER['REQUEST_URI'])) {
if (!in_array($master_short, array("bcel", "clf"))) {
$maintable = $sitedata['db_tables'];
if ($master_short == "tcc" or $master_short == "tccdede") {
$maintable = "tcc_site";
}
$is_univ_sitemap = 1;
if (!isset($site_table_criteria)) $site_table_criteria = site_table_criteria();
$sitemaphtml = mres(af_listpagesofsite());
$querysitemap = "SELECT id FROM $maintable{$GLOBALS['previewtail'][$maintable]} WHERE page_url = '/sitemap.html'$site_table_criteria and theorder>0";
$resultsitemap = mnq($querysitemap);
if (mnr($resultsitemap)) {
$rsq = mfs($resultsitemap);
$qsp = "UPDATE $maintable{$GLOBALS['previewtail'][$maintable]} SET maintext = '$sitemaphtml' WHERE id={$rsq['id']}";
mnq($qsp);
} else {
if ($site_table_criteria) {
$addccc = "," . strtr($site_table_criteria, array("AND " => "", "IS NULL" => "= NULL"));
}
$metatitle_field = metatitle_field($maintable);
$qsp = "INSERT INTO $maintable{$GLOBALS['previewtail'][$maintable]}
SET page_url='/sitemap.html', maintitle='SITE MAP', maintext='$sitemaphtml', $metatitle_field='Site Map', theorder=1$addccc
";
mnq($qsp);
}
}
}
switch ($sitedata['using_template']) {
case "1":
case "2":
updatefiles($sitedata['using_template']);
break;
}
//functions begin
function settimezone()
{
global $sitelan;
global $ipcountry;
$timezonesbylan = array(
"en" => "America/New_York",
"es" => "Europe/Madrid",
"de" => "Europe/Berlin",
"fi" => "Europe/Helsinki",
"sv" => "Europe/Stockholm",
"no" => "Europe/Oslo",
"fr" => "Europe/Paris",
"pl" => "Europe/Warsaw",
"pt" => "America/Sao_Paulo",
);
$timezonesbycountry = array(
"fr" => "Europe/Paris",
"ca" => "America/Toronto",
"be" => "Europe/Brussels",
"ch" => "Europe/Zurich",
"us" => "America/New_York",
"es" => "Europe/Madrid",
"gb" => "Europe/London",
"at" => "Europe/Vienna",
"de" => "Europe/Berlin",
"fi" => "Europe/Helsinki",
"se" => "Europe/Stockholm",
"no" => "Europe/Oslo",
"in" => "Asia/Calcutta",
"mx" => "America/Mexico_City",
"ar" => "America/Argentina/Buenos_Aires",
"cl" => "America/Santiago",
"au" => "Australia/Sydney",
"nz" => "Pacific/Auckland",
"za" => "Africa/Johannesburg",
"co" => "America/Bogota",
"pe" => "America/Lima",
"ve" => "America/Caracas",
"pr" => "America/Puerto_Rico",
"ma" => "Africa/Casablanca",
"dz" => "Africa/Algiers",
"tn" => "Africa/Tunis",
"sn" => "Africa/Dakar",
"mu" => "Indian/Mauritius",
"ga" => "Africa/Libreville",
"pl" => "Europe/Warsaw",
"br" => "America/Sao_Paulo",
);
$t = $timezonesbycountry[$ipcountry] or $t = $timezonesbylan[$sitelan];
if ($t) date_default_timezone_set($t);
}
function cryptocurrencies()
{
$a = array(
"BTC" => "Bitcoin",
"ETH" => "Ethereum",
"XRP" => "Ripple",
"BCH" => "Bitcoin Cash",
"XLM" => "Stellar",
"EOS" => "EOS.IO",
"ADA" => "Cardano",
"DASH" => "Dash",
"NMC" => "Namecoin",
"PPC" => "Peercoin",
"DOGE" => "Dogecoin",
);
return $a;
}
function processcssfiles($mainscss, $mobilecss = "", $mainscssreplace = "", $mobilecssreplace = "", $extraformaincss = "")
{
global $ismobilephone;
global $allresponsive;
global $localmode;
$cssquote = preg_quote($mainscss);
if (preg_match("@^$cssquote@", $_SERVER['REQUEST_URI'])) {
header("Content-type: text/css");
$css = file_get_contents($_SERVER['DOCUMENT_ROOT'] . $mainscss);
if ($extraformaincss) {
$css = preg_replace("@\*\*extracss\*\*@", $extraformaincss, $css, -1, $count);
if (!$count) $css .= $extraformaincss;
}
if ($mainscssreplace) $css = strtr($css, $mainscssreplace);
if (($ismobilephone or $allresponsive) and $mobilecss) {
$mcss = file_get_contents($_SERVER['DOCUMENT_ROOT'] . $mobilecss);
if ($mobilecssreplace) $mcss = strtr($mcss, $mobilecssreplace);
$css .= $mcss;
}
if (!$localmode) {
// Remove comments
$css = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $css);
// Remove space after colons
$css = str_replace(': ', ':', $css);
// Remove whitespace
$css = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $css);
}
echo $css;
exit;
}
}
function showthisgamenew2020()
{
global $site;
global $nofreegame;
if ($nofreegame) {
return;
}
$site['address'] = htmlspecialchars(trim($site['address']));
$js = "
<div class='iframe'>
<iframe src=\"{$site['address']}\" scrolling='no' frameborder='0' allowfullscreen></iframe>
</div>";
return $js;
}
function showthisgamenew($finalwidth, $test = 0)
{
global $sitelan;
global $site;
global $ismobilephone;
global $nofreegame;
if ($nofreegame) return;
$site['address'] = trim($site['address']);
if (substr($site['address'], 0, 1) != "<") {
$useframe = true;
}
$realwidth = 800;
$realheight = 600;
$divheight = (int) ($realheight * $finalwidth / $realwidth);
$framewidth = $finalwidth;
$frameheight = (int) ($realheight * $finalwidth / $realwidth);
if ($test) {
$site['address'] = "http://bcel/freegametest.php";
}
$js .= "<div style='overflow:hidden;height:{$divheight}px;width:{$framewidth}px;float:left;'>";
if ($useframe) {
$site['address'] = htmlspecialchars($site['address']);
$js .= "<iframe$siteemovetop src=\"{$site['address']}\" width={$framewidth}px height={$frameheight}px scrolling=no frameborder=no></iframe>";
} else {
$js .= "<div$siteemovetop style='width:{$framewidth}px; height:{$frameheight}px;'>{$site['address']}</div>";
}
$js .= "</div>";
return $js;
}
function addboxes($element)
{
$s = $element['maintext'];
if ($element['textinbox'][0]) {
$s = preg_replace("#(.+)(^.+<h2>)#ism", "$1*(r)e1*$2", $s);
}
if ($element['textinbox'][1]) {
$s = preg_replace("#(.+</h2>\r\n)#ism", "$1*(l)p1*", $s);
}
return $s;
}
function issubtitle($s)
{
$nottitle = false;
$s = trim($s);
$st = preg_split("@<b>(.*)</b>@U", $s, -1);
foreach ($st as $stt) {
if (strlen(trim($stt)) > 0) {
$nottitle = true;
break;
}
}
return !$nottitle;
}
function tagb2h($s, $h = "h2")
{
$ss = explode("\r\n", $s);
foreach ($ss as &$s) {
if (issubtitle($s)) {
$s = strtr($s, array("<b>" => "", "</b>" => "", "<B>" => "", "</B>" => ""));
$s = "<$h>$s</$h>";
}
}
return implode("\r\n", $ss);
}
function addkeywords($s, $tablename, $fieldname = "maintext")
{
return $s;
}
function modifykeywords()
{
global $keywords;
global $keywordsautoupdate;
$final = array();
$ee = explode("\n", $keywords);
foreach ($ee as $e) {
preg_match("@^(.*)=>(.+)@", $e, $matches);
if ($matches[1]) {
$e = trim($matches[1]);
$link = trim($matches[2]);
} else $link = "/";
$e = trim(strtolower($e));
if ($e) {
$kqm[$link][] = $e;
}
}
$kqm = super_unique($kqm);
foreach ($keywordsautoupdate as $tablename => $queryandfields) {
$query = $queryandfields[0];
$result = mnq($query);
while ($r = mfa($result)) {
if (!$kqm) break 2;
foreach ($queryandfields[1] as $fieldname) {
$s[$fieldname] = preg_replace("@<a .*/a>|<img .*>|<script .*/script>|<h2.*/h2>@isU", "", $r[$fieldname]);
}
foreach ($kqm as $kkey => &$kq) {
foreach ($kq as $i => $q) {
$qq = preg_quote($q);
foreach ($s as $fn => $si) {
$si = preg_replace("@(\PL|^|')($qq)(\PL|$|')@i", "***", $si, 1, $count);
if ($count) {
if ($f[$q][0]) {
//remove it
unset($kq[$i]);
} else {
// move to the end, serach for another time
$v = $kq[$i];
unset($kq[$i]);
$kq[] = $v;
}
$f[$q][] = $r['id'];
$final[$tablename][$r['id']][$fn][] = array($q, $kkey);
$finalstring .= calcurlof($tablename, $r['id'], $q, $kkey);
break 2;
}
}
}
}
}
}
$ttt = var_export($final, true);
$fp = fopen('k_eywords.dat', 'w');
if (fwrite($fp, $ttt) === false) {
$c = "ERROR updating site";
} else {
$c = "DONE" . $finalstring . "FINALSTRINGDONE";
}
fclose($fp);
return $c;
}
function calcurlof($tablename, $id, $text, $target)
{
global $urlstructure;
if (!$urlstructure[$tablename]) {
return;
}
$query = "SELECT * FROM $tablename WHERE id = $id";
$result = mnq($query);
if (mnr($result)) {
$r = mfa($result);
eval("\$lk=\"{$urlstructure[$tablename]}\";");
if ($target != "/") {
$text .= "=>$target";
}
$v = "<a rel='nofollow' target='_blank' href='http://{$_SERVER['HTTP_HOST']}/$lk'>$text</a><br />";
$v = preg_replace("@(http://.+)(//)@", "$1/", $v);
return $v;
}
}
function normaliza_4filenamechange($string)
{
$a = ' ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝàáâãäåæçèéêëìíîïðñòóôõöøüùúûýýþÿ????????????????\'"';
$b = '-aaaaaaaceeeeiiiidnoooooouuuuyaaaaaaaceeeeiiiidnoooooouuuuyybyRraassssttttuei---';
$string = utf8_decode($string);
$string = strtr($string, utf8_decode($a), $b);
$string = strtolower($string);
return utf8_encode($string);
}
function filenamechange($string)
{
$stt = normaliza_4filenamechange(trim($string));
$stt = strtr($stt, array("(" => "", ")" => "", "." => "", "!" => "", ":" => "", "&" => "and", "%" => "", "ca\$her" => "casher"));
$stt = strtr($stt, array("--" => "-"));
while (substr($stt, -1) == "-") {
$stt = substr($stt, 0, -1);
}
return $stt;
}
function normaliza_4filenamechange_on_array(&$s)
{
$s = normaliza_4filenamechange($s);
}
function super_unique($array)
{
if (!$array) {
return;
}
$array = array_map("array_unique", $array);
return sortbylen($array);
}
function sortbylen($a)
{
foreach ($a as &$aa) {
$b = array();
foreach ($aa as $ak) {
$b[] = strlen(trim($ak));
}
array_multisort($b, SORT_DESC, $aa);
}
return $a;
}
function info_for_logo_image_type_general($filetype)
{
global $maincat;
$a = array();
foreach ($maincat as $sitetype => $o) {
switch ($filetype) {
case "gif150x60":
$typesallowed = $maincat[$sitetype]['oqaque_logo_ext'];
$path = $maincat[$sitetype]['path_oqaque_logo'];
break;
case "png150x60lightbg":
$typesallowed = "png";
$path = $maincat[$sitetype]['path_trans_logo'];
break;
case "png150x60darkbg":
$typesallowed = "png";
$path = $maincat[$sitetype]['path_trans_logo_dark'];
break;
case "png250x100lightbg":
$typesallowed = "png";
$path = $maincat[$sitetype]['path_trans_logo250x100'];
break;
case "png250x100darkbg":
$typesallowed = "png";
$path = $maincat[$sitetype]['path_trans_logo250x100_dark'];
break;
case "screen1":
$typesallowed = "png";
$path = $maincat[$sitetype]['path_screen1'];
break;
case "screen2":
$typesallowed = "jpg";
$path = $maincat[$sitetype]['path_screen2'];
break;
case "screen4":
$typesallowed = "jpg";
$path = $maincat[$sitetype]['path_screen4'];
$nolan = 1;
break;
case "logo300":
$typesallowed = "png";
$path = $maincat[$sitetype]['path_trans_300x300'];
break;
case "logo100":
$typesallowed = "png";
$path = $maincat[$sitetype]['path_trans_100x100'];
break;
}
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/img/$path")) {
$a[] = array($typesallowed, "/img/$path");
}
}
return $a;
}
function update_md5($filetype)
{
$filetypeinfos = info_for_logo_image_type_general($filetype);
if (!$filetypeinfos) {
die("Wrong file type");
}
foreach ($filetypeinfos as $filetypeinfo) {
$typesallowed = $filetypeinfo[0];
$path = $filetypeinfo[1];
$e = scandir($_SERVER['DOCUMENT_ROOT'] . $path);
foreach ($e as $ee) {
if (substr($ee, -4) == ".$typesallowed") {
$md = md5_file($_SERVER['DOCUMENT_ROOT'] . $path . "/" . $ee);
$s .= $ee . " ";
$s .= $md . "\r\n";
}
}
}
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/$filetype.txt", $s);
return $s;
}
function univ_bankingdict()
{
global $sitelan;
$a = array();
$query = "SELECT * FROM bcel_bankingdict WHERE NULLIF(content_id,'') IS NOT NULL";
$result = mnq($query);
if ($result) {
while ($r = mfa($result)) {
$a[$r['content_id']] = $r[$sitelan];
}
}
return $a;
}
function univ_bank_is_valid($id)
{
global $univ_validbanks;
if (!isset($univ_validbanks)) {
$univ_validbanks = univ_validbanks();
}
if ($univ_validbanks[$id]) {
return 1;
} else {
return 0;
}
}
function univ_validbanks()
{
global $ipcountry;
global $sitelan;
global $forlansforips;
$univ_bankingdict = univ_bankingdict();
if (!$forlansforips && $ipcountry && $sitelan)
$forlansforips = "
(NULLIF(forips,'') IS NULL or if (instr(forips, 'not for'), FIND_IN_SET('{$GLOBALS['ipcountry']}',replace(forips,'not for ',''))=0, FIND_IN_SET('{$GLOBALS['ipcountry']}',forips)))
AND
(NULLIF(forlans,'') IS NULL or if (instr(forlans, 'not for'), FIND_IN_SET('$sitelan',replace(forlans,'not for ',''))=0, FIND_IN_SET('$sitelan',forlans)))
";
if ($forlansforips) {
$ex = " AND {$GLOBALS['forlansforips']}";
}
$query = "SELECT *
FROM live_banking
WHERE NULLIF(bank_id,'') IS NOT NULL AND
bank_disabled IS NULL$ex";
$result = mnq($query);
while ($r = mfa($result)) {
$bankname = $univ_bankingdict['bankname_' . $r['bank_id']] or $bankname = $r['bank_name'];
$validbanks[$r['bank_id']] = $bankname;
}
return $validbanks;
}
if (!function_exists("banknameofid")) {
function banknameofid()
{
$a = array();
$query = "SELECT * FROM live_banking WHERE NOT bank_id IS NULL";
$result = mnq($query);
if ($result) {
while ($r = mfa($result)) {
$a[$r['bank_id']] = $r['bank_name'];
}
}
return $a;
}
}
if (!function_exists("softwarenameofid")) {
function softwarenameofid($type = "casino")
{
$a = array();
switch ($type) {
case "casino":
$query = "SELECT * FROM live_software WHERE NOT software_id IS NULL";
$result = mnq($query);
if ($result) {
while ($r = mfa($result)) {
$a[$r['software_id']] = $r['software_name'];
}
}
break;
case "poker":
$query = "SELECT * FROM manage_pokersoftware WHERE NOT poker_software_id IS NULL";
$result = mnq($query);
if ($result) {
while ($r = mfa($result)) {
$a[$r['poker_software_id']] = $r['poker_software_name'];
}
}
break;
}
return $a;
}
}
if (!function_exists("jurisdiction_trans")) {
function jurisdiction_trans($t, $short = "")
{
global $jurisdiction_dict;
global $sitelan;
if (!$jurisdiction_dict) {
$jurisdiction_dict = array();
$query = "SELECT * FROM bcel_jurisdiction WHERE nullif(jurisdiction_id,'') IS NOT NULL";
$result = mnq($query);
while ($r = mfs($result)) {
$jurisdiction_dict[$r['jurisdiction_id']] = $r[$sitelan] or $jurisdiction_dict[$r['jurisdiction_id']] = $r['en'];
$jurisdiction_dict['short'][$r['jurisdiction_id']] = $r[$sitelan . "_short"] or $jurisdiction_dict['short'][$r['jurisdiction_id']] = $r['en_short'];
}
}
$e = explode(",", $t);
$a = array();
foreach ($e as $ee) {
if ($ee) {
if ($short) {
if ($jurisdiction_dict['short'][$ee]) {
$a[] = $jurisdiction_dict['short'][$ee];
}
} else {
if ($jurisdiction_dict[$ee]) {
$a[] = $jurisdiction_dict[$ee];
}
}
}
}
return implode(", ", $a);
}
}
if (!function_exists("calc_bonus_match")) {
function calc_bonus_match($max_bonus, $deposit4maxbonus)
{
$unit = substr($max_bonus, -3);
preg_match("@([0-9\.]+)$unit@", $deposit4maxbonus, $matches);
if ($matches[1] and (float)$matches[1] > 0) {
return round((float)$max_bonus / $matches[1] * 100);
}
}
}
if (!function_exists("calc_firstdepositbonus_and_bonusmatch")) {
function calc_firstdepositbonus_and_bonusmatch()
{
global $sitelan;
global $sitetype;
global $exclusivecri;
global $bonus_ipcontrol;
global $sitetypegeneral;
global $maincat;
if (!$sitetype) $sitetype = $sitetypegeneral;
if (!$sitetype) $sitetype = "casino";
$idname = $maincat[$sitetype]['id'];
$bonuses_new_name = $maincat[$sitetype]['bonus_detail'];
$the_history = array();
$a = array();
$query = "SELECT * FROM $bonuses_new_name WHERE
onlyfornotfor ='onlyfor $sitelan'
AND $idname IS NOT NULL
and bonus_type='Welcome'
and IFNULL(nth,0) < 2
and IFNULL(deposit4maxbonus,0)>0
$exclusivecri$bonus_ipcontrol
ORDER BY $idname, max_bonus/deposit4maxbonus DESC, max_bonus DESC";
$result = mnq($query);
while ($r = mfa($result)) {
if (!in_array($r[$idname], $the_history)) {
$the_history[] = $r[$idname];
$mbmb = currencychange($r['max_bonus'], "", 1);
$pcpc = calc_bonus_match($mbmb, $r['deposit4maxbonus']);
$a[$r[$idname]] = array($mbmb, $pcpc, "code" => $r['code'], "least_wr" => $r['least_wr']);
}
}
return $a;
}
}
if (!function_exists("calc_no_deposit_bonus")) {
function calc_no_deposit_bonus($subtype = "")
{ // subtype can be freespins
global $sitelan;
global $sitetype;
global $exclusivecri;
global $bonus_ipcontrol;
global $sitetypegeneral;
global $maincat;
if (!$sitetype) $sitetype = $sitetypegeneral;
if (!$sitetype) $sitetype = "casino";
$idname = $maincat[$sitetype]['id'];
$bonuses_new_name = $maincat[$sitetype]['bonus_detail'];
if ($sitetype == "sport") {
if ($subtype == "freebet") $cri = "bonus_type='Freebet'";
else $cri = "(bonus_type='Nodeposit' OR bonus_type='Freebet')";
} else {
if ($subtype == "freespins") $cri = "bonus_type='Freespins'";
else $cri = "(bonus_type='Nodeposit' OR bonus_type='Freespins')";
}
$the_history = array();
$a = array();
$query = "SELECT * FROM $bonuses_new_name WHERE
onlyfornotfor ='onlyfor $sitelan'
$exclusivecri
AND $idname IS NOT NULL
and $cri$bonus_ipcontrol
ORDER BY $idname, max_bonus DESC";
$result = mnq($query);
while ($r = mfa($result)) {
if (!in_array($r[$idname], $the_history)) {
$the_history[] = $r[$idname];
if ($r['is_exclusive_bonus']) $ex = 1;
else $ex = 0;
if ($r['bonus_type'] == "Freespins")
$a[$r[$idname]] = array($r['max_bonus'] . " Free spins", "code" => $r['code'], "isfreespin" => 1, "isexclusive" => $ex);
elseif ($r['bonus_type'] == "Freebet")
$a[$r[$idname]] = array($r['max_bonus'], "code" => $r['code'], "isfreebet" => 1, "isexclusive" => $ex);
else
$a[$r[$idname]] = array($r['max_bonus'], "code" => $r['code'], "isfreespin" => 0, "isfreebet" => 0, "isexclusive" => $ex);
}
}
return $a;
}
}
function getbonussumnew_with_extra($r)
{
global $sitelan;
global $allbonusinfo;
global $mastershort;
global $sitetype;
global $sitetypegeneral;
global $maincat;
if (!$sitetype) {
$sitetype = $sitetypegeneral;
}
if (!$sitetype) {
$sitetype = "casino";
}
$nid = $maincat[$sitetype]['id'];
$ntb = $maincat[$sitetype]['bonus_general'];
$nts = $maincat[$sitetype]['bonuses_general_special'];
if (!isset($allbonusinfo)) {
$allbonusinfo = array();
$bonus_ipcontrol = " AND (NULLIF(ipcontrol,'') IS NULL OR IF (instr(ipcontrol, 'not for'), FIND_IN_SET('{$GLOBALS['ipcountry']}',replace(ipcontrol,'not for ',''))=0, FIND_IN_SET('{$GLOBALS['ipcountry']}',ipcontrol)))";
$x = strtr($bonus_ipcontrol, array("ipcontrol" => "t1.ipcontrol"));
$query = "SELECT t1.$nid,
t1.ipcontrol,
t1.bonus_sum AS bonus_sum_normal,
t2.bonus_sum AS bonus_sum_special,
t1.bonus_extra AS bonus_extra_normal,
t2.bonus_extra AS bonus_extra_special
FROM $ntb AS t1 LEFT JOIN $nts AS t2 on t1.$nid=t2.$nid AND
t2.mastershort='$mastershort' AND
t2.lan='onlyfor $sitelan' AND
IFNULL(t1.ipcontrol,'') = IFNULL(t2.ipcontrol,'')
WHERE t1.lan = 'onlyfor $sitelan'$x
ORDER BY t1.ipcontrol";
$result = mnq($query);
while ($k = mfs($result)) {
$allbonusinfo[$k[$nid]] = $k;
}
}
if (is_array($r)) {
$cid = $r[$nid] or $cid = $r['site_id'];
} else{
$cid = $r;
}
if (!$cid) {
return;
}
$rr = $allbonusinfo[$cid];
if ($rr['bonus_sum_special'] or $rr['bonus_extra_special']) {
$v = $rr['bonus_sum_special'];
if ($rr['bonus_extra_special']) {
$v .= "<span>{$rr['bonus_extra_special']}</span>";
}
} else {
$v = $rr['bonus_sum_normal'];
if ($rr['bonus_extra_normal']) {
$v .= "<span>{$rr['bonus_extra_normal']}</span>";
}
}
return $v;
}
if (!function_exists("getbonussumnew")) {
function getbonussumnew($r)
{ // can be array or just the id
global $sitelan;
global $sitetype;
global $sitetypegeneral;
global $freebetforsports;
global $bonus_ipcontrol;
global $sitedata;
global $maincat;
if (!$r) return;
if (!$sitetype) $sitetype = $sitetypegeneral;
if (!$sitetype) $sitetype = "casino";
$idname = $maincat[$sitetype]['id'];
$bonus_table_name = $maincat[$sitetype]['bonus_general'];
$t = $sitedata['idname'] or $t = "site_id";
if (!is_array($r)) $r = array($t => $r);
$query = "SELECT * FROM $bonus_table_name WHERE $idname='{$r[$t]}' and NULLIF(bonus_sum,'') IS NOT NULL and lan = 'onlyfor $sitelan'$bonus_ipcontrol order by ipcontrol DESC";
$result = mnq($query);
if ($rr = mfa($result)) {
$freebetforsports = $rr['freebetforsports'];
return $rr['bonus_sum'];
}
}
}
function currency_locale()
{
global $sitelan;
global $ipcountry;
global $sitedata;
if ($ipcountry != "others") $locale = $sitelan . "_" . strtoupper($ipcountry);
elseif ($sitedata['targeted_countries']) $locale = $sitelan . "_" . $sitedata['targeted_countries'];
else $locale = "$sitelan";
return $locale;
}
function currency_change_by_locale($final, $extra)
{
global $currency_locale;
global $remove_us_in_symbol;
global $cryptocurrencies;
if (!preg_match("@([0-9\.]+)\s*(.+)@", $final, $matches) or (float)$final == 0) {
if ($extra) return $extra;
else return "–";
}
if (!$cryptocurrencies) {
$cryptocurrencies = cryptocurrencies();
}
if (!$currency_locale) $currency_locale = currency_locale();
if ($cryptocurrencies[$matches[2]]) { // if crypto
$fmt = numfmt_create($currency_locale, NumberFormatter::DECIMAL);
$s = numfmt_format($fmt, $matches[1]);
return $s . " " . $matches[2] . $extra;
}
$fmt = numfmt_create($currency_locale, NumberFormatter::CURRENCY);
$s = numfmt_format_currency($fmt, $matches[1], $matches[2]);
if (!isset($remove_us_in_symbol)) {
$currency_symbol = numfmt_get_symbol($fmt, NumberFormatter::CURRENCY_SYMBOL);
if (preg_match("@\\$@", $currency_symbol)) $remove_us_in_symbol = false;
else $remove_us_in_symbol = true;
}
// remove US if it will not confuse
if ($remove_us_in_symbol) $s = preg_replace("@(\\$\s*US|US\s*\\$)@", "$", $s);
// remove useless zeroes
$dcm = numfmt_get_symbol($fmt, NumberFormatter::DECIMAL_SEPARATOR_SYMBOL);
$dcm_quote = preg_quote($dcm);
$s = preg_replace("@{$dcm_quote}00@", "", $s);
return $s . $extra;
}
if (!function_exists("currencychange")) {
function currencychange($c, $addspace = "", $standard_currency_code = false, $onlyshortencurrency = false)
{
global $ipcountry;
global $sitelan;
global $dict;
global $sitedata;
preg_match("@(.*)(<span>.*</span>)@", $c, $matchesx);
if ($matchesx) {
$c = $matchesx[1];
$extra = $matchesx[2];
}
if (!$dict['free spins']) {
if ($sitelan == "es") $dict['free spins'] = "Giros gratis";
else $dict['free spins'] = "free spins";
}
if (stripos($c, "free spins") !== false) {
$c = preg_replace("@free spins@i", $dict['free spins'], $c);
return $c . $extra;
}
if ($onlyshortencurrency) {
$final = $c;
} else {
$a = array();
$cs = explode(",", $c);
foreach ($cs as $css) {
$a[substr($css, -3)] = $css;
}
$country2currency = country2currency($ipcountry);
if ($country2currency)
$final = $a[$country2currency] or $final = $a['USD'] or $final = $a['EUR'] or $final = current($a);
else {
$lan2currency = lan2currency($sitelan);
$final = $a[$lan2currency] or $final = $a['USD'] or $final = $a['EUR'] or $final = current($a);
}
if ($standard_currency_code) return $final . $extra;
}
// begin to format symbol:
$countries_enabled = array("de");
if (in_array($ipcountry, $countries_enabled) || $_GET['test'] == "83412") {
if (function_exists("numfmt_create")) {
return currency_change_by_locale($final, $extra);
}
}
$curwithsymbol = array( "USD" => "$",
"CAD" => "$",
"EUR" => "€",
"GBP" => "£",
"SEK" => "kr",
"NOK" => "kr",
"ZAR" => "R",
"BRL" => "R$",
"MXN" => "$",
"ARS" => "$",
"AUD" => "$",
"NZD" => "$",
"CLP" => "$",
"PEN" => "S/",
"COP" => "$",
"VES" => "Bs.",
"INR" => "₹",
"PLN" => "zł"
);
switch ($sitelan) {
case "fr":
case "de":
case "it":
if (in_array($ipcountry, array("ch"))) {
$currencyposition = "before";
} else {
$currencyposition = "after";
}
break;
case "en":
case "pt":
$currencyposition = "before";
break;
case "es":
if (in_array($ipcountry, array("es"))) {
$currencyposition = "after";
} else {
$currencyposition = "before";
}
break;
default:
$currencyposition = "after";
}
if ((float)$final == 0) {
if ($extra) {
return $extra;
} else {
return "–";
}
}
preg_match("@([0-9\.]+)([A-Z]+)@", $final, $matches);
if ($matches) {
if (!$curwithsymbol[$matches[2]]) {
return $final . $extra;
}
if ($addspace) {
if ($currencyposition == "after") {
$final = $matches[1] . " " . $matches[2];
} else {
$final = $matches[2] . " " . $matches[1];
}
} else {
if ($currencyposition == "after") {
$final = $matches[1] . $matches[2];
} else {
$final = $matches[2] . $matches[1];
}
}
} else {
if ($extra) {
return $extra;
} else {
return "–";
}
}
$c = $ipcountry;
if ($c == "others") {
$c = $sitedata['targeted_countries'];
}
if (in_array(strtolower($c), array("mx", "ar", "cl", "co"))) {
$final = strtr($final, array("USD" => "US$", "CAD" => "CA$", "NZD" => "NZ$", "AUD" => "AU$"));
}
$final = strtr($final, $curwithsymbol);
return $final . $extra;
}
}
if (!function_exists("casinoswithlogos")) {
function casinoswithlogos($field)
{
if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/$field.txt")) update_md5($field);
$s = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/$field.txt");
preg_match_all("@(.+)\.(gif|png|jpe*g) \S{32}\r$@m", $s, $matches);
return $matches[1];
}
}
if (!function_exists("getmenumobile")) {
function getmenumobile()
{
global $maintable;
global $site_table_criteria;
global $sitedata;
$query = "SELECT * FROM $maintable
WHERE (parent_link='/' OR page_url='/') AND
theorder>0$site_table_criteria
ORDER BY IF(page_url='/',0,1), theorder";
$result = mnq($query);
while ($r = mfa($result)) {
$t = $r['menutitle'] or $t = $r['maintitle'];
switch ($r['type']) {
default:
$s .= <<<A
<option value="{$sitedata['suffix']}{$r['page_url']}">$t</option>
A;
}
}
return $s;
}
}
if (!function_exists("addparentlink")) {
function addparentlink($s)
{
global $site;
if (!$site['parent_link']) return strtr($s, array("{" => "", "}" => ""));
$s = preg_replace("@\{(.+)\}@U", "<a href='{$GLOBALS['sitedata']['suffix']}{$site['parent_link']}'>$1</a>", $s);
return $s;
}
}
function univ_breadcrumb($metitle = "", $meparentlink = "")
{
global $site;
global $sitedata;
global $sitelan;
global $subdomain;
global $master_short;
global $pagename;
global $site_table_criteria;
if (!isset($site_table_criteria)) $site_table_criteria = site_table_criteria();
$e = explode(",", $sitedata['db_tables']);
$cururl = $site['page_url'];
if ($master_short == "tcc" or $master_short == "tccdede") {
$e = array("tcc_site");
}
if ($e[0] == "") return;
$query = "SELECT menutitle, maintitle, page_url, parent_link, type FROM {$e[0]} WHERE theorder>0$site_table_criteria order by id DESC";
$result = mnq($query);
if (!$result) return;
while ($r = mfs($result)) {
$tt = $r['menutitle'] or $tt = $r['maintitle'];
switch ($master_short) {
case "pro":
if ($r['type'] == "news") $r['parent_link'] = "/actualite/";
break;
}
$a[$r['page_url']] = array($tt, $r['parent_link']);
}
if (($master_short == "tcc" or $master_short == "tccdede") and $pagename == "review") {
$query = "SELECT menutitle, maintitle, page_url, parent_link FROM casinos_plus WHERE theorder>0$site_table_criteria order by id DESC";
$result = mnq($query);
while ($r = mfs($result)) {
$tt = $r['menutitle'] or $tt = $r['maintitle'];
$a[$r['page_url']] = array($tt, $r['parent_link']);
}
}
if (!$a[$cururl] and $metitle and $meparentlink) $a[$cururl] = array($metitle, $meparentlink);
$u = $a[$cururl];
$k = "";
while (1) {
if (!$k) {
$s[] = "<span>{$u[0]}</span>";
} else {
$hr = " href='{$GLOBALS['sitedata']['suffix']}$k'";
$s[] = "<a$hr>{$u[0]}</a>";
}
if ($k == "/") break;
$k = $u[1];
$u = $a[$u[1]];
if (!$u) break;
}
$s = array_reverse($s);
if ($s) return "<div id='breadcrumb'>" . implode(" > ", $s) . "</div>";
}
function univ_breadcrumb_new($metitle = "", $meparentlink = "")
{
global $site;
global $sitedata;
global $sitelan;
global $subdomain;
global $master_short;
global $pagename;
global $site_table_criteria;
if (!isset($site_table_criteria)) $site_table_criteria = site_table_criteria();
$e = explode(",", $sitedata['db_tables']);
$cururl = $site['page_url'];
if ($master_short == "tcc" or $master_short == "tccdede") {
$e = array("tcc_site");
}
if ($e[0] == "") return;
$query = "SELECT menutitle, maintitle, page_url, parent_link, type FROM {$e[0]} WHERE theorder>0$site_table_criteria order by id DESC";
$result = mnq($query);
if (!$result) return;
while ($r = mfs($result)) {
$tt = $r['menutitle'] or $tt = $r['maintitle'];
switch ($master_short) {
case "pro":
if ($r['type'] == "news") $r['parent_link'] = "/actualite/";
break;
}
$a[$r['page_url']] = array($tt, $r['parent_link']);
}
if (($master_short == "tcc" or $master_short == "tccdede") and $pagename == "review") {
$query = "SELECT menutitle, maintitle, page_url, parent_link FROM casinos_plus WHERE theorder>0$site_table_criteria order by id DESC";
$result = mnq($query);
while ($r = mfs($result)) {
$tt = $r['menutitle'] or $tt = $r['maintitle'];
$a[$r['page_url']] = array($tt, $r['parent_link']);
}
}
if (!$a[$cururl] and $metitle and $meparentlink) $a[$cururl] = array($metitle, $meparentlink);
$u = $a[$cururl];
$k = "";
while (1) {
if (!$k) $hr = <<<A
<a><span property="name">{$u[0]}</span></a>
A;
else $hr = <<<A
<a property="item" typeof="WebPage" href="{$GLOBALS['sitedata']['suffix']}$k"><span property="name">{$u[0]}</span></a>
A;
$s[] = <<<A
<li property="itemListElement" typeof="ListItem">
$hr
<meta property="position" content="***">
</li>
A;
if ($k == "/") break;
$k = $u[1];
$u = $a[$u[1]];
if (!$u) break;
}
$s = array_reverse($s);
if ($s) {
foreach ($s as &$ss) {
$n++;
$ss = strtr($ss, array("***" => $n));
}
return "<div id='breadcrumb'><ol vocab='http://schema.org/' typeof='BreadcrumbList'>" . implode($s) . "</ol></div>";
}
}
if (!function_exists("addsisterlinks")) {
function addsisterlinks($cols = 1)
{
global $site;
global $maintable;
global $sitelan;
global $subdomain;
global $master_short;
global $pagename;
global $univ_breadcrumb;
global $sitedata;
global $site_table_criteria;
$touselist = array("1", "2", "parier", "cfo", "cfst", "tcc", "gr", "ocrb", "gr2", "pro", "clf", "pel", "ocs", "sco", "jcgen", "celorg", "pssch");
if (in_array($sitedata['using_template'], $touselist)) $use_more_for_review = 1;
$no_show_bread_crumb_with_sisterlinks = array("tcc", "parier", "ocrb");
$maxforreview = 10;
$dictmore = array("en" => "More", "fr" => "Plus", "de" => "Weitere", "es" => "Más", "fi" => "Lisää", "sv" => "Mer", "no" => "Mer", "pl" => "Jeszcze", "pt" => "Mais");
$dictless = array("en" => "Less", "fr" => "Moins", "de" => "Weniger", "es" => "Menos", "fi" => "Vähemmän", "sv" => "Mindre", "no" => "Mindre", "pl" => "Mniej", "pt" => "Menos");
if (!isset($site_table_criteria)) $site_table_criteria = site_table_criteria();
$idname = $sitedata['idname'] or $idname = "site_id";
if (!$site['parent_link']) return;
if (array_key_exists('no_univ_breadcrumb', $sitedata) and !$sitedata['no_univ_breadcrumb']) {
$metitle = $site['menutitle'] or $metitle = $site['maintitle'];
$meparentlink = $site['parent_link'];
if (in_array($sitedata['using_template'], array("gr", "gr2", "ocrb", "parier", "cfo", "pel", "pro", "pssch", "1", "2", "cfst", "tcc", "ocs", "sco", "jcgen", "celorg", "clf")))
$univ_breadcrumb = univ_breadcrumb_new($metitle, $meparentlink);
else
$univ_breadcrumb = univ_breadcrumb($metitle, $meparentlink);
}
if ($site['bottom_text']) {
if ($site['bottom_text'] == "none") $site['bottom_text'] = "";
$all = array();
if ($site['type'] == "review") {
$tops = tops();
switch ($sitedata['using_template']) {
case "bcel":
$query = "SELECT $idname, page_url
FROM bcel_casino_plus
WHERE id != {$site['id']} AND
theorder>0$site_table_criteria
ORDER BY {$tops['case']}id DESC";
break;
case "clf":
$query = "SELECT $idname, page_url
FROM clf_casinos
WHERE id != {$site['id']} AND
theorder>0$site_table_criteria
ORDER BY {$tops['case']}id DESC";
break;
case "tcc":
$query = "SELECT $idname, page_url
FROM casinos_plus
WHERE id != {$site['id']} AND
theorder>0$site_table_criteria
ORDER BY {$tops['case']}id DESC";
break;
default:
$query = "SELECT $idname, page_url
FROM {$sitedata['db_tables']}
WHERE id != {$site['id']} AND
parent_link='{$site['parent_link']}' AND
theorder>0$site_table_criteria
ORDER BY {$tops['case']}id DESC";
break;
}
$result = mnq($query);
if ($result) {
$i = 0;
while ($r = mfs($result)) {
if (!$r[$idname] or !cbpgood($r[$idname])) continue;
$i++;
$t = addshy(id2name("", $r[$idname]));
if ($i > $maxforreview and $use_more_for_review) $h = " class='h'";
$all[] = "<li$h><a href='{$GLOBALS['sitedata']['suffix']}{$r['page_url']}'>$t</a></li>";
}
}
} else {
$query = "SELECT menutitle, maintitle, $idname, page_url
FROM $maintable
WHERE id != {$site['id']} AND
parent_link='{$site['parent_link']}' AND
theorder>0$site_table_criteria
ORDER BY theorder";
$result = mnq($query);
if ($result) {
while ($r = mfs($result)) {
if ($r[$idname] and !cbpgood($r[$idname])) {
continue;
}
$t = $r['menutitle'] or $t = $r['maintitle'];
$all[] = "<li><a href='{$GLOBALS['sitedata']['suffix']}{$r['page_url']}'>$t</a></li>";
}
}
}
$countall = count($all);
if ($countall) {
$final = array();
foreach ($all as $key => $l) {
$u = $key % $cols;
$final[$u][] = $l;
}
foreach ($final as &$o) {
$m = "<ul>";
$m .= implode("", $o);
if ($h) {
if ($countall > $maxforreview + 1)
$m .= "<li class='more'><a href='javascript:void(1)'>{$dictmore[$sitelan]}</a></li><li class='h less'><a href='javascript:void(1)'>{$dictless[$sitelan]}</a></li>";
else
$m = strtr($m, array(" class='h'" => ""));
}
$m .= "</ul>";
$o = $m;
}
$s .= implode("", $final);
$site['bottom_text'] = formattext(wholeb2h3($site['bottom_text']));
}
}
$p = "";
if (!in_array($sitedata['using_template'], $no_show_bread_crumb_with_sisterlinks)) {
$p = $univ_breadcrumb;
}
if ($s) {
$p .= "<div id='sistersw'>" . $site['bottom_text'] . "<div style='clear:both; margin:20px 0;'></div>$s</div>";
}
return $p;
}
}
if (!function_exists("wholeb2h3")) {
function wholeb2h3($s)
{
$s = preg_replace("@</b>(\h*)<b>@i", "$1", $s);
return preg_replace("@^\h*<b>(((?!<b>).)+)</b>\h*(\r|$)@im", "<h3>$1</h3>\r", $s);
}
}
function newsindex_url()
{
global $maintable;
global $table_critera;
global $sitelan;
global $subdomain;
if ($table_critera) {
$others = " AND " . strtr($table_critera, array("*lan*" => $sitelan, "*subdomain*" => $subdomain));
}
$query = "SELECT * FROM $maintable WHERE (type='newsindex' OR type_admin='newsindex') AND theorder>0$others";
$result = mnq($query);
if ($r = mfs($result)) return $r['page_url'];
else return "";
}
if (!function_exists("menunew")) {
function menunew($parent, $excludedtypes = array())
{
global $menus;
global $maintable;
global $table_critera;
global $sitelan;
global $subdomain;
global $site_table_criteria;
global $sitedata;
$idname = $sitedata['idname'] or $idname = "site_id";
if ($table_critera) {
$others = " AND " . strtr($table_critera, array("*lan*" => $sitelan, "*subdomain*" => $subdomain));
}
if ($parent == "/" && function_exists("partners")) {
$partners = partners();
}
if (!$menus) {
if ($excludedtypes) {
$excludedtypesstring = implode(",", $excludedtypes);
$excludedtypesstring = " and !find_in_set(IFNULL(type,''),'$excludedtypesstring')";
}
$query = "SELECT * FROM $maintable WHERE theorder>0$excludedtypesstring and (NULLIF(parent_link,'') IS NOT NULL OR page_url='/' OR type='news')$others$site_table_criteria order by IF(type='news',9999,theorder), id DESC";
$result = mnq($query);
while ($r = mfa($result)) {
if ($r[$idname] && !cbpgood($r[$idname])) {
continue;
}
if ($r['type'] == "news" && !$r['parent_link']) {
global $newsindex_url;
if (!isset($newsindex_url)) {
$newsindex_url = newsindex_url();
}
if ($newsindex_url) {
$r['parent_link'] = $newsindex_url;
} else {
$r['parent_link'] = "/";
}
}
$t = "";
$t = $r['menutitle'] or $t = $r['maintitle'];
$menus[$r['parent_link']][] = array($r['page_url'], $t);
}
}
if (is_array($menus[$parent])) {
foreach ($menus[$parent] as $m) {
$s .= "<li><a href='{$sitedata['suffix']}{$m[0]}'>{$m[1]}</a>" . menunew($m[0]) . "</li>";
}
} elseif ($parent == "/") {
$query = "SELECT menutitle, page_url, maintitle
FROM $maintable
WHERE page_url!='/sitemap.html' AND
theorder>0$others$site_table_criteria
ORDER BY theorder";
$result = mnq($query);
while ($r = mfa($result)) {
$t = "";
$t = $r['menutitle'] or $t = $r['maintitle'];
$s .= "<li><a href='{$sitedata['suffix']}{$r['page_url']}'>$t</a></li>";
}
return "<ul><li><a class='nohover'>Menu</a><ul>$s</ul></li>$partners</ul>";
}
if ($s) {
if ($parent == "/")
return "<ul><li><a href='{$sitedata['suffix']}/'>{$menus[""][0][1]}</a></li>$s$partners</ul>";
else
return "<ul>$s</ul>";
}
}
}
if (!function_exists("partners")) {
function partners()
{
global $sitelan;
global $maintable;
global $sitedata;
global $site;
$sitelanshort = substr($sitelan, 0, 2);
$localurl = $sitedata['short'];
if ( isset( $_SERVER['CF-Connecting-IP'] ) ) {
$http_x_headers = explode( ',', $_SERVER['CF-Connecting-IP'] );
$_SERVER['REMOTE_ADDR'] = $http_x_headers[0];
}
else if ( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
$http_x_headers = explode( ',', $_SERVER['HTTP_X_FORWARDED_FOR'] );
$_SERVER['REMOTE_ADDR'] = $http_x_headers[0];
}
$remoteip = $_SERVER['REMOTE_ADDR'];
if ($remoteip == "127.0.0.1") {
$query = "SELECT * FROM manage_websites WHERE NULLIF(short,'') IS NOT NULL AND NULLIF(url,'') IS NOT NULL";
$result = mnq($query);
while ($r = mfa($result)) {
$long2short[$r['url']] = $r['short'];
}
$query = "SELECT * FROM partners WHERE NULLIF(siteid,'') IS NULL AND NULLIF(longurl,'') IS NOT NULL";
$result = mnq($query);
while ($r = mfa($result)) {
$r['longurl'] = trim(strtr($r['longurl'], array("http://" => "")));
preg_match("@^[^\/]+@", $r['longurl'], $matches);
$url = trim($matches[0]);
$q = "UPDATE partners SET siteid='{$long2short[$url]}', longurl='$url' WHERE id={$r['id']}";
mnq($q);
}
}
$query = "SELECT * FROM partners WHERE siteid='$localurl'";
$result = mnq($query);
if ($result) {
if ($r = mfa($result)) {
if (!$r['homepageonly'] or $site['page_url'] == "/") {
preg_match_all("@.+@", $r['partners'], $mmm);
foreach ($mmm[0] as $aa) {
$aa = trim($aa);
preg_match("@^\s*([^\s]+)(.*)@", $aa, $matches);
if ($matches) {
$l = trim($matches[1]);
if (substr($l, 0, 4) != "http") $l = "http://$l";
if (is_https($l)) $l = preg_replace("@^http\://@", "https://", $l);
else $l = preg_replace("@^https\://@", "http://", $l);
$k = trim(strtr($matches[2], array("anchor :" => "", "anchor:" => "", "anchor" => "")));
if (!$k) {
$k = preg_replace("@^https?\://@i", "", $l);
$k = preg_replace("@^www\.@i", "", $k);
$k = preg_replace("@/$@", "", $k);
}
$s .= "<li><a href='$l'>$k</a></li>";
}
}
$wordpartner = array("fi" => "Kaverit", "de" => "Freunde", "fr" => "Amis", "sv" => "Vänner", "en" => "Friends", "es" => "Amigos");
if ($s) return "<li id='partners'><a>{$wordpartner[$sitelanshort]}</a><ul>$s</ul></li>";
}
}
}
}
}
function image_in_box($filename, $width, $height, $proportional, $allowfill = 1, $fillcolor = "")
{
if (!$width or !$height) return;
$styles = array();
if (!preg_match("@^" . preg_quote($_SERVER['DOCUMENT_ROOT']) . "@", $filename)) {
if (substr($filename, 0, 1) != "/") $filename = "/" . $filename;
$filenamefullpath = $_SERVER['DOCUMENT_ROOT'] . $filename;
$addrootpath = 1;
} else $filenamefullpath = $filename;
$g = @getimagesize($filenamefullpath);
if (!$g) return;
if (!$proportional) {
$styles['width'] = $width;
$styles['height'] = $height;
} else {
$oriwidth = $g[0];
$oriheight = $g[1];
if ($allowfill) {
if ($width / $height > $oriwidth / $oriheight) {
$styles['height'] = $height;
$styles['width'] = (int)($oriwidth * $height / $oriheight);
$styles['margin-left'] = ($width - $styles['width']) / 2;
$styles['margin-right'] = ($width - $styles['width']) / 2;
} else {
$styles['width'] = $width;
$styles['height'] = (int)($oriheight * $width / $oriwidth);
$styles['margin-top'] = ($height - $styles['height']) / 2;
$styles['margin-bottom'] = ($height - $styles['height']) / 2;
}
} else {
$fillcolor = "";
if ($width / $height > $oriwidth / $oriheight) {
$styles['width'] = $width;
$styles['height'] = (int)($oriheight * $width / $oriwidth);
} else {
$styles['height'] = $height;
$styles['width'] = (int)($oriwidth * $height / $oriheight);
$styles['margin-left'] = ($width - $styles['width']) / 2;
}
}
}
$filename = optimize_image($filename, $styles['width'], $styles['height']);
if ($addrootpath) $filename = $GLOBALS['rootpath'] . $filename;
$final = array();
foreach ($styles as $key => $style) {
$p = "$key:$style";
$p .= "px";
$final[] = $p;
}
$final = implode(";", $final);
if ($fillcolor) $addbg = "background-color:$fillcolor;";
$s = "<span class='imgspan' style='display:inline-block;overflow:hidden;width:{$width}px;height:{$height}px;$addbg'><img src='$filename' style='$final' /></span>";
return $s;
}
function adjust_main_image($maxwidth = "")
{
global $site;
global $sitedata;
if (!$site['image']) return;
if (in_array($sitedata['using_template'], array("bcel", "1", "2", "ocrb", "parier", "cfo", "gr", "gr2", "pro", "clf", "cfst", "pel", "tcc", "pssch", "jcgen", "ocs", "sco"))) return formattext("*img0*");
global $image_default_link;
if (!isset($image_default_link)) $image_default_link = image_default_link();
if (!$site['image_link']) $site['image_link'] = $image_default_link;
if (!$maxwidth) {
$maxwidth = page_image_maxwidth("img0");
}
if (preg_match("@^~~temp~~(\d+)~(.+)@", $site['image'], $mch)) {
if (strpos($_SERVER['HTTP_HOST'], ".") === false) {
$iname = "http://bcel/img/drafts/{$mch[1]}/{$mch[2]}";
$inamefull = $iname;
} else {
$iname = getenv('RBO_URL')."/img/drafts/{$mch[1]}/{$mch[2]}";
$inamefull = $iname;
}
} else {
if (strpos($site['image'], "/") === false) $iname = "/img/site/{$site['image']}";
else $iname = $site['image'];
if (substr($iname, 0, 1) != "/") $iname = "/" . $iname;
$inamefull = $_SERVER['DOCUMENT_ROOT'] . $iname;
}
if ($sitedata['using_template'] == "bcel") $style = "float:left;";
else $style = "float:left; margin:5px 10px 0 0; border:1px #eee solid;";
$site['picmain_maxwidth'] = $maxwidth;
$imgsize = @my_getimagesize($inamefull);
if (!$imgsize) return;
$site['picmain_width_ori'] = $imgsize[0];
$site['picmain_height_ori'] = $imgsize[1];
if ($site['picmain_width'] and !$site['picmain_height']) {
$site['picmain_height'] = $site['picmain_height_ori'] * $site['picmain_width'] / $site['picmain_width_ori'];
} elseif ($site['picmain_height'] and !$site['picmain_width']) {
$site['picmain_width'] = $site['picmain_width_ori'] * $site['picmain_height'] / $site['picmain_height_ori'];
} elseif (!$site['picmain_width'] and !$site['picmain_height']) {
$site['picmain_width'] = $site['picmain_width_ori'];
$site['picmain_height'] = $site['picmain_height_ori'];
}
if ($site['picmain_width'] > $site['picmain_maxwidth'] * 0.85) {
$site['picmain_height'] = $site['picmain_height'] * $site['picmain_maxwidth'] / $site['picmain_width'];
$site['picmain_width'] = $site['picmain_maxwidth'];
$style = "float:none; margin:5px 0 10px 0;";
$dontfloat = true;
}
if ($dontfloat) $iclass = "floatnone";
else $iclass = "floatleft"; // new
$site['picmain_width'] = (int)$site['picmain_width'];
$site['picmain_height'] = (int)$site['picmain_height'];
$iname = optimize_image($iname, $site['picmain_width'], $site['picmain_height'], $site['picmain_width_ori'], $site['picmain_height_ori']);
$style .= " width:{$site['picmain_width']}px; height:{$site['picmain_height']}px;";
$site['image_alt_text'] = htmlentities($site['image_alt_text'], ENT_COMPAT, "UTF-8");
$image = "<img src='$iname' alt=\"{$site['image_alt_text']}\" style='$style'>";
if ($site['image_link']) {
$image = "<a href='{$site['image_link']}'>$image</a>";
$image = strtr($image, array("href='www" => "href='http://www"));
}
if ($site['under_image']) {
$underi = preg_split("@(<a .+</a>)@Ui", $site['under_image'], -1, PREG_SPLIT_DELIM_CAPTURE);
$ni = -2;
while ($ni < count($underi) - 2) {
$ni = $ni + 2;
$underi[$ni] = preg_replace("@((?:http\:\/\/|www).\S+)@s", "<a href='$1'>$0</a>", $underi[$ni]);
}
$site['under_image'] = implode("", $underi);
$site['under_image'] = strtr($site['under_image'], array("href='www" => "href='http://www"));
if ($dontfloat) {
$image = preg_replace("@float\:none\; margin\:5px 0 10px 0\;@", "float:none; margin:5px 0 0 0;", $image);
$widthnofloat = (int)$site['picmain_width'] - 2;
$image .= "<span id='credit' style='clear:both;width:{$widthnofloat}px; font-style:italic; display:block; float:none; text-align:center; margin-bottom:5px; padding:5px 0;'>{$site['under_image']}</span>";
} else {
$image .= "<span id='credit' style='clear:both;width:{$site['picmain_width']}px; font-style:italic; display:block; float:left; margin-right:10px; text-align:center; margin-bottom:5px; padding:5px 0;'>{$site['under_image']}</span>";
}
}
switch ($sitedata['using_template']) {
case "bcel":
if ($dontfloat) $image = <<<A
<figure class="fig fig-none">$image</figure>
A;
else $image = <<<A
<figure class="fig fig-left">$image</figure>
A;
return $image;
break;
default:
if ($dontfloat) return "<center>$image</center>";
else return $image;
}
}
function update_fillin($tablename)
{
return;
}
$admindiv .= "<!-- page ready -->";
// functions end *********************
if ($_POST['scode'] == "mJii8jed_edKKio130830NHgge^^") { //this code for posting keywords
$keywords = stripslashes($_POST['keywords']);
echo modifykeywords();
exit;
}
// add admin part in javascript to site
function adminagain()
{
global $univ_live_admin;
echo $univ_live_admin;
}
function checkedandfailed($f)
{
global $checkedandfailed;
global $checkedandfailedread;
if (!$checkedandfailedread) {
$checkedandfailed = array();
$s = @file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/checkedandfailed.txt");
$s = strtr($s, array("\r\r" => "\r", "\n\n" => "\n"));
preg_match_all("@^(.+)\r*$@mU", $s, $matches);
foreach ($matches[1] as $m) {
$checkedandfailed[] = $m;
}
$checkedandfailedread = 1;
}
if (in_array($f, $checkedandfailed)) {
return true;
}
}
function writetofailedlist($f)
{
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/checkedandfailed.txt", $f . "\r\n", FILE_APPEND);
}
function removefromfailedlist($f)
{
$s = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/checkedandfailed.txt");
$f = preg_quote($f, "@");
$s = preg_replace("@^$f\r*$@m", "", $s);
$s = strtr($s, array("\n\n" => "\n", "\r\r" => "\r"));
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/checkedandfailed.txt", $s);
}
function file_exists_after_converting($targetimgname, $targetwidth = "", $targetheight = 0, $imgsource = "", $colordepth = 0, $leastheight = 0, $overlay = 0, $forceupdate = 0, $background_r = 0, $background_g = 0, $background_b = 0, $crop = "", $overlayx = 0, $overlayy = 0, $overlayw = 0, $overlayh = 0)
{
//updated 20191120
global $targetfiletype;
$imgsource = preg_replace("@^http\://www.bonus-casino-en-ligne\.info@", "https://www.casinosschweiz.com", $imgsource);
if ($_GET['forceupdate']) $forceupdate = 1;
preg_match("#(\.(jpe?g|png|gif|svg))$#i", $targetimgname, $matches);
$targetfiletype = $matches[1];
if (!$targetfiletype) return;
$targetimgname = preg_replace("#(https?\://{$_SERVER['HTTP_HOST']})(.+)#iU", "$2", $targetimgname);
if ((substr($targetimgname, 0, 1) == "/")) $targetimgname = $_SERVER['DOCUMENT_ROOT'] . $targetimgname;
if ($forceupdate == 0) {
if (file_exists_case_sensitive($targetimgname)) return true;
}
$image = open_image($targetimgname, $imgsource, $originalsize); //xxxx.gif
if (!$image) return false;
if ($targetfiletype == ".svg") {
$dir = preg_replace("@[^/]+\.svg$@", "", $targetimgname);
if (!is_dir($dir)) @mkdir($dir);
if (file_put_contents($targetimgname, $image) === false) return false;
else return true;
}
$w = imagesx($image);
$h = imagesy($image);
if (!$targetwidth) $targetwidth = $w;
if (!$targetheight) {
$targetheight = (int) ($targetwidth * $h / $w);
if ($targetheight < $leastheight) $targetheight = $leastheight;
}
$im2 = ImageCreateTrueColor($targetwidth, $targetheight);
if ($targetfiletype == ".gif" or $targetfiletype == ".png") { // keep alpha
imagecolortransparent($im2, imagecolorallocatealpha($im2, 0, 0, 0, 127));
imagealphablending($im2, false);
imagesavealpha($im2, true);
} else { // create a background
$background = imagecolorallocate($im2, $background_r, $background_g, $background_b);
imagefill($im2, 0, 0, $background);
}
if ($crop) {
if ($w / $h >= $targetwidth / $targetheight) {
$src_w = $targetwidth / $targetheight * $h;
$src_h = $h;
$src_x = ($w - $src_w) / 2;
$src_y = 0;
} else {
$src_w = $w;
$src_h = $w * $targetheight / $targetwidth;
$src_x = 0;
$src_y = ($h - $src_h) / 2;
}
} else {
$src_w = $w;
$src_h = $h;
$src_x = 0;
$src_y = 0;
}
imagecopyResampled($im2, $image, 0, 0, $src_x, $src_y, $targetwidth, $targetheight, $src_w, $src_h);
if ($overlay) {
if ((!$overlayw or $overlayw < $targetwidth / 2) and (!$overlayh or $overlayh < $targetheight / 2)) {
$overlayfile = imagecreatefrompng($_SERVER['DOCUMENT_ROOT'] . $overlay);
if (!$overlayw) $overlayw = $targetwidth;
if (!$overlayh) $overlayh = $targetheight;
if ($overlayy < 0) $overlayy = $targetheight + $overlayy - $overlayh;
if ($overlayx < 0) $overlayx = $targetwidth + $overlayx - $overlayw;
imagecopy($im2, $overlayfile, $overlayx, $overlayy, 0, 0, $overlayw, $overlayh);
}
}
$folder_of_target = preg_replace("@/[^/]+$@", "", $targetimgname);
if (!file_exists($folder_of_target)) {
if (!@mkdir($folder_of_target, 0775, true)) return false;
}
switch ($targetfiletype) {
case ".gif":
imagegif($im2, $targetimgname);
break;
case ".jpg":
case ".jpeg":
imagejpeg($im2, $targetimgname, 65); // image qaulity 65/100
break;
case ".png":
if ($colordepth) imageTrueColorToPalette($im2, true, $colordepth);
imagepng($im2, $targetimgname, 1);
break;
}
imagedestroy($im2);
imagedestroy($image);
return true;
}
if (!function_exists("open_image")) {
function open_image($file, $path = "")
{ //20170713
$im = false;
preg_match("#([^\/]+)\.(jpe?g|png|gif|svg)$#i", $file, $matches);
$f = $matches[1];
$oriext = $matches[2];
if (!$path) {
preg_match("#(.*/)#i", $file, $matches);
$path = $matches[1];
}
if (substr($path, 0, 1) == "/") $path = $_SERVER['DOCUMENT_ROOT'] . $path;
if (substr($path, -1) == "/")
$fs = array("$path$f.$oriext");
elseif (preg_match("@/[^\./]+$@", $path))
$fs = array($path, "$path/$f.$oriext");
else $fs = array($path);
foreach ($fs as $f) {
if ($itype = @my_exif_imagetype($f)) {
$cf = checkedandfailed($f);
if (!$_GET['forceupdate'] and $cf) continue;
$rt = loadimg($f);
if (!$rt) {
if (!$cf) writetofailedlist($f);
continue;
} else {
if ($cf) removefromfailedlist($f);
return $rt;
}
break;
}
}
return false;
}
}
function loadimg_by_ftp($url)
{
$conn_id = ftp_connect("146.88.234.136");
$login_result = ftp_login($conn_id, "imgs338@bonus-casino-en-ligne.info", "XAllJKI2bpSe");
ftp_pasv($conn_id, true);
$file = "/" . preg_replace("@^http\://www.bonus-casino-en-ligne.info/img/@i", "", $url);
ob_start();
$result = ftp_get($conn_id, "php://output", $file, FTP_BINARY);
ftp_close($conn_id);
$rawdata = ob_get_contents();
ob_end_clean();
if ($rawdata) {
$image = @imagecreatefromstring($rawdata);
return $image;
}
}
function loadimg($url)
{
$rawdata = @file_get_contents($url);
if (substr($url, -4) == ".svg") return $rawdata;
if ($rawdata) $image = @imagecreatefromstring($rawdata);
return $image;
}
if (!function_exists("file_exists_case_sensitive")) {
function file_exists_case_sensitive($f)
{
if (!$f) return false;
if ($_SERVER['SystemRoot'] != "C:\Windows") return file_exists($f);
global $filesinfolder;
if (substr($f, 1, 1) == ":") $isabsolutepath = true;
if (!$isabsolutepath) $f = $_SERVER['DOCUMENT_ROOT'] . "/$f";
preg_match("@(.+/)(.+)@", $f, $matches);
$dir .= $matches[1];
$f = $matches[2];
if (!$filesinfolder[$dir]) $filesinfolder[$dir] = @scandir($dir);
if (!$filesinfolder[$dir]) return false;
if (in_array($f, $filesinfolder[$dir])) return true;
else return false;
}
}
function optimize_image(
$filenames,
$newwidth = 0,
$newheight = 0,
$oriwidth = 0,
$oriheight = 0,
$special = "",
$getmobile = 0,
$crop = "",
$overlay = "",
$overlayx = 0,
$overlayy = 0,
$overlayw = 0,
$overlayh = 0,
$mobilewidth = 0,
$imgmobileforcecenter = 0,
$imgdontenlargeonmobile = 0,
$keep_original_format = 0,
&$finalwidth = 0,
&$finalheight = 0
) {
global $msrc;
global $dont_force_png_to_jpg;
if ($dont_force_png_to_jpg) $keep_original_format = 1;
$msrc = array(); // IF NO $mobilewidth, if the source image width>300, then use 400 as width for mobile
//## filename format example: img/site/xxxx.jpg, if no dir path, path will be img/site/
if ($GLOBALS['previewmode']) return $filenames;
// if (strpos($_SERVER['HTTP_HOST'],".")===false) return $filenames;
// if ($newwidth==0 and $newheight==0) return $filenames;
if ($crop and (!$newwidth or !$newheight) and !$overlay) return $filenames;
if ($crop) {
$cropadd = "c";
}
$final = array();
if (!is_array($filenames)) {
$filenames = array($filenames);
} else $sourceisarray = true;
foreach ($filenames as $filename) {
$addslash = "";
$hasfoldername = false;
preg_match("@(.*)([^/]+)\.(jpe*g|png|gif)$@iU", $filename, $matches);
if (!$matches) {
$final[] = $filename;
continue;
}
if (preg_match("@(.*)([^/]+)\.(png)$@iU", $filename)) {
$ispng = 1;
} else $ispng = 0;
if ($matches[1]) {
$filenamewithpath = $filename;
$filenamewithoutpath = $matches[2] . "." . $matches[3];
$folder = $matches[1];
if (substr($folder, 0, 1) == "/") {
$folder = substr($folder, 1);
$addslash = "/";
}
$hasfoldername = true;
} else {
$filenamewithpath = "img/site/" . $filename;
$filenamewithoutpath = $filename;
$folder = "img/site/";
}
$newwidth = (int)$newwidth;
$newheight = (int)$newheight;
if (!$oriwidth) {
$imgsize = @getimagesize($_SERVER['DOCUMENT_ROOT'] . "/" . $folder . $filenamewithoutpath);
if (!$imgsize) {
$final[] = $filename;
continue;
}
$oriwidth = $imgsize[0];
$oriheight = $imgsize[1];
}
if ($newwidth > 0 and $newheight > 0 and $special == "proportional") {
$oldproportion = $oriwidth / $oriheight;
if ($newwidth / $newheight < $oldproportion) {
$newheight = (int)($oriheight * $newwidth / $oriwidth);
} else {
$newwidth = (int)($oriwidth * $newheight / $oriheight);
}
}
if ($newwidth == 0 and $newheight == 0) {
$newwidth = $oriwidth;
$newheight = $oriheight;
} else {
if ($newwidth == 0) $newwidth = (int)($newheight * $oriwidth / $oriheight);
if ($newheight == 0) $newheight = (int)($newwidth * $oriheight / $oriwidth);
}
if ($getmobile and !$imgdontenlargeonmobile) {
if ($oriwidth >= 300 or $mobilewidth) {
if (!$mobilewidth) {
$mobilewidth = $oriwidth;
if ($mobilewidth > 400) $mobilewidth = 400;
if ($newwidth > $mobilewidth) $mobilewidth = $newwidth; //???
}
$mobileheight = (int)($mobilewidth * $oriheight / $oriwidth);
if ($ispng and !$keep_original_format)
$mobilefilename = "~{$mobilewidth}/$mobileheight$cropadd/" . $filenamewithoutpath . ".jpg";
else
$mobilefilename = "~{$mobilewidth}/$mobileheight$cropadd/" . $filenamewithoutpath;
if (file_exists_after_converting("{$folder}$mobilefilename", $mobilewidth, $mobileheight, "{$folder}$filenamewithoutpath", 0, 0, $overlay, 0, 255, 255, 255, $crop, $overlayx, $overlayy, $overlayw, $overlayh)) {
if ($hasfoldername) {
$msrc[] = "$addslash{$folder}$mobilefilename";
} else {
$msrc[] = "$mobilefilename";
}
} else {
$msrc[] = "";
}
} else {
$msrc[] = "";
}
}
// if ($newwidth>=$oriwidth and $newheight>=$oriheight) {
// $final[]= $filename;
// continue;
// }
if ($ispng and !$keep_original_format)
$newfilename = "~{$newwidth}/$newheight$cropadd/" . $filenamewithoutpath . ".jpg";
else
$newfilename = "~{$newwidth}/$newheight$cropadd/" . $filenamewithoutpath;
if (file_exists_after_converting("{$folder}$newfilename", $newwidth, $newheight, "{$folder}$filenamewithoutpath", 0, 0, $overlay, 0, 255, 255, 255, $crop, $overlayx, $overlayy, $overlayw, $overlayh)) {
if ($hasfoldername) {
$final[] = "$addslash{$folder}$newfilename";
continue;
} else {
$final[] = "$newfilename";
continue;
}
} else {
$final[] = $filename;
}
}
$finalwidth = $newwidth;
$finalheight = $newheight;
if ($sourceisarray) return $final;
else {
if ($msrc) $msrc = $msrc[0];
return $final[0];
}
}
function oddsdata($matches)
{
global $sitedata;
if ($sitedata['using_template'] == "cfo") {
$visitlinkformat = "/visit/";
$xpp = "php";
} else {
$visitlinkformat = "/go/";
$xpp = "html";
}
$query = "SELECT * FROM manage_sports_betting WHERE id = {$matches[1]}";
$result = mnq($query);
if ($result) {
if ($r = mfs($result)) {
$n = array();
$v = array();
$cols = array();
preg_match_all("@^(.+)\:(.*)\r*$@Um", $r['odds'], $matches);
foreach ($matches[1] as $key => $o) {
$n[$key] = $o;
$j = explode("|", $matches[2][$key]);
foreach ($j as $jj) {
preg_match("@(.+) ([0-9\.]+)$@", $jj, $mat2);
if ($mat2) {
if (!in_array($mat2[1], $cols)) {
$cols[] = $mat2[1];
}
$v[$key][$mat2[1]] = $mat2[2];
}
}
}
foreach ($v as $ind => $k) {
$name = id2name("", $n[$ind]);
$s .= "<tr><td><a rel='nofollow' target='_blank' href='$visitlinkformat{$n[$ind]}.$xpp'>$name</a></td>";
foreach ($cols as $col) {
$s .= "<td>{$v[$ind][$col]}</td>";
}
$s .= "</tr>";
}
}
}
if ($s) {
foreach ($cols as $col) {
$row1 .= "<th>$col</th>";
}
return "<table id='sportodds' cellpadding='0' cellspacing='0'><tr><th>Bookmaker</th>$row1</tr>$s</table>";
}
}
function pagedata()
{
global $site;
global $ipcountry;
global $sitelan;
$d = preg_split("@\*\*(.+)\*\*@U", $site['data'], -1, PREG_SPLIT_DELIM_CAPTURE);
$c = count($d);
$i = 1;
$data = array();
while ($i < $c) {
switch ($d[$i]) {
case (preg_match("@casinolist\d+@", $d[$i]) === 1):
$t = trim($d[$i + 1]);
$v = preg_split("@(.+)\:@U", $t, -1, PREG_SPLIT_DELIM_CAPTURE);
$j = count($v);
$q = 1;
$w = array();
while ($q < $j) {
$w[$v[$q]] = trim($v[$q + 1]);
$q = $q + 2;
}
$goodv = $w[$ipcountry] or $goodv = $w["general"];
$goodv = explode("\r\n", $goodv);
$goodv = array_unique($goodv);
if ($goodv) {
foreach ($goodv as $q => $goodvv) {
$jj .= " WHEN '$goodvv' THEN $q";
}
$ids = implode(",", $goodv);
$query = "SELECT t1.*, t2.software_id, t2.name
FROM bcel_casino_plus AS t1 LEFT JOIN casinos AS t2 ON t1.casino_id=t2.casino_id
WHERE lan='$sitelan' AND
theorder>0 AND
find_in_set(t1.casino_id,'$ids')
ORDER BY CASE t1.casino_id $jj ELSE 999 END";
if ($w['title']) {
$data[$d[$i]] = top10list($query, $w['title'], "", 1, "span");
} else {
$data[$d[$i]] = top10list($query, "", "", 1, "span", "notitle");
}
}
}
$i = $i + 2;
}
return $data;
}
function casinolistreplace($matches)
{
global $data;
if (!isset($data)) $data = pagedata();
$m = $data[$matches[1]];
return $m;
}
function changediv($s)
{
$m = preg_split("@(<div(?: .*|)>|</div>)@iU", $s, -1, PREG_SPLIT_DELIM_CAPTURE);
$c = count($m);
if ($c == 1) return $s;
$i = 1;
while ($i < $c) {
$a[] = $i;
$i += 2;
}
foreach ($a as $n => $aa) {
if (preg_match("@^<div@i", $m[$aa]) and preg_match("@^</div>@i", $m[$a[$n + 1]])) {
if (!stripos($m[$aa], "item")) $m[$aa + 1] = formattext($m[$aa + 1]);
$m[$aa] = "\r\n" . substr_replace($m[$aa], "v", 4, 0) . "\r\n";
$m[$a[$n + 1]] = "\r\n</divv>\r\n";
unset($a[$n]);
unset($a[$n + 1]);
}
}
$s = implode("", $m);
$v = array_values($a);
if ($v and $v == $a) return $s;
else {
$s = changediv($s);
}
return $s;
}
function faq_process($matches)
{
global $site;
global $sitedata;
if ($sitedata['using_template'] == "bcel" and $site['page_url'] == "/") return bcel_faq_process($matches);
$t = $site['faq'];
$e = preg_split("@^(q|a)\:\r*$@im", $t, -1);
$c = count($e) - 1;
if ($c > 1) {
$i = 0;
while ($i++ < $c / 2) {
$v = trim($e[$i * 2 - 1]);
$w = formattext($e[$i * 2]);
// don't delete the empty lines!
$s .= <<<A
<div itemscope itemprop='mainEntity' itemtype='https://schema.org/Question'>
<h3 itemprop='name'>$v</h3>
<div itemscope itemprop='acceptedAnswer' itemtype='https://schema.org/Answer'>
<div itemprop='text'>
$w
</div>
</div>
</div>
A;
}
// don't delete the empty lines!
$s = <<<A
<div itemscope itemtype='https://schema.org/FAQPage'>
$s</div>
A;
return $s;
}
}
function schema_process($matches)
{
global $site;
$a = array();
$year = date('Y');
$site['schema_markup'] = str_replace('$year', $year, $site['schema_markup']);
$p = preg_split("@\*(schema\d+)\*@", $site['schema_markup'], -1, PREG_SPLIT_DELIM_CAPTURE);
$c = count($p);
$i = 1;
while ($i < $c) {
if ($p[$i] == $matches[1]) {
return strtr(trim($p[$i + 1]), array("\r" => "", "\n" => "",));
}
$i = $i + 2;
}
}
function image_default_link()
{
global $site;
global $sitetypegeneral;
global $sitelan;
global $ipcountry;
global $sitetypesall;
global $sitedata;
$t = "";
if ($site['type'] == "news" or $site['type'] == "newsarticle") {
$getidname = getidname();
$t = $site[$getidname] or $t = $site['cta_casino_bm_poker_id'];
if (cbpgood($t)) {
$vlink_format_by_template = array("bcel" => "/casino/*id*/go.html", "tcc" => "/go/*id*");
$vfmt = $sitedata['vlink_format'] or $vfmt = $vlink_format_by_template[$sitedata['using_template']] or $vfmt = "/go/*id*.html";
$t = $sitedata['suffix'] . strtr($vfmt, array("*id*" => $t));
} else {
$t = "";
}
}
return $t;
}
function siteimgs()
{
global $site;
global $imagepath;
global $sitedata;
global $siteimgs;
global $last_main_image;
if (isset($siteimgs)) {
if ($site['image'] == $last_main_image) return $siteimgs;
}
if ($site['pic_url']) {
$site['image'] = $site['pic_url'];
$imagepath = "/newsimages/";
if (strpos($site['newstype'], "promotional_news") !== false and $site['promo_link']) {
$site['image_link'] = $site['promo_link'];
}
}
if (!$imagepath) $imagepath = "/img/site/";
$imgs = array();
if ($site['image']) {
$last_main_image = $site['image'];
if ($site['under_image']) {
$underi = preg_split("@(<a .+</a>)@Ui", $site['under_image'], -1, PREG_SPLIT_DELIM_CAPTURE);
$ni = -2;
while ($ni < count($underi) - 2) {
$ni = $ni + 2;
$underi[$ni] = preg_replace("@((?:http\:\/\/|www).\S+)@s", "<a href='$1'>$0</a>", $underi[$ni]);
}
$site['under_image'] = implode("", $underi);
$site['under_image'] = strtr($site['under_image'], array("href='www" => "href='http://www"));
}
$site['image_link'] = preg_replace_callback("@\*(goto|goex|gotc)(?:\s+([a-zA-Z0-9\-\:\_]+))?(?:\s*\[([^\]]*)\])?\*@", "addvisitlinksdirect", $site['image_link']);
if ($site['image_link']) {
$site['image_link'] = strtr($site['image_link'], array("href='www" => "href='http://www"));
}
$site['image'] = strtr($site['image'], array("/" => "\\"));
$mimg = "0:{$site['image']}/auto/{$site['picmain_width']}/{$site['picmain_height']}/{$site['under_image']}{}{$site['image_alt_text']}{}{$site['image_link']}\n";
}
$siteimagesplus = $mimg . $site['images'];
preg_match_all("@^(-?\d+)\:([^\/]+)(?:\/([^\/]*)|)(?:\/([^\/]*)|)(?:\/([^\/]*)|)(?:\/(.*)(?:\{\}(.*)|)(?:\{\}(.*)|)(?:\{\}(.*)|)|)(?:\r|)$@mU", $siteimagesplus, $matches2);
foreach ($matches2[1] as $key => $m2) {
$other_img_settings = $matches2[9][$key];
$mobilewidth = "";
$imgmobileforcecenter = 0;
$imgdontenlargeonmobile = 0;
if ($other_img_settings) {
$rms = preg_split("@(?:(mw|mc|dl)\:)@", $other_img_settings, -1, PREG_SPLIT_DELIM_CAPTURE);
$rmscount = count($rms);
$rmsi = 1;
while ($rmsi < $rmscount) {
switch ($rms[$rmsi]) {
case "mw":
$mobilewidth = trim($rms[$rmsi + 1]);
break;
case "mc":
$imgmobileforcecenter = trim($rms[$rmsi + 1]);
break;
case "dl":
$imgdontenlargeonmobile = trim($rms[$rmsi + 1]);
break;
}
$rmsi += 2;
}
}
$thelk = $matches2[8][$key];
$thelk = preg_replace_callback("@\*(goto|goex|gotc)(?:\s+([a-zA-Z0-9\-\:\_]+))?(?:\s*\[([^\]]*)\])?\*@", "addvisitlinksdirect", $thelk);
$imgs[$m2] = array($matches2[2][$key], $matches2[3][$key], $matches2[4][$key], $matches2[5][$key], $matches2[6][$key], $matches2[7][$key], $thelk);
if (!in_array($imgs[$m2][1], array("none", "right", "auto"))) $imgs[$m2][1] = "left";
if (!$imgs[$m2][2] or $imgs[$m2][1] == "auto") { // if no width or FROM old main image
$image_w = array();
if (preg_match("@^~~temp~~(\d+)~(.+)@", $imgs[$m2][0], $mch)) {
$isrc = getenv('RBO_URL')."/img/drafts/{$mch[1]}/{$mch[2]}";
} else {
if (strpos($imgs[$m2][0], "\\") !== false) {
$imgs[$m2][0] = strtr($imgs[$m2][0], array("\\" => "/"));
$imgwithpath = $imgs[$m2][0];
} else {
$imgwithpath = "$imagepath{$imgs[$m2][0]}";
}
$isrc = "{$_SERVER['DOCUMENT_ROOT']}$imgwithpath";
}
$image_w = @my_getimagesize($isrc);
if (!$image_w) {
unset($imgs[$m2]);
continue;
}
$screen_w = page_image_maxwidth("img$key");
switch ($sitedata['using_template']) {
case "gr2":
$floatnonefrom = 0.7;
break;
case "clf":
$floatnonefrom = 0.7;
break;
case "pro":
$floatnonefrom = 0.8;
break;
case "cfo":
$floatnonefrom = 0.75;
break;
case "ocs":
$floatnonefrom = 0.7;
break;
case "tcc":
$floatnonefrom = 0.7;
break;
case "pssch":
$floatnonefrom = 0.65;
break;
default:
$floatnonefrom = 0.85;
}
if ($imgs[$m2][1] == "auto") {
$site['picmain_maxwidth'] = $screen_w;
$site['picmain_width_ori'] = $image_w[0];
$site['picmain_height_ori'] = $image_w[1];
if ($site['picmain_width'] and $site['picmain_height']) {
$imgs[$m2][2] = $site['picmain_width'] . "px";
$imgs[$m2][3] = $site['picmain_height'] . "px";
} elseif ($site['picmain_width']) {
$imgs[$m2][2] = $site['picmain_width'] . "px";
} elseif ($site['picmain_height']) {
$site['picmain_width'] = $site['picmain_width_ori'] * $site['picmain_height'] / $site['picmain_height_ori'];
$imgs[$m2][2] = $site['picmain_width'] . "px";
} else {
$site['picmain_width'] = $site['picmain_width_ori'];
}
if ($site['picmain_width'] > $site['picmain_maxwidth'] * $floatnonefrom) {
$imgs[$m2][1] = "none";
$imgs[$m2][2] = $screen_w . "px";
$imgs[$m2][3] = "auto";
} else {
$imgs[$m2][1] = "left";
if (!$imgs[$m2][2]) $imgs[$m2][2] = min($screen_w - 10, $image_w[0]) . "px";
if (!$imgs[$m2][3]) $imgs[$m2][3] = "auto";
}
} else {
if ($imgs[$m2][1] == "none") {
$imgs[$m2][2] = $screen_w . "px";
} else {
$imgs[$m2][2] = min($screen_w - 10, $image_w[0]) . "px";
}
$imgs[$m2][3] = "auto";
}
} else {
if ($imgs[$m2][2]) $imgs[$m2][2] .= "px";
else $imgs[$m2][2] = "auto";
if ($imgs[$m2][3]) $imgs[$m2][3] .= "px";
else $imgs[$m2][3] = "auto";
}
$imgs[$m2][7] = $mobilewidth;
$imgs[$m2][8] = $imgmobileforcecenter;
$imgs[$m2][9] = $imgdontenlargeonmobile;
}
$siteimgs = $imgs;
return $imgs;
}
function id_standardize($id)
{
global $non_standard_ids;
global $all_good_cbp;
if (cbpgood($id)) {
return $id;
}
if ($non_standard_ids[$id]) {
return $non_standard_ids[$id];
}
$idlower = strtolower($id);
foreach ($all_good_cbp as $t) {
if ($idlower == strtolower($t)) {
$non_standard_ids[$id] = $t;
return $t;
}
}
return $id;
}
function addfreegamelinks($matches)
{
global $allfreegames;
global $ismobilephone;
global $sitedata;
global $extra_type_folder;
$fmt = $sitedata['freegame_format'];
if ($extra_type_folder) $fmt = substr($extra_type_folder, 0, -1) . $fmt;
if (!$fmt) return;
if (!isset($allfreegames)) {
if ($ismobilephone) {
$f = "link_works_mobile";
} else {
$f = "link_works_desktop";
}
$allfreegames = array();
$query = "SELECT game_id_new, game_name, $f FROM freegames_newnew";
$result = mnq($query);
while ($r = mfs($result)) {
$allfreegames[$r['game_id_new']] = array($r['game_name'], $r[$f]);
}
}
$gid = trim($matches[1]);
if (!$gid) {
return;
}
if ($allfreegames[$gid]) {
$anchor = $matches[2] or $anchor = $allfreegames[$gid][0];
if ($allfreegames[$gid][1] == 1) {
$k = strtr($fmt, array('$id' => $gid));
return "<a href='$k'>$anchor</a>";
} else {
return $anchor;
}
} else {
return $matches[2];
}
}
function px_process($a)
{
global $allcbp;
global $tops_default_sbgj;
global $univ_tops;
$p = $a[2];
if (preg_match("@^p(\d+)(?:\:([sbgj])_([a-z0-9\-]+))?@", $p, $matp)) {
if (!isset($allcbp)) {
$allcbp = allcbp();
}
$pps = array("s" => "software_id", "b" => "banking_id", "g" => "games", "j" => "jurisdiction");
$tops = tops();
if ($matp[1] <= 3) {
$tx = $matp[1] - 1;
if ($matp[2]) {
if (!isset($tops_default_sbgj[$matp[2]][$matp[3]])) {
get_top_table("", "", $matp[2] . "_" . $matp[3], ""); // to get $univ_tops
$tops_default_sbgj[$matp[2]][$matp[3]] = $univ_tops;
}
$link = $tops_default_sbgj[$matp[2]][$matp[3]][$tx];
} else {
$link = $tops['array'][$tx];
}
}
} else {
return $a;
}
if ($link) {
$a[2] = $link;
} else {
$a[2] = "null";
}
return $a;
}
function addvisitlinks($matches)
{
global $sitetypesall;
global $sitelan;
global $ipcountry;
global $site;
global $getidname;
global $sitedata;
$matches = px_process($matches);
$matches[3] = trim($matches[3]);
if (!$getidname) {
$getidname = getidname();
}
$id = $matches[2] or $id = $site[$getidname];
if ($id == "null") {
$id = "";
} else {
$id = trim($id);
$id = id_standardize($id);
}
if (!$matches[3]) {
$matches[3] = id2name("", $id);
}
if (!$matches[3]) {
return;
}
if (!$id or !cbpgood($id)) {
return $matches[3];
}
$lk = getvistlinkurl($id, $matches[1]);
$s = "<a rel='nofollow' target='_blank' href='{$sitedata['suffix']}$lk'>{$matches[3]}</a>";
return $s;
}
function addvisitlinksdirect($matches)
{
global $sitetypesall;
global $sitelan;
global $ipcountry;
global $site;
global $getidname;
global $sitedata;
$matches = px_process($matches);
if (!$getidname) $getidname = getidname();
$id = $matches[2] or $id = $site[$getidname];
if ($id == "null") $id = "";
else {
$id = trim($id);
$id = id_standardize($id);
}
if (!$id or !cbpgood($id)) {
return;
}
$lk = getvistlinkurl($id, $matches[1]);
$s = $lk;
return "{$sitedata['suffix']}$s";
}
function univ_shortcuts($r)
{
$a = array("maintitle", "meta_title", "meta_description");
foreach ($a as $aa) {
if (isset($r[$aa])) $r[$aa] = formattitle($r[$aa]);
}
return $r;
}
function formattitle($t)
{
$t = strtr($t, array('$month(uppercase_first)' => ucfirst(getMois_univ(date("F"))), '$month' => getMois_univ(date("F")), '$year' => date("Y")));
return $t;
}
function banner_replace($matches)
{
global $site;
global $sitelan;
global $sitetypesall;
global $ipcountry;
global $dontshow2versions;
global $isrealphone;
if ($GLOBALS['univ_nolink']) {
return "<!-- banner error: univ_nolink -->";
}
$idname = getidname();
$theid = $site[$idname];
if (!cbpgood($theid)) {
return "<!-- banner error: casino/bookmaker invalid -->";
}
$img = "/img/bns/{$theid}_{$sitelan}_{$matches[2]}.jpg";
$imgm = "/img/bns/{$theid}_{$sitelan}_{$matches[2]}_m.jpg";
if ($dontshow2versions) {
if ($isrealphone) {
$im = $imgm;
} else {
$im = $img;
}
if (file_exists_after_converting($im, "", 0, getenv('RBO_URL').$im)) {
$md5 = md5_file($_SERVER['DOCUMENT_ROOT'] . $im);
$v = getvistlinkurl($theid);
$s = <<<A
<div class="banners imgintxt floatnone fullonmobile"><a rel="nofollow" target='_blank' href='{$GLOBALS['sitedata']['suffix']}$v'><img alt="" src="$im?v=$md5"></a></div>
A;
return $s;
} else {
return "<!-- banner error: banner $im n/a -->";
}
} else {
if (file_exists_after_converting($img, "", 0, getenv('RBO_URL').$img)) {
$md5 = md5_file($_SERVER['DOCUMENT_ROOT'] . "/img/bns/{$theid}_{$sitelan}_{$matches[2]}.jpg");
if (file_exists_after_converting($imgm, "", 0, getenv('RBO_URL').$imgm)) {
$md5m = md5_file($_SERVER['DOCUMENT_ROOT'] . "/img/bns/{$theid}_{$sitelan}_{$matches[2]}_m.jpg");
$msrc = "$imgm?v=$md5m";
}
$v = getvistlinkurl($theid);
$s = <<<A
<div class="banners imgintxt floatnone fullonmobile"><a rel="nofollow" target='_blank' href='{$GLOBALS['sitedata']['suffix']}$v'><img alt="" src="$img?v=$md5" data-msrc="$msrc"></a></div>
A;
return $s;
} else {
return "<!-- banner error: banner $img n/a -->";
}
}
}
function force_domain_change($t)
{
global $force_chanage_domains;
if (!$force_chanage_domains) return $t;
$t = str_ireplace(array_keys($force_chanage_domains), array_values($force_chanage_domains), $t);
return $t;
}
function formattext_in($matches)
{
$t = formattext($matches[2]);
return $matches[1] . $t . $matches[3];
}
function formattext($t, $addlink = "", $selfurl = "")
{
global $image_default_link;
global $sitedata;
global $localmode;
global $sitetypegeneral;
global $sitelan;
global $ipcountry;
global $sitetypesall;
global $univ_nolink;
global $dontshow2versions;
global $isrealphone;
global $previewmode;
global $ourtypes;
$sitedata['root'] = preg_replace("@^[^/]+@", "", $sitedata['url']) . "/";
$sitedata['suffix'] = substr($sitedata['root'], 0, -1);
if (!$localmode) {
$hpre = $sitedata['suffix'];
} else {
$hpre = "";
}
if (!isset($image_default_link)) {
$image_default_link = image_default_link();
}
$t = remove_special_space($t);
$t = str_replace(chr(194) . chr(160), '', $t);
$t = strtr($t, array('$month(uppercase_first)' => ucfirst(getMois_univ(date("F"))), '$month' => getMois_univ(date("F")), '$year' => date("Y")));
$t = changediv($t);
$t = preg_replace("@<divv@iU", "<div", $t);
$t = preg_replace("@</divv>@i", "</div>", $t);
global $imagepath;
global $site_protocol;
global $sitelan;
global $sitedata;
global $site;
global $toptagavailable;
if (!$imagepath) {
$imagepath = "/img/site/";
}
$t = trim($t);
if ($t == "") {
return "";
}
$t = preg_replace("@(\*img\d+(\(\d*\))?\*)\s*(?!(\r|\n))@", "$1\r\n", $t);
$t = preg_replace("@(?<!(?:\n))\s*(\*img\d+(\(\d*\))?\*)@", "\r\n$1", $t);
if ($sitedata['using_template'] == "bcel") {
$t = preg_replace_callback("@(?<!(?:\n))\s*\*\*(casinolist\d+)\*\*@", "casinolistreplace", $t);
}
if ($site_protocol == "https://") {
$t = preg_replace("@<iframe[^>]+src\s*\=\s*[\"|\']http\://[^>]+>\s*</iframe>@Uis", "", $t);
}
$t = adjust_https($t);
$t = preg_replace_callback("@(<center.*>)(.+)(</center>)@Ui", "formattext_in", $t);
$t = preg_replace_callback("@<(i|b|em|strong)>((?:(?!<\g1[> ]).)+)</\g1>@Uis", "puttageachline", $t);
$t = preg_replace_callback("@<table(\h(?:(?!<table).)+)*>.*</table>@Uisu", "rearrangetable", $t);
$t = preg_replace("@<iframe.+>.*</iframe>@Uisu", "<center>$0</center>", $t);
$t = preg_replace_callback("@\*odds(\d+)\*@U", "oddsdata", $t);
// $t= force_domain_change($t);
$t = preg_replace_callback("@((?:<p>)*\*banner(\d+)\*(?:</p>)*)@", "banner_replace", $t);
if (preg_match_all("@(\=[\"\']|)((?:<p>)*\*img(\d+)(?:\((\d*)\))?\*(?:</p>)*)@", $t, $matches)) {
$siteimgs = siteimgs();
$imgs = $siteimgs;
if ($imgs) {
foreach ($matches[2] as $key => $m) {
if ($matches[1][$key]) {
$imgcodeonly = 1;
} else {
$imgcodeonly = 0;
}
$imgid = $matches[3][$key];
if ($matches[3][$key] == 0 and $imgs[-1]) {
$imgidmobile = -1;
} else {
$imgidmobile = $matches[4][$key];
}
$isrcmobile = "";
$fullsrcmobile = "";
if (!$imgs[$imgid][0]) {
$t = strtr($t, array($m => ""));
continue;
}
if (preg_match("@^~~temp~~(\d+)~(.+)@", $imgs[$imgid][0], $mch)) {
$isrc = getenv('RBO_URL')."/img/drafts/{$mch[1]}/{$mch[2]}";
$fullsrc = $isrc;
} else {
if (strpos($imgs[$imgid][0], "/") !== false) {
$isrc = $imgs[$imgid][0];
if ($imgidmobile) {
$isrcmobile = $imgs[$imgidmobile][0];
}
} else {
$isrc = "$imagepath{$imgs[$imgid][0]}";
if ($imgidmobile) {
$isrcmobile = "$imagepath{$imgs[$imgidmobile][0]}";
}
}
$fullsrc = $_SERVER['DOCUMENT_ROOT'] . $isrc;
if ($imgidmobile) $fullsrcmobile = $_SERVER['DOCUMENT_ROOT'] . $isrcmobile;
}
/*
if ($imgs[$imgid][2]=="auto") {
$imginfo=@getimagesize($fullsrc);
$imgs[$imgid][2]=$imginfo[0]."px";
}
if ($imgidmobile) {
if ($imgs[$imgidmobile][2]=="auto") {
$imginfomobile=@getimagesize($fullsrcmobile);
$imgs[$imgidmobile][2]=$imginfomobile[0]."px";
}
}
*/
if ($imgs[$imgid][4]) {
$txtwidth = (int)$imgs[$imgid][2];
$txt = "<div style='max-width:{$txtwidth}px;'>{$imgs[$imgid][4]}</div>";
} else {
$txt = "";
}
if ($isrcmobile and !$dontshow2versions) { // if use another image for mobile
$isrcmobile = optimize_image($isrcmobile, 400);
}
if (!$dontshow2versions and !$isrcmobile and in_array($imgs[$imgid][1], array("left", "right"))) {
$getmobile = 1;
} else {
$getmobile = 0;
}
global $msrc;
$watermarkfile = "";
$overlayx = 0;
$overlayy = 0;
$overlayw = 0;
$overlayh = 0;
$mobilewidth = $imgs[$imgid][7]; // not used yet
$imgmobileforcecenter = $imgs[$imgid][8]; // not used yet
$imgdontenlargeonmobile = $imgs[$imgid][9];
/*
if ($sitedata['short']=="clf") {
global $site;
if ($matches[3][$key]==0 and $site['type']=="news") {
} else {
$watermarkfile="/img/others/wm.png";
$overlayx=20;
$overlayy=-20;
$overlayw=209;
$overlayh=58;
}
}
*/
if ($dontshow2versions and $isrealphone) {
if ($isrcmobile) {
$mw = 400;
} else {
if (!$imgdontenlargeonmobile and $imgs[$imgid][2] >= 300) {
$mw = 400;
} else {
$mw = $imgs[$imgid][2];
}
$isrcmobile = $isrc;
}
$isrcmobile = optimize_image($isrcmobile, $mw, 0, 0, 0, "", 0, "", $watermarkfile, $overlayx, $overlayy, $overlayw, $overlayh, 0, 0, 0, 0, $finalwidth, $finalheight);
} else {
if ($previewmode) {
if (substr($imgs[$imgid][2], -2) == "px") {
$finalwidth = substr($imgs[$imgid][2], 0, -2);
} else {
$finalwidth = $imgs[$imgid][2];
}
if (!$finalwidth){
$finalwidth = "auto";
}
$finalheight = "auto";
} else {
$isrc = optimize_image($isrc, $imgs[$imgid][2], $imgs[$imgid][3], 0, 0, "", $getmobile, "", $watermarkfile, $overlayx, $overlayy, $overlayw, $overlayh, $mobilewidth, $imgmobileforcecenter, $imgdontenlargeonmobile, 0, $finalwidth, $finalheight);
}
if ($msrc) {
$isrcmobile = $msrc;
}
}
if ($imgcodeonly) {
$img = $isrc;
} else {
$xdata = "";
if ($isrcmobile && !$dontshow2versions) {
if (!$mobilewidth && !$imgdontenlargeonmobile) {
$addclassfullonmobile = " fullonmobile";
}
if ($isrcmobile != $isrc) {
$xdata = " data-msrc = '$isrcmobile'";
}
} else {
$addclassfullonmobile = "";
}
if ($dontshow2versions and $isrealphone) $imgs[$imgid][1] = "none";
$img = "<div class='imgintxt float{$imgs[$imgid][1]}$addclassfullonmobile'>";
$imgs[$imgid][5] = htmlentities($imgs[$imgid][5], ENT_COMPAT, "UTF-8");
if ($previewmode) {
$ar = "";
} else {
$ar = $GLOBALS['rootpath'];
}
if ($finalwidth != "auto") {
$finalwidth .= "px";
}
if ($finalheight != "auto") {
$finalheight .= "px";
}
$source = in_array($sitedata['using_template'],['clf','parier'])?'data-src':'src';
if ($dontshow2versions) {
if ($isrealphone) {
$imgcore = "<img alt=\"{$imgs[$imgid][5]}\" style='width:{$finalwidth};height:{$finalheight};' {$source}='$ar$isrcmobile' />";
} else {
$imgcore = "<img alt=\"{$imgs[$imgid][5]}\" style='width:{$finalwidth};height:{$finalheight};' {$source}='$ar$isrc' />";
}
} else {
$imgcore = "<img alt=\"{$imgs[$imgid][5]}\" style='width:{$finalwidth};height:{$finalheight};' {$source}='$ar$isrc'$xdata />";
}
if (!$imgs[$imgid][6] and $image_default_link) $imgs[$imgid][6] = $image_default_link;
if ($imgs[$imgid][6]) $img .= "<a href=\"{$imgs[$imgid][6]}\">$imgcore</a>";
else $img .= $imgcore;
$img .= "$txt</div>";
}
$t = strtr($t, array($m => $img));
}
}
}
if ($addlink) {
global $wordsarray;
if (!$wordsarray) $addlink = 0;
if ($selfurl) {
//delete self link:
foreach ($wordsarray as $key => $vv) {
if (stripos($vv, $selfurl) !== false) $wordsarray[$key] = $key;
}
}
}
$myarray = explode(chr(13), $t);
$t = "";
$nchange = array();
foreach ($myarray as $m) {
if ($m = trim($m)) {
$m_plus = preg_replace("@<(a|b|em|strong|i|span|mark)(\h(?:(?!/\g1>).)+)*>@iU", "", $m);
$m_plus = preg_replace("@</(a|b|em|strong|i|span|mark)>@i", "", $m_plus);
if (
(!(substr($m_plus, -1) == ">" and substr($m_plus, 0, 1) == "<"))
and !(substr($m_plus, 0, 3) == "<ul" or substr($m_plus, 0, 3) == "<li")
) {
$m = "<p>$m</p>";
}
$mlower = strtolower($m);
if ($addlink and (substr($mlower, 0, 2) == "<p" or substr($mlower, 0, 3) == "<ul" or substr($mlower, 0, 3) == "<li")) {
$lastoff = 0;
$goods = 0;
$uuu = array();
$toexit = false;
while (!$toexit) {
if (($lastoff = strpos($m, "<", $goods)) === false) {
$lastoff = strlen($m);
$toexit = true;
}
if ($goods != $lastoff) {
$uuu[] = substr($m, $goods, $lastoff - $goods);
}
if (($goods = strpos($m, ">", $lastoff)) !== false) {
$goods = $goods + 1;
$uuu[] = substr($m, $lastoff, $goods - $lastoff);
} else {
break;
}
}
$fs = '';
foreach ($uuu as &$u) {
if (substr($u, 0, 1) != "<") {
$fs .= strtr($u, $wordsarray);
} else {
$fs .= $u;
}
}
$m = $fs;
}
$t = $t . $m;
}
}
// remove redundant links
/*
$linkhistory=array();
$theoffset=-1;
while (strpos($t, "<a ", $theoffset+1) !== false) {
$theoffset=strpos($t, "<a ", $theoffset+1);
$endfirstpart=strpos($t, ">", $theoffset);
$beginsecondpart=strpos($t, "</a>", $theoffset);
$thelink=substr($t, $theoffset+2, $endfirstpart-3-$theoffset);
if (strpos($thelink, "/casino/") !== false) {
if (in_array($thelink, $linkhistory)) {
$t=substr_replace($t, "", $beginsecondpart, 4);
$t=substr_replace($t, "", $theoffset, $endfirstpart-$theoffset+1);
} else {
$linkhistory[]=$thelink;
}
}
}
*/
global $likeusapage;
if (in_array($sitedata['using_template'], array("bcel", "clf", "pel", "cfo")) && !$likeusapage) {
$t = preg_replace_callback("@(?:<p>)?\*\*([a-zA-Z0-9]+)\*\*(?:</p>)?@", "process_data", $t);
}
if (preg_match("@(<p>|)\*index\*(</p>|)@i", $t)) {
global $indextext;
$t = preg_replace_callback("@(?<!\()<h([2345])([^>]*)>(.+</h\g1>)@iU", "calch", $t);
if ($indextext[""]) {
$k = process_ind("");
}
$dt = array( "es" => "Indice",
"en" => "Topics",
"de" => "Inhaltsverzeichnis",
"sv" => "Innehåll",
"fi" => "Hakemisto",
"no" => "Innhold",
"fr" => "Sommaire",
"pt" => "Índice",
"pl" => "Sumaryczny"
);
// $extra=dev("articleindex");
if($sitedata['using_template'] == 'gr2'){
if ($k) $t = preg_replace("@(<p>|)\*index\*(</p>|)@i", "<div id='articleindex'><div id='articleindextitle'>{$dt[$sitelan]}</div></div>$extra", $t);
else $t = $t = preg_replace("@(<p>|)\*index\*(</p>|)@i", "", $t);
}
else {
if ($k) $t = preg_replace("@(<p>|)\*index\*(</p>|)@i", "<div id='articleindex'><div id='articleindextitle'>{$dt[$sitelan]}</div>$k<br style='clear:both;' /></div>$extra", $t);
else $t = $t = preg_replace("@(<p>|)\*index\*(</p>|)@i", "", $t);
}
}
$t = preg_replace_callback("@(?:<p>|)\*(schema\d+)\*(?:</p>|)@i", "schema_process", $t);
$t = preg_replace_callback("@(?:<p>|)\*faq\*(?:</p>|)@i", "faq_process", $t);
if (in_array($sitedata['using_template'], array("bcel"))) {
$t = preg_replace_callback("@(<p>|)\*gamereview_+([a-zA-Z0-9_-]+)\*(</p>|)@i", "game_review_shortcode", $t);
}
$t = preg_replace_callback("@(<p>|)\*ctabox\s+([a-zA-Z0-9\-\:\_]+)\s*(?:\[([^\]]+)\])\*(</p>|)@i", "ctabox_process_new", $t);
$t = preg_replace_callback("@(<p>|)\*ctaboxinternal\s+([a-zA-Z0-9\-\:\_[.html\/]+)\s*(?:\[([^\]]+)\])\*(</p>|)@i", "transformInternalCtaBox", $t);
$t = preg_replace_callback("@(<p>|)\*childrenlist\*(</p>|)@i", "childrenlist", $t);
while (preg_match("@(<p>|)\*ctabox(\d*)\*(</p>|)@i", $t, $matches)) {
$vfmtremove = 0;
$vlink_format_by_template = array("bcel" => "/casino/*id*/go.html", "tcc" => "/go/*id*");
$vfmt = $sitedata['vlink_format'] or $vfmt = $vlink_format_by_template[$sitedata['using_template']] or $vfmt = "/go/*id*.html";
$site['cta'] = trim($site['cta']);
if ($vfmt && $site['cta']) {
$ctanumber = $matches[2] or $ctanumber = 1;
$ctas = explode("\n", $site['cta']);
$ctatext = trim($ctas[$ctanumber - 1]) or $ctatext = trim($ctas[0]);
$ctatext = strip_tags($ctatext, "<span><b><i><em><u>");
if (cbpgood($site['cta_casino_bm_poker_id'])) {
$class = ctaboxclass($sitedata['using_template']);
$v = strtr($vfmt, array("*id*" => $site['cta_casino_bm_poker_id']));
$m = preg_replace("@\*(.+)\*@U", "$1", $ctatext);
$m = "<a$class href='$hpre$v'>$m</a>";
$m = "<div class='ctabox'>$m</div>";
$m = preg_replace("@\\$(\d)@", "\\\\$$1", $m);
$t = preg_replace("@(<p>|)\*ctabox{$matches[2]}\*(</p>|)@", $m, $t);
} else {
$vfmtremove = 1;
}
} else {
$vfmtremove = 1;
}
if ($vfmtremove) {
$t = preg_replace("@(<p>|)\*ctabox{$matches[2]}\*(</p>|)@", "", $t);
}
}
$tpstring = implode("|", $ourtypes);
$t = preg_replace_callback("@<p>\*($tpstring)?top(\d+|x)(?:\:(.*)|)(?:\((.*)\)|)\*</p>@U", "topreplace", $t);
$t = preg_replace_callback("@((?:<p>)*\*plus(\d+)(?:\s+([a-zA-Z0-9\-]+))?(?:\((.*)\))?\*(?:</p>)*)@", "plus_replace", $t);
$t = preg_replace_callback("@\*(goto|goex|gotc)(?:\s+([a-zA-Z0-9\-\:\_]+))?(?:\s*\[([^\]]*)\])?\*@", "addvisitlinks", $t);
$t = preg_replace_callback("@\*play(?:\s+([a-zA-Z0-9\-]+))(?:\s*\[([^\]]*)\])?\*@", "addfreegamelinks", $t);
$t = preg_replace_callback("@<p>\*all_casinos\*</p>@", "add_all_casinos", $t);
return $t;
}
function add_all_casinos($matches)
{
global $sitedata;
switch ($sitedata['using_template']) {
case "bcel":
return all_casinos_table();
default:
return;
}
}
function topreplace($matches)
{
global $toptagavailable;
$toptagavailable = 1;
$type = $matches[1];
if ($matches[2] != "x") $max = $matches[2];
else $max = "";
if ($matches[4]) $title = $matches[4];
else $title = "";
$top= get_top_table($max, $title, $matches[3], $type);
return '<div class="top-style">'.$top.'</div>';
}
function childrenlist($matches)
{
global $sitedata;
switch ($sitedata['using_template']) {
case "pel":
return indexlist();
case "ocrb":
return hpposts();
default:
return "";
}
}
function banking_remove_tail(&$item2, $key)
{
$item2 = strtr($item2, array("(1)" => "", "(2)" => "", "(3)" => ""));
}
/**
* Short code replacer for ctaboxinternal.
*
* @param string[] $matches The result from preg_replace_callback.
*
* @return string HTML formatted string (as an internal link).
*/
function transformInternalCtaBox($matches){
global $sitedata;
$templateInUse = $sitedata['using_template'];
$class = getClassForInternalCtaBox($templateInUse);
$location = $matches[2];
$text = $matches[3];
return "<div class='ctabox'><a rel='nofollow' $class href='$location'>$text</a></div>";
}
/**
* Get the correct class for the internal cta box based on the template used.
*
* @param string $template The template in use.
*
* @return string HTML formatted string (as a class attribute).
*/
function getClassForInternalCtaBox($template)
{
switch ($template) {
case "pel":
return "class='vb1 ctabox-internal'";
default:
return "class='ctabox-internal'";
}
}
function ctabox_process_new($matches)
{
global $sitetypegeneral;
global $sitelan;
global $ipcountry;
global $sitedata;
global $tops;
global $allgbp;
global $tops_default_sbgj;
global $univ_tops;
$class = ctaboxclass($sitedata['using_template']);
$link = $matches[2];
if (preg_match("@^p(\d+)(?:\:([sbgj])_([a-z0-9\-]+))?@", $link, $matp)) {
if (!isset($allcbp)) $allcbp = allcbp();
$pps = array("s" => "software_id", "b" => "banking_id", "g" => "games", "j" => "jurisdiction");
$tops = tops();
if ($matp[1] > 3) return; // max = 3
$tx = $matp[1] - 1;
if ($matp[2]) {
if (!isset($tops_default_sbgj[$matp[2]][$matp[3]])) {
$get_top_table = get_top_table("", "", $matp[2] . "_" . $matp[3], ""); // to get $univ_tops
$tops_default_sbgj[$matp[2]][$matp[3]] = $univ_tops;
}
$link = $tops_default_sbgj[$matp[2]][$matp[3]][$tx];
} else {
$link = $tops['array'][$tx];
}
}
if (!cbpgood($link)) return;
if ($sitedata['using_template'] == "tcc") {
global $site;
if ($site['page_url']) {
$site['plus_url'] = preg_replace("@^/.+/@U", "", $site['page_url']);
$tid = strtr($site['plus_url'], array("/" => ""));
} else {
$tid = $link;
}
$vfmt = "/go/*tid*";
} else {
$vlink_format_by_template = array("bcel" => "/casino/*id*/go.html");
$vfmt = $sitedata['vlink_format'] or $vfmt = $vlink_format_by_template[$sitedata['using_template']] or $vfmt = "/go/*id*.html";
}
$v = strtr($vfmt, array("*id*" => $link, "*tid*" => $tid));
$t = $matches[3];
if (strpos($t, "\$bonusamount") !== false) {
$bonusamount = currencychange(getbonussumnew($link));
if ($bonusamount == "–") $bonusamount = "";
if (!$bonusamount) return;
}
if (strpos($t, "\$name") !== false) $name = id2name("", $link);
eval("\$t=\"$t\";");
$t = strip_tags($t, "<b><i><u><em><strong>");
if ($sitedata['using_template'] == "jcgen") $t = "<span class='text-shadow'>$t</span>";
return "<div class='ctabox'><a rel='nofollow' $class href='{$sitedata['suffix']}$v'>$t</a></div>";
}
function ctaboxclass($template)
{
switch ($template) {
case "clf":
return " class='button'";
case "pel":
return " class='vb1'";
case "gr":
return " class='casino__button--big button button--secondary'";
case "gr2":
return " class='casino__button--small button button--secondary'";
case "ocrb":
return " class='button'";
case "tcc":
return " class='button rvbutton'";
case "cfo":
return " class='bigv btn1'";
case "sco":
return " class='playb'";
case "ocs":
return " class='nvbr'";
case "jcgen":
return " class='casino-button button'";
case "pssch":
return " class='rwvt'";
case "pro":
return " class='visbutton mbutton'";
}
}
function process_ind($d)
{
global $indextext;
global $sitedata;
global $devmode;
if (in_array($sitedata['using_template'], array("pel"))) $use2uls = 1;
if ($devmode and in_array($sitedata['using_template'], array("pro"))) $use2uls = 1;
if ($indextext[$d]) {
$c = ceil(count($indextext[$d]) / 2);
foreach ($indextext[$d] as $w => $m) {
if ($d == "" and $use2uls and $w > $c) {
$a[1][$w] = $m;
} else {
$a[0][$w] = $m;
}
}
$t = array();
foreach ($a as $lr => $o) {
$t[$lr] = "<ul>";
foreach ($o as $w => $m) {
if ($indextext[$w]) {
$hasc = " class='haschildren closed'";
$bf = "+";
} else {
$hasc = "";
$bf = "";
}
$t[$lr] .= "<li$hasc>";
$t[$lr] .= "<span>$bf</span><a href='#idx$w'>$m</a>";
$t[$lr] .= process_ind($w);
$t[$lr] .= "</li>";
}
$t[$lr] .= "</ul>";
}
}
if ($t) return implode("", $t);
}
function calch($matches)
{
global $beginning;
global $indextext;
if (preg_match("@<!--(.+)-->@U", $matches[0], $mcc)) $s = strip_tags($mcc[1]);
else $s = strip_tags($matches[0]);
$s = trim($s);
if (!$s) return;
switch ($matches[1]) {
case "2":
$beginning[2]++;
$beginning[3] = 0;
$beginning[4] = 0;
$beginning[5] = 0;
$calch = $beginning[2];
$parent = "";
$indextext[$parent][$calch] = $s;
break;
case "3":
$beginning[3]++;
$beginning[4] = 0;
$beginning[5] = 0;
$calch = $beginning[2] . "." . $beginning[3];
$parent = $beginning[2];
$indextext[$parent][$calch] = $s;
break;
case "4":
$beginning[4]++;
$beginning[5] = 0;
$calch = $beginning[2] . "." . $beginning[3] . "." . $beginning[4];
$parent = $beginning[2] . "." . $beginning[3];
$indextext[$parent][$calch] = $s;
break;
case "5":
$beginning[5]++;
$calch = $beginning[2] . "." . $beginning[3] . "." . $beginning[4] . "." . $beginning[5];
$parent = $beginning[2] . "." . $beginning[3] . "." . $beginning[4];
$indextext[$parent][$calch] = $s;
break;
}
return "<h{$matches[1]} id='idx$calch'{$matches[2]}>{$matches[3]}";
}
function puttageachline($matches)
{
$s = $matches[2];
if (strpos($s, "\n") === false) return $matches[0];
if (preg_match("@<(p|div)(>|\h)@iU", $s)) return $matches[0];
$tag = $matches[1];
$s = preg_replace("@\r*\n@", "</$tag>\r\n<$tag>", $s);
return "<$tag>$s</$tag>";
}
function rearrangetable($matches)
{
$s = $matches[0];
$s = strtr($s, array(chr(13) => "", chr(10) => ""));
return $s;
}
function recursive_array_search($needle, $haystack)
{
foreach ($haystack as $key => $value) {
$current_key = $key;
if ($needle === $value or (is_array($value) && recursive_array_search($needle, $value) !== false)) {
return $current_key;
}
}
return false;
}
function getRatingUsingPreparedStatments($id, $cat = "review", $addrating = 0, $getuuid = "")
{
global $sitedata;
global $mysqlilink;
if (!$id) return;
if (!preg_match("@^[a-zA-Z0-9\-]+$@", $id)) return;
if ($addrating and ($addrating > 5 or $addrating < 0)) return;
$id = mres($id);
$short = mres($sitedata['short']);
if (in_array($sitedata['using_template'], array("parier", "cfo", "pssch", "gr", "gr2", "ocrb", "pel", "pro", "clf", "ocs", "sco", "jcgen", "cfst", "tcc", "bcel"))) $central_rating = 1;
if (!$addrating) {
$uuid = uuid();
$uuidmres = mres($uuid);
$query = "insert into rating_uuid set uuid=?";
$statement = mysqli_prepare($mysqlilink, $query);
mysqli_stmt_bind_param($statement, "s", $uuidmres);
mysqli_stmt_execute($statement);
mysqli_stmt_close($statement);
if (merno() == 1146) {
$uuidtablestring = "CREATE TABLE `rating_uuid` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`uuid` longtext COLLATE utf8mb4_unicode_ci,
`uuidtime` timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci";
mnq($uuidtablestring);
$statement = mysqli_prepare($mysqlilink, $query);
mysqli_stmt_bind_param($statement, "s", $uuidmres);
mysqli_stmt_execute($statement);
mysqli_stmt_close($statement);
}
}
if ($central_rating) {
$addrating = round($addrating, 1);
if ($addrating) {
if ($getuuid) {
$getuuidmres = mres($getuuid);
$query = "SELECT * FROM rating_uuid WHERE uuid=?";
$statement = mysqli_prepare($mysqlilink, $query);
mysqli_stmt_bind_param($statement, "s", $getuuidmres);
mysqli_stmt_execute($statement);
$result = mysqli_stmt_get_result($statement);
mysqli_stmt_close($statement);
if (mnr($result)) {
$queryUpdate = "UPDATE live_rating_$cat set count=count+1, total=total+$addrating WHERE site_id=? and the_id=?";
$statement = mysqli_prepare($mysqlilink, $queryUpdate);
mysqli_stmt_bind_param($statement, "ss", $short, $id);
mysqli_stmt_execute($statement);
mysqli_stmt_close($statement);
$queryDelete = "DELETE FROM rating_uuid WHERE uuid=? or uuidtime<now()-15*60"; // delete if more than 15 minutes old
$statement = mysqli_prepare($mysqlilink, $queryDelete);
mysqli_stmt_bind_param($statement, "s", $getuuidmres);
mysqli_stmt_execute($statement);
mysqli_stmt_close($statement);
}
} else {
return;
}
}
$query = "SELECT * FROM live_rating_$cat WHERE site_id=?";
$statement = mysqli_prepare($mysqlilink, $query);
if (!$statement) {
mnq("CREATE TABLE `live_rating_$cat` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`the_id` longtext COLLATE utf8mb4_unicode_ci,
`site_id` longtext COLLATE utf8mb4_unicode_ci,
`total` float DEFAULT NULL,
`count` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci");
$statement = mysqli_prepare($mysqlilink, $query);
}
mysqli_stmt_bind_param($statement, "s", $short);
mysqli_stmt_execute($statement);
$result = mysqli_stmt_errno($statement);
mysqli_stmt_close($statement);
$query = "SELECT * FROM live_rating_$cat WHERE site_id=? and the_id=?";
$statement = mysqli_prepare($mysqlilink, $query);
mysqli_stmt_bind_param($statement, "ss", $short, $id);
mysqli_stmt_execute($statement);
mysqli_stmt_store_result($statement);
$numberOfRows = mysqli_stmt_num_rows($statement);
mysqli_stmt_close($statement);
if ($numberOfRows == 0) {
$h = rand(3, 15);
$v = $h * rand(25, 40) / 10;
$queryInsert = "INSERT INTO live_rating_$cat (the_id,count,total,site_id) VALUES (?, ?, ?, ?)";
$statement = mysqli_prepare($mysqlilink, $queryInsert);
mysqli_stmt_bind_param($statement, "sids", $id, $h, $v, $short);
mysqli_stmt_execute($statement);
mysqli_stmt_close($statement);
}
$statement = mysqli_prepare($mysqlilink, $query);
mysqli_stmt_bind_param($statement, "ss", $short, $id);
mysqli_stmt_execute($statement);
$result = mysqli_stmt_get_result($statement);
mysqli_stmt_close($statement);
$r = mfs($result);
$average = round($r['total'] / $r['count'], 1);
$average100 = round($r['total'] / $r['count'] * 20);
sync_rating_data($cat, $r['total'], $r['count'], $short, $id);
return array("howmanyvotes" => $r['count'], "votessum" => $r['total'], "average" => $average, "average100" => $average100, "uuid" => $uuid);
} else {
$query = "SELECT * FROM {$short}_rating_live WHERE rating_id=? and cat=?";
$statement = mysqli_prepare($mysqlilink, $query);
mysqli_stmt_bind_param($statement, "ss", $id, $cat);
mysqli_stmt_execute($statement);
$result = mysqli_stmt_get_result($statement);
mysqli_stmt_close($statement);
if (!$result) {
mnq("CREATE TABLE `{$short}_rating_live` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`rating_id` longtext,
`howmanyvotes` int(11) DEFAULT NULL,
`votessum` float DEFAULT NULL,
`cat` longtext NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC");
$query = "SELECT * FROM {$short}_rating_live WHERE rating_id=? and cat=?";
$statement = mysqli_prepare($mysqlilink, $query);
mysqli_stmt_bind_param($statement, "ss", $id, $cat);
mysqli_stmt_execute($statement);
$result = mysqli_stmt_get_result($statement);
mysqli_stmt_close($statement);
if (!$result) {
return;
}
}
if (mnr($result) == 0) {
$h = rand(3, 15);
$v = $h * rand(25, 40) / 10;
$queryInsert = "INSERT {$short}_rating_live (rating_id,howmanyvotes,votessum,cat) VALUES (?, ?, ?, ?)";
$statement = mysqli_prepare($mysqlilink, $queryInsert);
mysqli_stmt_bind_param($statement, "sids", $id, $h, $v, $cat);
mysqli_stmt_execute($statement);
mysqli_stmt_close($statement);
$query = "SELECT * FROM {$short}_rating_live WHERE rating_id=? and cat=?";
$statement = mysqli_prepare($mysqlilink, $query);
mysqli_stmt_bind_param($statement, "ss", $id, $cat);
mysqli_stmt_execute($statement);
$result = mysqli_stmt_get_result($statement);
mysqli_stmt_close($statement);
}
$r = mfs($result);
$average = round($r['votessum'] / $r['howmanyvotes'], 1);
if ($average > 5) {
$query = "UPDATE {$short}_rating_live set votessum=howmanyvotes*4.5 WHERE rating_id=? and cat=?";
$statement = mysqli_prepare($mysqlilink, $query);
mysqli_stmt_bind_param($statement, "ss", $id, $cat);
mysqli_stmt_execute($statement);
$result = mysqli_stmt_get_result($statement);
mysqli_stmt_close($statement);
$average = 4.5;
$r['votessum'] = $r['howmanyvotes'] * 4.5;
}
return array("howmanyvotes" => $r['howmanyvotes'], "votessum" => $r['votessum'], "average" => $average, "uuid" => $uuid);
}
}
function newrating($id, $cat = "review", $addrating = 0, $getuuid = "")
{
global $sitedata;
if (!$id) return;
if (!preg_match("@^[a-zA-Z0-9\-]+$@", $id)) return;
if ($addrating and ($addrating > 5 or $addrating < 0)) return;
$id = mres($id);
$short = mres($sitedata['short']);
if (in_array($sitedata['using_template'], array("parier", "cfo", "pssch", "gr", "gr2", "ocrb", "pel", "pro", "clf", "ocs", "sco", "jcgen", "cfst", "tcc", "bcel"))) $central_rating = 1;
if (!$addrating) {
$uuid = uuid();
$uuidmres = mres($uuid);
$q = "INSERT INTO rating_uuid SET uuid='$uuidmres'";
mnq($q);
if (merno() == 1146) {
$uuidtablestring = "CREATE TABLE `rating_uuid` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`uuid` longtext COLLATE utf8mb4_unicode_ci,
`uuidtime` timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci";
mnq($uuidtablestring);
mnq($q);
}
}
if ($central_rating) {
$addrating = round($addrating, 1);
if ($addrating) {
if ($getuuid) {
$getuuidmres = mres($getuuid);
$query = "SELECT * FROM rating_uuid WHERE uuid='$getuuidmres'";
$result = mnq($query);
if (mnr($result)) {
$q = "UPDATE live_rating_$cat SET count=count+1, total=total+$addrating WHERE site_id='$short' AND the_id='$id'";
mnq($q);
mnq("DELETE FROM rating_uuid WHERE uuid='$getuuidmres' OR uuidtime<NOW()-15*60"); // delete if more than 15 minutes old
}
} else return;
}
$query = "SELECT * FROM live_rating_$cat WHERE site_id='$short'";
$result = mnq($query);
if (merno() == 1146) {
$tocreate = 1;
}
if ($tocreate) {
mnq("CREATE TABLE `live_rating_$cat` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`the_id` longtext COLLATE utf8mb4_unicode_ci,
`site_id` longtext COLLATE utf8mb4_unicode_ci,
`total` float DEFAULT NULL,
`count` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci");
}
$query = "SELECT * FROM live_rating_$cat WHERE site_id='$short' AND the_id='$id'";
$result = mnq($query);
if (mnr($result) == 0) {
$h = rand(3, 15);
$v = $h * rand(25, 40) / 10;
$q = "INSERT INTO live_rating_$cat (the_id,count,total,site_id) VALUES ('$id',$h,$v,'$short')";
mnq($q);
$query = "SELECT * FROM live_rating_$cat WHERE site_id='$short' AND the_id='$id'";
$result = mnq($query);
}
$r = mfs($result);
$average = round($r['total'] / $r['count'], 1);
$average100 = round($r['total'] / $r['count'] * 20);
sync_rating_data($cat, $r['total'], $r['count'], $short, $id);
return array("howmanyvotes" => $r['count'], "votessum" => $r['total'], "average" => $average, "average100" => $average100, "uuid" => $uuid);
} else {
$query = "SELECT * FROM {$short}_rating_live WHERE rating_id='$id' and cat='$cat'";
$result = mnq($query);
if (!$result) {
mnq("CREATE TABLE `{$short}_rating_live` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`rating_id` longtext,
`howmanyvotes` int(11) DEFAULT NULL,
`votessum` float DEFAULT NULL,
`cat` longtext NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC");
$query = "SELECT * FROM {$short}_rating_live WHERE rating_id='$id' and cat='$cat'";
$result = mnq($query);
if (!$result) {
return;
}
}
if (mnr($result) == 0) {
$h = rand(3, 15);
$v = $h * rand(25, 40) / 10;
$q = "INSERT INTO {$short}_rating_live (rating_id,howmanyvotes,votessum,cat) VALUES ('$id',$h,$v,'$cat')";
mnq($q);
$query = "SELECT * FROM {$short}_rating_live WHERE rating_id='$id' and cat='$cat'";
$result = mnq($query);
}
$r = mfs($result);
$average = round($r['votessum'] / $r['howmanyvotes'], 1);
if ($average > 5) {
$query = "UPDATE {$short}_rating_live SET votessum=howmanyvotes*4.5 WHERE rating_id='$id' AND cat='$cat'";
mnq($query);
$average = 4.5;
$r['votessum'] = $r['howmanyvotes'] * 4.5;
}
return array("howmanyvotes" => $r['howmanyvotes'], "votessum" => $r['votessum'], "average" => $average, "uuid" => $uuid);
}
}
function sync_rating_data($cat, $total, $count, $short, $id)
{
global $localmode;
if ($localmode) return;
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible;)");
curl_setopt($ch, CURLOPT_URL, getenv('RBO_URL')."/ratingdata.php");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 1);
$post['mycode'] = "UdejJd^d128d^#jqP092MnYumwII0)sqjWudzMdq2#a!iqWbl(";
$post['cat'] = $cat;
$post['total'] = $total;
$post['count'] = $count;
$post['site'] = $short;
$post['the_id'] = $id;
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$response = curl_exec($ch);
$errr = curl_error($ch);
curl_close($ch);
}
function logobgcolor($theid)
{
global $sitetype;
global $allbgcolors;
global $sitetypegeneral;
global $maincat;
if (!$sitetype) $sitetype = $sitetypegeneral;
if (!$sitetype) $sitetype = "casino";
$idname = $maincat[$sitetype]['id'];
$table = $maincat[$sitetype]['logo_dark_bgcolor'];
if (!$allbgcolors) {
$query = "SELECT * FROM $table WHERE $idname is not null";
$result = mnq($query);
while ($r = mfs($result)) {
$allbgcolors[$r[$idname]] = $r['bgcolor'];
}
}
if (!$allbgcolors[$theid]) $allbgcolors[$theid] = "000000";
return "#" . (string)$allbgcolors[$theid];
}
function all_count_of_query($query)
{
$query = preg_replace("@ limit ((?! limit ).)+$@i", "", $query);
$result = mnq($query);
return mnr($result);
}
function get_a_free_game_new($game_id_new)
{
global $ismobilephone;
if ($ismobilephone) $k = "link_works_mobile";
else $k = "link_works_desktop";
$query = "SELECT * FROM freegames_newnew WHERE game_id_new='$game_id_new' and $k=1";
$result = mnq($query);
if ($r = mfs($result)) {
unset($r['id']);
return $r;
} else return false;
}
function get_a_free_game($id_unique)
{
global $freegamenewvar;
global $sitelan;
if (in_array($sitelan, array("en", "fr", "de", "es", "fi", "sv", "no"))) $lan = $sitelan;
else $lan = "en";
$query = "SELECT * FROM {$freegamenewvar['datadb']} as t1 left join freegamenew_template as t2 on t1.template=t2.id left join {$freegamenewvar['maindb']} as t3 on t1.id_unique=t3.id_unique WHERE t1.id_unique='$id_unique' AND t1.status>0 AND t2.$lan>0";
$result = mnq($query);
if ($r = mfs($result)) {
unset($r['id']);
return $r;
} else return false;
}
function getfreegamenewquery($types = "", $softwares = "", $orderby = "", $limit = "", $exclusion = "", $selectfileds = "")
{
global $freegamenewvar;
global $sitelan;
global $master_short;
if (in_array($sitelan, array("en", "fr", "de", "es", "fi", "sv", "no"))) $lan = $sitelan;
else $lan = "en";
if ($selectfileds) {
$fls = explode(",", $selectfileds);
foreach ($fls as &$flss) {
$flss = "t1." . trim($flss);
}
$fls = implode(",", $fls);
} else $fls = "t1.*";
$query = "SELECT $fls FROM {$freegamenewvar['maindb']} as t1 left join {$freegamenewvar['datadb']} as t2 on t1.id_unique=t2.id_unique left join freegamenew_template as t3 on t2.template=t3.id WHERE t2.status>0 and t3.$lan>0";
if ($types) {
$finaltypes = array();
if (!is_array($types)) $types = array($types);
foreach ($types as $type) {
switch ($type) {
case "favorite":
case "slot":
$finaltypes[] = "video";
$finaltypes[] = "video3d";
$finaltypes[] = "classic";
break;
case "3d":
$finaltypes[] = "video3d";
break;
case "videoslot":
$finaltypes[] = "video";
break;
case "classicslot":
$finaltypes[] = "classic";
break;
case "blackjack":
$finaltypes[] = "blackjack";
$finaltypes[] = "pontoon";
break;
case "poker":
$finaltypes[] = "poker";
$finaltypes[] = "3cardpoker";
$finaltypes[] = "caribbean";
$finaltypes[] = "paigow";
break;
default:
$finaltypes[] = $type;
}
}
$finaltypes = array_unique($finaltypes);
$query .= " AND find_in_set(t1.game_type,'" . implode(",", $finaltypes) . "')";
}
if ($softwares) {
if (!is_array($softwares)) $softwares = array($softwares);
$query .= " AND find_in_set(software_id,'" . implode(",", $softwares) . "')";
} else $query .= $GLOBALS['freeres'];
if ($master_short != "bcel") {
if ($f = @file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/{$freegamenewvar['maindb']}.txt")) {
$query .= " AND find_in_set(t1.id_unique,\"$f\")";
}
}
if ($exclusion) {
$query .= " AND find_in_set(t1.id_unique,'$exclusion')=0";
}
if ($orderby) $query .= " ORDER BY $orderby";
else $query .= " ORDER BY t1.freegame_name";
if ($limit) $query .= " LIMIT $limit";
return $query;
}
function otherstoaddinhead()
{
global $adminrightafterbody;
global $adminbeforebodycloses;
global $sitedata;
global $is_univ_sitemap;
global $master_short;
global $site_protocol;
global $site;
global $block_popup;
global $no_3rd_party;
global $devsticker;
$s = "";
if ($sitedata['favicons_ready']) {
$s .= @file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/fav.dat");
}
if ($sitedata['using_template'] == "bcel") {
if ($site['page_url']) $u = $site['page_url'];
else $u = preg_replace("@\?.*@", "", $_SERVER['REDIRECT_URL']);
} else {
if ($site['page_url']) $u = $site['page_url'];
else $u = preg_replace("@\?.*@", "", $_SERVER['REQUEST_URI']);
}
$s .= "<link rel=\"canonical\" href=\"$site_protocol{$sitedata['url']}$u\" />";
if ($master_short != "bcel") {
if ($site['page_target']) {
$s .= "\n<link rel=\"alternate\" hreflang=\"{$sitedata['lan']}-{$site['page_target']}\" href=\"$site_protocol{$sitedata['url']}$u\" />";
} else {
if ($sitedata['targeted_countries']) $lc = $sitedata['lan'] . "-" . $sitedata['targeted_countries'];
else $lc = $sitedata['lan'];
$s .= "\n<link rel=\"alternate\" hreflang=\"$lc\" href=\"$site_protocol{$sitedata['url']}$u\" />";
}
if ($site['extra_alternates']) $s .= "\n{$site['extra_alternates']}";
}
if ($is_univ_sitemap) {
$s .= <<<A
<style>
.sm_hierarchy {text-align:left;}
#univ_sitemap .sm_hierarchy {margin-bottom:0;}
#univ_sitemap .sm_hierarchy li {margin-bottom:0;}
#univ_sitemap>.sm_hierarchy>li>a {text-transform:uppercase; font-size:15px; font-weight:700;}
#univ_sitemap>.sm_hierarchy>li>ul>li>a {font-size:15px; font-weight:700;}
#univ_sitemap>.sm_hierarchy>li>ul>li>ul>li>a {font-size:14px;}
#univ_sitemap>.sm_hierarchy>li>ul>li>ul>li>ul>li>a {font-size:13px; font-style:italic;}
#univ_sitemap>.sm_hierarchy>li>ul>li>ul>li>ul>li>ul>li>a {font-size:12px;}
#univ_sitemap>.sm_hierarchy>li>ul>li>ul>li>ul>li>ul>li>ul>li {font-size:12px; font-style:italic;}
</style>
A;
}
/*
// google analytics
if ($sitedata['analytics_code']) {
$s.=<<<A
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id={$sitedata['analytics_code']}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '{$sitedata['analytics_code']}');
</script>
A;
}
*/
if (!$no_3rd_party) {
//push crew and google tag manager
$query = "SELECT * FROM manage_pushcrew WHERE short='{$sitedata['short']}'";
$result = mnq($query);
if ($result) {
if ($r = mfs($result)) {
if ($r['google_site_verification']) {
$s .= $r['google_site_verification'];
}
if ($r['googletagmanagercode1']) $s .= $r['googletagmanagercode1'];
if ($r['googletagmanagercode2']) $adminrightafterbody = $r['googletagmanagercode2'];
}
}
}
$adminrightafterbody .= $block_popup;
$adminrightafterbody .= $devsticker;
if ($site['custom_css'] = trim($site['custom_css'])) {
$siteimgs = siteimgs();
$site['custom_css'] = preg_replace_callback("@\*img(\d+)\*@", "custom_css_replace", $site['custom_css']);
$s .= "\n<style>\n" . $site['custom_css'] . "\n</style>";
}
if ($site['json_ld'] = trim($site['json_ld'])) {
$s .= "\n<script type='application/ld+json'>\n" . $site['json_ld'] . "\n</script>";
}
return $s;
}
function custom_css_replace($matches)
{
global $siteimgs;
global $imagepath;
$imgid = $matches[1];
$imgs = $siteimgs;
if (!$imgs[$imgid][0]) return "none";
if (preg_match("@^~~temp~~(\d+)~(.+)@", $imgs[$imgid][0], $mch)) {
$isrc = getenv('RBO_URL')."/img/drafts/{$mch[1]}/{$mch[2]}";
} else {
$isrc = "$imagepath{$imgs[$imgid][0]}";
}
return "url($isrc)";
}
function freegame_banner_info($software_id)
{
global $sitelan;
global $ipcountry;
global $master_short;
global $mastershort;
global $sitetypesall;
if ($mastershort) $master_short = $mastershort;
$a = array();
$query = "SELECT * FROM live_banner_for_freegames WHERE software_id='$software_id' and lan='$sitelan'";
$result = mnq($query);
if (!$result) return array();
if ($r = mfs($result)) {
if (preg_match_all("@^(.+)\:(.+)\r*$@mU", $r['casino_id'], $matches)) {
$cs = array();
foreach ($matches[1] as $mkey => $mo) {
$cs[$mo] = $matches[2][$mkey];
}
$a['casino_id'] = $cs[$ipcountry] or $a['casino_id'] = $cs['default'];
if ($a['casino_id']) {
if (!cbpgood($a['casino_id'])) return;
$query = "SELECT * FROM live_banner_for_freegames_text WHERE casino_id='{$a['casino_id']}' and lan='$sitelan'";
$result = mnq($query);
if ($r = mfs($result)) {
if (preg_match_all("@^(.+)\:(.+)\r*$@mU", $r['banner_text'], $matches)) {
$tt = array();
foreach ($matches[1] as $mkey => $mo) {
$tt[$mo] = $matches[2][$mkey];
}
$a['text'] = $tt[$master_short] or $a['text'] = $tt['default'];
}
}
}
}
}
return $a;
}
function admin_mystripslashes(&$v, $key)
{
$v = stripslashes($v);
}
function admin_mytrim(&$s, $key)
{
$s = trim($s);
}
function getquotesfromarray($a)
{
$s = array();
foreach ($a as $key => $o) {
if (substr($key, 0, 5) == "quote" and preg_match("@^quote(\d+)@", $key, $matches))
$s[] = "{$matches[1]}:{{" . $o . "}}";
}
return implode("\r\n", $s);
}
function getimagesfromarray($a, $images)
{
global $draftid;
$old = array();
preg_match_all("@^(\d+)\:([^/\r\n]+)@m", $images, $matches);
foreach ($matches[1] as $kk => $mm) {
$old[$mm] = $matches[2][$kk];
}
$s = array();
foreach ($a as $key => $o) {
if (substr($key, 0, 9) == "imgselect" and $key != "imgselect0" and $key != "imgselect999" and preg_match("@^imgselect(\d+)@", $key, $matches)) {
if ($o == "ori") $i = $old[$matches[1]];
elseif ($o == "") $i = "none";
else $i = "~~temp~~{$draftid}~$o";
$s[] = "{$matches[1]}:$i/{$a['imgfloat' .$matches[1]]}/{$a['imgwidth' .$matches[1]]}/{$a['imgheight' .$matches[1]]}/{$a['imgtext' .$matches[1]]}{}{$a['imgalt' .$matches[1]]}{}{$a['imglk' .$matches[1]]}";
}
}
return implode("\r\n", $s);
}
function am_parent_url_of($url)
{
global $site;
global $maintable;
global $sitelan;
global $subdomain;
if (am_table_has_column($maintable, "lan")) $lanstring = " and lan='$sitelan'";
if (am_table_has_column($maintable, "subdomain")) $subdomainstring = " and subdomain='$subdomain'";
$query = "SELECT * FROM $maintable WHERE page_url='$url' and theorder>0$lanstring$subdomainstring";
$result = mnq($query);
if ($r = mfs($result)) {
return $r['parent_link'];
}
}
function am_table_has_column($maintable, $col)
{
$query = "show columns FROM $maintable";
$result = mnq($query);
while ($r = mfs($result)) {
if ($r['Field'] == $col) return true;
}
}
function am_type_of_url($url)
{
global $site;
global $maintable;
global $sitelan;
global $subdomain;
if (am_table_has_column($maintable, "lan")) $lanstring = " and lan='$sitelan'";
if (am_table_has_column($maintable, "subdomain")) $subdomainstring = " and subdomain='$subdomain'";
$query = "SELECT * FROM $maintable WHERE page_url='$url' and theorder>0$lanstring$subdomainstring";
$result = mnq($query);
if ($r = mfs($result)) {
if ($r['type']) return $r['type'];
if ($r['type_admin']) return $r['type_admin'];
}
}
function is_offspring_of_type($type, $url)
{
while ($url = am_parent_url_of($url)) {
if ($url == "/" or !$url) return false;
if (am_type_of_url($url) == $type) return true;
}
}
function site_structure()
{
global $maintable;
global $sitelan;
global $subdomain;
$site_structure = array();
if (am_table_has_column($maintable, "lan")) $lanstring = " and lan='$sitelan'";
if (am_table_has_column($maintable, "subdomain")) $subdomainstring = " and subdomain='$subdomain'";
$query = "SELECT parent_link, page_url FROM $maintable WHERE NULLIF(parent_link,'') IS NOT NULL and theorder>0$lanstring$subdomainstring order by theorder";
$result = mnq($query);
while ($r = mfs($result)) {
$site_structure[$r['parent_link']][] = $r['page_url'];
}
return $site_structure;
}
function link2parents($link)
{ // like link1,link2...
global $maintable;
global $site_structure;
global $sitelan;
global $subdomain;
if (!$site_structure) $site_structure = site_structure();
global $link2parents_array;
$link2parents_array = array();
if (am_table_has_column($maintable, "lan")) $lanstring = " and lan='$sitelan'";
if (am_table_has_column($maintable, "subdomain")) $subdomainstring = " and subdomain='$subdomain'";
$query = "SELECT * FROM $maintable WHERE (find_in_set(page_url,'$link')) and theorder>0$lanstring$subdomainstring";
$result2 = mnq($query);
while ($r2 = mfs($result2)) {
link2parents_process_url($r2['page_url']);
}
return $link2parents_array;
}
function link2parents_process_url($url)
{
global $site_structure;
global $link2parents_array;
if (is_array($site_structure[$url])) {
$link2parents_array[] = $url;
foreach ($site_structure[$url] as $b) {
link2parents_process_url($b);
}
}
}
function type2parents($type)
{ // like type1,type2...
global $maintable;
global $site_structure;
global $sitelan;
global $subdomain;
if (!$site_structure) $site_structure = site_structure();
global $type2parents_array;
$type2parents_array = array();
if (am_table_has_column($maintable, "lan")) $lanstring = " and lan='$sitelan'";
if (am_table_has_column($maintable, "subdomain")) $subdomainstring = " and subdomain='$subdomain'";
$query = "SELECT * FROM $maintable WHERE (find_in_set(type,'$type') or find_in_set(type_admin,'$type')) and theorder>0$lanstring$subdomainstring";
$result2 = mnq($query);
while ($r2 = mfs($result2)) {
type2parents_process_url($r2['page_url']);
}
return $type2parents_array;
}
function type2parents_process_url($url)
{
global $site_structure;
global $type2parents_array;
if (is_array($site_structure[$url])) {
$type2parents_array[] = $url;
foreach ($site_structure[$url] as $b) {
type2parents_process_url($b);
}
}
}
function my_getimagesize($url)
{
if (preg_match("@^https?\://@i", $url)) {
$headers = array(
"Range: bytes=0-10485760" // Max 10MB
);
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($curl);
curl_close($curl);
$im = imagecreatefromstring($data);
$width = imagesx($im);
$height = imagesy($im);
return array($width, $height);
} else return @getimagesize($url);
}
function my_exif_imagetype($url)
{
preg_match("@\.(gif|jpe?g|png|svg)$@i", $url, $matches);
$ty = strtolower($matches[1]);
switch ($matches[1]) {
case "gif":
return 1;
break;
case "jpeg":
case "jpg":
return 2;
break;
case "png":
return 3;
break;
case "svg":
return 4;
}
}
function get_headers_curl($url)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
$r = curl_exec($ch);
return $r;
}
function ctabox_general()
{
}
function quote_in_article_general($matches)
{
global $site;
$n = $matches[1];
preg_match("@^$n\:(l|r|)(\d*)\{\{(.*)\}\}@m", $site['quotes'], $mm);
if ($mm[3]) {
return "<div class='excerpt1'>{$mm[3]}</div>";
}
}
function change_site_type_general()
{
global $site;
global $maintable;
if ($site['type']) return $site['type'];
if ($site['type_admin']) return $site['type_admin'];
}
function do_migration_301($olddomain, $newdomain)
{
$olddomainquote = preg_quote($olddomain);
$new_http_host = preg_replace("@(?<![^\.])$olddomainquote$@i", "$newdomain", $_SERVER['HTTP_HOST']);
if ($new_http_host != $_SERVER['HTTP_HOST']) {
$protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://';
header("Location: $protocol$new_http_host{$_SERVER['REQUEST_URI']}", TRUE, 301);
}
}
function visited_by_us()
{
$u = preg_quote(getenv('RBO_URL')."/manage/");
if (preg_match("@$u@i", $_SERVER['HTTP_REFERER'])) return "from manage backend";
if ($_GET['forceupdate']) return "forceupdate";
}
//mysqli_functions
function mfa($result)
{
if (!$result) return;
global $mysqlilink;
if ($mysqlilink) return $result->fetch_array();
else return mysql_fetch_array($result);
}
function mnr($result)
{
if (!$result) return;
global $mysqlilink;
if ($mysqlilink) return $result->num_rows;
else return mysql_num_rows($result);
}
function mres($s)
{
global $mysqlilink;
if ($mysqlilink) return mysqli_real_escape_string($mysqlilink, $s);
else return mysql_real_escape_string($s);
}
function mer()
{
global $mysqlilink;
if ($mysqlilink) return mysqli_error($mysqlilink);
else return mysql_error();
}
function merno()
{
global $mysqlilink;
if ($mysqlilink) return mysqli_errno($mysqlilink);
else return mysql_errno();
}
function mff($result)
{
if (!$result) return;
global $mysqlilink;
if ($mysqlilink) return mysqli_fetch_field($result);
else return mysql_fetch_field($result);
}
function mar()
{
global $mysqlilink;
if ($mysqlilink) return mysqli_affected_rows($mysqlilink);
else return mysql_affected_rows();
}
function mii()
{
global $mysqlilink;
if ($mysqlilink) return mysqli_insert_id($mysqlilink);
else return mysql_insert_id();
}
function mds($result, $n)
{
if (!$result) return;
global $mysqlilink;
if ($mysqlilink) return mysqli_data_seek($result, $n);
else return mysql_data_seek($result, $n);
}
function file_get_contents_https($url)
{
if (preg_match("@^https?\://@i", $url)) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible;)");
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
$result = curl_exec($ch);
/* if ($err=curl_error($ch)) {
echo $err;
die;
}
*/
curl_close($ch);
return $result;
} else return file_get_contents($url);
}
function sitemapxml()
{
global $maintable;
global $sitedata;
if (!$maintable) $maintable = $sitedata['db_tables'];
if (!$sitedata) die("Not Available.");
$site_table_criteria = site_table_criteria();
$protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://';
header('Content-Type: application/xml');
echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
$query = "SELECT * FROM $maintable WHERE theorder>0$site_table_criteria order by if(page_url='/',0,1), if(nullif(parent_link,'') is null,'zzzzz',parent_link), theorder";
$result = mnq($query);
while ($r = mfa($result)) {
$mod = date("c", strtotime($r['last_insert_update_timestamp'] . " UTC"));
$url = $r['page_url'];
if ($maintable == "bcel_site" and $url == "/") $freq = "daily";
elseif ($url == "/") $freq = "monthly";
else $freq = "yearly";
if ($url == "/") $priority = "1.0";
else $priority = "0.7";
$url = specialconvforsitemapxml($url);
if ($r['noindex']!='1') {
echo "
<url>
<loc>$protocol{$sitedata['url']}$url</loc>
<lastmod>$mod</lastmod>
<changefreq>$freq</changefreq>
<priority>$priority</priority>
</url>
";
}
}
echo '</urlset>';
}
function specialconvforsitemapxml($s)
{
$s = preg_replace("@&@", "&", $s);
$s = strtr($s, array("'" => "'", "\"" => """, ">" => ">", "<" => "<"));
return $s;
}
function get_lan_locale($site)
{
global $sitelan;
global $sitedata;
if (!$sitelan or !$site['page_target']) {
if (!$sitelan) $sitelan = $sitedata['lan'];
}
if ($site['page_target']) return $sitelan . "-" . $site['page_target'];
else {
if ($sitedata['targeted_countries']) return $sitelan . "-" . $sitedata['targeted_countries'];
else return $sitelan;
}
}
function aweberform($awebercode, $strname, $stremail, $strconfirm, $confirmclass = "", $thankyoupage = "thankyou.html")
{
global $sitelan;
$protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://';
$s = <<<A
<form id="newsletterForm" method="post" action="//www.aweber.com/scripts/addlead.pl">
<input type="hidden" name="listname" value="$awebercode" />
<input type="hidden" name="redirect" value="$protocol{$_SERVER['HTTP_HOST']}/$thankyoupage" />
<input type="hidden" name="meta_adtracking" value="custom form" />
<input type="hidden" name="meta_message" value="1" />
<input type="hidden" name="meta_required" value="name,email" />
<input type="hidden" name="meta_forward_vars" value="1" />
<input class="newsletterTextInputname txt nlf-field" onBlur="if(this.value==''){this.value='$strname'}" onFocus="$('#newsletterinfo').text(''); if(this.value=='$strname'){this.value='';}" type="text" name="name" value="$strname" />
<input class="newsletterTextInputemail txt nlf-field" onBlur="if(this.value==''){this.value='$stremail'}" onFocus="$('#newsletterinfo').text(''); if(this.value=='$stremail'){this.value='';}" type="text" name="email" value="$stremail" />
<input id="newslettersubmit" class='$confirmclass' type="submit" name="submit" value="$strconfirm" />
</form>
A;
return $s;
}
function get_site_name()
{
global $sitedata;
switch ($sitedata['header_text']) {
case "none":
$sitename = "";
break;
case "":
$sitename = preg_replace("@^.+\.@U", "", $_SERVER['HTTP_HOST']);
break;
default:
$sitename = $sitedata['header_text'];
}
return $sitename;
}
function sitedata()
{
global $localmode;
global $master_short;
global $children_suffix;
global $sites_locales;
global $sitedata2;
$query = "SELECT * FROM manage_websites WHERE short='{$_SERVER['HTTP_HOST']}'
or (url='{$_SERVER['HTTP_HOST']}' AND url2 is null)
or url2='{$_SERVER['HTTP_HOST']}'
or temporary_url='{$_SERVER['HTTP_HOST']}'";
$result = mnq($query);
$sitedata = mfs($result);
if ($sitedata['short'] == "bcelbak") {
$query = "SELECT * FROM manage_websites WHERE short='bcel'";
$result = mnq($query);
$sitedata = mfs($result);
}
$children_suffix = $sitedata['children_suffix'];
if ($sitedata['targeted_countries']) $sites_locales[""] = $sitedata['lan'] . "-" . $sitedata['targeted_countries'];
else $sites_locales[""] = $sitedata['lan'];
if ($children_suffix) {
$p = preg_replace("@(/[^,]+)@", $sitedata['url'] . "$0", $children_suffix);
$querya = "SELECT * FROM manage_websites WHERE find_in_set(url,'$p') and theorder>0 order by short";
$resulta = mnq($querya);
while ($r2 = mfs($resulta)) {
$cc = preg_replace("@^[^/]+@", "", $r2['url']);
if ($r2['targeted_countries']) $sites_locales[$cc] = $r2['lan'] . "-" . $r2['targeted_countries'];
else $sites_locales[$cc] = $r2['lan'];
if (preg_match("@^{$cc}[/\?\#]@i", $_SERVER['REQUEST_URI'])) {
$sitedata = $r2;
$_SERVER['REQUEST_URI'] = preg_replace("@^$cc@", "", $_SERVER['REQUEST_URI']);
$_SERVER['REDIRECT_URL'] = preg_replace("@^$cc@", "", $_SERVER['REDIRECT_URL']);
}
}
}
$s = array();
$query = "SELECT url FROM manage_websites WHERE protocol is null";
$result = mnq($query);
while ($r = mfs($result)) {
$s[] = $r['url'];
}
$sitedata['nonhttpssites'] = implode(",", $s);
$sitedata['root'] = preg_replace("@^[^/]+@", "", $sitedata['url']) . "/";
$sitedata['suffix'] = substr($sitedata['root'], 0, -1);
if ($sitedata['parent_site']) {
$query = "SELECT * FROM manage_websites_design WHERE
short='{$sitedata['short']}' or short='{$sitedata['parent_site']}' order by short DESC LIMIT 1";
} else {
$query = "SELECT * FROM manage_websites_design WHERE short='{$sitedata['short']}'";
}
$result = mnq($query);
if ($r = mfs($result)) {
unset($r['id']);
unset($r['short']);
$sitedata = $sitedata + $r;
}
if ($sitedata['using_template'] == "parier") {
$query = "SELECT short FROM manage_websites WHERE db_tables='{$sitedata['db_tables']}' and theorder>0";
$result = mnq($query);
while ($r = mfs($result)) {
$y[] = $r['short'];
}
$ys = implode(",", $y);
$query = "SELECT * FROM manage_websites_settings WHERE find_in_set(short,'$ys')";
$result = mnq($query);
while ($r = mfs($result)) {
if ($r['short'] == $sitedata['short']) {
$sitedata2 = $r;
unset($r['id']);
unset($r['short']);
$sitedata = $sitedata + $r;
} else {
$sitedata['mobile_menu_for_' . $r['short']] = $r['mobile_menu'];
$sitedata['desktop_menu_for_' . $r['short']] = $r['desktop_menu'];
}
}
} else {
$query = "SELECT * FROM manage_websites_settings WHERE short='{$sitedata['short']}'";
$result = mnq($query);
if ($result) {
if ($r = mfs($result)) {
$sitedata2 = $r;
unset($r['id']);
unset($r['short']);
$sitedata = $sitedata + $r;
}
}
}
if (!$sitedata['idname']) $sitedata['idname'] = "site_id";
return $sitedata;
}
function univ_social_account()
{
global $sitedata;
global $univ_sociallinks;
if (!$sitedata) return;
$query = "SELECT * FROM manage_social WHERE site_id='{$sitedata['short']}'";
$result = mnq($query);
if (!$result) return;
if ($r = mfs($result)) {
$a['fb'] = $r['facebook'];
$a['tw'] = $r['twitter'];
$d = array("fb" => "Facebook", "tw" => "Twitter");
foreach ($a as $akey => $ao) {
if ($ao) {
if (in_array($akey, array("fb", "tw"))) {
$s .= "<a href='$ao'>{$d[$akey]}</a> ";
}
}
}
$univ_sociallinks = $s;
return $a;
}
}
function vlinktext()
{
global $sitedata;
global $sitetypegeneral;
$b['fr']['sport'] = "Parier maintenant";
$b['fr']['poker'] = "Jouer maintenant";
$b['fr']['casino'] = "Jouer maintenant";
$b['fr']['bingo'] = "Jouer maintenant";
$b['en']['casino'] = "Play";
$b['en']['sport'] = "Bet";
$b['de']['casino'] = "Jetzt spielen";
$b['de']['sport'] = "Jetzt wetten";
$b['es']['casino'] = "Jugar ahora";
$b['es']['sport'] = "Apuesta ahora";
$b['sv']['casino'] = "Besök Casinot";
$b['sv']['sport'] = "Besök";
$b['no']['casino'] = "Spill nå";
$a['fr'] = "Jouer";
$a['de'] = "Spielen";
$a['en'] = "Play";
$a['es'] = "Jugar";
$a['fi'] = "Pelaa nyt";
$a['sv'] = "Spela";
$a['no'] = "Spill";
$a['it'] = "Visita";
$a['pt'] = "Jogue Agora";
$a['pl'] = "Odwied?";
if ($sitedata) {
$lan = $sitedata['lan'];
if ($b[$lan][$sitetypegeneral]) return $b[$lan][$sitetypegeneral];
else return $a[$lan];
} else {
global $sitelan;
$lan = $sitelan;
return $a[$lan];
}
}
function review_id_name()
{
global $sitetypegeneral;
global $maincat;
return $maincat[$sitetypegeneral]["id"];
}
function sitetypegeneral()
{
global $sitedata;
global $extra_sitetype;
global $sitetypesall;
global $extra_type_folder;
$sitetypegeneral = preg_replace("@\:.*@", "", $sitedata['sitetype']) or $sitetypegeneral = "casino";
$extra_sitetype = array();
$sitetypesall = array();
$sitedata['extra_sitetype'] = trim($sitedata['extra_sitetype']);
if ($sitedata['extra_sitetype']) {
$e = explode(",", $sitedata['extra_sitetype']);
$f = explode(",", $sitedata['extra_sitetype_folder']);
foreach ($e as $ind => $ee) {
$ee = trim($ee);
if ($ee) {
$et = preg_replace("@\:.*@", "", $ee);
$extra_sitetype[] = $et;
if ($f[$ind]) {
$j = $f[$ind];
$jq = preg_quote($j);
if (preg_match("@^$jq@i", $_SERVER['REQUEST_URI'])) { // not good for preview
$sitetypegeneral = $et;
$extra_type_folder = $j;
}
}
}
}
}
$sitetypesall = explode(",", $sitedata['types']);
return $sitetypegeneral;
}
function gotovisit($id, $special = "")
{
global $sitedata;
global $site_protocol;
$_GET['r'] = base64_encode($_SERVER['HTTP_REFERER']);
if (!$special) $special = $_GET['p'];
if ($special) $_GET['special'] = $special;
if ($_GET) {
$q = "?" . http_build_query($_GET);
}
$gotoadd = $site_protocol . $sitedata['url'] . "/go2/$id/$q";
echo <<<A
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Bonus Casino</title>
<meta name="description" content="Bonus Casino">
<meta name="viewport" content="width=device-width">
</head>
<body class="redirect-page">
<script type="text/javascript">
function redir(){
window.location.replace("$gotoadd");
};
var godirection = setTimeout(function(){
redir();
},0);
window.onload = function(){
godirection;
};
</script>
</body>
</html>
A;
exit;
}
function typeofid($id)
{
global $sitedata;
global $sitetypegeneral;
global $sitetypesall;
global $maincat;
if (!$sitedata['extra_sitetype']) return $sitetypegeneral;
foreach ($sitetypesall as $tp) {
$tbs = $maincat[$tp]['data'];
$idd = $maincat[$tp]['id'];
$query = "SELECT * FROM $tbs WHERE $idd = '$id'";
$result = mnq($query);
if (mnr($result)) return $tp;
}
}
function gotovisit_real($id, $delay = 0, $special = "")
{
global $sitelan;
global $sitedata;
global $ipcountry;
global $mastershort;
global $remoteip;
global $maincat;
$typeofid = typeofid($id);
$ssite = $mastershort;
if (!$ssite) {
return;
}
$hasfound = false;
$ex = (int) $_GET['isexclusive'];
$idd = $maincat[$typeofid]['id'];
$lkn = $maincat[$typeofid]['tracking'];
if (!$ipcountry) {
$ipcountry = strtolower($sitedata['targeted_countries']);
}
if ($special) {
$special = mres($special);
$vv = " (link_id IS NULL or link_id = '$special') ";
} else {
$vv = " link_id IS NULL ";
}
if ($ismobilephone) {
$mobilefilter = " AND IFNULL(pc_only,0)=0";
} else {
$mobilefilter = " AND IFNULL(mobile_only,0)=0";
}
if ($ex) {
$exfilter = "";
} else {
$exfilter = " AND (isexclusive = 0 OR (isexclusive = 1 AND ex_as_normal = '1'))";
}
if ($GLOBALS['ipcountry'] != "others") {
$foripsfilter = " AND (NULLIF(forips,'') IS NULL OR FIND_IN_SET('{$GLOBALS['ipcountry']}',forips))";
} else {
$foripsfilter = " AND NULLIF(forips,'') IS NULL";
}
$query = "SELECT *
FROM $lkn
WHERE nonseo IS NULL AND
$idd='$id'$mobilefilter$exfilter$foripsfilter AND
$vv AND
lan='$sitelan' AND
(only_for IS NULL OR FIND_IN_SET('$ssite', only_for) > 0)
ORDER BY mobile_only DESC,
link_id DESC,
isexclusive DESC,
only_for DESC,
forips DESC,
id DESC";
$result = mnq($query);
if ($result) {
if ($r = mfs($result)) {
$add = $r['link'];
$tracking_name = $r['name'];
}
}
if (!$add && $sitelan != "en") { // if didn't find link in the given language, use english link instead
$query = "SELECT *
FROM $lkn
WHERE nonseo IS NULL AND
$idd = '$id'$mobilefilter$exfilter$foripsfilter AND
$vv AND
lan='en' AND
(only_for IS NULL OR FIND_IN_SET('$ssite', only_for)>0)
ORDER BY mobile_only DESC,
link_id DESC,
isexclusive DESC,
only_for DESC,
forips DESC,
id DESC";
$result = mnq($query);
if ($result) {
if ($r = mfa($result)) {
$add = $r['link'];
$tracking_name = $r['name'];
}
}
}
$add = trim($add);
$add = adjust_uuid($add);
if (array_key_exists("test",$_GET)) die($add);
if ($add) {
if ($_GET['r']) {
$ref=base64_decode($_GET['r']);
}
if ($remoteip!="127.0.0.1") {
if (!preg_match("@^https?\://[^\.]+/@i",$ref)) {
update_click_tb($add, $tracking_name, $ref);
}
}
header("HTTP/1.1 302 Moved Temporarily");
if ($delay) {
header("Refresh: $delay; URL=$add");
} else {
header("location:$add");
}
exit;
}
}
function update_click_tb($add, $tracking_name, $ref) {
global $remoteip;
global $sitedata;
global $last_uuid;
global $clickCountry;
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, getenv('RBO_URL')."/clickdata.php");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
$post['mycode'] = "UdejJd^d128dYumwII0)sqjWudzMdq2#a!iq^#jqP092MnWbl(";
$post['ref'] = $ref;
$post['add'] = $add;
$post['tracking_name'] = $tracking_name;
$post['short'] = $sitedata['short'];
$post['ip'] = $remoteip;
$post['country'] = $clickCountry;
if ($last_uuid) {
$post['uuid'] = $last_uuid;
}
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$response = curl_exec($ch);
$errr = curl_error($ch);
if ($errr) {
backupClickDataTable($post);
}
curl_close($ch);
}
/**
* This function captures the clicks that do not go to the backoffice
* and stores them in the database to be further processed.
*
* @param $post Array the post details
* @return boolean true after inserttion in database
*/
function backupClickDataTable($post) {
global $mysqlilink;
$short = $post['short'];
$ref = $post['ref'];
$add = $post['add'];
$tracking_name = $post['tracking_name'];
$remoteip = $post['ip'];
$ipcountry = $post['country'];
$uuid = null;
if($post['uuid']) {
$uuid = $post['uuid'];
}
$insertQuery = "INSERT INTO click_data_backup
(short, url, tracking, tracking_name, ip, country, update_time, uuid)
VALUES (?, ?, ?, ?, ?, ?, now(), ?)";
$statement = mysqli_prepare($mysqlilink, $insertQuery);
mysqli_stmt_bind_param($statement, "sssssss", $short, $ref, $add, $tracking_name, $remoteip, $ipcountry, $uuid);
mysqli_stmt_execute($statement);
mysqli_stmt_close($statement);
if (merno() != 0) {
if (merno() == 1146) {
$createTableQuery = "CREATE TABLE click_data_backup (
id int(11) NOT NULL AUTO_INCREMENT,
tracking longtext DEFAULT NULL,
url longtext DEFAULT NULL,
short longtext DEFAULT NULL,
ip longtext DEFAULT NULL,
country longtext DEFAULT NULL,
update_time timestamp NULL DEFAULT NULL ON UPDATE current_timestamp(),
tracking_name longtext DEFAULT NULL,
uuid longtext DEFAULT NULL,
data_read boolean DEFAULT false,
PRIMARY KEY (id) );";
mnq($createTableQuery);
}
$statement = mysqli_prepare($mysqlilink, $insertQuery);
mysqli_stmt_bind_param($statement, "sssssss", $short, $ref, $add, $tracking_name, $remoteip, $ipcountry, $uuid);
mysqli_stmt_execute($statement);
mysqli_stmt_close($statement);
$file = 'debug.txt';
file_put_contents($file, merno(), FILE_APPEND);
if (merno() != 0) {
$file = 'click_data_log.txt';
$data = $short .'|'. $ref .'|'. $add .'|'. $tracking_name .'|'. $remoteip .'|'. $ipcountry .'|'. $uuid . '\r';
file_put_contents($file, $data, FILE_APPEND);
}
}
return true;
}
function no_data_for_order($useorder, $stid)
{
global $ordertable;
if ($useorder == "order_general") {
return false;
}
$query = "SELECT id FROM $ordertable WHERE site_id='$stid' AND $useorder>0";
$result = mnq($query);
if (!mfs($result)) {
return true;
}
}
function plus_replace($matches)
{
switch ($matches[2]) {
case "1": // for plus1
global $site;
global $sitelan;
global $sitedata;
global $sitetypesall;
global $ipcountry;
if ($matches[3]) {
$theid = trim($matches[3]);
} else {
$idname = getidname();
$theid = $site[$idname];
}
if (!cbpgood($theid)) return;
if ($GLOBALS['univ_nolink']) return;
if ($title = $matches[4]) {
$title = strtr($title, array('"' => '\"'));
$year = date("Y");
$month = getMois_univ(date("F"));
$title = strtr($title, array('$month(uppercase_first)' => ucfirst($year), '$year' => $year, '$month' => $month));
}
switch ($sitedata['using_template']) {
case "tcc":
return hptop5("", $title, "", "plus1", $theid);
case "1":
case "2":
$typeofid = typeofid($theid);
return get_top_table_smallsites("", $title, "", "plus1", $theid, $typeofid);
case "celorg":
return top5ingames("topx", $title, "", "", "plus1", $theid);
case "sco":
return bonuslist("", $title, "", "", "", "plus1", $theid);
case "ocs":
return ocstop3($title, "", "", "plus1", $theid);
case "pssch":
return toptable($title, "", "", "", "plus1", $theid);
case "parier":
return listofbonus("", $title, "", "", "", "", "plus1", $theid);
case "cfst":
return bonuslist("", $title, "", "", "", "plus1", $theid);
case "pro":
return listbonus($title, "", "notitle", "", "plus1", $theid);
case "jcgen":
return allcasinos("", $title, "", "", "plus1", $theid);
case "pel":
return addtable("", $title, "", "", "", "plus1", $theid);
case "bcel":
return top10home("", $title, "", "", "plus1", $theid);
case "ocrb":
return hptopright($title, "", "wider", "", "", "plus1", $theid);
case "cfo":
return top5home($title, "", "", "plus1", $theid);
case "gr":
case "gr2":
$top = allcasinos("", "", "", "", "plus1", $theid);
if ($title) {
eval("\$title=\"$title\";");
$top3title = <<<A
<div class="top3title">
<table class="preset bonus-table">
<thead class="bonus-table__head">
<tr>
<td>$title</td>
</tr>
</thead>
</table>
</div>
A;
}
return "$top3title$top";
case "clf":
$listtopcasinos = listtopcasinos("", "", "", "plus1", $theid);
if ($title) {
eval("\$title=\"$title\";");
if (!preg_match("@^<h\d+@i", $title)) $title = "<span class='ash2'>$title</span>";
}
if ($listtopcasinos) {
$listtopcasinos = <<<A
<div class="block">
$title
$listtopcasinos
</div>
A;
}
return $listtopcasinos;
default:
return;
}
break;
default:
return;
}
}
function sbggood($cid, $sb, $bsid)
{
global $allcbp;
if (!$sb or !$bsid) return 1;
if (!isset($allcbp)) $allcbp = allcbp();
switch ($sb) {
case "software":
global $univ_goodsoftware;
if (!$univ_goodsoftware) $univ_goodsoftware = univ_goodsoftware();
if (!isset($univ_goodsoftware[$bsid])) return 0;
$m = explode(",", $allcbp[$cid]['software_id']);
if (in_array($bsid, $m)) return 1;
else return 0;
case "banking":
$m = explode(",", $allcbp[$cid]['banking_id']);
foreach ($m as $ee) {
$ee = strtr($ee, array("(1)" => "", "(2)" => "", "(3)" => ""));
if ($bsid == $ee) return 1;
}
return 0;
case "game":
$m = explode(",", $allcbp[$cid]['games']);
if (in_array($bsid, $m)) return 1;
else return 0;
case "jurisdiction":
$m = explode(",", $allcbp[$cid]['jurisdiction']);
if (in_array($bsid, $m)) return 1;
else return 0;
default:
return 1;
}
}
function get_top_table($max = "", $title = "", $ordertype = "", $type = "")
{
global $sitedata;
global $actualcount;
global $sitetypegeneral;
$usenewtop = 1;
if (!$type) $type = $sitetypegeneral;
switch ($ordertype) {
case "pronostics":
case "news":
if (!in_array($sitedata['using_template'], array("pel"))) return;
break;
default:
if (preg_match("@^([bsjg])_(.+)@", $ordertype, $matchesbs)) {
$ordertype = "";
$bsid = $matchesbs[2];
switch ($matchesbs[1]) {
case "b":
$sb = "banking";
break;
case "s":
$sb = "software";
break;
case "j":
$sb = "jurisdiction";
break;
case "g":
$sb = "game";
break;
}
}
}
if ($title) {
$title = strtr($title, array('"' => '\"'));
$year = date("Y");
$month = getMois_univ(date("F"));
$title = strtr($title, array('$month(uppercase_first)' => ucfirst($year), '$year' => $year, '$month' => $month));
}
switch ($sitedata['using_template']) {
case "bcel":
return top10home("", $title, $max, $ordertype, "", "", $sb, $bsid);
case "sco":
return bonuslist("", $title, $max, $ordertype, "topx", "", "", $sb, $bsid);
case "ocs":
return ocstop3($title, $max, $ordertype, "", "", $sb, $bsid);
case "ocrb":
return hptopright($title, $max, "wider", $ordertype, "", "", "", $sb, $bsid);
case "parier":
return listofbonus("", $title, "topx", $max, $ordertype, "", "", "", $sb, $bsid);
case "pro":
return listbonus($title, $max, "notitle", $ordertype, "", "", $sb, $bsid);
case "cfo":
return top5home($title, $max, $ordertype, "", "", $sb, $bsid);
case "jcgen":
return allcasinos("topx", $title, $max, $ordertype, "", "", $sb, $bsid);
case "pel":
switch ($ordertype) {
case "monthly casino":
case "monthly bookmaker":
case "monthly bingo":
return monthly();
case "pronostics":
return pronosticshp($max, $title);
case "news":
return newsindex($max, $title);
default:
return addtable("topx", $title, $max, $ordertype, "", "", "", $sb, $bsid);
}
case "celorg":
return top5ingames("topx", $title, $max, $ordertype, "", "", $sb, $bsid);
case "cfst":
return bonuslist("", $title, $max, $ordertype, "topx", "", "", $sb, $bsid);
case "pssch":
return toptable($title, $max, $ordertype, "topx", "", "", $sb, $bsid);
case "clf":
$listtopcasinos = listtopcasinos($max, "", $ordertype, "", "", $sb, $bsid);
if (!$actualcount) return;
if ($title) {
$count = $actualcount;
eval("\$title=\"$title\";");
if (!preg_match("@^<h\d+@i", $title)) $title = "<span class='ash2'>$title</span>";
}
if ($listtopcasinos) {
$listtopcasinos = <<<A
<div class="block">
$title
$listtopcasinos
</div>
A;
}
return $listtopcasinos;
case "tcc":
return hptop5($max, $title, $ordertype, "", "", $sb, $bsid);
case "1":
case "2":
return get_top_table_smallsites($max, $title, $ordertype, "", "", $type, $sb, $bsid);
case "gr":
case "gr2":
$top = allcasinos("", $max, "", $ordertype, "", "", $sb, $bsid);
if (!$actualcount) return;
if ($title) {
$count = $actualcount;
eval("\$title=\"$title\";");
$top3title = <<<A
<div class="top3title">
<table class="preset bonus-table">
<thead class="bonus-table__head">
<tr>
<td>$title</td>
</tr>
</thead>
</table>
</div>
A;
}
return "$top3title$top";
}
}
function get_top_table_smallsites($max = "", $title = "", $ordertype = "", $plus1 = "", $id = "", $type = "", $sb = "", $bsid = "")
{
global $usetable;
global $sitelan;
global $sitetypegeneral;
global $site;
global $sitedata;
global $remoteip;
global $maincat;
global $allcbp;
global $site_table_criteria;
global $univ_tops;
$univ_tops = array();
if (!$type) $type = $sitetypegeneral;
$logofolder = $maincat[$type]['path_oqaque_logo'];
$idname = $maincat[$type]['id'];
$ext = $maincat[$type]['oqaque_logo_ext'];
$usetable = $maincat[$type]['data'];
$reviewtext = array("en" => "Review", "fr" => "Revue", "de" => "Rezension", "es" => "Análisis", "sv" => "Recension", "fi" => "Arvostelu", "no" => "Anmedelse", "it" => "Recensione", "ro" => "Recenzie", "pl" => "", "pt" => "Crítica");
$toptext["bookmakers"] = array( "en" => "TOP X BOOKMAKERS",
"fr" => "TOP X BOOKMAKERS",
"de" => "TOP X BOOKMAKERS",
"es" => "TOP X BOOKMAKERS",
"sv" => "TOP X BOOKMAKERS",
"fi" => "TOP X BOOKMAKERS",
"no" => "TOP X BOOKMAKERS",
"it" => "TOP X BOOKMAKERS",
"ro" => "TOP X BOOKMAKERS",
"pt" => "TOP X BOOKMAKERS",
"pl" => "TOP X BOOKMAKERS"
);
$toptext["pokerrooms"] = array( "en" => "TOP X POKER ROOMS",
"fr" => "TOP X POKER ROOMS",
"de" => "TOP X POKER ROOMS",
"es" => "TOP X POKER ROOMS",
"sv" => "TOP X POKER ROOMS",
"fi" => "TOP X POKER ROOMS",
"no" => "TOP X POKER ROOMS",
"it" => "TOP X POKER ROOMS",
"ro" => "TOP X POKER ROOMS",
"pt" => "TOP X POKER ROOMS",
"pl" => "TOP X POKER ROOMS"
);
$toptext["casinos"] = array("en" => "TOP X CASINOS",
"fr" => "TOP X CASINOS",
"de" => "TOP X CASINOS",
"es" => "TOP X CASINOS",
"sv" => "TOP X CASINOS",
"fi" => "TOP X CASINOS",
"no" => "TOP X CASINOS",
"it" => "TOP X CASINOS",
"ro" => "TOP X CASINOS",
"pt" => "TOP X CASINOS",
"pl" => "TOP X CASINOS"
);
$toptext["bingo"] = array( "en" => "TOP X BINGO",
"fr" => "TOP X BINGO",
"de" => "TOP X BINGO",
"es" => "TOP X BINGO",
"sv" => "TOP X BINGO",
"fi" => "TOP X BINGO",
"no" => "TOP X BINGO",
"it" => "TOP X BINGO",
"ro" => "TOP X BINGO",
"pt" => "TOP X BINGO",
"pl" => "TOP X BINGO"
);
$reviewtext = $reviewtext[$sitelan] or $reviewtext = "Review";
$visittext = strtoupper(vlinktext());
$a = array();
if ($plus1) {
$a = array($site['site_id']);
} elseif ($sb) {
$tops = tops($ordertype);
if (!isset($site_table_criteria)) $site_table_criteria = site_table_criteria();
$query = "SELECT site_id FROM {$sitedata['db_tables']} WHERE type='review' and theorder>0 and site_id is not null $site_table_criteria order by {$tops['case']}id DESC";
$result = mnq($query);
if ($result) {
while ($r = mfs($result)) {
$a[] = $r['site_id'];
}
}
} else {
$tops = tops($ordertype);
$a = $tops['array'];
$max = min(($max) ? $max : 999, $sitedata['usesuperlist']);
}
$i = 0;
foreach ($a as $cid) {
if (!cbpgood($cid)) {
continue;
}
if (!sbggood($cid, $sb, $bsid)) {
continue;
}
$img = "img/$logofolder/{$cid}.$ext";
$stars = stars_in_top_list($i++);
if (file_exists_after_converting($img, 150, 60, getenv('RBO_URL')."/img/$logofolder/")) {
$img = "<img class='nrz' src='/$img' />";
} else {
$img = "";
}
$thename = addshy(id2name("", $cid));
if ($plus1) {
$thename = "<a href='{$sitedata['suffix']}/go/{$cid}.html'>$thename</a>";
} else {
if ($allcbp[$cid]['review']) {
$thename = "<a href='{$sitedata['suffix']}{$allcbp[$cid]['review']}'>$thename</a>";
}
}
$t .= "<tr>
<td class='no'>$i</td>
<td class='img'><a{$GLOBALS['nofollow']} href='{$sitedata['suffix']}/go/{$cid}.html' target='_blank'>$img</a></td>
<td class='nm'>$thename</td>
<td class='stars'>$stars</td>
<td class='v'><a{$GLOBALS['nofollow']} href='{$sitedata['suffix']}/go/{$cid}.html' target='_blank'>$visittext</a></td>
</tr>";
$univ_tops[] = $cid;
if ($i == $max) {
break;
}
}
if ($title) {
$count = $i;
eval("\$topt=\"$title\";");
} else {
$topt = $toptext[$usetable][$sitelan];
$topt = strtr($topt, array(" X " => " $i "));
$topt = preg_replace("@ 1 (.+)s$@i", " $1", $topt);
}
if ($t) {
$t = "<table cellpadding='0' cellspacing='0' id='top_list1' style='margin:15px 0;'><caption><span>$topt</span></caption>$t</table>";
}
return $t;
}
function hp_beginningtext_and_toplist()
{
global $usetable;
global $sitelan;
global $sitetypegeneral;
global $site;
global $sitedata;
global $remoteip;
global $toptagavailable;
if ($site['page_url'] != "/") return;
if (!($s = $site['site_main_2'])) {
$e = preg_split("@(?<=</p>)<(h2|div)@i", $site['maintext'], 2, PREG_SPLIT_DELIM_CAPTURE);
if (count($e) > 1) {
if ($e[0]) {
$s = $e[0];
$site['maintext'] = "<" . $e[1] . $e[2];
} else {
}
} else return;
}
if (!$toptagavailable) $t = get_top_table();
if ($t) $s .= $t;
return $s;
}
function id2name($usetable, $id)
{ // $usetable not used
global $id2name;
global $sitetypesall;
global $maincat;
if (!$id2name) {
$id2name = array();
foreach ($sitetypesall as $tp) {
$a = $maincat[$tp]['data'];
$u = $maincat[$tp]['id'];
$query = "SELECT * FROM $a";
$result = mnq($query);
if ($result) {
while ($r = mfs($result)) {
$r['name'] = change_name_from_other_names($r);
$id2name[$r[$u]] = $r['name'];
}
}
}
}
return $id2name[$id];
}
function stars_in_top_list($n)
{
$a = array(0 => 50, 1 => 45, 2 => 45, 3 => 45, 4 => 40);
if ($n > 15) $i = 30;
elseif ($n > 4) $i = 40;
elseif ($n > 1) $i = 45;
else $i = 50;
$s = <<<A
<div class='starsbg'><div class='starsfg stars$i'></div></div>
A;
return $s;
}
function site_table_criteria()
{
global $sitedata;
if ($sitedata['table_criteria'])
return " AND " . strtr($sitedata['table_criteria'], array("*lan*" => $sitedata['lan'], "*subdomain*" => preg_replace("@\..+$@", "", $sitedata['url'])));
if (preg_match("@/.+@", $sitedata['url'], $matches))
return " AND subsite='{$matches[0]}'";
elseif ($sitedata['children_suffix']) return " AND subsite IS NULL";
}
function get_sitelan_from_sitedata()
{
global $sitedata;
return $sitedata['lan'];
}
function get_maintable_from_sitedata()
{
global $sitedata;
return $sitedata['db_tables'];
}
function topmenugeneral()
{
global $sitedata;
global $headerwithtopmenu;
global $site;
if (!$sitedata['topmenu_enabled']) return;
if ($sitedata['topmenu_content']) {
preg_match_all("@<a href\=[\'|\"](.+)[\'|\"].*>(.+)</a>@Ui", $sitedata['topmenu_content'], $matches);
foreach ($matches[0] as $ind => $m) {
if ($matches[1][$ind] == $site['page_url'])
$l = "<span class='cur'>{$matches[2][$ind]}</span>";
else
$l = "<a$class href='{$matches[1][$ind]}'>{$matches[2][$ind]}</a>";
$headerwithtopmenu = " headerwithtopmenu";
if ($i++ > 0) $s .= "<li class='sep'><span></span></li>";
$s .= "<li>$l</li>";
}
return "<div id='topmenugeneral'><ul>$s</ul></div>";;
}
}
function adjust_https($s)
{
global $sitedata;
global $allnonhttpssites;
$u = $sitedata['nonhttpssites'];
if (!$u) return $s;
$allnonhttpssites = explode(",", $u);
$s = preg_replace_callback("@http\://([^/\'\"\s]+)\b@i", "adjust_https_callback", $s);
return $s;
}
function adjust_https_callback($matches)
{
global $allnonhttpssites;
if (!in_array($matches[1], $allnonhttpssites)) return "https://{$matches[1]}";
else return $matches[0];
}
function is_https($s)
{
global $sitedata;
$u = $sitedata['nonhttpssites'];
$u = explode(",", $u);
preg_match("@^https?\://([^/]+)@i", $s, $matches);
if (!in_array($matches[1], $u)) return true;
}
function all_locales()
{
global $all_locales;
if ($all_locales) return $all_locales;
$a = <<<A
fr-AD Andorre
fr-BE Belgique
fr-BF Burkina Faso
fr-BI Burundi
fr-BJ Bénin
fr-CA Canada
fr-CAXON Ontario
fr-CD République Démocratique du Congo
fr-CF République Centrafricaine
fr-CG Congo
fr-CH Suisse
fr-CI Côte D'Ivoire
fr-CM Cameroun
fr-DJ Djibouti
fr-FR France
fr-GA Gabon
fr-GB Royaume-Uni
fr-GF Guinée Française
fr-GN Guinée
fr-GP Guadeloupe
fr-HT Haïti
fr-IT Italie
fr-KM Comores
fr-LB Liban
fr-LU Luxembourg
fr-MC Monaco
fr-MG Madagascar
fr-ML Mali
fr-MQ Martinique
fr-NC Nouvelle-Calédonie
fr-NE Niger
fr-PF Polynésie française
fr-PM Saint-Pierre et Miquelon
fr-RE Réunion
fr-RW Rwanda
fr-SC Les Seychelles
fr-TD Tchad
fr-TG Togo
fr-VA Vatican – Le Saint-Siège
fr-VU Vanuatu
fr-WF Wallis-et-Futuna
fr-YT Mayotte
fr-SN Sénégal
fr-DZ Algérie
fr-MA Maroc
fr-TN Tunisie
fr-MU Maurice
en-AG Antigua And Barbuda
en-AI Anguilla
en-AS American Samoa
en-AU Australia
en-BB Barbados
en-BE Belgium
en-BM Bermuda
en-BN Brunei Darussalam
en-BS Bahamas
en-BW Botswana
en-BZ Belize
en-CA Canada
en-CAXON Ontario
en-CK Cook Islands
en-CM Cameroon
en-DM Dominica
en-ER Eritrea
en-ET Ethiopia
en-FJ Fiji
en-FK Falkland Islands (Malvinas)
en-FM Micronesia
en-GB United Kingdom
en-GD Grenada
en-GH Ghana
en-GI Gibraltar
en-GM Gambia
en-GU Guam
en-GY Guyana
en-HK Hong Kong
en-IE Ireland
en-IL Israel
en-IN India
en-IO British Indian Ocean Territory
en-JM Jamaica
en-KE Kenya
en-KI Kiribati
en-KN Saint Kitts And Nevis
en-KY Cayman Islands
en-LC Saint Lucia
en-LR Liberia
en-LS Lesotho
en-MH Marshall Islands
en-MP Northern Mariana Islands
en-MS Montserrat
en-MT Malta
en-MU Mauritius
en-MW Malawi
en-NA Namibia
en-NF Norfolk Island
en-NG Nigeria
en-NR Nauru
en-NU Niue
en-NZ New Zealand
en-PG Papua New Guinea
en-PH Philippines
en-PK Pakistan
en-PN Pitcairn
en-PR Puerto Rico
en-PW Palau
en-RW Rwanda
en-SB Solomon Islands
en-SC Seychelles
en-SG Singapore
en-SH Saint Helena
en-SL Sierra Leone
en-SO Somalia
en-SZ Swaziland
en-TC Turks And Caicos Islands
en-TK Tokelau
en-TO Tonga
en-TT Trinidad And Tobago
en-UG Uganda
en-UM United States Minor Outlying Islands
en-US United States
en-VC Saint Vincent And The Grenadines
en-VG Virgin Islands, British
en-VI Virgin Islands, U.S.
en-VU Vanuatu
en-WS Samoa
en-ZA South Africa
en-ZM Zambia
en-ZW Zimbabwe
es-AR Argentina
es-BO Bolivia
es-CL Chile
es-CO Colombia
es-CR Costa Rica
es-CU Cuba
es-DO República Dominicana
es-EC Ecuador
es-ES España
es-GQ Guinea Ecuatorial
es-GT Guatemala
es-HN Honduras
es-MX México
es-NI Nicaragua
es-PA Panamá
es-PE Perú
es-PR Puerto Rico
es-PY Paraguay
es-SV El Salvador
es-US Estados Unidos
es-UY Uruguay
es-VE Venezuela
de-AT Österreich
de-BE Belgien
de-CH Schweiz
de-DE Deutschland
de-DK Dänemark
de-FR Frankreich
de-HU Ungarn
de-IT Italien
de-LI Liechtenstein
de-LU Luxemburg
de-PL Polen
sv-AX Åland
sv-FI Finland
sv-SE Sverige
fi-FI Suomi
fi-SE Ruotsi
no-NO Norge
pt-BR Brasil
pt-PT Portugal
fr France
de Deutschland
en United Kingdom
fi Suomi
sv Sverige
es España
no Norge
pt Brasil
A;
preg_match_all("@^(.+)\t(.*?)\r*$@m", $a, $matches);
foreach ($matches[1] as $i => $j) {
$m[$j] = $matches[2][$i];
}
return $m;
}
function linkstoothers()
{
global $children_suffix;
global $sites_locales;
global $all_locales;
if (!$children_suffix) return;
if (!$all_locales) $all_locales = all_locales();
foreach ($sites_locales as $k => $o) {
$s .= "<a class='ftlinks' href='$k/'>{$all_locales[$o]}</a>";
}
return $s;
}
function should_block($ip)
{
if ($ip == "146.88.234.136") return false;
if (preg_match("@^(/css/|/js/|/img/)@", $_SERVER['REQUEST_URI'])) return false;
global $ipblocklist;
global $citiestoblock;
global $regionstoblock;
global $sitedata;
global $ipcountry;
global $useipv6;
global $localmode;
global $blockreason;
global $nightmode;
global $remoteip;
if (!$ip) return false;
if (in_array($sitedata['short'], array("bcelen")) and $ipcountry == "gb") return true; // bcelen block all gb visits
if (in_array($sitedata['short'], array("bceles", "jcges", "tcceses", "jgef", "mcoe", "jdmx", "npl")) and $ipcountry == "es") return true; // some sites block all es visits
if ($ipblocklist && !(in_array($sitedata['short'], array("bcel","gr","clf")))) {
if ($useipv6) {
if (is_array($ipblocklist['blocked_ips_ipv6'])) {
if (in_array($ip, $ipblocklist['blocked_ips_ipv6'])) {
$blockreason = "in block ipv6 list";
return true;
}
}
} else {
if (is_array($ipblocklist['blocked_ips_ipv4'])) {
$ipn = preg_replace("@(\d+\.\d+\.\d+\.)\d+@", "$1*", $ip);
if (in_array($ipn, $ipblocklist['blocked_ips_ipv4']) or in_array($ip, $ipblocklist['blocked_ips_ipv4'])) {
$blockreason = "in block ipv4 list";
return true;
}
}
}
}
if (in_array($sitedata['short'], array("cfst", "tccfrfr", "jcgfr", "bjeu", "bjf", "jdr", "masinfo", "lv", "celorg", "celinfo"))) {
if ($ipcountry == "fr" and stripos($_SERVER['HTTP_USER_AGENT'], "Firefox") !== false) return true;
if (!$nightmode) {
$ipcity = "";
$ipregion = "";
$ipdataall = ipstack($remoteip);
if (!$ipdataall['error']) {
$ipcity = strtolower($ipdataall['city']);
$ipregion = strtolower($ipdataall['region_code']);
}
array_walk($citiestoblock, "normaliza_4filenamechange_on_array");
if (in_array(normaliza_4filenamechange($ipcity), $citiestoblock)) {
$blockreason = "in cities to block ($ipcity)";
return true;
}
if ($ipregion and $regionstoblock and in_array($ipregion, $regionstoblock)) {
$blockreason = "in regions to block ($ipregion)";
return true;
}
}
} elseif (
in_array($sitedata['short'], array("x375", "pel", "ssw", "x976", "pssch", "pro", "pronostics", "sw"))
) {
if ($sitedata['sitetype'] != "sport") return;
if (!in_array($ipcountry, array("ch"))) return;
if (in_array($sitedata['short'], array("pel", "sw")) and !$nightmode) {
$blockreason = "7am to 8pm";
return true;
}
$ipcity = "";
$ipdataall = ipstack($remoteip);
if (!$ipdataall['error']) {
$ipcity = strtolower($ipdataall['city']);
}
if (in_array($ipcity, array("bern"))) {
$blockreason = "in cities to block ($ipcity)";
return true;
}
} else return;
}
function topstext($theid, $description = "")
{
global $sitedata;
global $ipcountry;
global $alltopstext;
global $sitetypegeneral;
global $nightmode;
global $maincat;
$theid = trim($theid);
if (!isset($alltopstext)) {
$alltopstext = array();
$type_of_it = $maincat[$sitetypegeneral]['alias'];
$query = "SELECT * FROM live_tops_text WHERE short='{$sitedata['short']}' and type_of_it='$type_of_it'";
$result = mnq($query);
if ($result) {
while ($r = mfs($result)) {
$e = preg_split("@\n*^id:([a-zA-Z0-9\-]+)\n@m", $r['value'], -1, PREG_SPLIT_DELIM_CAPTURE);
$c = count($e);
$i = 1;
$j = array();
while ($i < $c) {
$x = $e[$i + 1];
$j[$e[$i]] = $e[$i + 1];
$i += 2;
}
$alltopstext[$r['description']][$r['version']] = $j;
}
}
}
if ($nightmode and $alltopstext[$description]["1"][$theid])
return $alltopstext[$description]["1"][$theid];
else
return $alltopstext[$description][""][$theid];
}
function tops($description = "", $ipx = "", $type = "", $short = "", $idname = "")
{
global $sitedata;
global $ipcountry;
global $alltops;
global $allribbons;
global $sitetypegeneral;
global $nightmode;
global $dont_use_general_when_top_missing;
global $sitelan;
global $maincat;
if (!$ipx) $ipx = $ipcountry;
if ($ipx == "others") $ipx = "general";
if (!$type) $type = $sitetypegeneral;
if (!$short) $short = $sitedata['short'];
if (!$idname) $idname = getidname();
$type_of_it = $maincat[$type]['alias'];
if ($ipx != "general" and !in_array($ipx, $dont_use_general_when_top_missing)) $ips = array("general", $ipx);
else $ips = array($ipx);
foreach ($ips as $ip) {
if (!isset($alltops[$ip])) {
$alltops[$ip] = array();
$allribbons = array();
if (!$result) {
if (!$sitedata['usesuperlist']) {
$use_another = array();
$topno = array();
$skip_this = array();
$query = "SELECT * FROM live_tops WHERE short='$short'";
$result = mnq($query);
while ($r = mfs($result)) {
if ($r['use_another']) {
preg_match("@^([^\(\:]+)(?:\((.+)\))?(?:\:(\d+))?$@", $r['use_another'], $matches);
if ($matches[1] == $short and $matches[2] == $r['description'] and $matches[3] == $r['version']) {
} else {
$use_another[$matches[1]][$matches[2]][$matches[3]][] = array($r['description'], $r['version']);
$topno[$r['description']][$r['version']] = $r['topno'] or $topno[$r['description']][$r['version']] = 20;
$skip_this[$r['description']][$r['version']] = 1;
}
}
}
}
if ($sitedata['usesuperlist']) {
$query = "SELECT * FROM live_tops WHERE short='superlist_{$type}_$sitelan'";
} else {
if ($use_another) {
$shortx = array($short);
foreach ($use_another as $x => $o) {
if ($x != $short) $shortx[] = $x;
}
$shortxstring = implode(",", $shortx);
$query = "SELECT * FROM live_tops WHERE find_in_set(short,'$shortxstring')";
} else {
mds($result, 0);
}
}
if ($query) $result = mnq($query);
} else mds($result, 0);
if ($result) {
while ($r = mfs($result)) {
$dd = array();
$ee = array();
if (!$sitedata['usesuperlist'] and $r['short'] != $short) {
if ($r['use_another']) continue;
if (!$z = $use_another[$r['short']][$r['description']][$r['version']]) continue;
foreach ($z as $zz) {
$dd[] = $zz[0];
$ee[] = $zz[1];
}
} else {
if ($skip_this[$r['description']][$r['version']]) continue;
$dd[] = $r['description'];
$ee[] = $r['version'];
}
if ($r['ribbons']) {
$rbs = preg_split("@^(general|[a-z][a-z])\:(.*)@m", $r['ribbons'], -1, PREG_SPLIT_DELIM_CAPTURE);
$rbscount = count($rbs);
if ($rbscount > 3) {
$ri = 1;
while ($ri < $rbscount) {
if ($rbs[$ri] == $ip) {
$rbstext = explode("\n", trim($rbs[$ri + 2]));
$rbstextcount = count($rbstext);
$bi = 0;
$ribbons = array();
while ($bi < $rbstextcount) {
$ribbons[trim($rbstext[$bi])] = trim($rbstext[$bi + 1]);
$bi += 2;
}
break;
}
$ri += 3;
}
}
}
$m = "";
$ms = "";
if (preg_match("@^$ip(\:|\=)(.+)@m", $r['value'], $matches)) {
if ($matches[1] == "=") {
$newip = trim($matches[2]);
if (preg_match("@^$newip\:(.+)@m", $r['value'], $matches)) {
$m = $matches[1];
}
} else {
$m = $matches[2];
}
}
if ($m) $ms = explode(",", $m);
if ($ms) {
$a["string"] = $m;
$a["array"] = $ms;
$s = "";
$n = 0;
foreach ($ms as $mss) {
$n++;
$s .= "WHEN '$mss' THEN $n ";
}
$a["case"] = " CASE $idname $s ELSE 999 END, ";
if ($topno[$r['description']][$r['version']])
$a["max"] = $topno[$r['description']][$r['version']];
else $a["max"] = $r['topno'] or $a["max"] = 20;
} else {
$a["string"] = "";
$a["array"] = array();
$a["case"] = "";
$a["max"] = "";
}
foreach ($dd as $ind => $w) {
$alltops[$ip][$r['type_of_it']][$w][$ee[$ind]] = $a;
}
$allribbons[$ip][$r['type_of_it']][$w][$ee[$ind]] = $ribbons;
}
}
}
}
$emptyarray = array("string" => "", "array" => array(), "case" => "");
if ($nightmode and $alltops[$ipx][$type_of_it][$description]["1"]["string"]) {
$final = $alltops[$ipx][$type_of_it][$description]["1"];
} elseif ($alltops[$ipx][$type_of_it][$description][""]["string"]) {
$final = $alltops[$ipx][$type_of_it][$description][""];
} elseif (!in_array($ipx, $dont_use_general_when_top_missing) and $alltops["general"][$type_of_it][$description][""]["string"]) {
$final = $alltops["general"][$type_of_it][$description][""];
} else {
$final = $emptyarray;
}
return $final;
}
function univ_ribbon($id, $ipx = "", $type = "")
{
global $allribbons;
global $sitetypegeneral;
global $ipcountry;
global $maincat;
global $dict;
global $nightmode;
if (!$ipx) $ipx = $ipcountry;
if ($ipx == "others") $ipx = "general";
if (!$type) $type = $sitetypegeneral;
$type_of_it = $maincat[$type]['alias'];
if ($nightmode and $allribbons[$ipx][$type_of_it][""]["1"][$id])
$x = $allribbons[$ipx][$type_of_it][""]["1"][$id];
else
$x = $allribbons[$ipx][$type_of_it][""][""][$id];
if ($x) {
return array("class" => $x, "text" => $dict["ribbon_$x"]);
}
}
function getJour_univ($day)
{
global $sitelan;
switch ($sitelan) {
case "fr":
$jour["Monday"] = "Lundi";
$jour["Tuesday"] = "Mardi";
$jour["Wednesday"] = "Mercredi";
$jour["Thursday"] = "Jeudi";
$jour["Friday"] = "Vendredi";
$jour["Saturday"] = "Samedi";
$jour["Sunday"] = "Dimanche";
return $jour[$day];
case "es":
$jour["Monday"] = "lunes";
$jour["Tuesday"] = "martes";
$jour["Wednesday"] = "miércoles";
$jour["Thursday"] = "jueves";
$jour["Friday"] = "viernes";
$jour["Saturday"] = "sábado";
$jour["Sunday"] = "domingo";
return $jour[$day];
case "de":
$jour["Monday"] = "Montag";
$jour["Tuesday"] = "Dienstag";
$jour["Wednesday"] = "Mittwoch";
$jour["Thursday"] = "Donnerstag";
$jour["Friday"] = "Freitag";
$jour["Saturday"] = "Samstag";
$jour["Sunday"] = "Sonntag";
return $jour[$day];
case "fi":
$jour["Monday"] = "maanantai";
$jour["Tuesday"] = "tiistai";
$jour["Wednesday"] = "keskiviikko";
$jour["Thursday"] = "torstai";
$jour["Friday"] = "perjantai";
$jour["Saturday"] = "lauantai";
$jour["Sunday"] = "sunnuntai";
return $jour[$day];
case "sv":
$jour["Monday"] = "Måndag";
$jour["Tuesday"] = "Tisdag";
$jour["Wednesday"] = "Onsdag";
$jour["Thursday"] = "Torsdag";
$jour["Friday"] = "Fredag";
$jour["Saturday"] = "Lördag";
$jour["Sunday"] = "Söndag";
return $jour[$day];
case "no":
$jour["Monday"] = "mandag";
$jour["Tuesday"] = "tirsdag";
$jour["Wednesday"] = "onsdag";
$jour["Thursday"] = "torsdag";
$jour["Friday"] = "fredag";
$jour["Saturday"] = "lørdag";
$jour["Sunday"] = "søndag";
return $jour[$day];
case "pl":
$jour["Monday"] = "Poniedzia?ek";
$jour["Tuesday"] = "Wtorek";
$jour["Wednesday"] = "?roda";
$jour["Thursday"] = "Czwartek";
$jour["Friday"] = "Pi?tek";
$jour["Saturday"] = "Sobota";
$jour["Sunday"] = "Niedziela";
return $jour[$day];
case "pt":
$jour["Monday"] = "Segunda-feira";
$jour["Tuesday"] = "Terça-feira";
$jour["Wednesday"] = "Quarta-feira";
$jour["Thursday"] = "Quinta-feira";
$jour["Friday"] = "Sexta-feira";
$jour["Saturday"] = "Sábado";
$jour["Sunday"] = "Domingo";
return $jour[$day];
default:
return $day;
}
}
function getMois_univ($month)
{
global $sitelan;
switch ($sitelan) {
case "fr":
$mois["January"] = "janvier";
$mois["February"] = "février";
$mois["March"] = "mars";
$mois["April"] = "avril";
$mois["May"] = "mai";
$mois["June"] = "juin";
$mois["July"] = "juillet";
$mois["August"] = "août";
$mois["September"] = "septembre";
$mois["October"] = "octobre";
$mois["November"] = "novembre";
$mois["December"] = "décembre";
return $mois[$month];
case "es":
$mois["January"] = "enero";
$mois["February"] = "febrero";
$mois["March"] = "marzo";
$mois["April"] = "abril";
$mois["May"] = "mayo";
$mois["June"] = "junio";
$mois["July"] = "julio";
$mois["August"] = "agosto";
$mois["September"] = "septiembre";
$mois["October"] = "octubre";
$mois["November"] = "noviembre";
$mois["December"] = "diciembre";
return $mois[$month];
case "de":
$mois["January"] = "Januar";
$mois["February"] = "Februar";
$mois["March"] = "März";
$mois["April"] = "April";
$mois["May"] = "Mai";
$mois["June"] = "Juni";
$mois["July"] = "Juli";
$mois["August"] = "August";
$mois["September"] = "September";
$mois["October"] = "Oktober";
$mois["November"] = "November";
$mois["December"] = "Dezember";
return $mois[$month];
case "fi":
$mois["January"] = "tammikuu";
$mois["February"] = "helmikuu";
$mois["March"] = "maaliskuu";
$mois["April"] = "huhtikuu";
$mois["May"] = "toukokuu";
$mois["June"] = "kesäkuu";
$mois["July"] = "heinäkuu";
$mois["August"] = "elokuu";
$mois["September"] = "syyskuu";
$mois["October"] = "lokakuu";
$mois["November"] = "marraskuu";
$mois["December"] = "joulukuu";
return $mois[$month];
case "sv":
$mois["January"] = "januari";
$mois["February"] = "februari";
$mois["March"] = "mars";
$mois["April"] = "april";
$mois["May"] = "maj";
$mois["June"] = "juni";
$mois["July"] = "juli";
$mois["August"] = "augusti";
$mois["September"] = "september";
$mois["October"] = "oktober";
$mois["November"] = "november";
$mois["December"] = "december";
return $mois[$month];
case "no":
$mois["January"] = "januar";
$mois["February"] = "februar";
$mois["March"] = "mars";
$mois["April"] = "april";
$mois["May"] = "mai";
$mois["June"] = "juni";
$mois["July"] = "juli";
$mois["August"] = "august";
$mois["September"] = "september";
$mois["October"] = "oktober";
$mois["November"] = "november";
$mois["December"] = "desember";
return $mois[$month];
case "pl":
$mois["January"] = "styczeń";
$mois["February"] = "luty";
$mois["March"] = "marzec";
$mois["April"] = "kwiecień";
$mois["May"] = "maj";
$mois["June"] = "czerwiec";
$mois["July"] = "lipiec";
$mois["August"] = "sierpień";
$mois["September"] = "wrzesień";
$mois["October"] = "październik";
$mois["November"] = "listopad";
$mois["December"] = "grudzień";
return $mois[$month];
case "pt":
$mois["January"] = "janeiro";
$mois["February"] = "fevereiro";
$mois["March"] = "março";
$mois["April"] = "abril";
$mois["May"] = "maio";
$mois["June"] = "junho";
$mois["July"] = "julho";
$mois["August"] = "agosto";
$mois["September"] = "setembro";
$mois["October"] = "outubro";
$mois["November"] = "novembro";
$mois["December"] = "dezembro";
return $mois[$month];
default:
return $month;
}
}
function af_listpagesofsite($fil = "")
{
global $maintable;
global $site_table_criteria;
global $master_short;
global $sitetypegeneral;
global $sitedata;
$tablesused[0] = $maintable;
if ($master_short == "tcc" or $master_short == "tccdede") {
$tablesused[1] = "casinos_plus";
}
$a = array();
foreach ($tablesused as $tb) {
$q1 = "SELECT * FROM $tb limit 1";
$result = mnq($q1);
$st = mfs($result);
$mainqueries[$tb] = "SELECT * FROM $tb WHERE (type IS NULL or type !='news') and theorder>0$site_table_criteria order by theorder";
}
foreach ($mainqueries as $tablename => $mainquery) {
hierarchy($mainquery, $tablename);
}
return af_process_hierarchy($fil);
}
function af_process_hierarchy($fil)
{
global $url;
global $pp;
foreach ($pp as $page_url => $o) {
global $f;
$f = array();
traceback($page_url);
$f = array_reverse($f);
$c = count($f);
switch ($c) {
case 1:
$rel[$f[0]][""] = 1;
break;
case 2:
$rel[$f[0]][$f[1]][""] = 1;
break;
case 3:
$rel[$f[0]][$f[1]][$f[2]][""] = 1;
break;
case 4:
$rel[$f[0]][$f[1]][$f[2]][$f[3]][""] = 1;
break;
case 5:
$rel[$f[0]][$f[1]][$f[2]][$f[3]][$f[4]][""] = 1;
break;
case 6:
$rel[$f[0]][$f[1]][$f[2]][$f[3]][$f[4]][$f[5]][""] = 1;
break;
case 7:
$rel[$f[0]][$f[1]][$f[2]][$f[3]][$f[4]][$f[5]][$f[6]][""] = 1;
break;
case 8:
$rel[$f[0]][$f[1]][$f[2]][$f[3]][$f[4]][$f[5]][$f[6]][$f[7]][""] = 1;
break;
case 9:
$rel[$f[0]][$f[1]][$f[2]][$f[3]][$f[4]][$f[5]][$f[6]][$f[7]][$f[8]][""] = 1;
break;
case 10:
$rel[$f[0]][$f[1]][$f[2]][$f[3]][$f[4]][$f[5]][$f[6]][$f[7]][$f[8]][$f[9]][""] = 1;
break;
case 11:
$rel[$f[0]][$f[1]][$f[2]][$f[3]][$f[4]][$f[5]][$f[6]][$f[7]][$f[8]][$f[9]][$f[10]][""] = 1;
break;
}
}
if ($pp) {
adjustorder($rel);
adjustorder_root($rel);
if ($fil) {
$rel = addfil($rel, $fil);
}
$s = "<div id='univ_sitemap'>" . af_showhierarchy($rel, "") . "</div>";
}
return $s;
}
function addfil($rel, $fil)
{
global $ffff;
$ffff = "";
relfilter($rel, $fil);
if ($ffff) $rel = array($fil => $ffff);
return $rel;
}
function relfilter($r, $fil)
{
global $ffff;
if (!$ffff and is_array($r)) {
foreach ($r as $key => $v) {
if ($key == "$fil") {
$ffff = $v;
return;
} else relfilter($v, $fil);
}
}
}
function hierarchy($query, $tablename)
{
global $pp;
global $p2c;
global $maincat;
global $sitedata;
$result = mnq($query);
if ($result) {
while ($r = mfa($result)) {
if ($r['type'] == "review" or $tablename == "casinos_plus") {
$tid = $r[$sitedata['idname']];
if (!cbpgood($tid)) continue;
}
$maintitle = $r['maintitle'] or $maintitle = $r['main_title'] or $maintitle = $r['menutitle'] or $maintitle = $r['game_name'] or $maintitle = $r['team_name'] or $maintitle = $r['menu_text'] or $maintitle = $r['plus_name'] or $maintitle = $r['bank_name'] or $maintitle = $r['page_url'];
$txt = $r['maintext'] . $r['site_main_2'] . $r['site_main_3'];
if ($r['parent_link'] and !preg_match("@\{.+\}@", $txt)) $noparentlink = 1;
else $noparentlink = 0;
if (trim($r['bottom_text'])) $nobottomtext = 0;
else $nobottomtext = 1;
if (in_array($tablename, array("bcel_site", "game"))) $r['parent_link'] = get_parentlink_bcel($r, $tablename);
$ppk = trim($r['parent_link']);
if ($ppk == $r['page_url']) $ppk = "";
$metatitle = $r['metatitle'] or $metatitle = $r['meta_title'];
$metadescription = $r['metadescription'] or $metadescription = $r['meta_description'];
$pp[$r['page_url']] = array($ppk, $maintitle, $r['theorder'] + 1 - $r['id'] / 10000000, $noparentlink, $nobottomtext, $metatitle, $metadescription, $r['menutitle'], $r['id']);
$p2c[$r['parent_link']][] = $r['page_url'];
}
} else {
$pp = array();
$p2c = array();
}
}
function adjustorder(&$rel)
{
global $pp;
$a = array();
if (is_array($rel)) {
foreach ($rel as $k => $u) {
$a[] = $pp[$k][2];
}
array_multisort($a, $rel);
foreach ($rel as &$u) {
//if (is_array($u))
adjustorder($u);
}
}
}
function af_showhierarchy($rel, $no)
{
global $pp;
global $sitedata;
global $site_protocol;
if (is_array($rel)) {
$v = 0;
foreach ($rel as $k => $u) {
if ($k !== "") {
$v++;
$lll = "";
$tthere = $pp[$k][7] or $tthere = $pp[$k][1];
if ($no and $pp[$k][1]) $lll = "<a target='_blank' href='$site_protocol{$sitedata['url']}$k'>$tthere</a>";
if ($lll) $s .= "<ul class='sm_hierarchy'><li>$lll" . af_showhierarchy($u, "$no$v.") . "</li></ul>";
else $s .= af_showhierarchy($u, "$no$v.");
}
}
return $s;
}
}
function traceback($page_url)
{
global $pp;
global $f;
$f[] = $page_url;
if ($pp[$page_url][0]) {
traceback($pp[$page_url][0]);
}
}
function adjustorder_root(&$rel)
{
ksort($rel);
}
function hasbrother($k)
{
global $p2c;
global $pp;
$p = $pp[$k][0];
if ($p and is_array($p2c[$p]) and count($p2c[$p]) > 1) return true;
}
function metatitle_field($maintable)
{
$query = "SELECT meta_title FROM $maintable limit 0";
$result = mnq($query);
if ($result) return "meta_title";
else return "metatitle";
}
function sitehasmorethan1page()
{
global $maintable;
global $site_table_criteria;
$query = "SELECT count(*) FROM $maintable WHERE page_url !='/sitemap.html' and theorder>0$site_table_criteria";
$result = mnq($query);
if ($result) {
$r = mfs($result);
if ($r['count(*)'] > 1) return true;
}
}
function sites_using_the_banking($bid, $sitetype = "casino")
{
global $sitetypegeneral;
global $sitelan;
global $ipcountry;
global $maincat;
if (!univ_bank_is_valid($bid)) return array("nothing" => "");
$a = array();
$tbs = $maincat[$sitetype]['data'];
$idd = $maincat[$sitetype]['id'];
$query = "SELECT $idd FROM $tbs WHERE valid=1 and banking_id REGEXP \"([',']|^){$bid}['(']\"";
if ($result = mnq($query)) {
while ($r = mfs($result)) {
if (!cbpgood($r[$idd])) continue;
$a[] = $r[$idd];
}
}
return $a;
}
function sites_using_the_software($sid, $sitetype = "casino")
{
global $sitetypegeneral;
global $sitelan;
global $ipcountry;
global $maincat;
$a = array();
$tbs = $maincat[$sitetype]['data'];
$idd = $maincat[$sitetype]['id'];
$query = "SELECT $idd FROM $tbs WHERE valid=1 and find_in_set('$sid',software_id)";
if ($result = mnq($query)) {
while ($r = mfs($result)) {
if (!cbpgood($r[$idd])) continue;
$a[] = $r[$idd];
}
}
return $a;
}
function sites_using_the_game($gid, $sitetype = "casino")
{
global $sitetypegeneral;
global $sitelan;
global $ipcountry;
if ($sitetype != "casino") return;
$a = array();
$query = "SELECT casino_id FROM casinos WHERE valid=1 and find_in_set('$gid',games)";
if ($result = mnq($query)) {
while ($r = mfs($result)) {
if (!cbpgood($r[casino_id])) continue;
$a[] = $r[casino_id];
}
}
return $a;
}
function univ_contact()
{
global $sitelan;
$GLOBALS['adminbeforebodycloses'] = <<<A
<script>
$("#univcontactsubmit").click(function(){
var hasError = false;
var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
var lan = $("#contact_lan").val();
var t_emptyfield = $("#contact_1").val();
var t_emailinvalid = $("#contact_2").val();
var t_success = $("#contact_4").val();
var t_validationerror = $("#contact_3").val();
$("#spanname").text("");
$("#spanemail").text("");
$("#spanmessage").text("");
$("#contactresponse").text("");
var emailVal = $.trim($("#youremail").val());
if(emailVal == '') {
$("#spanemail").text(t_emptyfield);
hasError = true;
} else if(!emailReg.test(emailVal)) {
$("#spanemail").text(t_emailinvalid);
hasError = true;
}
var msgVal = $.trim($("#yourmessage").val());
if(msgVal == '') {
$("#spanmessage").text(t_emptyfield);
hasError = true;
}
var nameVal = $.trim($("#yourname").val());
if(nameVal == '') {
$("#spanname").text(t_emptyfield);
hasError = true;
}
if(hasError == false) {
$.post("/univemail.html",
{ name: nameVal, email: emailVal, message: msgVal, contactlan: lan },
function(data){
$("#contactresponse").text(t_success);
$("#yourname").val("");
$("#youremail").val("");
$("#yourmessage").val("");
}
);
} else {
$("#contactresponse").html("<span style='color:red;'>"+t_validationerror+"</span>");
}
return false;
});
</script>
A;
switch ($sitelan) {
case "en":
$t = array(
"Your name", "Your Email", "Type your message", "Send",
"Please fill the required field.",
"Email address seems invalid.",
"Validation errors occurred. Please confirm the fields and submit it again.",
"Your message was sent successfully. Thanks.",
);
break;
case "fr":
$t = array(
"Votre nom", "Votre Email", "Tapez votre message", "Envoyer",
"Veuillez remplir les champs requis.",
"L'adresse Email semble invalide.",
"Erreur de validation. Veuillez vérifier les champs et soumettre à nouveau.",
"Votre message a bien été envoyé. Merci.",
);
break;
case "de":
$t = array(
"Ihr Name", "Ihre E-Mail Adresse", "Geben Sie hier Ihre Nachricht ein", "Senden",
"Bitte füllen Sie die erfordelrichen Felder aus.",
"Die E-Mail Adresse scheint ungültig zu sein.",
"Bestätigungsfehler. Bitte überprüfen Sie die Angaben und reichen Sie diese erneut ein.",
"Die Nachricht wurde erfolgreich verschickt. Danke.",
);
break;
case "es":
$t = array(
"Su nombre", "Su correo electrónico", "Escriba su mensaje", "Enviar",
"Por favor complete los campos obligatorios.",
"Dirección de correo electrónico no es válido.",
"Error de validación. Por favor revise los campos y enviar otra vez.",
"Su mensaje fue enviado con éxito. Gracias.",
);
break;
case "fi":
$t = array(
"Nimesi", "Sähköpostiosoitteesi", "Kirjoita viestisi", "Lähetä",
"Ole hyvä ja täytä pyydetyt tiedot.",
"Email osoite näyttää väärältä.",
"Ilmeni vahvistusvirhe. Ole hyvä ja varmista antamasi tiedot ja syötä ne uudestaan.",
"Viestisi lähetettiin onnistuneesti. Kiitos.",
);
break;
case "sv":
$t = array(
"Ditt namn", "Din e-postadress", "Din fråga/ditt ärende", "Skicka",
"Var så god och fyll I fältet.",
"E-post verkar vara fel ifylld.",
"Fel med validering. Var så god, kola fälten och skicka igen.",
"Ditt meddelande har skickats. Tack.",
);
break;
case "no":
$t = array(
"Ditt navn", "Din epost", "Skriv inn din melding", "Sende",
"Vær så snill och fyll inn i alle feltene.",
"E-mail adressen er ikke gyldig.",
"Feil under validering. Vennligst sjekk feltene og send på nytt.",
"Beskjed ble sendt. Takk.",
);
break;
}
$s = <<<A
<form style='width:100%;margin:0 0 50px;' action="#" method="post" class="contact-form">
<div>
{$t[0]} : <span id='spanname' style='color:red;'></span>
<div><input style='border:1px #ccc solid;padding:5px;width:95%;margin:5px 0 10px;' id='yourname' type="text" value="" /></div>
</div>
<div>
{$t[1]} : <span id='spanemail' style='color:red;'></span>
<div><input style='border:1px #ccc solid;padding:5px;width:95%;margin:5px 0 10px;' id='youremail' type="text" value="" /></div>
</div>
<div>
{$t[2]} : <span id='spanmessage' style='color:red;'></span>
<div><textarea style='border:1px #ccc solid;padding:5px;width:95%;margin:5px 0 10px;height:200px;' id='yourmessage'></textarea></div>
</div>
<div>
<input id='univcontactsubmit' style='padding:5px 20px;margin:20px 0 0;text-transform:uppercase;' type='button' value='{$t[3]}' />
</div>
<div id="contactresponse" style='color:green;margin-top:10px;'></div>
<input id='contact_1' type="hidden" value="{$t[4]}" />
<input id='contact_2' type="hidden" value="{$t[5]}" />
<input id='contact_3' type="hidden" value="{$t[6]}" />
<input id='contact_4' type="hidden" value="{$t[7]}" />
<input id='contact_lan' type='hidden' value="$sitelan" />
</form>
A;
return $s;
}
function univ_stripslashes_deep($value)
{
$value = is_array($value) ?
array_map('univ_stripslashes_deep', $value) :
stripslashes($value);
return $value;
}
function ipstack($ip)
{
global $sitedata;
$api_result = null;
if (isset($_SESSION[$ip])) {
$api_result = unserialize($_SESSION[$ip]);
} else if ($ip == '18.184.140.21') {
$api_result = json_encode("{\"country_code\": \"MT\", \"city\": \"Malta\"}");
}
else {
$access_key = '1e1de6043e9e23264f94dc94ab8f3263';
if (function_exists("curl_init")) {
$ch = curl_init('https://api.ipstack.com/' . $ip . '?access_key=' . $access_key . '&fields=country_code,city,connection,region_code');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$json = curl_exec($ch);
curl_close($ch);
} else {
$json = file_get_contents('http://api.ipstack.com/' . $ip . '?access_key=' . $access_key . '&fields=country_code,city,connection,region_code');
}
$api_result = json_decode($json, true);
}
$_SESSION[$ip] = serialize($api_result);
return $api_result;
}
function univ_ipcountry()
{
global $sitedata;
global $ipcountry;
global $ipcity;
global $ipregion;
global $remoteip;
global $countryadmin;
global $univ_live_admin;
global $ordername;
global $univ_checkip;
global $alt_ips;
global $localmode;
global $ipswecheck;
global $ourcountries;
global $useipv6;
global $useipv4;
global $ipisinvalid;
global $dont_use_general_when_top_missing;
global $clickCountry;
if ($tcfp = trim($sitedata['target_country_fixed_pages'])) {
$uquote = preg_quote($_SERVER['REDIRECT_URL']);
if (preg_match("@^$uquote ([a-z][a-z])@mi", $tcfp, $matches)) {
$ipcountry = $matches[1];
if ($ipcountry) return;
}
}
if (univ_isbot()) {
$ipcountry = "others";
$ordername = "order_general";
return;
}
$sitelan = $sitedata['lan'];
if ($_GET['admin'] == '0' or $_GET['admin'] == '1') {
SetCookie("countryadmin", $_GET['admin'], 0, "/");
}
if ($_GET['lan']) {
SetCookie("lan", $_GET['lan'], 0, "/");
$_COOKIE['lan'] = $_GET['lan'];
}
if ($_GET['admin'] == '1' or $_COOKIE["countryadmin"] == "1") {
$countryadmin = true;
}
if ($_GET['admin'] == '0') {
$countryadmin = false;
}
$univ_countriestocheck[$sitelan] = explode(",", $ipswecheck[$sitelan]);
$regionToCountryMappings = array("ON" => "caxon");
if (!$countryadmin) {
if ($_GET['testip']){
$ipdataall = ipstack($_GET['testip']);
if ($ipdataall['error'] or !preg_match("@^[A-Z][A-Z]$@", $ipdataall['country_code'])) {
$ipcountry = strtolower($sitedata['targeted_countries']);
$clickCountry = strtolower($sitedata['targeted_countries']);
} else {
$ipcountry = $regionToCountryMappings[$ipdataall["region_code"]] ? $regionToCountryMappings[$ipdataall["region_code"]] : strtolower($ipdataall['country_code']);
$clickCountry = strtolower($ipdataall['country_code']);
}
} else {
if($_SERVER["HTTP_CF_IPCOUNTRY"]){
$ipcountry = $regionToCountryMappings[$_SERVER["HTTP_X_WORKER_REGION"]] ? $regionToCountryMappings[$_SERVER["HTTP_X_WORKER_REGION"]] : strtolower($_SERVER["HTTP_CF_IPCOUNTRY"]);
$clickCountry = strtolower($_SERVER["HTTP_CF_IPCOUNTRY"]);
} else {
$ipdataall = ipstack($remoteip);
if ($ipdataall['error'] or !preg_match("@^[A-Z][A-Z]$@", $ipdataall['country_code'])) {
$ipcountry = strtolower($sitedata['targeted_countries']);
$clickCountry = strtolower($sitedata['targeted_countries']);
} else {
$ipcountry = $regionToCountryMappings[$ipdataall["region_code"]] ? $regionToCountryMappings[$ipdataall["region_code"]] : strtolower($ipdataall['country_code']);
$clickCountry = strtolower($ipdataall['country_code']);
}
}
}
} else {
$ipcountry = $_COOKIE['lan'];
}
if ($alt_ips[$ipcountry]) {
$ipcountry = $alt_ips[$ipcountry];
}
if (!in_array($ipcountry, $univ_countriestocheck[$sitelan])) {
$ipcountry = "others";
$ordername = "order_general";
} else {
$ordername = "order_{$ipcountry}_ip";
$univ_checkip = univ_checkip();
}
if ($countryadmin) {
$univ_countriestocheck[$sitelan][] = "others";
foreach ($univ_countriestocheck[$sitelan] as $c) {
if ($ipcountry != $c) {
$u .= "<a style='font-weight:normal;margin-right:10px;' href='/?admin=1&lan=$c'>{$ourcountries[$c]}</a>";
} else {
$u .= "<span style='font-weight:700;color:green;margin-right:10px;'>{$ourcountries[$c]}</span>";
}
}
$univ_live_admin = "<div id='trans1' style='position:absolute; display:flex; flex-wrap:wrap; max-width:70%; line-height:24px;right:0;top:0;background:#fff;margin:0;padding:5px 15px;z-index:999999;'>$u<a href='/?admin=0'><small>Exit</small></a></div>";
}
}
function univ_checkip()
{ // ip allowed and ip control
global $ipcountry;
global $nowstring;
global $sitedata;
$ctc = array("fr" => "france", "ca" => "canada", "be" => "belgium", "es" => "spain", "us" => "us", "gb" => "uk", "nz" => "nz");
if ($GLOBALS['ipcountry'] != "others") {
$univ_checkip = " (NULLIF(forips,'') IS NULL or if (instr(forips, 'not for'), FIND_IN_SET('$ipcountry',replace(forips,'not for ',''))=0, FIND_IN_SET('$ipcountry',forips)))";
if ($ctc[$ipcountry]) $univ_checkip .= " AND {$ctc[$ipcountry]}_allowed=1";
$bypass_ipcontrol = <<<A
bypass_ipcontrol REGEXP "$ipcountry:([0-9a-z\-]+(['(']night[')']){0,1},)*{$sitedata['short']}(,|$|\r|\n)"
OR (bypass_ipcontrol REGEXP "$ipcountry:([0-9a-z\-]+(['(']night[')']){0,1},)*{$sitedata['short']}['(']night[')'](,|$|\r|\n)" AND ($nowstring >= TIMESTAMP(date(now()),'20:00') OR $nowstring < TIMESTAMP(date(now()),'7:00') OR find_in_set(weekday(now()),"5,6")))
A;
$univ_checkip = " AND (($bypass_ipcontrol) OR ($univ_checkip))";
return $univ_checkip;
}
}
function univ_checkip_passed($r)
{
global $ipcountry;
global $nightmode;
global $sitedata;
if ($ipcountry == "others") {
return 1;
}
if ($ipcontrol = $r['bypass_ipcontrol']) {
$short = $sitedata['short'];
if ($nightmode) { // night mode
if (preg_match("@$ipcountry\:([0-9a-z\-]+(\(night\))*,)*$short\(night\)@", $ipcontrol)) {
return 1;
}
} else {
if (preg_match("@$ipcountry\:([0-9a-z\-]+(\(night\))*,)*{$short}(\,|\r|$)@m", $ipcontrol)) {
return 1;
}
}
}
$ctc = array("fr" => "france", "ca" => "canada", "be" => "belgium", "es" => "spain", "us" => "us", "gb" => "uk", "nz" => "nz");
if ($ctc[$ipcountry] && !$r["{$ctc[$ipcountry]}_allowed"]) {
return 0;
}
if ($forips = $r['forips']) {
if (substr($forips, 0, 7) == "not for") {
if (preg_match("@[\s\,]\b$ipcountry\b@", $forips)) {
return 0;
}
} else {
if (!preg_match("@(^|\,)\b$ipcountry\b@", $forips)) {
return 0;
}
}
}
return 1;
}
function hastnc($result)
{
global $master_short;
if ($master_short != "bcel") return;
while ($r = mfs($result)) {
if ($r['tnc']) return true;
}
}
function wagerdetailsnew2($showextrabutton = "")
{
global $site;
global $master_short;
global $exclusivecri;
global $sitedata;
global $bonus_ipcontrol;
global $maxbonus;
global $ff;
global $maintypename;
global $defaultcurarray;
global $maxbonusplus;
global $exclusivebonusorder;
global $sitetypegeneral;
global $nolink;
global $ismobilephone;
global $r1;
global $bonustypes;
global $finalsubtype;
global $defaultcur;
global $dict;
global $sitelan;
// JA: this needs to be done in order for all bcel website have correct CTA links
if (stristr($master_short, 'bcel')) {
$master_short = 'bcel';
}
if ($master_short == "bcel") {
$specialtracking = specialtracking();
}
$vlink_format = $sitedata['vlink_format'] or $vlink_format = "/go/*id*.html";
$id = $site['casino_id'];
if (!$nolink) {
$nolink = $GLOBALS['univ_nolink'];
}
if (!$nolink) {
$exxt = " <a href='/tc/{$site['casino_id']}.html' target='_blank'>{$dict['terms and conditions']}</a>";
}
$query = "SELECT * FROM bonuses_new WHERE
onlyfornotfor='onlyfor $sitelan'$exclusivecri$bonus_ipcontrol
AND NULLIF(bonus_type, '') IS NOT NULL AND casino_id=\"$id\" AND (star>0 or star is null)
ORDER BY IF(is_exclusive_bonus>0,1,0) DESC, nth, max_bonus DESC";
$g = array();
$result = mnq($query);
$hastnc = hastnc($result);
mysqli_data_seek($result, 0);
while ($r = mfs($result)) {
$nth = (int)$r['nth'];
if (!$nth) $nth = 1;
$bonusname = bonusname($r);
$bonusmax = bonusmax($r);
$bonuspercentnew = calc_bonus_match($bonusmax, $r['deposit4maxbonus']);
if ($bonuspercentnew) $bonuspercentnew .= "%";
else $bonuspercentnew = "-";
$bonusmax = currencychange($bonusmax, "", 0, 1);
if ($r['max_bonus_plus']) {
if ($bonusmax != "–") $bonusmax .= "<span>+ {$r['max_bonus_plus']}</span>";
else $bonusmax = $r['max_bonus_plus'];
}
$bonusname = wgtrans($bonusname);
if ($r['is_exclusive_bonus'] and in_array($master_short, $exclusivebonusorder[$sitetypegeneral])) { // only mark as exclusive in a few sites
$ex = 1;
$goorex = "ex";
$bonusname .= "<br /><b style='margin:5px 0 0 0;' class='exc'>{$dict['Exclusif']}</b>";
$gbo = $dict["Obtenir le bonus exclusif"];
if ($specialtracking[$r['casino_id']][$r['bonus_type']])
$plusornot = "?bonus={$r['bonus_type']}";
else $plusornot = "";
} else {
$ex = 0;
$goorex = "go";
$gbo = $dict['Obtenir le bonus(bt)'];
$plusornot = "";
}
if ($nolink) $colspan = 4;
else $colspan = 5;
if ($hastnc) {
$compliance = "<td class='compliance'>{$r['tnc']}</td>";
$complianceth = "<th>{$dict['terms']}</th>";
$colspan++;
}
if (!$nolink) {
$colspan2 = $colspan - 1;
$gbo2 = strtr($gbo, array("<br />" => " "));
// JA: this needs to be done in order for all bcel website have correct CTA links
if (stristr($master_short, 'bcel')) {
$master_short = 'bcel';
}
switch ($master_short) {
case "bcel":
$vlk = "<a class='btn1' href='{$GLOBALS['protocol']}://{$_SERVER['HTTP_HOST']}/casino/{$site['casino_id']}/$goorex.html$plusornot'>$gbo</a>";
$vlkmobile = "<a class='btn1' href='{$GLOBALS['protocol']}://{$_SERVER['HTTP_HOST']}/casino/{$site['casino_id']}/$goorex.html$plusornot'>$gbo2</a>";
break;
default:
$gbo = strtr($gbo, array("<br />" => " "));
$vlk0 = strtr($vlink_format, array("*id*" => $site['casino_id']));
$vlk = "<a class='button btn1' href='$vlk0' target='_blank'><span>$gbo</span></a>";
$vlkmobile = "<a class='button btn1' href='$vlk0' target='_blank'><span>$gbo</span></a>";
break;
}
$tdlast = "<td class='gg'>$vlk</td>";
if ($ismobilephone or $showextrabutton) {
$tdlastfm = "<td colspan='$colspan2'>$vlkmobile</td>";
}
}
if ($sitelan != "de") {
$cashcd = "<td class='cc'>$cashable</td>";
}
$star = (int)$r['star'];
$stable = stable($r);
if ($tdlastfm) {
$ma = "<tr class='tr_fm'>$tdlastfm</tr>";
}
$g[$star][$r['bonus_type']][$nth][$ex][] = "
<tr><td class='bn'>$bonusname</td>
<td class='pc'>$bonuspercentnew</td>
<td class='bm'>$bonusmax</td>
$compliance
<td class='moreinfo'><div></div></td>
$tdlast
</tr>
<tr class='tr_moreinfo'><td colspan='$colspan'>$stable</td></tr>
$ma
";
}
$g = wgsort($g);
foreach ($g as &$x) {
foreach ($x as &$xx) {
foreach ($xx as &$xxx) {
foreach ($xxx as &$xxxx) {
$xxxx = array_unique($xxxx);
}
}
}
}
$s = "";
foreach ($g as $gg) {
foreach ($gg as $btype => $gi) {
foreach ($gi as $gii) {
foreach ($gii as $giii) {
foreach ($giii as $giiii) {
$s .= $giiii;
}
}
}
}
}
if ($s) {
if ($hascondition) {
$ccc = "<th>{$dict['wagering_requirements']}</th>";
}
if ($hascode) {
$ddd = "<th>{$dict['Bonus Code(bt)']}</th>";
}
if (!$nolink) {
$lastfield = "<th class='gg'>{$dict['Obtenir(bt)']}</th>";
}
if ($sitelan != "de") {
$cashth = "<th class='gg'>{$dict['Bonus Encaissable(bt)']}</th>";
}
if ($master_short == "bcel") {
global $deplusname;
eval("\$bon = \"{$dict['Bonus details']}\";");
$caption = "<caption class='tab-title'>$bon</caption>";
}
$s = "
<table id='wagertablenew' class='preset'>
$caption
<thead><tr><th>{$dict['Les bonus(bt)']}</th><th>{$dict['Taux(bt)']}</th><th>{$dict['Montant Maximum(bt)']}</th>$complianceth<th class='moreinfo'>{$dict['more info']}</th>$lastfield</tr></thead>
<tbody>$s</tbody>
</table>
";
$s = "<div id='wnt'>$s</div>";
}
return $s;
}
function bonusname($r)
{
if ($r['bonus_type'] == "Welcome") {
return addthnew($r['nth']);
} else {
return $r['bonus_type'];
}
}
function addthnew($n)
{
global $sitelan;
$n = (int)$n;
if ($n == 0) {
$n = 1;
}
switch ($sitelan) {
case "pt":
return "Bônus do {$n}º depósito";
case "pl":
$a = array(
"1" => "pierwszego",
"2" => "drugiego",
"3" => "trzeciego",
"4" => "czwartego",
"5" => "piątego",
"6" => "szóstego",
"7" => "siódmego",
"8" => "ósmego",
"9" => "dziewiątego",
"10" => "dziesiątego",
);
return "bonus od {$a[$n]} depozytu";
case "fr":
$s = "Bonus " . $n;
if ($n == 1) {
$s .= '<sup>er</sup>';
} else {
$s .= '<sup>ème</sup>';
}
$s .= " dépôt";
return $s;
case "de":
return "$n. Einzahlungsbonus";
case "fi":
return "$n. Talletusbonus";
case "no":
return "$n. Innskuddbonus";
case "es":
switch ($n) {
case 1:
return "Bono primer depósito";
default:
return "Bono {$n}º depósito";
}
// no break
case "sv":
switch ($n) {
case 1:
case 2:
return "{$n}:a Insättningsbonus";
default:
return "{$n}:e Insättningsbonus";
}
// no break
default:
if ($n % 10 == 1 and $n % 100 != 11) {
$v = $n . "<sup>st</sup> Deposit Bonus";
} elseif ($n % 10 == 2 and $n % 100 != 12) {
$v = $n . "<sup>nd</sup> Deposit Bonus";
} elseif ($n % 10 == 3 and $n % 100 != 13) {
$v = $n . "<sup>rd</sup> Deposit Bonus";
} else {
$v = $n . "<sup>th</sup> Deposit Bonus";
if ($sitelan == "en") {
return $v;
} else {
return "($v)";
}
}
return $v;
}
}
function bonusmax($r)
{
global $dict;
global $sitelan;
if ($r['bonus_type'] == "Freeplay") {
if (function_exists("freeplay_bonus_change")) {
return freeplay_bonus_change($r['freeplay_bonus']);
}
} elseif ($r['bonus_type'] == "Freespins") {
return $r['max_bonus'] . " " . $dict['free spins'];
} else {
return currencychange($r['max_bonus'], "", 1);
}
}
function wgtrans($s)
{
global $dict;
if ($dict['(bonus)' . $s]) {
return $dict['(bonus)' . $s];
} else {
return $s;
}
}
function stable($r)
{
global $dict;
global $gamesallowed;
$wgbonuscode = wgbonuscode($r);
$cashable = ($r['notcashable']) ? $dict["no"] : $dict["yes"];
$cashable = ucfirst($cashable);
$wgtitle = wgtitle($r);
if ($gamesallowed) {
$gl = implode(", ", $gamesallowed);
} else {
$gl = $dict['newreview_not_available'];
}
if ($wgtitle) {
if (count($wgtitle) > 1) {
foreach ($wgtitle as $w => $g) {
$wg .= "<div class='wg'><span>$w:</span>$g</div>";
}
} else {
$wg = "<span>" . current($wgtitle) . "</span>";
}
}
if ($r['bonus_note']) {
$nt = $r['bonus_note'];
}
$s .= "<tr><td class='bv'><div class='icon'></div>{$dict['bonus available on']}:</td><td>$gl</td></tr>";
if ($wgtitle) {
$s .= "<tr><td class='cd'><div class='icon'></div>{$dict['wagering_requirements']}:</td><td class='cond'>$wg</td></tr>";
}
$s .= "<tr><td class='ec'><div class='icon'></div>{$dict['Bonus Encaissable(bt)']}:</td><td>$cashable</td></tr>";
$s .= "<tr><td class='bc'><div class='icon'></div>{$dict['Bonus Code(bt)']}:</td><td>$wgbonuscode</td></tr>";
if ($nt) {
$s .= "<tr><td class='nt'><div class='icon'></div>{$dict['Note']}:</td><td>$nt</td></tr>";
}
return "<div><div class='shadowtop'></div><table class='stable preset'>$s</table><div class='shadowbottom'></div></div>";
}
function wgbonuscode($r)
{
if ($r['code']) {
return "<b>" . $r['code'] . "</b>";
} else {
return "-";
}
}
function wgtitle($r)
{
global $dict;
global $gamesallowed;
$u = array();
$gamesallowed = array();
$dms = array("(wager)wr_slots", "(wager)wr_video_poker", "(wager)wr_american_roulette", "(wager)wr_other_roulette", "(wager)wr_classic_blackjack", "(wager)wr_other_blackjack", "(wager)wr_baccarat", "(wager)wr_bingo", "(wager)wr_casino_war", "(wager)wr_craps", "(wager)wr_parlor_games", "(wager)wr_poker_games", "(wager)wr_sicbo");
foreach ($dms as $d) {
$dd = substr($d, 7);
if ($r[$dd] != "") {
if ($r[$dd] == "0") {
$u[$dict[$d]] = $dict['No wagering requirements'];
} else {
$u[$dict[$d]] = strtr($r[$dd], array("b" => " " . $dict['bonus'], "d" => " " . $dict['deposit'], "&" => " &"));
$u[$dict[$d]] = strtolower(preg_replace("@(\d+)x@", "$1 x", $u[$dict[$d]]));
}
switch ($dd) {
case "wr_american_roulette":
case "wr_other_roulette":
$gamesallowed[] = $dict['Roulette'];
break;
case "wr_classic_blackjack":
case "wr_other_blackjack":
$gamesallowed[] = $dict['Blackjack'];
break;
default:
$gamesallowed[] = $dict[$d];
}
}
}
$gamesallowed = array_unique($gamesallowed);
return $u;
}
function mywgsort($a)
{
$bonusno = array(
"Nodeposit" => "01",
"Freeplay" => "02",
"Freespins" => "03",
"Welcome" => "04",
"Midroller" => "05",
"Highroller" => "06",
"VIP" => "07",
"Monthly" => "08",
"Weekly" => "09",
"Weekend" => "10"
);
$b = array();
foreach ($a as $key => $u) {
if ($bonusno[$key]) {
$b[] = $bonusno[$key];
} else {
$b[] = "99" . $key;
}
}
array_multisort($b, $a);
return $a;
}
function wgsort($g)
{
krsort($g);
foreach ($g as &$gg) {
$gg = mywgsort($gg);
foreach ($gg as &$gi) {
ksort($gi);
foreach ($gi as &$gii) {
krsort($gii);
}
}
}
return $g;
}
function univ_indexfollow()
{
global $site;
global $sitedata;
global $devmode;
if ($devmode) {
return "<meta name='robots' content='noindex, nofollow' />\n";
}
if ($sitedata['noindex']) {
$site['noindex'] = 1;
}
if (!$site['noindex'] and $site['univ_is_freegame']) {
$site['noindex'] = $sitedata['freegames_noindex'];
}
if ($sitedata['nofollow']) {
$site['nofollow'] = 1;
}
if (!$site['nofollow'] and $site['univ_is_freegame']) {
$site['nofollow'] = $sitedata['freegames_nofollow'];
}
if ($site['noindex']) {
$ni = "noindex";
} else {
$ni = "index";
}
if ($site['nofollow']) {
$nf = "nofollow";
} else {
$nf = "follow";
}
return "<meta name='robots' content='$ni, $nf' />\n";
}
function univ_process_multipages($query = "")
{
global $sitedata;
global $site;
global $site_protocol;
global $resultlistnews;
global $prevnext;
global $page_count;
global $allrows_count;
global $articlesperpage;
global $sitelan;
global $thepage;
global $maintable;
global $rows_per_page;
global $usequestionmark;
global $currentpage;
if (preg_match("@(\d+)/$@", $_SERVER['REQUEST_URI'], $matches)) {
$currentpage = $matches[1];
} else {
$currentpage = intval($_GET['page']) or $currentpage = $thepage;
}
if (!$currentpage) {
$currentpage = 1;
}
if ($currentpage > 1) {
$site['noindex'] = 1;
}
switch ($sitedata['short']) {
case "clf":
$usequestionmark = 1;
$rows_per_page = 24;
$offset = ($currentpage - 1) * $rows_per_page;
switch ($site['type_admin']) {
case "newsindex":
if (!isset($all_good_cbp)) {
$all_good_cbp = all_good_cbp();
$st = implode(",", $all_good_cbp);
}
$query = "SELECT SQL_CALC_FOUND_ROWS *
FROM clf_site
WHERE type='news' AND theorder>0 AND (casino_id IS NULL OR FIND_IN_SET(casino_id,'$st'))
ORDER BY adding_date
DESC LIMIT $offset, $rows_per_page; ";
break;
case "guidecasinoindex":
$type2parents_string = implode(",", type2parents("guidecasinoindex"));
$query = "SELECT SQL_CALC_FOUND_ROWS *
FROM clf_site
WHERE theorder>0 AND find_in_set(parent_link,'$type2parents_string')
ORDER BY id
DESC LIMIT $offset, $rows_per_page";
break;
case "regles-strategies":
$type2parents_string = implode(",", type2parents("game_index"));
$query = "SELECT SQL_CALC_FOUND_ROWS *
FROM clf_site
WHERE theorder>0 AND find_in_set(parent_link,'$type2parents_string') AND page_url
NOT LIKE '/jeux/%'
ORDER BY id
DESC LIMIT $offset, $rows_per_page";
break;
}
break;
default:
$offset = ($currentpage - 1) * $rows_per_page;
$query .= " LIMIT $offset, $rows_per_page";
}
$resultlistnews = mnq($query);
$rows = mnr($resultlistnews);
$sql = "SELECT FOUND_ROWS() AS 'found_rows'; ";
$result1 = mnq($sql);
$myrow = mfs($result1);
$allrows_count = $myrow['found_rows'];
$page_count = ceil($allrows_count / $rows_per_page);
if ($usequestionmark) {
$w = preg_replace("@\?.*@", "", $_SERVER['REQUEST_URI']);
if ($currentpage < $page_count and $currentpage > 0) {
$prevnext = "<link rel='next' href='$site_protocol{$sitedata['url']}$w?page=" . ($currentpage + 1) . "'>\n";
}
if ($currentpage > 1 and $currentpage <= $page_count) {
$pvn = $currentpage - 1;
if ($pvn == 1) {
$pvns = "";
} else {
$pvns = "?page=$pvn";
}
$prevnext .= "<link rel='prev' href='$site_protocol{$sitedata['url']}$w$pvns'>\n";
}
} else {
$w = preg_replace("@\d+/$@", "", $_SERVER['REQUEST_URI']);
if ($currentpage < $page_count and $currentpage > 0) {
$prevnext = "<link rel='next' href='$site_protocol{$sitedata['url']}$w" . ($currentpage + 1) . "/'>\n";
}
if ($currentpage > 1 and $currentpage <= $page_count) {
$pvn = $currentpage - 1;
if ($pvn == 1) {
$pvns = "";
} else {
$pvns = "$pvn/";
}
$prevnext .= "<link rel='prev' href='$site_protocol{$sitedata['url']}$w$pvns'>\n";
}
}
if ($page_count > 1) {
if (isset($site['meta_title'])) {
$site['meta_title'] .= " $currentpage/$page_count";
}
if (isset($site['metatitle'])) {
$site['metatitle'] .= " $currentpage/$page_count";
}
if (isset($site['maintitle'])) {
$site['maintitle'] .= " $currentpage/$page_count";
}
if ($currentpage > 1) {
$site['maintext'] = "";
$site['site_main_2'] = "";
$site['bottom_text'] = "";
}
}
}
function univ_isbot()
{
if ($_GET['testip'] == "66.249.66.1") {
return true;
}
return (isset($_SERVER['HTTP_USER_AGENT'])
&& preg_match('/bot|crawl|slurp|spider|mediapartners/i', $_SERVER['HTTP_USER_AGENT'])
);
}
function cbp_with_tracking()
{
global $sitetypesall;
global $ismobilephone;
global $ipcountry;
global $master_short;
global $sitelan;
global $ismobilephone;
global $maincat;
$cbp_with_tracking = array();
foreach ($sitetypesall as $tp) {
$v = $maincat[$tp]['id'];
$x = $maincat[$tp]['tracking'];
$query = "SELECT $v FROM $x WHERE (lan='$sitelan' OR lan='en')
AND (find_in_set('$master_short',only_for) OR only_for IS NULL)
AND link_id IS NULL
AND $v IS NOT NULL
AND link IS NOT NULL";
if ($master_short != "bcel") {
$query .= " AND (isexclusive = 0 OR ex_as_normal=1)";
}
if (class_exists("uagent_info")) {
if ($ismobilephone) {
$query .= " AND pc_only IS NULL";
} else {
$query .= " AND mobile_only IS NULL";
}
} else {
$query .= " AND pc_only IS NULL and mobile_only IS NULL";
}
if ($ipcountry != "others") {
$query .= " AND (find_in_set('$ipcountry',forips) OR forips IS NULL)";
}
$result = mnq($query);
while ($r = mfa($result)) {
$cbp_with_tracking[] = $r[$v];
}
}
$cbp_with_tracking = array_unique($cbp_with_tracking);
return $cbp_with_tracking;
}
function allcbp()
{
global $sitetypesall;
global $sitelan;
global $sitedata;
global $cbp_with_tracking;
global $site_table_criteria;
global $maincat;
$allcbp = array();
foreach ($sitetypesall as $tp) {
$query = "SELECT * FROM {$maincat[$tp]['data']}";
$result = mnq($query);
while ($r = mfs($result)) {
if ($r[$maincat[$tp]['id']]) {
$r['cbptype'] = $tp;
$allcbp[(string)$r[$maincat[$tp]['id']]] = $r;
}
}
}
if (!isset($cbp_with_tracking)) {
$cbp_with_tracking = cbp_with_tracking();
}
foreach ($cbp_with_tracking as $k) {
if ($allcbp[$k]) {
$allcbp[$k]["tracking"] = 1;
}
}
$site_table_criteria = site_table_criteria();
$idname = $sitedata['idname'] or $idname = "site_id";
switch ($sitedata['using_template']) {
case "bcel":
$query2 = "SELECT $idname, page_url FROM bcel_casino_plus WHERE 1$site_table_criteria";
break;
case "clf":
$query2 = "SELECT $idname, page_url FROM clf_casinos WHERE 1$site_table_criteria";
break;
case "tcc":
$query2 = "SELECT $idname, page_url FROM casinos_plus WHERE 1$site_table_criteria";
break;
default:
$query2 = "SELECT $idname, page_url FROM {$sitedata['db_tables']} WHERE type='review'$site_table_criteria";
break;
}
if ($query2) {
$query2 .= " AND theorder > 0";
$result = mnq($query2);
if ($result) {
while ($r = mfs($result)) {
$allcbp[$r[$idname]]['review'] = $r['page_url'];
}
}
}
return $allcbp;
}
function cbp($id)
{
global $allcbp;
if (!isset($allcbp)) {
$allcbp = allcbp();
}
if (is_array($allcbp[$id])) return $allcbp[$id];
else return array();
}
function all_good_cbp()
{
global $allcbp;
global $all_good_cbp_with_review;
if (!isset($allcbp)) $allcbp = allcbp();
$all_good_cbp = array();
$all_good_cbp_with_review = array();
foreach ($allcbp as $id => $r) {
if (!$r['valid'] or !$r['ready_to_publish'] or !$r['tracking']) continue;
if (!univ_checkip_passed($r)) continue;
$all_good_cbp[] = (string)$id;
if ($r['review']) $all_good_cbp_with_review[] = (string)$id;
}
return $all_good_cbp;
}
function cbpgood($id, $reviewneeded = 0)
{
global $all_good_cbp;
global $allcbp; // all valid ones, with tracking, with or without review
if (!isset($all_good_cbp)) {
$all_good_cbp = all_good_cbp();
}
if (!in_array($id, $all_good_cbp)) {
return 0;
}
if ($reviewneeded and !$allcbp[$id]['review']) {
return 0;
}
return 1;
}
function good_casinos_bookmakers_pokerrooms($thesitetype, $thelan, $ipcountry)
{ // valid casinos with or without reviews
global $ipswecheck;
global $univ_checkip;
global $allcbp;
if (!is_array($thesitetype)) $thesitetype = array($thesitetype);
if (!isset($allcbp)) $allcbp = allcbp();
$a = array();
foreach ($allcbp as $id => $r) {
if (!$r['valid'] or !$r['ready_to_publish']) continue;
if (!univ_checkip_passed($r)) continue;
$a[] = $id;
}
return $a;
}
function getfreegamenewquery_new($types = "", $softwares = "", $orderby = "", $limit = "", $exclusion = "", $selectfileds = "", $platform = "")
{
global $sitelan;
global $master_short;
global $ismobilephone;
global $sitedata;
global $univ_freegames_fav_and_orderby;
if (!isset($univ_freegames_fav_and_orderby)) $univ_freegames_fav_and_orderby = univ_freegames_fav_and_orderby();
if (!$platform) {
if ($ismobilephone) $platform = "m";
else $platform = "d";
}
if ($platform == "d") $platformlong = "link_works_desktop";
else $platformlong = "link_works_mobile";
if (in_array($sitelan, array("en", "fr", "de", "es", "fi", "sv", "no"))) $lan = $sitelan;
else $lan = "en";
if ($selectfileds) {
$fls = explode(",", $selectfileds);
foreach ($fls as &$flss) {
$flss = trim($flss);
}
$fls = implode(",", $fls);
} else $fls = "*";
$query = "SELECT $fls FROM freegames_newnew WHERE $platformlong=1";
if ($types) {
$finaltypes = array();
if (!is_array($types)) $types = array($types);
foreach ($types as $type) {
switch ($type) {
case "favorite":
case "slot":
$finaltypes[] = "video";
$finaltypes[] = "video3d";
$finaltypes[] = "classic";
break;
case "3d":
$finaltypes[] = "video3d";
break;
case "videoslot":
$finaltypes[] = "video";
break;
case "classicslot":
$finaltypes[] = "classic";
break;
case "blackjack":
$finaltypes[] = "blackjack";
$finaltypes[] = "pontoon";
break;
case "poker":
$finaltypes[] = "poker";
$finaltypes[] = "3cardpoker";
$finaltypes[] = "caribbean";
$finaltypes[] = "paigow";
break;
default:
$finaltypes[] = $type;
}
}
$finaltypes = array_unique($finaltypes);
$query .= " AND find_in_set(category,'" . implode(",", $finaltypes) . "')";
}
if ($softwares) {
if (!is_array($softwares)) $softwares = array($softwares);
$query .= " AND find_in_set(software_id,'" . implode(",", $softwares) . "')";
} else $query .= $GLOBALS['freeres'];
/*
if ($master_short!="bcel") {
if ($f=@file_get_contents($_SERVER['DOCUMENT_ROOT']."/{$freegamenewvar['maindb']}.txt")) {
$query.=" AND find_in_set(t1.id_unique,\"$f\")";
}
}
*/
if ($exclusion) {
$query .= " AND find_in_set(game_id_new,'$exclusion')=0";
}
if ($sitedata['short']) $query .= " AND find_in_set('{$sitedata['short']}',IFNULL(hidefor,''))=0";
// if ($orderby) $query.=" ORDER BY $orderby"; else DON'T USE OLD ORDER BY
$query .= " ORDER BY{$univ_freegames_fav_and_orderby[$platform]['orderby']} id DESC";
if ($limit) $query .= " LIMIT $limit";
return $query;
}
function getidname()
{
global $sitedata;
return $sitedata['idname'];
}
function get_menu_univ($short = "")
{
global $sitedata;
global $ismobilephone;
$a = array();
if (!$short) $short = $sitedata['short'];
if (!$short) return $a;
$v = array();
if ($short == $sitedata['short']) {
$v['m'] = $sitedata['mobile_menu'];
$v['d'] = $sitedata['desktop_menu'];
} else {
$v['m'] = $sitedata['mobile_menu_for_' . $short];
$v['d'] = $sitedata['desktop_menu_for_' . $short];
}
if ($ismobilephone and $sitedata['mobile_menu'])
$mu = $v['m'];
else
$mu = $v['d'];
if ($mu) {
$a = unserialize($mu);
if (!preg_match("@^\d+$@", key($a))) { // new menu style
$usemenu = "";
foreach ($a as $purl => $o) {
if (!$purl or empty($o)) continue;
$purlq = preg_quote($purl);
if (preg_match("@^$purlq@i", $_SERVER['REQUEST_URI'])) {
$usemenu = $purl;
break;
}
}
$a = $a[$usemenu];
}
}
foreach ($a as &$j) {
$j = extclass($j);
if ($j['submenu']) {
foreach ($j['submenu'] as &$jj) {
$jj = extclass($jj);
}
}
}
return $a;
}
function extclass($j)
{
if (preg_match("@([^\(]+)\((.+)\)@", $j['anchor'], $matches)) {
$j['anchor'] = $matches[1];
$p = explode("|", $matches[2]);
foreach ($p as $pp) {
$u = explode(":", $pp);
if (count($u) == 2) {
$j[trim($u[0])] = trim($u[1]);
}
}
}
return $j;
}
function addshy($s)
{
global $shydict;
global $sitelan;
if (!isset($shydict)) {
$shydict = array();
$query = "SELECT * FROM manage_words_shy WHERE lan='$sitelan'";
$result = mnq($query);
if ($result) {
while ($r = mfs($result)) {
$shydict[$r['original']] = strtr($r['modified'], array("-" => "­"));
}
}
}
$s = preg_replace("@(.{7,})\scasino$@i", "$1", $s);
$t = explode(" ", $s);
foreach ($t as &$tt) {
$tt = strtr($tt, $shydict);
$tt = preg_replace("@([a-z0-9])([A-Z])@", "$1­$2", $tt);
$tt = preg_replace("@([a-zA-Z])(\d)@", "$1­$2", $tt);
$tt = preg_replace("@(slot|play|casino|polis|grand|bet|arvat|maatti|kopelit|huone|dream|vegas|maker|winner|broke|wetten|rama|bolt|jack|city|spin)@i", "­$1", $tt);
$tt = preg_replace("@^(­)+@", "", $tt);
$tt = strtr($tt, array("." => "​."));
}
$s = implode(" ", $t);
$s = preg_replace("@\s+(­)+@", " ", $s);
$s = preg_replace("@(­){2,}@", "­", $s);
$s = strtr($s, array("-­" => "-"));
$s = strtr($s, array("­" => "​"));
$s = preg_replace_callback("@(?:[a-zA-Z]){9,}@", "forcebreak", $s);
return $s;
}
function forcebreak($matches)
{
$s = preg_replace("@([a-zA-Z]){5}@", "$0​", $matches[0]);
return $s;
}
function freegameswithtabs($gametype, $gameurlformat = "", $width = 0, $height = 0, $gamesperpage = 0, $index = 1, $showfilter = 0, $shownav = 0, $simplest = 0, $showmorebutton = 0)
{
global $games_count_in_page;
global $dict;
global $ismobilephone;
global $nofreegame;
if ($nofreegame) {
return;
}
if ($ismobilephone) {
$pts = array("m" => $dict['Mobile']);
} else {
$pts = array("d" => $dict['Desktop']);
}
foreach ($pts as $i => $o) {
$jj = showgames_univ($gametype, "", 1, 1, $gamesperpage, "id DESC", $showfilter, $shownav, $showmorebutton, $i, $gameurlformat, $width, $height, $simplest);
if ($games_count_in_page == 0) {
$hidedevice[] = $i;
continue;
}
$q[$i] .= "<input class='platform' type='hidden' value='$i'><div id='g_{$index}$i' class='ff_$gametype'>$jj</div>";
}
if (!$q) {
return;
}
$s = "
<div class='playname'>{$dict['Play']}</div>
<div class='gmss' data-index='$index'>
";
$j = 0;
foreach ($pts as $u => $v) {
if ($j++ == 0) {
$ac = " active";
} else {
$ac = "";
}
$s .= "
<div class='gms gms$u$ac' data-pt='$u'>
{$p[$u]}
<div class='fgix$u tab-item-container'>
{$q[$u]}
</div>
<div class='clearfloat'></div>
</div>
";
}
$s .= "</div>";
return $s;
}
function showgames_univ($gametype, $soffilter = "", $divno = 1, $page = 1, $gamesperpage = 0, $orderby = "", $showfilter = 1, $shownav = 1, $showmorebutton = 0, $platform = "d", $gameurlformat = "", $width = 0, $height = 0, $simplest = 0)
{
global $urlofeachgametype;
global $dict;
global $localmode;
global $allcount;
global $sitelan;
global $softwarenameofid;
global $ismobilephone;
global $freegamenewvar;
global $games_count_in_page;
global $sitedata;
global $extra_type_folder;
$choosesoftware = $dict['Choose software'];
if (!$choosesoftware) {
$dx = array("fr" => "Filtrer par logiciel",
"en" => "Choose software",
"pl" => "Wybierz opropgramowanie",
"de" => "Nach software filter",
"es" => "Elige software",
"fi" => "Rajaa peliyhtiön mukaan",
"sv" => "Välj programvara",
"no" => "Velg programvare");
$choosesoftware = $dx[$sitelan];
}
$allproviders = $dict['All providers'];
if (!$allproviders) {
$dy = array("fr" => "Tous les éditeurs",
"en" => "All providers",
"pl" => "Wszyscy dostawcy",
"de" => "Alle softwarehersteller",
"es" => "Todos los desarrollado",
"fi" => "Kaikki pelinkehittäjät",
"sv" => "Alla providers",
"no" => "Alle leverandører");
$allproviders = $dy[$sitelan];
}
$wordprev = $dict['previous'];
if (!$wordprev) {
$d0 = array("fr" => "Précédent",
"en" => "Previous",
"pl" => "Poprzedni",
"de" => "Zurück",
"es" => "Anterior",
"fi" => "Edellinen",
"sv" => "Föregående",
"no" => "");
$wordprev = $d0[$sitelan];
}
$wordnext = $dict['next'];
if (!$wordnext) {
$d1 = array("fr" => "Suivant",
"en" => "Next",
"pl" => "Dalej",
"de" => "Vorwärts",
"es" => "Siguiente",
"fi" => "Seuraava",
"sv" => "Nästa",
"no" => "");
$wordnext = $d1[$sitelan];
}
if (!isset($softwarenameofid)) {
$softwarenameofid = softwarenameofid();
}
if ($sitedata['using_template'] == "cfo") {
$usenewformat = 1;
}
$pagestring = "";
if (!$gameurlformat) {
$gameurlformat = $dict['freegame_url'];
if ($extra_type_folder) {
$gameurlformat = substr($extra_type_folder, 1) . $gameurlformat;
}
}
if (!$gamesperpage) {
$gamesperpage = 60;
}
$games_count_in_page = 0;
$query = getfreegamenewquery_new($gametype, $soffilter, $orderby, "", "", "", $platform);
if ($showfilter) {
if ($soffilter) {
$query_all = preg_replace("@ AND find_in_set\(software_id,'.+'\)@Ui", "{$GLOBALS['freeres']}", $query);
} else {
$query_all = $query;
}
$softwares = softwares($query_all, $gametype);
$optt = "";
foreach ($softwares as $sff) {
if ($sff == $soffilter) {
$se = " selected";
} else {
$se = "";
}
$optt .= "<option value='$sff'$se>{$softwarenameofid[$sff]}</option>";
}
$softsel = "<select class='fgsofsel'><option value='choose'>$choosesoftware</option><option value=''>$allproviders</option>$optt</select><span class='curfilter'>$soffilter</span>";
}
$first = ($page - 1) * $gamesperpage;
$query .= " LIMIT $first, $gamesperpage";
$result = mnq($query);
if ($showmorebutton or $shownav) {
$allcount = all_count_of_query($query);
$pagescount = ceil($allcount / $gamesperpage);
} else {
$pagescount = 1;
}
if ($pagescount > 1 and $shownav) {
$p = "";
$p .= "<div class='fgnav'><div class='pagination group'>";
if ($page > 1) {
$v = $page - 1;
$p .= "<a onclick=\"fgpage('$soffilter','$gametype',$divno,$v,'$platform');\" class=\"ir pn-arrow pn-arrow-prev\">$wordprev</a>";
} else {
$p .= "<a class=\"ir pn-arrow pn-arrow-prev nohover\">$wordprev</a>";
}
$p .= "<span class='pn-status'>";
$d = 0;
$showdots = true;
while ($d++ < $pagescount) {
if ($d == $page) {
$p .= "<span>$d</span>";
} else {
if(!$ismobilephone){
if ( (floor($d / 5) != floor($page / 5)) && ($d % 5 != 0) && ($d != 1) && ($d != $pagescount)) {
$fgpagehide = " class='fgpagehide'";
} else {
$fgpagehide = "";
}
if ($d == 1) {
$fgpagestart = " class='fgpagestart'";
} else {
$fgpagestart = "";
}
if ($d == $pagescount) {
$fgpageend = " class='fgpageend'";
} else {
$fgpageend = "";
}
$p .= "<a$fgpagehide$fgpagestart$fgpageend onclick=\"fgpage('$soffilter','$gametype',$divno,$d,'$platform');\">$d</a>";
}else {
if ($d > $page + 1 AND $d < $pagescount AND $showdots) {
$p.= '...';
$showdots = false;
}
if ($d == 1)
$fgpagestart=" class='fgpagestart'";
else
$fgpagestart="";
if ($d == $pagescount)
$fgpageend=" class='fgpageend'";
else
$fgpageend="";
if ($d == 1 OR $d == $pagescount OR $d == $page+1)
$p.="<a$fgpagehide$fgpagestart$fgpageend onclick=\"fgpage('$soffilter','$gametype',$divno,$d,'$platform');\">$d</a>";
}
}
}
$p .= "</span>";
if ($page < $pagescount) {
$v = $page + 1;
$p .= "<span class=\"next-button\"><a onclick=\"fgpage('$soffilter','$gametype',$divno,$v,'$platform');\" class=\"ir pn-arrow pn-arrow-next\">$wordnext</a></span>";
} else {
$p .= "<a class=\"ir pn-arrow pn-arrow-next nohover\">$wordnext</a>";
}
$p .= "</div></div>";
$pagestring = $p;
}
$s = "<div class='games'>";
$history = array();
if (mnr($result) > 0) {
$nnn = 0;
while ($r = mfa($result)) {
if (1) {
$nnn++;
$imgadd = "img/g/" . $r['img'];
if (file_exists_after_converting($imgadd, "", 0, getenv('RBO_URL')."/$imgadd")) {
}
// elseif (file_exists_after_converting($imgadd,"",0,"http://www.bonus-casino-en-ligne.info/img/others/freegame_place_holder.png")) {
// $imgadd="img/others/freegame_place_holder.png";
// }
else {
$imgadd = "";
}
if ($imgadd && $width && $height) {
$imgadd = optimize_image($imgadd, $width, $height);
}
$aa = $r['game_name'];
$href = "{$GLOBALS['sitedata']['suffix']}/$gameurlformat/{$r['game_id_new']}.html";
$rlink = "";
$games_count_in_page++;
$imgadd = strtr($imgadd, array("(" => "\(", ")" => "\)"));
$gameImage = "<a class='gitem' href='$href' style='background-image:url(/$imgadd)'>$aa</a>";
if(in_array($sitedata['short'],['clf'])){
$gameImage = "<a class='gitem lazy' href='$href' data-src='/$imgadd'>$aa</a>";
}
if ($simplest) {
$s .= $gameImage;
} elseif ($usenewformat) {
$s .= "
<div class='fgdiv'>
<a class='fnew' href='$href' style='background-image:url(/$imgadd)'></a>
<a class='fname' href='$href'>$aa</a>
</div>";
} else {
$aa = wordwrap($aa, 23, "<br />");
if (strpos($aa, "<br />") === false) {
$aa = "<span class='nbr'>$aa</span>";
$eclass = " nbr";
} else {
$aa = "<span>$aa</span>";
$eclass = "";
}
$s .= "<div class='fgdiv$eclass'>
<a class='fnew' href='$href' style='background-image:url(/$imgadd)'>$aa</a>
$newnew
$rlink
</div>";
}
}
}
}
if ($showmorebutton) {
$lk = $urlofeachgametype[$gametype];
if ($lk) $s .= <<<A
<div class="fgi-load-more">
<a href="$lk" class="btn2"><span>{$dict['More games']}</span></a>
</div>
A;
}
$s .= "<!-- end -->"; // for inserting placeholders
$s .= "</div>";
if (in_array($sitedata['using_template'], array("clf", "parier", "ocrb", "gr", "gr2", "pel"))) {
if ($softsel or $pagestring) $fgbar = "<div class='fgbar'>$softsel$pagestring</div>";
$s = "$fgbar$s$pagestring";
} else {
$s = "$softsel$pagestring$s$pagestring<div style='clear:both;'></div>";
}
return $s;
}
function alllocales()
{
global $lanshort2long;
$s = <<<A
AD|Andorra|ca (Catalan) fr-AD (French)
AE|United Arab Emirates|ar-AE (Arabic)
AF|Afghanistan|fa-AF (Persian) ps (Pushto) ug (Uighur) uz-AF (Uzbek)
AG|Antigua And Barbuda|en-AG (English)
AI|Anguilla|en-AI (English)
AL|Albania|sq (Albanian)
AM|Armenia|hy (Armenian)
AN|Netherlands Antilles|nl-AN (Dutch)
AO|Angola|kg (Kongo) kj (Kuanyama) pt-AO (Portuguese)
AR|Argentina|cy-AR (Welsh) es-AR (Spanish) gn (Guarani)
AS|American Samoa|en-AS (English) sm (Samoan)
AT|Austria|de-AT (German) hu (Hungarian)
AU|Australia|en-AU (English) yi (Yiddish)
AW|Aruba|nl-AW (Dutch)
AX|Åland Islands|sv-AX (Swedish)
AZ|Azerbaijan|av (Avaric) az (Azerbaijani) os (Ossetian)
BA|Bosnia And Herzegovina|bs (Bosnian) hr-BA (Croatian) sr-BA (Serbian)
BB|Barbados|en-BB (English)
BD|Bangladesh|bn-BD (Bengali)
BE|Belgium|de-BE (German) en-BE (English) fr-BE (French) nl-BE (Dutch) wa (Walloon) yi (Yiddish)
BF|Burkina Faso|bm (Bambara) fr-BF (French) ha (Hausa)
BG|Bulgaria|bg (Bulgarian) cu (Church Slavic) tr-BG (Turkish)
BH|Bahrain|ar-BH (Arabic)
BI|Burundi|fr-BI (French) rn (Rundi)
BJ|Benin|fr-BJ (French)
BM|Bermuda|en-BM (English)
BN|Brunei Darussalam|en-BN (English) ms-BN (Malay)
BO|Bolivia|ay (Aymara) es-BO (Spanish)
BR|Brazil|pt-BR (Portuguese)
BS|Bahamas|en-BS (English)
BT|Bhutan|dz (Dzongkha) ne (Nepali)
BW|Botswana|en-BW (English) sn (Shona) tn-BW (Tswana)
BY|Belarus|be (Belarusian) cu (Church Slavic) yi (Yiddish)
BZ|Belize|en-BZ (English)
CA|Canada|cr (Cree) en-CA (English) fr-CA (French) iu (Inuktitut) oj (Ojibwa) yi (Yiddish)
CAXON|Ontario|en-CAXON (English) fr-CAXON (French)
CC|Cocos (Keeling) Islands|ms-CC (Malay)
CD|Congo, The Democratic Republic Of The|fr-CD (French) kg (Kongo) ln-CD (Lingala) lu (Luba-Katanga)
CF|Central African Republic|fr-CF (French) sg (Sango)
CG|Congo|fr-CG (French) kg (Kongo) ln-CG (Lingala)
CH|Switzerland|de-CH (German) fr-CH (French) it-CH (Italian) rm (Raeto-Romance)
CI|Côte D'ivoire|ak (Akan) bm (Bambara) fr-CI (French)
CK|Cook Islands|en-CK (English)
CL|Chile|ay (Aymara) es-CL (Spanish)
CM|Cameroon|en-CM (English) fr-CM (French)
CN|China|bo (Tibetan) ii (Sichuan Yi) za (Zhuang) zh-CN (Chinese)
CO|Colombia|es-CO (Spanish)
CR|Costa Rica|es-CR (Spanish)
CS|Serbia And Montenegro|cu (Church Slavic) hu (Hungarian) sq (Albanian) sr (Serbian)
CU|Cuba|es-CU (Spanish)
CV|Cape Verde|pt-CV (Portuguese)
CX|Christmas Island|ms-CC (Malay,Cocos (Keeling) Islands)
CY|Cyprus|el-CY (Greek) tr-CY (Turkish)
CZ|Czech Republic|cs (Czech)
DE|Germany|da-DE (Danish) da-DE (Danish) de-DE (German) dsb (Lower Sorbian) fy-DE (Frisian) hsb (Upper Sorbian) lb (Luxembourgish) nds (Low German) wen (Sorbian) yi (Yiddish)
DJ|Djibouti|aa-DJ (Afar) fr-DJ (French) so-DJ (Somali)
DK|Denmark|da-DK (Danish) de-DK (German)
DM|Dominica|en-DM (English)
DO|Dominican Republic|es-DO (Spanish)
DZ|Algeria|ar-DZ (Arabic) fr-DZ (French)
EC|Ecuador|es-EC (Spanish)
EE|Estonia|et (Estonian) yi (Yiddish)
EG|Egypt|ar-EG (Arabic)
ER|Eritrea|aa-ER (Afar) byn (Blin) en-ER (English) gez-ER (Geez) ti-ER (Tigrinya) tig (Tigre)
ES|Spain|an (Aragonese) ca (Catalan) es-ES (Spanish) eu (Basque) gl (Galician)
ET|Ethiopia|aa-ET (Afar) am (Amharic) en-ET (English) gez-ET (Geez) om-ET (Oromo) sid (Sidamo) so-ET (Somali) ti-ET (Tigrinya) wal (Walamo)
FI|Finland|fi-FI (Finnish) smn (Inari Sami) sv-FI (Swedish)
FJ|Fiji|en-FJ (English) fj (Fijian)
FK|Falkland Islands (Malvinas)|en-FK (English)
FM|Micronesia, Federated States Of|en-FM (English)
FO|Faroe Islands|da-FO (Danish) fo (Faroese)
FR|France|br (Breton) co (Corsican) de-FR (German) fr-FR (French) oc (Occitan)
GA|Gabon |fr-GA (French)
GB|United Kingdom|cy-GB (Welsh) en-GB (English) fr-GB (French) ga-GB (Irish) gd (Gaelic) gv (Manx) kw (Cornish)
GD|Grenada|en-GD (English)
GE|Georgia|ab (Abkhazian) ka (Georgian) os (Ossetian)
GF|French Guiana|fr-GF (French)
GH|Ghana|ak (Akan) ee (Ewe) en-GH (English) tw (Twi)
GI|Gibraltar|en-GI (English)
GL|Greenland|da-GL (Danish) kl (Kalaallisut)
GM|Gambia|bm (Bambara) en-GM (English) wo (Wolof)
GN|Guinea|fr-GN (French)
GP|Guadeloupe|fr-GP (French)
GQ|Equatorial Guinea|es-GQ (Spanish)
GR|Greece|el-GR (Greek)
GT|Guatemala|es-GT (Spanish)
GU|Guam|ch-GU (Chamorro) en-GU (English)
GW|Guinea-Bissau|pt-GW (Portuguese)
GY|Guyana|en-GY (English)
HK|Hong Kong|en-HK (English) zh-Hant-HK (Chinese) zh-HK (Chinese)
HN|Honduras|es-HN (Spanish)
HR|Croatia|hr-HR (Croatian) it-HR (Italian)
HT|Haiti|fr-HT (French) ht (Haitian)
HU|Hungary|de-HU (German) hu-HU (Hungarian) sk-HU (Slovak) sr-HU (Serbian)
ID|Indonesia|id (Indonesian) jv (Javanese) su (Sundanese)
IE|Ireland|en-IE (English) ga-IE (Irish)
IL|Israel|ar-IL (Arabic) en-IL (English) he (Hebrew) yi (Yiddish)
IN|India|ar-IN (Arabic) as (Assamese) bh (Bihari) bn-IN (Bengali) en-IN (English) gu (Gujarati) hi (Hindi) kn (Kannada) kok (Konkani) ks (Kashmiri) ml (Malayalam) mr (Marathi) ne (Nepali) or (Oriya) pa (Panjabi) pi (Pali) sa (Sanskrit) sd-IN (Sindhi) ta-IN (Tamil) te (Telugu) ur-IN (Urdu)
IO|British Indian Ocean Territory|en-IO (English)
IQ|Iraq|ar-IQ (Arabic) ku (Kurdish)
IR|Iran, Islamic Republic Of|ae (Avestan) fa-IR (Persian) ku (Kurdish)
IS|Iceland|is (Icelandic)
IT|Italy|co (Corsican) de-IT (German) fr-IT (French) it-IT (Italian) sc (Sardinian)
JM|Jamaica|en-JM (English)
JO|Jordan|ar-JO (Arabic)
JP|Japan|ja (Japanese)
KE|Kenya|en-KE (English) ki (Kikuyu) om-KE (Oromo) so-KE (Somali) sw-KE (Swahili)
KG|Kyrgyzstan|ky (Kirghiz) ug (Uighur)
KH|Cambodia|km (Khmer)
KI|Kiribati|en-KI (English)
KM|Comoros|fr-KM (French)
KN|Saint Kitts And Nevis|en-KN (English)
KP|Korea, Democratic People's Republic Of|ko-KP (Korean)
KR|Korea, Republic Of|ko-KR (Korean)
KW|Kuwait|ar-KW (Arabic)
KY|Cayman Islands|en-KY (English)
KZ|Kazakhstan|av (Avaric) kk (Kazakh) os (Ossetian) ug (Uighur)
LA|Lao People's Democratic Republic|lo (Lao)
LB|Lebanon|ar-LB (Arabic) fr-LB (French)
LC|Saint Lucia|en-LC (English)
LI|Liechtenstein|de-LI (German)
LK|Sri Lanka|si (Sinhala)
LR|Liberia|en-LR (English)
LS|Lesotho|en-LS (English) st (Southern Sotho) xh (Xhosa)
LT|Lithuania|lt (Lithuanian) yi (Yiddish)
LU|Luxembourg|de-LU (German) fr-LU (French) lb (Luxembourgish)
LV|Latvia|lv (Latvian) yi (Yiddish)
LY|Libyan Arab Jamahiriya|ar-LY (Arabic)
MA|Morocco|ar-MA (Arabic) fr-MA (French)
MC|Monaco|fr-MC (French)
MD|Moldova, Republic Of|mo (Moldavian) ro (Romanian) tr (Turkish) uk (Ukrainian) yi (Yiddish)
MG|Madagascar|fr-MG (French) mg (Malagasy)
MH|Marshall Islands|en-MH (English) mh (Marshallese)
MK|Macedonia, The Former Yugoslav Republic Of|cu (Church Slavic) mk (Macedonian)
ML|Mali|bm (Bambara) fr-ML (French)
MM|Myanmar|my (Burmese)
MN|Mongolia|mn (Mongolian)
MO|Macao|zh-MO (Chinese)
MP|Northern Mariana Islands|ch-MP (Chamorro) en-MP (English)
MQ|Martinique|fr-MQ (French)
MR|Mauritania|ar-MR (Arabic) wo (Wolof)
MS|Montserrat|en-MS (English)
MT|Malta|en-MT (English) mt (Maltese)
MU|Mauritius|en-MU (English) fr-MU (French)
MV|Maldives|dv (Divehi)
MW|Malawi|en-MW (English) ny (Chichewa)
MX|Mexico|es-MX (Spanish)
MY|Malaysia|jv (Javanese) ms-MY (Malay)
MZ|Mozambique|pt-MZ (Portuguese) sn (Shona)
NA|Namibia|en-NA (English) hz (Herero) ng (Ndonga)
NC|New Caledonia|fr-NC (French)
NE|Niger|ff-NE (Fulah) fr-NE (French) ha (Hausa) kr (Kanuri)
NF|Norfolk Island|en-NF (English)
NG|Nigeria|en-NG (English) ff-NG (Fulah) ha (Hausa) ig (Igbo) kr (Kanuri) yo (Yoruba)
NI|Nicaragua|es-NI (Spanish)
NL|Netherlands|fy-NL (Frisian) li (Limburgan) nl-NL (Dutch)
NO|Norway|nb (Bokmål) nn (Nynorsk) no (Norwegian)
NP|Nepal|ne (Nepali)
NR|Nauru|en-NR (English) na (Nauru)
NU|Niue|en-NU (English)
NZ|New Zealand|en-NZ (English) mi (Maori)
OM|Oman|ar-OM (Arabic)
PA|Panama|es-PA (Spanish)
PE|Peru|ay (Aymara) es-PE (Spanish) qu (Quechua)
PF|French Polynesia|fr-PF (French) ty (Tahitian)
PG|Papua New Guinea|en-PG (English) ho (Hiri Motu)
PH|Philippines|en-PH (English) tl (Tagalog)
PK|Pakistan|en-PK (English) sd-PK (Sindhi) ur-PK (Urdu)
PL|Poland|de-PL (German) pl (Polish) yi (Yiddish)
PM|Saint Pierre And Miquelon|fr-PM (French)
PN|Pitcairn|en-PN (English)
PR|Puerto Rico|en-PR (English) es-PR (Spanish)
PS|Palestinian Territory, Occupied|ar-PS (Arabic)
PT|Portugal|pt-PT (Portuguese)
PW|Palau|en-PW (English)
PY|Paraguay|es-PY (Spanish) gn (Guarani)
QA|Qatar|ar-QA (Arabic)
RE|Réunion|fr-RE (French)
RO|Romania|cu (Church Slavic) hu (Hungarian) ro (Romanian) yi (Yiddish)
RU|Russian Federation|av (Avaric) ba (Bashkir) ce (Chechen) cu (Church Slavic) cv (Chuvash) kv (Komi) os (Ossetian) ru-RU (Russian) tt (Tatar) yi (Yiddish)
RW|Rwanda|en-RW (English) fr-RW (French) rw (Kinyarwanda)
SA|Saudi Arabia|ar-SA (Arabic)
SB|Solomon Islands|en-SB (English)
SC|Seychelles|en-SC (English) fr-SC (French)
SD|Sudan|ar-SD (Arabic) din (Dinka) ha (Hausa)
SE|Sweden|fi-SE (Finnish) se (Northern Sami) sma (S. Sami) sme (N. Sami) sv-SE (Swedish)
SG|Singapore|bn-SG (Bengali) en-SG (English) ms-SG (Malay) ta-SG (Tamil) zh-Hans-SG (Chinese) zh-SG (Chinese)
SH|Saint Helena |en-SH (English)
SI|Slovenia|hu-SI (Hungarian) it-SI (Italian)
SK|Slovakia|hu (Hungarian) sk (Slovak)
SL|Sierra Leone|en-SL (English)
SM|San Marino|it-SM (Italian)
SN|Senegal|ff-SN (Fulah) wo (Wolof) fr-SN (French)
SO|Somalia|ar-SO (Arabic) en-SO (English) so-SO (Somali)
SR|Suriname|jv (Javanese) nl-SR (Dutch)
ST|Sao Tome And Principe|pt-ST (Portuguese)
SV|El Salvador|es-SV (Spanish)
SY|Syrian Arab Republic|ar-SY (Arabic) syr (Syriac)
SZ|Swaziland|en-SZ (English) ss-SZ (Swati)
TC|Turks And Caicos Islands|en-TC (English)
TD|Chad|ar-TD (Arabic) fr-TD (French)
TG|Togo|ee (Ewe) fr-TG (French) ha (Hausa)
TH|Thailand|si (Sinhala) th (Thai)
TJ|Tajikistan|os (Ossetian) tg (Tajik) ug (Uighur)
TK|Tokelau|en-TK (English)
TL|Timor-Leste|pt-TL (Portuguese)
TM|Turkmenistan|os (Ossetian) tk (Turkmen)
TN|Tunisia|ar-TN (Arabic) fr-TN (French)
TO|Tonga|en-TO (English) to (Tongan)
TR|Turkey|ab (Abkhazian) av (Avaric) ku (Kurdish) tr-TR (Turkish) ug (Uighur)
TT|Trinidad And Tobago|en-TT (English)
TV|Tuvalu|gil (Gilbertese) tvl (Tuvalu)
TW|Taiwan, Province Of China|zh-TW (Chinese)
TZ|Tanzania, United Republic Of|sw-TZ (Swahili)
UA|Ukraine|ab (Abkhazian) cu (Church Slavic) hu (Hungarian) os (Ossetian) pl (Polish) ro (Romanian) ru-UA (Russian) uk (Ukrainian) yi (Yiddish)
UG|Uganda|en-UG (English) lg (Ganda)
UM|United States Minor Outlying Islands|en-UM (English)
US|United States|en-US (English) es-US (Spanish) haw (Hawaiian) ik (Inupiaq) nv (Navajo) oj (Ojibwa) yi (Yiddish)
UY|Uruguay|es-UY (Spanish)
UZ|Uzbekistan|os (Ossetian) ug (Uighur) uz-UZ (Uzbek)
VA|Holy See (Vatican City State)|fr (French) it (Italian) la (Latin)
VC|Saint Vincent And The Grenadines|en-VC (English)
VE|Venezuela|es-VE (Spanish)
VG|Virgin Islands, British|en-VG (English)
VI|Virgin Islands, U.S.|en-VI (English)
VN|Viet Nam|vi (Vietnamese)
VU|Vanuatu|bi (Bislama) en-VU (English) fr-VU (French)
WF|Wallis And Futuna|fr-WF (French)
WS|Samoa|en-WS (English) sm (Samoan)
YE|Yemen|ar-YE (Arabic)
YT|Mayotte|fr-YT (French)
ZA|South Africa|af (Afrikaans) en-ZA (English) nr (S. Ndebele) ss-ZA (Swati) tn-ZA (Tswana) ts (Tsonga) ve (Venda) xh (Xhosa) yi (Yiddish) zu (Zulu)
ZM|Zambia|en-ZM (English)
ZW|Zimbabwe|en-ZW (English) nd (N. Ndebele) sn (Shona) ve (Venda) zu (Zulu)
A;
$a = array();
preg_match_all("@^(.*)\|(.*)\|(.*)@m", $s, $matches);
foreach ($matches[2] as $ind => $countryname) {
$lanshort2long[$matches[1][$ind]] = $countryname;
preg_match_all("@(([a-z]+)(?:\-.+)?)\h\((.+)\)@Ui", $matches[3][$ind], $m2);
foreach ($m2[1] as $i2 => $j) {
$a[$m2[2][$i2]][] = array($j, $countryname, $matches[1][$ind], $m2[3][$i2]);
}
}
return $a;
}
function general_setup()
{
global $mastershort;
global $sitelan;
global $sitetypesall;
global $ipblocklist;
global $ipswecheck;
global $ourcountries;
global $lanshort2long;
global $country_flag_css_new;
global $country_flag_version;
global $maincat;
global $ourtypes;
global $univ_dict;
if (in_array($mastershort, array("clf")) || stristr($mastershort,'bcel')) $extra = 1;
$maincat = array();
$univ_dict = array();
$alllocales = alllocales();
$ipblocklist = array();
$ourtypes = array();
$query = "SELECT *
FROM manage_setup
WHERE item='dict_$sitelan' OR
item LIKE 'setup_%' OR
FIND_IN_SET(item, 'blocked_ips_ipv4,blocked_ips_ipv6,countries,country_flag_css_new,country_flag_version')";
$result = mnq($query);
if ($result) {
if (in_array($mastershort, array("parier", "pacca", "peb"))) {
$sitetypesall_here = array("sport", "casino", "poker");
} else {
$sitetypesall_here = $sitetypesall;
}
while ($r = mfs($result)) {
if ($r['item'] == "dict_$sitelan") {
preg_match_all("@^(.+)\=\>(.+)\r*$@m", $r['value'], $matches);
foreach ($matches[1] as $ind => $q) {
$univ_dict[$sitelan][$q] = $matches[2][$ind];
}
} elseif (substr($r['item'], 0, 6) == "setup_") {
$k = substr($r['item'], 6);
$ourtypes[] = $k;
if (in_array($k, $sitetypesall_here)) {
$s = explode("\n", $r['value']);
foreach ($s as $ss) {
$ss = trim($ss);
if (!$ss) {
continue;
}
$f = explode("=>", $ss);
$maincat[$k][$f[0]] = $f[1];
}
}
} else {
switch ($r['item']) {
case "blocked_ips_ipv4":
case "blocked_ips_ipv6":
$ipblocklist[$r['item']] = explode("\r\n", trim($r['value']));
break;
case "countries":
$ipswecheck = unserialize($r['value']);
foreach ($ipswecheck as $lan => &$o) {
foreach ($o as $oo) {
$ourcountries[$oo] = $lanshort2long[strtoupper($oo)];
}
$o = implode(",", $o);
}
$ourcountries['others'] = "general";
break;
case "country_flag_css_new":
if ($extra) {
$country_flag_css_new = unserialize($r['value']);
$country_flag_css_new = $country_flag_css_new[$sitelan];
}
break;
case "country_flag_version":
if ($extra) {
$country_flag_version = $r['value'];
}
break;
}
}
}
}
}
function univ_should_show_popup_with_link()
{
global $site;
global $allcbp;
global $getidname;
global $sitelan;
global $ipcountry;
if ($site['type'] != "review") return;
if (!$getidname) $getidname = getidname();
$m = $allcbp[$site[$getidname]]["showpopup"];
if (!$m) return;
$k = $sitelan . "-" . strtoupper($ipcountry);
$e = explode(",", $m);
foreach ($e as $ee) {
$ee = trim($ee);
if ($sitelan == $ee or $k == $ee) {
return true;
}
}
}
function univ_popupwindow()
{
global $site;
global $site2;
global $nolink;
global $previewmode;
global $ipcountry;
global $sitelan;
global $sitetypegeneral;
global $univ_popup_css;
global $getidname;
global $univ_nolink;
global $sitetypesall;
if ($site['type'] != "review") return;
if (univ_isbot()) return;
if ($previewmode) return;
if (!$sitetypegeneral) $sitetypegeneral = sitetypegeneral();
$getidname = getidname();
if (!cbpgood($site[$getidname])) {
$univ_nolink = 1;
$nolink = true;
} elseif (univ_should_show_popup_with_link()) {
} else return;
$name = id2name("", $site[$getidname]);
$univ_addpopup = univ_addpopup($name);
if ($univ_addpopup) {
$univ_popup_css = univ_popup_css();
return $univ_addpopup;
}
}
function univ_addpopup($name)
{
global $site;
global $sitetypegeneral;
global $sitedata;
global $ipcountry;
global $sitelan;
global $univ_popup_closebuttonnoshow;
global $univ_popup_overlay_opaque;
global $allcbp;
global $maincat;
global $univ_nolink;
global $univ_dict;
global $sitetypegeneral;
$mydict['visit'] = array( "fr" => "Visiter",
"en" => "Visit",
"de" => "Spielen",
"es" => "Visitar",
"fi" => "Tutustu",
"sv" => "Besök",
"no" => "Besøk",
"pt" => "Jogue",
"pl" => ""
);
$mydict['review'] = array( "fr" => "Revue",
"en" => "Review",
"de" => "Rezension",
"es" => "Análisis",
"fi" => "Arvostelu",
"sv" => "Recension",
"no" => "Anmeldelse",
"pt" => "Resenha",
"pl" => ""
);
if ($univ_nolink) {
$mydict['s1'] = array(
"fr" => "*name* n'est plus disponible dans votre pays",
"en" => "*name* is not available in your country",
"de" => "*name* ist in Ihrem Land nicht mehr verfügbar",
"es" => "*name* no está disponible en tu país",
"fi" => "*name* ei ole saatavilla maassasi",
"sv" => "Tyvärr är *name* inte tillgängligt i ditt land",
"no" => "*name* godtar ikke spillere fra ditt land",
"pt" => "*name* não está disponível em seu país",
"pl" => ""
);
$mydict['s2'] = array(
"fr" => "Nous vous recommandons les sites suivants :",
"en" => "We recommend to you the following sites:",
"de" => "Wir empfehlen Ihnen die folgenden Webseiten:",
"es" => "Te recomendamos los siguientes sitios:",
"fi" => "Suosittelemme seuraavia sivustoja:",
"sv" => "Vi rekommenderar följande sajter:",
"no" => "Vi anbefaler følgende nettsider:",
"pt" => "Recomendamos a você os seguintes sites:",
"pl" => ""
);
$t1 = strtr($mydict['s1'][$sitelan], array("*name*" => $name));
$t2 = $mydict['s2'][$sitelan];
} else {
if ($sitetypegeneral != "casino") {
$toadd = "$sitetypegeneral ";
}
$t1 = $univ_dict[$sitelan]["{$toadd}not accepted in country (for valid)"];
eval("\$t1=\"$t1\";");
$t2 = $univ_dict[$sitelan]["{$toadd}our recommendations (for valid)"];
}
$logofolder = $maincat[$sitetypegeneral]['path_oqaque_logo'];
$idname = $maincat[$sitetypegeneral]['id'];
$ext = $maincat[$sitetypegeneral]['oqaque_logo_ext'];
$usetable = $maincat[$sitetypegeneral]['data'];
$vlink_format_by_template = array("bcel" => "/casino/*id*/go.html", "tcc" => "/go/*id*");
$vfmt = $sitedata['vlink_format'] or $vfmt = $vlink_format_by_template[$sitedata['using_template']] or $vfmt = "/go/*id*.html";
if ($ipcountry != "others") {
$fimg = "img/flags/$ipcountry.svg";
if (file_exists_after_converting($fimg, "", 0, getenv('RBO_URL')."/$fimg"))
$flag = "<img src='/$fimg' alt=''>";
}
$max = 3;
$tops = tops();
foreach ($tops['array'] as $cid) {
if (!cbpgood($cid)) {
continue;
}
$i++;
$nm = addshy(id2name("", $cid));
$v = strtr($vfmt, array("*id*" => $cid));
if ($allcbp[$cid]['review']) {
$revue = "<a href=\"{$GLOBALS['sitedata']['suffix']}{$allcbp[$cid]['review']}\" class='popup-casinos__review'>{$mydict['review'][$sitelan]}</a>";
} else {
$revue = "";
}
if (file_exists_after_converting("img/$logofolder/{$cid}.$ext", "", 0, getenv('RBO_URL')."/img/$logofolder/{$cid}.$ext")) {
$img = "<img src='/img/$logofolder/{$cid}.$ext' alt='$nm'>";
} else {
$img = "<img src=' data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAACCAYAAACQahZdAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyBpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBXaW5kb3dzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjVFREJDNDg0OUVGQjExRTlBQzBDRTQzQ0VGQ0I5Q0E3IiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjVFREJDNDg1OUVGQjExRTlBQzBDRTQzQ0VGQ0I5Q0E3Ij4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6NUVEQkM0ODI5RUZCMTFFOUFDMENFNDNDRUZDQjlDQTciIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6NUVEQkM0ODM5RUZCMTFFOUFDMENFNDNDRUZDQjlDQTciLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz5+ZZ9TAAAAFElEQVR42mL8//8/AzpgxCYIEGAAsLgF/UoF2BIAAAAASUVORK5CYII=' alt='$nm'>";
}
$s .= <<<A
<li class="popup-casinos__item">
<div class="popup-casinos__logo"><a href="{$GLOBALS['sitedata']['suffix']}$v">$img</a></div>
<div class="popup-casinos__country">$flag</div>
<div class="popup-casinos__links">
<a href="{$GLOBALS['sitedata']['suffix']}$v" class="popup-casinos__visit">{$mydict['visit'][$sitelan]}</a>$revue
</div>
</li>
A;
if ($i == $max) {
break;
}
}
if ($s) $s = <<<A
<div id="popup" class="popup">
<div class="popup_overlay"$univ_popup_overlay_opaque>
</div>
<div class="popup-window">
<div class="popup-window__header">
<div class="popup-window__topbar">
<button onclick="document.getElementById('popup').style.display = 'none';" class="popup-window__close"$univ_popup_closebuttonnoshow></button>
</div>
</div>
<div class="popup-window__body">
<p class="popup-window__title">$t1</p>
<div class="popup-window__casinos popup-casinos">
<p class="popup-casinos__title">$t2</p>
<ul class="popup-casinos__list">
$s
</ul>
</div>
</div>
</div>
</div>
A;
return $s;
}
function univ_popup_css()
{
global $dict;
if (!$dict['*popup_bar*']) $dict['*popup_bar*'] = "#636363";
if (!$dict['*popup_bg1*']) $dict['*popup_bg1*'] = "#009a62";
if (!$dict['*popup_fg1*']) $dict['*popup_fg1*'] = "#ffffff";
if (!$dict['*popup_text*']) $dict['*popup_text*'] = "inherit";
if (!$dict['*popup_link*']) $dict['*popup_link*'] = "inherit";
if (!$dict['*popup_bg2*']) $dict['*popup_bg2*'] = $dict['*popup_bg1*'];
$s = <<<A
.popup .popup_overlay {
height:100%;width:100%;left:0;top:0;filter:alpha(opacity=80);opacity:0.8;-moz-opacity:0.8;background-color:#000;position:fixed;margin:0;text-align:center;z-index:10000;text-align:center;vertical-align:middle;
}
.popup-window {
position:fixed; top:50%; left:50%; z-index:10001; margin-left:-197.5px; margin-top:-206px;
width: 395px;
}
.popup-window__topbar {
position: relative;
height: 46px;
background-color: {$dict['*popup_bar*']};
border-radius: 18px 18px 0 0;
}
.popup-window__close {
position: absolute;
top: 50%;
right: 18px;
width: 20px;
height: 20px;
padding: 0;
background: {$dict['*popup_bg2*']};
border: none;
border-radius: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
cursor: pointer;
-webkit-transition: opacity 0.3s ease;
-o-transition: opacity 0.3s ease;
transition: opacity 0.3s ease;
}
.popup-window__close:before {
content:"X";
color:{$dict['*popup_fg1*']};
line-height:21px;
font-size:12px;
}
.popup-window__close:hover, .popup-window__close:focus {
opacity: 0.75;
}
.popup-window__body {
padding: 16px 20px 22px 20px;
background-color: #fff;
border-radius: 0 0 18px 18px;
}
.popup-window__title {
margin: 0 0 17px 0;
font-weight: 800;
font-size: 19px;
line-height: 24px;
font-family: 'Open Sans', sans-serif;
text-align: center;
color: {$dict['*popup_text*']};
text-transform: uppercase;
}
.popup-casinos__title {
margin: 0 0 17px 0;
font-weight: 400;
font-size: 17px;
line-height: 20px;
font-family: 'Open Sans', sans-serif;
text-align: center;
color: {$dict['*popup_text*']};
letter-spacing: -0.04em;
}
.popup-casinos__list {
margin: 0;
padding: 0;
list-style-type: none;
}
.popup-casinos__list img {
display: block; width:36px; height:24px;
}
.popup-casinos__item {
padding:0;
background-image:none !important;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
justify-content: flex-start;
align-items: flex-start;
-webkit-box-align: start;
-ms-flex-align: start;
-webkit-box-pack: start;
-ms-flex-pack: start;
}
.popup-casinos__item:not(:last-child) {
margin-bottom: 8px;
}
.popup-casinos__logo {
-ms-flex: 0 1 auto;
flex: 0 1 auto;
-webkit-box-flex: 0;
}
.popup-casinos__logo img {
max-width: 100%;
height: auto;
width:150px;
}
.popup-casinos__country {
-ms-flex: 0 0 auto;
flex: 0 0 auto;
padding: 15px 16px 0 14px;
-webkit-box-flex: 0;
}
.popup-casinos__links {
-ms-flex: 0 0 auto;
flex: 0 0 auto;
padding-top: 8px;
font-family: 'Open Sans', sans-serif;
text-align: center;
-webkit-box-flex: 0;
}
.popup-casinos__visit {
display: block;
width: 134px;
margin-bottom: 3px;
padding: 11px 5px;
font-weight: 700;
font-size: 15px;
line-height: 17px;
text-align: center;
color: {$dict['*popup_fg1*']} !important;
text-decoration: none !important;
background-color: {$dict['*popup_bg2*']};
border-radius: 7px;
-webkit-transition: opacity 0.3s ease;
-o-transition: opacity 0.3s ease;
transition: opacity 0.3s ease;
}
.popup-casinos__visit:hover, .popup-casinos__visit:focus {
opacity: 0.75;
}
.popup-casinos__review {
display: inline-block;
font-weight: 600;
font-size: 12px;
line-height: 15px;
color: {$dict['*popup_link*']};
}
.popup-casinos__review:hover, .popup-casinos__review:focus {
text-decoration: none;
}
@media (max-width: 395px) {
.popup-window {left:0; margin-left:0; width:100%;}
.popup-casinos__visit {width:120px;}
}
@media (max-width: 350px) {
.popup-casinos__logo {margin-top:8px;}
}
A;
$s = "<style type='text/css'>$s</style>";
return $s;
}
function page_image_maxwidth($special = "")
{
global $sitedata;
global $site;
switch ($sitedata['using_template']) {
case "1":
case "2":
if (!$sitedata['menu_width']) {
$sitedata['menu_width'] = 157;
}
$sitedata['main_part_width'] = 970 - $sitedata['menu_width'];
$maxwidth = $sitedata['main_part_width'] - 40;
break;
default:
$templateimgwidth["gr"] = array("general" => 840);
$templateimgwidth["gr2"] = array("general" => 1100);
$templateimgwidth["parier"] = array("general" => 650);
$templateimgwidth["tcc"] = array("general" => 894);
$templateimgwidth["ocrb"] = array("general" => 863);
$templateimgwidth["jcgen"] = array("general" => 977);
$templateimgwidth["pro"] = array("general" => 868, "review" => 1240, "bm_index" => 1240);
$templateimgwidth["sco"] = array("general" => 945);
$templateimgwidth["ocs"] = array("general" => 915);
$templateimgwidth["cfst"] = array("general" => 650);
$templateimgwidth["cfo"] = array("general" => 831);
$templateimgwidth["pel"] = array("general" => 1400);
$templateimgwidth["clf"] = array("general" => 871);
$templateimgwidth["pssch"] = array("general" => 960);
$templateimgwidth["bcel"] = array( "general" => 767,
"newsarticle" => 767,
"gameindex" => array("" => 767, "img0" => 1168),
"main" => 1148,
"casinos" => 1168,
"" => 1168,
"bitcoin_guide" => 1168,
"bonus_casino" => 1168,
"loteria" => 1168,
"loteriaindex" => 1168
);
$v = $templateimgwidth[$sitedata['using_template']][$site['type']];
if (is_array($v)) {
$maxwidth = $v[$special] or $maxwidth = $v[""];
} else {
$maxwidth = $v;
}
if (!$maxwidth) {
$maxwidth = $templateimgwidth[$sitedata['using_template']]["general"];
}
if (!$maxwidth) {
$maxwidth = 765;
}
}
return $maxwidth;
}
function country2currency($c)
{
global $sitedata;
$a = <<<A
NZ NZD
CK NZD
NU NZD
PN NZD
TK NZD
AU AUD
CX AUD
CC AUD
HM AUD
KI AUD
NR AUD
NF AUD
TV AUD
AS EUR
AD EUR
AT EUR
BE EUR
FI EUR
FR EUR
GF EUR
TF EUR
DE EUR
GR EUR
GP EUR
IE EUR
IT EUR
LU EUR
MQ EUR
YT EUR
MC EUR
NL EUR
PT EUR
RE EUR
WS EUR
SM EUR
SI EUR
ES EUR
VA EUR
GS GBP
GB GBP
JE GBP
IO USD
GU USD
MH USD
FM USD
MP USD
PW USD
PR USD
TC USD
US USD
UM USD
VG USD
VI USD
HK HKD
CA CAD
JP JPY
AF AFN
AL ALL
DZ DZD
AI XCD
AG XCD
DM XCD
GD XCD
MS XCD
KN XCD
LC XCD
VC XCD
AR ARS
AM AMD
AW ANG
AN ANG
AZ AZN
BS BSD
BH BHD
BD BDT
BB BBD
BY BYR
BZ BZD
BJ XOF
BF XOF
GW XOF
CI XOF
ML XOF
NE XOF
SN XOF
TG XOF
BM BMD
BT INR
IN INR
BO BOB
BW BWP
BV NOK
NO NOK
SJ NOK
BR BRL
BN BND
BG BGN
BI BIF
KH KHR
CM XAF
CF XAF
TD XAF
CG XAF
GQ XAF
GA XAF
CV CVE
KY KYD
CL CLP
CN CNY
CO COP
KM KMF
CD CDF
CR CRC
HR HRK
CU CUP
CY CYP
CZ CZK
DK DKK
FO DKK
GL DKK
DJ DJF
DO DOP
TP IDR
ID IDR
EC ECS
EG EGP
SV SVC
ER ETB
ET ETB
EE EEK
FK FKP
FJ FJD
PF XPF
NC XPF
WF XPF
GM GMD
GE GEL
GI GIP
GT GTQ
GN GNF
GY GYD
HT HTG
HN HNL
HU HUF
IS ISK
IR IRR
IQ IQD
IL ILS
JM JMD
JO JOD
KZ KZT
KE KES
KP KPW
KR KRW
KW KWD
KG KGS
LA LAK
LV LVL
LB LBP
LS LSL
LR LRD
LY LYD
LI CHF
CH CHF
LT LTL
MO MOP
MK MKD
MG MGA
MW MWK
MY MYR
MV MVR
MT MTL
MR MRO
MU MUR
MX MXN
MD MDL
MN MNT
MA MAD
EH MAD
MZ MZN
MM MMK
NA NAD
NP NPR
NI NIO
NG NGN
OM OMR
PK PKR
PA PAB
PG PGK
PY PYG
PE PEN
PH PHP
PL PLN
QA QAR
RO RON
RU RUB
RW RWF
ST STD
SA SAR
SC SCR
SL SLL
SG SGD
SK SKK
SB SBD
SO SOS
ZA ZAR
LK LKR
SD SDG
SR SRD
SZ SZL
SE SEK
SY SYP
TW TWD
TJ TJS
TZ TZS
TH THB
TO TOP
TT TTD
TN TND
TR TRY
TM TMT
UG UGX
UA UAH
AE AED
UY UYU
UZ UZS
VU VUV
VE VEF
VN VND
YE YER
ZM ZMK
ZW ZWD
AX EUR
AO AOA
AQ AQD
BA BAM
CD CDF
GH GHS
GG GGP
IM GBP
LA LAK
MO MOP
ME EUR
PS JOD
BL EUR
SH GBP
MF ANG
PM EUR
RS RSD
A;
if ($c == "others") $c = $sitedata['targeted_countries'];
if (strlen($c) != 2) return;
$c = preg_quote($c);
if (preg_match("@^$c (...)\s*\r*$@mi", $a, $matches)) return $matches[1];
}
function lan2currency($lan)
{
$currency = array( "en" => "USD",
"fr" => "EUR",
"de" => "EUR",
"es" => "EUR",
"fi" => "EUR",
"sv" => "SEK",
"no" => "NOK",
"it" => "EUR",
"ro" => "EUR",
"pt" => "EUR",
);
return $currency[$lan];
}
function univ_freegames_fav_and_orderby()
{
global $ipcountry;
$query = "SELECT * FROM live_orders WHERE site_id='general_fav(freegames_desktop)' or site_id='general_fav(freegames_mobile)'";
$result = mnq($query);
if ($result) {
while ($r = mfs($result)) {
$s = $r["order_{$ipcountry}_ip"] or $s = $r['order_general'];
$a = explode(",", $s);
$v = "";
if ($a) {
foreach ($a as $i => $oo) {
$v .= " WHEN '$oo' THEN $i";
}
if ($v) {
$v = " CASE game_id_new$v ELSE 9999 END,";
$t = " FIND_IN_SET(game_id_new,'$s')";
}
}
if ($r['site_id'] == "general_fav(freegames_desktop)") $o['d'] = array("findinset" => $t, "orderby" => $v);
else $o['m'] = array("findinset" => $t, "orderby" => $v);
}
}
return $o;
}
function univfreegamesorderby()
{
global $sitedata;
global $ismobilephone;
global $univfreegamesorderby;
global $ipcountry;
if (isset($univfreegamesorderby)) {
return $univfreegamesorderby;
}
if ($ipcountry == "others") {
$od = "_general";
} else {
$od = "_{$ipcountry}_ip";
}
if ($ismobilephone) {
$q = "m";
$f = "freegames_mobile";
} else {
$q = "d";
$f = "freegames_desktop";
}
$query = "SELECT * FROM live_orders WHERE site_id='{$sitedata['short']}($f)'";
$result = mnq($query);
if ($r = mfs($result)) {
$a = explode(",", $r['order' . $od]);
if ($a[0]) {
$found = 1;
}
}
if (!$found) {
$univ_freegames_fav_and_orderby = univ_freegames_fav_and_orderby();
$univfreegamesorderby = $univ_freegames_fav_and_orderby[$q]['orderby'];
} else {
foreach ($a as $i => $oo) {
$v .= " WHEN '$oo' THEN $i";
}
if ($v) {
$v = " CASE game_id_new$v ELSE 9999 END,";
}
$univfreegamesorderby = $v;
}
return $univfreegamesorderby;
}
function univ_parent_page_image($r)
{
$k = (int)$r['parent_page_image'];
if ($k) {
if ($r['images']) {
preg_match("@^$k\:([^\/]+?).*(?:\r|)$@mU", $r['images'], $matches);
if ($matches) {
return $matches[1];
}
}
}
if (!$r['image']) {
if (preg_match("@^\d+\:([^\/]+)@", $r['images'], $matches)) {
return $matches[1];
}
} else {
return $r['image'];
}
}
function updatefiles($template)
{
global $master_short;
if (strpos($_SERVER['HTTP_HOST'], ".") == false) {
} elseif ($master_short != "cfo") {
if (!file_exists("mysql.php")) {
$s = file_get_contents("conf.php");
preg_match("@define\('DB_SERVER', '.+'\);@", $s, $matches);
$u = $matches[0] . "\n";
preg_match("@define\('DB_SERVER_USERNAME', '.+'\);@", $s, $matches);
$u .= $matches[0] . "\n";
preg_match("@define\('DB_SERVER_PASSWORD', '.+'\);@", $s, $matches);
$u .= $matches[0] . "\n";
preg_match("@define\('DB_DATABASE', '.+'\);@", $s, $matches);
$u .= $matches[0];
$u = <<<A
<?php
if (strpos(\$_SERVER['HTTP_HOST'], ".")!==false OR \$_SERVER['HTTP_HOST']=="localhost") {
$u
}
A;
file_put_contents("mysql.php", $u);
}
$query = "SELECT * FROM manage_template_files_$template WHERE item IS NOT NULL";
if ($result = mnq($query)) {
while ($r = mfs($result)) {
$f = preg_replace("@^templates/$template/@", "", $r['item']);
$memd5 = @md5_file($f);
if ($r['checksum'] != $memd5) {
file_put_contents($f, $r['value']);
}
}
}
}
}
function sticky_banner_sentence($theid)
{
global $sitelan;
global $sitetypegeneral;
global $site;
$query = "SELECT * FROM manage_websites_configuration WHERE item='sticky_banner_text_$sitelan'";
$result = mnq($query);
if ($result) {
if ($r = mfs($result)) {
$a = unserialize($r['val']);
$v = $a[$sitetypegeneral];
if ($v) {
$bonusamount = currencychange(getbonussumnew($site));
if ($bonusamount == "–") {
$bonusamount = "";
}
if ($v[$theid]) {
if (!$bonusamount and preg_match("@\$bonusamount@", $v[$theid])) {
$s = $v['general_without_bonus'];
} else {
$s = $v[$theid];
}
} elseif (!$bonusamount) {
$s = $v['general_without_bonus'];
} else {
$s = $v['general_with_bonus'];
}
$name = id2name("", $theid);
eval("\$s=\"$s\";");
}
}
}
return $s;
}
function univ_sticky_banner()
{
global $site;
if ($GLOBALS['univ_nolink']) {
return;
}
$idname = getidname();
$theid = $site[$idname];
$sticky_banner_sentence = sticky_banner_sentence($theid);
$vt = strtoupper(vlinktext());
$vk = getvistlinkurl($theid);
$s = "<div id='stkhidden'>
<span>$sticky_banner_sentence</span>
<a class='univ_sticky_button' href='{$GLOBALS['sitedata']['suffix']}$vk'>$vt</a>
</div>";
return $s;
}
function block_popup()
{
global $ipcountry;
$s = '';
/*
if ($ipcountry=="es") {
$s=<<<A
<div id='block_popup' style='position: fixed;width: 100%;top: 0;left: 0;background: #000;z-index: 9999999999999;height: 100%;'>
<div style='box-sizing:border-box;display: flex;flex-direction: column;justify-content: center;background:#ccc; padding:20px; background: #ccc;padding: 20px;position: absolute;top: 50%;left: 50%;margin-top: -50%;width: 320px;height: 200px;margin-top: -100px;margin-left: -160px;'>
<p style='color:#000; line-height:28px;'>Lo sentimos, este contenido no está disponible en estos momentos en tu país de acuerdo con el artículo 37 del Real Decreto 11/2020.</p>
</div>
</div>
A;
}
*/
return $s;
}
function getvistlinkurl($id, $type = "goto")
{
global $sitedata;
global $localmode;
// if (!$localmode) $hpre=$sitedata['suffix']; else $hpre="";
$vlink_format_by_template = array( "bcel" => "/casino/*id*/go.html",
"tcc" => "/go/*id*"
);
$vfmt = $sitedata['vlink_format'] or $vfmt = $vlink_format_by_template[$sitedata['using_template']] or $vfmt = "/go/*id*.html";
if ($type == "goex" && $sitedata['using_template'] == "bcel") {
$vfmt = "/casino/*id*/ex.html";
}
if ($type == "gotc" && $sitedata['using_template'] == "bcel") {
$vfmt = "/tc/*id*.html";
}
$v = strtr($vfmt, array("*id*" => $id));
return $v;
}
function univ_process404()
{
global $sitelan;
$text404 = array(
"fr" => "Le chemin vers la victoire est parfois semé d'embûches. N'ayez crainte, notre page d'accueil n'est pas loin.",
"en" => "Oops, nothing to see here! But plenty's happening on our Home PageTook a wrong turn? Let's show you the way back to our Home Page",
"es" => "Tenemos BUENAS y MALAS noticias para tí: La mala es que la página que buscas no existe. Pero la buena, es que ¡Puedes encontrar muchas más en nuestra Web!",
"de" => "Hier gibt es leider nichts mehr zu sehen für Sie. Auf unserer Home Page aber schon.",
"fi" => "Käännyitkö väärään suuntaan? Ohjataanpa sinut takaisin kotisivullemme.",
"sv" => "Du tycks ha gått vilse. Låt oss hjälpa dig att hitta hem!",
"no" => "",
"pl" => "",
"pt" => "Opa, não encontramos nada aqui! Mas tem bastante conteúdo na nossa página inicial. Gostaria de ver? Vamos te mostrar como chegar lá:",
);
$buttontext = array(
"fr" => "Retour à l'accueil",
"en" => "Return To HomePage",
"es" => "Regresa al inicio",
"de" => "Zurück zur Startseite",
"fi" => "Palaa kotiin",
"sv" => "Åter till förstasidan",
"no" => "",
"pl" => "",
"pt" => "Volte à página inicial",
);
header("HTTP/1.0 404 Not Found");
if (function_exists("custom_process404")) {
custom_process404($text404[$sitelan], $buttontext[$sitelan]);
}
exit;
}
function convert_ascii($string)
{
// Replace Single Curly Quotes
$search[] = chr(226) . chr(128) . chr(152);
$replace[] = "'";
$search[] = chr(226) . chr(128) . chr(153);
$replace[] = "'";
// Replace Smart Double Curly Quotes
$search[] = chr(226) . chr(128) . chr(156);
$replace[] = '"';
$search[] = chr(226) . chr(128) . chr(157);
$replace[] = '"';
// Replace En Dash
$search[] = chr(226) . chr(128) . chr(147);
$replace[] = '--';
// Replace Em Dash
$search[] = chr(226) . chr(128) . chr(148);
$replace[] = '---';
// Replace Bullet
$search[] = chr(226) . chr(128) . chr(162);
$replace[] = '*';
// Replace Middle Dot
$search[] = chr(194) . chr(183);
$replace[] = '*';
// Apply Replacements
$string = str_replace($search, $replace, $string);
// Remove any non-ASCII Characters
$string = preg_replace("/[^\x01-\x7F]/", "", $string);
return $string;
}
function remove_special_space($string)
{
$search[] = chr(226) . chr(128) . chr(175);
$replace[] = ' ';
// Apply Replacements
$string = str_replace($search, $replace, $string);
return $string;
}
function type_of_it($type)
{
global $maincat;
return $maincat[$type]['alias'];
}
function univ_goodsoftware()
{
global $forlansforips;
global $ipcountry;
global $sitelan;
$forlansforips = "
(NULLIF(forips,'') IS NULL OR
IF (instr(forips, 'not for'),
FIND_IN_SET('{$GLOBALS['ipcountry']}',REPLACE(forips,'not for ',''))=0,
FIND_IN_SET('{$GLOBALS['ipcountry']}',forips)))
AND
(NULLIF(forlans,'') IS NULL OR
IF (instr(forlans, 'not for'),
FIND_IN_SET('$sitelan',REPLACE(forlans,'not for ',''))=0,
FIND_IN_SET('$sitelan',forlans)))
";
$a = array();
$query = "SELECT software_id, software_name
FROM live_software
WHERE NULLIF(software_disabled,0) IS NULL
AND NULLIF(software_id,'') IS NOT NULL
AND {$GLOBALS['forlansforips']}";
$result = mnq($query);
if ($result) {
while ($r = mfa($result)) {
$a[$r['software_id']] = $r['software_name'];
}
}
return $a;
}
function get_software_of_casino($id)
{
global $all_casino_software;
global $univ_goodsoftware;
if (!$all_casino_software) {
$all_casino_software = array();
$query = "SELECT casino_id, software_id FROM casinos WHERE valid = 1";
$result = mnq($query);
while ($r = mfs($result)) {
$all_casino_software[$r['casino_id']] = $r['software_id'];
}
}
if (!$univ_goodsoftware) {
$univ_goodsoftware = univ_goodsoftware();
}
$e = explode(",", $all_casino_software[$id]);
$final = array();
foreach ($e as $ee) {
if ($univ_goodsoftware[$ee]) {
$final[] = array($ee, $univ_goodsoftware[$ee]);
}
}
return $final;
}
function change_name_from_other_names($r)
{
global $sitelan;
global $ipcountry;
$m = trim($r['other_names']);
$b = strtoupper($ipcountry);
if (preg_match("@^{$sitelan}_$b\:(.+)\r*$@m", $m, $matches)) {
return $matches[1];
} elseif ($sitelan == "de" and $b == "DE") { // if de_DE remove the last " casino"
$s = preg_replace("@(.{3,}) casino$@i", "$1", $r['name']);
return $s;
} else {
return $r['name'];
}
}
function process_special_text_file()
{
global $sitedata;
if ($sitedata['special_text_files']) {
$a = array();
$e = preg_split("@^filename888\:\r*$@m", $sitedata['special_text_files']);
foreach ($e as $ind => $ee) {
if ($ind == 0) {
continue;
}
$ee = trim($ee);
$j = preg_split("@\r\n@", $ee, 2);
if ($j[0] == $_SERVER['REQUEST_URI']) {
header("Content-Type: text/plain");
echo $j[1];
die;
}
}
}
}
function reorder($type, $a)
{
global $univ_orders;
if (!isset($univ_orders)) $univ_orders = univ_orders();
switch ($type) {
case "software":
global $univ_goodsoftware;
if (!isset($univ_goodsoftware)) {
$univ_goodsoftware = univ_goodsoftware();
}
foreach ($a as $ind => $aa) {
if (!$univ_goodsoftware[$aa]) {
unset($a[$ind]);
}
}
$x = $univ_orders['software'];
break;
case "licence":
$x = $univ_orders['licence'];
break;
}
if (!$a || !$x) {
return $a;
}
$final = array();
sort($a);
foreach ($x as $xx) {
if ($k = array_search($xx, $a)) {
$final[] = $xx;
unset($a[$k]);
}
}
foreach ($a as $aa) {
$final[] = $aa;
}
return $final;
}
function univ_orders()
{
global $ipcountry;
$univ_orders = array();
if ($ipcountry == "others") {
$t = "general";
} else {
$t = $ipcountry;
}
// software
$a = array();
$query = "SELECT software_id FROM live_software WHERE order_$t>0 ORDER BY order_$t";
$result = mnq($query);
if ($result) {
$a = array();
while ($r = mfs($result)) {
$a[] = $r['software_id'];
}
/*
if ($a) {
foreach ($a as $n=>$o) {
$j.=" WHEN '$o' THEN $n";
}
$j=" CASE software_id$j ELSE 9999 END,";
}
*/
}
$univ_orders['software'] = $a;
// licence:
$a = array();
$query = "SELECT jurisdiction_id FROM bcel_jurisdiction WHERE order_$t>0 ORDER BY order_$t";
$result = mnq($query);
if ($result) {
$a = array();
while ($r = mfs($result)) {
$a[] = $r['jurisdiction_id'];
}
}
$univ_orders['licence'] = $a;
return $univ_orders;
}
function check_something()
{
switch ($_GET['something']) {
case "filegetcontents":
$fn = "https://www.casinosschweiz.com/something_for_test.txt";
$g = @file_get_contents($fn);
echo $g;
break;
}
die;
}
function delete_useless_files()
{
global $sitedata;
$deletion_interval = 24; // interval between deletion in hours
if (!array_key_exists("last_deletion_time", $sitedata)) {
$q = "ALTER TABLE manage_websites ADD column last_deletion_time longtext";
mnq($q);
}
if ($sitedata['last_deletion_time']) {
$timelast = strtotime($sitedata['last_deletion_time'] . " UTC");
}
if (!$timelast or time() - $timelast > $deletion_interval * 60 * 60) {
// do deletion
if (file_exists("checkedandfailed.txt")) {
@unlink("checkedandfailed.txt");
}
if (preg_match("@^skynethosting.+@", $sitedata['host_id'])) {
if (file_exists("error_log") and @filesize("error_log") > 1048576) { // if error_log >1MB
@unlink("error_log");
}
}
$gm = gmdate("Y-m-d H:i:s");
$q = "UPDATE manage_websites SET last_deletion_time='$gm' WHERE id={$sitedata['id']}";
mnq($q);
}
}
function univ_redirect_freegame()
{
global $sitedata;
if ($sitedata['freegames_301']) {
$newurl = trim($sitedata['freegames_301']);
header("Location: $newurl", true, 301);
} else {
header($_SERVER["SERVER_PROTOCOL"] . " 410 Gone");
if ($sitedata['using_template'] == "bcel") {
do404tohome();
}
}
exit;
}
function univ_text_for_blocking()
{
global $sitedata;
switch ($sitedata['using_template']) {
case "bcel":
showforblock();
break;
case "clf":
$style = <<<A
body {font-family: Arial, sans-serif;font-size:18px;background: #0181c0;position: absolute;height: 100%;width: 100%;text-align: center; margin:0;padding: 20px 0;box-sizing: border-box;}
#t {max-width: 500px;margin: 0 50px;color: #fff;min-height: 100%;display: inline-flex;flex-direction: column;text-align: left;justify-content: center;}
#t p {margin:8px 0;}
A;
case "ocrb":
if (!$style) $style = <<<A
body {font-family: "Open Sans",Helvetica,Arial,sans-serif;font-size:16px;background: #FFF;position: absolute;height: 100%;width: 100%;text-align: center; margin:0;padding: 20px 0;box-sizing: border-box;}
#t {max-width: 500px;margin: 0 50px;color: #000;min-height: 100%;display: inline-flex;flex-direction: column;text-align: left;justify-content: center;}
#t p {margin:8px 0;}
A;
default:
if (!$sitedata['text_for_blocking']) {
return;
}
if (!$style) $style = <<<A
#t {border: 1px #777 solid;width:600px; max-width:95%;margin: 50px auto;padding: 20px;box-sizing: border-box; font-family: "Open Sans", Arial, Helvetica, sans-serif;}
A;
$txt = formattext($sitedata['text_for_blocking']);
echo <<<A
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<meta name='robots' content='noindex, nofollow' />
<title>Site inaccessible</title>
<style>
$style
</style>
</head>
<body>
<div id='t'>
$txt
</div>
</body>
</html>
A;
}
}
function dev($segname)
{
global $devhtm;
global $sitedata;
global $devmode;
global $devsource;
if (!$devmode) {
return;
}
if (!$segname) {
return;
}
if (!isset($devhtm)) {
$devhtm = array();
$devhtmtext = @file_get_contents("$devsource/dev/{$sitedata['using_template']}/devhtm/dev.htm");
if (!$devhtmtext) return;
$e = preg_split("@#(.+)\r*@", $devhtmtext, -1, PREG_SPLIT_DELIM_CAPTURE);
$i = 1;
$c = count($e);
while ($i < $c) {
$devhtm[trim($e[$i])] = trim($e[$i + 1]);
$i += 2;
}
}
return <<<A
<!-- dev $segname begins -->
{$devhtm[$segname]}
<!-- dev $segname ends -->
A;
}
function univ_footer_logos()
{
global $sitedata;
global $ipcountry;
global $sitetypegeneral;
if (!$sitedata['using_template']) return;
$query = "SELECT * FROM manage_footers_usage WHERE template='{$sitedata['using_template']}'";
$result = mnq($query);
if (!$r = mfs($result)) {
return;
}
$a = array();
$query2 = "SELECT * FROM manage_footers";
$result2 = mnq($query2);
while ($r2 = mfs($result2)) {
if (substr($r2['lan'], 0, 1) == "!") {
$u = explode(",", substr($r2['lan'], 1));
foreach ($u as $uu) {
if (in_array($sitedata['lan'], $u)) {
continue 2;
}
}
} elseif ($r2['lan']) {
$u = explode(",", $r2['lan']);
foreach ($u as $uu) {
if (!in_array($sitedata['lan'], $u)) {
continue 2;
}
}
}
if (substr($r2['ip'], 0, 1) == "!") {
$u = explode(",", substr($r2['ip'], 1));
foreach ($u as $uu) {
if (in_array($ipcountry, $u)) {
continue 2;
}
}
} elseif ($r2['ip']) {
$u = explode(",", $r2['ip']);
foreach ($u as $uu) {
if (!in_array($ipcountry, $u)) {
continue 2;
}
}
}
if (substr($r2['site_type'], 0, 1) == "!") {
$u = explode(",", substr($r2['site_type'], 1));
foreach ($u as $uu) {
if (in_array($sitetypegeneral, $u)) {
continue 2;
}
}
} elseif ($r2['site_type']) {
$u = explode(",", $r2['site_type']);
foreach ($u as $uu) {
if (!in_array($sitetypegeneral, $u)) {
continue 2;
}
}
}
$a[$r2['id']] = $r2;
}
if (!$a) {
return;
}
preg_match_all("@^(\d+)\:([0-9\.]+)x([0-9\.]+)\r*$@m", $r['logos'], $matches);
foreach ($matches[1] as $ind => $o) {
if (!$a[$o]) {
continue;
}
$img = "img/footers/{$a[$o]['filename']}";
if (file_exists_after_converting($img, 0, 0, "http://www.casinosschweiz.com/footer/images/{$a[$o]['filename']}")) {
$img = optimize_image($img, $matches[2][$ind], $matches[3][$ind], 0, 0, "", 0, "", "", 0, 0, 0, 0, 0, 0, 0, 1);
if ($a[$o]['links']) {
$href = " href='{$a[$o]['links']}' target='_blank'";
} else {
$href = "";
}
if ($a[$o]['filename'] === 'gpwa.png' && ($sitedata['short'] === 'coe' || $sitedata['short'] == 'codp' || $sitedata['short'] !== 'codp')) {
$domain = $sitedata["domain"];
$href = " href='https://certify.gpwa.org/verify/$domain/' onclick='return GPWAVerificationPopup(this)' id='GPWASeal'";
}
if ($a[$o]['filename'] !== 'gpwa.png') {
if($sitedata['short']==='x2951')
{
$find = false;
$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$page_url;
$query2 = "SELECT page_url_categories_logo FROM manage_footers WHERE filename = '".$a[$o]['filename']."' ";
$result2 = mnq($query2);
while ($requestResult = mfs($result2)) {
$page_url = $requestResult['page_url_categories_logo'];
}
$notFor='';
if(strpos($page_url,'NOT FOR') !== false)
{
$notFor='NOT FOR';
$page_url =str_replace($notFor,'',$page_url);
}
$page_url= explode(",",$page_url);
$assArray=array();
foreach($page_url as $link){
$assArray[trim($link)]=trim($link);
}
$toFind = explode("?",$actual_link)[0];
$styleLogo='';
$subject ="<a$href ><img width='{$matches[2][$ind]}' height='{$matches[3][$ind]}' src='{$GLOBALS['rootpath']}/$img' /></a>";
if(strlen($notFor) !== 0 && $assArray[$toFind])
{
$styleLogo = 'display:none';
$subject= "<a$href style='{$styleLogo}'><img width='{$matches[2][$ind]}' height='{$matches[3][$ind]}' src='{$GLOBALS['rootpath']}/$img' /></a>";
}
elseif($assArray[$toFind] !==false && strlen($notFor) == 0)
{
$styleLogo = ($assArray[$toFind] && strlen($notFor) == 0)?'':'display:block';
$subject= "<a$href style='{$styleLogo}'><img width='{$matches[2][$ind]}' height='{$matches[3][$ind]}' src='{$GLOBALS['rootpath']}/$img' /></a>";
}
$s .= $subject;
$isNotOntarioWebpage;
for ($i = 0; $i < sizeof($page_url); $i++) {
if (trim($page_url[$i]) == trim($toFind)) {
$isNotOntarioWebpage = true;
}
}
if (!isset($isNotOntarioWebpage)) {
$s = str_replace('19plus-orcbonly', '18plus-ocrbonly', $s);
}
}
else{
$s .= "<a$href><img width='{$matches[2][$ind]}' height='{$matches[3][$ind]}' src='{$GLOBALS['rootpath']}/$img' /></a>";
}
}
if ($a[$o]['filename'] === 'gpwa.png' && ($sitedata['short'] === 'coe' || $sitedata['short'] === 'codp' || $sitedata['short'] === 'codp')) {
$s .= "<a$href><img width='{$matches[2][$ind]}' height='{$matches[3][$ind]}' src='{$GLOBALS['rootpath']}/$img' /></a>";
}
}
}
if ($s) {
return "<div id='footers'>$s</div>";
}
}
function univ_top_pronostic_order_by()
{
global $sitedata;
global $ipcountry;
if ($ipcountry == "others") {
$g = "order_general";
} else {
$g = "order_{$ipcountry}_ip";
}
$query = "SELECT * FROM live_orders WHERE site_id='{$sitedata['short']}(top pronostic)'";
$result = mnq($query);
if ($result) {
if ($r = mfs($result)) {
if ($a = $r[$g]) {
$e = explode(",", $a);
}
}
}
if ($e) {
$s = " CASE page_url";
foreach ($e as $ind => $ee) {
$s .= " WHEN '$ee' THEN $ind";
}
$s .= " ELSE 999 END, ";
return $s;
}
}
function univ_menunew($menuarray = "", $currentlevel = 1)
{
global $get_menu_univ;
$maxlevel = 3;
if (!isset($get_menu_univ)) {
$get_menu_univ = get_menu_univ();
}
if (!$menuarray) {
$menuarray = $get_menu_univ;
}
foreach ($menuarray as $m) {
$x = "";
$extraclass = "";
if ($currentlevel < $maxlevel && $m['submenu']) {
$x = univ_menunew($m['submenu'], $currentlevel + 1);
$extraclass = " class='hassub'";
}
$s .= "<li$extraclass><a href='{$m['url']}'>{$m['anchor']}</a>$x</li>";
}
return "<div class='level$currentlevel'><ul>$s</ul></div>";
}
function uuid()
{
if (function_exists("random_bytes")) {
// Generate 16 bytes (128 bits) of random data
$data = random_bytes(16);
assert(strlen($data) == 16);
// Set version to 0100
$data[6] = chr(ord($data[6]) & 0x0f | 0x40);
// Set bits 6-7 to 10
$data[8] = chr(ord($data[8]) & 0x3f | 0x80);
// Output the 36 character UUID.
return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
} else {
return sprintf(
'%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
mt_rand(0, 0xffff),
mt_rand(0, 0xffff),
mt_rand(0, 0xffff),
mt_rand(0, 0x0fff) | 0x4000,
mt_rand(0, 0x3fff) | 0x8000,
mt_rand(0, 0xffff),
mt_rand(0, 0xffff),
mt_rand(0, 0xffff)
);
}
}
function add_uuid_to_url($matches)
{
global $last_uuid;
$last_uuid = uuid();
return "=" . $last_uuid;
}
function adjust_uuid($url)
{
$url = preg_replace_callback("@\=\#\#uuid\#\#@i", "add_uuid_to_url", $url);
return $url;
}
function univ_freegame_data()
{
global $sitedata;
global $extra_type_folder;
$f = $sitedata['freegame_format'];
if ($extra_type_folder) {
$f = substr($extra_type_folder, 0, -1) . $f;
}
if ($f) {
$page_url = $_SERVER['REDIRECT_URL'];
$f = preg_quote($f);
$f = strtr($f, array('\$id' => '([a-z0-9\-]+)'));
if (preg_match("@^$f$@", $sitedata['suffix'] . $page_url, $matches)) {
$gid = $matches[1];
$query2 = "SELECT * FROM freegames_newnew WHERE game_id_new = '$gid'";
$result2 = mnq($query2);
if ($r2 = mfs($result2)) {
return $r2;
}
}
}
}