system.module 89.9 KB
Newer Older
Dries's avatar
 
Dries committed
1
<?php
2
// $Id$
Dries's avatar
 
Dries committed
3

Dries's avatar
 
Dries committed
4 5 6 7 8
/**
 * @file
 * Configuration system that lets administrators modify the workings of the site.
 */

9 10 11
/**
 * The current system version.
 */
12
define('VERSION', '7.0-dev');
13 14 15 16

/**
 * Core API compatibility.
 */
17
define('DRUPAL_CORE_COMPATIBILITY', '7.x');
18

19 20 21
/**
 * Minimum supported version of PHP.
 */
22
define('DRUPAL_MINIMUM_PHP',    '5.2.0');
23

24 25 26 27 28
/**
 * Minimum recommended value of PHP memory_limit.
 */
define('DRUPAL_MINIMUM_PHP_MEMORY_LIMIT',    '16M');

29 30 31
/**
 * Minimum supported version of MySQL, if it is used.
 */
32
define('DRUPAL_MINIMUM_MYSQL',  '5.0');
33 34 35 36

/**
 * Minimum supported version of PostgreSQL, if it is used.
 */
37
define('DRUPAL_MINIMUM_PGSQL',  '8.3');
38 39 40 41

/**
 * Maximum age of temporary files in seconds.
 */
42
define('DRUPAL_MAXIMUM_TEMP_FILE_AGE', 21600);
43

44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
/**
 * New users will be set to the default time zone at registration.
 */
define('DRUPAL_USER_TIMEZONE_DEFAULT', 0);

/**
 * New users will get an empty time zone at registration.
 */
define('DRUPAL_USER_TIMEZONE_EMPTY', 1);

/**
 * New users will select their own timezone at registration.
 */
define('DRUPAL_USER_TIMEZONE_SELECT', 2);

59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
 /**
 * Disabled option on forms and settings
 */
define('DRUPAL_DISABLED', 0);

/**
 * Optional option on forms and settings
 */
define('DRUPAL_OPTIONAL', 1);

/**
 * Required option on forms and settings
 */
define('DRUPAL_REQUIRED', 2);

Dries's avatar
 
Dries committed
74
/**
75
 * Implement hook_help().
Dries's avatar
 
Dries committed
76
 */
