当前位置: 首页>>代码示例>>PHP>>正文


PHP drupal_load函数代码示例

本文整理汇总了PHP中drupal_load函数的典型用法代码示例。如果您正苦于以下问题:PHP drupal_load函数的具体用法?PHP drupal_load怎么用?PHP drupal_load使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了drupal_load函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: install_main

/**
 * The Drupal installation happens in a series of steps. We begin by verifying
 * that the current environment meets our minimum requirements. We then go
 * on to verify that settings.php is properly configured. From there we
 * connect to the configured database and verify that it meets our minimum
 * requirements. Finally we can allow the user to select an installation
 * profile and complete the installation process.
 *
 * @param $phase
 *   The installation phase we should proceed to.
 */
function install_main()
{
    require_once './includes/bootstrap.inc';
    drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION);
    // The user agent header is used to pass a database prefix in the request when
    // running tests. However, for security reasons, it is imperative that no
    // installation be permitted using such a prefix.
    if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], "simpletest") !== FALSE) {
        header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden');
        exit;
    }
    // This must go after drupal_bootstrap(), which unsets globals!
    global $profile, $install_locale, $conf;
    require_once './modules/system/system.install';
    require_once './includes/file.inc';
    // Ensure correct page headers are sent (e.g. caching)
    drupal_page_header();
    // Set up $language, so t() caller functions will still work.
    drupal_init_language();
    // Load module basics (needed for hook invokes).
    include_once './includes/module.inc';
    $module_list['system']['filename'] = 'modules/system/system.module';
    $module_list['filter']['filename'] = 'modules/filter/filter.module';
    module_list(TRUE, FALSE, FALSE, $module_list);
    drupal_load('module', 'system');
    drupal_load('module', 'filter');
    // Install profile chosen, set the global immediately.
    // This needs to be done before the theme cache gets
    // initialized in drupal_maintenance_theme().
    if (!empty($_GET['profile'])) {
        $profile = preg_replace('/[^a-zA-Z_0-9]/', '', $_GET['profile']);
    }
    // Set up theme system for the maintenance page.
    drupal_maintenance_theme();
    // Check existing settings.php.
    $verify = install_verify_settings();
    if ($verify) {
        // Since we have a database connection, we use the normal cache system.
        // This is important, as the installer calls into the Drupal system for
        // the clean URL checks, so we should maintain the cache properly.
        require_once './includes/cache.inc';
        $conf['cache_inc'] = './includes/cache.inc';
        // Establish a connection to the database.
        require_once './includes/database.inc';
        db_set_active();
        // Check if Drupal is installed.
        $task = install_verify_drupal();
        if ($task == 'done') {
            install_already_done_error();
        }
    } else {
        // Since no persistent storage is available yet, and functions that check
        // for cached data will fail, we temporarily replace the normal cache
        // system with a stubbed-out version that short-circuits the actual
        // caching process and avoids any errors.
        require_once './includes/cache-install.inc';
        $conf['cache_inc'] = './includes/cache-install.inc';
        $task = NULL;
    }
    // No profile was passed in GET, ask the user.
    if (empty($_GET['profile'])) {
        if ($profile = install_select_profile()) {
            install_goto("install.php?profile={$profile}");
        } else {
            install_no_profile_error();
        }
    }
    // Load the profile.
    require_once "./profiles/{$profile}/{$profile}.profile";
    // Locale selection
    if (!empty($_GET['locale'])) {
        $install_locale = preg_replace('/[^a-zA-Z_0-9\\-]/', '', $_GET['locale']);
    } elseif (($install_locale = install_select_locale($profile)) !== FALSE) {
        install_goto("install.php?profile={$profile}&locale={$install_locale}");
    }
    // Tasks come after the database is set up
    if (!$task) {
        global $db_url;
        if (!$verify && !empty($db_url)) {
            // Do not install over a configured settings.php.
            install_already_done_error();
        }
        // Check the installation requirements for Drupal and this profile.
        install_check_requirements($profile, $verify);
        // Verify existence of all required modules.
        $modules = drupal_verify_profile($profile, $install_locale);
        // If any error messages are set now, it means a requirement problem.
        $messages = drupal_set_message();
        if (!empty($messages['error'])) {
//.........这里部分代码省略.........
开发者ID:alexismb5,项目名称:ckan-drupal,代码行数:101,代码来源:install.php

示例2: isset

$update_access_allowed = !empty($update_free_access) || $user->uid == 1;
// Only allow the requirements check to proceed if the current user has access
// to run updates (since it may expose sensitive information about the site's
// configuration).
$op = isset($_REQUEST['op']) ? $_REQUEST['op'] : '';
if (empty($op) && $update_access_allowed) {
    require_once DRUPAL_ROOT . '/includes/install.inc';
    require_once DRUPAL_ROOT . '/includes/file.inc';
    require_once DRUPAL_ROOT . '/modules/system/system.install';
    // Load module basics.
    include_once DRUPAL_ROOT . '/includes/module.inc';
    $module_list['system']['filename'] = 'modules/system/system.module';
    $module_list['filter']['filename'] = 'modules/filter/filter.module';
    module_list(TRUE, FALSE, $module_list);
    drupal_load('module', 'system');
    drupal_load('module', 'filter');
    // Set up $language, since the installer components require it.
    drupal_init_language();
    // Set up theme system for the maintenance page.
    drupal_maintenance_theme();
    // Check the update requirements for Drupal.
    update_check_requirements();
    // Redirect to the update information page if all requirements were met.
    install_goto('update.php?op=info');
}
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
drupal_maintenance_theme();
// Turn error reporting back on. From now on, only fatal errors (which are
// not passed through the error handler) will cause a message to be printed.
ini_set('display_errors', TRUE);
// Only proceed with updates if the user is allowed to run them.
开发者ID:veggieryan,项目名称:drupal,代码行数:31,代码来源:update.php

示例3: __construct

 /**
  * Constructor for this authentication source.
  *
  * @param array $info  Information about this authentication source.
  * @param array $config  Configuration.
  */
 public function __construct($info, $config)
 {
     assert('is_array($info)');
     assert('is_array($config)');
     /* Call the parent constructor first, as required by the interface. */
     parent::__construct($info, $config);
     /* Get the configuration for this module */
     $drupalAuthConfig = new sspmod_drupalauth_ConfigHelper($config, 'Authentication source ' . var_export($this->authId, TRUE));
     $this->debug = $drupalAuthConfig->getDebug();
     $this->attributes = $drupalAuthConfig->getAttributes();
     $this->cookie_name = $drupalAuthConfig->getCookieName();
     $this->drupal_logout_url = $drupalAuthConfig->getDrupalLogoutURL();
     $this->drupal_login_url = $drupalAuthConfig->getDrupalLoginURL();
     if (!defined('DRUPAL_ROOT')) {
         define('DRUPAL_ROOT', $drupalAuthConfig->getDrupalroot());
     }
     $ssp_config = SimpleSAML_Configuration::getInstance();
     $this->cookie_path = '/' . $ssp_config->getValue('baseurlpath');
     $this->cookie_salt = $ssp_config->getValue('secretsalt');
     $a = getcwd();
     chdir(DRUPAL_ROOT);
     /* Include the Drupal bootstrap */
     //require_once(DRUPAL_ROOT.'/includes/common.inc');
     require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
     require_once DRUPAL_ROOT . '/includes/file.inc';
     /* Using DRUPAL_BOOTSTRAP_FULL means that SimpleSAMLphp must use an session storage
      * mechanism other than phpsession (see: store.type in config.php). However, this trade-off
      * prevents the need for hackery here and makes this module work better in different environments.
      */
     drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
     // we need to be able to call Drupal user function so we load some required modules
     drupal_load('module', 'system');
     drupal_load('module', 'user');
     drupal_load('module', 'field');
     chdir($a);
 }
开发者ID:rw3iss,项目名称:drupalauth,代码行数:42,代码来源:External.php

示例4: synlogin

 function synlogin($get, $post)
 {
     $uid = $get['uid'];
     $username = $get['username'];
     //echo $uid.'/'.$username;
     if (!API_SYNLOGIN) {
         return API_RETURN_FORBIDDEN;
     }
     // drupal user login
     chdir(DRUPAL_ROOT_PATH);
     require_once './includes/bootstrap.inc';
     drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
     drupal_load('module', 'user');
     watchdog(t('user'), t('synlogin:start username:@username uid:@uid', array('@username' => $GLOBALS['user']->name, '@uid' => $GLOBALS['user']->uid)));
     $user = user_load(array('name' => $username));
     //user_external_login_register($username, 'ucenter');
     //sess_regenerate();
     //$state ['values'] = array('name'=>$username);
     //user_authenticate_finalize($state ['values']);
     //echo $username.'/ucenter';
     watchdog(t('user'), t('synlogin:end username:@username uid:@uid', array('@username' => $GLOBALS['user']->name, '@uid' => $GLOBALS['user']->uid)));
     return API_RETURN_SUCCEED;
 }
开发者ID:404pnf,项目名称:4u2u,代码行数:23,代码来源:uc.php

示例5: update_prepare_d7_bootstrap

require_once DRUPAL_ROOT . '/includes/unicode.inc';
update_prepare_d7_bootstrap();
// Determine if the current user has access to run update.php.
drupal_bootstrap(DRUPAL_BOOTSTRAP_SESSION);
// Only allow the requirements check to proceed if the current user has access
// to run updates (since it may expose sensitive information about the site's
// configuration).
$op = isset($_REQUEST['op']) ? $_REQUEST['op'] : '';
if (empty($op) && update_access_allowed()) {
    require_once DRUPAL_ROOT . '/includes/install.inc';
    require_once DRUPAL_ROOT . '/modules/system/system.install';
    // Load module basics.
    include_once DRUPAL_ROOT . '/includes/module.inc';
    $module_list['system']['filename'] = 'modules/system/system.module';
    module_list(TRUE, FALSE, FALSE, $module_list);
    drupal_load('module', 'system');
    // Reset the module_implements() cache so that any new hook implementations
    // in updated code are picked up.
    module_implements('', FALSE, TRUE);
    // Set up $language, since the installer components require it.
    drupal_language_initialize();
    // Set up theme system for the maintenance page.
    drupal_maintenance_theme();
    // Check the update requirements for Drupal.
    update_check_requirements();
    // Redirect to the update information page if all requirements were met.
    install_goto('update.php?op=info');
}
// update_fix_d7_requirements() needs to run before bootstrapping beyond path.
// So bootstrap to DRUPAL_BOOTSTRAP_LANGUAGE then include unicode.inc.
drupal_bootstrap(DRUPAL_BOOTSTRAP_LANGUAGE);
开发者ID:boombatower,项目名称:drupal,代码行数:31,代码来源:update.php

示例6: install_main

/**
 * The Drupal installation happens in a series of steps. We begin by verifying
 * that the current environment meets our minimum requirements. We then go
 * on to verify that settings.php is properly configured. From there we
 * connect to the configured database and verify that it meets our minimum
 * requirements. Finally we can allow the user to select an installation
 * profile and complete the installation process.
 *
 * @param $phase
 *   The installation phase we should proceed to.
 */
function install_main()
{
    require_once './includes/bootstrap.inc';
    drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION);
    // This must go after drupal_bootstrap(), which unsets globals!
    global $profile, $install_locale;
    require_once './modules/system/system.install';
    require_once './includes/file.inc';
    // Ensure correct page headers are sent (e.g. caching)
    drupal_page_header();
    // Check existing settings.php.
    $verify = install_verify_settings();
    // Drupal may already be installed.
    if ($verify) {
        // Establish a connection to the database.
        require_once './includes/database.inc';
        db_set_active();
        // Check if Drupal is installed.
        if (install_verify_drupal()) {
            install_already_done_error();
        }
    }
    // Load module basics (needed for hook invokes).
    include_once './includes/module.inc';
    $module_list['system']['filename'] = 'modules/system/system.module';
    $module_list['filter']['filename'] = 'modules/filter/filter.module';
    module_list(TRUE, FALSE, FALSE, $module_list);
    drupal_load('module', 'system');
    drupal_load('module', 'filter');
    // Decide which profile to use.
    if (!empty($_GET['profile'])) {
        $profile = preg_replace('/[^a-zA-Z_0-9]/', '', $_GET['profile']);
    } elseif ($profile = install_select_profile()) {
        install_goto("install.php?profile={$profile}");
    } else {
        install_no_profile_error();
    }
    // Locale selection
    if (!empty($_GET['locale'])) {
        $install_locale = preg_replace('/[^a-zA-Z_0-9]/', '', $_GET['locale']);
    } elseif (($install_locale = install_select_locale($profile)) !== FALSE) {
        install_goto("install.php?profile={$profile}&locale={$install_locale}");
    }
    // Load the profile.
    require_once "./profiles/{$profile}/{$profile}.profile";
    // Check the installation requirements for Drupal and this profile.
    install_check_requirements($profile);
    // Change the settings.php information if verification failed earlier.
    // Note: will trigger a redirect if database credentials change.
    if (!$verify) {
        install_change_settings($profile, $install_locale);
    }
    // Verify existence of all required modules.
    $modules = drupal_verify_profile($profile, $install_locale);
    if (!$modules) {
        install_missing_modules_error($profile);
    }
    // Perform actual installation defined in the profile.
    drupal_install_profile($profile, $modules);
    // Warn about settings.php permissions risk
    $settings_file = './' . conf_path() . '/settings.php';
    if (!drupal_verify_install_file($settings_file, FILE_EXIST | FILE_READABLE | FILE_NOT_WRITABLE)) {
        drupal_set_message(st('All necessary changes to %file have been made, so you should now remove write permissions to this file. Failure to remove write permissions to this file is a security risk.', array('%file' => $settings_file)), 'error');
    } else {
        drupal_set_message(st('All necessary changes to %file have been made. It has been set to read-only for security.', array('%file' => $settings_file)));
    }
    // Show end page.
    install_complete($profile);
}
开发者ID:jiva-technology,项目名称:smcuk,代码行数:80,代码来源:install.php

示例7: hook_boot

/**
 * Perform setup tasks for all page requests.
 *
 * This hook is run at the beginning of the page request. It is typically
 * used to set up global parameters that are needed later in the request.
 *
 * Only use this hook if your code must run even for cached page views. This
 * hook is called before the theme, modules, or most include files are loaded
 * into memory. It happens while Drupal is still in bootstrap mode.
 *
 * @see hook_init()
 */
function hook_boot()
{
    // We need user_access() in the shutdown function. Make sure it gets loaded.
    drupal_load('module', 'user');
    drupal_register_shutdown_function('devel_shutdown');
}
开发者ID:jayelless,项目名称:beehive,代码行数:18,代码来源:system.api.php

示例8: js_execute_callback

/**
 * Loads the requested module and executes the requested callback.
 *
 * @return
 *   The callback function's return value or one of the JS_* constants.
 */
function js_execute_callback()
{
    $args = explode('/', $_GET['q']);
    // If i18n is enabled and therefore the js module should boot
    // to DRUPAL_BOOTSTRAP_LANGUAGE.
    $i18n = FALSE;
    // Validate if there is a language prefix in the path.
    if (!empty($args[0]) && !empty($args[1]) && $args[1] == 'js_callback') {
        // Language string detected, strip off the language code.
        $language_code = array_shift($args);
        // Enable language detection to make sure i18n is enabled.
        $i18n = TRUE;
    }
    // Strip first argument 'js_callback'.
    if (!empty($args[0]) && $args[0] == 'js_callback') {
        array_shift($args);
    }
    // Determine module to load.
    $module = check_plain(array_shift($args));
    if (!$module || !drupal_load('module', $module)) {
        return JS_MENU_ACCESS_DENIED;
    }
    // Get info hook function name.
    $function = $module . '_js';
    if (!function_exists($function)) {
        return JS_MENU_NOT_FOUND;
    }
    // Get valid callbacks.
    $valid_callbacks = $function();
    // Get the callback.
    $callback = check_plain(array_shift($args));
    // Validate the callback.
    if (!isset($valid_callbacks[$callback])) {
        return JS_MENU_NOT_FOUND;
    }
    // If the callback function is located in another file, load that file now.
    if (isset($valid_callbacks[$callback]['file']) && ($filepath = drupal_get_path('module', $module) . '/' . $valid_callbacks[$callback]['file']) && file_exists($filepath)) {
        require_once $filepath;
    }
    // Validate the existance of the defined callback.
    if (!function_exists($valid_callbacks[$callback]['callback'])) {
        return JS_MENU_NOT_FOUND;
    }
    // Bootstrap to required level.
    $full_boostrap = FALSE;
    if (!empty($valid_callbacks[$callback]['bootstrap'])) {
        drupal_bootstrap($valid_callbacks[$callback]['bootstrap']);
        $full_boostrap = $valid_callbacks[$callback]['bootstrap'] == DRUPAL_BOOTSTRAP_FULL;
    }
    // Validate if the callback uses i18n.
    if (isset($valid_callbacks[$callback]['i18n'])) {
        $i18n = $valid_callbacks[$callback]['i18n'];
    }
    if (!$full_boostrap) {
        // The following mimics the behavior of _drupal_bootstrap_full().
        // The difference is that not all modules and includes are loaded.
        // @see _drupal_bootstrap_full().
        // If i18n is enabled, boot to the language phase and make
        // sure the required modules are enabled.
        if ($i18n) {
            // First boot to the variables to make sure drupal_multilingual() works.
            drupal_bootstrap(DRUPAL_BOOTSTRAP_VARIABLES);
            // As the variables bootstrap phase loads all core modules, we have to
            // add the user module and the path include as a dependencies because they
            // are required by some core modules.
            if (empty($valid_callbacks[$callback]['dependencies'])) {
                $valid_callbacks[$callback]['dependencies'] = array();
            }
            if (empty($valid_callbacks[$callback]['includes'])) {
                $valid_callbacks[$callback]['includes'] = array();
            }
            if (!in_array('user', $valid_callbacks[$callback]['dependencies'])) {
                $valid_callbacks[$callback]['dependencies'][] = 'user';
            }
            if (!in_array('path', $valid_callbacks[$callback]['includes'])) {
                $valid_callbacks[$callback]['includes'][] = 'path';
            }
            // Then check if it's a multilingual site. If so, boot to the language
            // phase.
            if (drupal_multilingual()) {
                drupal_bootstrap(DRUPAL_BOOTSTRAP_LANGUAGE);
            }
        }
        // Load required include files based on the callback.
        if (isset($valid_callbacks[$callback]['includes']) && is_array($valid_callbacks[$callback]['includes'])) {
            foreach ($valid_callbacks[$callback]['includes'] as $include) {
                if (file_exists("./includes/{$include}.inc")) {
                    require_once "./includes/{$include}.inc";
                }
            }
        }
        // Detect string handling method.
        unicode_check();
        // Undo magic quotes.
//.........这里部分代码省略.........
开发者ID:johnedelatorre,项目名称:fusion,代码行数:101,代码来源:js.php

示例9: drupal_bootstrap

require_once DRUPAL_ROOT . '/includes/common.inc';
require_once DRUPAL_ROOT . '/includes/file.inc';
require_once DRUPAL_ROOT . '/includes/module.inc';
require_once DRUPAL_ROOT . '/includes/ajax.inc';
// We prepare only a minimal bootstrap. This includes the database and
// variables, however, so we have access to the class autoloader registry.
drupal_bootstrap(DRUPAL_BOOTSTRAP_SESSION);
// This must go after drupal_bootstrap(), which unsets globals!
global $conf;
// We have to enable the user and system modules, even to check access and
// display errors via the maintainence theme.
$module_list['system']['filename'] = 'modules/system/system.module';
$module_list['user']['filename'] = 'modules/user/user.module';
module_list(TRUE, FALSE, FALSE, $module_list);
drupal_load('module', 'system');
drupal_load('module', 'user');
// We also want to have the language system available, but we do *NOT* want to
// actually call drupal_bootstrap(DRUPAL_BOOTSTRAP_LANGUAGE), since that would
// also force us through the DRUPAL_BOOTSTRAP_PAGE_HEADER phase, which loads
// all the modules, and that's exactly what we're trying to avoid.
drupal_language_initialize();
// Initialize the maintenance theme for this administrative script.
drupal_maintenance_theme();
$output = '';
$show_messages = TRUE;
if (authorize_access_allowed()) {
    // Load both the Form API and Batch API.
    require_once DRUPAL_ROOT . '/includes/form.inc';
    require_once DRUPAL_ROOT . '/includes/batch.inc';
    // Load the code that drives the authorize process.
    require_once DRUPAL_ROOT . '/includes/authorize.inc';
开发者ID:aslakhellesoy,项目名称:drupal,代码行数:31,代码来源:authorize.php

示例10: install_begin_request

/**
 * Begin an installation request, modifying the installation state as needed.
 *
 * This function performs commands that must run at the beginning of every page
 * request. It throws an exception if the installation should not proceed.
 *
 * @param $install_state
 *   An array of information about the current installation state. This is
 *   modified with information gleaned from the beginning of the page request.
 */
function install_begin_request(&$install_state)
{
    // Allow command line scripts to override server variables used by Drupal.
    require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
    if (!$install_state['interactive']) {
        drupal_override_server_variables($install_state['server']);
    }
    // The user agent header is used to pass a database prefix in the request when
    // running tests. However, for security reasons, it is imperative that no
    // installation be permitted using such a prefix.
    if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], "simpletest") !== FALSE) {
        header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden');
        exit;
    }
    drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION);
    // This must go after drupal_bootstrap(), which unsets globals!
    global $conf;
    require_once DRUPAL_ROOT . '/modules/system/system.install';
    require_once DRUPAL_ROOT . '/includes/common.inc';
    require_once DRUPAL_ROOT . '/includes/file.inc';
    require_once DRUPAL_ROOT . '/includes/path.inc';
    // Set up $language, so t() caller functions will still work.
    drupal_language_initialize();
    // Load module basics (needed for hook invokes).
    include_once DRUPAL_ROOT . '/includes/module.inc';
    include_once DRUPAL_ROOT . '/includes/session.inc';
    include_once DRUPAL_ROOT . '/includes/entity.inc';
    $module_list['system']['filename'] = 'modules/system/system.module';
    $module_list['filter']['filename'] = 'modules/filter/filter.module';
    $module_list['user']['filename'] = 'modules/user/user.module';
    module_list(TRUE, FALSE, FALSE, $module_list);
    drupal_load('module', 'system');
    drupal_load('module', 'filter');
    drupal_load('module', 'user');
    // Load the cache infrastructure with the Fake Cache. Switch to the database cache
    // later if possible.
    require_once DRUPAL_ROOT . '/includes/cache.inc';
    require_once DRUPAL_ROOT . '/includes/cache-install.inc';
    $conf['cache_inc'] = 'includes/cache.inc';
    $conf['cache_default_class'] = 'DrupalFakeCache';
    // Prepare for themed output, if necessary. We need to run this at the
    // beginning of the page request to avoid a different theme accidentally
    // getting set.
    if ($install_state['interactive']) {
        drupal_maintenance_theme();
    }
    // Check existing settings.php.
    $install_state['settings_verified'] = install_verify_settings();
    if ($install_state['settings_verified']) {
        // Since we have a database connection, we use the normal cache system.
        // This is important, as the installer calls into the Drupal system for
        // the clean URL checks, so we should maintain the cache properly.
        unset($conf['cache_default_class']);
        // Initialize the database system. Note that the connection
        // won't be initialized until it is actually requested.
        require_once DRUPAL_ROOT . '/includes/database/database.inc';
        // Verify the last completed task in the database, if there is one.
        $task = install_verify_completed_task();
    } else {
        $task = NULL;
        // Since previous versions of Drupal stored database connection information
        // in the 'db_url' variable, we should never let an installation proceed if
        // this variable is defined and the settings file was not verified above
        // (otherwise we risk installing over an existing site whose settings file
        // has not yet been updated).
        if (!empty($GLOBALS['db_url'])) {
            throw new Exception(install_already_done_error());
        }
    }
    // Modify the installation state as appropriate.
    $install_state['completed_task'] = $task;
    $install_state['database_tables_exist'] = !empty($task);
    // Add any installation parameters passed in via the URL.
    $install_state['parameters'] += $_GET;
    // Validate certain core settings that are used throughout the installation.
    if (!empty($install_state['parameters']['profile'])) {
        $install_state['parameters']['profile'] = preg_replace('/[^a-zA-Z_0-9]/', '', $install_state['parameters']['profile']);
    }
    if (!empty($install_state['parameters']['locale'])) {
        $install_state['parameters']['locale'] = preg_replace('/[^a-zA-Z_0-9\\-]/', '', $install_state['parameters']['locale']);
    }
}
开发者ID:blipp,项目名称:drupal,代码行数:92,代码来源:install.php

