system.module 140 KB
Newer Older
Dries's avatar
   
Dries committed
1
2
<?php

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

8
use Drupal\Core\Utility\ModuleInfo;
9

10
use Symfony\Component\HttpFoundation\JsonResponse;
11
12
use Symfony\Component\HttpFoundation\Response;

13
14
15
/**
 * Maximum age of temporary files in seconds.
 */
16
const DRUPAL_MAXIMUM_TEMP_FILE_AGE = 21600;
17

18
19
20
/**
 * New users will be set to the default time zone at registration.
 */
21
const DRUPAL_USER_TIMEZONE_DEFAULT = 0;
22
23
24
25

/**
 * New users will get an empty time zone at registration.
 */
26
const DRUPAL_USER_TIMEZONE_EMPTY = 1;
27
28
29
30

/**
 * New users will select their own timezone at registration.
 */
31
const DRUPAL_USER_TIMEZONE_SELECT = 2;
32

33
34
35
 /**
 * Disabled option on forms and settings
 */
36
const DRUPAL_DISABLED = 0;
37
38
39
40

/**
 * Optional option on forms and settings
 */
41
const DRUPAL_OPTIONAL = 1;
42
43
44
45

/**
 * Required option on forms and settings
 */
46
const DRUPAL_REQUIRED = 2;
47

48
49
50
51
52
53
54
/**
 * Maximum number of values in a weight select element.
 *
 * If the number of values is over the maximum, a text field is used instead.
 */
const DRUPAL_WEIGHT_SELECT_MAX = 100;

55
/**
56
 * Return only visible regions.
57
58
 *
 * @see system_region_list()
59
 */
60
const REGIONS_VISIBLE = 'visible';
61
62

/**
63
 * Return all regions.
64
65
 *
 * @see system_region_list()
66
 */
67
const REGIONS_ALL = 'all';
68

Dries's avatar
   
Dries committed
69
/**
70
 * Implements hook_help().
Dries's avatar
   
Dries committed
71
 */
72
function system_help($path, $arg) {
73
74
  global $base_url;

75
  switch ($path) {
76
    case 'admin/help#system':
77
78
      $output = '';
      $output .= '<h3>' . t('About') . '</h3>';
79
      $output .= '<p>' . t('The System module is integral to the site, 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 and disabling 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. For more information, see the online handbook entry for <a href="@system">System module</a>.', array('@system' => 'http://drupal.org/documentation/modules/system')) . '</p>';
80
81
82
      $output .= '<h3>' . t('Uses') . '</h3>';
      $output .= '<dl>';
      $output .= '<dt>' . t('Managing modules') . '</dt>';
83
      $output .= '<dd>' . t('The System module allows users with the appropriate permissions to enable and disable modules on the <a href="@modules">Modules administration page</a>. Drupal comes with a number of core modules, and each module provides a discrete set of features and may be enabled or disabled depending on the needs of the site. Many 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/modules'), '@drupal-modules' => 'http://drupal.org/project/modules')) . '</dd>';
84
85
86
87
88
      $output .= '<dt>' . t('Managing themes') . '</dt>';
      $output .= '<dd>' . t('The System module allows users with the appropriate permissions to enable and disable themes on the <a href="@themes">Appearance administration page</a>. Themes 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/appearance'), '@drupal-themes' => 'http://drupal.org/project/themes')) . '</dd>';
      $output .= '<dt>' . t('Managing caching') . '</dt>';
      $output .= '<dd>' . t("The System module allows users with the appropriate permissions to manage caching on the <a href='@cache-settings'>Performance settings page</a>. Drupal has a robust caching system that allows the efficient re-use of previously-constructed web pages and web page components. Pages requested by anonymous users are stored in a compressed format; depending on your site configuration and the amount of your web traffic tied to anonymous visitors, the caching system may significantly increase the speed of your site.", array('@cache-settings' => url('admin/config/development/performance'))) . '</dd>';
      $output .= '<dt>' . t('Performing system maintenance') . '</dt>';
