Index: system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system.module,v retrieving revision 1.138 diff -u -r1.138 system.module --- system.module 1 May 2004 09:14:49 -0000 1.138 +++ system.module 21 Jun 2004 19:45:42 -0000 @@ -75,9 +75,15 @@ } } menu('admin/system/help', t('help'), $access ? 'system_help_page' : MENU_DENIED, 9); + // menu('admin/system/phpinfo', t('phpinfo'), $access ? 'system_phpinfo' : MENU_DENIED, 10); + menu('admin/system/phpinfo', t('phpinfo'), 'system_phpinfo', 10); } } +function system_phpinfo() { + print phpinfo(); +} + function system_user($type, $edit, &$user) { if ($type == 'form') { $options = "\n"; @@ -89,18 +95,78 @@ } if (!variable_get("sitewide_timezone", 0)) { - $timestamp = time(); - $zonelist = array(-11, -10, -9.5, -9, -8, -7, -6, -5, -4, -3.5, -3, -2, -1, 0, 1, 2, 3, 3.5, 4, 5, 5.5, 5.75, 6, 6.5, 7, 8, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.75, 13, 14); - foreach ($zonelist as $offset) { - $zone = $offset * 3600; - $zones[$zone] = format_date($timestamp, 'custom', variable_get('date_format_long', 'l, F j, Y - H:i') . ' O', $zone); - } - $data[t('Locale settings')] = form_select(t("Time zone"), "timezone", $edit["timezone"], $zones, t("Select what time you currently have and your time zone settings will be set appropriate.")); + // use the site default as the user default + $sel_tz = $edit["timezone"] ? $edit["timezone"] : variable_get('date_default_timezone', 0); + $data[t('Locale settings')] = theme('select_timezone', t("Time zone"), 'timezone', $sel_tz, t("Select what time you currently have and your time zone settings will be set appropriately.")); } return $data; } } +/** +Return html for selecting a timezone, with $timezone being the current value. +If $timezone is NULL, it defaults to the user's timezone, or 0 if that isn't set either. +*/ + +function theme_select_timezone($label, $var, $timezone = NULL, $help = '', $style = 'timed') { + if ($timezone === NULL) { + global $user; + $timezone = $user && $user->timezone ? $user->timezone : 0; + } + $zones = $style == 'timed' ? _theme_timed_timezones() : _theme_labeled_timezones(); + return form_select($label, $var, $timezone, $zones, $help); +} + +define(_TZ_SECS, 3600); + +/** +Return timezone choices based on what time it is now. +*/ +function _theme_timed_timezones() { + $timestamp = time(); + $zonelist = array(-11, -10, -9.5, -9, -8, -7, -6, -5, -4, -3.5, -3, -2, -1, 0, 1, 2, 3, 3.5, 4, 5, 5.5, 5.75, 6, 6.5, 7, 8, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.75, 13, 14); + foreach ($zonelist as $offset) { + $zone = $offset * _TZ_SECS; + $zones[$zone] = format_date($timestamp, 'custom', variable_get('date_format_long', 'l, F j, Y - H:i') . ' O', $zone); + } + return $zones; +} + +/** +Return timezone choices as timezone labels. +*/ +function _theme_labeled_timezones() { + return array( + +12 *_TZ_SECS => '+1200=IDLE=NZST=NZT=Y', + +11 *_TZ_SECS => '+1100=X', + +10 *_TZ_SECS => '+1000=EAST=GST=USSRZone9=W', + +9 *_TZ_SECS => '+0900=JST=USSRZone8=V', + +8 *_TZ_SECS => '+0800=CCT=USSRZone7=U', + +7 *_TZ_SECS => '+0700=WAST=USSRZone6=T', + +6 *_TZ_SECS => '+0600=USSRZone5=ZP6=S', + +5 *_TZ_SECS => '+0500=USSRZone4=ZP5=R', + +4 *_TZ_SECS => '+0400=USSRZone3=ZP4=Q', + +3 *_TZ_SECS => '+0300=BT=USSRZone2=P', + +2 *_TZ_SECS => '+0200=EET=USSRZone1=O', + +1 *_TZ_SECS => '+0100=CET=FWT=MET=MEWT=SWT=N', + 0 *_TZ_SECS => '+0000=GMT=UTC=WET=Z', + -1 *_TZ_SECS => '-0100=WAT=A', + -2 *_TZ_SECS => '-0200=AT=B', + -3 *_TZ_SECS => '-0300=C', + -3.5 *_TZ_SECS => '-0330=NST', + -4 *_TZ_SECS => '-0400=AST=EDT=D', + -5 *_TZ_SECS => '-0500=EST=CDT=E', + -6 *_TZ_SECS => '-0600=CST=MDT=F', + -7 *_TZ_SECS => '-0700=MST=PDT=G', + -8 *_TZ_SECS => '-0800=PST=YDT=H', + -9 *_TZ_SECS => '-0900=YST=HDT=I', + -10 *_TZ_SECS => '-1000=AHST=CAT=HST=K', + -11 *_TZ_SECS => '-1100=NT=L', + -12 *_TZ_SECS => '-1200=IDLW=M' + ); +} + + function system_view_general() { global $conf; @@ -112,6 +178,9 @@ $group .= form_textarea(t("Footer message"), "site_footer", variable_get("site_footer", ""), 70, 5, t("This text will be displayed at the bottom of each page. Useful for adding a copyright notice to your pages.")); $group .= form_textfield(t("Anonymous user"), "anonymous", variable_get("anonymous", "Anonymous"), 70, 70, t("The name used to indicate anonymous users.")); $group .= form_textfield(t("Default front page"), "site_frontpage", variable_get("site_frontpage", "node"), 70, 70, t("The home page displays content from this relative URL. If you are not using clean URLs, specify the part after '?q='. If unsure, specify 'node'.")); + $group .= form_textfield(t("Alternate front page"), "site_frontpage_alt", variable_get("site_frontpage_alt", ''), 70, 70, t("An alternate home page, which should receive similar styling'.")); + $group .= form_textarea(t('extra head'), 'site_extra_head', variable_get('site_extra_head', ''), 70, 5, t('Extra head contents.')); + $group .= form_textfield(t("Default 403 (access denied) page"), "site_403", variable_get("site_403", ""), 70, 70, t("This page is displayed when the requested document is denied to the current user. If you are not using clean URLs, specify the part after '?q='. If unsure, specify nothing.")); $group .= form_textfield(t("Default 404 (not found) page"), "site_404", variable_get("site_404", ""), 70, 70, t("This page is displayed when no other content matches the requested document. If you are not using clean URLs, specify the part after '?q='. If unsure, specify nothing.")); $group .= form_radios(t("Clean URLs"), "clean_url", variable_get("clean_url", 0), array(t("Disabled"), t("Enabled")), t("Enable or disable clean URLs. If enabled, you'll need ModRewrite support. See also the .htaccess file in Drupal's top-level directory.")); @@ -135,20 +204,12 @@ $group .= form_radios(t('Download method'), 'file_downloads', variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC), array(FILE_DOWNLOADS_PUBLIC => t('Public - files are available using http directly.'), FILE_DOWNLOADS_PRIVATE => t('Private - files are be transferred by Drupal.')), t('This setting can be changed at any time, however, all download URLs will change and there may be unexpected problems so it is not recommended.')); $output .= form_group(t('File system'), $group); - // date settings: - $timestamp = time(); - $zonelist = array(-11, -10, -9.5, -9, -8, -7, -6, -5, -4, -3.5, -3, -2, -1, 0, 1, 2, 3, 3.5, 4, 5, 5.5, 5.75, 6, 6.5, 7, 8, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.75, 13, 14); - foreach ($zonelist as $offset) { - $zone = $offset * 3600; - $zones[$zone] = format_date($timestamp, 'custom', variable_get('date_format_long', 'l, F j, Y - H:i') . ' O', $zone); - } - // date settings: possible date formats $dateshort = array("m/d/Y - H:i", "d/m/Y - H:i", "Y/m/d - H:i", "m/d/Y - g:ia", "d/m/Y - g:ia", "Y/m/d - g:ia", "M j Y - H:i", "j M Y - H:i", "Y M j - H:i", "M j Y - g:ia", "j M Y - g:ia", "Y M j - g:ia"); - $datemedium = array("D, m/d/Y - H:i", "D, d/m/Y - H:i", "D, Y/m/d - H:i", + $datemedium = array("D, m/d/Y - H:i O", "D, d/m/Y - H:i", "D, Y/m/d - H:i", "F j, Y - H:i", "j F, Y - H:i", "Y, F j - H:i", "D, m/d/Y - g:ia", "D, d/m/Y - g:ia", "D, Y/m/d - g:ia", "F j, Y - g:ia", "j F, Y - g:ia", "Y, F j - g:ia"); @@ -166,7 +227,7 @@ $datelongchoices[$f] = format_date(time(), "custom", $f); } - $group = form_select(t("Time zone"), "date_default_timezone", variable_get('date_default_timezone', 0), $zones, t("Select the default site timezone.")); + $group = theme('select_timezone', t("Time zone"), 'date_default_timezone', variable_get('date_default_timezone', 0), t("Select the default site timezone.")); $group .= form_radios(t("Use sitewide timezone"), "sitewide_timezone", variable_get("sitewide_timezone", 0), array(t("Disabled"), t("Enabled")), t("Enable or disable the sidewide timezone feature. Disabled means that users could choose their own timezone.")); $group .= form_select(t("Date format (short)"), "date_format_short", variable_get("date_format_short", $dateshort[0]), $dateshortchoices, t("The short format of date display.")); $group .= form_select(t("Date format (medium)"), "date_format_medium", variable_get("date_format_medium", $datemedium[0]), $datemediumchoices, t("The medium sized date display.")); @@ -264,8 +325,11 @@ foreach ($files as $filename => $file) { include_once($filename); if ($type == "module") { - $info->name = module_invoke($file->name, "help", "admin/system/modules#name") ? module_invoke($file->name, "help", "admin/system/modules#name") : module_invoke($file->name, "system", "name") ? module_invoke($file->name, "system", "name") : $file->name; - $info->description = module_invoke($file->name, "help", "admin/system/modules#description") ? module_invoke($file->name, "help", "admin/system/modules#description") : module_invoke($file->name, "system", "description"); + $hname = module_invoke($file->name, "help", "admin/system/modules#name"); + $sname = module_invoke($file->name, "system", "name"); + $info->name = $hname ? $hname : ($sname ? $sname : $file->name); + $hdesc = module_invoke($file->name, "help", "admin/system/modules#description"); + $info->description = $hdesc ? $hdesc : module_invoke($file->name, "system", "description"); // log the critical hooks implemented by this module $bootstrap = 0; foreach (bootstrap_hooks() as $hook) {