Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

postfixadmin_vacation.php 6.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <?php
  2. require_once(dirname(__FILE__) . '/common.php');
  3. $xmlrpc = get_xmlrpc();
  4. $vacation = $xmlrpc->getProxy('vacation');
  5. $VACCONFTXT = _("I will be away from <date> until <date>. For urgent matters you can contact <contact person>.");
  6. bindtextdomain('squirrelmail', SM_PATH . 'locale');
  7. textdomain('squirrelmail');
  8. $VACCONF = <<<EOM
  9. $VACCONFTXT
  10. EOM;
  11. do_header();
  12. $USERID_USERNAME = $username;
  13. $tmp = preg_split ('/@/', $USERID_USERNAME);
  14. $USERID_DOMAIN = $tmp[1];
  15. if ($_SERVER['REQUEST_METHOD'] == "GET")
  16. {
  17. $details = $vacation->getDetails();
  18. if($vacation->checkVacation()) {
  19. bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
  20. textdomain('postfixadmin');
  21. $tMessage = _("You already have an auto response configured!");
  22. bindtextdomain('squirrelmail', SM_PATH . 'locale');
  23. textdomain('squirrelmail');
  24. bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
  25. textdomain('postfixadmin');
  26. echo "<table bgcolor=\"#b8cbdc\" align=\"center\" width=\"95%\" cellpadding=\"1\" cellspacing=\"0\" border=\"0\"><tr>
  27. <td align=\"center\"><b>". _("Options") ." - ". _("Auto Response") ."</b>
  28. <table align=\"center\" width=\"100%\" cellpadding=\"5\" cellspacing=\"0\" border=\"0\">
  29. <tr><td bgcolor=\"$color[4]\" align=\"center\"><br>
  30. <table align=\"center\" width=\"70%\" cellpadding=\"4\" cellspacing=\"0\" border=\"0\"><tr>
  31. <td bgcolor=\"$color[3]\" align=\"center\"><b>". _("Auto Response") ."\n
  32. </b></td></tr><tr>
  33. <td bgcolor=\"$color[0]\" align=\"center\"><form name=\"vacation\" method=\"post\">
  34. <table width=\"95%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\">
  35. <tr>
  36. <td><center>$tMessage<p></center></td>
  37. </tr>
  38. <tr>
  39. <td> <div align=\"center\">
  40. <input type=\"submit\" name=\"fBack\" value=\"" . _("Coming Back"). "\" />
  41. </div></td>
  42. </tr>
  43. </table>
  44. <TT></TT></FORM>
  45. </td>
  46. </tr><tr><td bgcolor=\"$color[4]\" align=\"left\">&nbsp;</td>
  47. </tr></table><BR></td></tr></table></td></tr></table>";
  48. bindtextdomain('squirrelmail', SM_PATH . 'locale');
  49. textdomain('squirrelmail');
  50. }
  51. else
  52. {
  53. $tSubject = "Out of Office";
  54. $tSubject = $details['subject'];
  55. $VACCONF = $details['body'];
  56. $tMessage = '';
  57. bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
  58. textdomain('postfixadmin');
  59. echo "<table bgcolor=\"$color[0]\" align=\"center\" width=\"95%\" cellpadding=\"1\" cellspacing=\"0\" border=\"0\">
  60. <tr>
  61. <td align=\"center\"><b>". _("Options") ." - ". _("Auto Response") ." </b>
  62. <table align=\"center\" width=\"100%\" cellpadding=\"5\" cellspacing=\"0\" border=\"0\">
  63. <tr><td bgcolor=\"$color[4]\" align=\"center\"><br>
  64. <table align=\"center\" width=\"70%\" cellpadding=\"4\" cellspacing=\"0\" border=\"0\"><tr>
  65. <td bgcolor=\"$color[3]\" align=\"center\"><b>" . _("Auto Response") ."\n
  66. </b></td></tr><tr>
  67. <td bgcolor=\"$color[0]\" align=\"center\"><form name=\"vacation\" method=\"post\">$tMessage
  68. <table width=\"95%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\"><tr>
  69. <td width=\"23%\">". _("Subject") .":\n</td>
  70. <td width=\"2%\">&nbsp;</td>
  71. <td width=\"69%\"><input type=\"text\" name=\"fSubject\" value=\"" . $tSubject . "\" /></td>
  72. <td width=\"2%\">&nbsp;</td>
  73. <td width=\"4%\">&nbsp;</td>
  74. </tr><tr>
  75. <td>". _("Body") .":\n</td>
  76. <td>&nbsp;</td>
  77. <td><textarea rows=\"10\" cols=\"80\" name=\"fBody\">$VACCONF\n
  78. </textarea></td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td>
  79. <td><input type=\"submit\" name=\"fAway\" value=\"" . _("Going Away") . "\" /></td>
  80. <td>&nbsp;</td><td>&nbsp;</td></tr>
  81. </table><TT></TT></FORM></td>
  82. </tr><tr><td bgcolor=\"$color[4]\" align=\"left\">&nbsp;</td>
  83. </tr></table><BR></td></tr></table></td></tr></table>";
  84. bindtextdomain('squirrelmail', SM_PATH . 'locale');
  85. textdomain('squirrelmail');
  86. }
  87. }
  88. if ($_SERVER['REQUEST_METHOD'] == "POST")
  89. {
  90. $fBack = null;
  91. $fAway = null;
  92. foreach(array('fBack', 'fAway', 'fSubject', 'fBody') as $key) {
  93. $$key = null;
  94. if(isset($_POST[$key])) {
  95. $$key = $_POST[$key];
  96. }
  97. }
  98. if (!empty($fBack))
  99. {
  100. $success = $vacation->remove();
  101. if(!$success)
  102. {
  103. bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
  104. textdomain('postfixadmin');
  105. $tMessage = _("Unable to update your auto response settings!");
  106. echo "<p>This may signify an error; please contact support (1)</p>";
  107. bindtextdomain('squirrelmail', SM_PATH . 'locale');
  108. textdomain('squirrelmail');
  109. }
  110. else
  111. {
  112. bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
  113. textdomain('postfixadmin');
  114. echo "<p align=center><b>". _("Your auto response has been removed!") ."</b></p>";
  115. bindtextdomain('squirrelmail', SM_PATH . 'locale');
  116. textdomain('squirrelmail');
  117. }
  118. }
  119. if (!empty ($fAway))
  120. {
  121. // add record into vacation
  122. $success = $vacation->setAway($fSubject, $fBody);
  123. if(!$success) {
  124. $error = 1;
  125. bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
  126. textdomain('postfixadmin');
  127. $tMessage = _("Unable to update your auto response settings!");
  128. bindtextdomain('squirrelmail', SM_PATH . 'locale');
  129. textdomain('squirrelmail');
  130. }
  131. else
  132. {
  133. bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
  134. textdomain('postfixadmin');
  135. echo "<p align=center><b>". _("Your auto response has been set!") ."</b></p>";
  136. bindtextdomain('squirrelmail', SM_PATH . 'locale');
  137. textdomain('squirrelmail');
  138. }
  139. }
  140. }
  141. ?>