diff options
Diffstat (limited to 'modules/system/system.admin.inc')
-rw-r--r-- | modules/system/system.admin.inc | 64 |
1 files changed, 42 insertions, 22 deletions
diff --git a/modules/system/system.admin.inc b/modules/system/system.admin.inc index 7ed232a54..e9682e7dd 100644 --- a/modules/system/system.admin.inc +++ b/modules/system/system.admin.inc @@ -106,7 +106,15 @@ function system_admin_index() { } /** - * Menu callback; displays a module's settings page. + * Displays the configuration overview page. + * + * This menu callback implementation is a legacy function that used to display + * the configuration overview page at admin/config. It is currently unused and + * will be removed in Drupal 8. The page at admin/config is now generated by + * system_admin_config_page(). + * + * @deprecated + * @see system_admin_config_page() */ function system_settings_overview() { // Check database setup if necessary @@ -470,17 +478,11 @@ function system_theme_settings($form, &$form_state, $key = '') { ), ), ); - $logo_path = theme_get_setting('logo_path', $key); - // If $logo_path is a public:// URI, display the path relative to the files - // directory; stream wrappers are not end-user friendly. - if (file_uri_scheme($logo_path) == 'public') { - $logo_path = file_uri_target($logo_path); - } $form['logo']['settings']['logo_path'] = array( '#type' => 'textfield', '#title' => t('Path to custom logo'), - '#default_value' => $logo_path, '#description' => t('The path to the file you would like to use as your logo file instead of the default logo.'), + '#default_value' => theme_get_setting('logo_path', $key), ); $form['logo']['settings']['logo_upload'] = array( '#type' => 'file', @@ -511,17 +513,11 @@ function system_theme_settings($form, &$form_state, $key = '') { ), ), ); - $favicon_path = theme_get_setting('favicon_path', $key); - // If $favicon_path is a public:// URI, display the path relative to the - // files directory; stream wrappers are not end-user friendly. - if (file_uri_scheme($favicon_path) == 'public') { - $favicon_path = file_uri_target($favicon_path); - } $form['favicon']['settings']['favicon_path'] = array( '#type' => 'textfield', '#title' => t('Path to custom icon'), - '#default_value' => $favicon_path, - '#description' => t('The path to the image file you would like to use as your custom shortcut icon.') + '#description' => t('The path to the image file you would like to use as your custom shortcut icon.'), + '#default_value' => theme_get_setting('favicon_path', $key), ); $form['favicon']['settings']['favicon_upload'] = array( '#type' => 'file', @@ -530,6 +526,22 @@ function system_theme_settings($form, &$form_state, $key = '') { ); } + // Inject human-friendly values for logo and favicon. + foreach (array('logo' => 'logo.png', 'favicon' => 'favicon.ico') as $type => $default) { + if (isset($form[$type]['settings'][$type . '_path'])) { + $element = &$form[$type]['settings'][$type . '_path']; + + // If path is a public:// URI, display the path relative to the files + // directory; stream wrappers are not end-user friendly. + $original_path = $element['#default_value']; + $friendly_path = NULL; + if (file_uri_scheme($original_path) == 'public') { + $friendly_path = file_uri_target($original_path); + $element['#default_value'] = $friendly_path; + } + } + } + if ($key) { // Call engine-specific settings. $function = $themes[$key]->prefix . '_engine_settings'; @@ -657,13 +669,20 @@ function system_theme_settings_validate($form, &$form_state) { * the path could not be validated. */ function _system_theme_settings_validate_path($path) { - if (drupal_realpath($path)) { - // The path is relative to the Drupal root, or is a valid URI. + // Absolute local file paths are invalid. + if (drupal_realpath($path) == $path) { + return FALSE; + } + // A path relative to the Drupal root or a fully qualified URI is valid. + if (is_file($path)) { return $path; } - $uri = 'public://' . $path; - if (file_exists($uri)) { - return $uri; + // Prepend 'public://' for relative file paths within public filesystem. + if (file_uri_scheme($path) === FALSE) { + $path = 'public://' . $path; + } + if (is_file($path)) { + return $path; } return FALSE; } @@ -1370,6 +1389,7 @@ function system_ip_blocking($default_ip = '') { '#theme' => 'table', '#header' => $header, '#rows' => $rows, + '#empty' => t('No blocked IP addresses available.'), ); return $build; @@ -1766,7 +1786,7 @@ function system_file_system_settings() { '#title' => t('Private file system path'), '#default_value' => variable_get('file_private_path', ''), '#maxlength' => 255, - '#description' => t('An existing local file system path for storing private files. It should be writable by Drupal and not accessible over the web. See the online handbook for <a href="@handbook">more information about securing private files</a>.', array('@handbook' => 'http://drupal.org/handbook/modules/file')), + '#description' => t('An existing local file system path for storing private files. It should be writable by Drupal and not accessible over the web. See the online handbook for <a href="@handbook">more information about securing private files</a>.', array('@handbook' => 'http://drupal.org/documentation/modules/file')), '#after_build' => array('system_check_directory'), ); |