Source for file newmail_opt.php

Documentation is available at newmail_opt.php

  1. <?php
  2.  
  3. /**
  4.  * newmails_opt.php - options page
  5.  *
  6.  * Displays all options relating to new mail sounds
  7.  *
  8.  * @copyright &copy; 1999-2006 The SquirrelMail Project Team
  9.  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  10.  * @version $Id: newmail_opt.php,v 1.43 2006/04/05 00:22:09 stekkel Exp $
  11.  * @package plugins
  12.  * @subpackage newmail
  13.  */
  14.  
  15. /**
  16.  * Path for SquirrelMail required files.
  17.  * @ignore
  18.  */
  19. require('../../include/init.php');
  20.  
  21. /** Plugin functions (also loads plugin's config) */
  22. include_once(SM_PATH 'plugins/newmail/functions.php');
  23.  
  24. include_once(SM_PATH 'functions/forms.php');
  25.  
  26. displayPageHeader($color'None');
  27.  
  28. echo html_tag'table''''center'$color[0]'width="95%" cellpadding="1" cellspacing="0" border="0"' "\n" .
  29.         html_tag'tr' "\n" .
  30.             html_tag'td''''center' .
  31.                 '<b>' _("Options"' - ' _("New Mail Notification""</b><br />\n" .
  32.                 html_tag'table''''''''width="100%" cellpadding="5" cellspacing="0" border="0"' "\n" .
  33.                     html_tag'tr' "\n" .
  34.                         html_tag'td''''left'$color[4"<br />\n";
  35.  
  36. echo html_tag'p',_("The NewMail plugin will follow the Folder Preferences option &quot;Enable Unread Message Notification&quot;")) "\n" .
  37.      html_tag'p',
  38.         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;')
  39.      "\n" .
  40.      html_tag'p',
  41.         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;')
  42.      "\n" .
  43.      html_tag'p',
  44.         sprintf(_("Selecting the %s option will change the title in some browsers to let you know when you have new mail (requires JavaScript, and only works in IE but you won't see errors with other browsers). 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;')
  45.      "\n";
  46. if ($newmail_allowsound{
  47.     echo html_tag'p',
  48.             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;')
  49.          "\n" .
  50.          html_tag'p',
  51.             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;')
  52.          "\n";
  53. }
  54.  
  55. echo '</td></tr>' .
  56.         html_tag'tr' .
  57.             html_tag'td''''center'$color[4"\n" '<hr style="width: 25%; height: 1px;" />' "\n";
  58.  
  59. echo '<form action="'.sqm_baseuri().'src/options.php" method="post" enctype="multipart/form-data">' "\n" .
  60.         html_tag'table''''''''width="100%" cellpadding="5" cellspacing="0" border="0"' "\n";
  61.  
  62. /* newmail_unseen_notify */
  63. $newmail_unseen_opts array=> _("Follow folder preferences"),
  64.                               SMPREF_UNSEEN_INBOX => _("INBOX"),
  65.                               SMPREF_UNSEEN_ALL => _("All folders"),
  66.                               SMPREF_UNSEEN_SPECIAL => _("Special folders"),
  67.                               SMPREF_UNSEEN_NORMAL => _("Regular folders"));
  68. echo html_tag('tr',
  69.               html_tag('td',_("Check for new messages in:"),'right''''style="white-space: nowrap;"').
  70.               html_tag('td',addSelect('newmail_unseen_notify',$newmail_unseen_opts,$newmail_unseen_notify,true),'left')
  71.               );
  72.  
  73. // Option: media_recent
  74. echo html_tag'tr' .
  75.         html_tag'td'_("Count only messages that are RECENT").':''right''''style="white-space: nowrap;"' .
  76.             html_tag'td''''left' .
  77.                 '<input type="checkbox" ';
  78. if ($newmail_recent == 'on'{
  79.     echo 'checked="checked" ';
  80. }
  81. echo 'name="media_recent" /></td></tr>' "\n";
  82.  
  83. // Option: media_changetitle
  84. echo html_tag'tr' .
  85.         html_tag'td'_("Change title on supported browsers").':''right''''style="white-space: nowrap;"' .
  86.             html_tag'td''''left' .
  87.                 '<input type="checkbox" ';
  88. if ($newmail_changetitle == 'on'{
  89.     echo 'checked="checked" ';
  90. }
  91. echo 'name="media_changetitle" />&nbsp;<small>('._("requires JavaScript to work").')</small></td></tr>' "\n";
  92.  
  93. // Option: media_popup
  94. echo html_tag'tr' .
  95.         html_tag'td'_("Show popup window on new mail").':''right''''style="white-space: nowrap;"' .
  96.             html_tag'td''''left' .
  97.                 '<input type="checkbox" ';
  98. if($newmail_popup == 'on'{
  99.     echo 'checked="checked" ';
  100. }
  101. echo 'name="media_popup" />&nbsp;<small>('._("requires JavaScript to work").')</small></td></tr>' "\n";
  102.  
  103. echo html_tag'tr' )
  104.      . html_tag('td',_("Width of popup window:"),'right','''style="white-space: nowrap;"')
  105.      . html_tag('td','<input type="text" name="popup_width" value="'
  106.                 . (int)$newmail_popup_width '" size="3" maxlengh="3" />'
  107.                 . '&nbsp;<small>(' _("If set to 0, reverts to default value"')</small>','left')
  108.      . "</tr>\n";
  109.  
  110. echo html_tag'tr' )
  111.      . html_tag('td',_("Height of popup window:"),'right','''style="white-space: nowrap;"')
  112.      . html_tag('td','<input type="text" name="popup_height" value="'
  113.                 . (int)$newmail_popup_height '" size="3" maxlengh="3" />'
  114.                 . '&nbsp;<small>(' _("If set to 0, reverts to default value"')</small>','left')
  115.      . "</tr>\n";
  116.  
  117. if ($newmail_allowsound{
  118. // Option: media_enable
  119.         echo html_tag'tr' .
  120.             html_tag'td'_("Enable Media Playing").':''right''''style="white-space: nowrap;"' .
  121.                 html_tag'td''''left' .
  122.                     '<input type="checkbox" ';
  123.     if ($newmail_media_enable == 'on'{
  124.         echo 'checked="checked" ';
  125.     }
  126.     echo 'name="media_enable" /></td></tr>' "\n";
  127.  
  128. // Option: media_sel
  129.         echo html_tag'tr' .
  130.         html_tag'td'_("Select server file").':''right''''style="white-space: nowrap;"' .
  131.             html_tag'td''''left' .
  132.                 '<select name="media_sel">' "\n" .
  133.                     '<option value="(none)"';
  134.     if $newmail_media == '(none)'{
  135.         echo 'selected="selected" ';
  136.     }
  137.     echo '>' _("(none)"'</option>' .  "\n";
  138.     // Iterate sound files for options
  139.         $d dir(SM_PATH 'plugins/newmail/sounds');
  140.     while($entry=$d->read()) {
  141.         // $fname = get_location () . '/sounds/' . $entry;
  142.                 if ($entry != '..' && $entry != '.' && $entry != 'CVS' && $entry != 'index.php'{
  143.             echo '<option ';
  144.             if ($entry == $newmail_media{
  145.                 echo 'selected="selected" ';
  146.             }
  147.             echo 'value="' htmlspecialchars($entry'">' .
  148.                 htmlspecialchars($entry"</option>\n";
  149.         }
  150.     }
  151.     $d->close();
  152.     // display media selection
  153.         foreach($newmail_mmedia as $newmail_mm_name => $newmail_mm_data{
  154.         echo '<option ';
  155.         if ($newmail_media=='mmedia_' $newmail_mm_name{
  156.             echo 'selected="selected" ';
  157.         }
  158.         echo 'value="mmedia_' $newmail_mm_name '">'
  159.             .htmlspecialchars($newmail_mm_name"</option>\n";
  160.     }
  161.  
  162.     if($newmail_uploadsounds{
  163.         // display local file option
  164.                 echo '<option ';
  165.         if ($newmail_media=='(userfile)'{
  166.             echo 'selected="selected" ';
  167.         }
  168.         echo 'value="(userfile)">'.
  169.             _("uploaded media file""</option>\n";
  170.         // end of local file option
  171.         }
  172.  
  173.     // Set media file name
  174.         if ($newmail_media == '(none)'{
  175.         $media_output _("none");
  176.     elseif ($newmail_media == '(userfile)'{
  177.         $media_output basename($newmail_userfile_name);
  178.     elseif (preg_match("/^mmedia_+/",$newmail_media)) {
  179.         $media_output preg_replace("/^mmedia_/",'',$newmail_media);
  180.     else {
  181.         $media_output basename($newmail_media);
  182.     }
  183.  
  184.     echo '</select>'.
  185.         '<input type="submit" value="' _("Try"'" name="test" onclick="' .
  186.             "window.open('testsound.php?sound='+media_sel.options[media_sel.selectedIndex].value, 'TestSound'," .
  187.             "'width=150,height=30,scrollbars=no');" .
  188.             'return false;' .
  189.             '" /></td></tr>';
  190.     if ($newmail_uploadsounds{
  191.         // upload form
  192.                 echo  html_tag('tr')
  193.             . html_tag('td',_("Upload Media File:"),'right','','style="white-space: nowrap;"')
  194.             . html_tag('td','<input type="file" size="40" name="media_file">')
  195.             . "</tr>\n";
  196.         // display currently uploaded file information
  197.                 echo  html_tag('tr')
  198.             . html_tag('td',_("Uploaded Media File:"),'right','','style="white-space: nowrap;"')
  199.             . html_tag('td',($newmail_userfile_name!='' htmlspecialchars($newmail_userfile_name_("unavailable")))
  200.             ."</tr>\n";
  201.     
  202.         if ($newmail_userfile_name!=''{
  203.             echo '<tr>'
  204.                 .'<td colspan="2" align="center">'
  205.                 .sprintf(_("Media file %s will be removed, if you upload other media file."),basename($newmail_userfile_name))
  206.                 .'</td></tr>';
  207.         }
  208.     }
  209.     echo html_tag'tr'"\n" .
  210.                 html_tag'td'_("Current File:")'right''''style="white-space: nowrap;"' .
  211.                     html_tag'td''<input type="hidden" value="' .
  212.                         htmlspecialchars($newmail_media'" name="media_default" />' .
  213.                         htmlspecialchars($media_output'''left' )
  214.              "\n";
  215. }
  216. echo html_tag'tr'"\n" .
  217.     html_tag'td''&nbsp;' .
  218.         html_tag'td',
  219.             '<input type="hidden" name="optmode" value="submit" />' .
  220.             '<input type="hidden" name="optpage" value="newmail" />' .
  221.             '<input type="submit" value="' _("Submit"'" name="submit_newmail" />',
  222.         'left' )
  223.      "\n";
  224. ?>
  225. </table></form></td></tr></table></td></tr></table></body></html>

Documentation generated on Sat, 07 Oct 2006 16:12:40 +0300 by phpDocumentor 1.3.0RC6