Source for file newmail_opt.php

Documentation is available at newmail_opt.php

  1. <?php
  2.  
  3. /**
  4.  * newmails_opt.php
  5.  *
  6.  * Copyright (c) 1999-2020 The SquirrelMail Project Team
  7.  * Licensed under the GNU GPL. For full terms see the file COPYING.
  8.  *
  9.  * Displays all options relating to new mail sounds
  10.  *
  11.  * $Id: newmail_opt.php 14840 2020-01-07 07:42:38Z pdontthink $
  12.  * @package plugins
  13.  * @subpackage newmail
  14.  */
  15.  
  16. /** @ignore */
  17. define('SM_PATH','../../');
  18.  
  19. /* SquirrelMail required files. */
  20. require_once(SM_PATH 'include/validate.php');
  21. require_once(SM_PATH 'functions/page_header.php');
  22. require_once(SM_PATH 'functions/display_messages.php');
  23. require_once(SM_PATH 'functions/imap.php');
  24. require_once(SM_PATH 'include/load_prefs.php');
  25.  
  26. displayPageHeader($color'None');
  27.  
  28. $media_enable getPref($data_dir,$username'newmail_enable''FALSE' );
  29. $media_popup getPref($data_dir$username,'newmail_popup');
  30. $media_allbox getPref($data_dir,$username,'newmail_allbox');
  31. $media_recent getPref($data_dir,$username,'newmail_recent');
  32. $media_changetitle getPref($data_dir,$username,'newmail_changetitle');
  33. $newmail_popup_height getPref($data_dir$username'newmail_popup_height',130);
  34. $newmail_popup_width getPref($data_dir$username'newmail_popup_width',200);
  35. $media getPref($data_dir,$username,'newmail_media''(none)');
  36.  
  37. // Set $allowsound to false if you don't want sound files available
  38. $allowsound "true";
  39.  
  40. echo html_tag'table''''center'$color[0]'width="95%" cellpadding="1" cellspacing="0" border="0"' "\n" .
  41.         html_tag'tr' "\n" .
  42.             html_tag'td''''center' .
  43.                 '<b>' _("Options"' - ' _("New Mail Notification""</b><br />\n" .
  44.                 html_tag'table''''''''width="100%" cellpadding="5" cellspacing="0" border="0"' "\n" .
  45.                     html_tag'tr' "\n" .
  46.                         html_tag'td''''left'$color[4"<br />\n";
  47.  
  48. echo html_tag'p',
  49.         sprintf(_("The %s option will check ALL of your folders for unseen mail, not just the inbox for notification.")'&quot;'._("Check all boxes, not just INBOX").'&quot;')
  50.      "\n" .
  51.      html_tag'p',
  52.         sprintf(_("Selecting the %s option will enable the showing of a popup window when unseen mail is in your folders (requires JavaScript).")'&quot;'._("Show popup window on new mail").'&quot;')
  53.      "\n" .
  54.      html_tag'p',
  55.         sprintf(_("Use the %s option to only check for messages that are recent. Recent messages are those that have just recently showed up and have not been \"viewed\" or checked yet. This can prevent being continuously annoyed by sounds or popups for unseen mail.")'&quot;'._("Count only messages that are RECENT").'&quot;')
  56.      "\n" .
  57.      html_tag'p',
  58.         sprintf(_("Selecting the %s option will change the title in some browsers to let you know when you have new mail (requires JavaScript). This will always tell you if you have new mail, even if you have %s enabled.")'&quot;'._("Change title on supported browsers").'&quot;''&quot;'._("Count only messages that are RECENT").'&quot;')
  59.      "\n";
  60. if ($allowsound == "true"{
  61.     echo html_tag'p',
  62.             sprintf(_("Select %s to turn on playing a media file when unseen mail is in your folders. When enabled, you can specify the media file to play in the provided file box.")'&quot;'._("Enable Media Playing").'&quot;')
  63.          "\n" .
  64.          html_tag'p',
  65.             sprintf(_("Select from the list of %s the media file to play when new mail arrives. If no file is specified, %s, no sound will be used.")'&quot;'._("Select server file").'&quot;''&quot;'._("(none)").'&quot;')
  66.          "\n";
  67. }
  68.  
  69. echo '</td></tr>' .
  70.         html_tag'tr' .
  71.             html_tag'td''''center'$color[4"\n" '<hr style="width: 25%; height: 1px;" />' "\n";
  72.  
  73. echo '<form action="'.sqm_baseuri().'src/options.php" method="post">' "\n" .
  74.         '<input type="hidden" name="smtoken" value="' sm_generate_security_token('">' "\n" .
  75.         html_tag'table''''''''width="100%" cellpadding="5" cellspacing="0" border="0"' "\n";
  76.  
  77. // Option: media_allbox
  78. echo html_tag'tr' .
  79.         html_tag'td'_("Check all boxes, not just INBOX").':''right''''nowrap' .
  80.             html_tag'td''''left' .
  81.                 '<input type="checkbox" ';
  82. if ($media_allbox == 'on'{
  83.     echo 'checked="checked" ';
  84. }
  85. echo 'name="media_allbox" /></td></tr>' "\n";
  86.  
  87. // Option: media_recent
  88. echo html_tag'tr' .
  89.         html_tag'td'_("Count only messages that are RECENT").':''right''''nowrap' .
  90.             html_tag'td''''left' .
  91.                 '<input type="checkbox" ';
  92. if ($media_recent == 'on'{
  93.     echo 'checked="checked" ';
  94. }
  95. echo 'name="media_recent" /></td></tr>' "\n";
  96.  
  97. // Option: media_changetitle
  98. echo html_tag'tr' .
  99.         html_tag'td'_("Change title on supported browsers").':''right''''nowrap' .
  100.             html_tag'td''''left' .
  101.                 '<input type="checkbox" ';
  102. if ($media_changetitle == 'on'{
  103.     echo 'checked="checked" ';
  104. }
  105. echo 'name="media_changetitle" />&nbsp;('._("requires JavaScript to work").')</td></tr>' "\n";
  106.  
  107. // Option: media_popup
  108. echo html_tag'tr' .
  109.         html_tag'td'_("Show popup window on new mail").':''right''''nowrap' .
  110.             html_tag'td''''left' .
  111.                 '<input type="checkbox" ';
  112. if($media_popup == 'on'{
  113.     echo 'checked="checked" ';
  114. }
  115. echo 'name="media_popup" />&nbsp;('._("requires JavaScript to work").')</td></tr>' "\n";
  116.  
  117. echo html_tag'tr' )
  118.      . html_tag('td',_("Width of popup window:"),'right','''style="white-space: nowrap;"')
  119.      . html_tag('td','<input type="text" name="popup_width" value="'
  120.                 . (int)$newmail_popup_width '" size="3" maxlength="3" />'
  121.                 . '&nbsp;<small>(' _("If set to 0, reverts to default value"')</small>','left')
  122.      . "</tr>\n";
  123.  
  124. echo html_tag'tr' )
  125.      . html_tag('td',_("Height of popup window:"),'right','''style="white-space: nowrap;"')
  126.      . html_tag('td','<input type="text" name="popup_height" value="'
  127.                 . (int)$newmail_popup_height '" size="3" maxlength="3" />'
  128.                 . '&nbsp;<small>(' _("If set to 0, reverts to default value"')</small>','left')
  129.      . "</tr>\n";
  130.  
  131.  
  132. if ($allowsound == "true"{
  133. // Option: media_enable
  134.     echo html_tag'tr' .
  135.             html_tag'td'_("Enable Media Playing").':''right''''nowrap' .
  136.                 html_tag'td''''left' .
  137.                     '<input type="checkbox" ';
  138.     if ($media_enable == 'on'{
  139.         echo 'checked="checked" ';
  140.     }
  141.     echo 'name="media_enable" /></td></tr>' "\n";
  142.  
  143. // Option: media_sel
  144.     echo html_tag'tr' .
  145.         html_tag'td'_("Select server file").':''right''''nowrap' .
  146.             html_tag'td''''left' .
  147.                 '<select name="media_sel">' "\n" .
  148.                     '<option value="(none)"';
  149.     if $media == '(none)'{
  150.         echo 'selected="selected" ';
  151.     }
  152.     echo '>' _("(none)"'</option>' .  "\n";
  153.     // Iterate sound files for options
  154.     $d dir(SM_PATH 'plugins/newmail/sounds');
  155.     if ($d{
  156.         while($entry=$d->read()) {
  157.             $fname get_location ('/sounds/' $entry;
  158.             if ($entry != '..' && $entry != '.' && $entry != 'CVS' && $entry != 'index.php'{
  159.                 echo '<option ';
  160.                 if ($fname == $media{
  161.                     echo 'selected="selected" ';
  162.                 }
  163.                 echo 'value="' sm_encode_html_special_chars($fname'">' .
  164.                     sm_encode_html_special_chars($entry"</option>\n";
  165.             }
  166.         }
  167.         $d->close();
  168.     }
  169.     $media_output ($media == '(none)'_("(none)"substr($mediastrrpos($media'/')+1);
  170.     echo '</select>'.
  171.         '<input type="submit" value="' _("Try"'" name="test" onClick="' .
  172.             "window.open('testsound.php?sound='+media_sel.options[media_sel.selectedIndex].value, 'TestSound'," .
  173.             "'width=150,height=30,scrollbars=no');" .
  174.             'return false;' .
  175.             '" /></td></tr>' .
  176.             html_tag'tr'"\n" .
  177.                 html_tag'td'_("Current File:")'right''''nowrap' .
  178.                     html_tag'td''<input type="hidden" value="' .
  179.                         sm_encode_html_special_chars($media'" name="media_default">' .
  180.                         sm_encode_html_special_chars($media_output'''left' )
  181.              "\n";
  182. }
  183. echo html_tag'tr'"\n" .
  184.     html_tag'td''&nbsp;' .
  185.         html_tag'td',
  186.             '<input type="hidden" name="optmode" value="submit" />' .
  187.             '<input type="hidden" name="optpage" value="newmail" />' .
  188.             '<input type="hidden" name="smtoken" value="' sm_generate_security_token('" />' .
  189.             '<input type="submit" value="' _("Submit"'" name="submit_newmail" />',
  190.         'left' )
  191.      "\n";
  192. ?>
  193. </table></form></td></tr></table></td></tr></table></body></html>

Documentation generated on Mon, 13 Jan 2020 04:25:02 +0100 by phpDocumentor 1.4.3