-
Notifications
You must be signed in to change notification settings - Fork 21
/
upgrade.php
executable file
·117 lines (93 loc) · 3.26 KB
/
upgrade.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php
// +----------------------------------------------------------------+
// | AtMail Open - Licensed under the Apache 2.0 Open-source License|
// | http://opensource.org/licenses/apache2.0.php |
// +----------------------------------------------------------------+
require_once('header.php');
header('Content-type: text/html; charset=utf-8');
require_once('Config.php');
require_once('Global_Base.php'); // Backwards compatability, e.g FC2, no file_put_contents if sqldo statement errors
require_once('SQL.php');
$db = new SQL();
$newversion = '1.03';
if (preg_match('/(\d+\.\d+)/', $pref['version'], $m)) {
$version = $m[1];
if ($version == $newversion) {
die("Already at version $version");
}
} else {
die('Could not determine current version');
}
$alpha = range('a', 'z');
$alpha[] = 'other';
if ($version == '1.0') {
$version = '1.01';
}
if ($version == '1.01') {
// Add UseSSL column
foreach ($alpha as $a) {
$db->sqldo("alter table UserSettings_$a add UseSSL tinyint(1) default 0");
}
$db->sqldo("alter table Accounts add UseSSL tinyint(1) default 0");
if (extension_loaded('openssl')) {
$pref['mail_type_ssl'] = 'allow';
} else {
$pref['mail_type_ssl'] = 'deny';
}
$version = '1.02';
}
if ($version == '1.02') {
if (empty($pref['aspell_path']) || !is_executable($pref['aspell_path'])) {
if (is_executable('/usr/bin/aspell')) {
$pref['aspell_path'] = '/usr/bin/aspell';
} elseif (is_executable('/usr/local/bin/aspell')) {
$pref['aspell_path'] = '/usr/local/bin/aspell';
}
}
$pref['addressbook_ldap_entries'] = '0';
$pref['autocomplete_ldap_entries'] = '0';
$pref['imap_sort_extension'] = '1';
$pref['imap_sort_charset'] = 'us-ascii';
$pref['quota_bar'] = '1';
$pref['quota_alert'] = '1';
$pref['quota_alert_over'] = '90';
$pref['quota_alert_html'] = '<p style="font-weight:bold;text-align:center;font-size:24px;">
YOUR QUOTA IS NEARLY EXHAUSTED - PLEASE DELETE UNNECESSARY ITEMS</p>
<p style="text-align:center;font-size:18px;">
You will be unable to receive or send any messages once you have exhausted your quota.</p>';
$version = '1.03';
}
if ($version == '1.03') {
$pref['logo_small_alt'] = 'Atmail Open';
$pref['footer_msg'] = '<hr />Message sent via Atmail Open - http://atmail.org/';
$version = '1.04';
}
$pref['version'] = "Atmail Open $version";
writeconf();
$msg = <<<_EOF
<h1>Upgrade to Atmail Open $newversion - Complete</h1>
<p>Reload the <a href='index.php'>index page</a> of Atmail Open to continue using the latest release.</p>
<p>View the <a href="http://support.atmail.org/changelog.html">changelog</a> for details on the new Atmail Open $newversion release.</p>
<p>This script (upgrade.php) will be deleted from your server. A new version will be supplied with the next release.</p>
_EOF;
unlink(__FILE__);
?>
<HTML>
<BODY>
<HEAD>
<STYLE>
BODY { background: #ffffff; width: 600px;}
H1 { font-family: Verdana, arial; font-size: 16px;}
P { font-family: Verdana, arial; font-size: 12px;}
pre {
overflow: auto;
padding: 1em;
border: 1px solid #c0d8c0;
background-color: #f0f0f0;
}
</STYLE>
</HEAD>
<img src="../../imgs/about.gif">
<?php echo $msg; ?>
</BODY>
</HTML>