function update_config_table($table_name, $default_cfg, $cfg, $type) { foreach ($default_cfg as $config_name => $config_value) { if (isset($_POST[$config_name]) && $_POST[$config_name] != $cfg[$config_name]) { if ($type == 'str') { $config_value = $_POST[$config_name]; } else { if ($type == 'bool') { $config_value = $_POST[$config_name] ? 1 : 0; } else { if ($type == 'num') { $config_value = abs(intval($_POST[$config_name])); } else { return; } } } bb_update_config(array($config_name => $config_value), $table_name); } } }
} $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 . ")"); } // Cron if (empty($_POST) && !defined('IN_ADMIN') && !defined('IN_AJAX') && !file_exists(CRON_RUNNING) && ($bb_cfg['cron_enabled'] || defined('START_CRON')) || defined('FORCE_CRON')) { if (TIMENOW - $bb_cfg['cron_last_check'] > $bb_cfg['cron_check_interval']) { // Update cron_last_check bb_update_config(array('cron_last_check' => TIMENOW + 10)); define('CRON_LOG_ENABLED', true); // global ON/OFF define('CRON_FORCE_LOG', false); // always log regardless of job settings define('CRON_DIR', INC_DIR . 'cron/'); define('CRON_JOB_DIR', CRON_DIR . 'jobs/'); define('CRON_LOG_DIR', 'cron/'); // inside LOG_DIR define('CRON_LOG_FILE', 'cron'); // without ext bb_log(date('H:i:s - ') . getmypid() . ' -x-- DB-LOCK try' . LOG_LF, CRON_LOG_DIR . 'cron_check'); if (DB()->get_lock('cron', 1)) { bb_log(date('H:i:s - ') . getmypid() . ' --x- DB-LOCK OBTAINED !!!!!!!!!!!!!!!!!' . LOG_LF, CRON_LOG_DIR . 'cron_check'); sleep(2); require CRON_DIR . 'cron_init.php';
<?php if (!empty($setmodules)) { $module['GENERAL']['TERMS'] = basename(__FILE__); return; } require './pagestart.php'; require INC_DIR . 'bbcode.php'; if (isset($_POST['post']) && $bb_cfg['terms'] != $_POST['message']) { bb_update_config(array('terms' => $_POST['message'])); bb_die($lang['CONFIG_UPDATED']); } $template->assign_vars(array('S_ACTION' => 'admin_terms.php', 'EXT_LINK_NW' => $bb_cfg['ext_link_new_win'], 'MESSAGE' => $bb_cfg['terms'] ? $bb_cfg['terms'] : '', 'PREVIEW_HTML' => isset($_REQUEST['preview']) ? bbcode2html($_POST['message']) : '')); print_page('admin_terms.tpl', 'admin');
$short[] = join(",\n", $users); } $logged_online += count($users); } $online['userlist'] = join(",\n", $inline) . join("\n", $block); $online_short['userlist'] = join(",\n", $short); } if (!$online['userlist']) { $online['userlist'] = $online_short['userlist'] = $lang['NONE']; } else { if (isset($_REQUEST['f'])) { $online['userlist'] = $online_short['userlist'] = $lang['BROWSING_FORUM'] . ' ' . $online['userlist']; } } $total_online = $logged_online + $guests_online; if ($total_online > $bb_cfg['record_online_users']) { bb_update_config(array('record_online_users' => $total_online, 'record_online_date' => TIMENOW)); } $online['stat'] = $online_short['stat'] = sprintf($lang['ONLINE_USERS'], $total_online, $logged_online, $guests_online); $online['cnt'] = $online_short['cnt'] = <<<HTML [ \t<span class="colorAdmin bold">{$users_cnt['admin']}</span> <span class="small">·</span> \t<span class="colorMod bold">{$users_cnt['mod']}</span> <span class="small">·</span> \t<span class="colorGroup bold">{$users_cnt['group_member']}</span> <span class="small">·</span> \t<span class="colorISL">{$users_cnt['ignore_load']}</span> <span class="small">·</span> \t<span>{$users_cnt['user']}</span> <span class="small">·</span> \t<span>{$users_cnt['guest']}</span> ] HTML; CACHE('bb_cache')->set('online_' . $userdata['user_lang'], $online, 60); CACHE('bb_cache')->set('online_short_' . $userdata['user_lang'], $online_short, 60);
// Pull all config data // $sql = "SELECT * FROM " . BB_CONFIG; if (!($result = DB()->sql_query($sql))) { bb_die('Could not query config information in admin_board'); } else { while ($row = DB()->sql_fetchrow($result)) { $config_name = $row['config_name']; $config_value = $row['config_value']; $default_config[$config_name] = $config_value; $new[$config_name] = isset($_POST[$config_name]) ? $_POST[$config_name] : $default_config[$config_name]; if (isset($_POST['submit']) && $row['config_value'] != $new[$config_name]) { if ($config_name == 'seed_bonus_points' || $config_name == 'seed_bonus_release' || $config_name == 'bonus_upload' || $config_name == 'bonus_upload_price') { $new[$config_name] = serialize(str_replace(',', '.', $new[$config_name])); } bb_update_config(array($config_name => $new[$config_name])); } } if (isset($_POST['submit'])) { bb_die($lang['CONFIG_UPDATED'] . $return_links[$mode] . $return_links['index']); } } switch ($mode) { case 'config_mods': $template->assign_vars(array('S_CONFIG_ACTION' => 'admin_board.php?mode=config_mods', 'CONFIG_MODS' => true, 'MAGNET_LINKS_ENABLED' => $new['magnet_links_enabled'], 'GENDER' => $new['gender'], 'CALLSEED' => $new['callseed'], 'TOR_STATS' => $new['tor_stats'], 'SHOW_LATEST_NEWS' => $new['show_latest_news'], 'MAX_NEWS_TITLE' => $new['max_news_title'], 'LATEST_NEWS_COUNT' => $new['latest_news_count'], 'LATEST_NEWS_FORUM_ID' => $new['latest_news_forum_id'], 'SHOW_NETWORK_NEWS' => $new['show_network_news'], 'MAX_NET_TITLE' => $new['max_net_title'], 'NETWORK_NEWS_COUNT' => $new['network_news_count'], 'NETWORK_NEWS_FORUM_ID' => $new['network_news_forum_id'], 'WHOIS_INFO' => $new['whois_info'], 'SHOW_MOD_INDEX' => $new['show_mod_index'], 'BIRTHDAY_ENABLED' => $new['birthday_enabled'], 'BIRTHDAY_MAX_AGE' => $new['birthday_max_age'], 'BIRTHDAY_MIN_AGE' => $new['birthday_min_age'], 'BIRTHDAY_CHECK_DAY' => $new['birthday_check_day'], 'PREMOD' => $new['premod'], 'TOR_COMMENT' => $new['tor_comment'], 'NEW_TPLS' => $new['new_tpls'], 'SEED_BONUS_ENABLED' => $new['seed_bonus_enabled'], 'SEED_BONUS_TOR_SIZE' => $new['seed_bonus_tor_size'], 'SEED_BONUS_USER_REGDATE' => $new['seed_bonus_user_regdate'])); if ($new['seed_bonus_points'] && $new['seed_bonus_release']) { $seed_bonus = unserialize($new['seed_bonus_points']); $seed_release = unserialize($new['seed_bonus_release']); foreach ($seed_bonus as $i => $row) { if (!$row || !$seed_release[$i]) { continue;
// if ($bb_cfg['show_latest_news'] and $news_forum_ids = $bb_cfg['latest_news_forum_id']) { $news_count = max($bb_cfg['latest_news_count'], 1); $data = DB()->fetch_rowset("\n\t\tSELECT topic_id, topic_time, topic_title, forum_id\n\t\tFROM " . BB_TOPICS . "\n\t\tWHERE forum_id IN ({$news_forum_ids})\n\t\t\tAND topic_moved_id = 0\n\t\tORDER BY topic_time DESC\n\t\tLIMIT {$news_count}\n\t"); $this->store('latest_news', $data); } // // Network_news // if ($bb_cfg['show_network_news'] and $net_forum_ids = $bb_cfg['network_news_forum_id']) { $net_count = max($bb_cfg['network_news_count'], 1); $data = DB()->fetch_rowset("\n\t\tSELECT topic_id, topic_time, topic_title, forum_id\n\t\tFROM " . BB_TOPICS . "\n\t\tWHERE forum_id IN ({$net_forum_ids})\n\t\t\tAND topic_moved_id = 0\n\t\tORDER BY topic_time DESC\n\t\tLIMIT {$net_count}\n\t"); $this->store('network_news', $data); } // // Ads // if ($bb_cfg['show_ads']) { $ad_html = $ad_block_assignment = array(); $active_ads = DB()->fetch_rowset("\n\t\tSELECT *\n\t\tFROM " . BB_ADS . "\n\t\tWHERE ad_status = 1\n\t\t\tAND ad_start_time < NOW()\n\t\t\tAND DATE_ADD(ad_start_time, INTERVAL ad_active_days DAY) > NOW()\n\t"); foreach ($active_ads as $ad) { if ($ad['ad_block_ids']) { foreach (explode(',', $ad['ad_block_ids']) as $block_id) { $ad_block_assignment[$block_id][] = $ad['ad_id']; } } $ad_html[$ad['ad_id']] = $ad['ad_html']; } $this->store('ads', $ad_html); bb_update_config(array('active_ads' => serialize($ad_block_assignment))); }
if (!empty($setmodules)) { $module['MODS']['SITEMAP'] = basename(__FILE__); return; } require './pagestart.php'; require INC_DIR . 'functions_selects.php'; $sql = "SELECT * FROM " . BB_CONFIG; if (!($result = DB()->sql_query($sql))) { bb_die('Could not query config information in admin_sitemap'); } else { $new_params = array(); while ($row = DB()->sql_fetchrow($result)) { $config_name = $row['config_name']; $config_value = $row['config_value']; $default_config[$config_name] = $config_value; $new[$config_name] = isset($_POST[$config_name]) ? $_POST[$config_name] : $default_config[$config_name]; if (isset($_POST['submit']) && $row['config_value'] != $new[$config_name]) { $new_params[$config_name] = $new[$config_name]; } } if (isset($_POST['submit'])) { if (!empty($new_params)) { bb_update_config($new_params); } } } $s_mess = $lang['SITEMAP_CREATED'] . ': <b>' . bb_date($new['sitemap_time'], $bb_cfg['post_date_format']) . '</b> ' . $lang['SITEMAP_AVAILABLE'] . ': <a href="' . make_url('sitemap.xml') . '" target="_blank">' . make_url('sitemap.xml') . '</a>'; $message = @file_exists(BB_ROOT . "/internal_data/sitemap/sitemap.xml") ? $s_mess : $lang['SITEMAP_NOT_CREATED']; $template->assign_vars(array('STATIC_SITEMAP' => $new['static_sitemap'], 'MESSAGE' => $message)); print_page('admin_sitemap.tpl', 'admin');
function create() { $row = DB()->fetch_row("SELECT COUNT(*) AS count FROM " . BB_TOPICS); if (!$this->limit) { $this->limit = $row['count']; } if ($this->limit > 40000) { $pages_count = @ceil($row['count'] / 40000); $sitemap = $this->build_index($pages_count); $handler = fopen(SITEMAP_DIR . "sitemap.xml", "wb+"); fwrite($handler, $sitemap); fclose($handler); @chmod(SITEMAP_DIR . "sitemap.xml", 0666); $sitemap = $this->build_stat(); $handler = fopen(SITEMAP_DIR . "sitemap1.xml", "wb+"); fwrite($handler, $sitemap); fclose($handler); @chmod(SITEMAP_DIR . "sitemap.xml", 0666); for ($i = 0; $i < $pages_count; $i++) { $t = $i + 2; $n = $i + 1; $sitemap = $this->build_map_topic($n); $handler = fopen(SITEMAP_DIR . "sitemap{$t}.xml", "wb+"); fwrite($handler, $sitemap); fclose($handler); @chmod(SITEMAP_DIR . "sitemap{$t}.xml", 0666); } } else { $sitemap = $this->build_map(); $handler = fopen(SITEMAP_DIR . "sitemap.xml", "wb+"); fwrite($handler, $sitemap); fclose($handler); @chmod(SITEMAP_DIR . "sitemap.xml", 0666); } $params['sitemap_time'] = TIMENOW; bb_update_config($params); }