89
      $output .= '<dd>' . t('In order for the site and its modules to continue to operate well, a set of routine administrative operations must run on a regular basis. The System module manages this task by making use of a system cron job. You can verify the status of cron tasks by visiting the <a href="@status">Status report page</a>. For more information, see the online handbook entry for <a href="@handbook">configuring cron jobs</a>. You can set up cron job by visiting <a href="@cron">Cron configuration</a> page', array('@status' => url('admin/reports/status'), '@handbook' => 'http://drupal.org/cron', '@cron' => url('admin/config/system/cron'))) . '</dd>';
90
      $output .= '<dt>' . t('Configuring basic site settings') . '</dt>';
91
      $output .= '<dd>' . t('The System module also handles basic configuration options for your site, including <a href="@date-time-settings">Date and time settings</a>, <a href="@file-system">File system settings</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('@date-time-settings' => url('admin/config/regional/date-time'), '@file-system' => url('admin/config/media/file-system'), '@site-info' => url('admin/config/system/site-information'), '@maintenance-mode' => url('admin/config/development/maintenance'))) . '</dd>';
92
      $output .= '</dl>';
93
      return $output;
94
    case 'admin/index':
95
      return '<p>' . t('This page shows you all available administration tasks for each module.') . '</p>';
96
    case 'admin/appearance':
97
      $output = '<p>' . t('Set and configure the default theme for your website.  Alternative <a href="@themes">themes</a> are available.', array('@themes' => 'http://drupal.org/project/themes')) . '</p>';
98
      return $output;
99
    case 'admin/appearance/settings/' . $arg[3]:
100
101
102
      $theme_list = list_themes();
      $theme = $theme_list[$arg[3]];
      return '<p>' . t('These options control the display settings for the %name theme. When your site is displayed using this theme, these settings will be used.', array('%name' => $theme->info['name'])) . '</p>';
103
    case 'admin/appearance/settings':
104
      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>';
105
    case 'admin/modules':
106
      $output = '<p>' . t('Download additional <a href="@modules">contributed modules</a> to extend Drupal\'s functionality.', array('@modules' => 'http://drupal.org/project/modules')) . '</p>';
107
108
      if (module_exists('update')) {
        if (update_manager_access()) {
109
          $output .= '<p>' . t('Regularly review and install <a href="@updates">available updates</a> to maintain a secure and current site. Always run the <a href="@update-php">update script</a> each time a module is updated.', array('@update-php' => $base_url . '/core/update.php', '@updates' => url('admin/reports/updates'))) . '</p>';
110
111
        }
        else {
112
          $output .= '<p>' . t('Regularly review <a href="@updates">available updates</a> to maintain a secure and current site. Always run the <a href="@update-php">update script</a> each time a module is updated.', array('@update-php' => $base_url . '/core/update.php', '@updates' => url('admin/reports/updates'))) . '</p>';
113
114
115
        }
      }
      else {
116
        $output .= '<p>' . t('Regularly review available updates to maintain a secure and current site. Always run the <a href="@update-php">update script</a> each time a module is updated. Enable the Update Manager module to update and install modules and themes.', array('@update-php' => $base_url . '/core/update.php')) . '</p>';
117
      }
118
      return $output;
119
    case 'admin/modules/uninstall':
120
      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>.', array('@modules' => url('admin/modules'))) . '</p>';
121
    case 'admin/structure/block/manage':
122
      if ($arg[4] == 'system' && $arg[5] == 'powered-by') {
123
        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>';
124
      }
125
      break;
126
    case 'admin/config/development/maintenance':
127
128
      global $user;
      if ($user->uid == 1) {
129
        return '<p>' . t('Use maintenance mode when making major updates, particularly if the updates could disrupt visitors or the update process. Examples include upgrading, importing or exporting content, modifying a theme, modifying content types, and making backups.') . '</p>';
130
      }
131
      break;
132
    case 'admin/reports/status':
133
      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. Before filing a support request, ensure that your web server meets the <a href=\"@system-requirements\">system requirements.</a>", array('@system-requirements' => 'http://drupal.org/requirements')) . '</p>';