77
function system_help($path, $arg) {
78 79
  global $base_url;

80
  switch ($path) {
81
    case 'admin/help#system':
82 83 84 85 86 87
      $output = '<p>' . t('The system module is at the foundation of your Drupal website, and provides basic but extensible functionality for use by other modules and themes. Some integral elements of Drupal are contained in and managed by the system module, including caching, enabling or disabling of modules and themes, preparing and displaying the administrative page, and configuring fundamental site settings. A number of key system maintenance operations are also part of the system module.') . '</p>';
      $output .= '<p>' . t('The system module provides:') . '</p>';
      $output .= '<ul><li>' . t('support for enabling and disabling <a href="@modules">modules</a>. Drupal comes packaged with a number of core modules; each module provides a discrete set of features and may be enabled depending on the needs of your site. A wide array of additional modules contributed by members of the Drupal community are available for download at the <a href="@drupal-modules">Drupal.org module page</a>.', array('@modules' => url('admin/build/modules'), '@drupal-modules' => 'http://drupal.org/project/modules')) . '</li>';
      $output .= '<li>' . t('support for enabling and disabling <a href="@themes">themes</a>, which determine the design and presentation of your site. Drupal comes packaged with several core themes and additional contributed themes are available at the <a href="@drupal-themes">Drupal.org theme page</a>.', array('@themes' => url('admin/build/themes'), '@drupal-themes' => 'http://drupal.org/project/themes')) . '</li>';
      $output .= '<li>' . t('a robust <a href="@cache-settings">caching system</a> that allows the efficient re-use of previously-constructed web pages and web page components. Drupal stores the pages requested by anonymous users in a compressed format; depending on your site configuration and the amount of your web traffic tied to anonymous visitors, Drupal\'s caching system may significantly increase the speed of your site.', array('@cache-settings' => url('admin/settings/performance'))) . '</li>';
      $output .= '<li>' . t('a set of routine administrative operations that rely on a correctly-configured <a href="@cron">cron maintenance task</a> to run automatically. A number of other modules, including the feed aggregator, and search also rely on <a href="@cron">cron maintenance tasks</a>. For more information, see the online handbook entry for <a href="@handbook">configuring cron jobs</a>.', array('@cron' => url('admin/reports/status'), '@handbook' => 'http://drupal.org/cron')) . '</li>';
88
      $output .= '<li>' . t('basic configuration options for your site, including <a href="@regional-settings">date and time settings</a>, <a href="@file-system">file system settings</a>, <a href="@clean-url">clean URL support</a>, <a href="@site-info">site name and other information</a>, and a <a href="@maintenance-mode">maintenance mode</a> for taking your site temporarily offline.', array('@regional-settings' => url('admin/settings/regional-settings'), '@file-system' => url('admin/settings/file-system'), '@clean-url' => url('admin/settings/clean-urls'), '@site-info' => url('admin/settings/site-information'), '@maintenance-mode' => url('admin/settings/maintenance-mode'))) . '</li></ul>';
89
      $output .= '<p>' . t('For more information, see the online handbook entry for <a href="@system">System module</a>.', array('@system' => 'http://drupal.org/handbook/modules/system/')) . '</p>';
90
      return $output;
91
    case 'admin/by-module':
92
      return '<p>' . t('This page shows you all available administration tasks for each module.') . '</p>';
93
    case 'admin/build/themes':
94 95
      $output = '<p>' . t('Select which themes are available to your users and specify the default theme. To configure site-wide display settings, click the "configure" task above. Alternatively, to override these settings in a specific theme, click the "configure" link for that theme. Note that different themes may have different regions available for displaying content; for consistency in presentation, you may wish to enable only one theme.') . '</p>';
      $output .= '<p>' . t('To change the appearance of your site, a number of <a href="@themes">contributed themes</a> are available.', array('@themes' => 'http://drupal.org/project/themes')) . '</p>';
96
      return $output;
97
    case 'admin/build/themes/settings/' . $arg[4]:
98
      $reference = explode('.', $arg[4], 2);
99
      $theme = array_pop($reference);
100
      return '<p>' . t('These options control the display settings for the <code>%template</code> theme. When your site is displayed using this theme, these settings will be used. By clicking "Reset to defaults," you can choose to use the <a href="@global">global settings</a> for this theme.', array('%template' => $theme, '@global' => url('admin/build/themes/settings'))) . '</p>';
101
    case 'admin/build/themes/settings':
102
      return '<p>' . t('These options control the default display settings for your entire site, across all themes. Unless they have been overridden by a specific theme, these settings will be used.') . '</p>';
103
    case 'admin/build/modules':
104 105 106
      $output = '<p>' . t('Modules are plugins that extend Drupal\'s core functionality. To enable modules, select the <em>Enabled</em> checkboxes below and click the <em>Save configuration</em> button. To further extend your site\'s functionality, a number of <a href="@modules">contributed modules</a> are available for download.', array('@permissions' => url('admin/user/permissions'), '@modules' => 'http://drupal.org/project/modules')) . '</p>';
      $output .= '<p>' . t('Module-related tasks can be located on the <a href="@by-module">administration by module page</a>. New <a href="@permissions">module-related permissions</a> may also become available as new modules are enabled.', array('@by-module' => url('admin/by-module'), '@permissions' => url('admin/user/permissions'))) . '</p>';
      $output .= '<p>' . t('Each time a module is updated, it is important that <a href="@update-php">update.php</a> is run. To help manage the update process, the <em>Update status</em> module, if enabled, provides <a href="@updates">information on new versions of modules (and themes)</a> as they are released. Regular review of the <a href="@updates">available updates page</a> is essential to maintaining a secure and current site.', array('@update-php' => $base_url . '/update.php', '@updates' => url('admin/reports/updates'))) . '</p>';
107
      return $output;
108
    case 'admin/build/modules/uninstall':
109
      return '<p>' . t('The uninstall process removes all data related to a module. To uninstall a module, you must first disable it on the main <a href="@modules">modules page</a>. Not all modules support this feature.', array('@modules' => url('admin/build/modules'))) . '</p>';
110
    case 'admin/build/block/configure':
111
      if ($arg[4] == 'system' && $arg[5] == 'powered-by') {
112
        return '<p>' . t('The <em>Powered by Drupal</em> block is an optional link to the home page of the Drupal project. While there is absolutely no requirement that sites feature this link, it may be used to show support for Drupal.') . '</p>';
113
      }
114
      break;
115 116
    case 'admin/settings/actions':
    case 'admin/settings/actions/manage':
117 118
      $output = '<p>' . t('Actions are individual tasks that the system can do, such as unpublishing a piece of content or banning a user. Modules, such as the trigger module, can fire these actions when certain system events happen; for example, when a new post is added or when a user logs in. Modules may also provide additional actions.') . '</p>';
      $output .= '<p>' . t('There are two types of actions: simple and advanced. Simple actions do not require any additional configuration, and are listed here automatically. Advanced actions can do more than simple actions; for example, send an e-mail to a specified address, or check for certain words within a piece of content. These actions need to be created and configured first before they may be used. To create an advanced action, select the action from the drop-down below and click the <em>Create</em> button.') . '</p>';
119
      if (module_exists('trigger')) {
120
        $output .= '<p>' . t('You may proceed to the <a href="@url">Triggers</a> page to assign these actions to system events.', array('@url' => url('admin/build/trigger'))) . '</p>';
121
      }
122
      return $output;
123 124
    case 'admin/settings/actions/configure':
      return t('An advanced action offers additional configuration options which may be filled out below. Changing the <em>Description</em> field is recommended, in order to better identify the precise action taking place. This description will be displayed in modules such as the trigger module when assigning actions to system events, so it is best if it is as descriptive as possible (for example, "Send e-mail to Moderation Team" rather than simply "Send e-mail").');
125
    case 'admin/settings/ip-blocking':
126
      return '<p>' . 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.') . '</p>';
127
    case 'admin/reports/status':
128
      return '<p>' . t("Here you can find a short overview of your site's parameters as well as any problems detected with your installation. It may be useful to copy and paste this information into support requests filed on drupal.org's support forums and project issue queues.") . '</p>';
129
  }
Dries's avatar
 
Dries committed
130 131
}

