function variable_get

6.x db.inc variable_get($name, $default_value = "")
4.x db.inc variable_get($name, $default_value = "")
5.x db.inc variable_get($name, $default_value = "")

Get a variable from the database. We will first look in our GLOBALS array, to see that it hasn't already been retrieved this page load.

Parameters

unknown_type $name:

unknown_type $default_value:

Return value

unknown

110 calls to variable_get()
admin_add_degree_form in modules/admin/admin.degrees.inc
This form lets the user add a degree to the database.
admin_add_degree_form_submit in modules/admin/admin.degrees.inc
Submit handler for the add_degree_form.
admin_advising_settings_form in modules/admin/admin.module
This is a systems settings form, which lets the user edit advising variabled for FlightPath.
admin_apply_draft_changes_form_submit in modules/admin/admin.module
Handles the actual moving of draft courses into production.
admin_display_degrees in modules/admin/admin.degrees.inc

... See full list

File

includes/db.inc, line 553
This file contains mostly db shortcuts.

Code

function variable_get($name, $default_value = "") {

  $val = null;

  // First, check in our GLOBALS array, like a cache...
  if (isset($GLOBALS ["fp_system_settings"][$name])) {
    $val = $GLOBALS ["fp_system_settings"][$name];
  }
  else {
    // Not found-- look in the database for it.
    $res = db_query("SELECT value FROM variables
                           WHERE name = '?' ", $name);
    $cur = db_fetch_array($res);
    @$val = unserialize($cur ["value"]);

    // Save back to our cache...
    $GLOBALS ["fp_system_settings"][$name] = $val;

  }


  if (!$val) {
    $val = $default_value;
  }

  // We must have this down here again, just in case what got stored in the GLOBALS
  // array was this placeholder.  This can happen, because the settings file doesn't do
  // this check when assembling this variable on page load.  It's something that needs
  // to be fixed.
  if ($val === "BOOLEAN_FALSE_PLACEHOLDER") {
    $val = FALSE;
  }

  if ($val === "NULL_PLACEHOLDER") {
    $val = NULL;
  }

  return $val;
}