134
  }
Dries's avatar
   
Dries committed
135
136
}

137
/**
138
 * Implements hook_theme().
139
 */
140
function system_theme() {
141
  return array_merge(drupal_common_theme(), array(
142
143
    'system_themes_page' => array(
      'variables' => array('theme_groups' => NULL),
144
      'file' => 'system.admin.inc',
145
    ),
146
    'system_settings_form' => array(
147
      'render element' => 'form',
148
149
    ),
    'confirm_form' => array(
150
      'render element' => 'form',
151
    ),
152
    'system_modules_fieldset' => array(
153
      'render element' => 'form',
154
      'file' => 'system.admin.inc',
155
    ),
156
    'system_modules_incompatible' => array(
157
      'variables' => array('message' => NULL),
158
      'file' => 'system.admin.inc',
159
    ),
160
    'system_modules_uninstall' => array(
161
      'render element' => 'form',
162
      'file' => 'system.admin.inc',
163
164
    ),
    'status_report' => array(
165
      'render element' => 'requirements',
166
      'file' => 'system.admin.inc',
167
168
    ),
    'admin_page' => array(
169
      'variables' => array('blocks' => NULL),
170
      'file' => 'system.admin.inc',
171
172
    ),
    'admin_block' => array(
173
      'variables' => array('block' => NULL),
174
      'file' => 'system.admin.inc',
175
176
    ),
    'admin_block_content' => array(
177
      'variables' => array('content' => NULL),
178
      'file' => 'system.admin.inc',
179
    ),
180
    'system_admin_index' => array(
181
      'variables' => array('menu_items' => NULL),
182
      'file' => 'system.admin.inc',
183
    ),
184
    'system_powered_by' => array(
185
      'variables' => array(),
186
    ),
187
188
    'system_compact_link' => array(
      'variables' => array(),
189
    ),
190
    'system_date_time_settings' => array(
191
      'render element' => 'form',
192
193
      'file' => 'system.admin.inc',
    ),
194
195
196
    'system_date_format_localize_form' => array(
      'render element' => 'form',
    ),
197
198
  ));
}
199

Dries's avatar
   
Dries committed
200
/**
201
 * Implements hook_permission().
Dries's avatar
   
Dries committed
202
 */
203
function system_permission() {
204
  return array(
205
206
207
    'administer modules' => array(
      'title' => t('Administer modules'),
    ),
208
209
    'administer site configuration' => array(
      'title' => t('Administer site configuration'),
210
      'restrict access' => TRUE,
211
    ),
212
213
214
    'administer themes' => array(
      'title' => t('Administer themes'),
    ),
215
    'administer software updates' => array(
216
217
      'title' => t('Administer software updates'),
      'restrict access' => TRUE,
218
    ),
219
    'access administration pages' => array(
220
      'title' => t('Use the administration pages and help'),
221
    ),
222
    'access site in maintenance mode' => array(
223
      'title' => t('Use the site in maintenance mode'),
224
    ),
225
226
227
228
    'view the administration theme' => array(
      'title' => t('View the administration theme'),
      'description' => variable_get('admin_theme') ? '' : t('This is only used when the site is configured to use a separate administration theme on the <a href="@appearance-url">Appearance</a> page.', array('@appearance-url' => url('admin/appearance'))),
    ),
229
    'access site reports' => array(
230
      'title' => t('View site reports'),
231
    ),
232
  );
Dries's avatar
   
Dries committed
233
234
}

235
/**
236
 * Implements hook_hook_info().
237
238
239
240
241
 */
function system_hook_info() {
  $hooks['token_info'] = array(
    'group' => 'tokens',
  );
242
243
244
  $hooks['token_info_alter'] = array(
    'group' => 'tokens',
  );
245
246
247
  $hooks['tokens'] = array(
    'group' => 'tokens',
  );
248
249
250
251
  $hooks['tokens_alter'] = array(
    'group' => 'tokens',
  );

252
253
254
  return $hooks;
}

