4 * SquirrelMail NewMail plugin
8 * @copyright 2001-2011 The SquirrelMail Project Team
9 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
13 * @todo add midi support
17 /** file type defines */
18 define('SM_NEWMAIL_FILETYPE_WAV',2);
19 define('SM_NEWMAIL_FILETYPE_MP3',3);
20 define('SM_NEWMAIL_FILETYPE_OGG',4);
21 define('SM_NEWMAIL_FILETYPE_SWF',5);
22 define('SM_NEWMAIL_FILETYPE_SVG',6);
24 /** load default config */
25 if (file_exists(SM_PATH
. 'plugins/newmail/config_default.php')) {
26 include_once(SM_PATH
. 'plugins/newmail/config_default.php');
30 if (file_exists(SM_PATH
. 'config/newmail_config.php')) {
31 include_once(SM_PATH
. 'config/newmail_config.php');
32 } elseif (file_exists(SM_PATH
. 'plugins/newmail/config.php')) {
33 include_once(SM_PATH
. 'plugins/newmail/config.php');
36 // ----- hooked functions -----
39 * Register newmail option block
41 function newmail_optpage_register_block_function() {
42 // Gets added to the user's OPTIONS page.
43 global $optpage_blocks;
45 /* Register Squirrelspell with the $optionpages array. */
46 $optpage_blocks[] = array(
47 'name' => _("New Mail Options"),
48 'url' => sqm_baseuri() . 'plugins/newmail/newmail_opt.php',
49 'desc' => _("This configures settings for playing sounds and/or showing popup windows when new mail arrives."),
55 * Save newmail plugin settings
57 function newmail_sav_function() {
58 global $data_dir, $username, $_FILES, $newmail_uploadsounds;
60 if ( sqgetGlobalVar('submit_newmail', $submit, SQ_POST
) ) {
64 $media_changetitle = '';
69 sqgetGlobalVar('media_enable', $media_enable, SQ_POST
);
70 sqgetGlobalVar('media_popup', $media_popup, SQ_POST
);
71 sqgetGlobalVar('media_recent', $media_recent, SQ_POST
);
72 sqgetGlobalVar('media_changetitle', $media_changetitle, SQ_POST
);
73 sqgetGlobalVar('popup_width', $popup_width, SQ_POST
);
74 sqgetGlobalVar('popup_height', $popup_height, SQ_POST
);
76 // sanitize height and width
77 $popup_width = (int) $popup_width;
78 if ($popup_width<=0) $popup_width=200;
79 $popup_height = (int) $popup_height;
80 if ($popup_height<=0) $popup_height=130;
82 setPref($data_dir,$username,'newmail_enable',$media_enable);
83 setPref($data_dir,$username,'newmail_popup', $media_popup);
84 setPref($data_dir,$username,'newmail_recent',$media_recent);
85 setPref($data_dir,$username,'newmail_changetitle',$media_changetitle);
86 setPref($data_dir,$username,'newmail_popup_width',$popup_width);
87 setPref($data_dir,$username,'newmail_popup_height',$popup_height);
89 if (sqgetGlobalVar('newmail_unseen_notify', $newmail_unseen_notify, SQ_POST
)) {
90 $newmail_unseen_notify = (int) $newmail_unseen_notify;
91 setPref($data_dir,$username,'newmail_unseen_notify',$newmail_unseen_notify);
94 if( sqgetGlobalVar('media_sel', $media_sel, SQ_POST
) &&
95 $media_sel == '(none)' ) {
96 removePref($data_dir,$username,'newmail_media');
98 setPref($data_dir,$username,'newmail_media',$media_sel);
101 // process uploaded file
102 if ($newmail_uploadsounds && isset($_FILES['media_file']['tmp_name']) && $_FILES['media_file']['tmp_name']!='') {
103 // set temp file and get media file name
104 $newmail_tempmedia=getHashedDir($username, $data_dir) . "/$username.tempsound";
105 $newmail_mediafile=getHashedFile($username, $data_dir, $username . '.sound');
106 if (move_uploaded_file($_FILES['media_file']['tmp_name'], $newmail_tempmedia)) {
107 // new media file is in $newmail_tempmedia
108 if (file_exists($newmail_mediafile)) unlink($newmail_mediafile);
109 if (! rename($newmail_tempmedia,$newmail_mediafile)) {
110 // remove (userfile), if file rename fails
111 removePref($data_dir,$username,'newmail_media');
114 if (isset($_FILES['media_file']['type']) && isset($_FILES['media_file']['name'])) {
115 setPref($data_dir,$username,'newmail_userfile_type',
116 newmail_get_mediatype($_FILES['media_file']['type'],$_FILES['media_file']['name']));
118 removePref($data_dir,$username,'newmail_userfile_type');
121 if (isset($_FILES['media_file']['name'])) {
122 setPref($data_dir,$username,'newmail_userfile_name',basename($_FILES['media_file']['name']));
124 setPref($data_dir,$username,'newmail_userfile_name','mediafile.unknown');
133 * Load newmail plugin settings
135 function newmail_pref_function() {
136 global $username,$data_dir;
137 global $newmail_media,$newmail_media_enable,$newmail_popup;
138 global $newmail_recent, $newmail_changetitle;
139 global $newmail_userfile_type, $newmail_userfile_name;
140 global $newmail_popup_width, $newmail_popup_height;
141 global $newmail_unseen_notify;
143 $newmail_recent = getPref($data_dir,$username,'newmail_recent');
144 $newmail_media_enable = getPref($data_dir,$username,'newmail_enable');
145 $newmail_media = getPref($data_dir, $username, 'newmail_media', '(none)');
146 // remove full location from setting (since SM 1.5.1 plugin uses only filename).
147 if ($newmail_media!='(none)')
148 $newmail_media = basename($newmail_media);
150 $newmail_popup = getPref($data_dir, $username, 'newmail_popup');
151 $newmail_popup_width = getPref($data_dir, $username, 'newmail_popup_width',200);
152 $newmail_popup_height = getPref($data_dir, $username, 'newmail_popup_height',130);
153 $newmail_changetitle = getPref($data_dir, $username, 'newmail_changetitle');
155 $newmail_userfile_type = getPref($data_dir, $username, 'newmail_userfile_type');
156 $newmail_userfile_name = getPref($data_dir,$username,'newmail_userfile_name','');
158 $newmail_unseen_notify = getPref($data_dir,$username,'newmail_unseen_notify',0);
164 * Used by option page when saving settings.
166 function newmail_set_loadinfo_function() {
167 global $optpage, $optpage_name;
168 if ($optpage=='newmail') {
169 $optpage_name=_("New Mail Options");
174 /* Receive the status of the folder and do something with it */
175 function newmail_folder_status($statusarr) {
176 global $newmail_media_enable,$newmail_popup,$newmail_changetitle,$trash_folder,
177 $sent_folder,$totalNewArr, $newmail_unseen_notify, $unseen_notify, $newmail_recent;
179 /* if $newmail_unseen_notify is set to zero, plugin follows $unseen_notify */
180 if ($newmail_unseen_notify == 0)
181 $newmail_unseen_notify = $unseen_notify;
183 $mailbox=$statusarr['MAILBOX'];
185 if (($newmail_media_enable == 'on' ||
186 $newmail_popup == 'on' ||
187 $newmail_changetitle == 'on') &&
189 * make sure that $newmail_unseen_notify is set to supported value,
190 * currently (1.5.2cvs) SMPREF_UNSEEN_NORMAL has highest integer value
191 * in SMPREF_UNSEEN constants
193 ($newmail_unseen_notify > SMPREF_UNSEEN_NONE
&& $newmail_unseen_notify <= SMPREF_UNSEEN_NORMAL
)) {
195 // Skip folders for Sent and Trash
196 // TODO: make this optional
197 if ($statusarr['MAILBOX'] == $sent_folder ||
$statusarr['MAILBOX'] == $trash_folder) {
201 if ((($mailbox == 'INBOX') && ($newmail_unseen_notify == SMPREF_UNSEEN_INBOX
)) ||
202 ($newmail_unseen_notify == SMPREF_UNSEEN_SPECIAL
&& isSpecialMailbox($mailbox)) ||
203 ($newmail_unseen_notify == SMPREF_UNSEEN_NORMAL
&& ! isSpecialMailbox($mailbox)) ||
204 ($newmail_unseen_notify == SMPREF_UNSEEN_ALL
)) {
205 if (($newmail_recent == 'on') && (!empty($statusarr['RECENT']))) {
206 $totalNewArr[$mailbox] = $statusarr['RECENT'];
207 } elseif ($newmail_recent != 'on' && !empty($statusarr['UNSEEN'])) {
208 $totalNewArr[$mailbox] = $statusarr['UNSEEN'];
215 * Insert needed data in left_main
217 function newmail_plugin_function() {
218 global $username, $newmail_media, $newmail_media_enable, $newmail_popup,
219 $newmail_recent, $newmail_changetitle, $imapConnection,
220 $newmail_mmedia, $newmail_allowsound, $newmail_userfile_type,
221 $newmail_popup_width, $newmail_popup_height, $totalNewArr,
222 $newmail_title_bar_singular, $newmail_title_bar_plural,
225 if ($newmail_media_enable == 'on' ||
226 $newmail_popup == 'on' ||
227 $newmail_changetitle) {
231 if (!empty($totalNewArr)) { $totalNew=array_sum($totalNewArr); }
232 else { $totalNew=0; }
234 // If we found unseen messages, then we
235 // will play the sound as follows:
237 if ($newmail_changetitle) {
239 // make sure default strings are in pot file
240 $ignore = _("%s New Message");
241 $ignore = _("%s New Messages");
243 $singular_title = "%s New Message";
244 $plural_title = "%s New Messages";
245 if (!empty($newmail_title_bar_singular))
246 $singular_title = $newmail_title_bar_singular;
247 if (!empty($newmail_title_bar_plural))
248 $plural_title = $newmail_title_bar_plural;
249 list($singular_title, $plural_title) = str_replace(array('###USERNAME###', '###ORG_TITLE###'), array($username, $org_title), array($singular_title, $plural_title));
250 $title = sprintf(ngettext($singular_title, $plural_title, $totalNew), $totalNew);
252 //FIXME: remove HTML from core - put this into a template file
253 $output .= "<script type=\"text/javascript\">\n"
254 . "function ChangeTitleLoad() {\n"
255 . "var BeforeChangeTitle;\n"
256 . 'window.parent.document.title = "'
259 . "if (BeforeChangeTitle != null)\n"
260 . "BeforeChangeTitle();\n"
262 . "BeforeChangeTitle = window.onload;\n"
263 . "window.onload = ChangeTitleLoad;\n"
267 // create media output if there are new email messages
268 if ($newmail_allowsound && $totalNew > 0
269 && $newmail_media_enable == 'on'
270 && $newmail_media != '' ) {
271 //FIXME: remove HTML from core - put this into a template file
272 $output .= newmail_create_media_tags($newmail_media);
275 if ($totalNew > 0 && $newmail_popup == 'on') {
276 //FIXME: remove HTML from core - put this into a template file
277 $output .= "<script type=\"text/javascript\">\n"
279 . "function PopupScriptLoad() {\n"
280 . 'window.open("'.sqm_baseuri().'plugins/newmail/newmail.php?numnew='.$totalNew
282 . "\"width=$newmail_popup_width,height=$newmail_popup_height,scrollbars=no\");\n"
283 . "if (BeforePopupScript != null)\n"
284 . "BeforePopupScript();\n"
286 . "BeforePopupScript = window.onload;\n"
287 . "window.onload = PopupScriptLoad;\n"
292 return array('left_main_after' => $output);
298 // ----- end of hooked functions -----
303 * Function tries to detect if file contents match declared file type
305 * Function returns default extension for detected mime type or 'false'
307 * TODO: use $contents to check if file is in specified type
308 * @param string $contents file contents
309 * @param string $type file mime type
312 function newmail_detect_filetype($contents,$type) {
313 // convert $type to lower case
314 $type=strtolower($type);
325 case 'application/ogg':
328 case 'application/x-shockwave-flash':
331 case 'image/svg+xml':
341 * Function tries to detect uploaded file type
342 * @param string $type
343 * @param string $filename
344 * @return integer One of SM_NEWMAIL_FILETYPE_* defines or false.
346 function newmail_get_mediatype($type,$filename) {
348 // fix for browser's that upload file as application/octet-stream
349 case 'application/octet-stream':
350 $ret=newmail_get_mediatype_by_ext($filename);
353 $ret=SM_NEWMAIL_FILETYPE_WAV
;
356 $ret=SM_NEWMAIL_FILETYPE_MP3
;
358 case 'application/ogg':
359 $ret=SM_NEWMAIL_FILETYPE_OGG
;
361 case 'application/x-shockwave-flash':
362 $ret=SM_NEWMAIL_FILETYPE_SWF
;
364 case 'image/svg+xml':
365 $ret=SM_NEWMAIL_FILETYPE_SVG
;
374 * Function provides filetype detection for browsers, that
375 * upload files with application/octet-stream file type.
376 * Ex. some version of Opera.
377 * @param string $filename
378 * @return integer One of SM_NEWMAIL_FILETYPE_* defines or false.
380 function newmail_get_mediatype_by_ext($filename) {
381 if (preg_match("/\.wav$/i",$filename)) return SM_NEWMAIL_FILETYPE_WAV
;
382 if (preg_match("/\.mp3$/i",$filename)) return SM_NEWMAIL_FILETYPE_MP3
;
383 if (preg_match("/\.ogg$/i",$filename)) return SM_NEWMAIL_FILETYPE_OGG
;
384 if (preg_match("/\.swf$/i",$filename)) return SM_NEWMAIL_FILETYPE_SWF
;
385 if (preg_match("/\.svg$/i",$filename)) return SM_NEWMAIL_FILETYPE_SVG
;
390 * Creates html object tags of multimedia object
392 * Main function that creates multimedia object tags
393 * @param string $object object name
394 * @param integer $type media object type
395 * @param string $path URL to media object
396 * @param array $args media object attributes
397 * @param string $extra tags that have to buried deep inside object tags
398 * @param bool $addsuffix controls addition of suffix to media object url
399 * @return string object html tags and attributes required by selected media type.
401 function newmail_media_objects($object,$types,$path,$args=array(),$extra='',$addsuffix=true) {
402 global $newmail_mediacompat_mode;
404 // first prepare single object for IE
405 $ret = newmail_media_object_ie($object,$types[0],$path,$args,$addsuffix);
407 // W3.org nested objects
408 $ret.= "<!--[if !IE]> <-->\n"; // not for IE
410 foreach ($types as $type) {
411 $ret.= newmail_media_object($object,$type,$path,$args,$addsuffix);
414 if (isset($newmail_mediacompat_mode) && $newmail_mediacompat_mode)
415 $ret.= newmail_media_embed($object,$types[0],$path,$args,$addsuffix);
416 // add $extra code inside objects
421 if (isset($newmail_mediacompat_mode) && $newmail_mediacompat_mode)
422 $ret.= newmail_media_embed_close($types[0]);
424 // close w3.org nested objects
425 foreach (array_reverse($types) as $type) {
426 $ret.= newmail_media_object_close($type);
428 $ret.= "<!--> <![endif]-->\n"; // end non-IE mode
430 $ret.= newmail_media_object_ie_close($types[0]);
436 * Creates object tags of multimedia object for browsers that comply to w3.org
441 * <li>Returned string does not contain html closing tag.
442 * <li>This is internal function, use newmail_media_objects() instead
444 * @link http://www.w3.org/TR/html4/struct/objects.html#edef-OBJECT W3.org specs
445 * @param string $object object name
446 * @param integer $type media object type
447 * @param string $path URL to media object
448 * @param array $args media object attributes
449 * @param bool $addsuffix controls addition of suffix to media object url
450 * @return string object html tags and attributes required by selected media type.
452 function newmail_media_object($object,$type,$path,$args=array(),$addsuffix=true) {
455 $sArgs=newmail_media_prepare_args($args);
458 case SM_NEWMAIL_FILETYPE_SWF
:
459 if ($addsuffix) $suffix='.swf';
460 $ret_w3 = '<object data="' . $path . $object . $suffix . '" '
462 .'type="application/x-shockwave-flash">' . "\n";
464 case SM_NEWMAIL_FILETYPE_WAV
:
465 if ($addsuffix) $suffix='.wav';
466 $ret_w3 = '<object data="' . $path . $object . $suffix . '" '
468 .'type="audio/x-wav">' . "\n";
470 case SM_NEWMAIL_FILETYPE_OGG
:
471 if ($addsuffix) $suffix='.ogg';
472 $ret_w3 = '<object data="' . $path . $object . $suffix . '" '
474 .'type="application/ogg">' . "\n";
476 case SM_NEWMAIL_FILETYPE_MP3
:
477 if ($addsuffix) $suffix='.mp3';
478 $ret_w3 = '<object data="' . $path . $object . $suffix . '" '
480 .'type="audio/mpeg">' . "\n";
482 case SM_NEWMAIL_FILETYPE_SVG
:
483 if ($addsuffix) $suffix='.svg';
484 $ret_w3 = '<object data="' . $path . $object . $suffix . '" '
486 .'type="image/svg+xml">' . "\n";
495 * Creates multimedia object tags for Internet Explorer (Win32)
498 * * Returned string does not contain html closing tag, because
499 * this multimedia object can include other media objects.
500 * * This is internal function, use newmail_media_objects() instead
502 * @param string $object object name
503 * @param integer $type media object type
504 * @param string $path URL to media object
505 * @param array $args media object attributes
506 * @param bool $addsuffix controls addition of suffix to media object url
507 * @return string object html tags and attributes required by selected media type.
508 * @todo add ogg and svg support
510 function newmail_media_object_ie($object,$type,$path,$args=array(),$addsuffix) {
513 $sArgs=newmail_media_prepare_args($args);
516 case SM_NEWMAIL_FILETYPE_SWF
:
517 if ($addsuffix) $suffix='.swf';
518 $ret_ie ='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '
519 .'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" '
520 . $sArgs . 'id="' . $object ."\">\n"
521 .'<param name="movie" value="' . $path . $object . $suffix . "\">\n"
522 .'<param name="hidden" value="true">' . "\n";
524 case SM_NEWMAIL_FILETYPE_WAV
:
525 if ($addsuffix) $suffix='.wav';
526 $ret_ie ='<object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" '
527 .'codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,02,0902" '
528 . $sArgs . 'id="' . $object ."\" \n"
529 .'type="audio/x-wav">' ."\n"
530 .'<param name="FileName" value="' . $path . $object . $suffix . "\">\n";
532 case SM_NEWMAIL_FILETYPE_MP3
:
533 if ($addsuffix) $suffix='.mp3';
534 $ret_ie ='<object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" '
535 .'codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,02,0902" '
536 . $sArgs . 'id="' . $object ."\" \n"
537 .'type="audio/mpeg">' ."\n"
538 .'<param name="FileName" value="' . $path . $object . $suffix . "\">\n";
540 case SM_NEWMAIL_FILETYPE_OGG
:
541 case SM_NEWMAIL_FILETYPE_SVG
:
549 * Creates embed tags of multimedia object
552 * Apple: http://www.apple.com/quicktime/authoring/embed.html
555 * * Returned string does not contain html closing tag.
556 * * embed tags will be created by newmail_media_objects() only
557 * when $newmail_mediacompat_mode option is enabled. Option is not
558 * enabled by default in order to comply to w3.org specs.
559 * * This is internal function, use newmail_media_objects() instead
560 * @link http://www.apple.com/quicktime/authoring/embed.html Info about embed tag
561 * @param string $object object name
562 * @param integer $type media object type
563 * @param string $path URL to media object
564 * @param array $args media object attributes
565 * @param bool $addsuffix controls addition of suffix to media object url
566 * @return string embed html tags and attributes required by selected media type.
568 function newmail_media_embed($object,$type,$path,$args=array(),$addsuffix=true) {
571 $sArgs=newmail_media_prepare_args($args);
574 case SM_NEWMAIL_FILETYPE_SWF
:
575 if ($addsuffix) $suffix='.swf';
576 $ret_embed='<embed src="' . $path . $object . $suffix . '" '. "\n"
577 .'hidden="true" autostart="true" '. "\n"
579 .'name="' . $object .'" ' . "\n"
580 .'type="application/x-shockwave-flash" ' . "\n"
581 .'pluginspage="http://www.macromedia.com/go/getflashplayer">' . "\n";
583 case SM_NEWMAIL_FILETYPE_WAV
:
584 if ($addsuffix) $suffix='.wav';
585 $ret_embed='<embed src="' . $path . $object . $suffix . '" '. "\n"
586 .' hidden="true" autostart="true" '. "\n"
588 .' name="' . $object .'" ' . "\n"
589 .' type="audio/x-wav">' . "\n";
591 case SM_NEWMAIL_FILETYPE_SVG
:
592 if ($addsuffix) $suffix='.svg';
593 $ret_embed='<embed src="' . $path . $object . $suffix . '" '. "\n"
594 .'hidden="true" autostart="true" '. "\n"
596 .'name="' . $object .'" ' . "\n"
597 .'type="image/svg-xml" ' . "\n"
598 .'pluginspage="http://www.adobe.com/svg/viewer/install/">' . "\n";
600 case SM_NEWMAIL_FILETYPE_OGG
:
601 if ($addsuffix) $suffix='.ogg';
602 $ret_embed='<embed src="' . $path . $object . $suffix . '" '. "\n"
603 .' hidden="true" autostart="true" '. "\n"
605 .' name="' . $object .'" ' . "\n"
606 .' type="application/ogg">' . "\n";
608 case SM_NEWMAIL_FILETYPE_MP3
:
609 if ($addsuffix) $suffix='.mp3';
610 $ret_embed='<embed src="' . $path . $object . $suffix . '" '. "\n"
611 .' hidden="true" autostart="true" '. "\n"
613 .' name="' . $object .'" ' . "\n"
614 .' type="audio/mpeg">' . "\n";
623 * Adds closing tags for ie object
625 * * This is internal function, use newmail_media_objects() instead
626 * @param integer $type media object type
627 * @return string closing tag of media object
629 function newmail_media_object_ie_close($type) {
632 case SM_NEWMAIL_FILETYPE_SWF
:
633 case SM_NEWMAIL_FILETYPE_WAV
:
634 case SM_NEWMAIL_FILETYPE_MP3
:
635 $ret_end="</object>\n";
637 case SM_NEWMAIL_FILETYPE_OGG
:
638 case SM_NEWMAIL_FILETYPE_SVG
:
646 * Adds closing tags for object
648 * * This is internal function, use newmail_media_objects() instead
649 * @param integer $type media object type
650 * @return string closing tag of media object
652 function newmail_media_object_close($type) {
655 case SM_NEWMAIL_FILETYPE_SWF
:
656 case SM_NEWMAIL_FILETYPE_WAV
:
657 case SM_NEWMAIL_FILETYPE_OGG
:
658 case SM_NEWMAIL_FILETYPE_MP3
:
659 case SM_NEWMAIL_FILETYPE_SVG
:
660 $ret_end="</object>\n";
669 * Adds closing tags for object
671 * * This is internal function, use newmail_media_objects() instead
672 * @param integer $type media object type
673 * @return string closing tag of media object
675 function newmail_media_embed_close($type) {
678 case SM_NEWMAIL_FILETYPE_SWF
:
679 case SM_NEWMAIL_FILETYPE_WAV
:
680 case SM_NEWMAIL_FILETYPE_OGG
:
681 case SM_NEWMAIL_FILETYPE_MP3
:
682 case SM_NEWMAIL_FILETYPE_SVG
:
683 $ret_end="</embed>\n";
692 * Converts media attributes to string
694 * * attribute values are automatically sanitized by htmlspecialchars()
695 * * This is internal function, use newmail_media_objects() instead
696 * @param array $args array with object attributes
697 * @return string string with object attributes
699 function newmail_media_prepare_args($args) {
701 foreach ($args as $arg => $value) {
702 $ret_args.= $arg . '="' . htmlspecialchars($value) . '" ';
708 * Detects used media type and creates all need tags
709 * @param string $newmail_media
710 * @return string html tags with media objects
712 function newmail_create_media_tags($newmail_media) {
713 global $newmail_mmedia, $newmail_userfile_type;
715 if (preg_match("/^mmedia_+/",$newmail_media)) {
716 $ret_media = "<!-- newmail mmedia option -->\n";
718 $newmail_mmedia_short=preg_replace("/^mmedia_/",'',$newmail_media);
719 // check if media option is not removed
720 if (isset($newmail_mmedia[$newmail_mmedia_short])) {
721 $ret_media.= newmail_media_objects($newmail_mmedia_short,
722 $newmail_mmedia[$newmail_mmedia_short]['types'],
723 sqm_baseuri() . 'plugins/newmail/media/',
724 $newmail_mmedia[$newmail_mmedia_short]['args']);
726 $ret_media.= "<!-- end of newmail mmedia option -->\n";
727 } elseif ($newmail_media=='(userfile)') {
728 $ret_media = "<!-- newmail usermedia option -->\n";
729 $ret_media.= newmail_media_objects('loadfile.php',
730 array($newmail_userfile_type),
731 sqm_baseuri() . 'plugins/newmail/',
732 array('width'=>0,'height'=>0),
734 $ret_media.= "<!-- end of newmail usermedia option -->\n";
736 $ret_media = "<!-- newmail sounds from sounds/*.wav -->\n";
737 $ret_media.= newmail_media_objects(basename($newmail_media),
738 array(SM_NEWMAIL_FILETYPE_WAV
),
739 sqm_baseuri() . 'plugins/newmail/sounds/',
740 array('width'=>0,'height'=>0),
742 $ret_media.= "<!-- end of newmail sounds from sounds/*.wav -->\n";