blob: 20beb5efd19a709d78251a82e9181442b7a9ae49 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
<?php
function variable_init($conf = array()) {
$result = db_query("SELECT * FROM variable");
while ($variable = db_fetch_object($result)) $conf[$variable->name] = $variable->value;
return $conf;
}
function handler_post_threshold($node, $default) {
if ($node->type) {
$function = $node->type ."_post_threshold";
return $function($node, $default);
}
else {
return $default;
}
}
function handler_dump_threshold($node, $default) {
if ($node->type) {
$function = $node->type ."_dump_threshold";
return $function($node, $default);
}
else {
return $default;
}
}
function handler_timout_threshold($node, $default) {
if ($node->type) {
$function = $node->type ."_timout_threshold";
return $function($node, $default);
}
else {
return $default;
}
}
function variable_get($name, $default, $object = 0) {
global $conf;
switch ($name) {
case "post_threshold":
return handler_post_threshold($object, $default);
case "dump_threshold":
return handler_dump_threshold($object, $default);
case "timout_threshold":
return handler_timout_threshold($object, $default);
default:
return ($conf[$name] ? $conf[$name] : $default);
}
}
?>
|