255
/**
256
 * Implements hook_element_info().
257
 */
258
259
260
function system_element_info() {
  // Top level elements.
  $types['form'] = array(
261
262
    '#method' => 'post',
    '#action' => request_uri(),
263
    '#theme_wrappers' => array('form'),
264
  );
265
  $types['page'] = array(
266
267
    '#show_messages' => TRUE,
    '#theme' => 'page',
268
    '#theme_wrappers' => array('html'),
269
  );
270
  // By default, we don't want Ajax commands being rendered in the context of an
271
272
  // HTML page, so we don't provide defaults for #theme or #theme_wrappers.
  // However, modules can set these properties (for example, to provide an HTML
273
  // debugging page that displays rather than executes Ajax commands).
274
275
276
277
  $types['ajax'] = array(
    '#header' => TRUE,
    '#commands' => array(),
    '#error' => NULL,
278
  );
279
280
  $types['html_tag'] = array(
    '#theme' => 'html_tag',
281
    '#pre_render' => array('drupal_pre_render_conditional_comments'),
282
283
284
    '#attributes' => array(),
    '#value' => NULL,
  );
285
286
287
288
289
290
  $types['styles'] = array(
    '#items' => array(),
    '#pre_render' => array('drupal_pre_render_styles'),
    '#group_callback' => 'drupal_group_css',
    '#aggregate_callback' => 'drupal_aggregate_css',
  );
291
292
293
294
295
296
  $types['scripts'] = array(
    '#items' => array(),
    '#pre_render' => array('drupal_pre_render_scripts'),
    '#group_callback' => 'drupal_group_js',
    '#aggregate_callback' => 'drupal_aggregate_js',
  );
297

298
299
  // Input elements.
  $types['submit'] = array(
300
301
302
303
    '#input' => TRUE,
    '#name' => 'op',
    '#button_type' => 'submit',
    '#executes_submit_callback' => TRUE,
304
    '#limit_validation_errors' => FALSE,
305
    '#process' => array('form_process_button', 'ajax_process_form'),
306
    '#theme_wrappers' => array('button'),
307
  );
308
  $types['button'] = array(
309
310
311
312
    '#input' => TRUE,
    '#name' => 'op',
    '#button_type' => 'submit',
    '#executes_submit_callback' => FALSE,
313
    '#limit_validation_errors' => FALSE,
314
    '#process' => array('form_process_button', 'ajax_process_form'),
315
    '#theme_wrappers' => array('button'),
316
  );
317
  $types['image_button'] = array(
318
319
320
    '#input' => TRUE,
    '#button_type' => 'submit',
    '#executes_submit_callback' => TRUE,
321
    '#limit_validation_errors' => FALSE,
322
    '#process' => array('form_process_button', 'ajax_process_form'),
323
324
325
    '#return_value' => TRUE,
    '#has_garbage_value' => TRUE,
    '#src' => NULL,
326
    '#theme_wrappers' => array('image_button'),
327
  );
328
  $types['textfield'] = array(
329
330
331
332
    '#input' => TRUE,
    '#size' => 60,
    '#maxlength' => 128,
    '#autocomplete_path' => FALSE,
333
    '#process' => array('form_process_autocomplete', 'ajax_process_form', 'form_process_pattern'),
334
    '#theme' => 'textfield',
335
    '#theme_wrappers' => array('form_element'),
336
  );
337
338
339
340
341
  $types['tel'] = array(
    '#input' => TRUE,
    '#size' => 30,
    '#maxlength' => 128,
    '#autocomplete_path' => FALSE,
342
    '#process' => array('form_process_autocomplete', 'ajax_process_form', 'form_process_pattern'),
343
344
345
    '#theme' => 'tel',
    '#theme_wrappers' => array('form_element'),
  );
346
347
348
  $types['email'] = array(
    '#input' => TRUE,
    '#size' => 60,
349
350
    // user.module is not loaded in case of early bootstrap errors.
    '#maxlength' => defined('EMAIL_MAX_LENGTH') ? EMAIL_MAX_LENGTH : 255,
351
    '#autocomplete_path' => FALSE,
352
    '#process' => array('form_process_autocomplete', 'ajax_process_form', 'form_process_pattern'),
353
354
355
356
    '#element_validate' => array('form_validate_email'),
    '#theme' => 'email',
    '#theme_wrappers' => array('form_element'),
  );
357
358
359
360
361
  $types['url'] = array(
    '#input' => TRUE,
    '#size' => 60,
    '#maxlength' => 255,
    '#autocomplete_path' => FALSE,
362
    '#process' => array('form_process_autocomplete', 'ajax_process_form', 'form_process_pattern'),
363
364
365
366
    '#element_validate' => array('form_validate_url'),
    '#theme' => 'url',
    '#theme_wrappers' => array('form_element'),
  );
367
368
369
370
371
  $types['search'] = array(
    '#input' => TRUE,
    '#size' => 60,
    '#maxlength' => 128,
    '#autocomplete_path' => FALSE,
372
    '#process' => array('form_process_autocomplete', 'ajax_process_form'),
373
374
375
    '#theme' => 'search',
    '#theme_wrappers' => array('form_element'),
  );
376
377
378
379
380
381
382
383
  $types['number'] = array(
    '#input' => TRUE,
    '#step' => 1,
    '#process' => array('ajax_process_form'),
    '#element_validate' => array('form_validate_number'),
    '#theme' => 'number',
    '#theme_wrappers' => array('form_element'),
  );
384
385
386
387
388
389
390
391
392
393
  $types['range'] = array(
    '#input' => TRUE,
    '#step' => 1,
    '#min' => 0,
    '#max' => 100,
    '#process' => array('ajax_process_form'),
    '#element_validate' => array('form_validate_number'),
    '#theme' => 'range',
    '#theme_wrappers' => array('form_element'),
  );
394
395
396
397
398
399
400
  $types['color'] = array(
    '#input' => TRUE,
    '#process' => array('ajax_process_form'),
    '#element_validate' => array('form_validate_color'),
    '#theme' => 'color',
    '#theme_wrappers' => array('form_element'),
  );
401
402
403
404
405
406
407
  $types['machine_name'] = array(
    '#input' => TRUE,
    '#default_value' => NULL,
    '#required' => TRUE,
    '#maxlength' => 64,
    '#size' => 60,
    '#autocomplete_path' => FALSE,
408
    '#process' => array('form_process_machine_name', 'form_process_autocomplete', 'ajax_process_form'),
409
410
411
412
    '#element_validate' => array('form_validate_machine_name'),
    '#theme' => 'textfield',
    '#theme_wrappers' => array('form_element'),
  );
413
  $types['password'] = array(
414
415
416
    '#input' => TRUE,
    '#size' => 60,
    '#maxlength' => 128,
417
    '#process' => array('ajax_process_form', 'form_process_pattern'),
418
    '#theme' => 'password',
419
    '#theme_wrappers' => array('form_element'),
420
  );
421
  $types['password_confirm'] = array(
422
    '#input' => TRUE,
423
    '#process' => array('form_process_password_confirm', 'user_form_process_password_confirm'),
424
    '#theme_wrappers' => array('form_element'),
425
  );
426
  $types['textarea'] = array(
427
428
429
    '#input' => TRUE,
    '#cols' => 60,
    '#rows' => 5,
430
    '#resizable' => 'vertical',
431
    '#process' => array('ajax_process_form'),
432
    '#theme' => 'textarea',
433
    '#theme_wrappers' => array('form_element'),
434
  );
435
  $types['radios'] = array(
436
    '#input' => TRUE,
437
    '#process' => array('form_process_radios'),
438
    '#theme_wrappers' => array('radios'),
439
    '#pre_render' => array('form_pre_render_conditional_form_element'),
440
  );
441
  $types['radio'] = array(
442
443
    '#input' => TRUE,
    '#default_value' => NULL,
444
    '#process' => array('ajax_process_form'),
445
    '#theme' => 'radio',
446
    '#theme_wrappers' => array('form_element'),
447
    '#title_display' => 'after',
448
  );
449
  $types['checkboxes'] = array(
450
    '#input' => TRUE,
451
    '#process' => array('form_process_checkboxes'),
452
    '#theme_wrappers' => array('checkboxes'),
453
    '#pre_render' => array('form_pre_render_conditional_form_element'),
454
  );
455
  $types['checkbox'] = array(
456
457
    '#input' => TRUE,
    '#return_value' => 1,
458
    '#theme' => 'checkbox',
459
    '#process' => array('form_process_checkbox', 'ajax_process_form'),
460
    '#theme_wrappers' => array('form_element'),
461
    '#title_display' => 'after',
462
  );
463
  $types['select'] = array(
464
465
    '#input' => TRUE,
    '#multiple' => FALSE,
466
    '#process' => array('form_process_select', 'ajax_process_form'),
467
    '#theme' => 'select',
468
    '#theme_wrappers' => array('form_element'),
469
  );
470
471
472
473
  $types['language_select'] = array(
    '#input' => TRUE,
    '#default_value' => LANGUAGE_NOT_SPECIFIED,
  );
474
  $types['weight'] = array(
475
476
477
    '#input' => TRUE,
    '#delta' => 10,
    '#default_value' => 0,
478
    '#process' => array('form_process_weight', 'ajax_process_form'),
479
  );
480
  $types['date'] = array(
481
482
    '#input' => TRUE,
    '#element_validate' => array('date_validate'),
483
    '#process' => array('form_process_date'),
484
    '#theme' => 'date',
485
    '#theme_wrappers' => array('form_element'),
486
  );
487
  $types['file'] = array(
488
489
    '#input' => TRUE,
    '#size' => 60,
490
    '#theme' => 'file',
491
    '#theme_wrappers' => array('form_element'),
492
  );
493
  $types['tableselect'] = array(
494
495
496
497
498
499
    '#input' => TRUE,
    '#js_select' => TRUE,
    '#multiple' => TRUE,
    '#process' => array('form_process_tableselect'),
    '#options' => array(),
    '#empty' => '',
500
    '#theme' => 'tableselect',
501
  );
502

503
504
  // Form structure.
  $types['item'] = array(
505
    '#markup' => '',
506
    '#pre_render' => array('drupal_pre_render_markup'),
507
    '#theme_wrappers' => array('form_element'),
508
  );
509
  $types['hidden'] = array(
510
    '#input' => TRUE,
511
    '#process' => array('ajax_process_form'),
512
    '#theme' => 'hidden',
513
  );
514
  $types['value'] = array(
515
516
    '#input' => TRUE,
  );
517
  $types['markup'] = array(
518
    '#markup' => '',
519
520
521
522
    '#pre_render' => array('drupal_pre_render_markup'),
  );
  $types['link'] = array(
    '#pre_render' => array('drupal_pre_render_link', 'drupal_pre_render_markup'),
523
  );
524
  $types['fieldset'] = array(
525
526
527
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
    '#value' => NULL,
528
    '#process' => array('form_process_fieldset', 'ajax_process_form'),
529
    '#pre_render' => array('form_pre_render_fieldset'),
530
    '#theme_wrappers' => array('fieldset'),
531
  );
532
  $types['vertical_tabs'] = array(
533
    '#theme_wrappers' => array('vertical_tabs'),
534
535
536
    '#default_tab' => '',
    '#process' => array('form_process_vertical_tabs'),
  );
537
538
539
540
541

  $types['container'] = array(
    '#theme_wrappers' => array('container'),
    '#process' => array('form_process_container'),
  );
542
543
544
545
546
  $types['actions'] = array(
    '#theme_wrappers' => array('container'),
    '#process' => array('form_process_actions', 'form_process_container'),
    '#weight' => 100,
  );
547

548
  $types['token'] = array(
549
    '#input' => TRUE,
550
    '#theme' => 'hidden',
551
552
  );

553
  return $types;
554
555
}