示例11: drupal_load

 /**
  * Includes a file with the provided type and name.
  *
  * This prevents including a theme, engine, module, etc., more than once.
  *
  * @param $type
  *   The type of item to load (i.e. theme, theme_engine, module).
  * @param $name
  *   The name of the item to load.
  *
  * @return bool
  *   TRUE if the item is loaded or has already been loaded.
  */
 public function drupal_load($type, $name)
 {
     return drupal_load($type, $name);
 }
开发者ID:EarthTeam,项目名称:earthteam.net,代码行数:17,代码来源:Drupal7.php

示例12: define

<?php

/**
 * @file
 * An optimized page execution used for ELMSLN API calls for a
 * minimally bootstrapped Drupal installation.
 */
/**
 * Root directory of Drupal installation.
 */
define('DRUPAL_ROOT', getcwd());
/**
 * Required core files needed to run any request.
 */
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
require_once DRUPAL_ROOT . '/includes/common.inc';
require_once DRUPAL_ROOT . '/includes/module.inc';
require_once DRUPAL_ROOT . '/includes/unicode.inc';
require_once DRUPAL_ROOT . '/includes/file.inc';
// Bootstrap Drupal to at least the database level so it can be accessed.
drupal_bootstrap(DRUPAL_BOOTSTRAP_DATABASE);
// Load the ELMSLN API module and execute request.
drupal_load('module', 'elmsln_api');
elmsln_api_execute_request();
开发者ID:mmilutinovic1313,项目名称:elmsln,代码行数:24,代码来源:elmsln.php

