This commit has been accessed 589 times via Git panel.
commit 33e23f79674afd5f50b9d5b1153641f3f0981235
tree 14cb2afddd86761a1995b9decedc34c22461c5f3
parent 3e7f70d0ffacde4a88e40cc981192ac899f22423
author Engels Antonio <engels@majcms.org> 1333782217 +0800
committer Engels Antonio <engels@majcms.org> 1333782217 +0800
Add folder create and delete options
diff --git a/index.php b/index.php
index 0e5b2ab..0570a9a 100644
--- a/index.php
+++ b/index.php
@@ -830,6 +830,21 @@ if (isset($_SESSION['logged_uid'])) {
$mbox = @imap_open("{$host}$folder", $_SESSION['logged_uid'], $_SESSION['logged_key'], CL_EXPUNGE) or die(imap_last_error());
+ if (isset($_POST['fnew_name']) and !empty($_POST['fnew_name'])) {
+
+ $fnew_name = imap_utf7_encode(ucwords(strtolower(trim(preg_replace("/[^a-z0-9 ]/i","",strip_tags($_POST['fnew_name']))))));
+ imap_createmailbox($mbox,"{$host}$fnew_name");
+ }
+
+ if (isset($_POST['fdel_name']) and !empty($_POST['fdel_name'])) {
+
+ $fdel_name = imap_utf7_encode(ucwords(strtolower(trim(preg_replace("/[^a-z0-9 ]/i","",strip_tags($_POST['fdel_name']))))));
+
+ if (($fdel_name != "INBOX") and ($fdel_name != "Sent") and ($fdel_name != "Trash")) {
+ imap_deletemailbox($mbox,"{$host}$fdel_name");
+ }
+ }
+
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
if (isset($_POST['reply_from']) and isset($_POST['reply_to']) and isset($_POST['reply_subj']) and isset($_POST['reply_body']) and !empty($_POST['reply_from']) and !empty($_POST['reply_to']) and !empty($_POST['reply_subj']) and !empty($_POST['reply_body'])) {
@@ -990,6 +1005,36 @@ if (isset($_SESSION['logged_uid'])) {
echo "<tr bgcolor=\"#ffffff\"><td><input class=\"button\" type=\"submit\" value=\"update\"></td><td></td></tr>";
echo "</form></table>";
+
+ echo "<br><table border=\"0\" cellspacing=\"1\" cellpadding=\"1\" width=\"800\">";
+ echo "<form method=\"post\">";
+ echo "<input type=\"hidden\" name=\"set\" value=\"1\">";
+ echo "<tr bgcolor=\"#ffffff\"><td width=\"200\"><input class=\"input\" type=\"text\" name=\"fnew_name\" 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>";
+
+ $fdel_mbox = imap_list($mbox,$host,"*");
+ $fdel_mbox = array_diff($fdel_mbox,array("{$host}INBOX","{$host}Sent","{$host}Trash"));
+
+ if (count($fdel_mbox) > 0) {
+
+ sort($fdel_mbox);
+
+ echo "<form method=\"post\">";
+ echo "<input type=\"hidden\" name=\"set\" value=\"1\">";
+ echo "<tr bgcolor=\"#ffffff\"><td width=\"200\"><select class=\"input\" name=\"fdel_name\">";
+
+ foreach ($fdel_mbox as $fdel_name) {
+
+ $fdel_name = imap_utf7_decode(str_replace($host,"",$fdel_name));
+
+ echo "<option value=\"$fdel_name\">$fdel_name</option>";
+ }
+
+ echo "</select></td><td width=\"197\"><input class=\"button\" type=\"submit\" value=\"delete folder\"></td><td></td></tr>";
+ echo "</form>";
+ }
+ echo "</table>";
}
else {
include("inbox.php");
tree 14cb2afddd86761a1995b9decedc34c22461c5f3
parent 3e7f70d0ffacde4a88e40cc981192ac899f22423
author Engels Antonio <engels@majcms.org> 1333782217 +0800
committer Engels Antonio <engels@majcms.org> 1333782217 +0800
Add folder create and delete options
diff --git a/index.php b/index.php
index 0e5b2ab..0570a9a 100644
--- a/index.php
+++ b/index.php
@@ -830,6 +830,21 @@ if (isset($_SESSION['logged_uid'])) {
$mbox = @imap_open("{$host}$folder", $_SESSION['logged_uid'], $_SESSION['logged_key'], CL_EXPUNGE) or die(imap_last_error());
+ if (isset($_POST['fnew_name']) and !empty($_POST['fnew_name'])) {
+
+ $fnew_name = imap_utf7_encode(ucwords(strtolower(trim(preg_replace("/[^a-z0-9 ]/i","",strip_tags($_POST['fnew_name']))))));
+ imap_createmailbox($mbox,"{$host}$fnew_name");
+ }
+
+ if (isset($_POST['fdel_name']) and !empty($_POST['fdel_name'])) {
+
+ $fdel_name = imap_utf7_encode(ucwords(strtolower(trim(preg_replace("/[^a-z0-9 ]/i","",strip_tags($_POST['fdel_name']))))));
+
+ if (($fdel_name != "INBOX") and ($fdel_name != "Sent") and ($fdel_name != "Trash")) {
+ imap_deletemailbox($mbox,"{$host}$fdel_name");
+ }
+ }
+
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
if (isset($_POST['reply_from']) and isset($_POST['reply_to']) and isset($_POST['reply_subj']) and isset($_POST['reply_body']) and !empty($_POST['reply_from']) and !empty($_POST['reply_to']) and !empty($_POST['reply_subj']) and !empty($_POST['reply_body'])) {
@@ -990,6 +1005,36 @@ if (isset($_SESSION['logged_uid'])) {
echo "<tr bgcolor=\"#ffffff\"><td><input class=\"button\" type=\"submit\" value=\"update\"></td><td></td></tr>";
echo "</form></table>";
+
+ echo "<br><table border=\"0\" cellspacing=\"1\" cellpadding=\"1\" width=\"800\">";
+ echo "<form method=\"post\">";
+ echo "<input type=\"hidden\" name=\"set\" value=\"1\">";
+ echo "<tr bgcolor=\"#ffffff\"><td width=\"200\"><input class=\"input\" type=\"text\" name=\"fnew_name\" 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>";
+
+ $fdel_mbox = imap_list($mbox,$host,"*");
+ $fdel_mbox = array_diff($fdel_mbox,array("{$host}INBOX","{$host}Sent","{$host}Trash"));
+
+ if (count($fdel_mbox) > 0) {
+
+ sort($fdel_mbox);
+
+ echo "<form method=\"post\">";
+ echo "<input type=\"hidden\" name=\"set\" value=\"1\">";
+ echo "<tr bgcolor=\"#ffffff\"><td width=\"200\"><select class=\"input\" name=\"fdel_name\">";
+
+ foreach ($fdel_mbox as $fdel_name) {
+
+ $fdel_name = imap_utf7_decode(str_replace($host,"",$fdel_name));
+
+ echo "<option value=\"$fdel_name\">$fdel_name</option>";
+ }
+
+ echo "</select></td><td width=\"197\"><input class=\"button\" type=\"submit\" value=\"delete folder\"></td><td></td></tr>";
+ echo "</form>";
+ }
+ echo "</table>";
}
else {
include("inbox.php");