This commit has been accessed 566 times via Git panel.
commit c172fad5e5a845009feb02f58e16352e5b252bd1
tree 3d6e8a2c22b425810ff693e60144c6d8fceb6fe8
parent c39368623626f18c42782db97e896b40d262cea3
author Engels Antonio <engels@majcms.org> 1335549007 +0800
committer Engels Antonio <engels@majcms.org> 1335549007 +0800
Improve settings segregation
diff --git a/index.php b/index.php
index 86ac454..f7c1e6b 100644
--- a/index.php
+++ b/index.php
@@ -864,6 +864,7 @@ if (isset($_SESSION['logged_uid'])) {
if (isset($_POST['del_box']) and !empty($_POST['del_box'])) {
$del_box = imap_utf7_encode(ucwords(trim(preg_replace("/[^a-z0-9 ]/i","",strip_tags($_POST['del_box'])))));
+ $del_siv = $del_box;
if (($del_box != "INBOX") and ($del_box != "Sent") and ($del_box != "Trash")) {
imap_deletemailbox($mbox,"{$host}$del_box");
@@ -1007,315 +1008,330 @@ if (isset($_SESSION['logged_uid'])) {
echo "<title>Kartero - Settings</title>";
+ echo "<style> .hide { display: none; } </style>";
+
echo "<div class=\"message\">";
+ echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"800\"><tr><td>";
+
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
echo "<tr>";
- echo "<form method=\"post\"><td class=\"label\"><input type=\"hidden\" name=\"set\" value=\"account\"><input type=\"image\" src=\"images/mail-settings.png\"></td></form>";
- echo "<form method=\"post\"><td class=\"label\"><input type=\"hidden\" name=\"set\" value=\"folders\"><input type=\"image\" src=\"images/mail-settings.png\"></td></form>";
- echo "<form method=\"post\"><td class=\"label\"><input type=\"hidden\" name=\"set\" value=\"filters\"><input type=\"image\" src=\"images/mail-settings.png\"></td></form>";
- echo "</tr>";
+ echo "<td class=\"label\"><img src=\"images/mail-settings.png\" border=\"0\" width=\"32\" height=\"32\" onclick=\"document.getElementById('account').className ='';document.getElementById('folders').className='hide';document.getElementById('filters').className='hide'\"></td>";
+ echo "<td class=\"label\"><img src=\"images/mail-settings.png\" border=\"0\" width=\"32\" height=\"32\" onclick=\"document.getElementById('account').className ='hide';document.getElementById('folders').className='';document.getElementById('filters').className='hide'\"></td>";
+ echo "<td class=\"label\"><img src=\"images/mail-settings.png\" border=\"0\" width=\"32\" height=\"32\" onclick=\"document.getElementById('account').className ='hide';document.getElementById('folders').className='hide';document.getElementById('filters').className=''\"></td>";
+echo "</tr>";
echo "<tr><td class=\"label\">account</td><td class=\"label\">folders</td><td class=\"label\">filters</td></tr>";
echo "</table>";
+
+ echo "</td></tr></table>";
echo "</div>";
if ($_POST['set'] == "account") {
+ echo "<div id=\"account\">";
+ }
+ else {
+ echo "<div id=\"account\" class=\"hide\">";
+ }
- echo "<div class=\"spacer\"></div>";
- echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"1\" width=\"800\">";
- echo "<form method=\"post\">";
- echo "<input type=\"hidden\" name=\"set\" value=\"account\">";
- echo "<tr bgcolor=\"#ffffff\"><td width=\"400\"><input class=\"input\" type=\"text\" name=\"usr_name\" value=\"$usr_name\" autocomplete=\"off\" maxlength=\"128\" required autofocus></td><td>name</td></tr>";
- echo "<tr bgcolor=\"#ffffff\"><td><input class=\"input\" type=\"password\" name=\"usr_pw1\" autocomplete=\"off\" maxlength=\"64\"></td><td>current password</td></tr>";
-
- echo "<tr bgcolor=\"#ffffff\"><td><input class=\"input\" type=\"password\" name=\"usr_pw2\" autocomplete=\"off\" maxlength=\"64\"></td><td>new password";
-
- if (isset($_POST['usr_pw1']) and !empty($_POST['usr_pw1']) and isset($_POST['usr_pw2']) and (strlen($_POST['usr_pw2']) < 8)) {
- echo " <font color=\"red\">too short</font>";
- }
+ echo "<div class=\"spacer\"></div>";
+ echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"1\">";
+ echo "<form method=\"post\">";
+ echo "<input type=\"hidden\" name=\"set\" value=\"account\">";
+ echo "<tr bgcolor=\"#ffffff\"><td width=\"400\"><input class=\"input\" type=\"text\" name=\"usr_name\" value=\"$usr_name\" autocomplete=\"off\" maxlength=\"128\" required autofocus></td><td>name</td></tr>";
+ echo "<tr bgcolor=\"#ffffff\"><td><input class=\"input\" type=\"password\" name=\"usr_pw1\" autocomplete=\"off\" maxlength=\"64\"></td><td>current password</td></tr>";
- echo "</td></tr>";
+ echo "<tr bgcolor=\"#ffffff\"><td><input class=\"input\" type=\"password\" name=\"usr_pw2\" autocomplete=\"off\" maxlength=\"64\"></td><td>new password";
- echo "<tr bgcolor=\"#ffffff\"><td><input class=\"input\" type=\"password\" name=\"usr_pw3\" autocomplete=\"off\" maxlength=\"64\"></td><td>new password";
+ if (isset($_POST['usr_pw1']) and !empty($_POST['usr_pw1']) and isset($_POST['usr_pw2']) and (strlen($_POST['usr_pw2']) < 8)) {
+ echo " <font color=\"red\">too short</font>";
+ }
- if (isset($_POST['usr_pw1']) and !empty($_POST['usr_pw1']) and isset($_POST['usr_pw3']) and (strlen($_POST['usr_pw3']) < 8)) {
- echo " <font color=\"red\">too short</font>";
- }
+ echo "</td></tr>";
- echo "</td></tr>";
+ echo "<tr bgcolor=\"#ffffff\"><td><input class=\"input\" type=\"password\" name=\"usr_pw3\" autocomplete=\"off\" maxlength=\"64\"></td><td>new password";
- echo "<tr bgcolor=\"#ffffff\"><td><input class=\"button\" type=\"submit\" value=\"update\"></td><td></td></tr>";
- echo "</form></table>";
+ if (isset($_POST['usr_pw1']) and !empty($_POST['usr_pw1']) and isset($_POST['usr_pw3']) and (strlen($_POST['usr_pw3']) < 8)) {
+ echo " <font color=\"red\">too short</font>";
}
- if (($_POST['set'] == "folders") or ($_POST['set'] == "filters") or ($_POST['set'] == "sivD") or ($_POST['set'] == "sivM")) {
+ echo "</td></tr>";
- $usr_box = imap_list($mbox,$host,"*");
- $usr_box = array_diff($usr_box,array("{$host}INBOX","{$host}Sent","{$host}Trash"));
+ echo "<tr bgcolor=\"#ffffff\"><td><input class=\"button\" type=\"submit\" value=\"update\"></td><td></td></tr>";
+ echo "</form></table>";
+ echo "</div>";
- if (isset($mail_home) and !empty($mail_home)) {
-
- $sivU = explode("@",$_SESSION['logged_uid']);
- $sivN = $sivU[0];
- $sivD = $sivU[1];
- $sivP = "$mail_home/$sivD/{$sivN[0]}/$sivN";
- $sivR = glob("$sivP/*.sieve",GLOB_NOSORT);
-
- if ($del_box) {
-
- foreach ($sivR as $sivI) {
-
- if (stripos(file_get_contents($sivI),"fileinto \"$del_box\";")) {
- unlink($sivI);
- }
- }
- }
- }
+ if ($_POST['set'] == "folders") {
+ echo "<div id=\"folders\">";
+ }
+ else {
+ echo "<div id=\"folders\" class=\"hide\">";
}
- if ($_POST['set'] == "folders") {
+ echo "<div class=\"spacer\"></div>";
+ echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"1\">";
+ echo "<form method=\"post\">";
+ echo "<input type=\"hidden\" name=\"set\" value=\"folders\">";
+ echo "<tr bgcolor=\"#ffffff\"><td width=\"200\"><input class=\"input\" type=\"text\" name=\"new_box\" autocomplete=\"off\" maxlength=\"200\" required autofocus></td>";
+ echo "<td width=\"197\"><input class=\"button\" type=\"submit\" value=\"create folder\"></td><td></td></tr>";
+ echo "</form>";
- echo "<div class=\"spacer\"></div>";
- echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"1\" width=\"800\">";
- echo "<form method=\"post\">";
- echo "<input type=\"hidden\" name=\"set\" value=\"folders\">";
- echo "<tr bgcolor=\"#ffffff\"><td width=\"200\"><input class=\"input\" type=\"text\" name=\"new_box\" autocomplete=\"off\" maxlength=\"200\" required autofocus></td>";
- echo "<td width=\"197\"><input class=\"button\" type=\"submit\" value=\"create folder\"></td><td></td></tr>";
- echo "</form>";
+ $usr_box = imap_list($mbox,$host,"*");
+ $usr_box = array_diff($usr_box,array("{$host}INBOX","{$host}Sent","{$host}Trash"));
+ if (count($usr_box) > 0) {
- if (count($usr_box) > 0) {
+ sort($usr_box);
- sort($usr_box);
-
- echo "<form method=\"post\">";
- echo "<input type=\"hidden\" name=\"set\" value=\"folders\">";
- echo "<tr bgcolor=\"#ffffff\"><td width=\"200\"><select class=\"input\" name=\"del_box\">";
-
- foreach ($usr_box as $del_box) {
+ echo "<form method=\"post\">";
+ echo "<input type=\"hidden\" name=\"set\" value=\"folders\">";
+ echo "<tr bgcolor=\"#ffffff\"><td width=\"200\"><select class=\"input\" name=\"del_box\">";
+
+ foreach ($usr_box as $del_box) {
- $del_box = imap_utf7_decode(str_replace($host,"",$del_box));
+ $del_box = imap_utf7_decode(str_replace($host,"",$del_box));
- echo "<option value=\"$del_box\">$del_box</option>";
- }
+ echo "<option value=\"$del_box\">$del_box</option>";
+ }
- echo "</select></td><td width=\"197\"><input class=\"button\" type=\"submit\" value=\"delete folder\" onclick=\"if (confirm('Delete folder and all messages in it?')) {return true;} else {return false;}\"></td><td></td></tr>";
- echo "</form>";
- }
- echo "</table>";
+ echo "</select></td><td width=\"197\"><input class=\"button\" type=\"submit\" value=\"delete folder\" onclick=\"if (confirm('Delete folder and all messages in it?')) {return true;} else {return false;}\"></td><td></td></tr>";
+ echo "</form>";
}
- if (($_POST['set'] == "filters") or ($_POST['set'] == "sivD") or ($_POST['set'] == "sivM")) {
+ echo "</table>";
+ echo "</div>";
- if (isset($mail_home) and !empty($mail_home)) {
-
- if (isset($_POST['sieveT']) and !empty($_POST['sieveT']) and isset($_POST['sieveV']) and !empty($_POST['sieveV']) and isset($_POST['sieveF']) and !empty($_POST['sieveF'])) {
+ if (isset($mail_home) and !empty($mail_home)) {
- $sieveT = strtolower(trim(strip_tags($_POST['sieveT'])));
- $sieveV = trim($_POST['sieveV']);
- $sieveF = imap_utf7_encode(trim(strip_tags($_POST['sieveF'])));
+ $sivU = explode("@",$_SESSION['logged_uid']);
+ $sivN = $sivU[0];
+ $sivD = $sivU[1];
+ $sivP = "$mail_home/$sivD/{$sivN[0]}/$sivN";
+ $sivR = glob("$sivP/*.sieve",GLOB_NOSORT);
- if ($sieveT == "subject") {
- $sieveV = strip_tags($sieveV);
+ if ($del_siv) {
+
+ foreach ($sivR as $sivI) {
+
+ if (stripos(file_get_contents($sivI),"fileinto \"$del_siv\";")) {
+ unlink($sivI);
}
+ }
+ }
- if ($sieveV != "") {
- $sieveW = "require \"fileinto\"; if header :contains \"$sieveT\" \"$sieveV\" { fileinto \"$sieveF\"; }";
- }
+ if (isset($_POST['sieveT']) and !empty($_POST['sieveT']) and isset($_POST['sieveV']) and !empty($_POST['sieveV']) and isset($_POST['sieveF']) and !empty($_POST['sieveF'])) {
- if ($sieveW != ""){
-
- if (count($sivR) > 0) {
-
- foreach ($sivR as $sieveR) {
+ $sieveT = strtolower(trim(strip_tags($_POST['sieveT'])));
+ $sieveV = trim($_POST['sieveV']);
+ $sieveF = imap_utf7_encode(trim(strip_tags($_POST['sieveF'])));
- if (strtolower(trim(file_get_contents($sieveR))) != strtolower($sieveW)) {
- continue;
- }
-
- unlink($sieveR);
+ if ($sieveT == "subject") {
+ $sieveV = strip_tags($sieveV);
+ }
+
+ if ($sieveV != "") {
+ $sieveW = "require \"fileinto\"; if header :contains \"$sieveT\" \"$sieveV\" { fileinto \"$sieveF\"; }";
+ }
+
+ if ($sieveW != ""){
+
+ if (count($sivR) > 0) {
+
+ foreach ($sivR as $sieveR) {
+
+ if (strtolower(trim(file_get_contents($sieveR))) != strtolower($sieveW)) {
+ continue;
}
+
+ unlink($sieveR);
}
+ }
- $sieveP = "$sivP/" . date("YmdHis") . ".sieve";
+ $sieveP = "$sivP/" . date("YmdHis") . ".sieve";
- if (!file_exists($sivP)) {
- mkdir($sivP,0700,true);
- }
+ if (!file_exists($sivP)) {
+ mkdir($sivP,0700,true);
+ }
- $fp = fopen($sieveP,"w");
- fwrite($fp,$sieveW);
- fclose($fp);
+ $fp = fopen($sieveP,"w");
+ fwrite($fp,$sieveW);
+ fclose($fp);
- $sieveC = "$sieveT \"$sieveV\"";
+ $sieveC = "$sieveT \"$sieveV\"";
- $sieveO = (imap_search($mbox,$sieveC,SE_UID));
+ $sieveO = (imap_search($mbox,$sieveC,SE_UID));
- foreach ($sieveO as $sivO) {
- imap_mail_move($mbox,$sivO,$sieveF,CP_UID);
- imap_expunge($mbox);
- }
- }
+ foreach ($sieveO as $sivO) {
+ imap_mail_move($mbox,$sivO,$sieveF,CP_UID);
+ imap_expunge($mbox);
+ }
}
+ }
- if (isset($_POST['sieve']) and !empty($_POST['sieve'])) {
+ if (isset($_POST['sieve']) and !empty($_POST['sieve'])) {
- $sieve = strtolower(trim(strip_tags($_POST['sieve'])));
+ $sieve = strtolower(trim(strip_tags($_POST['sieve'])));
- if (isset($_POST['sivM']) and !empty($_POST['sivM'])) {
+ if (isset($_POST['sivM']) and !empty($_POST['sivM'])) {
- $sivM = trim(strip_tags($_POST['sivM']));
+ $sivM = trim(strip_tags($_POST['sivM']));
- if (file_exists("$sivP/$sivM") and ($_POST['set'] == "sivM")) {
+ if (file_exists("$sivP/$sivM") and ($_POST['set'] == "sivM")) {
- $sivMs = file_get_contents("$sivP/$sieve");
- $sivMt = file_get_contents("$sivP/$sivM");
+ $sivMs = file_get_contents("$sivP/$sieve");
+ $sivMt = file_get_contents("$sivP/$sivM");
- $fp = fopen("$sivP/$sieve","w");
- fwrite($fp,$sivMt);
- fclose($fp);
+ $fp = fopen("$sivP/$sieve","w");
+ fwrite($fp,$sivMt);
+ fclose($fp);
- $fp = fopen("$sivP/$sivM","w");
- fwrite($fp,$sivMs);
- fclose($fp);
- }
+ $fp = fopen("$sivP/$sivM","w");
+ fwrite($fp,$sivMs);
+ fclose($fp);
}
+ }
- if (file_exists("$sivP/$sieve") and ($_POST['set'] == "sivD")) {
- unlink("$sivP/$sieve");
- }
+ if (file_exists("$sivP/$sieve") and ($_POST['set'] == "sivD")) {
+ unlink("$sivP/$sieve");
}
+ }
- echo "<div class=\"spacer\"></div>";
- echo "<div class=\"message\" style=\"padding: 0;\">";
- echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"1\" width=\"100%\">";
- echo "<form method=\"post\"><input type=\"hidden\" name=\"set\" value=\"filters\"><tr>";
- echo "<td width=\"200\"><select class=\"input\" name=\"sieveT\">";
- echo "<option value=\"subject\">If message subject contains</option>";
- echo "<option value=\"from\">If message from contains</option>";
- echo "<option value=\"to\">If message to contains</option>";
- echo "<option value=\"cc\">If message cc contains</option>";
- echo "</td>";
- echo "<td><input class=\"input\" type=\"text\" name=\"sieveV\" autocomplete=\"off\" required></td>";
- echo "<td><select class=\"input\" name=\"sieveF\"><option value=\"Trash\" selected>then move to Trash</option>";
+ if (($_POST['set'] == "filters") or ($_POST['set'] == "sivD") or ($_POST['set'] == "sivM")) {
+ echo "<div id=\"filters\">";
+ }
+ else {
+ echo "<div id=\"filters\" class=\"hide\">";
+ }
- foreach ($usr_box as $sieveF) {
-
- $sieveF = str_replace($host,"",$sieveF);
-
- echo "<option value=\"$sieveF\">then move to $sieveF</option>";
- }
-
- echo "</select></td>";
- echo "<td><input class=\"button\" type=\"submit\" value=\"add filter\"></td>";
- echo "</tr></form>";
- echo "</table>";
- echo "</div>";
- echo "<div class=\"spacer\"></div>";
+ echo "<div class=\"spacer\"></div>";
+ echo "<div class=\"message\" style=\"padding: 0;\">";
+ echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"1\" width=\"100%\">";
+ echo "<form method=\"post\"><input type=\"hidden\" name=\"set\" value=\"filters\"><tr>";
+ echo "<td width=\"200\"><select class=\"input\" name=\"sieveT\">";
+ echo "<option value=\"subject\">If message subject contains</option>";
+ echo "<option value=\"from\">If message from contains</option>";
+ echo "<option value=\"to\">If message to contains</option>";
+ echo "<option value=\"cc\">If message cc contains</option>";
+ echo "</td>";
+ echo "<td><input class=\"input\" type=\"text\" name=\"sieveV\" autocomplete=\"off\" required></td>";
+ echo "<td><select class=\"input\" name=\"sieveF\"><option value=\"Trash\" selected>then move to Trash</option>";
+
+ foreach ($usr_box as $sieveF) {
+
+ $sieveF = str_replace($host,"",$sieveF);
+
+ echo "<option value=\"$sieveF\">then move to $sieveF</option>";
+ }
- $sivR = glob("$sivP/*.sieve");
+ echo "</select></td>";
+ echo "<td><input class=\"button\" type=\"submit\" value=\"add filter\"></td>";
+ echo "</tr></form>";
+ echo "</table>";
+ echo "</div>";
+ echo "<div class=\"spacer\"></div>";
+
+ $sivR = glob("$sivP/*.sieve");
- if (count($sivR) > 0) {
+ if (count($sivR) > 0) {
- $sivW = 'require "include";';
+ $sivW = 'require "include";';
- echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"2\" bgcolor=\"#cccccc\">";
+ echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"2\" bgcolor=\"#cccccc\">";
- foreach ($sivR as $sivK => $sivS) {
+ foreach ($sivR as $sivK => $sivS) {
- if ($bgColor == "#ffffff") {
- $bgColor = "#fdfdfd";
- }
- else {
- $bgColor = "#ffffff";
- }
+ if ($bgColor == "#ffffff") {
+ $bgColor = "#fdfdfd";
+ }
+ else {
+ $bgColor = "#ffffff";
+ }
- if ($sivK > 0) {
+ if ($sivK > 0) {
- $sivKp = $sivK - 1;
+ $sivKp = $sivK - 1;
- if (array_key_exists($sivKp,$sivR)) {
- $sivKp = basename($sivR[$sivKp]);
- }
- else {
- unset($sivKp);
- }
+ if (array_key_exists($sivKp,$sivR)) {
+ $sivKp = basename($sivR[$sivKp]);
}
+ else {
+ unset($sivKp);
+ }
+ }
- if ($sivK < count($sivR)) {
+ if ($sivK < count($sivR)) {
- $sivKn = $sivK + 1;
+ $sivKn = $sivK + 1;
- if (array_key_exists($sivKn,$sivR)) {
- $sivKn = basename($sivR[$sivKn]);
- }
- else {
- unset($sivKn);
- }
+ if (array_key_exists($sivKn,$sivR)) {
+ $sivKn = basename($sivR[$sivKn]);
+ }
+ else {
+ unset($sivKn);
}
+ }
- $sivC = (explode('"',file_get_contents($sivS)));
- $sivF = basename($sivS);
-
- $sivW = $sivW . "\r\ninclude \"" . str_replace(".sieve","",$sivF) . '";';
-
+ $sivC = (explode('"',file_get_contents($sivS)));
+ $sivF = basename($sivS);
+
+ $sivW = $sivW . "\r\ninclude \"" . str_replace(".sieve","",$sivF) . '";';
+
+ echo "<form method=\"post\">";
+ echo "<input type=\"hidden\" name=\"set\" value=\"sivD\">";
+ echo "<input type=\"hidden\" name=\"sieve\" value=\"$sivF\">";
+ echo "<tr bgcolor=\"$bgColor\">";
+ echo "<td valign=\"bottom\" width=\"24\"><input type=\"image\" src=\"images/sieve-del.png\"></td>";
+ echo "</form>";
+
+ if ($sivKp) {
echo "<form method=\"post\">";
- echo "<input type=\"hidden\" name=\"set\" value=\"sivD\">";
+ echo "<input type=\"hidden\" name=\"set\" value=\"sivM\">";
echo "<input type=\"hidden\" name=\"sieve\" value=\"$sivF\">";
- echo "<tr bgcolor=\"$bgColor\">";
- echo "<td valign=\"bottom\" width=\"24\"><input type=\"image\" src=\"images/sieve-del.png\"></td>";
+ echo "<input type=\"hidden\" name=\"sivM\" value=\"$sivKp\">";
+ echo "<td valign=\"bottom\" width=\"24\"><input type=\"image\" src=\"images/sieve-up.png\"></td>";
echo "</form>";
-
- if ($sivKp) {
- echo "<form method=\"post\">";
- echo "<input type=\"hidden\" name=\"set\" value=\"sivM\">";
- echo "<input type=\"hidden\" name=\"sieve\" value=\"$sivF\">";
- echo "<input type=\"hidden\" name=\"sivM\" value=\"$sivKp\">";
- echo "<td valign=\"bottom\" width=\"24\"><input type=\"image\" src=\"images/sieve-up.png\"></td>";
- echo "</form>";
- }
- else {
- if (count($sivR) > 1) {
- echo "<td></td>";
- }
+ }
+ else {
+ if (count($sivR) > 1) {
+ echo "<td></td>";
}
+ }
- if ($sivKn) {
- echo "<form method=\"post\">";
- echo "<input type=\"hidden\" name=\"set\" value=\"sivM\">";
- echo "<input type=\"hidden\" name=\"sieve\" value=\"$sivF\">";
- echo "<input type=\"hidden\" name=\"sivM\" value=\"$sivKn\">";
- echo "<td valign=\"bottom\" width=\"24\"><input type=\"image\" src=\"images/sieve-down.png\"></td>";
- echo "</form>";
- }
- else {
- if (count($sivR) > 1) {
- echo "<td></td>";
- }
+ if ($sivKn) {
+ echo "<form method=\"post\">";
+ echo "<input type=\"hidden\" name=\"set\" value=\"sivM\">";
+ echo "<input type=\"hidden\" name=\"sieve\" value=\"$sivF\">";
+ echo "<input type=\"hidden\" name=\"sivM\" value=\"$sivKn\">";
+ echo "<td valign=\"bottom\" width=\"24\"><input type=\"image\" src=\"images/sieve-down.png\"></td>";
+ echo "</form>";
+ }
+ else {
+ if (count($sivR) > 1) {
+ echo "<td></td>";
}
- echo "<td>If message {$sivC[3]} contains {$sivC[5]} then move to {$sivC[7]}</td>";
- echo "</tr>";
}
+ echo "<td>If message {$sivC[3]} contains {$sivC[5]} then move to {$sivC[7]}</td>";
+ echo "</tr>";
+ }
- echo "</table>";
+ echo "</table>";
+ echo "</div>";
- if ($sivW != file_get_contents("$sivP/.dovecot.sieve")) {
-
- $fp = fopen("$sivP/.dovecot.sieve","w");
- fwrite($fp,$sivW);
- fclose($fp);
- }
+ if ($sivW != file_get_contents("$sivP/.dovecot.sieve")) {
+
+ $fp = fopen("$sivP/.dovecot.sieve","w");
+ fwrite($fp,$sivW);
+ fclose($fp);
}
- else {
- if (file_exists("$sivP/.dovecot.sieve")) {
+ }
+ else {
+ if (file_exists("$sivP/.dovecot.sieve")) {
unlink("$sivP/.dovecot.sieve");
- }
+ }
- if (file_exists("$sivP/.dovecot.svbin")) {
+ if (file_exists("$sivP/.dovecot.svbin")) {
unlink("$sivP/.dovecot.svbin");
- }
}
}
}
diff --git a/read.php b/read.php
index 19d12c5..ca2c68f 100644
--- a/read.php
+++ b/read.php
@@ -78,6 +78,33 @@ if (isset($_POST['msg']) and !empty($_POST['msg']) and is_numeric($_POST['msg'])
echo "<div class=\"message\">";
+ $fileFrom = extract_emails_from($header_fromaddress);
+ $fileFrom = $fileFrom[0];
+ $fileFrom = sha1($fileFrom);
+
+ $filePic = "";
+
+ if (file_exists("images/contacts/$fileUsr/{$fileFrom}.gif") and !file_exists("images/contacts/$fileUsr/{$fileFrom}.jpg") and !file_exists("images/contacts/$fileUsr/{$fileFrom}.png")) {
+ $filePic = "images/contacts/$fileUsr/{$fileFrom}.gif";
+ }
+
+ if (!file_exists("images/contacts/$fileUsr/{$fileFrom}.gif") and file_exists("images/contacts/$fileUsr/{$fileFrom}.jpg") and !file_exists("images/contacts/$fileUsr/{$fileFrom}.png")) {
+ $filePic = "images/contacts/$fileUsr/{$fileFrom}.jpg";
+ }
+
+ if (!file_exists("images/contacts/$fileUsr/{$fileFrom}.gif") and !file_exists("images/contacts/$fileUsr/{$fileFrom}.jpg") and file_exists("images/contacts/$fileUsr/{$fileFrom}.png")) {
+ $filePic = "images/contacts/$fileUsr/{$fileFrom}.png";
+ }
+
+ if ($filePic != "") {
+
+ $filePicSize = getimagesize($filePic);
+
+ if (($filePicSize[0] > 0) and ($filePicSize[1] > 0)) {
+ echo "<img src=\"$filePic\" border=\"0\" width=\"{$filePicSize[0]}\" height=\"{$filePicSize[1]}\" align=\"right\">";
+ }
+ }
+
echo "<b>Subject: $header_subject</b>";
echo "<br><br>From: $header_fromaddress";
echo "<br>To: $header_toaddress";
tree 3d6e8a2c22b425810ff693e60144c6d8fceb6fe8
parent c39368623626f18c42782db97e896b40d262cea3
author Engels Antonio <engels@majcms.org> 1335549007 +0800
committer Engels Antonio <engels@majcms.org> 1335549007 +0800
Improve settings segregation
diff --git a/index.php b/index.php
index 86ac454..f7c1e6b 100644
--- a/index.php
+++ b/index.php
@@ -864,6 +864,7 @@ if (isset($_SESSION['logged_uid'])) {
if (isset($_POST['del_box']) and !empty($_POST['del_box'])) {
$del_box = imap_utf7_encode(ucwords(trim(preg_replace("/[^a-z0-9 ]/i","",strip_tags($_POST['del_box'])))));
+ $del_siv = $del_box;
if (($del_box != "INBOX") and ($del_box != "Sent") and ($del_box != "Trash")) {
imap_deletemailbox($mbox,"{$host}$del_box");
@@ -1007,315 +1008,330 @@ if (isset($_SESSION['logged_uid'])) {
echo "<title>Kartero - Settings</title>";
+ echo "<style> .hide { display: none; } </style>";
+
echo "<div class=\"message\">";
+ echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"800\"><tr><td>";
+
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
echo "<tr>";
- echo "<form method=\"post\"><td class=\"label\"><input type=\"hidden\" name=\"set\" value=\"account\"><input type=\"image\" src=\"images/mail-settings.png\"></td></form>";
- echo "<form method=\"post\"><td class=\"label\"><input type=\"hidden\" name=\"set\" value=\"folders\"><input type=\"image\" src=\"images/mail-settings.png\"></td></form>";
- echo "<form method=\"post\"><td class=\"label\"><input type=\"hidden\" name=\"set\" value=\"filters\"><input type=\"image\" src=\"images/mail-settings.png\"></td></form>";
- echo "</tr>";
+ echo "<td class=\"label\"><img src=\"images/mail-settings.png\" border=\"0\" width=\"32\" height=\"32\" onclick=\"document.getElementById('account').className ='';document.getElementById('folders').className='hide';document.getElementById('filters').className='hide'\"></td>";
+ echo "<td class=\"label\"><img src=\"images/mail-settings.png\" border=\"0\" width=\"32\" height=\"32\" onclick=\"document.getElementById('account').className ='hide';document.getElementById('folders').className='';document.getElementById('filters').className='hide'\"></td>";
+ echo "<td class=\"label\"><img src=\"images/mail-settings.png\" border=\"0\" width=\"32\" height=\"32\" onclick=\"document.getElementById('account').className ='hide';document.getElementById('folders').className='hide';document.getElementById('filters').className=''\"></td>";
+echo "</tr>";
echo "<tr><td class=\"label\">account</td><td class=\"label\">folders</td><td class=\"label\">filters</td></tr>";
echo "</table>";
+
+ echo "</td></tr></table>";
echo "</div>";
if ($_POST['set'] == "account") {
+ echo "<div id=\"account\">";
+ }
+ else {
+ echo "<div id=\"account\" class=\"hide\">";
+ }
- echo "<div class=\"spacer\"></div>";
- echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"1\" width=\"800\">";
- echo "<form method=\"post\">";
- echo "<input type=\"hidden\" name=\"set\" value=\"account\">";
- echo "<tr bgcolor=\"#ffffff\"><td width=\"400\"><input class=\"input\" type=\"text\" name=\"usr_name\" value=\"$usr_name\" autocomplete=\"off\" maxlength=\"128\" required autofocus></td><td>name</td></tr>";
- echo "<tr bgcolor=\"#ffffff\"><td><input class=\"input\" type=\"password\" name=\"usr_pw1\" autocomplete=\"off\" maxlength=\"64\"></td><td>current password</td></tr>";
-
- echo "<tr bgcolor=\"#ffffff\"><td><input class=\"input\" type=\"password\" name=\"usr_pw2\" autocomplete=\"off\" maxlength=\"64\"></td><td>new password";
-
- if (isset($_POST['usr_pw1']) and !empty($_POST['usr_pw1']) and isset($_POST['usr_pw2']) and (strlen($_POST['usr_pw2']) < 8)) {
- echo " <font color=\"red\">too short</font>";
- }
+ echo "<div class=\"spacer\"></div>";
+ echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"1\">";
+ echo "<form method=\"post\">";
+ echo "<input type=\"hidden\" name=\"set\" value=\"account\">";
+ echo "<tr bgcolor=\"#ffffff\"><td width=\"400\"><input class=\"input\" type=\"text\" name=\"usr_name\" value=\"$usr_name\" autocomplete=\"off\" maxlength=\"128\" required autofocus></td><td>name</td></tr>";
+ echo "<tr bgcolor=\"#ffffff\"><td><input class=\"input\" type=\"password\" name=\"usr_pw1\" autocomplete=\"off\" maxlength=\"64\"></td><td>current password</td></tr>";
- echo "</td></tr>";
+ echo "<tr bgcolor=\"#ffffff\"><td><input class=\"input\" type=\"password\" name=\"usr_pw2\" autocomplete=\"off\" maxlength=\"64\"></td><td>new password";
- echo "<tr bgcolor=\"#ffffff\"><td><input class=\"input\" type=\"password\" name=\"usr_pw3\" autocomplete=\"off\" maxlength=\"64\"></td><td>new password";
+ if (isset($_POST['usr_pw1']) and !empty($_POST['usr_pw1']) and isset($_POST['usr_pw2']) and (strlen($_POST['usr_pw2']) < 8)) {
+ echo " <font color=\"red\">too short</font>";
+ }
- if (isset($_POST['usr_pw1']) and !empty($_POST['usr_pw1']) and isset($_POST['usr_pw3']) and (strlen($_POST['usr_pw3']) < 8)) {
- echo " <font color=\"red\">too short</font>";
- }
+ echo "</td></tr>";
- echo "</td></tr>";
+ echo "<tr bgcolor=\"#ffffff\"><td><input class=\"input\" type=\"password\" name=\"usr_pw3\" autocomplete=\"off\" maxlength=\"64\"></td><td>new password";
- echo "<tr bgcolor=\"#ffffff\"><td><input class=\"button\" type=\"submit\" value=\"update\"></td><td></td></tr>";
- echo "</form></table>";
+ if (isset($_POST['usr_pw1']) and !empty($_POST['usr_pw1']) and isset($_POST['usr_pw3']) and (strlen($_POST['usr_pw3']) < 8)) {
+ echo " <font color=\"red\">too short</font>";
}
- if (($_POST['set'] == "folders") or ($_POST['set'] == "filters") or ($_POST['set'] == "sivD") or ($_POST['set'] == "sivM")) {
+ echo "</td></tr>";
- $usr_box = imap_list($mbox,$host,"*");
- $usr_box = array_diff($usr_box,array("{$host}INBOX","{$host}Sent","{$host}Trash"));
+ echo "<tr bgcolor=\"#ffffff\"><td><input class=\"button\" type=\"submit\" value=\"update\"></td><td></td></tr>";
+ echo "</form></table>";
+ echo "</div>";
- if (isset($mail_home) and !empty($mail_home)) {
-
- $sivU = explode("@",$_SESSION['logged_uid']);
- $sivN = $sivU[0];
- $sivD = $sivU[1];
- $sivP = "$mail_home/$sivD/{$sivN[0]}/$sivN";
- $sivR = glob("$sivP/*.sieve",GLOB_NOSORT);
-
- if ($del_box) {
-
- foreach ($sivR as $sivI) {
-
- if (stripos(file_get_contents($sivI),"fileinto \"$del_box\";")) {
- unlink($sivI);
- }
- }
- }
- }
+ if ($_POST['set'] == "folders") {
+ echo "<div id=\"folders\">";
+ }
+ else {
+ echo "<div id=\"folders\" class=\"hide\">";
}
- if ($_POST['set'] == "folders") {
+ echo "<div class=\"spacer\"></div>";
+ echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"1\">";
+ echo "<form method=\"post\">";
+ echo "<input type=\"hidden\" name=\"set\" value=\"folders\">";
+ echo "<tr bgcolor=\"#ffffff\"><td width=\"200\"><input class=\"input\" type=\"text\" name=\"new_box\" autocomplete=\"off\" maxlength=\"200\" required autofocus></td>";
+ echo "<td width=\"197\"><input class=\"button\" type=\"submit\" value=\"create folder\"></td><td></td></tr>";
+ echo "</form>";
- echo "<div class=\"spacer\"></div>";
- echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"1\" width=\"800\">";
- echo "<form method=\"post\">";
- echo "<input type=\"hidden\" name=\"set\" value=\"folders\">";
- echo "<tr bgcolor=\"#ffffff\"><td width=\"200\"><input class=\"input\" type=\"text\" name=\"new_box\" autocomplete=\"off\" maxlength=\"200\" required autofocus></td>";
- echo "<td width=\"197\"><input class=\"button\" type=\"submit\" value=\"create folder\"></td><td></td></tr>";
- echo "</form>";
+ $usr_box = imap_list($mbox,$host,"*");
+ $usr_box = array_diff($usr_box,array("{$host}INBOX","{$host}Sent","{$host}Trash"));
+ if (count($usr_box) > 0) {
- if (count($usr_box) > 0) {
+ sort($usr_box);
- sort($usr_box);
-
- echo "<form method=\"post\">";
- echo "<input type=\"hidden\" name=\"set\" value=\"folders\">";
- echo "<tr bgcolor=\"#ffffff\"><td width=\"200\"><select class=\"input\" name=\"del_box\">";
-
- foreach ($usr_box as $del_box) {
+ echo "<form method=\"post\">";
+ echo "<input type=\"hidden\" name=\"set\" value=\"folders\">";
+ echo "<tr bgcolor=\"#ffffff\"><td width=\"200\"><select class=\"input\" name=\"del_box\">";
+
+ foreach ($usr_box as $del_box) {
- $del_box = imap_utf7_decode(str_replace($host,"",$del_box));
+ $del_box = imap_utf7_decode(str_replace($host,"",$del_box));
- echo "<option value=\"$del_box\">$del_box</option>";
- }
+ echo "<option value=\"$del_box\">$del_box</option>";
+ }
- echo "</select></td><td width=\"197\"><input class=\"button\" type=\"submit\" value=\"delete folder\" onclick=\"if (confirm('Delete folder and all messages in it?')) {return true;} else {return false;}\"></td><td></td></tr>";
- echo "</form>";
- }
- echo "</table>";
+ echo "</select></td><td width=\"197\"><input class=\"button\" type=\"submit\" value=\"delete folder\" onclick=\"if (confirm('Delete folder and all messages in it?')) {return true;} else {return false;}\"></td><td></td></tr>";
+ echo "</form>";
}
- if (($_POST['set'] == "filters") or ($_POST['set'] == "sivD") or ($_POST['set'] == "sivM")) {
+ echo "</table>";
+ echo "</div>";
- if (isset($mail_home) and !empty($mail_home)) {
-
- if (isset($_POST['sieveT']) and !empty($_POST['sieveT']) and isset($_POST['sieveV']) and !empty($_POST['sieveV']) and isset($_POST['sieveF']) and !empty($_POST['sieveF'])) {
+ if (isset($mail_home) and !empty($mail_home)) {
- $sieveT = strtolower(trim(strip_tags($_POST['sieveT'])));
- $sieveV = trim($_POST['sieveV']);
- $sieveF = imap_utf7_encode(trim(strip_tags($_POST['sieveF'])));
+ $sivU = explode("@",$_SESSION['logged_uid']);
+ $sivN = $sivU[0];
+ $sivD = $sivU[1];
+ $sivP = "$mail_home/$sivD/{$sivN[0]}/$sivN";
+ $sivR = glob("$sivP/*.sieve",GLOB_NOSORT);
- if ($sieveT == "subject") {
- $sieveV = strip_tags($sieveV);
+ if ($del_siv) {
+
+ foreach ($sivR as $sivI) {
+
+ if (stripos(file_get_contents($sivI),"fileinto \"$del_siv\";")) {
+ unlink($sivI);
}
+ }
+ }
- if ($sieveV != "") {
- $sieveW = "require \"fileinto\"; if header :contains \"$sieveT\" \"$sieveV\" { fileinto \"$sieveF\"; }";
- }
+ if (isset($_POST['sieveT']) and !empty($_POST['sieveT']) and isset($_POST['sieveV']) and !empty($_POST['sieveV']) and isset($_POST['sieveF']) and !empty($_POST['sieveF'])) {
- if ($sieveW != ""){
-
- if (count($sivR) > 0) {
-
- foreach ($sivR as $sieveR) {
+ $sieveT = strtolower(trim(strip_tags($_POST['sieveT'])));
+ $sieveV = trim($_POST['sieveV']);
+ $sieveF = imap_utf7_encode(trim(strip_tags($_POST['sieveF'])));
- if (strtolower(trim(file_get_contents($sieveR))) != strtolower($sieveW)) {
- continue;
- }
-
- unlink($sieveR);
+ if ($sieveT == "subject") {
+ $sieveV = strip_tags($sieveV);
+ }
+
+ if ($sieveV != "") {
+ $sieveW = "require \"fileinto\"; if header :contains \"$sieveT\" \"$sieveV\" { fileinto \"$sieveF\"; }";
+ }
+
+ if ($sieveW != ""){
+
+ if (count($sivR) > 0) {
+
+ foreach ($sivR as $sieveR) {
+
+ if (strtolower(trim(file_get_contents($sieveR))) != strtolower($sieveW)) {
+ continue;
}
+
+ unlink($sieveR);
}
+ }
- $sieveP = "$sivP/" . date("YmdHis") . ".sieve";
+ $sieveP = "$sivP/" . date("YmdHis") . ".sieve";
- if (!file_exists($sivP)) {
- mkdir($sivP,0700,true);
- }
+ if (!file_exists($sivP)) {
+ mkdir($sivP,0700,true);
+ }
- $fp = fopen($sieveP,"w");
- fwrite($fp,$sieveW);
- fclose($fp);
+ $fp = fopen($sieveP,"w");
+ fwrite($fp,$sieveW);
+ fclose($fp);
- $sieveC = "$sieveT \"$sieveV\"";
+ $sieveC = "$sieveT \"$sieveV\"";
- $sieveO = (imap_search($mbox,$sieveC,SE_UID));
+ $sieveO = (imap_search($mbox,$sieveC,SE_UID));
- foreach ($sieveO as $sivO) {
- imap_mail_move($mbox,$sivO,$sieveF,CP_UID);
- imap_expunge($mbox);
- }
- }
+ foreach ($sieveO as $sivO) {
+ imap_mail_move($mbox,$sivO,$sieveF,CP_UID);
+ imap_expunge($mbox);
+ }
}
+ }
- if (isset($_POST['sieve']) and !empty($_POST['sieve'])) {
+ if (isset($_POST['sieve']) and !empty($_POST['sieve'])) {
- $sieve = strtolower(trim(strip_tags($_POST['sieve'])));
+ $sieve = strtolower(trim(strip_tags($_POST['sieve'])));
- if (isset($_POST['sivM']) and !empty($_POST['sivM'])) {
+ if (isset($_POST['sivM']) and !empty($_POST['sivM'])) {
- $sivM = trim(strip_tags($_POST['sivM']));
+ $sivM = trim(strip_tags($_POST['sivM']));
- if (file_exists("$sivP/$sivM") and ($_POST['set'] == "sivM")) {
+ if (file_exists("$sivP/$sivM") and ($_POST['set'] == "sivM")) {
- $sivMs = file_get_contents("$sivP/$sieve");
- $sivMt = file_get_contents("$sivP/$sivM");
+ $sivMs = file_get_contents("$sivP/$sieve");
+ $sivMt = file_get_contents("$sivP/$sivM");
- $fp = fopen("$sivP/$sieve","w");
- fwrite($fp,$sivMt);
- fclose($fp);
+ $fp = fopen("$sivP/$sieve","w");
+ fwrite($fp,$sivMt);
+ fclose($fp);
- $fp = fopen("$sivP/$sivM","w");
- fwrite($fp,$sivMs);
- fclose($fp);
- }
+ $fp = fopen("$sivP/$sivM","w");
+ fwrite($fp,$sivMs);
+ fclose($fp);
}
+ }
- if (file_exists("$sivP/$sieve") and ($_POST['set'] == "sivD")) {
- unlink("$sivP/$sieve");
- }
+ if (file_exists("$sivP/$sieve") and ($_POST['set'] == "sivD")) {
+ unlink("$sivP/$sieve");
}
+ }
- echo "<div class=\"spacer\"></div>";
- echo "<div class=\"message\" style=\"padding: 0;\">";
- echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"1\" width=\"100%\">";
- echo "<form method=\"post\"><input type=\"hidden\" name=\"set\" value=\"filters\"><tr>";
- echo "<td width=\"200\"><select class=\"input\" name=\"sieveT\">";
- echo "<option value=\"subject\">If message subject contains</option>";
- echo "<option value=\"from\">If message from contains</option>";
- echo "<option value=\"to\">If message to contains</option>";
- echo "<option value=\"cc\">If message cc contains</option>";
- echo "</td>";
- echo "<td><input class=\"input\" type=\"text\" name=\"sieveV\" autocomplete=\"off\" required></td>";
- echo "<td><select class=\"input\" name=\"sieveF\"><option value=\"Trash\" selected>then move to Trash</option>";
+ if (($_POST['set'] == "filters") or ($_POST['set'] == "sivD") or ($_POST['set'] == "sivM")) {
+ echo "<div id=\"filters\">";
+ }
+ else {
+ echo "<div id=\"filters\" class=\"hide\">";
+ }
- foreach ($usr_box as $sieveF) {
-
- $sieveF = str_replace($host,"",$sieveF);
-
- echo "<option value=\"$sieveF\">then move to $sieveF</option>";
- }
-
- echo "</select></td>";
- echo "<td><input class=\"button\" type=\"submit\" value=\"add filter\"></td>";
- echo "</tr></form>";
- echo "</table>";
- echo "</div>";
- echo "<div class=\"spacer\"></div>";
+ echo "<div class=\"spacer\"></div>";
+ echo "<div class=\"message\" style=\"padding: 0;\">";
+ echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"1\" width=\"100%\">";
+ echo "<form method=\"post\"><input type=\"hidden\" name=\"set\" value=\"filters\"><tr>";
+ echo "<td width=\"200\"><select class=\"input\" name=\"sieveT\">";
+ echo "<option value=\"subject\">If message subject contains</option>";
+ echo "<option value=\"from\">If message from contains</option>";
+ echo "<option value=\"to\">If message to contains</option>";
+ echo "<option value=\"cc\">If message cc contains</option>";
+ echo "</td>";
+ echo "<td><input class=\"input\" type=\"text\" name=\"sieveV\" autocomplete=\"off\" required></td>";
+ echo "<td><select class=\"input\" name=\"sieveF\"><option value=\"Trash\" selected>then move to Trash</option>";
+
+ foreach ($usr_box as $sieveF) {
+
+ $sieveF = str_replace($host,"",$sieveF);
+
+ echo "<option value=\"$sieveF\">then move to $sieveF</option>";
+ }
- $sivR = glob("$sivP/*.sieve");
+ echo "</select></td>";
+ echo "<td><input class=\"button\" type=\"submit\" value=\"add filter\"></td>";
+ echo "</tr></form>";
+ echo "</table>";
+ echo "</div>";
+ echo "<div class=\"spacer\"></div>";
+
+ $sivR = glob("$sivP/*.sieve");
- if (count($sivR) > 0) {
+ if (count($sivR) > 0) {
- $sivW = 'require "include";';
+ $sivW = 'require "include";';
- echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"2\" bgcolor=\"#cccccc\">";
+ echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"2\" bgcolor=\"#cccccc\">";
- foreach ($sivR as $sivK => $sivS) {
+ foreach ($sivR as $sivK => $sivS) {
- if ($bgColor == "#ffffff") {
- $bgColor = "#fdfdfd";
- }
- else {
- $bgColor = "#ffffff";
- }
+ if ($bgColor == "#ffffff") {
+ $bgColor = "#fdfdfd";
+ }
+ else {
+ $bgColor = "#ffffff";
+ }
- if ($sivK > 0) {
+ if ($sivK > 0) {
- $sivKp = $sivK - 1;
+ $sivKp = $sivK - 1;
- if (array_key_exists($sivKp,$sivR)) {
- $sivKp = basename($sivR[$sivKp]);
- }
- else {
- unset($sivKp);
- }
+ if (array_key_exists($sivKp,$sivR)) {
+ $sivKp = basename($sivR[$sivKp]);
}
+ else {
+ unset($sivKp);
+ }
+ }
- if ($sivK < count($sivR)) {
+ if ($sivK < count($sivR)) {
- $sivKn = $sivK + 1;
+ $sivKn = $sivK + 1;
- if (array_key_exists($sivKn,$sivR)) {
- $sivKn = basename($sivR[$sivKn]);
- }
- else {
- unset($sivKn);
- }
+ if (array_key_exists($sivKn,$sivR)) {
+ $sivKn = basename($sivR[$sivKn]);
+ }
+ else {
+ unset($sivKn);
}
+ }
- $sivC = (explode('"',file_get_contents($sivS)));
- $sivF = basename($sivS);
-
- $sivW = $sivW . "\r\ninclude \"" . str_replace(".sieve","",$sivF) . '";';
-
+ $sivC = (explode('"',file_get_contents($sivS)));
+ $sivF = basename($sivS);
+
+ $sivW = $sivW . "\r\ninclude \"" . str_replace(".sieve","",$sivF) . '";';
+
+ echo "<form method=\"post\">";
+ echo "<input type=\"hidden\" name=\"set\" value=\"sivD\">";
+ echo "<input type=\"hidden\" name=\"sieve\" value=\"$sivF\">";
+ echo "<tr bgcolor=\"$bgColor\">";
+ echo "<td valign=\"bottom\" width=\"24\"><input type=\"image\" src=\"images/sieve-del.png\"></td>";
+ echo "</form>";
+
+ if ($sivKp) {
echo "<form method=\"post\">";
- echo "<input type=\"hidden\" name=\"set\" value=\"sivD\">";
+ echo "<input type=\"hidden\" name=\"set\" value=\"sivM\">";
echo "<input type=\"hidden\" name=\"sieve\" value=\"$sivF\">";
- echo "<tr bgcolor=\"$bgColor\">";
- echo "<td valign=\"bottom\" width=\"24\"><input type=\"image\" src=\"images/sieve-del.png\"></td>";
+ echo "<input type=\"hidden\" name=\"sivM\" value=\"$sivKp\">";
+ echo "<td valign=\"bottom\" width=\"24\"><input type=\"image\" src=\"images/sieve-up.png\"></td>";
echo "</form>";
-
- if ($sivKp) {
- echo "<form method=\"post\">";
- echo "<input type=\"hidden\" name=\"set\" value=\"sivM\">";
- echo "<input type=\"hidden\" name=\"sieve\" value=\"$sivF\">";
- echo "<input type=\"hidden\" name=\"sivM\" value=\"$sivKp\">";
- echo "<td valign=\"bottom\" width=\"24\"><input type=\"image\" src=\"images/sieve-up.png\"></td>";
- echo "</form>";
- }
- else {
- if (count($sivR) > 1) {
- echo "<td></td>";
- }
+ }
+ else {
+ if (count($sivR) > 1) {
+ echo "<td></td>";
}
+ }
- if ($sivKn) {
- echo "<form method=\"post\">";
- echo "<input type=\"hidden\" name=\"set\" value=\"sivM\">";
- echo "<input type=\"hidden\" name=\"sieve\" value=\"$sivF\">";
- echo "<input type=\"hidden\" name=\"sivM\" value=\"$sivKn\">";
- echo "<td valign=\"bottom\" width=\"24\"><input type=\"image\" src=\"images/sieve-down.png\"></td>";
- echo "</form>";
- }
- else {
- if (count($sivR) > 1) {
- echo "<td></td>";
- }
+ if ($sivKn) {
+ echo "<form method=\"post\">";
+ echo "<input type=\"hidden\" name=\"set\" value=\"sivM\">";
+ echo "<input type=\"hidden\" name=\"sieve\" value=\"$sivF\">";
+ echo "<input type=\"hidden\" name=\"sivM\" value=\"$sivKn\">";
+ echo "<td valign=\"bottom\" width=\"24\"><input type=\"image\" src=\"images/sieve-down.png\"></td>";
+ echo "</form>";
+ }
+ else {
+ if (count($sivR) > 1) {
+ echo "<td></td>";
}
- echo "<td>If message {$sivC[3]} contains {$sivC[5]} then move to {$sivC[7]}</td>";
- echo "</tr>";
}
+ echo "<td>If message {$sivC[3]} contains {$sivC[5]} then move to {$sivC[7]}</td>";
+ echo "</tr>";
+ }
- echo "</table>";
+ echo "</table>";
+ echo "</div>";
- if ($sivW != file_get_contents("$sivP/.dovecot.sieve")) {
-
- $fp = fopen("$sivP/.dovecot.sieve","w");
- fwrite($fp,$sivW);
- fclose($fp);
- }
+ if ($sivW != file_get_contents("$sivP/.dovecot.sieve")) {
+
+ $fp = fopen("$sivP/.dovecot.sieve","w");
+ fwrite($fp,$sivW);
+ fclose($fp);
}
- else {
- if (file_exists("$sivP/.dovecot.sieve")) {
+ }
+ else {
+ if (file_exists("$sivP/.dovecot.sieve")) {
unlink("$sivP/.dovecot.sieve");
- }
+ }
- if (file_exists("$sivP/.dovecot.svbin")) {
+ if (file_exists("$sivP/.dovecot.svbin")) {
unlink("$sivP/.dovecot.svbin");
- }
}
}
}
diff --git a/read.php b/read.php
index 19d12c5..ca2c68f 100644
--- a/read.php
+++ b/read.php
@@ -78,6 +78,33 @@ if (isset($_POST['msg']) and !empty($_POST['msg']) and is_numeric($_POST['msg'])
echo "<div class=\"message\">";
+ $fileFrom = extract_emails_from($header_fromaddress);
+ $fileFrom = $fileFrom[0];
+ $fileFrom = sha1($fileFrom);
+
+ $filePic = "";
+
+ if (file_exists("images/contacts/$fileUsr/{$fileFrom}.gif") and !file_exists("images/contacts/$fileUsr/{$fileFrom}.jpg") and !file_exists("images/contacts/$fileUsr/{$fileFrom}.png")) {
+ $filePic = "images/contacts/$fileUsr/{$fileFrom}.gif";
+ }
+
+ if (!file_exists("images/contacts/$fileUsr/{$fileFrom}.gif") and file_exists("images/contacts/$fileUsr/{$fileFrom}.jpg") and !file_exists("images/contacts/$fileUsr/{$fileFrom}.png")) {
+ $filePic = "images/contacts/$fileUsr/{$fileFrom}.jpg";
+ }
+
+ if (!file_exists("images/contacts/$fileUsr/{$fileFrom}.gif") and !file_exists("images/contacts/$fileUsr/{$fileFrom}.jpg") and file_exists("images/contacts/$fileUsr/{$fileFrom}.png")) {
+ $filePic = "images/contacts/$fileUsr/{$fileFrom}.png";
+ }
+
+ if ($filePic != "") {
+
+ $filePicSize = getimagesize($filePic);
+
+ if (($filePicSize[0] > 0) and ($filePicSize[1] > 0)) {
+ echo "<img src=\"$filePic\" border=\"0\" width=\"{$filePicSize[0]}\" height=\"{$filePicSize[1]}\" align=\"right\">";
+ }
+ }
+
echo "<b>Subject: $header_subject</b>";
echo "<br><br>From: $header_fromaddress";
echo "<br>To: $header_toaddress";