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'))); case 'admin/help#system': return t("Drupal comes with system-wide defaults but the setting-module provides control over many Drupal preferences, behaviours including visual and operational settings.
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). 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.
The recommended way to set up your cron system is to set up a Unix/Linux crontab entry (see \"man crontab\") that frequently visits %cron-link. Note that cron does not guarantee the commands will be executed at the specified interval. However, Drupal will try its best to run the tasks as close to the specified intervals as possible. The more you visit cron.php, the more accurate cron will be.
If your hosting company does not allow you to set up crontab entries, you can always ask someone else to set up an entry for you. After all, virtually any Unix/Linux machine with access to the internet can set up a crontab entry to frequently visit %cron-link.
For the Unix/Linux crontab itself, use a browser like lynx or wget but make sure the process terminates: either use /usr/bin/lynx -source %base_url/cron.php
or /usr/bin/wget -o /dev/null -O /dev/null %cron-link
. Take a look at the example scripts in the scripts
-directory. Make sure to adjust them to fit your needs. A good crontab line to run the cron script once every hour would be:
00 * * * * /home/www/drupal/scripts/cron-lynx.shNote that it is essential to access
cron.php
using a browser on the web site's domain; do not run it using command line PHP and avoid using localhost
or 127.0.0.1
or some of the environment variables will not be set correctly and features may not work as expected.", array('%base_url' => $base_url, '%cron-link' => "$base_url/cron.php", '%lynx' => 'http://lynx.browser.org', '%wget' => 'http://www.gnu.org/software/wget/wget.html' ));
case 'admin/modules#description':
return t('Handles general site configuration for administrators.');
}
}
/**
* Implementation of hook_perm().
*/
function system_perm() {
return array('administer site configuration', 'access administration pages', 'bypass input data check');
}
/**
* 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', '#execute' => TRUE);
$type['button'] = array('#input' => TRUE, '#name' => 'op', '#button_type' => 'submit', exexute => FALSE);
$type['textfield'] = array('#input' => TRUE, '#size' => 60, '#maxlength' => 70, '#autocomplete_path' => FALSE);
$type['password'] = array('#input' => TRUE, '#size' => 60, '#maxlength' => 70);
$type['textarea'] = array('#input' => TRUE, '#cols' => 60, '#rows' => 20);
$type['radios'] = array('#input' => TRUE, '#process' => 'expand_radios');
$type['radio'] = array('#input' => TRUE);
$type['checkboxes'] = array('#input' => TRUE, '#process' => 'expand_checkboxes', '#tree' => TRUE);
$type['select'] = array('#input' => TRUE);
$type['weight'] = array('#input' => TRUE, '#delta' => 10);
$type['date'] = array('#input' => TRUE, '#process' => 'expand_date');
$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') {
$themes = list_themes();
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, '#collapsed' => FALSE, '#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['locale'] = array('#type'=>'item', '#title' => t('Locale settings'), '#weight' => 6);
$form['locale']['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;
}
$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')), '#maxlength' => 128,
'#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', ''),
'#maxlength' => 128, '#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', ''),
'#rows' => 5, '#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', ''), '#rows' => 5,
'#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_execute($form_id, $values) {
db_query("UPDATE {system} SET status = 0 WHERE type = 'theme'");
if ($_POST['op'] == t('Save configuration')) {
variable_set('theme_default', $values['theme_default']);
if (is_array($values['status'])) {
foreach ($values['status'] as $key => $choice) {
if ($choice) {
db_query("UPDATE {system} SET status = 1 WHERE type = 'theme' and name = '%s'", $key);
}
}
}
}
else {
variable_del('theme_default');
}
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:
db_query("DELETE FROM {system} WHERE name = '%s' AND type = '%s'", $file->name, '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, '#tree' => TRUE);
$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, '#tree' => TRUE);
$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_execute($form_id, $edit) {
db_query("UPDATE {system} SET status = 0, throttle = 0 WHERE type = 'module'");
foreach ($edit['status'] as $key => $choice) {
if ($choice) {
db_query("UPDATE {system} SET status = 1 WHERE type = 'module' AND name = '%s'", $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);
}
}
}
menu_rebuild();
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 = variable_get('file_directory_path', 'files');
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'), '#size' => 60, '#maxlength' => 128,
'#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) {
// Menu settings
$form['primary_links'] = system_navigation_links_form('primary', 'Primary');
$form['secondary_links'] = system_navigation_links_form('secondary', 'Secondary');
// 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_primary_links' => t('Primary links'),
'toggle_secondary_links' => t('Secondary links'),
'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.'), '#tree' => TRUE);
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 system_navigation_links_form($type, $utype) {
$settings = theme_get_settings('');
$value = $settings[$type . '_links'];
if (!is_array($value)) {
$value = array();
}
// Increment the link count, if the user has requested more links.
if (variable_get($type . '_links_more', false)) {
variable_del($type . '_links_more');
variable_set($type . '_link_count', variable_get($type . '_link_count', 5) + 5);
}
// Get the amount of links to show, possibly expanding if there are more links defined than the count specifies.
$count = variable_get($type . '_link_count', 5);
$count = ($count > sizeof($value['link'])) ? $count : sizeof($value['link']);
if (variable_get($type . '_link_count', 5) != $count) {
variable_set($type . '_link_count', $count);
}
$form = array(
'#type' => 'item', '#title' => t('_TYPE_ link settings', array('_TYPE_' => $utype)), '#theme' => 'system_navigation_links_form',
'#description' => t('You can specify your _TYPE_ links here, one link per line.