示例13: install_main

/**
 * The Drupal installation happens in a series of steps. We begin by verifying
 * that the current environment meets our minimum requirements. We then go
 * on to verify that settings.php is properly configured. From there we
 * connect to the configured database and verify that it meets our minimum
 * requirements. Finally we can allow the user to select an installation
 * profile and complete the installation process.
 *
 * @param $phase
 *   The installation phase we should proceed to.
 */
function install_main()
{
    require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
    drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION);
    // The user agent header is used to pass a database prefix in the request when
    // running tests. However, for security reasons, it is imperative that no
    // installation be permitted using such a prefix.
    if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], "simpletest") !== FALSE) {
        header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden');
        exit;
    }
    // This must go after drupal_bootstrap(), which unsets globals!
    global $profile, $install_locale, $conf;
    require_once DRUPAL_ROOT . '/modules/system/system.install';
    require_once DRUPAL_ROOT . '/includes/file.inc';
    // Ensure correct page headers are sent (e.g. caching)
    drupal_page_header();
    // Set up $language, so t() caller functions will still work.
    drupal_init_language();
    // Load module basics (needed for hook invokes).
    include_once DRUPAL_ROOT . '/includes/module.inc';
    $module_list['system']['filename'] = 'modules/system/system.module';
    $module_list['filter']['filename'] = 'modules/filter/filter.module';
    module_list(TRUE, FALSE, FALSE, $module_list);
    drupal_load('module', 'system');
    drupal_load('module', 'filter');
    // Load the cache infrastructure using a "fake" cache implementation that
    // does not attempt to write to the database. We need this during the initial
    // part of the installer because the database is not available yet. We
    // continue to use it even when the database does become available, in order
    // to preserve consistency between interactive and command-line installations
    // (the latter complete in one page request and therefore are forced to
    // continue using the cache implementation they started with) and also
    // because any data put in the cache during the installer is inherently
    // suspect, due to the fact that Drupal is not fully set up yet.
    require_once DRUPAL_ROOT . '/includes/cache-install.inc';
    $conf['cache_inc'] = './includes/cache-install.inc';
    // Install profile chosen, set the global immediately.
    // This needs to be done before the theme cache gets
    // initialized in drupal_maintenance_theme().
    if (!empty($_GET['profile'])) {
        $profile = preg_replace('/[^a-zA-Z_0-9]/', '', $_GET['profile']);
    }
    // Set up theme system for the maintenance page.
    drupal_maintenance_theme();
    // Check existing settings.php.
    $verify = install_verify_settings();
    if ($verify) {
        // Establish a connection to the database.
        require_once DRUPAL_ROOT . '/includes/database.inc';
        db_set_active();
        // Check if Drupal is installed.
        $task = install_verify_drupal();
        if ($task == 'done') {
            install_already_done_error();
        }
    } else {
        $task = NULL;
    }
    // No profile was passed in GET, ask the user.
    if (empty($_GET['profile'])) {
        if ($profile = install_select_profile()) {
            install_goto("install.php?profile={$profile}");
        } else {
            install_no_profile_error();
        }
    }
    // Load the profile.
    require_once DRUPAL_ROOT . "/profiles/{$profile}/{$profile}.profile";
    // Locale selection
    if (!empty($_GET['locale'])) {
        $install_locale = preg_replace('/[^a-zA-Z_0-9\\-]/', '', $_GET['locale']);
    } elseif (($install_locale = install_select_locale($profile)) !== FALSE) {
        install_goto("install.php?profile={$profile}&locale={$install_locale}");
    }
    // Tasks come after the database is set up
    if (!$task) {
        global $db_url;
        if (!$verify && !empty($db_url)) {
            // Do not install over a configured settings.php.
            install_already_done_error();
        }
        // Check the installation requirements for Drupal and this profile.
        install_check_requirements($profile, $verify);
        // Verify existence of all required modules.
        $modules = drupal_verify_profile($profile, $install_locale);
        // If any error messages are set now, it means a requirement problem.
        $messages = drupal_set_message();
        if (!empty($messages['error'])) {
//.........这里部分代码省略.........
开发者ID:rjbrown99,项目名称:6,代码行数:101,代码来源:install.php

示例14: define

<?php

/**
 * @file
 * An optimized page execution used to serve JavaScript AJAX requests using a
 * minimally bootstrapped Drupal installation.
 */
/**
 * Root directory of Drupal installation.
 */
define('DRUPAL_ROOT', getcwd());
/**
 * Required core files needed to run any AJAX request.
 */
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
require_once DRUPAL_ROOT . '/includes/common.inc';
require_once DRUPAL_ROOT . '/includes/module.inc';
require_once DRUPAL_ROOT . '/includes/unicode.inc';
require_once DRUPAL_ROOT . '/includes/file.inc';
// Bootstrap Drupal to at least the database level so it can be accessed.
drupal_bootstrap(DRUPAL_BOOTSTRAP_DATABASE);
// Load the JS module and execute request.
drupal_load('module', 'js');
js_execute_request();
开发者ID:CodeElegance,项目名称:finsearches,代码行数:24,代码来源:js.php


注:本文中的drupal_load函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。