Core/Config

* convert configuration from list of constants to object
 * fixes config changes not applying on cli whithout closing and reopening again
 * config variables are no longer embedded in localization text
This commit is contained in:
Sarjuuk
2024-05-28 15:41:44 +02:00
parent 454e09cc78
commit f77d676a19
94 changed files with 1094 additions and 922 deletions

View File

@@ -33,7 +33,7 @@ endif;
<script type="text/javascript">DomContentLoaded.now()</script>
<?php
if (CFG_DEBUG && User::isInGroup(U_GROUP_DEV | U_GROUP_ADMIN)):
if (Cfg::get('DEBUG') >= CLI::LOG_INFO && User::isInGroup(U_GROUP_DEV | U_GROUP_ADMIN)):
?>
<script type="text/javascript">
window.open("/", "SqlLog", "width=1800,height=200,top=100,left=100,status=no,location=no,toolbar=no,menubar=no").document.write('<?=DB::getProfiles();?>');

View File

@@ -1,8 +1,8 @@
<title><?=Util::htmlEscape(implode(' - ', $this->title)); ?></title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="SHORTCUT ICON" href="<?=STATIC_URL; ?>/images/logos/favicon.ico" />
<link rel="search" type="application/opensearchdescription+xml" href="<?=STATIC_URL; ?>/download/searchplugins/aowow.xml" title="Aowow" />
<link rel="SHORTCUT ICON" href="<?=Cfg::get('STATIC_URL'); ?>/images/logos/favicon.ico" />
<link rel="search" type="application/opensearchdescription+xml" href="<?=Cfg::get('STATIC_URL'); ?>/download/searchplugins/aowow.xml" title="Aowow" />
<?php
foreach ($this->css as [$type, $css]):
if ($type == SC_CSS_FILE):
@@ -14,8 +14,8 @@ endforeach;
?>
<script type="text/javascript">
var g_serverTime = new Date('<?=date(Util::$dateFormatInternal); ?>');
var g_staticUrl = "<?=STATIC_URL; ?>";
var g_host = "<?=HOST_URL; ?>";
var g_staticUrl = "<?=Cfg::get('STATIC_URL'); ?>";
var g_host = "<?=Cfg::get('HOST_URL'); ?>";
<?php
if ($this->gDataKey):
echo " var g_dataKey = '".$_SESSION['dataKey']."'\n";
@@ -41,7 +41,7 @@ endif;
</script>
<?php
if (CFG_ANALYTICS_USER):
if (Cfg::get('ANALYTICS_USER')):
?>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
@@ -49,7 +49,7 @@ if (CFG_ANALYTICS_USER):
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', '<?=CFG_ANALYTICS_USER; ?>', 'auto');
ga('create', '<?=Cfg::get('ANALYTICS_USER'); ?>', 'auto');
ga('send', 'pageview');
</script>
<?php

View File

@@ -1,4 +1,4 @@
<h2><img src="<?=STATIC_URL; ?>/images/icons/bubble-big.gif" width="32" height="29" alt="" style="vertical-align:middle;margin-right:8px">Reminder</h2>
<h2><img src="<?=Cfg::get('STATIC_URL'); ?>/images/icons/bubble-big.gif" width="32" height="29" alt="" style="vertical-align:middle;margin-right:8px">Reminder</h2>
Your screenshot will <b class="q10">not</b> be approved if it doesn't correspond to the following guidelines.
<ul>

View File

@@ -1,4 +1,4 @@
<h2><img src="<?=STATIC_URL; ?>/images/icons/bubble-big.gif" width="32" height="29" alt="" style="vertical-align:middle;margin-right:8px">Hinweis</h2>
<h2><img src="<?=Cfg::get('STATIC_URL'); ?>/images/icons/bubble-big.gif" width="32" height="29" alt="" style="vertical-align:middle;margin-right:8px">Hinweis</h2>
Euer Screenshot wird <b class="q10">nicht</b> zugelassen werden, wenn er nicht unseren Richtlinien entspricht.
<ul>

View File

@@ -1,4 +1,4 @@
<h2><img src="<?=STATIC_URL; ?>/images/icons/bubble-big.gif" width="32" height="29" alt="" style="vertical-align:middle;margin-right:8px">提醒</h2>
<h2><img src="<?=Cfg::get('STATIC_URL'); ?>/images/icons/bubble-big.gif" width="32" height="29" alt="" style="vertical-align:middle;margin-right:8px">提醒</h2>
你的截图将<b class="q10">不会</b> 通过审查假设不符合下列准则。
<ul>

