(#915527).
- Remove code related to non-UID-supporting IMAP servers.
- Fix quoteimap() regex escaping problem (#921291).
+ - Added option to suppress Received: line in outbound SM headers (#847107)
+ - Changed read_body header from links to buttons (looks like message index)
- Add functions for building HTML forms (functions/forms.php).
+ - Moved javascript_on to session (from prefs). Centralized javascript detection
+ in prefs.php method checkForJavascript.
Version 1.5.0
--------------------
$offset = strlen($results) - 1;
}
$results .= $read;
+#sm_print_r("Trace from line " . __LINE__, $results);
}
return $results;
}
} else {
$results .= $sRead;
}
+#sm_print_r("Trace from line " . __LINE__, $results);
}
return $results;
}
// display flag buttons only if supported
if ($show_flag_buttons && $mbxresponse != NULL &&
strpos($mbxresponse['PERMANENTFLAGS'], '\Flagged') !== FALSE) {
- echo getButton('SUBMIT', 'markUnflagged',_("Un"));
+ echo getButton('SUBMIT', 'markUnflagged',_("Unflag"));
echo getButton('SUBMIT', 'markFlagged',_("Flag"));
echo ' ';
}
- echo getButton('SUBMIT', 'markUnread',_("Un"));
+ echo getButton('SUBMIT', 'markUnread',_("Unread"));
echo getButton('SUBMIT', 'markRead',_("Read"));
echo ' ';
echo ' </SELECT></TT> ';
}
-function getButton($type, $name, $value, $enabled = TRUE) {
+function getButton($type, $name, $value, $js = '', $enabled = TRUE) {
$disabled = ( $enabled ? '' : 'disabled ' );
- return '<INPUT '.$disabled.
+ $js = ( $js ? $js.' ' : '' );
+ return '<INPUT '.$disabled.$js.
'TYPE="'.$type.
'" NAME="'.$name.
'" VALUE="'.$value .
}
if ($session) {
- $compose_uri = $base_uri.'src/compose.php?mailbox='.urlencode($mailbox).'&attachedmessages=true&session='."$session";
+ $compose_uri = $base_uri.'src/compose.php?mailbox='.urlencode($mailbox).'&attachedmessages=true&session='."$session";
} else {
$compose_uri = $base_uri.'src/compose.php?newmessage=1';
- $session = 0;
+ $session = 0;
}
if($javascript_on) {
if (!preg_match("/^[0-9]{3,4}$/", $compose_height)) {
$compose_height = '550';
}
- $js .= "function comp_in_new(comp_uri) {\n".
- " if (!comp_uri) {\n".
- ' comp_uri = "'.$compose_uri."\";\n".
- ' }'. "\n".
- ' var newwin = window.open(comp_uri' .
- ', "_blank",'.
- '"width='.$compose_width. ',height='.$compose_height.
- ',scrollbars=yes,resizable=yes");'."\n".
- "}\n\n";
+ $js .= "function comp_in_new_form(comp_uri, button, myform) {\n".
+ ' if (!comp_uri) {'."\n".
+ ' comp_uri = "'.$compose_uri."\";\n".
+ ' }'. "\n".
+ ' comp_uri += "&" + button.name + "=1";'."\n".
+ ' for ( var i=0; i < myform.elements.length; i++ ) {'."\n".
+ ' if ( myform.elements[i].type == "checkbox" && myform.elements[i].checked )'."\n".
+ ' comp_uri += "&" + myform.elements[i].name + "=1";'."\n".
+ ' }'."\n".
+ ' var newwin = window.open(comp_uri' .
+ ', "_blank",'.
+ '"width='.$compose_width. ',height='.$compose_height.
+ ',scrollbars=yes,resizable=yes");'."\n".
+ "}\n\n";
}
// javascript for sending read receipts
$js .= 'function sendMDN() {'."\n".
" mdnuri=window.location+'&sendreceipt=1'; ".
"var newwin = window.open(mdnuri,'right');".
- "\n}\n\n";
+ "\n}\n\n";
}
// if any of the above passes, add the JS tags too.
"document.forms[i-1].elements[pos].focus();\n".
"}\n".
"}\n";
-
+
$js .= "// -->\n".
- "</script>\n";
+ "</script>\n";
$onload = 'onload="checkForm();"';
displayHtmlHeader ('SquirrelMail', $js);
break;
"if( pos >= 0 ) {\n".
"document.forms[i-1].elements[pos].focus();\n".
"}\n".
- "$xtra\n".
+ "$xtra\n".
"}\n";
-
+
if ($compose_new_win == '1') {
if (!preg_match("/^[0-9]{3,4}$/", $compose_width)) {
$compose_width = '640';
$compose_height = '550';
}
$js .= "function comp_in_new(comp_uri) {\n".
- " if (!comp_uri) {\n".
- ' comp_uri = "'.$compose_uri."\";\n".
- ' }'. "\n".
+ " if (!comp_uri) {\n".
+ ' comp_uri = "'.$compose_uri."\";\n".
+ ' }'. "\n".
' var newwin = window.open(comp_uri' .
', "_blank",'.
'"width='.$compose_width. ',height='.$compose_height.
}
$js .= "// -->\n". "</script>\n";
-
+
$onload = 'onload="checkForm();"';
displayHtmlHeader ('SquirrelMail', $js);
break;
"}\n".
"}\n";
$js .= "// -->\n".
- "</script>\n";
+ "</script>\n";
$onload = 'onload="checkForm();"';
displayHtmlHeader (_("Compose"), $js);
break;
return ($hash_dirs);
}
+function checkForJavascript()
+{
+ global $data_dir, $username, $javascript_on;
+ if ( sqGetGlobalVar('javascript_on', $javascript_on) )
+ return;
+
+ if ( !sqGetGlobalVar('js_autodetect_results', $js_autodetect_results) )
+ $js_autodetect_results = SMPREF_JS_OFF;
+
+ $javascript_setting = getPref($data_dir, $username, 'javascript_setting', SMPREF_JS_AUTODETECT);
+
+ if ( $javascript_setting == SMPREF_JS_AUTODETECT )
+ $js_pref = $js_autodetect_results;
+ else
+ $js_pref = $javascript_setting;
+
+ sqsession_register('javascript_on',$js_pref);
+ return $js_pref;
+}
+
?>
// show (or not) flag and unflag buttons on mailbox list screen
$show_flag_buttons = getPref($data_dir, $username, 'show_flag_buttons', SMPREF_OFF );
-$use_javascript_addr_book = getPref($data_dir, $username, 'use_javascript_addr_book', $default_use_javascript_addr_book);
-
/* Load the user's special folder preferences */
$move_to_sent =
getPref($data_dir, $username, 'move_to_sent', $default_move_to_sent);
getPref($data_dir, $username, 'alt_index_colors', SMPREF_ON );
/* Folder List Display Format */
-$use_javascript_folder_list = getPref($data_dir, $username, 'use_javascript_folder_list');
$location_of_bar =
getPref($data_dir, $username, 'location_of_bar', SMPREF_LOC_LEFT);
$location_of_buttons =
$sort_by_ref = getPref($data_dir, $username, 'sort_by_ref', 1);
/* Load the javascript settings. */
-$javascript_setting =
- getPref($data_dir, $username, 'javascript_setting', SMPREF_JS_AUTODETECT);
-$javascript_on = getPref($data_dir, $username, 'javascript_on', SMPREF_ON);
-
+if ( checkForJavascript() )
+{
+ $use_javascript_folder_list = getPref($data_dir, $username, 'use_javascript_folder_list');
+ $use_javascript_addr_book = getPref($data_dir, $username, 'use_javascript_addr_book', $default_use_javascript_addr_book);
+} else {
+ $use_javascript_folder_list = false;
+ $use_javascript_addr_book = false;
+}
$search_memory = getPref($data_dir, $username, 'search_memory', 0);
function save_option_javascript_autodetect($option) {
global $data_dir, $username, $new_javascript_setting;
- /* Set javascript either on or off. */
- if ($new_javascript_setting == SMPREF_JS_AUTODETECT) {
- if ($option->new_value == SMPREF_JS_ON) {
- setPref($data_dir, $username, 'javascript_on', SMPREF_JS_ON);
- } else {
- setPref($data_dir, $username, 'javascript_on', SMPREF_JS_OFF);
- }
- } else {
- setPref($data_dir, $username, 'javascript_on', $new_javascript_setting);
- }
+ setPref($data_dir, $username, 'javascript_setting', $new_javascript_setting);
+ checkForJavascript();
}
/**
if ( sqgetGlobalVar('smaction_reply_all',$tmp) ) $action = 'reply_all';
if ( sqgetGlobalVar('smaction_forward',$tmp) ) $action = 'forward';
if ( sqgetGlobalVar('smaction_attache',$tmp) ) $action = 'forward_as_attachment';
+ if ( sqgetGlobalVar('smaction_draft',$tmp) ) $action = 'draft';
+ if ( sqgetGlobalVar('smaction_edit_new',$tmp) ) $action = 'edit_as_new';
}
/* Location (For HTTP 1.1 Header("Location: ...") redirects) */
global $base_uri, $draft_folder, $where, $what, $color, $sort,
$startMessage, $PHP_SELF, $save_as_draft,
$enable_forward_as_attachment, $imapConnection, $lastTargetMailbox,
- $data_dir, $username, $delete_prev_next_display;
+ $data_dir, $username, $delete_prev_next_display,
+ $compose_new_win, $javascript_on;
$topbar_delimiter = ' | ';
$double_delimiter = ' ';
// BEGIN MENU ROW - DELETE/REPLY/FORWARD/MOVE/etc.
$menu_row = '<tr bgcolor="'.$color[9].'"><td><small>';
-
- // Start form for reply/reply all/forward..
$comp_uri = $base_uri.'src/compose.php' .
'?passed_id=' . $passed_id .
'&mailbox=' . $urlMailbox .
'&startMessage=' . $startMessage .
(isset($passed_ent_id) ? '&passed_ent_id='.$passed_ent_id : '');
- $menu_row .= '<form action="'.$comp_uri.'" method="post"><small>';
+
+ // Start form for reply/reply all/forward..
+ $target = '';
+ $on_click='';
+ $method='method="get" ';
+ if ($compose_new_win == '1') {
+ if ( $javascript_on ) {
+ $on_click=' onclick="comp_in_new_form(\''.$comp_uri.'\', this, this.form)"';
+ $comp_uri = 'javascript:void(0)';
+ } else {
+ $target = 'target="_blank"';
+ $method='method="post" ';
+ }
+ }
+
+ $menu_row .= "\n".'<form name="composeForm" action="'.$comp_uri.'" '.$method.$target.'><small>'."\n";
// If Draft folder - create Resume link
if (($mailbox == $draft_folder) && ($save_as_draft)) {
- $new_button = 'draft';
+ $new_button = 'smaction_draft';
$comp_alt_string = _("Resume Draft");
} else if (handleAsSent($mailbox)) {
// If in Sent folder, edit as new
- $new_button = 'edit_as_new';
+ $new_button = 'smaction_edit_new';
$comp_alt_string = _("Edit Message as New");
}
// Show Alt URI for Draft/Sent
if (isset($comp_alt_string))
- $menu_row .= getButton('SUBMIT', $new_button, $comp_alt_string) . "\n";
-
- $menu_row .= getButton('SUBMIT', 'smaction_reply', _("Reply"));
- $menu_row .= ' '.getButton('SUBMIT', 'smaction_reply_all', _("Reply All"));
- $menu_row .= ' '.getButton('SUBMIT', 'smaction_forward', _("Forward"));
+ $menu_row .= getButton('SUBMIT', $new_button, $comp_alt_string, $on_click) . "\n";
+ $menu_row .= getButton('SUBMIT', 'smaction_reply', _("Reply"), $on_click) . "\n";
+ $menu_row .= getButton('SUBMIT', 'smaction_reply_all', _("Reply All"), $on_click) ."\n";
+ $menu_row .= getButton('SUBMIT', 'smaction_forward', _("Forward"), $on_click);
if ($enable_forward_as_attachment)
- $menu_row .= '<input type="checkbox" name="smaction_attache">' . _("Attachment");
+ $menu_row .= '<input type="checkbox" name="smaction_attache">' . _("Attachment") ."\n";
- $menu_row .= '</form>'.' ';
+ $menu_row .= '</form>'.' '."\n";
// Form for deletion
$delete_url = $base_uri . 'src/delete_message.php?mailbox=' . $urlMailbox;
$menu_row .= '<input type="checkbox" name="bypass_trash">' . _("Bypass Trash");
}
else
- $menu_row .= getButton('SUBMIT', 'delete', _("Delete"), FALSE) . "\n"; // delete button is disabled
+ $menu_row .= getButton('SUBMIT', 'delete', _("Delete"), '', FALSE) . "\n"; // delete button is disabled
$menu_row .= '</form>' . "\n";
/* get globals we me need */
sqGetGlobalVar('login_username', $login_username);
sqGetGlobalVar('secretkey', $secretkey);
-sqGetGlobalVar('js_autodetect_results', $js_autodetect_results);
if(!sqGetGlobalVar('squirrelmail_language', $squirrelmail_language) || $squirrelmail_language == '') {
$squirrelmail_language = $squirrelmail_default_language;
}
}
/* Complete autodetection of Javascript. */
-$javascript_setting = getPref
- ($data_dir, $username, 'javascript_setting', SMPREF_JS_AUTODETECT);
-$js_autodetect_results = (isset($js_autodetect_results) ?
- $js_autodetect_results : SMPREF_JS_OFF);
-/* See if it's set to "Always on" */
-$js_pref = SMPREF_JS_ON;
-if ($javascript_setting != SMPREF_JS_ON){
- if ($javascript_setting == SMPREF_JS_AUTODETECT) {
- if ($js_autodetect_results == SMPREF_JS_OFF) {
- $js_pref = SMPREF_JS_OFF;
- }
- } else {
- $js_pref = SMPREF_JS_OFF;
- }
-}
-/* Update the prefs */
-setPref($data_dir, $username, 'javascript_on', $js_pref);
+checkForJavascript();
/* Compute the URL to forward the user to. */
$redirect_url = $location . '/webmail.php';