<?php
/**
* options_display.php
*
* Displays all optinos about display preferences
*
* @copyright 1999-2020 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id: display.php 14840 2020年01月07日 07:42:38Z pdontthink $
* @package squirrelmail
*/
/** Define the group constants for the display options page. */
define ('SMOPT_GRP_GENERAL', 0);
define ('SMOPT_GRP_MAILBOX', 1);
define ('SMOPT_GRP_MESSAGE', 2);
/**
* This function builds an array with all the information about
* the options available to the user, and returns it. The options
* are grouped by the groups in which they are displayed.
* For each option, the following information is stored:
* - name: the internal (variable) name
* - caption: the description of the option in the UI
* - type: one of SMOPT_TYPE_*
* - refresh: one of SMOPT_REFRESH_*
* - size: one of SMOPT_SIZE_*
* - save: the name of a function to call when saving this option
* @return array all option information
*/
$optmode;
/* Build a simple array into which we will build options. */
$optgrps = array();
$optvals = array();
/******************************************************/
/* LOAD EACH GROUP OF OPTIONS INTO THE OPTIONS ARRAY. */
/******************************************************/
/*** Load the General Options into the array ***/
/* Load the theme option. */
$theme_values = array();
foreach ($theme as $theme_key => $theme_attributes) {
$theme_values[$theme_attributes['NAME']] = $theme_attributes['PATH'];
}
'name' => 'chosen_theme',
'caption' =>
_ ("Theme"),
'posvals' => $theme_values,
'save' => 'save_option_theme'
);
$css_values =
array( 'none' =>
_ ("Default" ) );
while ($file =
readdir ($handle) ) {
if ( substr ( $file, -
4 ) ==
'.css' ) {
$css_values[$file] =
substr ( $file, 0, strlen ( $file ) -
4 );
}
}
}
if ( count ( $css_values ) >
1 ) {
'name' => 'custom_css',
'caption' =>
_ ("Custom Stylesheet"),
'posvals' => $css_values
);
}
$language_values = array();
foreach ($languages as $lang_key => $lang_attributes) {
if (isset($lang_attributes['NAME'])) {
$language_values[$lang_key] = $lang_attributes['NAME'];
}
}
asort ($language_values);
$language_values =
$language = $squirrelmail_language;
'name' => 'language',
'caption' =>
_ ("Language"),
'posvals' => $language_values,
'htmlencoded' => true
);
/* Set values for the "use javascript" option. */
'name' => 'javascript_setting',
'caption' =>
_ ("Use Javascript"),
);
if ($optmode != 'submit')
// FIXME: our form is named "f" - why? let's use something better
$onLoadScript =
'document.f.new_js_autodetect_results.value = \'' .
SMPREF_JS_ON .
'\'';
else
$onLoadScript = '';
'name' => 'js_autodetect_results',
'caption' => '',
//'post_script' => $js_autodetect_script,
'save' => 'save_option_javascript_autodetect'
);
/*** Load the General Options into the array ***/
'name' => 'show_num',
'caption' =>
_ ("Number of Messages per Page"),
);
'name' => 'alt_index_colors',
'caption' =>
_ ("Enable Alternating Row Colors"),
);
'name' => 'page_selector',
'caption' =>
_ ("Enable Page Selector"),
);
'name' => 'page_selector_max',
'caption' =>
_ ("Maximum Number of Pages to Show"),
);
'name' => 'show_full_date',
'caption' =>
_ ("Always Show Full Date"),
);
'name' => 'truncate_sender',
'caption' =>
_ ("Length of From/To Field (0 for full)"),
'initial_value' => 55
);
'name' => 'truncate_subject',
'caption' =>
_ ("Length of Subject Field (0 for full)"),
'initial_value' => 55
);
/*** Load the General Options into the array ***/
'name' => 'wrap_at',
'caption' =>
_ ("Wrap Incoming Text At"),
);
'name' => 'editor_size',
'caption' =>
_ ("Width of Editor Window"),
);
'name' => 'editor_height',
'caption' =>
_ ("Height of Editor Window"),
);
'name' => 'location_of_buttons',
'caption' =>
_ ("Location of Buttons when Composing"),
);
'name' => 'use_javascript_addr_book',
'caption' =>
_ ("Address Book Display Format"),
'posvals' =>
array('1' =>
_ ("Javascript"),
);
'name' => 'addrsrch_fullname',
'caption' =>
_ ("Format of Addresses Added From Address Book"),
'posvals' =>
array('noprefix' =>
_ ("No prefix/Address only"),
'nickname' =>
_ ("Nickname and address"),
'fullname' =>
_ ("Full name and address"))
);
'name' => 'show_html_default',
'caption' =>
_ ("Show HTML Version by Default"),
);
'name' => 'enable_forward_as_attachment',
'caption' =>
_ ("Enable Forward as Attachment"),
);
'name' => 'do_not_reply_to_self',
'caption' =>
_ ("Send Replies To My Own Messages To Previous Recipient"),
);
'name' => 'include_self_reply_all',
'caption' =>
_ ("Include Me in CC when I Reply All"),
);
'name' => 'return_to_message_after_reply',
'caption' =>
_ ("Return to Original Message After Replying"),
);
'name' => 'show_xmailer_default',
'caption' =>
_ ("Enable Mailer Display"),
);
'name' => 'attachment_common_show_images',
'caption' =>
_ ("Display Attached Images with Message"),
);
'name' => 'pf_cleandisplay',
'caption' =>
_ ("Enable Printer Friendly Clean Display"),
);
if ($default_use_mdn) {
'name' => 'mdn_user_support',
'caption' =>
_ ("Enable Mail Delivery Notification"),
);
}
'name' => 'compose_new_win',
'caption' =>
_ ("Compose Messages in New Window"),
);
'name' => 'compose_width',
'caption' =>
_ ("Width of Compose Window"),
);
'name' => 'compose_height',
'caption' =>
_ ("Height of Compose Window"),
);
'name' => 'sig_first',
'caption' =>
_ ("Prepend Signature before Reply/Forward Text"),
);
'name' => 'strip_sigs',
'caption' =>
_ ("Strip signature when replying"),
);
'name' => 'body_quote',
'caption' =>
_ ("Prefix for Original Message when Replying"),
'save' => 'save_option_reply_prefix'
);
'name' => 'reply_focus',
'caption' =>
_ ("Cursor Position when Replying"),
'posvals' =>
array('' =>
_ ("To: field"),
'focus' =>
_ ("Focus in body"),
'select' =>
_ ("Select body"),
'none' =>
_ ("No focus"))
);
'name' => 'internal_date_sort',
'caption' =>
_ ("Sort by Received Date"),
);
if ($allow_thread_sort == TRUE) {
'name' => 'sort_by_ref',
'caption' =>
_ ("Enable Thread Sort by References Header"),
);
}
/* Assemble all this together and return it as our result. */
$result = array(
'grps' => $optgrps,
'vals' => $optvals,
'xtra' => $onLoadScript
);
return ($result);
}
/******************************************************************/
/** Define any specialized save functions for this option page. ***/
/******************************************************************/
/**
* This function saves a new theme setting.
* It updates the theme array.
*/
/* Do checking to make sure $new_theme is in the array. */
$theme_in_array = false;
for ($i =
0; $i <
count ($theme); ++
$i) {
if ($theme[$i]['PATH'] == $option->new_value) {
$theme_in_array = true;
break;
}
}
if (!$theme_in_array) {
$option->new_value = '';
}
/* Save the option like normal. */
}
/**
* This function saves the javascript detection option.
*/
sqGetGlobalVar('new_javascript_setting', $new_javascript_setting);
// Set javascript either on or off.
} else {
}
} else {
setPref ($data_dir, $username, 'javascript_on', $new_javascript_setting);
}
}
global $data_dir , $username, $new_javascript_setting;
// save as "NONE" if it was blanked out
//
if (empty($option->new_value)) $option->new_value = 'NONE';
// Save the option like normal.
//
}