/** * Connect to the database and load user details * * @param $autoclean * (optional) boolean - Check whether or not to run cleanup (default: false) */ function dbconn($autoclean = false) { global $mysql_host, $mysql_user, $mysql_pass, $mysql_db, $THEME, $LANGUAGE, $LANG, $site_config; $THEME = $LANGUAGE = null; if (!ob_get_level()) { if (extension_loaded('zlib') && !ini_get('zlib.output_compression')) { ob_start('ob_gzhandler'); } else { ob_start(); } } header("Content-Type: text/html;charset={$site_config['CHARSET']}"); function_exists("mysql_connect") or die("MySQL support not available."); @mysql_connect($mysql_host, $mysql_user, $mysql_pass) or die('DATABASE: mysql_connect: ' . mysql_error()); @mysql_select_db($mysql_db) or die('DATABASE: mysql_select_db: ' . mysql_error()); unset($mysql_pass); //security userlogin(); //Get user info //Get language and theme $CURUSER = $GLOBALS["CURUSER"]; $ss_a = mysql_fetch_assoc(SQL_Query_exec("select uri from stylesheets where id='" . ($CURUSER ? $CURUSER['stylesheet'] : $site_config['default_theme']) . "'")); $THEME = $ss_a["uri"]; $lng_a = mysql_fetch_assoc(SQL_Query_exec("select uri from languages where id='" . ($CURUSER ? $CURUSER['language'] : $site_config['default_language']) . "'")); $LANGUAGE = $lng_a["uri"]; require_once "languages/{$LANGUAGE}"; if ($autoclean) { autoclean(); } }
function autoformat($html) { $html = stripslashes($html); $html = preg_replace(array('@on(\\w+)=(["\']?)+\\1@is', '@style=(["|\']?)+\\1@is', '@<script[^>]*>.*?</script>@is', '@<style[^>]*>.*?</style>@is', '@<br[^>]*>@is', '@<div[^>]*>(.*?)</div>@is', '@<p[^>]*>(.*?)</p>@is', '@<b[^>]*>(.*?)</b>@is', '@<strong[^>]*>(.*?)</strong>@is', '@<img[^>]+src=(["\']?)(.*?)\\1[^>]*?>@is'), array('', '', '', '', "\n[br]\n", "\$1\n", "\$1\n", "[b]\$1[/b]", "[b]\$1[/b]", "\n[img]\$2[/img]\n"), $html); if (stripos($html, '<embed') !== false) { preg_match_all("@<embed[^>]*>@is", $html, $embed_match); foreach ((array) $embed_match[0] as $key => $value) { preg_match("@.*?src\\s*=[\"|'|](.*?)[\"|'|]@is", $value, $src_match); preg_match("@.*?class\\s*=[\"|'|](.*?)[\"|'|]@is", $value, $class_match); preg_match("@.*?width\\s*=[\"|'|](\\d+)[\"|'|]@is", $value, $width_match); preg_match("@.*?height\\s*=[\"|'|](\\d+)[\"|'|]@is", $value, $height_match); $embed_width = $width_match[1]; $embed_height = $height_match[1]; if ($class_match[1] == 'edui-faked-music') { empty($embed_width) && ($embed_width = "400"); empty($embed_height) && ($embed_height = "95"); $html = str_replace($value, '[music=' . $embed_width . ',' . $embed_height . ']' . $src_match[1] . '[/music]', $html); } else { empty($embed_width) && ($embed_width = "500"); empty($embed_height) && ($embed_height = "450"); $html = str_replace($value, '[video=' . $embed_width . ',' . $embed_height . ']' . $src_match[1] . '[/video]', $html); } } } $html = str_replace(array(" ", " "), '', $html); $html = preg_replace('@<[/\\!]*?[^<>]*?>@is', '', $html); $html = ubb2html($html); $html = autoclean($html); return $html; }
} $multiclan = read_multiclan(); $multiclan_main = multi_main($multiclan); foreach ($multiclan as $clan) { if ($clan['id'] != $config['clan']) { $multiclan_info[$clan['id']] = $cache->get('get_last_roster_' . $clan['id'], 0); if ($multiclan_info[$clan['id']] === FALSE or empty($multiclan_info[$clan['id']])) { $multiclan_info[$clan['id']] = get_api_roster($clan['id'], $config); } if (empty($multiclan_info)) { $multiclan_info[$clan['id']]['status'] = 'error'; $multiclan_info[$clan['id']]['status_code'] = 'ERROR'; } if ($multiclan_info[$clan['id']]['status'] == 'ok' && $multiclan_info[$clan['id']]['status_code'] == 'NO_ERROR') { $cache->clear('get_last_roster_' . $clan['id']); $cache->set('get_last_roster_' . $clan['id'], $multiclan_info[$clan['id']]); } else { die('No cahced data'); } } else { $multiclan_info[$clan['id']] =& $new; } } //Autoclener autoclean(86400 * 7, $multiclan, $config, ROOT_DIR . '/cache/players/'); $rand_keys = array_rand($res, 1); $eff_rating = eff_rating($res, $lang); $tanks_nation = tanks_nations(); $tanks_types = tanks_types(); $tanks_lvl = tanks_lvl(); sort($tanks_lvl);
<?php require_once "include/bittorrent.php"; dbconn(); if ($useCronTriggerCleanUp) { $return = autoclean(); if ($return) { echo $return . "\n"; } else { echo "Clean-up not triggered.\n"; } } else { echo "Forbidden. Clean-up is set to be browser-triggered.\n"; }