* Configuration system that lets administrators modify the workings of the site.
*/
/**
* The current system version.
*/
define('VERSION', '6.0');
/**
* Core API compatibility.
*/
define('DRUPAL_CORE_COMPATIBILITY', '6.x');
/**
* Minimum supported version of PHP.
*/
define('DRUPAL_MINIMUM_PHP', '4.3.5');
/**
* Minimum recommended value of PHP memory_limit.
*/
define('DRUPAL_MINIMUM_PHP_MEMORY_LIMIT', '16M');
/**
* Minimum supported version of MySQL, if it is used.
*/
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', 1440);
/**
* Implementation of hook_help().
*/
function system_help($path, $arg) {
global $base_url;
switch ($path) {
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>';
$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>';
$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>';
return $output;
case 'admin':
return '<p>'. t('Welcome to the administration section. Here you may control how your site functions.') .'</p>';
case 'admin/by-module':
return '<p>'. t('This page shows you all available administration tasks for each module.') .'</p>';
case 'admin/build/themes':
$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;
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>';
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>';
case 'admin/build/modules':
$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')));
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>';
return $output;
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>';
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>';
}
break;
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>';
}
return $output;
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':
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>';
}
}
/**
* Implementation of hook_theme().
*/
function system_theme() {
return array_merge(drupal_common_theme(), array(
'system_theme_select_form' => array(
'arguments' => array('form' => NULL),
'file' => 'system.admin.inc',
),
'system_themes_form' => array(
'arguments' => array('form' => NULL),
'file' => 'system.admin.inc',
),
'system_modules' => array(
'arguments' => array('form' => NULL),
'file' => 'system.admin.inc',
),
'system_modules_uninstall' => array(
'arguments' => array('form' => NULL),
'file' => 'system.admin.inc',
),
'status_report' => array(
'arguments' => array('requirements' => NULL),
'file' => 'system.admin.inc',
),
'admin_page' => array(
'arguments' => array('blocks' => NULL),
'file' => 'system.admin.inc',
),
'admin_block' => array(
'arguments' => array('block' => NULL),
'file' => 'system.admin.inc',
),
'admin_block_content' => array(
'arguments' => array('content' => NULL),
'file' => 'system.admin.inc',
),
'system_admin_by_module' => array(
'arguments' => array('menu_items' => NULL),
'file' => 'system.admin.inc',
),
'system_powered_by' => array(
'arguments' => array('image_path' => NULL),
),
));
}
/**
* Implementation of hook_perm().
*/
function system_perm() {
return array('administer site configuration', 'access administration pages', 'administer actions', 'access site reports', 'select different theme', 'administer files');
'access arguments' => array('administer site configuration'),
'file' => 'system.admin.inc',
);
$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.",
'page callback' => 'system_logging_overview',
'access arguments' => array('administer site configuration'),
'file' => 'system.admin.inc',
);
$items['admin/settings/performance'] = array(
'title' => 'Performance',
'description' => 'Enable or disable page caching for anonymous users and set CSS and JS bandwidth optimization options.',
* Allows users to individually set their theme and time zone.
*/
function system_user($type, $edit, &$user, $category = NULL) {
if ($type == 'form' && $category == 'account') {
$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);
FROM {menu_links} ml INNER JOIN {menu_router} m ON ml.router_path = m.path WHERE ml.link_path LIKE 'admin/%' AND hidden >= 0 AND module = 'system' AND m.number_parts > 2");
$items = array();
while ($item = db_fetch_array($result)) {
_menu_link_translate($item);
if ($item['access']) {
$items[$item['router_path']] = $item;
}
}
}
$admin_tasks = array();
$admin_task_count = 0;
// Check for permissions.
if (module_hook($module, 'perm') && $admin_access) {
'#description' => t('A unique description for this advanced action. This description will be displayed in the interface of modules that integrate with actions, such as Trigger module.'),
'#weight' => -10
);
$action_form = $function .'_form';
$form = array_merge($form, $action_form($edit));
$form['actions_type'] = array(
'#type' => 'value',
'#value' => $edit['actions_type'],
);
$form['actions_action'] = array(
'#type' => 'hidden',
'#value' => $action,
);
// $aid is set when configuring an existing action instance.
if (isset($aid)) {
$form['actions_aid'] = array(
'#type' => 'hidden',
'#value' => $aid,
);
}
$form['actions_configured'] = array(
'#type' => 'hidden',
'#value' => '1',
);
$form['buttons']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
'#weight' => 13
);
return $form;
}
/**
* Validate system_actions_configure form submissions.
*/
function system_actions_configure_validate($form, $form_state) {
* Remove actions that are in the database but not supported by any enabled module.
*/
function system_actions_remove_orphans() {
actions_synchronize(actions_list(), TRUE);
drupal_goto('admin/settings/actions/manage');
}
/**
* Return a form definition so the Send email action can be configured.
*
* @see system_send_email_action_validate()
* @see system_send_email_action_submit()
* @param $context
* Default values (if we are editing an existing action instance).
* @return
* Form definition.
*/
function system_send_email_action_form($context) {
// Set default values for form.
if (!isset($context['recipient'])) {
$context['recipient'] = '';
}
if (!isset($context['subject'])) {
$context['subject'] = '';
}
if (!isset($context['message'])) {
$context['message'] = '';
}
$form['recipient'] = array(
'#type' => 'textfield',
'#title' => t('Recipient'),
'#default_value' => $context['recipient'],
'#maxlength' => '254',
'#description' => t('The email address to which the message should be sent OR enter %author if you would like to send an e-mail to the author of the original post.', array('%author' => '%author')),
);
$form['subject'] = array(
'#type' => 'textfield',
'#title' => t('Subject'),
'#default_value' => $context['subject'],
'#maxlength' => '254',
'#description' => t('The subject of the message.'),
);
$form['message'] = array(
'#type' => 'textarea',
'#title' => t('Message'),
'#default_value' => $context['message'],
'#cols' => '80',
'#rows' => '20',
'#description' => t('The message that should be sent. You may include the following variables: %site_name, %username, %node_url, %node_type, %title, %teaser, %body. Not all variables will be available in all contexts.'),
);
return $form;
}
/**
* Validate system_send_email_action form submissions.
*/
function system_send_email_action_validate($form, $form_state) {
$form_values = $form_state['values'];
// Validate the configuration form.
if (!valid_email_address($form_values['recipient']) && $form_values['recipient'] != '%author') {
// We want the literal %author placeholder to be emphasized in the error message.
form_set_error('recipient', t('Please enter a valid email address or %author.', array('%author' => '%author')));
}
}
/**
* Process system_send_email_action form submissions.
*/
function system_send_email_action_submit($form, $form_state) {
$form_values = $form_state['values'];
// Process the HTML form to store configuration. The keyed array that
// we return will be serialized to the database.
$params = array(
'recipient' => $form_values['recipient'],
'subject' => $form_values['subject'],
'message' => $form_values['message'],
);
return $params;
}
/**
* Implementation of a configurable Drupal action. Sends an email.
*/
function system_send_email_action($object, $context) {
global $user;
switch ($context['hook']) {
case 'nodeapi':
// Because this is not an action of type 'node' the node
// will not be passed as $object, but it will still be available
// in $context.
$node = $context['node'];
break;
// The comment hook provides nid, in $context.
case 'comment':
$comment = $context['comment'];
$node = node_load($comment->nid);
break;
case 'user':
// Because this is not an action of type 'user' the user
// object is not passed as $object, but it will still be available
// in $context.
$account = $context['account'];
if (isset($context['node'])) {
$node = $context['node'];
}
elseif ($context['recipient'] == '%author') {
// If we don't have a node, we don't have a node author.
watchdog('error', 'Cannot use %author token in this context.');
'#description' => t('The message to be displayed to the current user. You may include the following variables: %site_name, %username, %node_url, %node_type, %title, %teaser, %body. Not all variables will be available in all contexts.'),
);
return $form;
}
function system_message_action_submit($form, $form_state) {
* Implementation of a configurable Drupal action. Redirect user to a URL.
*/
function system_goto_action_form($context) {
$form['url'] = array(
'#type' => 'textfield',
'#title' => t('URL'),
'#description' => t('The URL to which the user should be redirected. This can be an internal URL like node/1234 or an external URL like http://drupal.org.'),
$image = theme('image', $image_path, t('Powered by Drupal, an open source content management system'), t('Powered by Drupal, an open source content management system'));