Skip to content
This repository was archived by the owner on Jun 10, 2020. It is now read-only.

Commit 0792ee5

Browse files
committed
Initial commit.
In theory, this should work correctly and should be ready for general use; However, testing is still required (I haven't yet done any live testing).
1 parent afca663 commit 0792ee5

File tree

4 files changed

+117
-15
lines changed

4 files changed

+117
-15
lines changed

.gitattributes

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,40 @@
1-
# Auto detect text files and perform LF normalization
2-
* text=auto
1+
# phpMussel .gitattributes file.
2+
# phpMussel repository can be found here:
3+
# https://github.com/Maikuolan/phpMussel/
34

4-
# Custom for Visual Studio
5-
*.cs diff=csharp
5+
# Written based on the .gitattributes guide available from:
6+
# https://help.github.com/articles/dealing-with-line-endings/
67

7-
# Standard to msysgit
8-
*.doc diff=astextplain
9-
*.DOC diff=astextplain
10-
*.docx diff=astextplain
11-
*.DOCX diff=astextplain
12-
*.dot diff=astextplain
13-
*.DOT diff=astextplain
14-
*.pdf diff=astextplain
15-
*.PDF diff=astextplain
16-
*.rtf diff=astextplain
17-
*.RTF diff=astextplain
8+
# Which EOL is best could be easily debated for or against any one way or
9+
# another, which is, perhaps, the reason why those various OS adopted by the
10+
# wider IT community don't follow any one particular strict standard, with
11+
# Windows defaulting to CRLF, Unix/Linux to LF, and so on and so forth.
12+
# Although I do the vast bulk of my coding via a Windows machine, and by
13+
# extension, it might be assumed I prefer CRLF, contrarily, I personally
14+
# prefer LF over CRLF or any other alternatives, due in part to my own personal
15+
# experiences and in part to my desire to minimise the overall size of the
16+
# phpMussel package. Linux users shouldn't normally have any issue reading
17+
# files that use LF linebreaks, but, for Windows users, to avoid issues
18+
# readings these files, I'd recommend using Notepad++ for opening and reading
19+
# these files, because, unlike traditional Notepad or other similar native
20+
# text readers/editors, Notepad++ has no difficulties in readning textfiles of
21+
# of various linebreak types (TXT and INI files will remain as CRLF, however).
22+
* text eol=lf
23+
*.ini text eol=crlf
24+
*.txt text eol=crlf
25+
*.cvd binary
26+
*.dat binary
27+
*.exe binary
28+
*.gif binary
29+
*.gz binary
30+
*.jpeg binary
31+
*.jpg binary
32+
*.ole binary
33+
*.pdf binary
34+
*.png binary
35+
*.rar binary
36+
*.rtf binary
37+
*.swf binary
38+
*.tar binary
39+
*.xdp binary
40+
*.zip binary

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
## **What is phpMussel?**
2+
3+
An ideal solution for shared hosting environments, where it's often not possible to utilise or install conventional anti-virus protection solutions, phpMussel is a PHP script designed to **detect trojans, viruses, malware and other threats** within files uploaded to your system wherever the script is hooked, based on the signatures of [ClamAV](http://www.clamav.net/) and others.
4+
5+
## **What's this repository for?**
6+
7+
This repository, "phpMussel-plugin-notifications", is the repository for a phpMussel plugin that allows you to receive email notifications from phpMussel whenever a file upload is blocked (requires PHP "mail" function to be correctly configured).
8+
9+
The main repository: [phpMussel](https://github.com/Maikuolan/phpMussel).
10+
11+
This repository: [phpMussel-plugin-notifications](https://github.com/Maikuolan/phpMussel-plugin-notifications).
12+
13+
## **How to install?**
14+
15+
1. Add the following section to your `phpmussel.ini` file and edit accordingly:
16+
17+
```
18+
[notifications]
19+
; "to_addr" is the email address for sending notifications to.
20+
to_addr='username@domain.tld'
21+
; "from_addr" is the email address cited as the origin for all sent notifications.
22+
from_addr='username@domain.tld'
23+
```
24+
25+
2. Upload the "notifications" directory of this repository and all its contents to the "plugins" directory of your phpMussel installation (the "plugins" directory is a sub-directory of the "vault" directory).
26+
27+
That's everything! :-)

notifications/plugin.php

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
/* _____ _ _ _____ _______ _ _ _______ _______ _______
3+
< |_____] |_____| |_____] | | | | | |______ |______ |______ | >
4+
| | | | | | | |_____| ______| ______| |______ |_____
5+
6+
This "plugin.php" file belongs to a plugin of phpMussel.
7+
8+
PLUGIN INFORMATION BEGIN
9+
Plugin Name: Notifications.
10+
Plugin Author: Caleb M / Maikuolan.
11+
Plugin Version: 1.0.0
12+
Download Address: https://github.com/Maikuolan/phpMussel-plugin-notifications
13+
Min. Compatible: 0.9.0
14+
Max. Compatible: -
15+
Tested up to: 0.9.0
16+
Last Modified: 2015.11.15
17+
Plugin Description: Receive email notifications from phpMussel whenever a file
18+
upload is blocked (requires PHP "mail" function to be
19+
correctly configured; for more information, please refer
20+
to http://php.net/manual/en/function.mail.php).
21+
PLUGIN INFORMATION END */
22+
23+
if(!defined('phpMussel'))die('[phpMussel] This should not be accessed directly.');
24+
25+
phpMussel_Register_Hook('phpMussel_Notify','before_html_out');
26+
27+
if(!isset($MusselConfig['notifications']))$MusselConfig['notifications']=array();
28+
if(!isset($MusselConfig['notifications']['to_addr']))$MusselConfig['notifications']['to_addr']='';
29+
if(!isset($MusselConfig['notifications']['from_addr']))$MusselConfig['notifications']['from_addr']='';
30+
31+
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+
?>

notifications/template.en.eml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Hi,
2+
3+
This is an automated email from phpMussel to notify you that an attempted file upload has been blocked.
4+
5+
Time/Date: {time}
6+
Originating IP Address: {ipaddr}
7+
Reason Blocked: {whyflagged}
8+

0 commit comments

Comments
 (0)