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

Documentation generated on Mon, 13 Jan 2020 04:23:11 +0100 by phpDocumentor 1.4.3