2001-04-06 14:14:16 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
function variable_init($conf = array()) {
|
|
|
|
$result = db_query("SELECT * FROM variable");
|
|
|
|
while ($variable = db_fetch_object($result)) $conf[$variable->name] = $variable->value;
|
2001-08-28 20:39:25 +00:00
|
|
|
|
2001-04-06 14:14:16 +00:00
|
|
|
return $conf;
|
|
|
|
}
|
|
|
|
|
|
|
|
function variable_get($name, $default, $object = 0) {
|
|
|
|
global $conf;
|
2001-08-28 20:39:25 +00:00
|
|
|
|
2001-06-15 10:41:18 +00:00
|
|
|
return isset($conf[$name]) ? $conf[$name] : $default;
|
2001-04-06 14:14:16 +00:00
|
|
|
}
|
|
|
|
|
2001-05-19 13:41:52 +00:00
|
|
|
function variable_set($name, $value) {
|
|
|
|
global $conf;
|
|
|
|
|
2001-05-20 19:30:39 +00:00
|
|
|
db_query("DELETE FROM variable WHERE name = '". check_query($name) ."'");
|
|
|
|
db_query("INSERT INTO variable (name, value) VALUES ('". check_query($name) ."', '". check_query($value) ."')");
|
2001-05-19 13:41:52 +00:00
|
|
|
|
|
|
|
$conf[$name] = $value;
|
|
|
|
}
|
|
|
|
|
2001-05-20 13:51:40 +00:00
|
|
|
function variable_del($name) {
|
|
|
|
global $conf;
|
|
|
|
|
2001-05-20 19:30:39 +00:00
|
|
|
db_query("DELETE FROM variable WHERE name = '". check_query($name) ."'");
|
2001-05-20 13:51:40 +00:00
|
|
|
|
2001-08-28 20:39:25 +00:00
|
|
|
unset($conf[$name]);
|
2001-05-20 13:51:40 +00:00
|
|
|
}
|
|
|
|
|
2001-04-06 14:14:16 +00:00
|
|
|
?>
|