132
/**
133
 * Implement hook_theme().
134
 */
135
function system_theme() {
136
  return array_merge(drupal_common_theme(), array(
137 138
    'system_theme_select_form' => array(
      'arguments' => array('form' => NULL),
139
      'file' => 'system.admin.inc',
140 141 142
    ),
    'system_themes_form' => array(
      'arguments' => array('form' => NULL),
143
      'file' => 'system.admin.inc',
144
    ),
145
    'system_modules_fieldset' => array(
146
      'arguments' => array('form' => NULL),
147
      'file' => 'system.admin.inc',
148
    ),
149 150
    'system_modules_incompatible' => array(
      'arguments' => array('message' => NULL),
151
      'file' => 'system.admin.inc',
152
    ),
153 154
    'system_modules_uninstall' => array(
      'arguments' => array('form' => NULL),
155
      'file' => 'system.admin.inc',
156 157 158
    ),
    'status_report' => array(
      'arguments' => array('requirements' => NULL),
159
      'file' => 'system.admin.inc',
160 161 162
    ),
    'admin_page' => array(
      'arguments' => array('blocks' => NULL),
163
      'file' => 'system.admin.inc',
164 165 166
    ),
    'admin_block' => array(
      'arguments' => array('block' => NULL),
167
      'file' => 'system.admin.inc',
168 169 170
    ),
    'admin_block_content' => array(
      'arguments' => array('content' => NULL),
171
      'file' => 'system.admin.inc',
172 173 174
    ),
    'system_admin_by_module' => array(
      'arguments' => array('menu_items' => NULL),
175
      'file' => 'system.admin.inc',
176
    ),
177 178 179
    'system_powered_by' => array(
      'arguments' => array('image_path' => NULL),
    ),
180 181 182 183 184 185
    'meta_generator_html' => array(
      'arguments' => array('version' => NULL),
    ),
    'meta_generator_header' => array(
      'arguments' => array('version' => NULL),
    ),
186
    'system_compact_link' => array(),
187 188
  ));
}
189

Dries's avatar
 
Dries committed
190
/**
191
 * Implement hook_perm().
Dries's avatar
 
Dries committed
192
 */
