You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
834 B

<?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);
}
}
?>