} require './pagestart.php'; $max_forum_name_len = 30; $max_forum_rows = 25; require INC_DIR . 'functions_admin_torrent.php'; $submit = isset($_POST['submit']); $confirm = isset($_POST['confirm']); $cfg = array(); // All config names with default values $default_cfg_str = array('bt_announce_url' => 'http://demo.torrentpier.me/bt/'); $default_cfg_bool = array('bt_disable_dht' => 1, 'bt_show_peers' => 1, 'bt_add_auth_key' => 1, 'bt_show_dl_list' => 0, 'bt_dl_list_only_1st_page' => 1, 'bt_dl_list_only_count' => 1, 'bt_replace_ann_url' => 1, 'bt_show_ip_only_moder' => 1, 'bt_show_port_only_moder' => 1, 'bt_check_announce_url' => 0, 'bt_show_dl_list_buttons' => 1, 'bt_show_dl_but_will' => 1, 'bt_show_dl_but_down' => 0, 'bt_show_dl_but_compl' => 1, 'bt_show_dl_but_cancel' => 1, 'bt_show_dl_stat_on_index' => 1, 'bt_newtopic_auto_reg' => 1, 'bt_tor_browse_only_reg' => 1, 'bt_search_bool_mode' => 1, 'bt_allow_spmode_change' => 1, 'bt_del_addit_ann_urls' => 1, 'bt_set_dltype_on_tor_reg' => 1, 'bt_unset_dltype_on_tor_unreg' => 1); $default_cfg_num = array('bt_show_peers_mode' => SHOW_PEERS_COUNT); $default_cfg = array_merge($default_cfg_str, $default_cfg_bool, $default_cfg_num); $db_fields_bool = array('allow_reg_tracker' => 0, 'allow_porno_topic' => 0, 'self_moderated' => 0); // Get config $cfg = bb_get_config(BB_CONFIG, true, false); // Submit new config if ($submit && $confirm) { foreach ($db_fields_bool as $field_name => $field_def_val) { update_table_bool(BB_FORUMS, 'forum_id', $field_name, $field_def_val); } update_config_table(BB_CONFIG, $default_cfg_str, $cfg, 'str'); update_config_table(BB_CONFIG, $default_cfg_bool, $cfg, 'bool'); update_config_table(BB_CONFIG, $default_cfg_num, $cfg, 'num'); $datastore->update('cat_forums'); bb_die($lang['CONFIG_UPD'] . '<br /><br />' . sprintf($lang['RETURN_CONFIG'], '<a href="admin_bt_forum_cfg.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>')); } // Set template vars set_tpl_vars($default_cfg_str, $cfg); set_tpl_vars_lang($default_cfg_str); set_tpl_vars_bool($default_cfg_bool, $cfg);
return (string) htmlspecialchars($txt, $quote_style, $charset, $double_encode); } function html_ent_decode($txt, $quote_style = ENT_QUOTES, $charset = 'UTF-8') { return (string) html_entity_decode($txt, $quote_style, $charset); } function make_url($path = '') { return FULL_URL . preg_replace('#^\\/?(.*?)\\/?$#', '\\1', $path); } require INC_DIR . 'functions.php'; require INC_DIR . 'sessions.php'; require INC_DIR . 'template.php'; require CORE_DIR . 'mysql.php'; define('SQL_LAYER', 'mysql'); $bb_cfg = array_merge(bb_get_config(BB_CONFIG), $bb_cfg); $user = new user_common(); $userdata =& $user->data; if (DBG_USER) { require INC_DIR . 'functions_dev.php'; } $html = new html_common(); $log_action = new log_action(); $ads = new ads_common(); // TODO temporarily 'cat_forums' always enqueued $datastore->enqueue(array('cat_forums')); // Дата старта вашего проекта if (!$bb_cfg['board_startdate']) { bb_update_config(array('board_startdate' => TIMENOW)); DB()->query("UPDATE " . BB_USERS . " SET user_regdate = " . TIMENOW . " WHERE user_id IN(2, " . EXCLUDED_USERS_CSV . ")"); }
function bb_update_config($params, $table = BB_CONFIG) { $updates = array(); foreach ($params as $name => $val) { $updates[] = array('config_name' => $name, 'config_value' => $val); } $updates = DB()->build_array('MULTI_INSERT', $updates); DB()->query("REPLACE INTO {$table} {$updates}"); // Update cache bb_get_config($table, true, true); }