From 65b14f90f66fb256ca4cfe5d4096a251f5a1eaf0 Mon Sep 17 00:00:00 2001 From: lkehresman Date: Thu, 6 Jan 2000 00:48:05 +0000 Subject: [PATCH] Beginnings of the options menu git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@106 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- INSTALL | 11 +++++- data/default_pref | 3 ++ functions/page_header.php | 2 +- functions/prefs.php | 75 +++++++++++++++++++++++++++++++++++++++ src/options.php | 23 ++++++++++++ src/webmail.php | 3 ++ 6 files changed, 115 insertions(+), 2 deletions(-) create mode 100644 data/default_pref create mode 100644 functions/prefs.php create mode 100644 src/options.php diff --git a/INSTALL b/INSTALL index a10c4866..5eba5aff 100644 --- a/INSTALL +++ b/INSTALL @@ -8,5 +8,14 @@ overview of how to install SquirrelMail. 3. Edit the config file, config/config.php -4. Point your browser to the location you specified in step 2. +4. Change the permissons for the "data/" directory so it's writable to + the web server. Under Red Hat Linux 6.0, this is done by: + + chown nobody data + chgrp nobody data + + "nobody" is the user and group for the apache server for this + example. + +5. Point your browser to the location you specified in step 2. In this example, it's: http://YOURHOST/squirrelmail-0.1/index.html diff --git a/data/default_pref b/data/default_pref new file mode 100644 index 00000000..3ba55015 --- /dev/null +++ b/data/default_pref @@ -0,0 +1,3 @@ +theme=default_theme.php +full_name=Luke Ehresman +reply_to=luke@usa.om.org \ No newline at end of file diff --git a/functions/page_header.php b/functions/page_header.php index 81585570..e8b360ea 100644 --- a/functions/page_header.php +++ b/functions/page_header.php @@ -22,7 +22,7 @@ echo " Compose  "; echo " Addresses  "; echo " Folders  "; - echo " Options  "; + echo " Options  "; echo " "; echo " SquirrelMail"; echo " "; diff --git a/functions/prefs.php b/functions/prefs.php new file mode 100644 index 00000000..1f6891bd --- /dev/null +++ b/functions/prefs.php @@ -0,0 +1,75 @@ +"; + exit; + } + $file = fopen($filename, "r"); + + /** read in all the preferences **/ + for ($i=0; !feof($file); $i++) { + $pref[$i] = fgets($file, 1024); + if (substr($pref[$i], 0, strpos($pref[$i], "=")) == $string) { + $found = true; + $pos = $i; + } + } + fclose($file); + + $file = fopen($filename, "w"); + if ($found == true) { + for ($i=0; $i < count($pref); $i++) { + if ($i == $pos) { + fwrite($file, "$string=$set_to\n", 1024); + } else { + fwrite($file, "$pref[$i]", 1024); + } + } + } else { + for ($i=0; $i < count($pref); $i++) { + fwrite($file, "$pref[$i]", 1024); + } + fwrite($file, "$string=$set_to\n", 1024); + } + + fclose($file); + } + + /** This checks if there is a pref file, if there isn't, it will create it. **/ + function checkForPrefs($username) { + $filename = "../data/default_pref"; + if (!file_exists($filename)) { + if (!copy("../config/default.pref", $filename)) { + echo "Error opening $filename"; + exit; + } + } + return; + } +?> \ No newline at end of file diff --git a/src/options.php b/src/options.php new file mode 100644 index 00000000..3a819a09 --- /dev/null +++ b/src/options.php @@ -0,0 +1,23 @@ +\n"; + displayPageHeader($color, "None"); + + echo "\n"; + echo " \n"; + echo "
\n"; + echo " Options\n"; + echo "
\n"; + + echo getPref($username, "full_name"); + + echo ""; +?> \ No newline at end of file diff --git a/src/webmail.php b/src/webmail.php index aaaaf785..8f11384b 100644 --- a/src/webmail.php +++ b/src/webmail.php @@ -19,6 +19,7 @@ <? include ("../config/config.php"); + include ("../functions/prefs.php"); echo "$org_title"; ?> @@ -37,6 +38,8 @@ we would like to use as little Javascript as possible. **/ "; -- 2.25.1