' . 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.') . '
'; $output .= '' . t('The system module provides:') . '
'; $output .= '' . t('For more information, see the online handbook entry for System module.', array('@system' => 'http://drupal.org/handbook/modules/system/')) . '
'; return $output; case 'admin/by-module': return '' . t('This page shows you all available administration tasks for each module.') . '
'; case 'admin/build/themes': $output = '' . 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.') . '
'; $output .= '' . t('To change the appearance of your site, a number of contributed themes are available.', array('@themes' => 'http://drupal.org/project/themes')) . '
'; return $output; case 'admin/build/themes/settings/' . $arg[4]: $reference = explode('.', $arg[4], 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.', array('%template' => $theme, '@global' => url('admin/build/themes/settings'))) . '
' . 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/build/modules': $output = '' . t('Modules are plugins that extend Drupal\'s core functionality. To enable modules, select the Enabled checkboxes below and click the Save configuration button. To further extend your site\'s functionality, a number of contributed modules are available for download.', array('@permissions' => url('admin/user/permissions'), '@modules' => 'http://drupal.org/project/modules')) . '
'; $output .= '' . t('Module-related tasks can be located on the administration by module page. New module-related permissions may also become available as new modules are enabled.', array('@by-module' => url('admin/by-module'), '@permissions' => url('admin/user/permissions'))) . '
'; $output .= '' . t('Each time a module is updated, it is important that update.php is run. To help manage the update process, the Update status module, if enabled, provides information on new versions of modules (and themes) as they are released. Regular review of the available updates page is essential to maintaining a secure and current site.', array('@update-php' => $base_url . '/update.php', '@updates' => url('admin/reports/updates'))) . '
'; return $output; case 'admin/build/modules/uninstall': return '' . t('The uninstall process removes all data related to a module. To uninstall a module, you must first disable it on the main modules page. Not all modules support this feature.', array('@modules' => url('admin/build/modules'))) . '
'; case 'admin/build/block/configure': if ($arg[4] == 'system' && $arg[5] == 'powered-by') { return '' . t('The Powered by Drupal 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.') . '
'; } break; case 'admin/settings/maintenance-mode': global $user; if ($user->uid == 1) { return '' . t('If you are upgrading to a newer version of Drupal or upgrading contributed modules or themes you may need to run !update-php.', array('!update-php' => l('update.php', 'update.php'))) . '
'; } case 'admin/settings/actions': case 'admin/settings/actions/manage': $output = '' . 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.') . '
'; $output .= '' . 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 Create button.') . '
'; if (module_exists('trigger')) { $output .= '' . t('You may proceed to the Triggers page to assign these actions to system events.', array('@url' => url('admin/build/trigger'))) . '
'; } return $output; case 'admin/settings/actions/configure': return t('An advanced action offers additional configuration options which may be filled out below. Changing the Description 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/settings/ip-blocking': return '' . t('IP addresses listed here are blocked from your site before any modules are loaded. You may add IP addresses to the list, or delete existing entries.') . '
'; case 'admin/reports/status': return '' . 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.") . '
'; } } /** * Implement 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_fieldset' => array( 'arguments' => array('form' => NULL), 'file' => 'system.admin.inc', ), 'system_modules_incompatible' => array( 'arguments' => array('message' => 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), ), 'meta_generator_html' => array( 'arguments' => array('version' => NULL), ), 'meta_generator_header' => array( 'arguments' => array('version' => NULL), ), 'system_compact_link' => array(), )); } /** * Implement hook_perm(). */ function system_perm() { return array( 'administer site configuration' => array( 'title' => t('Administer site configuration'), 'description' => t('Configure site-wide settings such as module or theme administration settings.'), ), 'administer actions' => array( 'title' => t('Administer actions'), 'description' => t('Manage the actions defined for your site.'), ), 'administer files' => array( 'title' => t('Administer files'), 'description' => t('Manage user-uploaded files.'), ), 'access administration pages' => array( 'title' => t('Access administration pages'), 'description' => t('View the administration panel and browse the help system.'), ), 'access site reports' => array( 'title' => t('Access site reports'), 'description' => t('View reports from system logs and other status information.'), ), 'select different theme' => array( 'title' => t('Select different theme'), 'description' => t('Select a theme other than the default theme set by the site administrator.'), ), 'block IP addresses' => array( 'title' => t('Block IP addresses'), 'description' => t('Block IP addresses from accessing your site.'), ), ); } /** * Implement hook_rdf_namespaces(). */ function system_rdf_namespaces() { return array( 'admin' => 'http://webns.net/mvcb/', 'content' => 'http://purl.org/rss/1.0/modules/content/', 'dc' => 'http://purl.org/dc/elements/1.1/', 'dcterms' => 'http://purl.org/dc/terms/', 'foaf' => 'http://xmlns.com/foaf/0.1/', 'owl' => 'http://www.w3.org/2002/07/owl#', 'rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'rdfs' => 'http://www.w3.org/2000/01/rdf-schema#', 'rss' => 'http://purl.org/rss/1.0/', 'sioc' => 'http://rdfs.org/sioc/ns#', 'xsd' => 'http://www.w3.org/2001/XMLSchema', ); } /** * Implement hook_elements(). */ function system_elements() { // Top level form $type['form'] = array( '#method' => 'post', '#action' => request_uri(), '#theme_wrapper' => 'form', ); $type['page'] = array( '#show_messages' => TRUE, '#show_blocks' => TRUE, '#theme' => 'page', ); $type['list'] = array( '#title' => '', '#list_type' => 'ul', '#attributes' => array(), '#items' => array(), ); /** * Input elements. */ $type['submit'] = array( '#input' => TRUE, '#name' => 'op', '#button_type' => 'submit', '#executes_submit_callback' => TRUE, '#process' => array('form_process_ahah'), '#theme_wrapper' => 'button', ); $type['button'] = array( '#input' => TRUE, '#name' => 'op', '#button_type' => 'submit', '#executes_submit_callback' => FALSE, '#process' => array('form_process_ahah'), '#theme_wrapper' => 'button', ); $type['image_button'] = array( '#input' => TRUE, '#button_type' => 'submit', '#executes_submit_callback' => TRUE, '#process' => array('form_process_ahah'), '#return_value' => TRUE, '#has_garbage_value' => TRUE, '#src' => NULL, '#theme_wrapper' => 'image_button', ); $type['textfield'] = array( '#input' => TRUE, '#size' => 60, '#maxlength' => 128, '#autocomplete_path' => FALSE, '#process' => array('form_process_text_format', 'form_process_ahah'), '#theme' => 'textfield', '#theme_wrapper' => 'form_element', ); $type['password'] = array( '#input' => TRUE, '#size' => 60, '#maxlength' => 128, '#process' => array('form_process_ahah'), '#theme' => 'password', '#theme_wrapper' => 'form_element', ); $type['password_confirm'] = array( '#input' => TRUE, '#process' => array('form_process_password_confirm'), '#theme_wrapper' => 'form_element', ); $type['textarea'] = array( '#input' => TRUE, '#cols' => 60, '#rows' => 5, '#resizable' => TRUE, '#process' => array('form_process_text_format', 'form_process_ahah'), '#theme' => 'textarea', '#theme_wrapper' => 'form_element', ); $type['radios'] = array( '#input' => TRUE, '#process' => array('form_process_radios'), '#theme_wrapper' => 'radios', '#pre_render' => array('form_pre_render_conditional_form_element'), ); $type['radio'] = array( '#input' => TRUE, '#default_value' => NULL, '#process' => array('form_process_ahah'), '#theme' => 'radio', '#theme_wrapper' => 'form_element', '#form_element_skip_title' => TRUE, ); $type['checkboxes'] = array( '#input' => TRUE, '#tree' => TRUE, '#process' => array('form_process_checkboxes'), '#theme_wrapper' => 'checkboxes', '#pre_render' => array('form_pre_render_conditional_form_element'), ); $type['checkbox'] = array( '#input' => TRUE, '#return_value' => 1, '#process' => array('form_process_ahah'), '#theme' => 'checkbox', '#theme_wrapper' => 'form_element', '#form_element_skip_title' => TRUE, ); $type['select'] = array( '#input' => TRUE, '#size' => 0, '#multiple' => FALSE, '#process' => array('form_process_ahah'), '#theme' => 'select', '#theme_wrapper' => 'form_element', ); $type['weight'] = array( '#input' => TRUE, '#delta' => 10, '#default_value' => 0, '#process' => array('form_process_weight', 'form_process_ahah'), ); $type['date'] = array( '#input' => TRUE, '#element_validate' => array('date_validate'), '#process' => array('form_process_date'), '#theme' => 'date', '#theme_wrapper' => 'form_element', ); $type['file'] = array( '#input' => TRUE, '#size' => 60, '#theme' => 'file', '#theme_wrapper' => 'form_element', ); $type['tableselect'] = array( '#input' => TRUE, '#js_select' => TRUE, '#multiple' => TRUE, '#process' => array('form_process_tableselect'), '#options' => array(), '#empty' => '', '#theme' => 'tableselect' ); /** * Form structure. */ $type['item'] = array( '#markup' => '', '#theme' => 'markup', '#theme_wrapper' => 'form_element', ); $type['hidden'] = array( '#input' => TRUE, '#process' => array('form_process_ahah'), '#theme' => 'hidden', ); $type['value'] = array( '#input' => TRUE, ); $type['markup'] = array( '#markup' => '', '#theme' => 'markup', ); $type['fieldset'] = array( '#collapsible' => FALSE, '#collapsed' => FALSE, '#value' => NULL, '#process' => array('form_process_fieldset', 'form_process_ahah'), '#pre_render' => array('form_pre_render_fieldset'), '#theme_wrapper' => 'fieldset', ); $type['vertical_tabs'] = array( '#theme_wrapper' => 'vertical_tabs', '#default_tab' => '', '#process' => array('form_process_vertical_tabs'), ); $type['token'] = array( '#input' => TRUE, '#theme' => array('hidden'), ); return $type; } /** * Implement hook_menu(). */ function system_menu() { $items['system/files'] = array( 'title' => 'File download', 'page callback' => 'file_download', 'access callback' => TRUE, 'type' => MENU_CALLBACK, ); $items['system/ahah'] = array( 'title' => 'AHAH callback', 'page callback' => 'form_ahah_callback', 'access callback' => TRUE, 'type' => MENU_CALLBACK, ); $items['system/timezone'] = array( 'title' => 'Time zone', 'page callback' => 'system_timezone', 'access callback' => TRUE, 'type' => MENU_CALLBACK, ); $items['admin'] = array( 'title' => 'Administer', 'access arguments' => array('access administration pages'), 'page callback' => 'system_main_admin_page', 'weight' => 9, 'menu_name' => 'management', ); $items['admin/compact'] = array( 'title' => 'Compact mode', 'page callback' => 'system_admin_compact_page', 'access arguments' => array('access administration pages'), 'type' => MENU_CALLBACK, ); $items['admin/by-task'] = array( 'title' => 'By task', 'page callback' => 'system_main_admin_page', 'access arguments' => array('access administration pages'), 'type' => MENU_DEFAULT_LOCAL_TASK, ); $items['admin/by-module'] = array( 'title' => 'By module', 'page callback' => 'system_admin_by_module', 'access arguments' => array('access administration pages'), 'type' => MENU_LOCAL_TASK, 'weight' => 2, ); $items['admin/content'] = array( 'title' => 'Content management', 'description' => "Manage your site's content.", 'position' => 'left', 'weight' => -10, 'page callback' => 'system_admin_menu_block_page', 'access callback' => 'system_admin_menu_block_access', 'access arguments' => array('admin/content', 'access administration pages'), ); // Menu items that are basically just menu blocks. $items['admin/settings'] = array( 'title' => 'Site configuration', 'description' => 'Configure site settings.', 'position' => 'right', 'weight' => -5, 'page callback' => 'system_settings_overview', 'access callback' => 'system_admin_menu_block_access', 'access arguments' => array('admin/settings', 'access administration pages'), ); $items['admin/build'] = array( 'title' => 'Site building', 'description' => 'Control how your site looks and feels.', 'position' => 'right', 'weight' => -10, 'page callback' => 'system_admin_menu_block_page', 'access callback' => 'system_admin_menu_block_access', 'access arguments' => array('admin/build', 'access administration pages'), ); // Themes. $items['admin/build/themes'] = array( 'title' => 'Themes', 'description' => 'Change which theme your site uses or allows users to set.', 'page callback' => 'drupal_get_form', 'page arguments' => array('system_themes_form'), 'access arguments' => array('administer site configuration'), ); $items['admin/build/themes/select'] = array( 'title' => 'List', 'description' => 'Select the default theme for your site.', 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -1, ); $items['admin/build/themes/settings'] = array( 'title' => 'Configure', 'page arguments' => array('system_theme_settings'), 'access arguments' => array('administer site configuration'), 'type' => MENU_LOCAL_TASK, ); // Theme configuration subtabs. $items['admin/build/themes/settings/global'] = array( 'title' => 'Global settings', 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -1, ); foreach (list_themes() as $theme) { $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), ); } // Modules. $items['admin/build/modules'] = array( 'title' => 'Modules', 'description' => 'Enable or disable add-on modules for your site.', 'page callback' => 'drupal_get_form', 'page arguments' => array('system_modules'), 'access arguments' => array('administer site configuration'), ); $items['admin/build/modules/list'] = array( 'title' => 'List', 'type' => MENU_DEFAULT_LOCAL_TASK, ); $items['admin/build/modules/list/confirm'] = array( 'title' => 'List', 'access arguments' => array('administer site configuration'), 'type' => MENU_CALLBACK, ); $items['admin/build/modules/uninstall'] = array( 'title' => 'Uninstall', 'page arguments' => array('system_modules_uninstall'), 'access arguments' => array('administer site configuration'), 'type' => MENU_LOCAL_TASK, ); $items['admin/build/modules/uninstall/confirm'] = array( 'title' => 'Uninstall', 'access arguments' => array('administer site configuration'), 'type' => MENU_CALLBACK, ); // Development menu category. $items['admin/development'] = array( 'title' => 'Development', 'description' => 'Development tools.', 'position' => 'right', 'weight' => -7, 'page callback' => 'system_admin_menu_block_page', 'access callback' => 'system_admin_menu_block_access', 'access arguments' => array('admin/development', 'access administration pages'), ); // Actions. $items['admin/settings/actions'] = array( 'title' => 'Actions', 'description' => 'Manage the actions defined for your site.', 'access arguments' => array('administer actions'), 'page callback' => 'system_actions_manage' ); $items['admin/settings/actions/manage'] = array( 'title' => 'Manage actions', 'description' => 'Manage the actions defined for your site.', 'page callback' => 'system_actions_manage', 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -2, ); $items['admin/settings/actions/configure'] = array( 'title' => 'Configure an advanced action', 'page callback' => 'drupal_get_form', 'page arguments' => array('system_actions_configure'), 'access arguments' => array('administer actions'), 'type' => MENU_CALLBACK, ); $items['admin/settings/actions/delete/%actions'] = array( 'title' => 'Delete action', 'description' => 'Delete an action.', 'page callback' => 'drupal_get_form', 'page arguments' => array('system_actions_delete_form', 4), 'access arguments' => array('administer actions'), 'type' => MENU_CALLBACK, ); $items['admin/settings/actions/orphan'] = array( 'title' => 'Remove orphans', 'page callback' => 'system_actions_remove_orphans', 'access arguments' => array('administer actions'), 'type' => MENU_CALLBACK, ); // IP address blocking. $items['admin/settings/ip-blocking'] = array( 'title' => 'IP address blocking', 'description' => 'Manage blocked IP addresses.', 'page callback' => 'system_ip_blocking', 'access arguments' => array('block IP addresses'), ); $items['admin/settings/ip-blocking/%'] = array( 'title' => 'IP address blocking', 'description' => 'Manage blocked IP addresses.', 'page callback' => 'system_ip_blocking', 'access arguments' => array('block IP addresses'), 'type' => MENU_CALLBACK, ); $items['admin/settings/ip-blocking/delete/%blocked_ip'] = array( 'title' => 'Delete IP address', 'page callback' => 'drupal_get_form', 'page arguments' => array('system_ip_blocking_delete', 4), 'access arguments' => array('block IP addresses'), 'type' => MENU_CALLBACK, ); // 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.', 'page callback' => 'drupal_get_form', 'page arguments' => array('system_site_information_settings'), 'access arguments' => array('administer site configuration'), ); $items['admin/settings/logging'] = array( 'title' => 'Logging and errors', 'description' => "Settings for logging and alerts modules. Various modules can route Drupal's system events to different destinations, such as syslog, database, email, etc.", 'page callback' => 'drupal_get_form', 'page arguments' => array('system_logging_settings'), 'access arguments' => array('administer site configuration'), ); $items['admin/settings/logging/settings'] = array( 'title' => 'Settings', 'access arguments' => array('administer site configuration'), 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -1, ); $items['admin/settings/performance'] = array( 'title' => 'Performance', 'description' => 'Enable or disable page caching for anonymous users and set CSS and JS bandwidth optimization options.', 'page callback' => 'drupal_get_form', 'page arguments' => array('system_performance_settings'), 'access arguments' => array('administer site configuration'), ); $items['admin/settings/file-system'] = array( 'title' => 'File system', 'description' => 'Tell Drupal where to store uploaded files and how they are accessed.', 'page callback' => 'drupal_get_form', 'page arguments' => array('system_file_system_settings'), 'access arguments' => array('administer site configuration'), ); $items['admin/settings/image-toolkit'] = array( 'title' => 'Image toolkit', 'description' => 'Choose which image toolkit to use if you have installed optional toolkits.', 'page callback' => 'drupal_get_form', 'page arguments' => array('system_image_toolkit_settings'), 'access arguments' => array('administer site configuration'), ); $items['admin/content/rss-publishing'] = array( 'title' => 'RSS publishing', 'description' => 'Configure the site description, the number of items per feed and whether feeds should be titles/teasers/full-text.', 'page callback' => 'drupal_get_form', 'page arguments' => array('system_rss_feeds_settings'), 'access arguments' => array('administer site configuration'), ); $items['admin/settings/regional-settings'] = array( 'title' => 'Regional settings', 'description' => "Settings for how Drupal displays date and time, as well as the system's default time zone.", 'page callback' => 'drupal_get_form', 'page arguments' => array('system_regional_settings'), 'access arguments' => array('administer site configuration'), ); $items['admin/settings/regional-settings/lookup'] = array( 'title' => 'Date and time lookup', 'type' => MENU_CALLBACK, 'page callback' => 'system_date_time_lookup', 'access arguments' => array('administer site configuration'), ); $items['admin/settings/maintenance-mode'] = array( 'title' => 'Maintenance mode', 'description' => 'Take the site offline for maintenance or bring it back online.', 'page callback' => 'drupal_get_form', 'page arguments' => array('system_site_maintenance_mode'), 'access arguments' => array('administer site configuration'), ); $items['admin/settings/clean-urls'] = array( 'title' => 'Clean URLs', 'description' => 'Enable or disable clean URLs for your site.', 'page callback' => 'drupal_get_form', 'page arguments' => array('system_clean_url_settings'), 'access arguments' => array('administer site configuration'), ); $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, ); // Reports. $items['admin/reports'] = array( 'title' => 'Reports', 'description' => 'View reports from system logs and other status information.', 'page callback' => 'system_admin_menu_block_page', 'access callback' => 'system_admin_menu_block_access', 'access arguments' => array('admin/reports', 'access site reports'), 'weight' => 5, 'position' => 'left', ); $items['admin/reports/status'] = array( 'title' => 'Status report', 'description' => "Get a status report about your site's operation and any detected problems.", 'page callback' => 'system_status', 'weight' => 10, 'access arguments' => array('administer site configuration'), ); $items['admin/reports/status/run-cron'] = array( 'title' => 'Run cron', 'page callback' => 'system_run_cron', 'access arguments' => array('administer site configuration'), 'type' => MENU_CALLBACK, ); $items['admin/reports/status/php'] = array( 'title' => 'PHP', 'page callback' => 'system_php', 'access arguments' => array('administer site configuration'), 'type' => MENU_CALLBACK, ); // Default page for batch operations. $items['batch'] = array( 'page callback' => 'system_batch_page', 'access callback' => TRUE, 'type' => MENU_CALLBACK, ); return $items; } /** * Implementation of hook_library(). */ function system_library() { // jQuery. $libraries['jquery'] = array( 'title' => 'jQuery', 'website' => 'http://jquery.com', 'version' => '1.3.2', 'js' => array( 'misc/jquery.js' => array('weight' => JS_LIBRARY - 20), ), ); // jQuery Form Plugin. $libraries['form'] = array( 'title' => 'jQuery Form Plugin', 'website' => 'http://malsup.com/jquery/form/', 'version' => '2.16', 'js' => array( 'misc/jquery.form.js' => array(), ), ); // Farbtastic. $libraries['farbtastic'] = array( 'title' => 'Farbtastic', 'website' => 'http://code.google.com/p/farbtastic/', 'version' => '1.2', 'js' => array( 'misc/farbtastic/farbtastic.js' => array(), ), 'css' => array( 'misc/farbtastic/farbtastic.css' => array('preprocess' => FALSE), ), ); // Cookie. $libraries['cookie'] = array( 'title' => 'Cookie', 'website' => 'http://plugins.jquery.com/project/cookie', 'version' => '1.0', 'js' => array( 'misc/jquery.cookie.js' => array(), ), ); // jQuery UI. $libraries['ui'] = array( 'title' => 'jQuery UI: Core', 'website' => 'http://jqueryui.com', 'version' => '1.7.2', 'js' => array( 'misc/ui/ui.core.js' => array('weight' => JS_LIBRARY - 10), ), 'css' => array( 'misc/ui/ui.core.css' => array(), 'misc/ui/ui.theme.css' => array(), ), ); $libraries['ui.accordion'] = array( 'title' => 'jQuery UI: Accordion', 'website' => 'http://jqueryui.com/demos/accordion/', 'version' => '1.7.2', 'js' => array( 'misc/ui/ui.accordion.js' => array(), ), 'css' => array( 'misc/ui/ui.accordion.css' => array(), ), 'dependencies' => array( array('system', 'ui'), ), ); $libraries['ui.datepicker'] = array( 'title' => 'jQuery UI: Date Picker', 'website' => 'http://jqueryui.com/demos/datepicker/', 'version' => '1.7.2', 'js' => array( 'misc/ui/ui.datepicker.js' => array(), ), 'css' => array( 'misc/ui/ui.datepicker.css' => array(), ), 'dependencies' => array( array('system', 'ui'), ), ); $libraries['ui.dialog'] = array( 'title' => 'jQuery UI: Dialog', 'website' => 'http://jqueryui.com/demos/dialog/', 'version' => '1.7.2', 'js' => array( 'misc/ui/ui.dialog.js' => array(), ), 'css' => array( 'misc/ui/ui.dialog.css' => array(), ), 'dependencies' => array( array('system', 'ui'), ), ); $libraries['ui.draggable'] = array( 'title' => 'jQuery UI: Dialog', 'website' => 'http://jqueryui.com/demos/draggable/', 'version' => '1.7.2', 'js' => array( 'misc/ui/ui.draggable.js' => array(), ), 'dependencies' => array( array('system', 'ui'), ), ); $libraries['ui.droppable'] = array( 'title' => 'jQuery UI: Droppable', 'website' => 'http://jqueryui.com/demos/droppable/', 'version' => '1.7.2', 'js' => array( 'misc/ui/ui.droppable.js' => array(), ), 'dependencies' => array( array('system', 'ui'), array('system', 'ui.draggable'), ), ); $libraries['ui.progressbar'] = array( 'title' => 'jQuery UI: Progress Bar', 'website' => 'http://jqueryui.com/demos/progressbar/', 'version' => '1.7.2', 'js' => array( 'misc/ui/ui.progressbar.js' => array(), ), 'css' => array( 'misc/ui/ui.progressbar.css' => array(), ), 'dependencies' => array( array('system', 'ui'), ), ); $libraries['ui.resizable'] = array( 'title' => 'jQuery UI: Resizable', 'website' => 'http://jqueryui.com/demos/resizable/', 'version' => '1.7.2', 'js' => array( 'misc/ui/ui.resizable.js' => array(), ), 'css' => array( 'misc/ui/ui.resizable.css' => array(), ), 'dependencies' => array( array('system', 'ui'), ), ); $libraries['ui.selectable'] = array( 'title' => 'jQuery UI: Selectable', 'website' => 'http://jqueryui.com/demos/selectable/', 'version' => '1.7.2', 'js' => array( 'misc/ui/ui.selectable.js' => array(), ), 'css' => array( 'misc/ui/ui.selectable.css' => array(), ), 'dependencies' => array( array('system', 'ui'), ), ); $libraries['ui.slider'] = array( 'title' => 'jQuery UI: Slider', 'website' => 'http://jqueryui.com/demos/slider/', 'version' => '1.7.2', 'js' => array( 'misc/ui/ui.slider.js' => array(), ), 'css' => array( 'misc/ui/ui.slider.css' => array(), ), 'dependencies' => array( array('system', 'ui'), ), ); $libraries['ui.sortable'] = array( 'title' => 'jQuery UI: Sortable', 'website' => 'http://jqueryui.com/demos/sortable/', 'version' => '1.7.2', 'js' => array( 'misc/ui/ui.sortable.js' => array(), ), 'dependencies' => array( array('system', 'ui'), ), ); $libraries['ui.tabs'] = array( 'title' => 'jQuery UI: Tabs', 'website' => 'http://jqueryui.com/demos/tabs/', 'version' => '1.7.2', 'js' => array( 'misc/ui/ui.tabs.js' => array(), ), 'css' => array( 'misc/ui/ui.tabs.css' => array(), ), 'dependencies' => array( array('system', 'ui'), ), ); $libraries['effects'] = array( 'title' => 'jQuery UI: Effects', 'website' => 'http://jqueryui.com/demos/effect/', 'version' => '1.7.2', 'js' => array( 'misc/ui/effects.core.js' => array('weight' => JS_LIBRARY - 9), ), 'dependencies' => array( array('system', 'ui'), ), ); $libraries['effects.blind'] = array( 'title' => 'jQuery UI: Effects Blind', 'website' => 'http://jqueryui.com/demos/effect/', 'version' => '1.7.2', 'js' => array( 'misc/ui/effects.blind.js' => array(), ), 'dependencies' => array( array('system', 'effects'), ), ); $libraries['effects.bounce'] = array( 'title' => 'jQuery UI: Effects Bounce', 'website' => 'http://jqueryui.com/demos/effect/', 'version' => '1.7.2', 'js' => array( 'misc/ui/effects.bounce.js' => array(), ), 'dependencies' => array( array('system', 'effects'), ), ); $libraries['effects.clip'] = array( 'title' => 'jQuery UI: Effects Clip', 'website' => 'http://jqueryui.com/demos/effect/', 'version' => '1.7.2', 'js' => array( 'misc/ui/effects.clip.js' => array(), ), 'dependencies' => array( array('system', 'effects'), ), ); $libraries['effects.drop'] = array( 'title' => 'jQuery UI: Effects Drop', 'website' => 'http://jqueryui.com/demos/effect/', 'version' => '1.7.2', 'js' => array( 'misc/ui/effects.drop.js' => array(), ), 'dependencies' => array( array('system', 'effects'), ), ); $libraries['effects.explode'] = array( 'title' => 'jQuery UI: Effects Explode', 'website' => 'http://jqueryui.com/demos/effect/', 'version' => '1.7.2', 'js' => array( 'misc/ui/effects.explode.js' => array(), ), 'dependencies' => array( array('system', 'effects'), ), ); $libraries['effects.fold'] = array( 'title' => 'jQuery UI: Effects Fold', 'website' => 'http://jqueryui.com/demos/effect/', 'version' => '1.7.2', 'js' => array( 'misc/ui/effects.fold.js' => array(), ), 'dependencies' => array( array('system', 'effects'), ), ); $libraries['effects.highlight'] = array( 'title' => 'jQuery UI: Effects Fold', 'website' => 'http://jqueryui.com/demos/effect/', 'version' => '1.7.2', 'js' => array( 'misc/ui/effects.highlight.js' => array(), ), 'dependencies' => array( array('system', 'effects'), ), ); $libraries['effects.pulsate'] = array( 'title' => 'jQuery UI: Effects Pulsate', 'website' => 'http://jqueryui.com/demos/effect/', 'version' => '1.7.2', 'js' => array( 'misc/ui/effects.pulsate.js' => array(), ), 'dependencies' => array( array('system', 'effects'), ), ); $libraries['effects.scale'] = array( 'title' => 'jQuery UI: Effects Pulsate', 'website' => 'http://jqueryui.com/demos/effect/', 'version' => '1.7.2', 'js' => array( 'misc/ui/effects.scale.js' => array(), ), 'dependencies' => array( array('system', 'effects'), ), ); $libraries['effects.shake'] = array( 'title' => 'jQuery UI: Effects Shake', 'website' => 'http://jqueryui.com/demos/effect/', 'version' => '1.7.2', 'js' => array( 'misc/ui/effects.scale.js' => array(), ), 'dependencies' => array( array('system', 'effects'), ), ); $libraries['effects.slide'] = array( 'title' => 'jQuery UI: Effects Slide', 'website' => 'http://jqueryui.com/demos/effect/', 'version' => '1.7.2', 'js' => array( 'misc/ui/effects.slide.js' => array(), ), 'dependencies' => array( array('system', 'effects'), ), ); $libraries['effects.transfer'] = array( 'title' => 'jQuery UI: Effects Transfer', 'website' => 'http://jqueryui.com/demos/effect/', 'version' => '1.7.2', 'js' => array( 'misc/ui/effects.transfer.js' => array(), ), 'dependencies' => array( array('system', 'effects'), ), ); return $libraries; } /** * Retrieve a blocked IP address from the database. * * @param $iid integer * The ID of the blocked IP address to retrieve. * * @return * The blocked IP address from the database as an array. */ function blocked_ip_load($iid) { return db_query("SELECT * FROM {blocked_ips} WHERE iid = :iid", array(':iid' => $iid))->fetchAssoc(); } /** * 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)); } /** * Menu item access callback - hides empty system settings overview pages. * * @param $path * The path of the menu item to check for child menu entries. * @param $string * The permission, such as "administer nodes", being checked for. * @return * Boolean TRUE if the current user has the requested permission and the * current menu item has children. */ function system_admin_menu_block_access($path, $permission) { if (!user_access($permission)) { return FALSE; } $content = system_admin_menu_block(array('path' => $path)); return !empty($content); } /** * Implement hook_filetransfer_backends(). */ function system_filetransfer_backends() { $backends = array(); //This is the default, will be available on most systems if (function_exists('ftp_connect')) { $backends['ftp_extension'] = array( 'title' => t('FTP'), 'class' => 'FileTransferFTPExtension', 'settings_form' => 'system_filetransfer_backend_form_ftp', 'weight' => 0, ); } if (ini_get('allow_url_fopen')) { $backends['ftp_wrapper'] = array( 'title' => t('FTP using file streams'), 'class' => 'FileTransferFTPWrapper', 'settings_form' => 'system_filetransfer_backend_form_ftp', 'weight' => 10, ); } // SSH2 lib connection is only available if the proper PHP extension is // installed. if (function_exists('ssh2_connect')) { $backends['ssh'] = array( 'title' => t('SSH'), 'class' => 'FileTransferSSH', 'settings_form' => 'system_filetransfer_backend_form_ssh', 'weight' => 20, ); } return $backends; } /** * Helper function to return a form for configuring a filetransfer backend. * * @param string $filetransfer_backend_name * The name of the backend to return a form for. * * @param string $defaults * An associative array of settings to pre-populate the form with. */ function system_get_filetransfer_settings_form($filetransfer_backend_name, $defaults) { $available_backends = module_invoke_all('filetransfer_backends'); $form = call_user_func($available_backends[$filetransfer_backend_name]['settings_form']); foreach ($form as $name => &$element) { if (isset($defaults[$name])) { $element['#default_value'] = $defaults[$name]; } } return $form; } /** * Returns the form to configure the filetransfer class for FTP */ function system_filetransfer_backend_form_ftp() { $form = _system_filetransfer_backend_form_common(); $form['port']['#default_value'] = 21; return $form; } /** * Returns the form to configure the filetransfer class for SSH */ function system_filetransfer_backend_form_ssh() { $form = _system_filetransfer_backend_form_common(); $form['port']['#default_value'] = 22; return $form; } /** * Helper function because SSH and FTP backends share the same elements */ function _system_filetransfer_backend_form_common() { $form = array(); $form['hostname'] = array ( '#type' => 'textfield', '#title' => t('Host'), '#default_value' => 'localhost', ); $form['port'] = array ( '#type' => 'textfield', '#title' => t('Port'), '#default_value' => NULL, ); $form['username'] = array ( '#type' => 'textfield', '#title' => t('Username'), ); $form['password'] = array ( '#type' => 'password', '#title' => t('Password'), '#description' => t('This is not saved in the database and is only used to test the connection'), ); return $form; } /** * Implement hook_init(). */ function system_init() { // Use the administrative theme if the user is looking at a page in the admin/* path. if (arg(0) == 'admin' || (variable_get('node_admin_theme', '0') && arg(0) == 'node' && (arg(1) == 'add' || arg(2) == 'edit'))) { global $custom_theme; $custom_theme = variable_get('admin_theme', 0); drupal_add_css(drupal_get_path('module', 'system') . '/admin.css'); } // Add the CSS for this module. drupal_add_css(drupal_get_path('module', 'system') . '/defaults.css'); drupal_add_css(drupal_get_path('module', 'system') . '/system.css'); drupal_add_css(drupal_get_path('module', 'system') . '/system-menus.css'); // Ignore slave database servers for this request. // // In Drupal's distributed database structure, new data is written to the master // and then propagated to the slave servers. This means there is a lag // between when data is written to the master and when it is available on the slave. // At these times, we will want to avoid using a slave server temporarily. // For example, if a user posts a new node then we want to disable the slave // server for that user temporarily to allow the slave server to catch up. // That way, that user will see their changes immediately while for other // users we still get the benefits of having a slave server, just with slightly // stale data. Code that wants to disable the slave server should use the // db_set_ignore_slave() function to set $_SESSION['ignore_slave_server'] to // the timestamp after which the slave can be re-enabled. if (isset($_SESSION['ignore_slave_server'])) { if ($_SESSION['ignore_slave_server'] >= REQUEST_TIME) { Database::ignoreTarget('default', 'slave'); } else { unset($_SESSION['ignore_slave_server']); } } } /** * Implement MODULE_preprocess_HOOK(). */ function system_preprocess_page(&$variables) { // Get the major version list($version, ) = explode('.', VERSION); // Emit the META tag in the HTML HEAD section theme('meta_generator_html', $version); // Emit the HTTP Header too theme('meta_generator_header', $version); $variables['head'] = drupal_get_html_head(); } /** * Implement hook_user_form(). */ function system_user_form(&$edit, &$user, $category = NULL) { if ($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); if (variable_get('configurable_timezones', 1)) { system_user_timezone($edit, $form); } return $form; } } /** * Implement hook_user_register(). */ function system_user_register(&$edit, &$user, $category = NULL) { if (variable_get('configurable_timezones', 1)) { $form = array(); if (variable_get('user_default_timezone', DRUPAL_USER_TIMEZONE_DEFAULT) == DRUPAL_USER_TIMEZONE_SELECT) { system_user_timezone($edit, $form); } else { $form['account']['timezone'] = array( '#type' => 'hidden', '#value' => variable_get('user_default_timezone', DRUPAL_USER_TIMEZONE_DEFAULT) ? '' : variable_get('date_default_timezone', ''), ); } return $form; } } /** * Implement hook_user_login(). */ function system_user_login(&$edit, &$user, $category = NULL) { // If the user has a NULL time zone, notify them to set a time zone. if (!$user->timezone && variable_get('configurable_timezones', 1) && variable_get('empty_timezone_message', 0)) { drupal_set_message(t('Please configure your account time zone setting.', array('@user-edit' => url("user/$user->uid/edit", array('query' => drupal_get_destination(), 'fragment' => 'edit-timezone'))))); } } /** * Add the time zone field to the user edit and register forms. */ function system_user_timezone(&$edit, &$form) { global $user; $form['timezone'] = array( '#type' => 'fieldset', '#title' => t('Locale settings'), '#weight' => 6, '#collapsible' => TRUE, ); $form['timezone']['timezone'] = array( '#type' => 'select', '#title' => t('Time zone'), '#default_value' => $edit['timezone'] ? $edit['timezone'] : ($edit['uid'] == $user->uid ? variable_get('date_default_timezone', '') : ''), '#options' => system_time_zones(($edit['uid'] != $user->uid)), '#description' => t('Select the desired local time and time zone. Dates and times throughout this site will be displayed using this time zone.'), ); if (!$edit['timezone'] && $edit['uid'] == $user->uid) { $form['timezone']['#description'] = t('Your time zone setting will be automatically detected if possible. Please confirm the selection and click save.'); $form['timezone']['timezone']['#attributes'] = array('class' => 'timezone-detect'); drupal_add_js('misc/timezone.js'); } } /** * Implement hook_block_list(). */ function system_block_list() { $blocks['main'] = array( 'info' => t('Main page content'), // Cached elsewhere. 'cache' => BLOCK_NO_CACHE, ); $blocks['powered-by'] = array( 'info' => t('Powered by Drupal'), 'weight' => '10', 'cache' => BLOCK_NO_CACHE, ); $blocks['help'] = array( 'info' => t('System help'), 'weight' => '5', ); // System-defined menu blocks. foreach (menu_list_system_menus() as $menu_name => $title) { $blocks[$menu_name]['info'] = t($title); // Menu blocks can't be cached because each menu item can have // a custom access callback. menu.inc manages its own caching. $blocks[$menu_name]['cache'] = BLOCK_NO_CACHE; } return $blocks; } /** * Implement hook_block_configure(). */ function system_block_configure($delta = '') { if ($delta == 'powered-by') { $image_path = 'misc/' . variable_get('drupal_badge_color', 'powered-blue') . '-' . variable_get('drupal_badge_size', '80x15') . '.png'; drupal_add_js(drupal_get_path('module', 'system') . '/system.js'); // 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')), ); $form['wrapper']['preview'] = array( '#type' => 'item', '#title' => 'Preview', '#markup' => theme('image', $image_path, t('Powered by Drupal, an open source content management system'), t('Powered by Drupal, an open source content management system'), array('class' => 'powered-by-preview'), FALSE), ); return $form; } } /** * Implement hook_block_save(). */ function system_block_save($delta = '', $edit = NULL) { if ($delta == 'powered-by') { $image_path = 'misc/' . variable_get('drupal_badge_color', 'powered-blue') . '-' . variable_get('drupal_badge_size', '80x15') . '.png'; variable_set('drupal_badge_color', $edit['color']); variable_set('drupal_badge_size', $edit['size']); } } /** * Implement hook_block_view(). * * Generate a block with a promotional link to Drupal.org and * all system menu blocks. */ function system_block_view($delta = '') { $block = array(); switch ($delta) { case 'main': $block['subject'] = NULL; $block['content'] = drupal_set_page_content(); return $block; case 'powered-by': $image_path = 'misc/' . variable_get('drupal_badge_color', 'powered-blue') . '-' . variable_get('drupal_badge_size', '80x15') . '.png'; $block['subject'] = NULL; $block['content'] = theme('system_powered_by', $image_path); return $block; case 'help': $block['subject'] = NULL; $block['content'] = menu_get_active_help(); return $block; default: // All system menu blocks. $system_menus = menu_list_system_menus(); if (isset($system_menus[$delta])) { $block['subject'] = t($system_menus[$delta]); $block['content'] = menu_tree($delta); return $block; } break; } } /** * Provide a single block on the administration overview page. * * @param $item * The menu item to be displayed. */ function system_admin_menu_block($item) { $cache = &drupal_static(__FUNCTION__, array()); if (!isset($item['mlid'])) { $item += db_query("SELECT mlid, menu_name FROM {menu_links} ml WHERE ml.router_path = :path AND module = 'system'", array(':path' => $item['path']))->fetchAssoc(); } else if (isset($cache[$item['mlid']])) { return $cache[$item['mlid']]; } $content = array(); $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.* FROM {menu_links} ml LEFT JOIN {menu_router} m ON ml.router_path = m.path WHERE ml.plid = :plid AND ml.menu_name = :name AND hidden = 0", array(':plid' => $item['mlid'], ':name' => $item['menu_name']), array('fetch' => PDO::FETCH_ASSOC)); foreach ($result as $item) { _menu_link_translate($item); if (!$item['access']) { continue; } // 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']; } // 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']) . ' ' . $item['title'] . ' ' . $item['mlid']] = $item; } ksort($content); $cache[$item['mlid']] = $content; return $content; } /** * 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')) { $enabled = array(); $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. $info->key = $info->name == variable_get('theme_default', 'garland') ? '' : $info->name; $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('#markup' => $screenshot); $form['themes'][$info->key]['description'] = array('#type' => 'item', '#title' => $info->name, '#markup' => dirname($info->filename) . ($info->name == variable_get('theme_default', 'garland') ? '