made data path relative
authorlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 6 Jan 2000 19:29:24 +0000 (19:29 +0000)
committerlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 6 Jan 2000 19:29:24 +0000 (19:29 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@114 7612ce4b-ef26-0410-bec9-ea0150e637f0

config/config.php
functions/prefs.php
functions/smtp.php
src/load_prefs.php
src/options.php
src/options_submit.php
src/webmail.php

index 04ef87a8afef9627c974ae7f599808be81b76898..4ae1f37655622c55357ac01a2378678b34718074 100644 (file)
 //  Whether or not to use META tags and automatically forward after an action has
 //  been completed.
     $auto_forward = true;
+
+//  Path to the data/ directory
+//    It is a possible security hole to have a writable directory under the web server's
+//    root directory (ex: /home/httpd/html).  For this reason, it is possible to put
+//    the data directory anywhere you would like.   The path name can be absolute or
+//    relative (to the config directory).  It doesn't matter.  Here are two examples:
+//
+//  Absolute:
+//    $data_dir = "/usr/local/squirrelmail/data/";
+//
+//  Relative (to the config directory):
+//    $data_dir = "../data/";
+
+    $data_dir = "../data/haha/";
 ?>
index 51265242727e4a4ea47d8116e99fc08fc8ab47d3..93682733a1ebe49d7883d82287c22d2cd6961f07 100644 (file)
@@ -6,8 +6,8 @@
     **/
 
    /** returns the value for $string **/
-   function getPref($username, $string) {
-      $filename = "../data/$username.pref";
+   function getPref($data_dir, $username, $string) {
+      $filename = "$data_dir$username.pref";
       if (!file_exists($filename)) {
          echo "Preference file \"$filename\" not found.  Exiting abnormally";
          exit;
@@ -28,8 +28,8 @@
    }
 
    /** sets the pref, $string, to $set_to **/
-   function setPref($username, $string, $set_to) {
-      $filename = "../data/$username.pref";
+   function setPref($data_dir, $username, $string, $set_to) {
+      $filename = "$data_dir$username.pref";
       $found = false;
       if (!file_exists($filename)) {
          echo "Preference file, $filename, does not exist.  Log out, and log back in to create a default preference file.<BR>";
    }
 
    /** This checks if there is a pref file, if there isn't, it will create it. **/
-   function checkForPrefs($username) {
-      $filename = "../data/$username.pref";
+   function checkForPrefs($data_dir, $username) {
+      $filename = "$data_dir$username.pref";
       if (!file_exists($filename)) {
-         if (!copy("../data/default_pref", $filename)) {
+         if (!copy("$data_dirdefault_pref", $filename)) {
             echo "Error opening $filename";
             exit;
          }
index a5b7934a02fca2bfeef32346edf536c2c268c635..6150e24ce24e859301b864f04b6d56b5a6994b4e 100644 (file)
@@ -24,8 +24,8 @@
       $bcc = parseAddrs($b);
       $body = stripslashes($body);
       $from_addr = "$username@$domain";
-      $reply_to = getPref($username, "reply_to");
-      $from = getPref($username, "full_name");
+      $reply_to = getPref($data_dir, $username, "reply_to");
+      $from = getPref($data_dir, $username, "full_name");
       if ($from == "")
          $from = "<$from_addr>";
       else
index 97785f6f66a5b023fbb48cb2cdc128f8a65bc520..973ae4abda4f7b73adfdf5f5fabbd2bc54f43ce2 100644 (file)
@@ -1,7 +1,8 @@
 <?
+   include("../config/config.php");
    include("../functions/prefs.php");
 
-   $chosen_theme = getPref($username, "chosen_theme");
+   $chosen_theme = getPref($data_dir, $username, "chosen_theme");
 
    if (isset($chosen_theme)) {
       require("$chosen_theme");
index f3aaea3977eba5b510d7e99cd2b7107bf86d214c..17aabaf146a54626999a1d41c52f974f30d558ff 100644 (file)
@@ -14,8 +14,8 @@
    displayPageHeader($color, "None");
 
    /** load up some of the values from the pref file **/
-   $fullname = getPref($username, "full_name");
-   $replyto  = getPref($username, "reply_to");
+   $fullname = getPref($data_dir, $username, "full_name");
+   $replyto  = getPref($data_dir, $username, "reply_to");
    if ($replyto == "")
       $replyto = "$username@$domain";
 
index 3f128602c15632b9db9c48a8d7292e8882775018..65b8c202e50cb8978f5327ae97e63a0e23afe977 100644 (file)
@@ -13,9 +13,9 @@
    echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
    displayPageHeader($color, "None");
 
-   setPref($username, "full_name", $full_name);
-   setPref($username, "reply_to", $reply_to);
-   setPref($username, "chosen_theme", $chosentheme);
+   setPref($data_dir, $username, "full_name", $full_name);
+   setPref($data_dir, $username, "reply_to", $reply_to);
+   setPref($data_dir, $username, "chosen_theme", $chosentheme);
 
    echo "<FONT FACE=\"Arial,Helvetica\">";
    echo "<BR><BR><BR><CENTER><B>Options Saved!</B><BR><BR>";
index 8f11384b439c8a745ea94a5ad3d2af9809fb05ac..54eb524c6a15abba307a8e26b0e3939cc486e51a 100644 (file)
@@ -38,7 +38,7 @@
     we would like to use as little Javascript as possible.
 **/
 <?
-   checkForPrefs($username);
+   checkForPrefs($data_dir, $username);
 
    if ($right_frame == "right_main.php") {
       $urlMailbox = urlencode($mailbox);