~ubuntu-branches/ubuntu/maverick/ilohamail/maverick

« back to all changes in this revision

Viewing changes to IlohaMail/include/save_prefs.FS.inc

  • Committer: Bazaar Package Importer
  • Author(s): Joerg Jaspert
  • Date: 2004-02-04 13:44:37 UTC
  • Revision ID: james.westby@ubuntu.com-20040204134437-kz8j3ui2qa7oq8z2
Tags: upstream-0.8.12
ImportĀ upstreamĀ versionĀ 0.8.12

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/////////////////////////////////////////////////////////
 
3
//      
 
4
//      include/save_prefs.inc
 
5
//
 
6
//      (C) Copyright 2001-2002 Ryo Chijiiwa <Ryo@IlohaMail.org>
 
7
//
 
8
//      This file is part of IlohaMail. IlohaMail is free software released 
 
9
//      under the GPL license.  See enclosed file COPYING for details, or 
 
10
//      see http://www.fsf.org/copyleft/gpl.html
 
11
//
 
12
/////////////////////////////////////////////////////////
 
13
 
 
14
/********************************************************
 
15
 
 
16
        PURPOSE:
 
17
                Save prefs (in $my_prefs) to back-end
 
18
                Generate $usrPath/my_prefs.inc file.
 
19
        PRE-CONDITIONS:
 
20
                "include/session_auth.inc"
 
21
                $userPath (or $path) - user directory
 
22
                $my_prefs - array
 
23
                
 
24
********************************************************/
 
25
    include_once("../include/array2php.inc");
 
26
 
 
27
        if ((isset($userPath)) && (!isset($path))) $path = $userPath;
 
28
 
 
29
    // save prefs into $userPath/prefs file
 
30
    $file=$path."/prefs";
 
31
    $fd=fopen($file, "w");
 
32
    if ($fd){
 
33
        reset($my_prefs);
 
34
        while ( list($key, $val) = each($my_prefs)){
 
35
            fwrite($fd, $key.":".base64_encode($val)."\n");
 
36
        }
 
37
        fclose($fd);
 
38
    }
 
39
    
 
40
    // write dynamically created PHP code into $userPath/prefs.inc
 
41
    $fp = fopen($file.".inc", "w");
 
42
    if ($fp){
 
43
        $str = Array2PHP($my_prefs, "my_prefs");
 
44
        fputs($fp, "<?php\n");
 
45
        fputs($fp, $str);
 
46
        fputs($fp, "?>\n");
 
47
    }
 
48
 
 
49
?>
 
 
b'\\ No newline at end of file'