HTML Code:
<?php
// +--------------------------------------------------------------------+
// | vBindex Version 3.0.0 Release Candidate 5 (UK English)
// | Copyright (C) MMII - MMIV Winter Systems
// +--------------------------------------------------------------------+
// | vbioptions.php, v3.0.4
// |--------------------------------------------------------------------+
// | Support will only be given at Core Forums (http://www.coreforums.net)
// | to those who have confirmed they are licenced, or at vBulletin.org
// | via the vBindex 3.x thread listed bellow.
// +--------------------------------------------------------------------+
// | v1.x Release(s) by el3m3nt:
// | (https://vborg.vbsupport.ru/showthread.php?threadid=37021)
// | v2.x Release(s) by NTLDR (aka Eldorado):
// | (https://vborg.vbsupport.ru/showthread.php?threadid=41916)
// | v3.x Release(s) by NTLDR (aka Eldorado):
// | (http://www.coreforums.net/forums/showthread.core?threadid=93)
// | (https://vborg.vbsupport.ru/showthread.php?threadid=59524)
// +--------------------------------------------------------------------+
// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// ##################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
// #################### PRE-CACHE TEMPLATES AND DATA ######################
$phrasegroups = array(
'vbindex_cp'
);
$specialtemplates = array(
'vbindex_setting'
);
// ########################## REQUIRE BACK-END ############################
if (@file_exists('../vbiconfig.php')) {
require_once('../vbiconfig.php');
$configpath = '../vbiconfig.php';
} elseif (@file_exists('../../vbiconfig.php')) {
$configpath = '../../vbiconfig.php';
require_once('../../vbiconfig.php');
}
if (!defined('SCRIPT_EXTENSION')) {
// vbiconfig.php couldn't be found, assume .php extension
define('SCRIPT_EXTENSION', '.php');
}
require_once('./global'.SCRIPT_EXTENSION);
// ############################# LOG ACTION ###############################
log_admin_action();
// ########################################################################
// ######################### START MAIN SCRIPT ############################
// ########################################################################
print_cp_header($vbphrase['vbindex_options']);
if (empty($_REQUEST['do'])) {
$_REQUEST['do'] = 'edit';
}
$vbindex = unserialize($datastore['vbindex_setting']);
// ###################### Start edit #######################
if ($_REQUEST['do'] == 'edit') {
print_form_header('vbioptions', 'update');
$coloptions = array(
'0' => $vbphrase['neither'],
'1' => $vbphrase['left'],
'2 ' => $vbphrase['right'],
'64' => $vbphrase['both']
);
if ($vbindex['options'] & 1) {
$col = 1;
} elseif ($vbindex['options'] & 2) {
$col = 2;
} elseif ($vbindex['options'] & 64) {
$col = 64;
}
$colnames = array(
'0' => $vbphrase['leave_unused'],
'latestthreads' => $vbphrase['latest_threads'],
'onlineusers' => $vbphrase['online_users'],
'shoutbox' => $vbphrase['shoutbox'],
'calendar' => $vbphrase['calendar'],
'birthdays' => $vbphrase['birthdays'],
'poll' => $vbphrase['poll']
);
for($box = 1; $box <= $vbindex['customboxes']; $box++) {
$colnames["customblock_$box"] = construct_phrase($vbphrase['custom_block_x'], $box);
}
$totalboxes = 6;
// side options
print_table_header($vbphrase['side_columns']);
print_select_row($vbphrase['columns_to_show'], 'vbi_bit[cols]', $coloptions, $col);
print_input_row($vbphrase['number_of_custom_blocks'], 'vbi_int[customboxes]', $vbindex['customboxes'], 1, 2);
construct_hidden_code('vbi[totalboxes]', $totalboxes);
// left
for($box = 1; $box < ($totalboxes + 1 + $vbindex['customboxes']); $box++) {
print_select_row(construct_phrase($vbphrase['x_box_x'], $vbphrase['left'], $box), "vbi[left_{$box}]", $colnames, $vbindex["left_{$box}"]);
}
// right
for($box = 1; $box < ($totalboxes + 1 + $vbindex['customboxes']); $box++) {
print_select_row(construct_phrase($vbphrase['x_box_x'], $vbphrase['right'], $box), "vbi[right_{$box}]", $colnames, $vbindex["right_{$box}"]);
}
print_table_break();
// news
print_table_header($vbphrase['news']);
print_checkbox_row($vbphrase['news_enabled'], 'vbi_bit[shownews]', iif($vbindex['options'] & 4, 1, 0), 4);
print_checkbox_row($vbphrase['enable_vbwar'], 'vbi_bit[vbwar]', iif($vbindex['options'] & 16777216, 1, 0), 16777216);
print_checkbox_row($vbphrase['news_posters_avatar'], 'vbi_bit[shownewsavatar]', iif($vbindex['options'] & 8, 1, 0), 8);
print_input_row($vbphrase['news_forumid'], 'vbi[newsfid]', $vbindex['newsfid']);
print_input_row($vbphrase['news_posts_to_show'], 'vbi_int[newsposts]', $vbindex['newsposts']);
print_input_row($vbphrase['news_chars_to_show'], 'vbi_int[newscharlimit]', $vbindex['newscharlimit']);
print_checkbox_row($vbphrase['show_subscribed_icon'], 'vbi_bit[subnews]', iif($vbindex['options'] & 256, 1, 0), 256);
print_checkbox_row($vbphrase['show_sticky_news_threads'], 'vbi_bit[stickynews]', iif($vbindex['options'] & 1048576, 1, 0), 1048576);
print_table_break();
// latest threads
print_table_header($vbphrase['latest_threads']);
print_checkbox_row($vbphrase['latest_threads_enabled'], 'vbi_bit[showthreads]', iif($vbindex['options'] & 16, 1, 0), 16);
print_checkbox_row($vbphrase['enable_center_threads'], 'vbi_bit[showcenterthreads]', iif($vbindex['options'] & 134217728, 1, 0), 134217728);
print_input_row($vbphrase['recent_threads_to_show'], 'vbi_int[maxlthreads]', $vbindex['maxlthreads']);
print_checkbox_row($vbphrase['show_subscribed_icon'], 'vbi_bit[subthreads]', iif($vbindex['options'] & 512, 1, 0), 512);
print_table_break();
// poll
print_table_header($vbphrase['poll']);
print_checkbox_row($vbphrase['poll_enabled'], 'vbi_bit[pollnews]', iif($vbindex['options'] & 65536, 1, 0), 65536);
print_checkbox_row($vbphrase['random_poll_enabled'], 'vbi_bit[randompoll]', iif($vbindex['options'] & 131072, 1, 0), 131072);
print_input_row($vbphrase['poll_forumid'], 'vbi[pollsforumid]', $vbindex['pollsforumid']);
print_table_break();
// shoutbox
print_table_header($vbphrase['shoutbox']);
print_checkbox_row($vbphrase['shoutbox_enabled'], 'vbi_bit[showshoutbox]', iif($vbindex['options'] & 32, 1, 0), 32);
print_input_row($vbphrase['shouts_to_show'], 'vbi_int[maxshouts]', $vbindex['maxshouts']);
print_checkbox_row($vbphrase['asc_order_shoutbox'], 'vbi_bit[ascshout]', iif($vbindex['options'] & 8388608, 1, 0), 8388608);
print_input_row($vbphrase['shout_wrap_length'], 'vbi_int[shout_wrap_length]', $vbindex['shout_wrap_length']);
print_input_row($vbphrase['max_shout_length'], 'vbi_int[max_shout_length]', $vbindex['max_shout_length']);
print_checkbox_row($vbphrase['scrollable_shoutbox'], 'vbi_bit[shoutbox_type]', iif($vbindex['options'] & 4096, 1, 0), 4096);
print_checkbox_row($vbphrase['shoutbox_showdisabled'], 'vbi_bit[shoutbox_postdisabled]', iif($vbindex['options'] & 262144, 1, 0), 262144);
print_checkbox_row($vbphrase['shout_deletion'], 'vbi_bit[member_shout_delete]', iif($vbindex['options'] & 8192, 1, 0), 8192);
// implode the global shout deletion groups into $vbindex['membergroupids'] so that print_memebergroup_row will check the usergroup boxes
if (is_array($vbindex['global_shout_delete'])) {
$vbindex['membergroupids'] = implode(',', $vbindex['global_shout_delete']);
} else {
$vbindex['membergroupids'] = array(0);
}
print_membergroup_row($vbphrase['global_shout_delete'], 'vbi_ug[global_shout_delete]', 0, $vbindex);
// add 0 to the above array so that the foreach in the update allways has an array to create
construct_hidden_code('vbi_ug[global_shout_delete][]', '0');
print_table_break();
// welcome box
print_table_header($vbphrase['welcome_box']);
print_checkbox_row($vbphrase['enable_new_posts'],'vbi_bit[shownewposts]', iif($vbindex['options'] & 524288, 1, 0), 524288);
print_checkbox_row($vbphrase['show_users_avatar'], 'vbi_bit[showwavatar]', iif($vbindex['options'] & 2048, 1, 0), 2048);
print_input_row($vbphrase['default_guest_avatar'], 'vbi[guestavatar]', $vbindex['guestavatar']);
print_input_row($vbphrase['default_user_avatar'], 'vbi[useravatar]', $vbindex['useravatar']);
print_checkbox_row($vbphrase['new_subscribed_threads'], 'vbi_bit[subnewposts]', iif($vbindex['options'] & 1024, 1, 0), 1024);
print_table_break();
// calendar
print_table_header($vbphrase['calendar']);
print_checkbox_row($vbphrase['enable_calendar'], 'vbi_bit[showcalendar]', iif($vbindex['options'] & 16384, 1, 0), 16384);
print_checkbox_row($vbphrase['enable_todays_birthdays'], 'vbi_bit[showbirthdays]', iif($vbindex['options'] & 32768, 1, 0), 32768);
print_checkbox_row($vbphrase['show_weekends'], 'vbi_bit[showweekends]', iif($vbindex['options'] & 33554432, 1, 0), 33554432);
print_table_break();
// wol
print_table_header($vbphrase['whos_online']);
print_checkbox_row($vbphrase['enable_online_users'], 'vbi_bit[wol]', iif($vbindex['options'] & 128, 1, 0), 128);
print_checkbox_row($vbphrase['enable_online_today'], 'vbi_bit[24wol]', iif($vbindex['options'] & 2097152, 1, 0), 2097152);
print_checkbox_row($vbphrase['enable_online_today_usernames'], 'vbi_bit[24woluser]', iif($vbindex['options'] & 4194304, 1, 0), 4194304);
print_table_break();
// misc
print_table_header($vbphrase['misc']);
print_input_row($vbphrase['exclude_forumids'], 'vbi[limitfids]', $vbindex['limitfids']);
print_table_break();
// save options row
print_submit_row($vbphrase['save']);
}
// ###################### Start insert #######################
if ($_POST['do'] == 'update') {
$_vbindex = array();
$_vbindex['options'] = 0;
// process bitfield options
foreach($_POST['vbi_bit'] AS $value) {
$_vbindex['options'] += intval($value);
}
unset($key, $value);
// process int vals
foreach($_POST['vbi_int'] AS $key => $value) {
$_vbindex["$key"] = intval($value);
}
unset($key, $value);
// process string vals
foreach($_POST['vbi'] AS $key => $value) {
$_vbindex["$key"] = trim($value);
}
unset($key, $value);
// process usergroup options
$is_array = false;
foreach($_POST['vbi_ug'] AS $key => $array) {
foreach($array AS $value) {
if (intval($value) != 0) {
$_vbindex["$key"][] = intval($value);
$is_array = true;
} elseif (!$is_array) {
$_vbindex["$key"] = array();
}
}
}
unset($key, $value, $array, $is_array);
$DB_site->query("UPDATE ".TABLE_PREFIX."datastore SET data = '".addslashes(serialize($_vbindex))."' WHERE title = 'vbindex_setting'");
define('CP_REDIRECT', 'vbioptions'.SCRIPT_EXTENSION.'?do=edit');
print_stop_message('vbindex_settings_saved');
if ($debug) {
echo '<pre>';
print_r($_vbindex);
echo '</pre>';
}
}
print_cp_footer();
?>