connect to 1 to enable debug mode require_once ("{$CONF['path']}/settings_sql.php"); require_once ("{$CONF['path']}/sources/sql/{$CONF['sql']}.php"); require_once ("{$CONF['path']}/button_config.php"); $DB = "sql_{$CONF['sql']}"; $DB = new $DB; $DB->connect($CONF['sql_host'], $CONF['sql_username'], $CONF['sql_password'], $CONF['sql_database'], $CONF['debug']); $TMPL['rand'] = rand(1, 1000); // Settings $settings = $DB->fetch("SELECT * FROM {$CONF['sql_prefix']}_settings", __FILE__, __LINE__); $CONF = array_merge($CONF, $settings); // Hide PV Data if not enabled if ($CONF['count_pv'] != 1) { $TMPL['pv_hide'] = ' style="display: none;"'; } // The language file $LNG['charset'] = "utf-8"; require_once ("{$CONF['path']}/languages/english.php"); require_once ("{$CONF['path']}/languages/{$CONF['default_language']}.php"); // URL Helpers if ($CONF['clean_url'] == 1) { $TMPL['url_tail'] = '/'; $TMPL['url_helper_a'] = ''; $TMPL['url_helper_u'] = '/'; $TMPL['url_helper_cat'] = 'category/'; $TMPL['url_helper_cat2'] = '/category/'; $TMPL['url_helper_rate'] = 'review'; $TMPL['url_helper_b'] = '/'; $TMPL['url_helper_id'] = '/'; $TMPL['url_helper_method'] = 'rank/'; $TMPL['url_helper_q'] = '/'; $TMPL['url_helper_start'] = '/'; } else { $TMPL['url_tail'] = ''; $TMPL['url_helper_a'] = '?a='; $TMPL['url_helper_u'] = '&u='; $TMPL['url_helper_cat'] = '?cat='; $TMPL['url_helper_cat2'] = '&cat='; $TMPL['url_helper_rate'] = 'rate'; $TMPL['url_helper_b'] = '&b='; $TMPL['url_helper_id'] = '&id='; $TMPL['url_helper_method'] = '?method='; $TMPL['url_helper_q'] = '&q='; $TMPL['url_helper_start'] = '&start='; } // Ad Breaks $ad_breaks = explode(',', $CONF['ad_breaks']); $CONF['ad_breaks'] = array(); foreach ($ad_breaks as $key => $value) { $CONF['ad_breaks'][$value] = $value; } //Initialize some vars for skin plugins, move this to better locations as time allows $TMPL['join_user_extra'] = ''; $TMPL['join_website_extra'] = ''; $TMPL['join_security_extra'] = ''; $TMPL['edit_website_extra'] = ''; $TMPL['front_page_after_content'] = ''; $TMPL['table_wrap_before_content'] = ''; $TMPL['table_wrap_after_content'] = ''; $TMPL['css_styles'] = ''; $TMPL['user_cp_main_menu'] = ''; $TMPL['front_page_top'] = ''; $TMPL['sidebar_1_top'] = ''; $TMPL['sidebar_1_bottom'] = ''; $TMPL['featured_member'] = ''; $TMPL['multiple_pages_p'] = ''; $TMPL['multiple_pages_links'] = ''; $TMPL['user_cp_score'] = ''; $TMPL['extra_javascripts'] = ''; $TMPL['multiple_pages_n'] = ''; $TMPL['currency_code'] = $CONF['currency_code']; $TMPL['currency_symbol'] = $CONF['currency_symbol']; //Start Up The Plugin manager include ('plugins.php'); pluginManager::getPluginManager(); // Lets load The Plugin Language Files $plugin_dir = opendir("{$CONF['path']}/plugins/"); while (false !== ($plugin_subdir = readdir($plugin_dir))) { if ($plugin_subdir != '.' && $plugin_subdir != '..' && $plugin_subdir != 'index.htm') { include ('plugins/' . $plugin_subdir . '/languages/english.php'); if (file_exists('plugins/' . $plugin_subdir . '/languages/' . $CONF['default_language'] . '.php')) { include ('plugins/' . $plugin_subdir . '/languages/' . $CONF['default_language'] . '.php'); } } } /* function correct_encoding(&$item1, $key, $prefix) { //$current_encoding = mb_detect_encoding($item1, 'auto'); $item1 = iconv(mb_detect_encoding($item1, 'auto'), 'UTF-8', $item1); } array_walk($LNG, 'correct_encoding', $LNG); */ // Convert previously wrong encoded LNG vars function icon_convert(&$item1, $key, $prefix) { $item1 = iconv("cp1251", "UTF-8", $item1); } array_walk($LNG, 'icon_convert', $LNG); //Hook Location eval(PluginManager::getPluginManager()->pluginHooks('global_start')); $CONF['skins_path'] = "{$CONF['path']}/skins"; $CONF['skins_url'] = "{$CONF['list_url']}/skins"; $TMPL['skins_url'] = $CONF['skins_url']; $TMPL['list_name'] = $CONF['list_name']; $TMPL['list_url'] = $CONF['list_url']; // Combine the GET and POST input $FORM = array_merge($_GET, $_POST); $result = $DB->query("SELECT category, skin, cat_description, cat_keywords FROM {$CONF['sql_prefix']}_categories ORDER BY category", __file__, __line__); while (list($category, $skin, $cat_description, $cat_keywords) = $DB-> fetch_array($result)) { $CONF['categories'][$category]['skin'] = $skin; $CONF['categories'][$category]['cat_desc'] = $cat_description; $CONF['categories'][$category]['cat_key'] = $cat_keywords; } // Does FORM['cat'] exist? foreach ($CONF['categories'] as $cat => $skin) { // Unchanged category name array $category_name[] = $cat; // Rewrite category name to structure of category links $category_match[] = preg_replace('/((\&)|(\s))+/', '-', $cat); // Combine name and match, so we can use it to compare $category_combined = array_combine($category_name, $category_match); // See if $FORM cat match value from combined array ($category_match) // This assures that $FORM cat = category_match, therefore we have our needed CONF category // Use tag below to validate category in url instead of isset $TMPL['cat_exist'] = array_search($FORM['cat'], $category_combined); // Does old category links exist? if (preg_match('/((\&)|(\s))/', $FORM['cat']) && $FORM['a'] != 'admin') { $TMPL['old_cat_exist'] = array_search($FORM['cat'], $category_name); } } // Determine the category skin and meta data if ($TMPL['cat_exist']) { $TMPL['skin_name'] = $CONF['categories'][$TMPL['cat_exist']]['skin']; $TMPL['meta_description'] = $CONF['categories'][$TMPL['cat_exist']]['cat_desc']; $TMPL['meta_keywords'] = $CONF['categories'][$TMPL['cat_exist']]['cat_key']; $TMPL['cat_desc'] = $CONF['categories'][$TMPL['cat_exist']]['cat_desc']; } else { $TMPL['skin_name'] = $CONF['default_skin']; } if (!is_dir("{$CONF['path']}/skins/{$TMPL['skin_name']}/") || !$TMPL['skin_name']) { $TMPL['skin_name'] = $CONF['default_skin']; } if (!is_dir("{$CONF['path']}/skins/{$CONF['default_skin']}/")) { $TMPL['skin_name'] = 'parabola'; } require_once ("{$CONF['path']}/sources/misc/skin.php"); if (isset($FORM['a'])) { if ($FORM['a'] == 'admin') { $TMPL['skin_name'] = 'admin'; } } // Is it a new day/week/month? list($last_new_day, $last_new_week, $last_new_month, $TMPL['original_version']) = $DB->fetch("SELECT last_new_day, last_new_week, last_new_month, original_version FROM {$CONF['sql_prefix']}_etc", __file__, __line__); $time = time() + (3600 * $CONF['time_offset']); $current_day = date('d', $time); $current_week = date('W', $time); $current_month = date('m', $time); if ($last_new_day != $current_day) { require_once ("{$CONF['path']}/sources/misc/new_day.php"); new_day($current_day); } if ($last_new_week != $current_week) { require_once ("{$CONF['path']}/sources/misc/new_day.php"); new_week($current_week); } if ($last_new_month != $current_month) { require_once ("{$CONF['path']}/sources/misc/new_day.php"); new_month($current_month); } // Adjust the output text based on days, weeks, or months if ($CONF['ranking_period'] == 'weekly') { $LNG['g_this_period'] = $LNG['g_this_week']; $LNG['g_last_period'] = $LNG['g_last_week']; } elseif ($CONF['ranking_period'] == 'monthly') { $LNG['g_this_period'] = $LNG['g_this_month']; $LNG['g_last_period'] = $LNG['g_last_month']; } else { $LNG['g_this_period'] = $LNG['g_today']; $LNG['g_last_period'] = $LNG['g_yesterday']; } // Check if installer is there if (file_exists("{$CONF['path']}/install/")) { $TMPL['header'] = $LNG['g_error']; $base = new base; $base->error($LNG['g_delete_install']); } // Check for hits in require_once ("{$CONF['path']}/sources/in.php"); $in = new in; // Array containing the valid .php files from the sources directory $action = array( 'admin' => 1, 'in' => 1, 'join' => 1, 'lost_pw' => 1, 'out' => 1, 'page' => 1, 'rankings' => 1, 'rate' => 1, 'search' => 1, 'stats' => 1, 'sendmessage' => 1, 'user_cpl' => 1 ); eval(PluginManager::getPluginManager()->pluginHooks('action_array')); // Redirect old category links to new ones if clean_urls are off if ($TMPL['old_cat_exist']) { $new_cat = preg_replace('/((\%26)|(\+))+/', '-', $_SERVER['REQUEST_URI']); $new_cat_url = 'http://' . $_SERVER['SERVER_NAME'] . $new_cat; Header("HTTP/1.1 301 Moved Permanently"); Header('Location: ' . $new_cat_url); } // Require the appropriate file if (isset($FORM['a']) && isset($action[$FORM['a']])) { $page_name = $FORM['a']; $page_name_path = $FORM['a']; } elseif (isset($FORM['app']) && isset($action[$FORM['app']])) { $page_name = $FORM['app']; $page_name_path = 'mod/' . $FORM['app']; } else { $page_name = 'rankings'; $page_name_path = 'rankings'; } eval(PluginManager::getPluginManager()->pluginHooks('include_source')); require_once ("{$CONF['path']}/sources/{$page_name_path}.php"); $page = new $page_name; // Begin detect user_cp or login mvoe html to templates befroe release if($FORM['a'] != 'admin') { if (isset($_COOKIE['atsphp_sid_user_cp'])) { require_once ("{$CONF['path']}/sources/misc/session.php"); $session = new session; list($type, $data) = $session->get($_COOKIE['atsphp_sid_user_cp']); $TMPL['wrapper_username'] = $DB->escape($data); } if (isset($TMPL['wrapper_username']) && $TMPL['wrapper_username']) { //$TMPL['wrapper_welcome'] = "
{$LNG['g_welcome']} {$TMPL['wrapper_username']}!
"; $TMPL['wrapper_welcome'] = base::do_skin('welcome_logged_in'); } else { $TMPL['wrapper_username'] = ''; $TMPL['wrapper_welcome'] = base::do_skin('welcome_not_logged_in'); } } // Display the page $skin = new main_skin('wrapper'); echo $skin->make(); $DB->close(); // Print out debugging info, if necessary if ($CONF['debug'] == 1) { ini_set('display_errors', 1); error_reporting(E_ALL | E_STRICT); echo '
'; foreach ($DB->queries as $value) { echo "
{$value}
"; } echo '
';
    print_r($_REQUEST);
    echo '
'; echo '
'; } else { //error_reporting(E_ERROR | E_PARSE); }