override die on error

This commit is contained in:
Andrew Dolgov 2006-05-22 12:35:18 +01:00
parent a3c0ae7ca2
commit 1e107b0fce
1 changed files with 6 additions and 2 deletions

View File

@ -7,7 +7,7 @@
$_SESSION["prefs_cache"] = array();
}
function get_pref($link, $pref_name, $user_id = false) {
function get_pref($link, $pref_name, $user_id = false, $die_on_error = true) {
$pref_name = db_escape_string($pref_name);
@ -49,7 +49,11 @@
return convert_pref_type($value, $type_name);
} else {
die("Fatal error, unknown preferences key: $pref_name");
if ($die_on_error) {
die("Fatal error, unknown preferences key: $pref_name");
} else {
return null;
}
}
}