'. t('The system module provides system-wide defaults such as running jobs at a particular time, and storing web pages to improve efficiency. The ability to run scheduled jobs makes administering the web site more usable, as administrators do not have to manually start jobs. The storing of web pages, or caching, allows the site to efficiently re-use web pages and improve web site performance. The settings module provides control over preferences, behaviours including visual and operational settings.') .'
'; $output .= ''. t('Some modules require regularly scheduled actions, such as cleaning up logfiles. Cron, which stands for chronograph, is a periodic command scheduler executing commands at intervals specified in seconds. It can be used to control the execution of daily, weekly and monthly jobs (or anything with a period measured in seconds). The aggregator module periodically updates feeds using cron. Ping periodically notifies services of new content on your site. Search periodically indexes the content on your site. Automating tasks is one of the best ways to keep a system running smoothly, and if most of your administration does not require your direct involvement, cron is an ideal solution.') .'
'; $output .= ''. t('There is a caching mechanism which stores dynamically generated web pages in a database. By caching a web page, the system module does not have to create the page each time someone wants to view it, instead it takes only one SQL query to display it, reducing response time and the server\'s load. Only pages requested by anonymous users are cached. In order to reduce server load and save bandwidth, the system module stores and sends cached pages compressed.') .'
'; $output .= t('You can
'. t('For more information please read the configuration and customization handbook System page.', array('%system' => 'http://www.drupal.org/handbook/modules/system/')) .'
'; return $output; case 'admin/modules#description': return t('Handles general site configuration for administrators.'); case 'admin': return t('Welcome to the administration section. Below are the most recent system events.
'); case 'admin/settings': return t('General configuration options for your site. Set up the name of the site, e-mail address used in mail-outs, clean URL options, caching, etc.
'); case 'admin/themes': return 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. Alternately, to override these settings in a specific theme, click the "configure" link for the corresponding theme. Note that different themes may have different regions available for rendering content like blocks. If you want consistency in what your users see, you may wish to enable only one theme.
'); case 'admin/themes/settings': return 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.
'); case 'admin/themes/settings/'. arg(3): $reference = explode('.', arg(3), 2); $theme = array_pop($reference); return t('These options control the display settings for the %template
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 global settings for this theme.
Modules are plugins for Drupal that extend its core functionality. Here you can select which modules are enabled. Click on the name of the module in the navigation menu for their individual configuration pages. Once a module is enabled, new permissions might be made available. Modules can automatically be temporarily disabled to reduce server load when your site becomes extremely busy by enabling the throttle.module and checking throttle. The auto-throttle functionality must be enabled on the throttle configuration page after having enabled the throttle module.
', array('%permissions' => url('admin/access/permissions'), '%throttle' => url('admin/settings/throttle'))); } } /** * Implementation of hook_perm(). */ function system_perm() { return array('administer site configuration', 'access administration pages', 'select different theme'); } /** * Implementation of hook_elements(). */ function system_elements() { // Top level form $type['form'] = array('#method' => 'post', '#action' => request_uri()); // Inputs $type['checkbox'] = array('#input' => TRUE, '#return_value' => 1); $type['submit'] = array('#input' => TRUE, '#name' => 'op', '#button_type' => 'submit', '#form_submitted' => TRUE); $type['button'] = array('#input' => TRUE, '#name' => 'op', '#button_type' => 'submit', '#form_submitted' => FALSE); $type['textfield'] = array('#input' => TRUE, '#size' => 60, '#maxlength' => 128, '#autocomplete_path' => FALSE); $type['password'] = array('#input' => TRUE, '#size' => 30, '#maxlength' => 64); $type['password_confirm'] = array( '#input' => TRUE, '#value' => 'pass', 'pass1' => array('#type' => 'password', '#size' => 12, '#maxlength' => 24), 'pass2' => array('#type' => 'password', '#size' => 12, '#maxlength' => 24), '#validate' => array('password_confirm_validate' => ''), ); $type['textarea'] = array('#input' => TRUE, '#cols' => 60, '#rows' => 5); $type['radios'] = array('#input' => TRUE, '#process' => array('expand_radios' => array())); $type['radio'] = array('#input' => TRUE); $type['checkboxes'] = array('#input' => TRUE, '#process' => array('expand_checkboxes' => array()), '#tree' => TRUE); $type['select'] = array('#input' => TRUE); $type['weight'] = array('#input' => TRUE, '#delta' => 10, '#default_value' => 0); $type['date'] = array('#input' => TRUE, '#process' => array('expand_date' => array())); $type['file'] = array('#input' => TRUE, '#size' => 60); // Form structure $type['item'] = array(); $type['hidden'] = array('#input' => TRUE); $type['value'] = array('#input' => TRUE); $type['markup'] = array('#prefix' => '', '#suffix' => ''); $type['fieldset'] = array('#collapsible' => FALSE, '#collapsed' => FALSE); return $type; } /** * Implementation of hook_menu(). */ function system_menu($may_cache) { $items = array(); if ($may_cache) { $items[] = array('path' => 'system/files', 'title' => t('file download'), 'callback' => 'file_download', 'access' => TRUE, 'type' => MENU_CALLBACK); // Clean URL tester $items[] = array('path' => 'system/test', 'callback' => 'system_test', 'access' => TRUE, 'type' => MENU_CALLBACK); $access = user_access('administer site configuration'); $items[] = array('path' => 'admin', 'title' => t('administer'), 'access' => user_access('access administration pages'), 'callback' => 'watchdog_overview', 'weight' => 9); // Themes: $items[] = array('path' => 'admin/themes', 'title' => t('themes'), 'callback' => 'system_themes', 'access' => $access); $items[] = array('path' => 'admin/themes/select', 'title' => t('list'), 'callback' => 'system_themes', 'access' => $access, 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -1); $items[] = array('path' => 'admin/themes/settings', 'title' => t('configure'), 'callback' => 'system_theme_settings', 'access' => $access, 'type' => MENU_LOCAL_TASK); // Theme configuration subtabs $items[] = array('path' => 'admin/themes/settings/global', 'title' => t('global settings'), 'callback' => 'system_theme_settings', 'access' => $access, 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -1); foreach (list_themes() as $theme) { $items[] = array('path' => 'admin/themes/settings/'. $theme->name, 'title' => $theme->name, 'callback' => 'system_theme_settings', 'callback arguments' => array($theme->name), 'access' => $access, 'type' => MENU_LOCAL_TASK); } // Modules: $items[] = array('path' => 'admin/settings', 'title' => t('settings'), 'callback' => 'system_site_settings', 'access' => $access); foreach (module_list() as $name) { if (module_hook($name, 'settings')) { $items[] = array('path' => 'admin/settings/'. $name, 'title' => t($name)); } } $items[] = array('path' => 'admin/modules', 'title' => t('modules'), 'callback' => 'system_modules', 'access' => $access); } return $items; } /** * Menu callback: dummy clean URL tester. */ function system_test() { variable_set('clean_url_ok', 1); exit; } /** * 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') { if (user_access('select different theme')) { $themes = array_filter(list_themes(), create_function('$theme', 'return $theme->status;')); if (count($themes) > 1) { ksort($themes); // Reset to follow site default theme if user selects the site default if ($key == variable_get('theme_default', 'bluemarine')) { $key = ''; if ($edit['theme'] == variable_get('theme_default', 'bluemarine')) { $edit['theme'] = ''; } } $form['themes'] = array( '#type' => 'fieldset', '#title' => t('Theme configuration'), '#description' => t('Selecting a different theme will change the look and feel of the site.'), '#weight' => 2, '#collapsible' => TRUE, '#theme' => 'system_user'); foreach ($themes as $info) { $info->screenshot = dirname($info->filename) . '/screenshot.png'; $screenshot = file_exists($info->screenshot) ? theme('image', $info->screenshot, t('Screenshot for %theme theme', array('%theme' => $info->name)), '', array('class' => 'screenshot'), false) : t('no screenshot'); $form['themes'][$info->name]['screenshot'] = array('#type' => 'markup', '#value' => $screenshot); $form['themes'][$info->name]['description'] = array('#type' => 'item', '#title' => $info->name, '#value' => dirname($info->filename)); $options[$info->name] = ''; } $form['themes']['theme'] = array('#type' => 'radios', '#options' => $options, '#default_value' => $edit['theme'] ? $edit['theme'] : variable_get('theme_default', 'bluemarine')); } } if (variable_get('configurable_timezones', 1)) { $zones = _system_zonelist(); $form['timezone'] = array('#type'=>'fieldset', '#title' => t('Locale settings'), '#weight' => 6); $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.') ); } return $form; } } function theme_system_user($form) { foreach (element_children($form) as $key) { $row = array(); if (is_array($form[$key]['description'])) { $row[] = form_render($form[$key]['screenshot']); $row[] = form_render($form[$key]['description']); $row[] = form_render($form['theme'][$key]); } $rows[] = $row; } $header = array(t('Screenshot'), t('Name'), t('Selected')); $output = theme('table', $header, $rows); return $output; } function _system_zonelist() { $timestamp = time(); $zonelist = array(-11, -10, -9.5, -9, -8, -7, -6, -5, -4, -3.5, -3, -2, -1, 0, 1, 2, 3, 3.5, 4, 5, 5.5, 5.75, 6, 6.5, 7, 8, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.75, 13, 14); $zones = array(); foreach ($zonelist as $offset) { $zone = $offset * 3600; $zones[$zone] = format_date($timestamp, 'custom', variable_get('date_format_long', 'l, F j, Y - H:i') . ' O', $zone); } return $zones; } function system_view_general() { // General settings: $form['general'] = array( '#type' => 'fieldset', '#title' => t('General settings'), '#collapsible' => TRUE, '#collapsed' => TRUE ); $form['general']['site_name'] = array( '#type' => 'textfield', '#title' => t('Name'), '#default_value' => variable_get('site_name', 'drupal'), '#description' => t('The name of this web site.') ); $form['general']['site_mail'] = array( '#type' => 'textfield', '#title' => t('E-mail address'), '#default_value' => variable_get('site_mail', ini_get('sendmail_from')), '#description' => t('A valid e-mail address for this website, used by the auto-mailer during registration, new password requests, notifications, etc.') ); $form['general']['site_slogan'] = array( '#type' => 'textfield', '#title' => t('Slogan'), '#default_value' => variable_get('site_slogan', ''), '#description' => t('The slogan of this website. Some themes display a slogan when available.') ); $form['general']['site_mission'] = array( '#type' => 'textarea', '#title' => t('Mission'), '#default_value' => variable_get('site_mission', ''), '#description' => t('Your site\'s mission statement or focus.') ); $form['general']['site_footer'] = array( '#type' => 'textarea', '#title' => t('Footer message'), '#default_value' => variable_get('site_footer', ''), '#description' => t('This text will be displayed at the bottom of each page. Useful for adding a copyright notice to your pages.') ); $form['general']['anonymous'] = array( '#type' => 'textfield', '#title' => t('Anonymous user'), '#default_value' => variable_get('anonymous', 'Anonymous'), '#description' => t('The name used to indicate anonymous users.') ); $form['general']['site_frontpage'] = array( '#type' => 'textfield', '#title' => t('Default front page'), '#default_value' => variable_get('site_frontpage', 'node'), '#description' => t('The home page displays content from this relative URL. If you are not using clean URLs, specify the part after "?q=". If unsure, specify "node".') ); // We check for clean URL support using an image on the client side. $form['general']['clean_url'] = array( '#type' => 'radios', '#title' => t('Clean URLs'), '#default_value' => variable_get('clean_url', 0), '#options' => array(t('Disabled'), t('Enabled')), '#description' => t('This option makes Drupal emit clean URLs (i.e. without?q=
in the URL). You\'ll need ModRewrite
support for this to work. See the .htaccess
file in Drupal\'s top-level directory for more information.')
);
variable_set('clean_url_ok', 0);
global $base_url;
// We will use a random URL so there is no way a proxy or a browser could cache the "no such image" answer.
$form['general']['clean_url_test'] = array('#type' => 'markup', '#value' => 'ModRewrite
support with your administrator.'), 'error');
$edit['clean_url'] = 0;
}
}
/**
* Menu callback; displays a listing of all themes.
*/
function system_themes() {
$themes = system_theme_data();
ksort($themes);
foreach ($themes as $info) {
$info->screenshot = dirname($info->filename) . '/screenshot.png';
$screenshot = file_exists($info->screenshot) ? theme('image', $info->screenshot, t('Screenshot for %theme theme', array('%theme' => $info->name)), '', array('class' => 'screenshot'), false) : t('no screenshot');
$form[$info->name]['screenshot'] = array('#type' => 'markup', '#value' => $screenshot);
$form[$info->name]['description'] = array('#type' => 'item', '#title' => $info->name, '#value' => dirname($info->filename));
$options[$info->name] = '';
if ($info->status) {
$status[] = $info->name;
}
if ($info->status && (function_exists($info->prefix . '_settings') || function_exists($info->prefix . '_features'))) {
$form[$info->name]['operations'] = array('#type' => 'markup', '#value' => l(t('configure'), 'admin/themes/settings/' . $info->name) );
}
else {
// Dummy element for form_render. Cleaner than adding a check in the theme function.
$form[$info->name]['operations'] = array();
}
}
$form['status'] = array('#type' => 'checkboxes', '#options' => $options, '#default_value' => $status);
$form['theme_default'] = array('#type' => 'radios', '#options' => $options, '#default_value' => variable_get('theme_default', 'bluemarine'));
$form['buttons']['submit'] = array('#type' => 'submit', '#value' => t('Save configuration') );
$form['buttons']['reset'] = array('#type' => 'submit', '#value' => t('Reset to defaults') );
return drupal_get_form('system_themes', $form);
}
function theme_system_themes($form) {
foreach (element_children($form) as $key) {
$row = array();
if (is_array($form[$key]['description'])) {
$row[] = form_render($form[$key]['screenshot']);
$row[] = form_render($form[$key]['description']);
$row[] = array('data' => form_render($form['status'][$key]), 'align' => 'center');
if ($form['theme_default']) {
$row[] = array('data' => form_render($form['theme_default'][$key]), 'align' => 'center');
$row[] = array('data' => form_render($form[$key]['operations']), 'align' => 'center');
}
}
$rows[] = $row;
}
$header = array(t('Screenshot'), t('Name'), t('Enabled'), t('Default'), t('Operations'));
$output = theme('table', $header, $rows);
$output .= form_render($form);
return $output;
}
function system_themes_submit($form_id, $values) {
db_query("UPDATE {system} SET status = 0 WHERE type = 'theme'");
if ($_POST['op'] == t('Save configuration')) {
if (is_array($values['status'])) {
foreach ($values['status'] as $key => $choice) {
// Always enable the default theme, despite its status checkbox being checked:
if ($choice || $values['theme_default'] == $key) {
// If theme status is being set to 1 from 0, initialize block data for this theme if necessary.
if (db_num_rows(db_query("SELECT status FROM {system} WHERE type = 'theme' AND name = '%s' AND status = 0", $key))) {
system_initialize_theme_blocks($key);
}
db_query("UPDATE {system} SET status = 1 WHERE type = 'theme' and name = '%s'", $key);
}
}
}
variable_set('theme_default', $values['theme_default']);
}
else {
variable_del('theme_default');
db_query("UPDATE {system} SET status = 1 WHERE type = 'theme' AND name ='bluemarine'");
}
menu_rebuild();
drupal_set_message(t('The configuration options have been saved.'));
drupal_goto('admin/themes');
}
/**
* Menu callback; displays a listing of all modules.
*/
function system_modules() {
// Get current list of modules
$files = system_listing('\.module$', 'modules', 'name', 0);
// Extract current files from database.
system_get_files_database($files, 'module');
ksort($files);
foreach ($files as $filename => $file) {
drupal_get_filename('module', $file->name, $file->filename);
drupal_load('module', $file->name);
$file->description = module_invoke($file->name, 'help', 'admin/modules#description');
$form['name'][$file->name] = array('#value' => $file->name);
$form['description'][$file->name] = array('#value' => $file->description);
$options[$file->name] = '';
if ($file->status) {
$status[] = $file->name;
}
if ($file->throttle) {
$throttle[] = $file->name;
}
// log the critical hooks implemented by this module
$bootstrap = 0;
foreach (bootstrap_hooks() as $hook) {
if (module_hook($file->name, $hook)) {
$bootstrap = 1;
break;
}
}
// Update the contents of the system table:
if (isset($file->status)) {
db_query("UPDATE {system} SET description = '%s', name = '%s', bootstrap = %d WHERE filename = '%s'", $file->description, $file->name, $bootstrap, $file->filename);
}
else {
// This is a new module.
db_query("INSERT INTO {system} (name, description, type, filename, status, throttle, bootstrap) VALUES ('%s', '%s', '%s', '%s', %d, %d, %d)", $file->name, $file->description, 'module', $file->filename, $file->status, $file->throttle, $bootstrap);
}
}
// Handle status checkboxes, including overriding the generated
// checkboxes for required modules.
$form['status'] = array('#type' => 'checkboxes', '#default_value' => $status, '#options' => $options);
$required = array('block', 'filter', 'system', 'user', 'watchdog');
foreach ($required as $require) {
$form['status'][$require] = array('#type' => 'hidden', '#value' => 1, '#suffix' => t('required'));
}
/**
* Handle throttle checkboxes, including overriding the generated checkboxes for required modules.
*/
if (module_exist('throttle')) {
$form['throttle'] = array('#type' => 'checkboxes', '#default_value' => $throttle, '#options' => $options);
$throttle_required = array_merge($required, array('throttle'));
foreach ($throttle_required as $require) {
$form['throttle'][$require] = array('#type' => 'hidden', '#value' => 1, '#suffix' => t('required'));
}
}
$form['buttons']['submit'] = array('#type' => 'submit', '#value' => t('Save configuration'));
return drupal_get_form('system_modules', $form);
}
function theme_system_modules($form) {
foreach (element_children($form['name']) as $key) {
$row = array();
$row[] = form_render($form['name'][$key]);
$row[] = form_render($form['description'][$key]);
$row[] = array('data' => form_render($form['status'][$key]), 'align' => 'center');
if (module_exist('throttle')) {
$row[] = array('data' => form_render($form['throttle'][$key]), 'align' => 'center');
}
$rows[] = $row;
}
$header = array(t('Name'), t('Description'), t('Enabled'));
if (module_exist('throttle')) {
$header[] = t('Throttle');
}
$output = theme('table', $header, $rows);
$output .= form_render($form);
return $output;
}
function system_modules_submit($form_id, $edit) {
db_query("UPDATE {system} SET status = 0, throttle = 0 WHERE type = 'module'");
$new_modules = array();
foreach ($edit['status'] as $key => $choice) {
if ($choice) {
db_query("UPDATE {system} SET status = 1 WHERE type = 'module' AND name = '%s'", $key);
if (!module_exist($key)) {
$new_modules[] = $key;
}
}
}
if (is_array($edit['throttle'])) {
foreach ($edit['throttle'] as $key => $choice) {
if ($choice) {
db_query("UPDATE {system} SET throttle = 1 WHERE type = 'module' and name = '%s'", $key);
}
}
}
module_list(TRUE, FALSE);
menu_rebuild();
include './includes/install.inc';
foreach ($new_modules as $module) {
// Set the installed schema version for newly-enabled modules
$versions = drupal_get_schema_versions($module);
if (drupal_get_installed_schema_version($module) == SCHEMA_UNINSTALLED) {
drupal_set_installed_schema_version($module, $versions ? max($versions) : SCHEMA_INSTALLED);
}
}
drupal_set_message(t('The configuration options have been saved.'));
drupal_goto('admin/modules');
}
/**
* Menu callback; displays a module's settings page.
*/
function system_site_settings($module = NULL) {
if ($module) {
$form = module_invoke($module, 'settings');
}
else {
$form = system_view_general();
$module = 'system';
}
return system_settings_form($module . '_settings_form', $form);
}
/**
* Menu callback; display theme configuration for entire site and individual themes.
*/
function system_theme_settings($key = '') {
$directory_path = file_directory_path();
file_check_directory($directory_path, FILE_CREATE_DIRECTORY, 'file_directory_path');
// Default settings are defined in theme_get_settings() in includes/theme.inc
if ($key) {
$settings = theme_get_settings($key);
$var = str_replace('/', '_', 'theme_'. $key .'_settings');
$themes = system_theme_data();
$features = function_exists($themes[$key]->prefix . '_features') ? call_user_func($themes[$key]->prefix . '_features') : array();
}
else {
$settings = theme_get_settings('');
$var = 'theme_settings';
}
$form['var'] = array('#type' => 'hidden', '#value' => $var);
// Check for a new uploaded logo, and use that instead.
if ($file = file_check_upload('logo_upload')) {
if ($info = image_get_info($file->filepath)) {
$parts = pathinfo($file->filename);
$filename = ($key) ? str_replace('/', '_', $key) . '_logo.' . $parts['extension'] : 'logo.' . $parts['extension'];
if ($file = file_save_upload('logo_upload', $filename, 1)) {
$_POST['edit']['default_logo'] = 0;
$_POST['edit']['logo_path'] = $file->filepath;
}
}
else {
form_set_error('file_upload', t('Only JPEG, PNG and GIF images are allowed to be used as logos.'));
}
}
// Check for a new uploaded favicon, and use that instead.
if ($file = file_check_upload('favicon_upload')) {
$parts = pathinfo($file->filename);
$filename = ($key) ? str_replace('/', '_', $key) . '_favicon.' . $parts['extension'] : 'favicon.' . $parts['extension'];
if ($file = file_save_upload('favicon_upload', $filename, 1)) {
$_POST['edit']['default_favicon'] = 0;
$_POST['edit']['favicon_path'] = $file->filepath;
}
}
// Logo settings
if ((!$key) || in_array('logo', $features)) {
$form['logo'] = array('#type' => 'fieldset', '#title' => t('Logo image settings'));
$form['logo']["default_logo"] = array(
'#type' => 'checkbox',
'#title' => t('Use the default logo'),
'#default_value' => $settings['default_logo'],
'#tree' => FALSE,
'#description' => t('Check here if you want the theme to use the logo supplied with it.')
);
$form['logo']['logo_path'] = array(
'#type' => 'textfield',
'#title' => t('Path to custom logo'),
'#default_value' => $settings['logo_path'],
'#description' => t('The path to the file you would like to use as your logo file instead of the default logo.'));
$form['logo']['logo_upload'] = array(
'#type' => 'file',
'#title' => t('Upload logo image'),
'#maxlength' => 40,
'#description' => t("If you don't have direct file access to the server, use this field to upload your logo.")
);
}
// Icon settings
if ((!$key) || in_array('toggle_favicon', $features)) {
$form['favicon'] = array('#type' => 'fieldset', '#title' => t('Shortcut icon settings'));
$form['favicon']['text'] = array('#value' => t('Your shortcut icon or \'favicon\' is displayed in the address bar and bookmarks of most browsers.'));
$form['favicon']['default_favicon'] = array(
'#type' => 'checkbox',
'#title' => t('Use the default shortcut icon.'),
'#default_value' => $settings['default_favicon'],
'#description' => t('Check here if you want the theme to use the default shortcut icon.')
);
$form['favicon']['favicon_path'] = array(
'#type' => 'textfield',
'#title' => t('Path to custom icon'),
'#default_value' => $settings['favicon_path'],
'#description' => t('The path to the image file you would like to use as your custom shortcut icon.')
);
$form['favicon']['favicon_upload'] = array(
'#type' => 'file',
'#title' => t('Upload icon image'),
'#description' => t("If you don't have direct file access to the server, use this field to upload your shortcut icon.")
);
}
// System wide only settings.
if (!$key) {
// Toggle node display.
$node_types = module_invoke('node', 'get_types');
if ($node_types) {
$group = '';
$form['node_info'] = array('#type' => 'fieldset', '#title' => t('Display post information on'), '#description' => t('Enable or disable the "submitted by Username on date" text when displaying posts of the above type'));
foreach ($node_types as $type => $name) {
$form['node_info']["toggle_node_info_$type"] = array('#type' => 'checkbox', '#title' => $name, '#default_value' => $settings["toggle_node_info_$type"]);
}
}
}
$group = '';
// Toggle settings
$toggles = array(
'toggle_name' => t('Site name'),
'toggle_slogan' => t('Site slogan'),
'toggle_mission' => t('Mission statement'),
'toggle_node_user_picture' => t('User pictures in posts'),
'toggle_comment_user_picture' => t('User pictures in comments'),
'toggle_search' => t('Search box'),
'toggle_favicon' => t('Shortcut icon')
);
// Some features are not always available
$disabled = array();
if (!variable_get('user_pictures', 0)) {
$disabled['toggle_node_user_picture'] = true;
$disabled['toggle_comment_user_picture'] = true;
}
if (!module_exist('search')) {
$disabled['toggle_search'] = true;
}
$form['theme_settings'] = array('#type' => 'fieldset', '#title' => t('Toggle display'), '#description' => t('Enable or disable the display of certain page elements.'));
foreach ($toggles as $name => $title) {
if ((!$key) || in_array($name, $features)) {
// disable search box if search.module is disabled
$form['theme_settings'][$name] = array('#type' => 'checkbox', '#title' => $title, '#default_value' => $settings[$name]);
if (isset($disabled[$name])) {
$form['theme_settings'][$name]['#attributes'] = array('disabled' => 'disabled');
}
}
}
if ($key) {
// Template-specific settings
$function = $themes[$key]->prefix .'_settings';
if (function_exists($function)) {
if ($themes[$key]->template) {
// file is a template or a style of a template
$form['specific'] = array('#type' => 'fieldset', '#title' => t('Engine-specific settings'), '#description' => t('These settings only exist for all the templates and styles based on the %engine theme engine.', array('%engine' => $themes[$key]->prefix)));
}
else {
// file is a theme or a style of a theme
$form['specific'] = array('#type' => 'fieldset', '#title' => t('Theme-specific settings'), '#description' => t('These settings only exist for the %theme theme and all the styles based on it.', array('%theme' => $themes[$key]->prefix)));
}
$group = $function();
$form['specific'] = array_merge($form['specific'], (is_array($group) ? $group : array()));
}
}
$form['#attributes'] = array('enctype' => 'multipart/form-data');
return system_settings_form('system_theme_settings', $form);
}
function search_box() {
$form['#action'] = url('search');
$form['keys'] = array('#type' => 'textfield', '#size'=> 15, '#value' => '', '#attributes' => array('alt' => t('Enter the terms you wish to search for.')));
$form['submit'] = array('#type' => 'submit', '#value' => t('Search'));
return drupal_get_form('search_box', $form);
}
function theme_search_box($form) {
$output = '