Dries's avatar
 
Dries committed
193
function system_perm() {
194
  return array(
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222
    '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.'),
    ),
223
  );
Dries's avatar
 
Dries committed
224 225
}

226
/**
227
 * Implement hook_rdf_namespaces().
228 229 230 231 232 233 234 235 236 237 238 239 240
 */
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#',
241
    'xsd'      => 'http://www.w3.org/2001/XMLSchema',
242 243 244
  );
}

245
/**
246
 * Implement hook_elements().
247 248 249
 */
function system_elements() {
  // Top level form
250 251 252
  $type['form'] = array(
    '#method' => 'post',
    '#action' => request_uri(),
253
    '#theme_wrapper' => 'form',
254 255
  );

256 257 258 259 260 261 262 263 264 265 266 267 268
  $type['page'] = array(
    '#show_messages' => TRUE,
    '#show_blocks' => TRUE,
    '#theme' => 'page',
  );

  $type['list'] = array(
    '#title' => '',
    '#list_type' => 'ul',
    '#attributes' => array(),
    '#items' => array(),
  );

269 270 271 272 273 274 275 276
  /**
   * Input elements.
   */
  $type['submit'] = array(
    '#input' => TRUE,
    '#name' => 'op',
    '#button_type' => 'submit',
    '#executes_submit_callback' => TRUE,
277
    '#process' => array('form_process_ahah'),
278
    '#theme_wrapper' => 'button',
279 280 281 282 283 284 285
  );

  $type['button'] = array(
    '#input' => TRUE,
    '#name' => 'op',
    '#button_type' => 'submit',
    '#executes_submit_callback' => FALSE,
286
    '#process' => array('form_process_ahah'),
287
    '#theme_wrapper' => 'button',
288 289 290 291 292 293
  );

  $type['image_button'] = array(
    '#input' => TRUE,
    '#button_type' => 'submit',
    '#executes_submit_callback' => TRUE,
294
    '#process' => array('form_process_ahah'),
295 296 297
    '#return_value' => TRUE,
    '#has_garbage_value' => TRUE,
    '#src' => NULL,
298
    '#theme_wrapper' => 'image_button',
299 300 301 302 303 304 305
  );

  $type['textfield'] = array(
    '#input' => TRUE,
    '#size' => 60,
    '#maxlength' => 128,
    '#autocomplete_path' => FALSE,
306
    '#process' => array('form_process_text_format', 'form_process_ahah'),
307 308
    '#theme' => 'textfield',
    '#theme_wrapper' => 'form_element',
309 310 311 312 313 314
  );

  $type['password'] = array(
    '#input' => TRUE,
    '#size' => 60,
    '#maxlength' => 128,
315
    '#process' => array('form_process_ahah'),
316 317
    '#theme' => 'password',
    '#theme_wrapper' => 'form_element',
318 319 320 321
  );

  $type['password_confirm'] = array(
    '#input' => TRUE,
322
    '#process' => array('form_process_password_confirm'),
323
    '#theme_wrapper' => 'form_element',
324 325 326 327 328 329 330
  );

  $type['textarea'] = array(
    '#input' => TRUE,
    '#cols' => 60,
    '#rows' => 5,
    '#resizable' => TRUE,
331
    '#process' => array('form_process_text_format', 'form_process_ahah'),
332 333
    '#theme' => 'textarea',
    '#theme_wrapper' => 'form_element',
334 335 336 337
  );

  $type['radios'] = array(
    '#input' => TRUE,
338
    '#process' => array('form_process_radios'),
339 340
    '#theme_wrapper' => 'radios',
    '#pre_render' => array('form_pre_render_conditional_form_element'),
341 342 343 344 345
  );

  $type['radio'] = array(
    '#input' => TRUE,
    '#default_value' => NULL,
346
    '#process' => array('form_process_ahah'),
347 348 349
    '#theme' => 'radio',
    '#theme_wrapper' => 'form_element',
    '#form_element_skip_title' => TRUE,
350 351 352 353 354
  );

  $type['checkboxes'] = array(
    '#input' => TRUE,
    '#tree' => TRUE,
355
    '#process' => array('form_process_checkboxes'),
356 357
    '#theme_wrapper' => 'checkboxes',
    '#pre_render' => array('form_pre_render_conditional_form_element'),
358 359 360 361 362
  );

  $type['checkbox'] = array(
    '#input' => TRUE,
    '#return_value' => 1,
363
    '#process' => array('form_process_ahah'),
364 365 366
    '#theme' => 'checkbox',
    '#theme_wrapper' => 'form_element',
    '#form_element_skip_title' => TRUE,
367 368 369 370 371 372
  );

  $type['select'] = array(
    '#input' => TRUE,
    '#size' => 0,
    '#multiple' => FALSE,
373
    '#process' => array('form_process_ahah'),
374 375
    '#theme' => 'select',
    '#theme_wrapper' => 'form_element',
376 377 378 379 380 381
  );

  $type['weight'] = array(
    '#input' => TRUE,
    '#delta' => 10,
    '#default_value' => 0,
382
    '#process' => array('form_process_weight', 'form_process_ahah'),
383 384 385 386 387
  );

  $type['date'] = array(
    '#input' => TRUE,
    '#element_validate' => array('date_validate'),
388
    '#process' => array('form_process_date'),
389 390
    '#theme' => 'date',
    '#theme_wrapper' => 'form_element',
391 392 393 394 395
  );

  $type['file'] = array(
    '#input' => TRUE,
    '#size' => 60,
396 397
    '#theme' => 'file',
    '#theme_wrapper' => 'form_element',
398
  );
399

400 401 402 403 404 405 406
  $type['tableselect'] = array(
    '#input' => TRUE,
    '#js_select' => TRUE,
    '#multiple' => TRUE,
    '#process' => array('form_process_tableselect'),
    '#options' => array(),
    '#empty' => '',
407
    '#theme' => 'tableselect'
408
  );
409 410 411 412 413

  /**
   * Form structure.
   */
  $type['item'] = array(
414
    '#markup' => '',
415 416
    '#theme' => 'markup',
    '#theme_wrapper' => 'form_element',
417 418 419 420
  );

  $type['hidden'] = array(
    '#input' => TRUE,
421
    '#process' => array('form_process_ahah'),
422
    '#theme' => 'hidden',
423 424 425 426 427 428 429
  );

  $type['value'] = array(
    '#input' => TRUE,
  );

  $type['markup'] = array(
430 431
    '#markup' => '',
    '#theme' => 'markup',
432 433 434 435 436 437
  );

  $type['fieldset'] = array(
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
    '#value' => NULL,
438 439
    '#process' => array('form_process_fieldset', 'form_process_ahah'),
    '#pre_render' => array('form_pre_render_fieldset'),
440
    '#theme_wrapper' => 'fieldset',
441 442
  );

443 444 445 446 447 448
  $type['vertical_tabs'] = array(
    '#theme_wrapper' => 'vertical_tabs',
    '#default_tab' => '',
    '#process' => array('form_process_vertical_tabs'),
  );

449 450
  $type['token'] = array(
    '#input' => TRUE,
451
    '#theme' => array('hidden'),
452 453
  );

454 455 456
  return $type;
}

