parent
5ee447997f
commit
cbd536d7be
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/*
|
||||
*
|
||||
* @copyright (c) 2011 animegame.eu
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence
|
||||
*
|
||||
*/
|
||||
|
||||
include_once ($_SERVER['DOCUMENT_ROOT'].'ag/include/config/db.inc.php');
|
||||
|
||||
|
||||
$GLOBALS['definesInitialized'] = FALSE;
|
||||
|
||||
function initializeDefines() {
|
||||
$sql = 'SELECT * from defines';
|
||||
$qry = mysql_query($sql);
|
||||
while($row = mysql_fetch_assoc($qry)) {
|
||||
if(!defined($row['key'])) {
|
||||
define($row['key'], $row['value']);
|
||||
}
|
||||
}
|
||||
$GLOBALS['definesInitialized'] = TRUE;
|
||||
}
|
||||
|
||||
|
||||
function defineIfNotDefined($key, $value) {
|
||||
if(!$GLOBALS['definesInitialized']) {
|
||||
initializeDefines();
|
||||
}
|
||||
|
||||
if(!defined($key)) {
|
||||
// we seem that we need to insert this key - value pair!
|
||||
$sql = 'INSERT INTO defines(`key`, `value`) values(\''.$key.'\', \''.$value.'\')';
|
||||
mysql_query($sql);
|
||||
define($key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
Loading…
Reference in new issue