Getting ready for 1.2.0 release.
[squirrelmail.git] / src / load_prefs.php
index b55a4b3091c43899983262571bfa62c0a5d74209..b6e796371af65e79c5fa8c49a04a580a0e80030b 100644 (file)
@@ -1,23 +1,34 @@
 <?php
-    /**
-     * load_prefs.php
-     *
-     * Copyright (c) 1999-2001 The SquirrelMail Development Team
-     * Licensed under the GNU GPL. For full terms see the file COPYING.
-     *
-     * Loads preferences from the $username.pref file used by almost
-     * every other script in the source directory and alswhere.
-     *
-     * $Id$
-     **/
-
-    require_once('../src/validate.php');
-
-    /**************************************************************/
-    /* Following code should be removed in the next foo_once step */
-    if (defined('load_prefs_php')) { return; }
-    define('load_prefs_php', true);
-    /**************************************************************/
+
+/**
+ * load_prefs.php
+ *
+ * Copyright (c) 1999-2002 The SquirrelMail Project Team
+ * Licensed under the GNU GPL. For full terms see the file COPYING.
+ *
+ * Loads preferences from the $username.pref file used by almost
+ * every other script in the source directory and alswhere.
+ *
+ * $Id$
+ */
+
+/*****************************************************************/
+/*** THIS FILE NEEDS TO HAVE ITS FORMATTING FIXED!!!           ***/
+/*** PLEASE DO SO AND REMOVE THIS COMMENT SECTION.             ***/
+/***    + Base level indent should begin at left margin, as    ***/
+/***      the require_once below looks.                        ***/
+/***    + All identation should consist of four space blocks   ***/
+/***    + Tab characters are evil.                             ***/
+/***    + all comments should use "slash-star ... star-slash"  ***/
+/***      style -- no pound characters, no slash-slash style   ***/
+/***    + FLOW CONTROL STATEMENTS (if, while, etc) SHOULD      ***/
+/***      ALWAYS USE { AND } CHARACTERS!!!                     ***/
+/***    + Please use ' instead of ", when possible. Note "     ***/
+/***      should always be used in _( ) function calls.        ***/
+/*** Thank you for your help making the SM code more readable. ***/
+/*****************************************************************/
+
+require_once('../src/validate.php');
 
     global $theme, $chosen_theme, $color;
     if (! isset($theme)) { $theme = array(); }
@@ -27,7 +38,6 @@
     require_once('../functions/constants.php');
       
     if (!isset($username)) { $username = ''; }
-    checkForPrefs($data_dir, $username);
 
     $chosen_theme = getPref($data_dir, $username, "chosen_theme");
     $in_ary = false;
     global $trash_folder, $sent_folder, $draft_folder;
 
     /** Load special folder - trash **/