Dries's avatar
 
Dries committed
457
/**
458
 * Implement hook_menu().
Dries's avatar
 
Dries committed
459
 */
460 461
function system_menu() {
  $items['system/files'] = array(
462
    'title' => 'File download',
463 464
    'page callback' => 'file_download',
    'access callback' => TRUE,
465 466 467 468 469 470
    'type' => MENU_CALLBACK,
  );
  $items['system/ahah'] = array(
    'title' => 'AHAH callback',
    'page callback' => 'form_ahah_callback',
    'access callback' => TRUE,
471 472
    'type' => MENU_CALLBACK,
  );
473 474 475 476 477 478
  $items['system/timezone'] = array(
    'title' => 'Time zone',
    'page callback' => 'system_timezone',
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,
  );
479
  $items['admin'] = array(
480
    'title' => 'Administer',
481 482 483
    'access arguments' => array('access administration pages'),
    'page callback' => 'system_main_admin_page',
    'weight' => 9,
484
    'menu_name' => 'management',
485 486
  );
  $items['admin/compact'] = array(
487
    'title' => 'Compact mode',
488
    'page callback' => 'system_admin_compact_page',
489
    'access arguments' => array('access administration pages'),
490 491 492
    'type' => MENU_CALLBACK,
  );
  $items['admin/by-task'] = array(
493
    'title' => 'By task',
494
    'page callback' => 'system_main_admin_page',
495
    'access arguments' => array('access administration pages'),
496 497 498
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
  $items['admin/by-module'] = array(
499
    'title' => 'By module',
500
    'page callback' => 'system_admin_by_module',
501
    'access arguments' => array('access administration pages'),
502 503 504
    'type' => MENU_LOCAL_TASK,
    'weight' => 2,
  );
505 506 507 508 509 510
  $items['admin/content'] = array(
    'title' => 'Content management',
    'description' => "Manage your site's content.",
    'position' => 'left',
    'weight' => -10,
    'page callback' => 'system_admin_menu_block_page',
511 512
    'access callback' => 'system_admin_menu_block_access',
    'access arguments' => array('admin/content', 'access administration pages'),
513 514
  );

515
  // Menu items that are basically just menu blocks.
516
  $items['admin/settings'] = array(
517
    'title' => 'Site configuration',
518
    'description' => 'Configure site settings.',
519 520 521
    'position' => 'right',
    'weight' => -5,
    'page callback' => 'system_settings_overview',
522 523
    'access callback' => 'system_admin_menu_block_access',
    'access arguments' => array('admin/settings', 'access administration pages'),
524 525
  );
  $items['admin/build'] = array(
526 527
    'title' => 'Site building',
    'description' => 'Control how your site looks and feels.',
528 529 530
    'position' => 'right',
    'weight' => -10,
    'page callback' => 'system_admin_menu_block_page',
531 532
    'access callback' => 'system_admin_menu_block_access',
    'access arguments' => array('admin/build', 'access administration pages'),
533
  );
534
  // Themes.
535
  $items['admin/build/themes'] = array(
536 537
    'title' => 'Themes',
    'description' => 'Change which theme your site uses or allows users to set.',
538
    'page callback' => 'drupal_get_form',
539
    'page arguments' => array('system_themes_form'),
540
    'access arguments' => array('administer site configuration'),
541 542
  );
  $items['admin/build/themes/select'] = array(
543
    'title' => 'List',
544
    'description' => 'Select the default theme for your site.',
545 546 547 548
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -1,
  );
  $items['admin/build/themes/settings'] = array(
549
    'title' => 'Configure',
550
    'page arguments' => array('system_theme_settings'),
551
    'access arguments' => array('administer site configuration'),
552 553
    'type' => MENU_LOCAL_TASK,
  );
554
  // Theme configuration subtabs.
555
  $items['admin/build/themes/settings/global'] = array(
556
    'title' => 'Global settings',
557 558 559
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -1,
  );
Dries's avatar
 
Dries committed
560

561
  foreach (list_themes() as $theme) {
562
    $items['admin/build/themes/settings/' . $theme->name] = array(
563 564 565 566 567 568
      'title' => $theme->info['name'],
      'page arguments' => array('system_theme_settings', $theme->name),
      'type' => MENU_LOCAL_TASK,
      'access callback' => '_system_themes_access',
      'access arguments' => array($theme),
    );
Dries's avatar
 
Dries committed
569
  }
drumm's avatar
drumm committed
570

571
  // Modules.
572
  $items['admin/build/modules'] = array(
573 574
    'title' => 'Modules',
    'description' => 'Enable or disable add-on modules for your site.',
575 576
    'page callback' => 'drupal_get_form',
    'page arguments' => array('system_modules'),
577
    'access arguments' => array('administer site configuration'),
578 579
  );
  $items['admin/build/modules/list'] = array(
580
    'title' => 'List',
581 582 583
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
  $items['admin/build/modules/list/confirm'] = array(
584
    'title' => 'List',
585
    'access arguments' => array('administer site configuration'),
586 587 588
    'type' => MENU_CALLBACK,
  );
  $items['admin/build/modules/uninstall'] = array(
589
    'title' => 'Uninstall',
590
    'page arguments' => array('system_modules_uninstall'),
591
    'access arguments' => array('administer site configuration'),
592 593 594
    'type' => MENU_LOCAL_TASK,
  );
  $items['admin/build/modules/uninstall/confirm'] = array(
595
    'title' => 'Uninstall',
596
    'access arguments' => array('administer site configuration'),
597 598
    'type' => MENU_CALLBACK,
  );
Dries's avatar
 
Dries committed
599

600 601 602 603 604 605 606 607 608 609 610
  // 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'),
  );

611
  // Actions.
612
  $items['admin/settings/actions'] = array(
613 614 615 616 617
    'title' => 'Actions',
    'description' => 'Manage the actions defined for your site.',
    'access arguments' => array('administer actions'),
    'page callback' => 'system_actions_manage'
  );
618
  $items['admin/settings/actions/manage'] = array(
619 620 621 622 623 624
    'title' => 'Manage actions',
    'description' => 'Manage the actions defined for your site.',
    'page callback' => 'system_actions_manage',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -2,
  );
625 626
  $items['admin/settings/actions/configure'] = array(
    'title' => 'Configure an advanced action',
627 628
    'page callback' => 'drupal_get_form',
    'page arguments' => array('system_actions_configure'),
629
    'access arguments' => array('administer actions'),
630 631
    'type' => MENU_CALLBACK,
  );
632
  $items['admin/settings/actions/delete/%actions'] = array(
633 634 635 636
    'title' => 'Delete action',
    'description' => 'Delete an action.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('system_actions_delete_form', 4),
637
    'access arguments' => array('administer actions'),
638 639
    'type' => MENU_CALLBACK,
  );
640
  $items['admin/settings/actions/orphan'] = array(
641 642
    'title' => 'Remove orphans',
    'page callback' => 'system_actions_remove_orphans',
643
    'access arguments' => array('administer actions'),
644 645 646
    'type' => MENU_CALLBACK,
  );

647 648 649 650 651 652 653
  // 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'),
  );
654 655 656 657 658 659 660
  $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,
  );