Dries's avatar
   
Dries committed
556
/**
557
 * Implements hook_menu().
Dries's avatar
   
Dries committed
558
 */
559
function system_menu() {
560
  $items['cron/%'] = array(
561
    'title' => 'Run cron',
562
    'page callback' => 'system_cron_page',
563
    'access callback' => 'system_cron_access',
564
    'access arguments' => array(1),
565
566
    'type' => MENU_CALLBACK,
  );
567
  $items['system/files'] = array(
568
    'title' => 'File download',
569
    'page callback' => 'file_download',
570
571
572
573
574
575
576
577
    'page arguments' => array('private'),
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,
  );
  $items['system/temporary'] = array(
    'title' => 'Temporary files',
    'page callback' => 'file_download',
    'page arguments' => array('temporary'),
578
    'access callback' => TRUE,
579
580
    'type' => MENU_CALLBACK,
  );
581
  $items['system/ajax'] = array(
582
    'title' => 'AHAH callback',
583
    'page callback' => 'ajax_form_callback',
584
    'access callback' => TRUE,
585
    'theme callback' => 'ajax_base_page_theme',
586
    'type' => MENU_CALLBACK,
587
    'file path' => 'core/includes',
588
    'file' => 'form.inc',
589
  );
590
591
592
593
594
  $items['system/timezone'] = array(
    'title' => 'Time zone',
    'page callback' => 'system_timezone',
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,
595
    'file' => 'system.admin.inc',
596
  );
597
  $items['admin'] = array(
598
    'title' => 'Administration',
599
    'access arguments' => array('access administration pages'),
600
    'page callback' => 'system_admin_menu_block_page',
601
    'weight' => 9,
602
    'menu_name' => 'management',
603
    'file' => 'system.admin.inc',
604
605
  );
  $items['admin/compact'] = array(
606
    'title' => 'Compact mode',
607
    'page callback' => 'system_admin_compact_page',
608
    'access arguments' => array('access administration pages'),
609
    'type' => MENU_CALLBACK,
610
    'file' => 'system.admin.inc',
611
  );
612
613
  $items['admin/tasks'] = array(
    'title' => 'Tasks',
614
    'type' => MENU_DEFAULT_LOCAL_TASK,
615
    'weight' => -20,
616
  );
617
618
619
  $items['admin/index'] = array(
    'title' => 'Index',
    'page callback' => 'system_admin_index',
620
    'access arguments' => array('access administration pages'),
621
    'type' => MENU_LOCAL_TASK,
622
    'weight' => -18,
623
    'file' => 'system.admin.inc',
624
  );
625

626
  // Menu items that are basically just menu blocks.
627
628
  $items['admin/structure'] = array(
    'title' => 'Structure',
629
    'description' => 'Administer blocks, content types, menus, etc.',
630
    'position' => 'right',
631
    'weight' => -8,
632
    'page callback' => 'system_admin_menu_block_page',
633
    'access arguments' => array('access administration pages'),
634
    'file' => 'system.admin.inc',
635
  );
636
637
638
  // Appearance.
  $items['admin/appearance'] = array(
    'title' => 'Appearance',
639
    'description' => 'Select and configure your themes.',
640
    'page callback' => 'system_themes_page',
641
    'access arguments' => array('administer themes'),
642
    'position' => 'left',
643
    'weight' => -6,
644
    'file' => 'system.admin.inc',
645
  );
646
  $items['admin/appearance/list'] = array(
647
    'title' => 'List',
648
    'description' => 'Select and configure your theme',
649
650
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -1,
651
    'file' => 'system.admin.inc',
652
  );
653
654
655
  $items['admin/appearance/enable'] = array(
    'title' => 'Enable theme',
    'page callback' => 'system_theme_enable',
656
    'access arguments' => array('administer themes'),
657
658
659
660
661
662
    'type' => MENU_CALLBACK,
    'file' => 'system.admin.inc',
  );
  $items['admin/appearance/disable'] = array(
    'title' => 'Disable theme',
    'page callback' => 'system_theme_disable',
663
    'access arguments' => array('administer themes'),
664
665
666
667
668
669
    'type' => MENU_CALLBACK,
    'file' => 'system.admin.inc',
  );
  $items['admin/appearance/default'] = array(
    'title' => 'Set default theme',
    'page callback' => 'system_theme_default',
670
    'access arguments' => array('administer themes'),
671
672
673
    'type' => MENU_CALLBACK,
    'file' => 'system.admin.inc',
  );
674
  $items['admin/appearance/settings'] = array(
675
    'title' => 'Settings',
676
    'description' => 'Configure default and theme specific settings.',
677
    'page callback' => 'drupal_get_form',
678
    'page arguments' => array('system_theme_settings'),
679
    'access arguments' => array('administer themes'),
680
    'type' => MENU_LOCAL_TASK,
681
    'file' => 'system.admin.inc',
682
    'weight' => 20,
683
  );
684
  // Theme configuration subtabs.
685
  $items['admin/appearance/settings/global'] = array(
686
    'title' => 'Global settings',
687
688
689
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -1,
  );
Dries's avatar
   
Dries committed
690

691
  foreach (list_themes() as $key => $theme) {
692
    $items['admin/appearance/settings/' . $theme->name] = array(
693
694
695
696
      'title' => $theme->info['name'],
      'page arguments' => array('system_theme_settings', $theme->name),
      'type' => MENU_LOCAL_TASK,
      'access callback' => '_system_themes_access',
697
      'access arguments' => array($key),
698
      'file' => 'system.admin.inc',
699
    );
Dries's avatar
   
Dries committed
700
  }
drumm's avatar
drumm committed
701

702
  // Modules.
703
  $items['admin/modules'] = array(
704
705
    'title' => 'Extend',
    'description' => 'Add and enable modules to extend site functionality.',
706
707
    'page callback' => 'drupal_get_form',
    'page arguments' => array('system_modules'),
708
    'access arguments' => array('administer modules'),
709
    'file' => 'system.admin.inc',
710
    'weight' => -2,
711
  );
712
  $items['admin/modules/list'] = array(
713
    'title' => 'List',
714
715
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
716
  $items['admin/modules/list/confirm'] = array(
717
    'title' => 'List',
718
    'access arguments' => array('administer modules'),
719
    'type' => MENU_VISIBLE_IN_BREADCRUMB,
720
  );
721
  $items['admin/modules/uninstall'] = array(
722
    'title' => 'Uninstall',
723
    'page arguments' => array('system_modules_uninstall'),
724
    'access arguments' => array('administer modules'),
725
    'type' => MENU_LOCAL_TASK,
726
    'file' => 'system.admin.inc',
727
    'weight' => 20,
728
  );
729
  $items['admin/modules/uninstall/confirm'] = array(
730
    'title' => 'Uninstall',
731
    'access arguments' => array('administer modules'),
732
    'type' => MENU_VISIBLE_IN_BREADCRUMB,
733
734
735
    'file' => 'system.admin.inc',
  );

736
  // Configuration.
737
738
  $items['admin/config'] = array(
    'title' => 'Configuration',
739
    'description' => 'Administer settings.',
740
741
    'page callback' => 'system_admin_config_page',
    'access arguments' => array('access administration pages'),
742
    'file' => 'system.admin.inc',
743
744
  );

745
  // Media settings.
746
  $items['admin/config/media'] = array(
747
748
749
    'title' => 'Media',
    'description' => 'Media tools.',
    'position' => 'left',
750
    'weight' => -10,
751
    'page callback' => 'system_admin_menu_block_page',
752
    'access arguments' => array('access administration pages'),
753
    'file' => 'system.admin.inc',
754
755
  );
  $items['admin/config/media/file-system'] = array(
756
    'title' => 'File system',