-    $new_trash_folder = getPref($data_dir, $username, 'trash_folder');
-    if (($new_trash_folder == '') && ($move_to_trash)) {
+    $load_trash_folder = getPref($data_dir, $username, 'trash_folder');
+    if (($load_trash_folder == '') && ($move_to_trash)) {
         $trash_folder = $folder_prefix . $trash_folder;
     } else {
-        $trash_folder = $new_trash_folder;
+        $trash_folder = $load_trash_folder;
     }
 
     /** Load special folder - sent **/
-    $new_sent_folder = getPref($data_dir, $username, 'sent_folder');
-    if (($new_sent_folder == '') && ($move_to_sent)) {
+    $load_sent_folder = getPref($data_dir, $username, 'sent_folder');
+    if (($load_sent_folder == '') && ($move_to_sent)) {
         $sent_folder = $folder_prefix . $sent_folder;
     } else {
-        $sent_folder = $new_sent_folder;
+        $sent_folder = $load_sent_folder;
     }
 
     /** Load special folder - draft **/
-    $new_draft_folder = getPref($data_dir, $username, 'draft_folder');
-    if (($new_draft_folder == '') && ($save_as_draft)) {
+    $load_draft_folder = getPref($data_dir, $username, 'draft_folder');
+    if (($load_draft_folder == '') && ($save_as_draft)) {
         $draft_folder = $folder_prefix . $draft_folder;
     } else {
-        $draft_folder = $new_draft_folder;
+        $draft_folder = $load_draft_folder;
     }
 
     global $show_num, $wrap_at, $left_size;
     global $editor_size, $use_signature, $prefix_sig;
     $editor_size = getPref($data_dir, $username, "editor_size", 76 );
 
-    $use_signature = getPref($data_dir, $username, 'use_signature', FALSE );
+    $use_signature = getPref($data_dir, $username, 'use_signature', SMPREF_OFF );
 
     $prefix_sig = getPref($data_dir, $username, "prefix_sig");
 
     /* Load preferences for reply citation style. */
     global $reply_citation_style, $reply_citation_start, $reply_citation_end;
 
-    $reply_citation_style = getPref($data_dir, $username, 'reply_citation_style', 'none' );
+    $reply_citation_style = getPref($data_dir, $username, 'reply_citation_style', SMPREF_NONE );
     $reply_citation_start = getPref($data_dir, $username, 'reply_citation_start');
     $reply_citation_end = getPref($data_dir, $username, 'reply_citation_end');
 
     global $left_refresh, $sort;
-    $left_refresh = getPref($data_dir, $username, 'left_refresh', 'None' );
+    $left_refresh = getPref($data_dir, $username, 'left_refresh', SMPREF_NONE );
     $sort = getPref($data_dir, $username, 'sort', 6 );
 
     /** Load up the Signature file **/
     }
 
     global $alt_index_colors;
-    $alt_index_colors = getPref($data_dir, $username, 'alt_index_colors', FALSE );
+    $alt_index_colors = getPref($data_dir, $username, 'alt_index_colors', SMPREF_ON );
 
     global $location_of_bar, $location_of_buttons;
-    $location_of_bar = getPref($data_dir, $username, 'location_of_bar', 'left');
-    $location_of_buttons = getPref($data_dir, $username, 'location_of_buttons', 'between' );
+    $location_of_bar = getPref($data_dir, $username, 'location_of_bar', SMPREF_LOC_LEFT);
+    $location_of_buttons = getPref($data_dir, $username, 'location_of_buttons', SMPREF_LOC_BETWEEN);
 
-    global $collapse_folders, $show_html_default;
-    $collapse_folders = getPref($data_dir, $username, 'collapse_folders');
+    global $collapse_folders, $show_html_default, $show_xmailer_default,
+           $attachment_common_show_images, $pf_subtle_link, $pf_cleandisplay;
+    $collapse_folders = getPref($data_dir, $username, 'collapse_folders', SMPREF_ON);
 
     /* show_html_default is a int value. */
-    $show_html_default = intval(getPref($data_dir, $username, 'show_html_default', 1 ) );
+    $show_html_default = intval(getPref($data_dir, $username, 'show_html_default', SMPREF_ON));
+
+    $show_xmailer_default = getPref($data_dir, $username, 'show_xmailer_default', SMPREF_OFF );
+    $attachment_common_show_images = getPref($data_dir, $username, 'attachment_common_show_images', SMPREF_OFF );
+    $pf_subtle_link = getPref($data_dir, $username, 'pf_subtle_link', SMPREF_ON);
+    $pf_cleandisplay = getPref($data_dir, $username, 'pf_cleandisplay', SMPREF_OFF);
+
+    global $include_self_reply_all;
+    $include_self_reply_all = getPref($data_dir, $username, 'include_self_reply_all', SMPREF_ON);
+
+    global $page_selector, $page_selector_max;
+    $page_selector = getPref($data_dir, $username, 'page_selector', SMPREF_ON);
+    $page_selector_max = getPref($data_dir, $username, 'page_selector_max', 10);
 
     /* SqClock now in the core */
     global $date_format, $hour_format, $username, $data_dir;
     /* Load the javascript settings. */
     global $javascript_setting, $javascript_on;
     $javascript_setting = getPref($data_dir, $username, 'javascript_setting', SMPREF_JS_AUTODETECT);
-    $javascript_on = getPref($data_dir, $username, 'javascript_on', true);
+    $javascript_on = getPref($data_dir, $username, 'javascript_on', SMPREF_ON);
 
     do_hook("loading_prefs");
 ?>