661 662 663 664 665 666 667 668
  $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,
  );

669
  // Settings.
670
  $items['admin/settings/site-information'] = array(
671 672
    'title' => 'Site information',
    'description' => 'Change basic site information, such as the site name, slogan, e-mail address, mission, front page and more.',
673 674
    'page callback' => 'drupal_get_form',
    'page arguments' => array('system_site_information_settings'),
675
    'access arguments' => array('administer site configuration'),
676
  );
677
  $items['admin/settings/logging'] = array(
678
    'title' => 'Logging and errors',
679
    'description' => "Settings for logging and alerts modules. Various modules can route Drupal's system events to different destinations, such as syslog, database, email, etc.",
680
    'page callback' => 'drupal_get_form',
681
    'page arguments' => array('system_logging_settings'),
682
    'access arguments' => array('administer site configuration'),
683
  );
684 685
  $items['admin/settings/logging/settings'] = array(
    'title' => 'Settings',
686
    'access arguments' => array('administer site configuration'),
687 688
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -1,
689
  );
690
  $items['admin/settings/performance'] = array(
691
    'title' => 'Performance',
692
    'description' => 'Enable or disable page caching for anonymous users and set CSS and JS bandwidth optimization options.',
693 694
    'page callback' => 'drupal_get_form',
    'page arguments' => array('system_performance_settings'),
695
    'access arguments' => array('administer site configuration'),
696 697
  );
  $items['admin/settings/file-system'] = array(
698 699
    'title' => 'File system',
    'description' => 'Tell Drupal where to store uploaded files and how they are accessed.',
700 701
    'page callback' => 'drupal_get_form',
    'page arguments' => array('system_file_system_settings'),
702
    'access arguments' => array('administer site configuration'),
703 704
  );
  $items['admin/settings/image-toolkit'] = array(
705 706
    'title' => 'Image toolkit',
    'description' => 'Choose which image toolkit to use if you have installed optional toolkits.',
707 708
    'page callback' => 'drupal_get_form',
    'page arguments' => array('system_image_toolkit_settings'),
709
    'access arguments' => array('administer site configuration'),
710 711
  );
  $items['admin/content/rss-publishing'] = array(
712
    'title' => 'RSS publishing',
713
    'description' => 'Configure the site description, the number of items per feed and whether feeds should be titles/teasers/full-text.',
714 715
    'page callback' => 'drupal_get_form',
    'page arguments' => array('system_rss_feeds_settings'),
716
    'access arguments' => array('administer site configuration'),
717
  );
