get rid of global $F
This commit is contained in:
16
chat.php
16
chat.php
@ -34,7 +34,6 @@
|
|||||||
|
|
||||||
send_headers();
|
send_headers();
|
||||||
// initialize and load variables/configuration
|
// initialize and load variables/configuration
|
||||||
$F=[];// Fonts
|
|
||||||
$I=[];// Translations
|
$I=[];// Translations
|
||||||
$L=[];// Languages
|
$L=[];// Languages
|
||||||
$U=[];// This user data
|
$U=[];// This user data
|
||||||
@ -46,7 +45,6 @@ load_config();
|
|||||||
if(!isSet($_REQUEST['session']) && isSet($_COOKIE[COOKIENAME])){
|
if(!isSet($_REQUEST['session']) && isSet($_COOKIE[COOKIENAME])){
|
||||||
$_REQUEST['session']=$_COOKIE[COOKIENAME];
|
$_REQUEST['session']=$_COOKIE[COOKIENAME];
|
||||||
}
|
}
|
||||||
load_fonts();
|
|
||||||
load_lang();
|
load_lang();
|
||||||
check_db();
|
check_db();
|
||||||
route();
|
route();
|
||||||
@ -316,7 +314,7 @@ function form($action, $do=''){
|
|||||||
|
|
||||||
function form_target($target, $action, $do=''){
|
function form_target($target, $action, $do=''){
|
||||||
global $language;
|
global $language;
|
||||||
return "<form action=\"$_SERVER[SCRIPT_NAME]\" enctype=\"multipart/form-data\" method=\"post\" target=\"$target\">".hidden('lang', $language).hidden('nc', substr(time(), -6)).hidden('action', $action);
|
$form="<form action=\"$_SERVER[SCRIPT_NAME]\" enctype=\"multipart/form-data\" method=\"post\" target=\"$target\">".hidden('lang', $language).hidden('nc', substr(time(), -6)).hidden('action', $action);
|
||||||
if(!empty($_REQUEST['session'])){
|
if(!empty($_REQUEST['session'])){
|
||||||
$form.=hidden('session', $_REQUEST['session']);
|
$form.=hidden('session', $_REQUEST['session']);
|
||||||
}
|
}
|
||||||
@ -1826,7 +1824,7 @@ function send_help(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function send_profile($arg=''){
|
function send_profile($arg=''){
|
||||||
global $F, $I, $L, $U, $db, $language;
|
global $I, $L, $U, $db, $language;
|
||||||
print_start('profile');
|
print_start('profile');
|
||||||
echo form('profile', 'save')."<h2>$I[profile]</h2><i>$arg</i><table>";
|
echo form('profile', 'save')."<h2>$I[profile]</h2><i>$arg</i><table>";
|
||||||
thr();
|
thr();
|
||||||
@ -1867,6 +1865,7 @@ function send_profile($arg=''){
|
|||||||
if($U['status']>=3){
|
if($U['status']>=3){
|
||||||
echo "<tr><td><table id=\"font\"><tr><th>$I[fontface]</th><td><table>";
|
echo "<tr><td><table id=\"font\"><tr><th>$I[fontface]</th><td><table>";
|
||||||
echo "<tr><td> </td><td><select name=\"font\" size=\"1\"><option value=\"\">* $I[roomdefault] *</option>";
|
echo "<tr><td> </td><td><select name=\"font\" size=\"1\"><option value=\"\">* $I[roomdefault] *</option>";
|
||||||
|
$F=load_fonts();
|
||||||
foreach($F as $name=>$font){
|
foreach($F as $name=>$font){
|
||||||
echo "<option style=\"$font\" ";
|
echo "<option style=\"$font\" ";
|
||||||
if(strpos($U['style'], $font)!==false){
|
if(strpos($U['style'], $font)!==false){
|
||||||
@ -2676,7 +2675,7 @@ function passreset($nick, $pass){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function amend_profile(){
|
function amend_profile(){
|
||||||
global $F, $U;
|
global $U;
|
||||||
if(isSet($_REQUEST['refresh'])){
|
if(isSet($_REQUEST['refresh'])){
|
||||||
$U['refresh']=$_REQUEST['refresh'];
|
$U['refresh']=$_REQUEST['refresh'];
|
||||||
}
|
}
|
||||||
@ -2696,6 +2695,7 @@ function amend_profile(){
|
|||||||
}
|
}
|
||||||
$U['style']="color:#$colour;";
|
$U['style']="color:#$colour;";
|
||||||
if($U['status']>=3){
|
if($U['status']>=3){
|
||||||
|
$F=load_fonts();
|
||||||
if(isSet($F[$_REQUEST['font']])){
|
if(isSet($F[$_REQUEST['font']])){
|
||||||
$U['style'].=$F[$_REQUEST['font']];
|
$U['style'].=$F[$_REQUEST['font']];
|
||||||
}
|
}
|
||||||
@ -3594,7 +3594,7 @@ function init_chat(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function update_db(){
|
function update_db(){
|
||||||
global $F, $I, $db, $memcached;
|
global $I, $db, $memcached;
|
||||||
$dbversion=(int) get_setting('dbversion');
|
$dbversion=(int) get_setting('dbversion');
|
||||||
if($dbversion<DBVERSION || get_setting('msgencrypted')!=MSGENCRYPTED){
|
if($dbversion<DBVERSION || get_setting('msgencrypted')!=MSGENCRYPTED){
|
||||||
ignore_user_abort(true);
|
ignore_user_abort(true);
|
||||||
@ -3668,6 +3668,7 @@ function update_db(){
|
|||||||
$db->exec('ALTER TABLE ' . PREFIX . 'members ADD style varchar(255) NOT NULL;');
|
$db->exec('ALTER TABLE ' . PREFIX . 'members ADD style varchar(255) NOT NULL;');
|
||||||
$result=$db->query('SELECT * FROM ' . PREFIX . 'members;');
|
$result=$db->query('SELECT * FROM ' . PREFIX . 'members;');
|
||||||
$stmt=$db->prepare('UPDATE ' . PREFIX . 'members SET style=? WHERE id=?;');
|
$stmt=$db->prepare('UPDATE ' . PREFIX . 'members SET style=? WHERE id=?;');
|
||||||
|
$F=load_fonts();
|
||||||
while($temp=$result->fetch(PDO::FETCH_ASSOC)){
|
while($temp=$result->fetch(PDO::FETCH_ASSOC)){
|
||||||
$style="color:#$temp[colour];";
|
$style="color:#$temp[colour];";
|
||||||
if(isSet($F[$temp['fontface']])){
|
if(isSet($F[$temp['fontface']])){
|
||||||
@ -3994,8 +3995,7 @@ function check_db(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function load_fonts(){
|
function load_fonts(){
|
||||||
global $F;
|
return [
|
||||||
$F=[
|
|
||||||
'Arial' =>"font-family:'Arial','Helvetica','sans-serif';",
|
'Arial' =>"font-family:'Arial','Helvetica','sans-serif';",
|
||||||
'Book Antiqua' =>"font-family:'Book Antiqua','MS Gothic';",
|
'Book Antiqua' =>"font-family:'Book Antiqua','MS Gothic';",
|
||||||
'Comic' =>"font-family:'Comic Sans MS','Papyrus';",
|
'Comic' =>"font-family:'Comic Sans MS','Papyrus';",
|
||||||
|
Reference in New Issue
Block a user