function adserve_include_drupal in Advertisement 6.3
Same name and namespace in other branches
- 5.2 adserve.inc \adserve_include_drupal()
- 5 adserve.inc \adserve_include_drupal()
- 6 adserve.inc \adserve_include_drupal()
- 6.2 adserve.inc \adserve_include_drupal()
- 7 adserve.inc \adserve_include_drupal()
Include Drupal's bootstrap.inc.
1 call to adserve_include_drupal()
- adserve_bootstrap in ./adserve.inc 
- Include the necessary files and call the Drupal bootstrap.
File
- ./adserve.inc, line 265 
- Configuration.
Code
function adserve_include_drupal() {
  // For optimal performance set DRUPAL_ROOT at the top of this file.
  if (defined('DRUPAL_ROOT')) {
    if (is_dir(DRUPAL_ROOT) && file_exists(DRUPAL_ROOT . '/includes/bootstrap.inc')) {
      chdir(DRUPAL_ROOT);
      adserve_variable('root_dir', DRUPAL_ROOT);
    }
    else {
      echo 'Invalid DRUPAL_ROOT (' . DRUPAL_ROOT . ') defined in adserve.inc';
    }
  }
  else {
    $path = explode('/', str_replace('\\', '/', adserve_variable('ad_dir')));
    while (!empty($path)) {
      // Search for top level Drupal directory to perform bootstrap.
      chdir(implode('/', $path));
      if (file_exists('./includes/bootstrap.inc')) {
        adserve_variable('root_dir', getcwd());
        break;
      }
      array_pop($path);
    }
  }
  require_once adserve_variable('root_dir') . '/includes/bootstrap.inc';
}