718 719
  $items['admin/settings/regional-settings'] = array(
    'title' => 'Regional settings',
720
    'description' => "Settings for how Drupal displays date and time, as well as the system's default time zone.",
721
    'page callback' => 'drupal_get_form',
722
    'page arguments' => array('system_regional_settings'),
723
    'access arguments' => array('administer site configuration'),
724
  );
725
  $items['admin/settings/regional-settings/lookup'] = array(
726
    'title' => 'Date and time lookup',
727 728
    'type' => MENU_CALLBACK,
    'page callback' => 'system_date_time_lookup',
729
    'access arguments' => array('administer site configuration'),
730
  );
731 732
  $items['admin/settings/maintenance-mode'] = array(
    'title' => 'Maintenance mode',
733
    'description' => 'Take the site offline for maintenance or bring it back online.',
734
    'page callback' => 'drupal_get_form',
735
    'page arguments' => array('system_site_maintenance_mode'),
736
    'access arguments' => array('administer site configuration'),
737 738
  );
  $items['admin/settings/clean-urls'] = array(
739 740
    'title' => 'Clean URLs',
    'description' => 'Enable or disable clean URLs for your site.',
741 742
    'page callback' => 'drupal_get_form',
    'page arguments' => array('system_clean_url_settings'),
743
    'access arguments' => array('administer site configuration'),
744
  );