View File

@@ -61,7 +61,7 @@
<div class="pad3"></div>
<?php
if (CFG_ACC_ALLOW_REGISTER):
if (Cfg::get('ACC_ALLOW_REGISTER')):
echo ' <div style="text-align: center; line-height: 1.5em; font-size: 125%">'.Lang::account('accCreate')."</div>\n";
endif;
?>

View File

@@ -54,7 +54,7 @@ $this->brick('pageTemplate');
<td><select name="locale" id="locale" required="required" size="1">
<?php
foreach (Lang::locales() as $i => $l):
if (CFG_LOCALES & (1 << $i))
if (Cfg::get('LOCALES') & (1 << $i))
echo ' <option value="'.$i.'"'.($this->editorFields('locale', true) == $i ? ' selected="selected"' : '').'>'.$l."</option>\n";
endforeach;
?>
@@ -284,7 +284,7 @@ endif;
</div>
</div>
<img src="<?=STATIC_URL;?>/images/icons/ajax.gif" style="display:none" class="spinning-circle">
<img src="<?=Cfg::get('STATIC_URL');?>/images/icons/ajax.gif" style="display:none" class="spinning-circle">
<span id="save-status"></span>
</form>
</div>

View File

@@ -7,9 +7,9 @@
<style type="text/css">
body { text-align: center; font-family: Arial; background-color: black; color: white }
.maintenance { background: url(<?=STATIC_URL; ?>/images/logos/home.png) no-repeat center top; width: 900px; margin: 40px auto; text-align: center; padding-top: 70px; }
.maintenance { background: url(<?=Cfg::get('STATIC_URL'); ?>/images/logos/home.png) no-repeat center top; width: 900px; margin: 40px auto; text-align: center; padding-top: 70px; }
.maintenance div { color: #00DD00; font-weight: bold; padding: 20px }
.maintenance p { background: url(<?=STATIC_URL; ?>/images/maintenance/brbgnomes.jpg) no-repeat center bottom; padding-bottom: 300px }
.maintenance p { background: url(<?=Cfg::get('STATIC_URL'); ?>/images/maintenance/brbgnomes.jpg) no-repeat center bottom; padding-bottom: 300px }
</style>
</head>
<body>

View File

@@ -12,7 +12,7 @@
<div class="text">
<h1><?=Lang::privileges('privileges');?></h1>
<div style="float:right;line-height:1.2;max-width:410px;overflow:hidden;text-align:center"><img class="border" alt="" src="<?=STATIC_URL;?>/images/help/privileges/example.jpg" /></div>
<div style="float:right;line-height:1.2;max-width:410px;overflow:hidden;text-align:center"><img class="border" alt="" src="<?=Cfg::get('STATIC_URL');?>/images/help/privileges/example.jpg" /></div>
<p><?=Lang::privileges('main');?></p>
<br><br>
<table class="wsa-list wsa-tbl">

View File

@@ -241,7 +241,7 @@ $WH.aE(window,\'load\',function(){$WH.ge(\'spelleffectmarkup-'.$i.'\').innerHTML
if (isset($e['perfItem'])):
?>
<small><a href="?spell=<?=$e['perfItem']['cndSpellId'];?>" class="icontiny"><img src="<?=STATIC_URL;?>/images/wow/icons/tiny/<?=$e['perfItem']['icon'];?>.gif" align="absmiddle">
<small><a href="?spell=<?=$e['perfItem']['cndSpellId'];?>" class="icontiny"><img src="<?=Cfg::get('STATIC_URL');?>/images/wow/icons/tiny/<?=$e['perfItem']['icon'];?>.gif" align="absmiddle">
<span class="tinyicontxt"><?=$e['perfItem']['cndSpellName'];?></span></a><?=Lang::main('colon').' '.$e['perfItem']['chance'].'%';?></small><table class="icontab">
<tr><th id="icontab-icon<?=++$iconTabIdx;?>"></th><td><small><a href="?item=<?=$e['perfItem']['itemId'];?>" class="q<?=$e['perfItem']['quality'];?>"><?=$e['perfItem']['itemName'];?></a></small></td></tr></table>