X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=plugins%2Fnewmail%2Fsetup.php;h=02ca71ba85ca93e639e9d8ec1c96fae0eb30f554;hb=66783e5581450bcbd507d8b0d169ea0140f1b220;hp=0deb4dac1c3ce3019806f310bd3b53e1e0652137;hpb=91e0dccca7b2452d8b450791cae3aa4125e8889e;p=squirrelmail.git
diff --git a/plugins/newmail/setup.php b/plugins/newmail/setup.php
index 0deb4dac..02ca71ba 100644
--- a/plugins/newmail/setup.php
+++ b/plugins/newmail/setup.php
@@ -1,10 +1,9 @@
_("NewMail Options"),
- 'url' => SM_PATH . 'plugins/newmail/newmail_opt.php',
- 'desc' => _("This configures settings for playing sounds and/or showing popup windows when new mail arrives."),
- 'js' => TRUE
- );
- }
+ include_once(SM_PATH . 'plugins/newmail/functions.php');
+ newmail_optpage_register_block_function();
}
+
/**
* Save newmail plugin settings
*/
function newmail_sav() {
- global $data_dir, $username;
-
- if ( sqgetGlobalVar('submit_newmail', $submit, SQ_POST) ) {
- $media_enable = '';
- $media_popup = '';
- $media_allbox = '';
- $media_recent = '';
- $media_changetitle = '';
- $media_sel = '';
-
- sqgetGlobalVar('media_enable', $media_enable, SQ_POST);
- sqgetGlobalVar('media_popup', $media_popup, SQ_POST);
- sqgetGlobalVar('media_allbox', $media_allbox, SQ_POST);
- sqgetGlobalVar('media_recent', $media_recent, SQ_POST);
- sqgetGlobalVar('media_changetitle', $media_changetitle, SQ_POST);
-
- setPref($data_dir,$username,'newmail_enable',$media_enable);
- setPref($data_dir,$username,'newmail_popup', $media_popup);
- setPref($data_dir,$username,'newmail_allbox',$media_allbox);
- setPref($data_dir,$username,'newmail_recent',$media_recent);
- setPref($data_dir,$username,'newmail_changetitle',$media_changetitle);
-
- if( sqgetGlobalVar('media_sel', $media_sel, SQ_POST) &&
- ($media_sel == '(none)' || $media_sel == '(local media)') ) {
- removePref($data_dir,$username,'newmail_media');
- } else {
- setPref($data_dir,$username,'newmail_media',$media_sel);
- }
- }
+ include_once(SM_PATH . 'plugins/newmail/functions.php');
+ newmail_sav_function();
}
+
/**
* Load newmail plugin settings
*/
function newmail_pref() {
- global $username,$data_dir;
- global $newmail_media,$newmail_enable,$newmail_popup,$newmail_allbox;
- global $newmail_recent, $newmail_changetitle;
-
- $newmail_recent = getPref($data_dir,$username,'newmail_recent');
- $newmail_enable = getPref($data_dir,$username,'newmail_enable');
- $newmail_media = getPref($data_dir, $username, 'newmail_media', '(none)');
- $newmail_popup = getPref($data_dir, $username, 'newmail_popup');
- $newmail_allbox = getPref($data_dir, $username, 'newmail_allbox');
- $newmail_changetitle = getPref($data_dir, $username, 'newmail_changetitle');
+ include_once(SM_PATH . 'plugins/newmail/functions.php');
+ newmail_pref_function();
}
+
/**
* Set loadinfo data
*
* Used by option page when saving settings.
*/
function newmail_set_loadinfo() {
- global $optpage, $optpage_name;
- if ($optpage=='newmail') {
- $optpage_name=_("NewMail Options");
- }
+ include_once(SM_PATH . 'plugins/newmail/functions.php');
+ newmail_set_loadinfo_function();
}
+
/**
* Insert needed data in left_main
*/
function newmail_plugin() {
- global $username, $newmail_media, $newmail_enable, $newmail_popup,
- $newmail_recent, $newmail_changetitle, $imapConnection, $PHP_SELF;
-
- if ($newmail_enable == 'on' ||
- $newmail_popup == 'on' ||
- $newmail_changetitle) {
-
- // open a connection on the imap port (143)
-
- $boxes = sqimap_mailbox_list($imapConnection);
- $delimeter = sqimap_get_delimiter($imapConnection);
-
- $status = 0;
- $totalNew = 0;
+ include_once(SM_PATH . 'plugins/newmail/functions.php');
+ return newmail_plugin_function();
+}
- for ($i = 0;$i < count($boxes); $i++) {
- $mailbox = $boxes[$i]['formatted'];
+/**
+ * Returns info about this plugin
+ *
+ */
+function newmail_info() {
+ return array(
+ 'english_name' => 'New Mail',
+ 'authors' => array(
+ 'SquirrelMail Team' => array(),
+ ),
+ 'version' => 'CORE',
+ 'required_sm_version' => 'CORE',
+ 'requires_configuration' => 0,
+ 'summary' => 'This plugin is used to notify the user when a new mail arrives.',
+ 'details' => 'This plugin is used to notify the user when a new mail arrives. This is accomplished by playing a sound through the browser or spawning a popup window whenever the user has unseen messages.',
+ );
+}
- if (! isset($boxes[$i]['unseen'])) {
- $boxes[$i]['unseen'] = '';
- }
- if ($boxes[$i]['flags']) {
- $noselect = false;
- for ($h = 0; $h < count($boxes[$i]['flags']); $h++) {
- if (strtolower($boxes[$i]["flags"][$h]) == 'noselect') {
- $noselect = TRUE;
- }
- }
- if (! $noselect) {
- $status += CheckNewMailboxSound($imapConnection,
- $mailbox,
- $boxes[$i]['unformatted'],
- $delimeter,
- $boxes[$i]['unseen'],
- $totalNew);
- }
- } else {
- $status += CheckNewMailboxSound($imapConnection,
- $mailbox,
- $boxes[$i]['unformatted'],
- $delimeter,
- $boxes[$i]['unseen'],
- $totalNew);
- }
- }
- // sqimap_logout($imapConnection);
- // If we found unseen messages, then we
- // will play the sound as follows:
+/**
+ * Returns version info about this plugin
+ *
+ */
+function newmail_version() {
+ $info = newmail_info();
+ return $info['version'];
+}
- if ($newmail_changetitle) {
- echo "\n";
- }
- if ($totalNew > 0 && $newmail_enable == 'on' && $newmail_media != '' ) {
- echo '