745 746 747 748 749 750 751
  $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,
  );
752

753
  // Reports.
754 755 756
  $items['admin/reports'] = array(
    'title' => 'Reports',
    'description' => 'View reports from system logs and other status information.',
757
    'page callback' => 'system_admin_menu_block_page',
758 759
    'access callback' => 'system_admin_menu_block_access',
    'access arguments' => array('admin/reports', 'access site reports'),
760 761 762
    'weight' => 5,
    'position' => 'left',
  );
763
  $items['admin/reports/status'] = array(
764 765
    'title' => 'Status report',
    'description' => "Get a status report about your site's operation and any detected problems.",
766 767 768 769
    'page callback' => 'system_status',
    'weight' => 10,
    'access arguments' => array('administer site configuration'),
  );
770
  $items['admin/reports/status/run-cron'] = array(
771
    'title' => 'Run cron',
772
    'page callback' => 'system_run_cron',
773
    'access arguments' => array('administer site configuration'),
774 775
    'type' => MENU_CALLBACK,
  );
776
  $items['admin/reports/status/php'] = array(
777
    'title' => 'PHP',
778
    'page callback' => 'system_php',
779
    'access arguments' => array('administer site configuration'),
780 781
    'type' => MENU_CALLBACK,
  );
782
  // Default page for batch operations.
783 784 785 786 787
  $items['batch'] = array(
    'page callback' => 'system_batch_page',
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,
  );
Dries's avatar
 
Dries committed
788
  return $items;
Dries's avatar
 
Dries committed
789 790
}

791 792 793 794 795 796 797 798 799 800
/**
 * 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) {
801
  return db_query("SELECT * FROM {blocked_ips} WHERE iid = :iid", array(':iid' => $iid))->fetchAssoc();
802 803
}

804 805 806 807
/**
 * Menu item access callback - only admin or enabled themes can be accessed.
 */
function _system_themes_access($theme) {
808
  return user_access('administer site configuration') && ($theme->status || $theme->name == variable_get('admin_theme', 0));
809 810
}

811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829
/**
 * 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);
}

830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859
/**
 * Implementation of hook_filetransfer_backends().
 */
function system_filetransfer_backends() {
  $backends = array();

  // 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',
    );
  }
  if (function_exists('ftp_connect')) {
    $backends['ftp_extension'] = array(
      'title' => t('FTP Extension'),
      'class' => 'FileTransferFTPExtension',
    );
  }

  if (ini_get('allow_url_fopen')) {
    $backends['ftp_wrapper'] = array(
      'title' => t('FTP Wrapper'),
      'class' => 'FileTransferFTPWrapper',
    );
  }
  return $backends;
}

860
/**
861
 * Implement hook_init().