Newer
Older
/**
* @file
* Configuration system that lets administrators modify the workings of the site.
*/
/**
* The current system version.
*/
/**
* Core API compatibility.
*/
Dries Buytaert
committed
define('DRUPAL_CORE_COMPATIBILITY', '6.x');
Dries Buytaert
committed
/**
* Minimum supported version of PHP.
*/
Gábor Hojtsy
committed
/**
* Minimum recommended value of PHP memory_limit.
*/
define('DRUPAL_MINIMUM_PHP_MEMORY_LIMIT', '16M');
/**
* Minimum supported version of MySQL, if it is used.
*/
Gábor Hojtsy
committed
define('DRUPAL_MINIMUM_MYSQL', '4.1.1');
/**
* Minimum supported version of PostgreSQL, if it is used.
*/
define('DRUPAL_MINIMUM_PGSQL', '7.4');
/**
* Maximum age of temporary files in seconds.
*/
define('DRUPAL_MAXIMUM_TEMP_FILE_AGE', 21600);
Gábor Hojtsy
committed
function system_help($path, $arg) {
Gábor Hojtsy
committed
switch ($path) {
Dries Buytaert
committed
case 'admin/help#system':
$output = '<p>'. t('The system module is at the foundation of your Drupal website, and provides basic but extensible functionality for use by other modules and themes. Some integral elements of Drupal are contained in and managed by the system module, including caching, enabling or disabling of modules and themes, preparing and displaying the administrative page, and configuring fundamental site settings. A number of key system maintenance operations are also part of the system module.') .'</p>';
$output .= '<p>'. t('The system module provides:') .'</p>';
$output .= '<ul><li>'. t('support for enabling and disabling <a href="@modules">modules</a>. Drupal comes packaged with a number of core modules; each module provides a discrete set of features and may be enabled depending on the needs of your site. A wide array of additional modules contributed by members of the Drupal community are available for download at the <a href="@drupal-modules">Drupal.org module page</a>.', array('@modules' => url('admin/build/modules'), '@drupal-modules' => 'http://drupal.org/project/modules')) .'</li>';
$output .= '<li>'. t('support for enabling and disabling <a href="@themes">themes</a>, which determine the design and presentation of your site. Drupal comes packaged with several core themes and additional contributed themes are available at the <a href="@drupal-themes">Drupal.org theme page</a>.', array('@themes' => url('admin/build/themes'), '@drupal-themes' => 'http://drupal.org/project/themes')) .'</li>';
$output .= '<li>'. t('a robust <a href="@cache-settings">caching system</a> that allows the efficient re-use of previously-constructed web pages and web page components. Drupal stores the pages requested by anonymous users in a compressed format; depending on your site configuration and the amount of your web traffic tied to anonymous visitors, Drupal\'s caching system may significantly increase the speed of your site.', array('@cache-settings' => url('admin/settings/performance'))) .'</li>';
Gábor Hojtsy
committed
$output .= '<li>'. t('a set of routine administrative operations that rely on a correctly-configured <a href="@cron">cron maintenance task</a> to run automatically. A number of other modules, including the feed aggregator, ping module and search also rely on <a href="@cron">cron maintenance tasks</a>. For more information, see the online handbook entry for <a href="@handbook">configuring cron jobs</a>.', array('@cron' => url('admin/reports/status'), '@handbook' => 'http://drupal.org/cron')) .'</li>';
$output .= '<li>'. t('basic configuration options for your site, including <a href="@date-settings">date and time settings</a>, <a href="@file-system">file system settings</a>, <a href="@clean-url">clean URL support</a>, <a href="@site-info">site name and other information</a>, and a <a href="@site-maintenance">site maintenance</a> function for taking your site temporarily off-line.', array('@date-settings' => url('admin/settings/date-time'), '@file-system' => url('admin/settings/file-system'), '@clean-url' => url('admin/settings/clean-urls'), '@site-info' => url('admin/settings/site-information'), '@site-maintenance' => url('admin/settings/site-maintenance'))) .'</li></ul>';
Gábor Hojtsy
committed
$output .= '<p>'. t('For more information, see the online handbook entry for <a href="@system">System module</a>.', array('@system' => 'http://drupal.org/handbook/modules/system/')) .'</p>';
Dries Buytaert
committed
return $output;
Dries Buytaert
committed
case 'admin':
return '<p>'. t('Welcome to the administration section. Here you may control how your site functions.') .'</p>';
Steven Wittens
committed
case 'admin/by-module':
return '<p>'. t('This page shows you all available administration tasks for each module.') .'</p>';
Dries Buytaert
committed
case 'admin/build/themes':
Dries Buytaert
committed
$output = '<p>'. t('Select which themes are available to your users and specify the default theme. To configure site-wide display settings, click the "configure" task above. Alternatively, to override these settings in a specific theme, click the "configure" link for that theme. Note that different themes may have different regions available for displaying content; for consistency in presentation, you may wish to enable only one theme.') .'</p>';
$output .= '<p>'. t('To change the appearance of your site, a number of <a href="@themes">contributed themes</a> are available.', array('@themes' => 'http://drupal.org/project/themes')) .'</p>';
return $output;
Gábor Hojtsy
committed
case 'admin/build/themes/settings/'. $arg[4]:
$reference = explode('.', $arg[4], 2);
$theme = array_pop($reference);
return '<p>'. t('These options control the display settings for the <code>%template</code> theme. When your site is displayed using this theme, these settings will be used. By clicking "Reset to defaults," you can choose to use the <a href="@global">global settings</a> for this theme.', array('%template' => $theme, '@global' => url('admin/build/themes/settings'))) .'</p>';
Gábor Hojtsy
committed
case 'admin/build/themes/settings':
return '<p>'. t('These options control the default display settings for your entire site, across all themes. Unless they have been overridden by a specific theme, these settings will be used.') .'</p>';
Steven Wittens
committed
case 'admin/build/modules':
Dries Buytaert
committed
$output = '<p>'. t('Modules are plugins that extend Drupal\'s core functionality. Enable modules by selecting the <em>Enabled</em> checkboxes below and clicking the <em>Save configuration</em> button. Once a module is enabled, new <a href="@permissions">permissions</a> may be available. To reduce server load, modules with their <em>Throttle</em> checkbox selected are temporarily disabled when your site becomes extremely busy. (Note that the <em>Throttle</em> checkbox is only available if the Throttle module is enabled.)', array('@permissions' => url('admin/user/permissions')));
Dries Buytaert
committed
if (module_exists('throttle')) {
$output .= ' '. t('The auto-throttle functionality must be enabled on the <a href="@throttle">throttle configuration page</a> after having enabled the throttle module.', array('@throttle' => url('admin/settings/throttle')));
}
$output .= '</p>';
$output .= '<p>'. t('It is important that <a href="@update-php">update.php</a> is run every time a module is updated to a newer version.', array('@update-php' => $base_url .'/update.php')) .'</p>';
$output .= '<p>'. t('You can find all administration tasks belonging to a particular module on the <a href="@by-module">administration by module page</a>.', array('@by-module' => url('admin/by-module'))) .'</p>';
$output .= '<p>'. t('To extend the functionality of your site, a number of <a href="@modules">contributed modules</a> are available.', array('@modules' => 'http://drupal.org/project/modules')) .'</p>';
Gábor Hojtsy
committed
$output .= '<p>'. t('To clear all caches, click the button on the <a href="@performance">Performance page</a>.', array('@performance' => url('admin/settings/performance', array('fragment' => 'edit-clear')))) .'</p>';
Dries Buytaert
committed
return $output;
Dries Buytaert
committed
case 'admin/build/modules/uninstall':
return '<p>'. t('The uninstall process removes all data related to a module. To uninstall a module, you must first disable it. Not all modules support this feature.') .'</p>';
Gábor Hojtsy
committed
case 'admin/build/block/configure':
if ($arg[4] == 'system' && $arg[5] == 0) {
return '<p>'. t('The <em>Powered by Drupal</em> block is an optional link to the home page of the Drupal project. While there is absolutely no requirement that sites feature this link, it may be used to show support for Drupal.') .'</p>';
}
Gábor Hojtsy
committed
break;
Gábor Hojtsy
committed
case 'admin/settings/actions':
case 'admin/settings/actions/manage':
$output = '<p>'. t('Actions are individual tasks that the system can do, such as unpublishing a piece of content or banning a user. Modules, such as the trigger module, can fire these actions when certain system events happen; for example, when a new post is added or when a user logs in. Modules may also provide additional actions.') .'</p>';
$output .= '<p>'. t('There are two types of actions: simple and advanced. Simple actions do not require any additional configuration, and are listed here automatically. Advanced actions can do more than simple actions; for example, send an e-mail to a specified address, or check for certain words within a piece of content. These actions need to be created and configured first before they may be used. To create an advanced action, select the action from the drop-down below and click the <em>Create</em> button.') .'</p>';
if (module_exists('trigger')) {
$output .= '<p>'. t('You may proceed to the <a href="@url">Triggers</a> page to assign these actions to system events.', array('@url' => url('admin/build/trigger'))) .'</p>';
}
Gábor Hojtsy
committed
return $output;
Gábor Hojtsy
committed
case 'admin/settings/actions/configure':
return t('An advanced action offers additional configuration options which may be filled out below. Changing the <em>Description</em> field is recommended, in order to better identify the precise action taking place. This description will be displayed in modules such as the trigger module when assigning actions to system events, so it is best if it is as descriptive as possible (for example, "Send e-mail to Moderation Team" rather than simply "Send e-mail").');
case 'admin/reports/status':
Dries Buytaert
committed
return '<p>'. t("Here you can find a short overview of your site's parameters as well as any problems detected with your installation. It may be useful to copy and paste this information into support requests filed on drupal.org's support forums and project issue queues.") .'</p>';
Dries Buytaert
committed
}
/**
* Implementation of hook_theme().
*/
Dries Buytaert
committed
function system_theme() {
return array_merge(drupal_common_theme(), array(
Dries Buytaert
committed
'system_theme_select_form' => array(
'arguments' => array('form' => NULL),
'file' => 'system.admin.inc',
Dries Buytaert
committed
),
'system_themes_form' => array(
'arguments' => array('form' => NULL),
'file' => 'system.admin.inc',
Dries Buytaert
committed
),
'system_modules' => array(
'arguments' => array('form' => NULL),
'file' => 'system.admin.inc',
Dries Buytaert
committed
),
'system_modules_uninstall' => array(
'arguments' => array('form' => NULL),
'file' => 'system.admin.inc',
Dries Buytaert
committed
),
'status_report' => array(
'arguments' => array('requirements' => NULL),
'file' => 'system.admin.inc',
Dries Buytaert
committed
),
'admin_page' => array(
'arguments' => array('blocks' => NULL),
'file' => 'system.admin.inc',
Dries Buytaert
committed
),
'admin_block' => array(
'arguments' => array('block' => NULL),
'file' => 'system.admin.inc',
Dries Buytaert
committed
),
'admin_block_content' => array(
'arguments' => array('content' => NULL),
'file' => 'system.admin.inc',
Dries Buytaert
committed
),
'system_admin_by_module' => array(
'arguments' => array('menu_items' => NULL),
'file' => 'system.admin.inc',
Dries Buytaert
committed
),
Gábor Hojtsy
committed
'system_powered_by' => array(
'arguments' => array('image_path' => NULL),
),
Dries Buytaert
committed
));
}
Dries Buytaert
committed
return array('administer site configuration', 'access administration pages', 'administer actions', 'access site reports', 'select different theme', 'administer files');
/**
* Implementation of hook_elements().
*/
function system_elements() {
// Top level form
Gerhard Killesreiter
committed
$type['form'] = array('#method' => 'post', '#action' => request_uri());
$type['submit'] = array('#input' => TRUE, '#name' => 'op', '#button_type' => 'submit', '#executes_submit_callback' => TRUE, '#process' => array('form_expand_ahah'));
$type['button'] = array('#input' => TRUE, '#name' => 'op', '#button_type' => 'submit', '#executes_submit_callback' => FALSE, '#process' => array('form_expand_ahah'));
Gábor Hojtsy
committed
$type['image_button'] = array('#input' => TRUE, '#button_type' => 'submit', '#executes_submit_callback' => TRUE, '#process' => array('form_expand_ahah'), '#return_value' => TRUE, '#has_garbage_value' => TRUE, '#src' => NULL);
$type['textfield'] = array('#input' => TRUE, '#size' => 60, '#maxlength' => 128, '#autocomplete_path' => FALSE, '#process' => array('form_expand_ahah'));
$type['password'] = array('#input' => TRUE, '#size' => 60, '#maxlength' => 128, '#process' => array('form_expand_ahah'));
Dries Buytaert
committed
$type['password_confirm'] = array('#input' => TRUE, '#process' => array('expand_password_confirm'));
$type['textarea'] = array('#input' => TRUE, '#cols' => 60, '#rows' => 5, '#resizable' => TRUE, '#process' => array('form_expand_ahah'));
Dries Buytaert
committed
$type['radios'] = array('#input' => TRUE, '#process' => array('expand_radios'));
$type['radio'] = array('#input' => TRUE, '#default_value' => NULL, '#process' => array('form_expand_ahah'));
Dries Buytaert
committed
$type['checkboxes'] = array('#input' => TRUE, '#process' => array('expand_checkboxes'), '#tree' => TRUE);
$type['checkbox'] = array('#input' => TRUE, '#return_value' => 1, '#process' => array('form_expand_ahah'));
$type['select'] = array('#input' => TRUE, '#size' => 0, '#multiple' => FALSE, '#process' => array('form_expand_ahah'));
$type['weight'] = array('#input' => TRUE, '#delta' => 10, '#default_value' => 0, '#process' => array('process_weight', 'form_expand_ahah'));
$type['date'] = array('#input' => TRUE, '#process' => array('expand_date'), '#element_validate' => array('date_validate'));
Dries Buytaert
committed
$type['file'] = array('#input' => TRUE, '#size' => 60);
Dries Buytaert
committed
$type['item'] = array('#value' => '');
$type['hidden'] = array('#input' => TRUE, '#process' => array('form_expand_ahah'));
Dries Buytaert
committed
$type['value'] = array('#input' => TRUE);
$type['markup'] = array('#prefix' => '', '#suffix' => '');
$type['fieldset'] = array('#collapsible' => FALSE, '#collapsed' => FALSE, '#value' => NULL, '#process' => array('form_expand_ahah'));
Dries Buytaert
committed
function system_menu() {
$items['system/files'] = array(
'title' => 'File download',
Dries Buytaert
committed
'page callback' => 'file_download',
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
$items['admin'] = array(
'title' => 'Administer',
Dries Buytaert
committed
'access arguments' => array('access administration pages'),
'page callback' => 'system_main_admin_page',
'weight' => 9,
Dries Buytaert
committed
'file' => 'system.admin.inc',
Dries Buytaert
committed
);
$items['admin/compact'] = array(
'title' => 'Compact mode',
Dries Buytaert
committed
'page callback' => 'system_admin_compact_page',
Dries Buytaert
committed
'type' => MENU_CALLBACK,
'file' => 'system.admin.inc',
Dries Buytaert
committed
);
$items['admin/by-task'] = array(
'title' => 'By task',
Dries Buytaert
committed
'page callback' => 'system_main_admin_page',
Dries Buytaert
committed
'file' => 'system.admin.inc',
Dries Buytaert
committed
'type' => MENU_DEFAULT_LOCAL_TASK,
);
$items['admin/by-module'] = array(
'title' => 'By module',
Dries Buytaert
committed
'page callback' => 'system_admin_by_module',
'file' => 'system.admin.inc',
Dries Buytaert
committed
'type' => MENU_LOCAL_TASK,
'weight' => 2,
);
Gábor Hojtsy
committed
$items['admin/content'] = array(
'title' => 'Content management',
'description' => "Manage your site's content.",
'position' => 'left',
'weight' => -10,
'page callback' => 'system_admin_menu_block_page',
Gábor Hojtsy
committed
'file' => 'system.admin.inc',
);
Dries Buytaert
committed
// menu items that are basically just menu blocks
$items['admin/settings'] = array(
'title' => 'Site configuration',
'description' => 'Adjust basic site configuration options.',
Dries Buytaert
committed
'position' => 'right',
'weight' => -5,
'page callback' => 'system_settings_overview',
'file' => 'system.admin.inc',
Dries Buytaert
committed
);
$items['admin/build'] = array(
'title' => 'Site building',
'description' => 'Control how your site looks and feels.',
Dries Buytaert
committed
'position' => 'right',
'weight' => -10,
'page callback' => 'system_admin_menu_block_page',
Dries Buytaert
committed
'file' => 'system.admin.inc',
Dries Buytaert
committed
);
$items['admin/settings/admin'] = array(
'title' => 'Administration theme',
'description' => 'Settings for how your administrative pages should look.',
Dries Buytaert
committed
'position' => 'left',
'page callback' => 'drupal_get_form',
'page arguments' => array('system_admin_theme_settings'),
Dries Buytaert
committed
'access arguments' => array('administer site configuration'),
Dries Buytaert
committed
'block callback' => 'system_admin_theme_settings',
'file' => 'system.admin.inc',
Dries Buytaert
committed
);
// Themes:
$items['admin/build/themes'] = array(
'title' => 'Themes',
'description' => 'Change which theme your site uses or allows users to set.',
Dries Buytaert
committed
'page callback' => 'drupal_get_form',
Gábor Hojtsy
committed
'page arguments' => array('system_themes_form', NULL),
Dries Buytaert
committed
'access arguments' => array('administer site configuration'),
'file' => 'system.admin.inc',
Dries Buytaert
committed
);
$items['admin/build/themes/select'] = array(
'title' => 'List',
'description' => 'Select the default theme.',
Dries Buytaert
committed
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -1,
);
$items['admin/build/themes/settings'] = array(
'title' => 'Configure',
Gábor Hojtsy
committed
'page arguments' => array('system_theme_settings'),
Dries Buytaert
committed
'type' => MENU_LOCAL_TASK,
);
// Theme configuration subtabs
$items['admin/build/themes/settings/global'] = array(
'title' => 'Global settings',
Dries Buytaert
committed
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -1,
);
Dries Buytaert
committed
foreach (list_themes() as $theme) {
Gábor Hojtsy
committed
$items['admin/build/themes/settings/'. $theme->name] = array(
'title' => $theme->info['name'],
'page arguments' => array('system_theme_settings', $theme->name),
'type' => MENU_LOCAL_TASK,
'access callback' => '_system_themes_access',
'access arguments' => array($theme),
);
Dries Buytaert
committed
// Modules:
$items['admin/build/modules'] = array(
'title' => 'Modules',
'description' => 'Enable or disable add-on modules for your site.',
Dries Buytaert
committed
'page callback' => 'drupal_get_form',
'page arguments' => array('system_modules'),
Dries Buytaert
committed
'access arguments' => array('administer site configuration'),
'file' => 'system.admin.inc',
Dries Buytaert
committed
);
$items['admin/build/modules/list'] = array(
'title' => 'List',
Dries Buytaert
committed
'type' => MENU_DEFAULT_LOCAL_TASK,
);
$items['admin/build/modules/list/confirm'] = array(
'title' => 'List',
Dries Buytaert
committed
'type' => MENU_CALLBACK,
);
$items['admin/build/modules/uninstall'] = array(
'title' => 'Uninstall',
Dries Buytaert
committed
'page arguments' => array('system_modules_uninstall'),
Dries Buytaert
committed
'type' => MENU_LOCAL_TASK,
);
$items['admin/build/modules/uninstall/confirm'] = array(
'title' => 'Uninstall',
Dries Buytaert
committed
'type' => MENU_CALLBACK,
);
Gábor Hojtsy
committed
// Actions:
Gábor Hojtsy
committed
$items['admin/settings/actions'] = array(
Gábor Hojtsy
committed
'title' => 'Actions',
'description' => 'Manage the actions defined for your site.',
'access arguments' => array('administer actions'),
'page callback' => 'system_actions_manage'
);
Gábor Hojtsy
committed
$items['admin/settings/actions/manage'] = array(
Gábor Hojtsy
committed
'title' => 'Manage actions',
'description' => 'Manage the actions defined for your site.',
'page callback' => 'system_actions_manage',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -2,
);
Gábor Hojtsy
committed
$items['admin/settings/actions/configure'] = array(
'title' => 'Configure an advanced action',
Gábor Hojtsy
committed
'page callback' => 'drupal_get_form',
'page arguments' => array('system_actions_configure'),
Gábor Hojtsy
committed
'type' => MENU_CALLBACK,
);
Gábor Hojtsy
committed
$items['admin/settings/actions/delete/%actions'] = array(
Gábor Hojtsy
committed
'title' => 'Delete action',
'description' => 'Delete an action.',
'page callback' => 'drupal_get_form',
'page arguments' => array('system_actions_delete_form', 4),
Gábor Hojtsy
committed
'type' => MENU_CALLBACK,
);
Gábor Hojtsy
committed
$items['admin/settings/actions/orphan'] = array(
Gábor Hojtsy
committed
'title' => 'Remove orphans',
'page callback' => 'system_actions_remove_orphans',
Gábor Hojtsy
committed
'type' => MENU_CALLBACK,
);
Dries Buytaert
committed
// Settings:
$items['admin/settings/site-information'] = array(
'title' => 'Site information',
'description' => 'Change basic site information, such as the site name, slogan, e-mail address, mission, front page and more.',
Dries Buytaert
committed
'page callback' => 'drupal_get_form',
'page arguments' => array('system_site_information_settings'),
Dries Buytaert
committed
'access arguments' => array('administer site configuration'),
'file' => 'system.admin.inc',
Dries Buytaert
committed
);
$items['admin/settings/error-reporting'] = array(
'title' => 'Error reporting',
'description' => 'Control how Drupal deals with errors including 403/404 errors as well as PHP error reporting.',
Dries Buytaert
committed
'page callback' => 'drupal_get_form',
'page arguments' => array('system_error_reporting_settings'),
Dries Buytaert
committed
'access arguments' => array('administer site configuration'),
'file' => 'system.admin.inc',
Dries Buytaert
committed
);
Dries Buytaert
committed
$items['admin/settings/logging'] = array(
'title' => 'Logging and alerts',
'description' => "Settings for logging and alerts modules. Various modules can route Drupal's system events to different destination, such as syslog, database, email, ...etc.",
Dries Buytaert
committed
'page callback' => 'system_logging_overview',
Dries Buytaert
committed
'access arguments' => array('administer site configuration'),
'file' => 'system.admin.inc',
Dries Buytaert
committed
);
Dries Buytaert
committed
$items['admin/settings/performance'] = array(
'title' => 'Performance',
'description' => 'Enable or disable page caching for anonymous users and set CSS and JS bandwidth optimization options.',
Dries Buytaert
committed
'page callback' => 'drupal_get_form',
'page arguments' => array('system_performance_settings'),
Dries Buytaert
committed
'access arguments' => array('administer site configuration'),
'file' => 'system.admin.inc',
Dries Buytaert
committed
);
$items['admin/settings/file-system'] = array(
'title' => 'File system',
'description' => 'Tell Drupal where to store uploaded files and how they are accessed.',
Dries Buytaert
committed
'page callback' => 'drupal_get_form',
'page arguments' => array('system_file_system_settings'),
Dries Buytaert
committed
'access arguments' => array('administer site configuration'),
'file' => 'system.admin.inc',
Dries Buytaert
committed
);
$items['admin/settings/image-toolkit'] = array(
'title' => 'Image toolkit',
'description' => 'Choose which image toolkit to use if you have installed optional toolkits.',
Dries Buytaert
committed
'page callback' => 'drupal_get_form',
'page arguments' => array('system_image_toolkit_settings'),
Dries Buytaert
committed
'access arguments' => array('administer site configuration'),
'file' => 'system.admin.inc',
Dries Buytaert
committed
);
$items['admin/content/rss-publishing'] = array(
'title' => 'RSS publishing',
'description' => 'Configure the number of items per feed and whether feeds should be titles/teasers/full-text.',
Dries Buytaert
committed
'page callback' => 'drupal_get_form',
'page arguments' => array('system_rss_feeds_settings'),
'access arguments' => array('administer site configuration'),
'file' => 'system.admin.inc',
Dries Buytaert
committed
);
$items['admin/settings/date-time'] = array(
'title' => 'Date and time',
'description' => "Settings for how Drupal displays date and time, as well as the system's default timezone.",
Dries Buytaert
committed
'page callback' => 'drupal_get_form',
'page arguments' => array('system_date_time_settings'),
Dries Buytaert
committed
'access arguments' => array('administer site configuration'),
'file' => 'system.admin.inc',
Dries Buytaert
committed
);
$items['admin/settings/date-time/lookup'] = array(
'title' => 'Date and time lookup',
'type' => MENU_CALLBACK,
'page callback' => 'system_date_time_lookup',
'file' => 'system.admin.inc',
Dries Buytaert
committed
$items['admin/settings/site-maintenance'] = array(
'title' => 'Site maintenance',
'description' => 'Take the site off-line for maintenance or bring it back online.',
Dries Buytaert
committed
'page callback' => 'drupal_get_form',
'page arguments' => array('system_site_maintenance_settings'),
Dries Buytaert
committed
'access arguments' => array('administer site configuration'),
'file' => 'system.admin.inc',
Dries Buytaert
committed
);
$items['admin/settings/clean-urls'] = array(
'title' => 'Clean URLs',
'description' => 'Enable or disable clean URLs for your site.',
Dries Buytaert
committed
'page callback' => 'drupal_get_form',
'page arguments' => array('system_clean_url_settings'),
Dries Buytaert
committed
'access arguments' => array('administer site configuration'),
'file' => 'system.admin.inc',
Dries Buytaert
committed
);
Gábor Hojtsy
committed
$items['admin/settings/clean-urls/check'] = array(
'title' => 'Clean URL check',
'page callback' => 'drupal_json',
'page arguments' => array(array('status' => TRUE)),
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
Dries Buytaert
committed
// Reports:
$items['admin/reports'] = array(
'title' => 'Reports',
'description' => 'View reports from system logs and other status information.',
Dries Buytaert
committed
'page callback' => 'system_admin_menu_block_page',
Dries Buytaert
committed
'access arguments' => array('access site reports'),
Dries Buytaert
committed
'weight' => 5,
'position' => 'left',
Dries Buytaert
committed
'file' => 'system.admin.inc',
Dries Buytaert
committed
);
$items['admin/reports/status'] = array(
'title' => 'Status report',
'description' => "Get a status report about your site's operation and any detected problems.",
Dries Buytaert
committed
'page callback' => 'system_status',
'weight' => 10,
'access arguments' => array('administer site configuration'),
'file' => 'system.admin.inc',
Dries Buytaert
committed
);
$items['admin/reports/status/run-cron'] = array(
'title' => 'Run cron',
Dries Buytaert
committed
'page callback' => 'system_run_cron',
Dries Buytaert
committed
'type' => MENU_CALLBACK,
'file' => 'system.admin.inc',
Dries Buytaert
committed
);
$items['admin/reports/status/php'] = array(
'title' => 'PHP',
Dries Buytaert
committed
'page callback' => 'system_php',
Dries Buytaert
committed
'type' => MENU_CALLBACK,
'file' => 'system.admin.inc',
Dries Buytaert
committed
);
$items['admin/reports/status/sql'] = array(
'title' => 'SQL',
Dries Buytaert
committed
'page callback' => 'system_sql',
Dries Buytaert
committed
'type' => MENU_CALLBACK,
'file' => 'system.admin.inc',
Dries Buytaert
committed
);
// Default page for batch operations
$items['batch'] = array(
'page callback' => 'system_batch_page',
'access callback' => TRUE,
'type' => MENU_CALLBACK,
'file' => 'system.admin.inc',
);
Gábor Hojtsy
committed
/**
* Menu item access callback - only admin or enabled themes can be accessed.
*/
function _system_themes_access($theme) {
return user_access('administer site configuration') && ($theme->status || $theme->name == variable_get('admin_theme', '0'));
Gábor Hojtsy
committed
}
/**
* Implementation of hook_init().
*/
Dries Buytaert
committed
function system_init() {
// Use the administrative theme if the user is looking at a page in the admin/* path.
Dries Buytaert
committed
if (arg(0) == 'admin' || (variable_get('node_admin_theme', '0') && arg(0) == 'node' && (arg(1) == 'add' || arg(2) == 'edit'))) {
Dries Buytaert
committed
global $custom_theme;
$custom_theme = variable_get('admin_theme', '0');
drupal_add_css(drupal_get_path('module', 'system') .'/admin.css', 'module');
}
// Add the CSS for this module.
drupal_add_css(drupal_get_path('module', 'system') .'/defaults.css', 'module');
drupal_add_css(drupal_get_path('module', 'system') .'/system.css', 'module');
Gábor Hojtsy
committed
drupal_add_css(drupal_get_path('module', 'system') .'/system-menus.css', 'module');
Dries Buytaert
committed
}
/**
* Implementation of hook_user().
*
* Allows users to individually set their theme and time zone.
*/
function system_user($type, $edit, &$user, $category = NULL) {
if ($type == 'form' && $category == 'account') {
Dries Buytaert
committed
$form['theme_select'] = system_theme_select_form(t('Selecting a different theme will change the look and feel of the site.'), isset($edit['theme']) ? $edit['theme'] : NULL, 2);
if (variable_get('configurable_timezones', 1)) {
$form['timezone'] = array(
Dries Buytaert
committed
'#type' => 'fieldset',
'#title' => t('Locale settings'),
'#weight' => 6,
'#collapsible' => TRUE,
);
$form['timezone']['timezone'] = array(
'#type' => 'select',
'#title' => t('Time zone'),
'#default_value' => strlen($edit['timezone']) ? $edit['timezone'] : variable_get('date_default_timezone', 0),
'#options' => $zones,
'#description' => t('Select your current local time. Dates and times throughout this site will be displayed using this time zone.'),
Gábor Hojtsy
committed
/**
* Implementation of hook_block().
*
Gábor Hojtsy
committed
* Generate a block with a promotional link to Drupal.org.
*/
function system_block($op = 'list', $delta = 0, $edit = NULL) {
Gábor Hojtsy
committed
switch ($op) {
Gábor Hojtsy
committed
case 'list':
$blocks[0] = array(
'info' => t('Powered by Drupal'),
'weight' => '10',
Gábor Hojtsy
committed
// Not worth caching.
'cache' => BLOCK_NO_CACHE,
Gábor Hojtsy
committed
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
);
return $blocks;
case 'configure':
// Compile a list of fields to show
$form['wrapper']['color'] = array(
'#type' => 'select',
'#title' => t('Badge color'),
'#default_value' => variable_get('drupal_badge_color', 'powered-blue'),
'#options' => array('powered-black' => t('Black'), 'powered-blue' => t('Blue'), 'powered-gray' => t('Gray')),
);
$form['wrapper']['size'] = array(
'#type' => 'select',
'#title' => t('Badge size'),
'#default_value' => variable_get('drupal_badge_size', '80x15'),
'#options' => array('80x15' => t('Small'), '88x31' => t('Medium'), '135x42' => t('Large')),
);
return $form;
case 'save':
variable_set('drupal_badge_color', $edit['color']);
variable_set('drupal_badge_size', $edit['size']);
break;
case 'view':
$image_path = 'misc/'. variable_get('drupal_badge_color', 'powered-blue') .'-'. variable_get('drupal_badge_size', '80x15') .'.png';
$block['subject'] = NULL; // Don't display a title
$block['content'] = theme('system_powered_by', $image_path);
return $block;
}
}
Dries Buytaert
committed
/**
* Provide a single block on the administration overview page.
*
* @param $item
* The menu item to be displayed.
Dries Buytaert
committed
*/
function system_admin_menu_block($item) {
Dries Buytaert
committed
$content = array();
Dries Buytaert
committed
if (!isset($item['mlid'])) {
Gábor Hojtsy
committed
$item += db_fetch_array(db_query("SELECT mlid, menu_name FROM {menu_links} ml WHERE ml.router_path = '%s' AND module = 'system'", $item['path']));
Dries Buytaert
committed
$result = db_query("
SELECT m.load_functions, m.to_arg_functions, m.access_callback, m.access_arguments, m.page_callback, m.page_arguments, m.title, m.title_callback, m.title_arguments, m.type, m.description, ml.*
Dries Buytaert
committed
FROM {menu_links} ml
LEFT JOIN {menu_router} m ON ml.router_path = m.path
Gábor Hojtsy
committed
WHERE ml.plid = %d AND ml.menu_name = '%s' AND hidden = 0", $item['mlid'], $item['menu_name']);
Dries Buytaert
committed
while ($item = db_fetch_array($result)) {
_menu_link_translate($item);
Dries Buytaert
committed
if (!$item['access']) {
continue;
Dries Buytaert
committed
}
Gábor Hojtsy
committed
// The link 'description' either derived from the hook_menu 'description' or
// entered by the user via menu module is saved as the title attribute.
if (!empty($item['localized_options']['attributes']['title'])) {
$item['description'] = $item['localized_options']['attributes']['title'];
Gábor Hojtsy
committed
}
// Prepare for sorting as in function _menu_tree_check_access().
// The weight is offset so it is always positive, with a uniform 5-digits.
$content[(50000 + $item['weight']) .' '. drupal_strtolower($item['title']) .' '. $item['mlid']] = $item;
Dries Buytaert
committed
}
Gábor Hojtsy
committed
ksort($content);
Dries Buytaert
committed
return $content;
}
/**
* Process admin theme form submissions.
*/
Dries Buytaert
committed
function system_admin_theme_submit($form, &$form_state) {
Dries Buytaert
committed
// If we're changing themes, make sure the theme has its blocks initialized.
Gábor Hojtsy
committed
if ($form_state['values']['admin_theme'] && $form_state['values']['admin_theme'] != variable_get('admin_theme', '0')) {
Dries Buytaert
committed
$result = db_result(db_query("SELECT COUNT(*) FROM {blocks} WHERE theme = '%s'", $form_state['values']['admin_theme']));
if (!$result) {
Dries Buytaert
committed
system_initialize_theme_blocks($form_state['values']['admin_theme']);
Dries Buytaert
committed
}
}
}
/**
* Returns a fieldset containing the theme select form.
*
* @param $description
* description of the fieldset
* @param $default_value
* default value of theme radios
* @param $weight
* weight of the fieldset
* @return
* a form array
*/
function system_theme_select_form($description = '', $default_value = '', $weight = 0) {
if (user_access('select different theme')) {
Steven Wittens
committed
$enabled = array();
Dries Buytaert
committed
$themes = list_themes();
foreach ($themes as $theme) {
if ($theme->status) {
$enabled[] = $theme;
}
}
if (count($enabled) > 1) {
ksort($enabled);
$form['themes'] = array(
'#type' => 'fieldset',
'#title' => t('Theme configuration'),
'#description' => $description,
'#collapsible' => TRUE,
'#theme' => 'system_theme_select_form'
);
foreach ($enabled as $info) {
// For the default theme, revert to an empty string so the user's theme updates when the site theme is changed.
Dries Buytaert
committed
$info->key = $info->name == variable_get('theme_default', 'garland') ? '' : $info->name;
Dries Buytaert
committed
$screenshot = NULL;
$theme_key = $info->name;
while ($theme_key) {
if (file_exists($themes[$theme_key]->info['screenshot'])) {
$screenshot = $themes[$theme_key]->info['screenshot'];
break;
}
$theme_key = isset($themes[$theme_key]->info['base theme']) ? $themes[$theme_key]->info['base theme'] : NULL;
}
$screenshot = $screenshot ? theme('image', $screenshot, t('Screenshot for %theme theme', array('%theme' => $info->name)), '', array('class' => 'screenshot'), FALSE) : t('no screenshot');
$form['themes'][$info->key]['screenshot'] = array('#value' => $screenshot);
$form['themes'][$info->key]['description'] = array('#type' => 'item', '#title' => $info->name, '#value' => dirname($info->filename) . ($info->name == variable_get('theme_default', 'garland') ? '<br /> <em>'. t('(site default theme)') .'</em>' : ''));
$options[$info->key] = '';
}
$form['themes']['theme'] = array('#type' => 'radios', '#options' => $options, '#default_value' => $default_value ? $default_value : '');
$form['#weight'] = $weight;
return $form;
}
}
}
Dries Buytaert
committed
/**
* Checks the existence of the directory specified in $form_element. This
* function is called from the system_settings form to check both the
Dries Buytaert
committed
* file_directory_path and file_directory_temp directories. If validation
* fails, the form element is flagged with an error from within the
* file_check_directory function.
*
* @param $form_element
* The form element containing the name of the directory to check.
*/
function system_check_directory($form_element) {
Dries Buytaert
committed
file_check_directory($form_element['#value'], FILE_CREATE_DIRECTORY, $form_element['#parents'][0]);
return $form_element;
}
/**
* Retrieves the current status of an array of files in the system table.
*
* @param $files
* An array of files to check.
* @param $type
* The type of the files.
Gerhard Killesreiter
committed
$result = db_query("SELECT filename, name, type, status, throttle, schema_version FROM {system} WHERE type = '%s'", $type);
if (isset($files[$file->name]) && is_object($files[$file->name])) {
Gerhard Killesreiter
committed
$file->old_filename = $file->filename;
if (!isset($files[$file->name]) || !isset($files[$file->name]->$key)) {
$files[$file->name]->$key = $value;
}
/**
* Prepare defaults for themes.
*
* @return
* An array of default themes settings.
*/
function system_theme_default() {
return array(
'regions' => array(
'left' => 'Left sidebar',
'right' => 'Right sidebar',
'content' => 'Content',
'header' => 'Header',
'footer' => 'Footer',
),
'description' => '',
'features' => array(
'comment_user_picture',
'favicon',
'mission',
'logo',
'name',
'node_user_picture',
'search',
Gábor Hojtsy
committed
'slogan',
'primary_links',
'secondary_links',
Gábor Hojtsy
committed
'stylesheets' => array(
'all' => array('style.css')
),
'scripts' => array('script.js'),
Dries Buytaert
committed
'screenshot' => 'screenshot.png',
Gábor Hojtsy
committed
'php' => DRUPAL_MINIMUM_PHP,
);
}
* Collect data about all currently available themes.
*
* @return
* Array of all available themes and their data.
// Scan the installation theme .info files and their engines.
$themes = _system_theme_data();
// Extract current files from database.
system_get_files_database($themes, 'theme');
db_query("DELETE FROM {system} WHERE type = 'theme'");
foreach ($themes as $theme) {
if (!isset($theme->owner)) {
$theme->owner = '';
Gábor Hojtsy
committed
}
db_query("INSERT INTO {system} (name, owner, info, type, filename, status, throttle, bootstrap) VALUES ('%s', '%s', '%s', '%s', '%s', %d, %d, %d)", $theme->name, $theme->owner, serialize($theme->info), 'theme', $theme->filename, isset($theme->status) ? $theme->status : 0, 0, 0);
}
return $themes;
}
Gábor Hojtsy
committed
/**
* Helper function to scan and collect theme .info data and their engines.
*
* @return
* An associative array of themes information.
*/
function _system_theme_data() {
static $themes_info = array();
Gábor Hojtsy
committed
Dries Buytaert
committed
if (empty($themes_info)) {
// Find themes
$themes = drupal_system_listing('\.info$', 'themes');
// Find theme engines
$engines = drupal_system_listing('\.engine$', 'themes/engines');
$defaults = system_theme_default();
$sub_themes = array();
// Read info files for each theme
foreach ($themes as $key => $theme) {
$themes[$key]->info = drupal_parse_info_file($theme->filename) + $defaults;
// Invoke hook_system_info_alter() to give installed modules a chance to
// modify the data in the .info files if necessary.
drupal_alter('system_info', $themes[$key]->info, $themes[$key]);
if (!empty($themes[$key]->info['base theme'])) {
$sub_themes[] = $key;
if (empty($themes[$key]->info['engine'])) {
$filename = dirname($themes[$key]->filename) .'/'. $themes[$key]->name .'.theme';
if (file_exists($filename)) {
$themes[$key]->owner = $filename;
$themes[$key]->prefix = $key;
}
Dries Buytaert
committed
}
else {
$engine = $themes[$key]->info['engine'];
if (isset($engines[$engine])) {
$themes[$key]->owner = $engines[$engine]->filename;
$themes[$key]->prefix = $engines[$engine]->name;
$themes[$key]->template = TRUE;
}
Gábor Hojtsy
committed
}
// Give the stylesheets proper path information.
$pathed_stylesheets = array();
foreach ($themes[$key]->info['stylesheets'] as $media => $stylesheets) {
foreach ($stylesheets as $stylesheet) {
$pathed_stylesheets[$media][$stylesheet] = dirname($themes[$key]->filename) .'/'. $stylesheet;
}
}
$themes[$key]->info['stylesheets'] = $pathed_stylesheets;
// Give the scripts proper path information.
$scripts = array();
foreach ($themes[$key]->info['scripts'] as $script) {
$scripts[$script] = dirname($themes[$key]->filename) .'/'. $script;
Dries Buytaert
committed
}
$themes[$key]->info['scripts'] = $scripts;
// Give the screenshot proper path information.
if (!empty($themes[$key]->info['screenshot'])) {
$themes[$key]->info['screenshot'] = dirname($themes[$key]->filename) .'/'. $themes[$key]->info['screenshot'];
// Now that we've established all our master themes, go back and fill in
// data for subthemes.
foreach ($sub_themes as $key) {
$themes[$key]->base_themes = system_find_base_themes($themes, $key);
// Don't proceed if there was a problem with the root base theme.
if (!current($themes[$key]->base_themes)) {
continue;
}
$base_key = key($themes[$key]->base_themes);
foreach (array_keys($themes[$key]->base_themes) as $base_theme) {
$themes[$base_theme]->sub_themes[$key] = $themes[$key]->info['name'];
}
// Copy the 'owner' and 'engine' over if the top level theme uses a
// theme engine.
if (isset($themes[$base_key]->owner)) {
if (isset($themes[$base_key]->info['engine'])) {
$themes[$key]->info['engine'] = $themes[$base_key]->info['engine'];
$themes[$key]->owner = $themes[$base_key]->owner;
$themes[$key]->prefix = $themes[$base_key]->prefix;
}
else {
$themes[$key]->prefix = $key;
}
}
Dries Buytaert
committed
}
Gábor Hojtsy
committed
$themes_info = $themes;
Gábor Hojtsy
committed
// To avoid side effects, we don't return the original objects.
$themes_info_cloned = array();
foreach ($themes_info as $key => $theme) {
$themes_info_cloned[$key] = drupal_clone($theme);
}
return $themes_info_cloned;
Dries Buytaert
committed
/**
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
* Find all the base themes for the specified theme.
*
* Themes can inherit templates and function implementations from earlier themes.
*
* @param $themes
* An array of available themes.
* @param $key
* The name of the theme whose base we are looking for.
* @param $used_keys
* A recursion parameter preventing endless loops.
* @return
* Returns an array of all of the theme's ancestors; the first element's value
* will be NULL if an error occurred.
*/
function system_find_base_themes($themes, $key, $used_keys = array()) {
$base_key = $themes[$key]->info['base theme'];
// Does the base theme exist?
if (!isset($themes[$base_key])) {
return array($base_key => NULL);
}
$current_base_theme = array($base_key => $themes[$base_key]->info['name']);
// Is the base theme itself a child of another theme?
if (isset($themes[$base_key]->info['base theme'])) {
// Do we already know the base themes of this theme?
if (isset($themes[$base_key]->base_themes)) {
return $themes[$base_key]->base_themes + $current_base_theme;
}
// Prevent loops.
if (!empty($used_keys[$base_key])) {
return array($base_key => NULL);
}
$used_keys[$base_key] = TRUE;
return system_find_base_themes($themes, $base_key, $used_keys) + $current_base_theme;
}
// If we get here, then this is our parent theme.
return $current_base_theme;
}
/**
* This function has been deprecated in favor of system_find_base_themes().
*
Dries Buytaert
committed
* Recursive function to find the top level base theme. Themes can inherit
* templates and function implementations from earlier themes.
*
* @param $themes
* An array of available themes.
* @param $key
* The name of the theme whose base we are looking for.
* @param $used_keys
* A recursion parameter preventing endless loops.
* @return
* Returns the top level parent that has no ancestor or returns NULL if there isn't a valid parent.
Dries Buytaert
committed
*/
function system_find_base_theme($themes, $key, $used_keys = array()) {
$base_key = $themes[$key]->info['base theme'];
// Does the base theme exist?
if (!isset($themes[$base_key])) {
return NULL;
}
// Is the base theme itself a child of another theme?
if (isset($themes[$base_key]->info['base theme'])) {
// Prevent loops.
Gábor Hojtsy
committed
if (!empty($used_keys[$base_key])) {
Dries Buytaert
committed
return NULL;
}
$used_keys[$base_key] = TRUE;