8
8
PLUGIN INFORMATION BEGIN
9
9
Plugin Name: Notifications.
10
10
Plugin Author: Caleb M / Maikuolan.
11
- Plugin Version: 1.0.0
11
+ Plugin Version: 1.0.1
12
12
Download Address: https://github.com/Maikuolan/phpMussel-plugin-notifications
13
13
Min. Compatible: 0.9.0
14
14
Max. Compatible: -
15
- Tested up to: 0.9.0
16
- Last Modified: 2015.11.15
15
+ Tested up to: 0.9.2
16
+ Last Modified: 2016.12.08
17
17
Plugin Description: Receive email notifications from phpMussel whenever a file
18
18
upload is blocked (requires PHP "mail" function to be
19
19
correctly configured; for more information, please refer
20
20
to http://php.net/manual/en/function.mail.php).
21
21
PLUGIN INFORMATION END */
22
22
23
+ /**
24
+ * Notifications plugin for phpMussel.
25
+ *
26
+ * Receive email notifications from phpMussel whenever a file upload is blocked
27
+ * (requires PHP "mail" function to be correctly configured; for more
28
+ * information, please refer to http://php.net/manual/en/function.mail.php).
29
+ *
30
+ * This document and its associated package can be downloaded for free from:
31
+ * - GitHub <https://github.com/Maikuolan/phpMussel-plugin-notifications>.
32
+ *
33
+ * @package Maikuolan/phpMussel-plugin-notifications
34
+ */
35
+
36
+ /**
37
+ * Prevents direct access (the plugin should only be called from the phpMussel
38
+ * plugin system).
39
+ */
23
40
if (!defined ('phpMussel ' ))die ('[phpMussel] This should not be accessed directly. ' );
24
41
42
+ /**
43
+ * Registers the `phpMussel_Notify()` function to the `before_html_out` hook.
44
+ */
25
45
phpMussel_Register_Hook ('phpMussel_Notify ' ,'before_html_out ' );
26
46
27
47
if (!isset ($ MusselConfig ['notifications ' ]))$ MusselConfig ['notifications ' ]=array ();
28
48
if (!isset ($ MusselConfig ['notifications ' ]['to_addr ' ]))$ MusselConfig ['notifications ' ]['to_addr ' ]='' ;
29
49
if (!isset ($ MusselConfig ['notifications ' ]['from_addr ' ]))$ MusselConfig ['notifications ' ]['from_addr ' ]='' ;
30
50
51
+ /**
52
+ * The actual plugin code (the "Notifications" plugin only has one small
53
+ * function; nothing else is needed).
54
+ *
55
+ * @param array $input An empty array (we don't need to send anything from the calling scope to the function, but, the plugin system nonetheless requires this parameter to exist).
56
+ * @return bool Returns true if everything is working correctly.
57
+ */
31
58
function phpMussel_Notify ($ input )
32
- {
33
- if (!$ GLOBALS ['MusselConfig ' ]['notifications ' ]['to_addr ' ]||!$ GLOBALS ['MusselConfig ' ]['notifications ' ]['from_addr ' ]||empty ($ GLOBALS ['whyflagged ' ]))return false ;
34
- $ NotifyLang =(!file_exists ($ GLOBALS ['vault ' ].'plugins/notifications/template. ' .$ GLOBALS ['MusselConfig ' ]['general ' ]['lang ' ].'.eml ' ))?'en ' :$ GLOBALS ['MusselConfig ' ]['general ' ]['lang ' ];
35
- $ NotifyVars =array ();
36
- $ NotifyVars ['whyflagged ' ]=$ GLOBALS ['whyflagged ' ];
37
- $ NotifyVars ['ipaddr ' ]=$ _SERVER [$ GLOBALS ['MusselConfig ' ]['general ' ]['ipaddr ' ]];
38
- $ NotifyVars ['time ' ]=date ('r ' );
39
- $ content =phpMusselV ($ NotifyVars ,phpMusselFile ($ GLOBALS ['vault ' ].'plugins/notifications/template. ' .$ NotifyLang .'.eml ' ,0 ,true ));
40
- mail ($ GLOBALS ['MusselConfig ' ]['notifications ' ]['to_addr ' ],$ GLOBALS ['MusselConfig ' ]['lang ' ]['denied ' ],$ content ,"MIME-Version: 1.0 \nContent-type: text/plain; charset=iso-8859-1 \nFrom: " .$ GLOBALS ['MusselConfig ' ]['notifications ' ]['from_addr ' ],'-f ' .$ GLOBALS ['MusselConfig ' ]['notifications ' ]['from_addr ' ]);
41
- return true ;
42
- }
43
-
44
- ?>
59
+ {
60
+ if (!$ GLOBALS ['MusselConfig ' ]['notifications ' ]['to_addr ' ]||!$ GLOBALS ['MusselConfig ' ]['notifications ' ]['from_addr ' ]||empty ($ GLOBALS ['whyflagged ' ]))return false ;
61
+ $ NotifyLang =(!file_exists ($ GLOBALS ['vault ' ].'plugins/notifications/template. ' .$ GLOBALS ['MusselConfig ' ]['general ' ]['lang ' ].'.eml ' ))?'en ' :$ GLOBALS ['MusselConfig ' ]['general ' ]['lang ' ];
62
+ $ NotifyVars =array ();
63
+ $ NotifyVars ['whyflagged ' ]=$ GLOBALS ['whyflagged ' ];
64
+ $ NotifyVars ['ipaddr ' ]=$ _SERVER [$ GLOBALS ['MusselConfig ' ]['general ' ]['ipaddr ' ]];
65
+ $ NotifyVars ['time ' ]=date ('r ' );
66
+ $ content =phpMusselV ($ NotifyVars ,phpMusselFile ($ GLOBALS ['vault ' ].'plugins/notifications/template. ' .$ NotifyLang .'.eml ' ,0 ,true ));
67
+ mail ($ GLOBALS ['MusselConfig ' ]['notifications ' ]['to_addr ' ],$ GLOBALS ['MusselConfig ' ]['lang ' ]['denied ' ],$ content ,"MIME-Version: 1.0 \nContent-type: text/plain; charset=iso-8859-1 \nFrom: " .$ GLOBALS ['MusselConfig ' ]['notifications ' ]['from_addr ' ],'-f ' .$ GLOBALS ['MusselConfig ' ]['notifications ' ]['from_addr ' ]);
68
+ return true ;
69
+ }
0 commit comments