Remove global variable for configuration
This commit is contained in:
35
chat.php
35
chat.php
@ -34,7 +34,6 @@
|
|||||||
|
|
||||||
send_headers();
|
send_headers();
|
||||||
// initialize and load variables/configuration
|
// initialize and load variables/configuration
|
||||||
$C=array();// Configuration
|
|
||||||
$F=array();// Fonts
|
$F=array();// Fonts
|
||||||
$H=array();// HTML-stuff
|
$H=array();// HTML-stuff
|
||||||
$I=array();// Translations
|
$I=array();// Translations
|
||||||
@ -145,7 +144,6 @@ function route(){
|
|||||||
send_admin(route_admin());
|
send_admin(route_admin());
|
||||||
}elseif($_REQUEST['action']==='setup'){
|
}elseif($_REQUEST['action']==='setup'){
|
||||||
route_setup();
|
route_setup();
|
||||||
send_setup();
|
|
||||||
}elseif($_REQUEST['action']==='init'){
|
}elseif($_REQUEST['action']==='init'){
|
||||||
init_chat();
|
init_chat();
|
||||||
}else{
|
}else{
|
||||||
@ -219,7 +217,7 @@ function route_admin(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function route_setup(){
|
function route_setup(){
|
||||||
global $C, $U;
|
global $U;
|
||||||
if(!check_init()){
|
if(!check_init()){
|
||||||
send_init();
|
send_init();
|
||||||
}
|
}
|
||||||
@ -236,19 +234,20 @@ function route_setup(){
|
|||||||
$C['settings']=array_merge(array('guestaccess', 'englobalpass', 'globalpass', 'captcha', 'dismemcaptcha', 'topic', 'guestreg', 'defaulttz'), $C['bool_settings'], $C['colour_settings'], $C['msg_settings'], $C['number_settings'], $C['textarea_settings'], $C['text_settings']); // All settings in the database
|
$C['settings']=array_merge(array('guestaccess', 'englobalpass', 'globalpass', 'captcha', 'dismemcaptcha', 'topic', 'guestreg', 'defaulttz'), $C['bool_settings'], $C['colour_settings'], $C['msg_settings'], $C['number_settings'], $C['textarea_settings'], $C['text_settings']); // All settings in the database
|
||||||
if(!isSet($_REQUEST['do'])){
|
if(!isSet($_REQUEST['do'])){
|
||||||
}elseif($_REQUEST['do']==='save'){
|
}elseif($_REQUEST['do']==='save'){
|
||||||
save_setup();
|
save_setup($C);
|
||||||
}elseif($_REQUEST['do']==='backup' && $U['status']==8){
|
}elseif($_REQUEST['do']==='backup' && $U['status']==8){
|
||||||
send_backup();
|
send_backup($C);
|
||||||
}elseif($_REQUEST['do']==='restore' && $U['status']==8){
|
}elseif($_REQUEST['do']==='restore' && $U['status']==8){
|
||||||
restore_backup();
|
restore_backup($C);
|
||||||
send_backup();
|
send_backup($C);
|
||||||
}elseif($_REQUEST['do']==='destroy' && $U['status']==8){
|
}elseif($_REQUEST['do']==='destroy' && $U['status']==8){
|
||||||
if(isSet($_REQUEST['confirm'])){
|
if(isSet($_REQUEST['confirm'])){
|
||||||
destroy_chat();
|
destroy_chat($C);
|
||||||
}else{
|
}else{
|
||||||
send_destroy_chat();
|
send_destroy_chat();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
send_setup($C);
|
||||||
}
|
}
|
||||||
|
|
||||||
// html output subs
|
// html output subs
|
||||||
@ -454,8 +453,8 @@ function send_captcha(){
|
|||||||
echo '</td><td class="right">'.hidden('challenge', $randid).'<input type="text" name="captcha" size="15" autocomplete="off"></td></tr>';
|
echo '</td><td class="right">'.hidden('challenge', $randid).'<input type="text" name="captcha" size="15" autocomplete="off"></td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
function send_setup(){
|
function send_setup($C){
|
||||||
global $C, $H, $I, $U;
|
global $H, $I, $U;
|
||||||
print_start('setup');
|
print_start('setup');
|
||||||
echo "<h2>$I[setup]</h2><$H[form]>$H[commonform]".hidden('action', 'setup').hidden('do', 'save');
|
echo "<h2>$I[setup]</h2><$H[form]>$H[commonform]".hidden('action', 'setup').hidden('do', 'save');
|
||||||
if(!isSet($_REQUEST['session'])){
|
if(!isSet($_REQUEST['session'])){
|
||||||
@ -661,8 +660,8 @@ function send_setup(){
|
|||||||
print_end();
|
print_end();
|
||||||
}
|
}
|
||||||
|
|
||||||
function restore_backup(){
|
function restore_backup($C){
|
||||||
global $C, $db;
|
global $db;
|
||||||
if(!extension_loaded('json')){
|
if(!extension_loaded('json')){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -717,8 +716,8 @@ function restore_backup(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function send_backup(){
|
function send_backup($C){
|
||||||
global $C, $H, $I, $db;
|
global $H, $I, $db;
|
||||||
$code=array();
|
$code=array();
|
||||||
if($_REQUEST['do']==='backup'){
|
if($_REQUEST['do']==='backup'){
|
||||||
if(isSet($_REQUEST['settings'])){
|
if(isSet($_REQUEST['settings'])){
|
||||||
@ -3101,8 +3100,8 @@ function send_headers(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function save_setup(){
|
function save_setup($C){
|
||||||
global $C, $db;
|
global $db;
|
||||||
//sanity checks and escaping
|
//sanity checks and escaping
|
||||||
foreach($C['msg_settings'] as $setting){
|
foreach($C['msg_settings'] as $setting){
|
||||||
$_REQUEST[$setting]=htmlspecialchars($_REQUEST[$setting]);
|
$_REQUEST[$setting]=htmlspecialchars($_REQUEST[$setting]);
|
||||||
@ -3280,8 +3279,8 @@ function check_init(){
|
|||||||
return @$db->query('SELECT * FROM ' . PREFIX . 'settings LIMIT 1;');
|
return @$db->query('SELECT * FROM ' . PREFIX . 'settings LIMIT 1;');
|
||||||
}
|
}
|
||||||
|
|
||||||
function destroy_chat(){
|
function destroy_chat($C){
|
||||||
global $C, $H, $I, $db, $language;
|
global $H, $I, $db, $language;
|
||||||
setcookie(COOKIENAME, false);
|
setcookie(COOKIENAME, false);
|
||||||
print_start('destory');
|
print_start('destory');
|
||||||
$db->exec('DROP TABLE ' . PREFIX . 'captcha;');
|
$db->exec('DROP TABLE ' . PREFIX . 'captcha;');
|
||||||
|
Reference in New Issue
Block a user