123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- <?php
-
- require_once(dirname(__FILE__) . '/common.php');
-
- $xmlrpc = get_xmlrpc();
- $vacation = $xmlrpc->getProxy('vacation');
-
- $VACCONFTXT = _("I will be away from <date> until <date>. For urgent matters you can contact <contact person>.");
- bindtextdomain('squirrelmail', SM_PATH . 'locale');
- textdomain('squirrelmail');
- $VACCONF = <<<EOM
- $VACCONFTXT
- EOM;
-
- do_header();
-
- $USERID_USERNAME = $username;
- $tmp = preg_split ('/@/', $USERID_USERNAME);
- $USERID_DOMAIN = $tmp[1];
-
- if ($_SERVER['REQUEST_METHOD'] == "GET")
- {
- $details = $vacation->getDetails();
- if($vacation->checkVacation()) {
-
- bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
- textdomain('postfixadmin');
- $tMessage = _("You already have an auto response configured!");
- bindtextdomain('squirrelmail', SM_PATH . 'locale');
- textdomain('squirrelmail');
- bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
- textdomain('postfixadmin');
- echo "<table bgcolor=\"#b8cbdc\" align=\"center\" width=\"95%\" cellpadding=\"1\" cellspacing=\"0\" border=\"0\"><tr>
- <td align=\"center\"><b>". _("Options") ." - ". _("Auto Response") ."</b>
- <table align=\"center\" width=\"100%\" cellpadding=\"5\" cellspacing=\"0\" border=\"0\">
- <tr><td bgcolor=\"$color[4]\" align=\"center\"><br>
- <table align=\"center\" width=\"70%\" cellpadding=\"4\" cellspacing=\"0\" border=\"0\"><tr>
- <td bgcolor=\"$color[3]\" align=\"center\"><b>". _("Auto Response") ."\n
- </b></td></tr><tr>
- <td bgcolor=\"$color[0]\" align=\"center\"><form name=\"vacation\" method=\"post\">
- <table width=\"95%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\">
- <tr>
- <td><center>$tMessage<p></center></td>
- </tr>
- <tr>
- <td> <div align=\"center\">
- <input type=\"submit\" name=\"fBack\" value=\"" . _("Coming Back"). "\" />
- </div></td>
- </tr>
- </table>
- <TT></TT></FORM>
- </td>
- </tr><tr><td bgcolor=\"$color[4]\" align=\"left\"> </td>
- </tr></table><BR></td></tr></table></td></tr></table>";
- bindtextdomain('squirrelmail', SM_PATH . 'locale');
- textdomain('squirrelmail');
- }
- else
- {
- $tSubject = "Out of Office";
- $tSubject = $details['subject'];
- $VACCONF = $details['body'];
-
- $tMessage = '';
- bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
- textdomain('postfixadmin');
- echo "<table bgcolor=\"$color[0]\" align=\"center\" width=\"95%\" cellpadding=\"1\" cellspacing=\"0\" border=\"0\">
- <tr>
- <td align=\"center\"><b>". _("Options") ." - ". _("Auto Response") ." </b>
- <table align=\"center\" width=\"100%\" cellpadding=\"5\" cellspacing=\"0\" border=\"0\">
- <tr><td bgcolor=\"$color[4]\" align=\"center\"><br>
- <table align=\"center\" width=\"70%\" cellpadding=\"4\" cellspacing=\"0\" border=\"0\"><tr>
- <td bgcolor=\"$color[3]\" align=\"center\"><b>" . _("Auto Response") ."\n
- </b></td></tr><tr>
- <td bgcolor=\"$color[0]\" align=\"center\"><form name=\"vacation\" method=\"post\">$tMessage
- <table width=\"95%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\"><tr>
- <td width=\"23%\">". _("Subject") .":\n</td>
- <td width=\"2%\"> </td>
- <td width=\"69%\"><input type=\"text\" name=\"fSubject\" value=\"" . $tSubject . "\" /></td>
- <td width=\"2%\"> </td>
- <td width=\"4%\"> </td>
- </tr><tr>
- <td>". _("Body") .":\n</td>
- <td> </td>
- <td><textarea rows=\"10\" cols=\"80\" name=\"fBody\">$VACCONF\n
- </textarea></td><td> </td><td> </td></tr><tr><td> </td><td> </td>
- <td><input type=\"submit\" name=\"fAway\" value=\"" . _("Going Away") . "\" /></td>
- <td> </td><td> </td></tr>
- </table><TT></TT></FORM></td>
- </tr><tr><td bgcolor=\"$color[4]\" align=\"left\"> </td>
- </tr></table><BR></td></tr></table></td></tr></table>";
- bindtextdomain('squirrelmail', SM_PATH . 'locale');
- textdomain('squirrelmail');
- }
- }
-
- if ($_SERVER['REQUEST_METHOD'] == "POST")
- {
- $fBack = null;
- $fAway = null;
- foreach(array('fBack', 'fAway', 'fSubject', 'fBody') as $key) {
- $$key = null;
- if(isset($_POST[$key])) {
- $$key = $_POST[$key];
- }
- }
-
- if (!empty($fBack))
- {
- $success = $vacation->remove();
-
- if(!$success)
- {
- bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
- textdomain('postfixadmin');
- $tMessage = _("Unable to update your auto response settings!");
- echo "<p>This may signify an error; please contact support (1)</p>";
- bindtextdomain('squirrelmail', SM_PATH . 'locale');
- textdomain('squirrelmail');
- }
- else
- {
- bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
- textdomain('postfixadmin');
- echo "<p align=center><b>". _("Your auto response has been removed!") ."</b></p>";
- bindtextdomain('squirrelmail', SM_PATH . 'locale');
- textdomain('squirrelmail');
-
- }
- }
-
- if (!empty ($fAway))
- {
- // add record into vacation
- $success = $vacation->setAway($fSubject, $fBody);
-
- if(!$success) {
- $error = 1;
- bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
- textdomain('postfixadmin');
- $tMessage = _("Unable to update your auto response settings!");
- bindtextdomain('squirrelmail', SM_PATH . 'locale');
- textdomain('squirrelmail');
- }
- else
- {
- bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
- textdomain('postfixadmin');
- echo "<p align=center><b>". _("Your auto response has been set!") ."</b></p>";
- bindtextdomain('squirrelmail', SM_PATH . 'locale');
- textdomain('squirrelmail');
-
- }
- }
- }
-
- ?>
|