diff options
-rw-r--r-- | admin/configuration.php | 1 | ||||
-rw-r--r-- | include/functions_comment.inc.php | 12 | ||||
-rw-r--r-- | include/functions_mail.inc.php | 20 | ||||
-rw-r--r-- | install/config.sql | 7 | ||||
-rw-r--r-- | install/db/57-database.php | 66 | ||||
-rw-r--r-- | language/en_UK.iso-8859-1/admin.lang.php | 7 | ||||
-rw-r--r-- | language/en_UK.iso-8859-1/help/configuration.html | 8 | ||||
-rw-r--r-- | language/fr_FR.iso-8859-1/admin.lang.php | 7 | ||||
-rw-r--r-- | language/fr_FR.iso-8859-1/help/configuration.html | 8 | ||||
-rw-r--r-- | register.php | 9 | ||||
-rw-r--r-- | template/yoga/admin/configuration.tpl | 14 | ||||
-rw-r--r-- | upload.php | 30 |
12 files changed, 159 insertions, 30 deletions
diff --git a/admin/configuration.php b/admin/configuration.php index 0c8b21aa5..4de758083 100644 --- a/admin/configuration.php +++ b/admin/configuration.php @@ -51,6 +51,7 @@ else $main_checkboxes = array( 'email_admin_on_new_user', 'allow_user_registration', + 'email_admin_on_picture_uploaded', ); $history_checkboxes = array( diff --git a/include/functions_comment.inc.php b/include/functions_comment.inc.php index c5ff60fc7..9db0a4c17 100644 --- a/include/functions_comment.inc.php +++ b/include/functions_comment.inc.php @@ -194,20 +194,20 @@ INSERT INTO '.COMMENTS_TABLE.' { include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); - $del_url = get_absolute_root_url().'comments.php?delete='.$comm['id']; + $del_url = + get_absolute_root_url().'comments.php?delete='.$comm['id']; $content = - 'Author: '.$comm['author']."\n" + 'Author: '.$comm['author']."\n" .'Comment: '.$comm['content']."\n" - .'IP: '.$comm['ip']."\n" - .'Browser: '.$comm['agent']."\n\n" + .get_block_mail_admin_info() .'Delete: '.$del_url."\n"; if ($comment_action!='validate') { $content .= - 'Validate: '.get_absolute_root_url() - .'comments.php?validate='.$comm['id']; + 'Validate: ' + .get_absolute_root_url().'comments.php?validate='.$comm['id']; } pwg_mail diff --git a/include/functions_mail.inc.php b/include/functions_mail.inc.php index 7307781f2..61a637fcf 100644 --- a/include/functions_mail.inc.php +++ b/include/functions_mail.inc.php @@ -196,6 +196,19 @@ order by return $result; } +/* Return a standard block useful for admin mail */ +function get_block_mail_admin_info() +{ + global $user; + + return
+ "\n" + .'Connected user: '.$user['username']."\n" + .'IP: '.$_SERVER['REMOTE_ADDR']."\n" + .'Browser: '.$_SERVER['HTTP_USER_AGENT']."\n"
+ ."\n"; +} + /** * sends an email, using PhpWebGallery specific informations * @@ -373,7 +386,12 @@ function pwg_mail($to, $args = array()) // Content if (($args['content_format'] == 'text/plain') and ($args['email_format'] == 'text/html'))
{
- $content.= '<p>'.nl2br(htmlentities($args['content'])).'</p>';
+ $content.= '<p>'. + nl2br( + preg_replace("/(http:\/\/)([^\s,]*)/i", + "<a href='$1$2'>$1$2</a>", + htmlentities($args['content']))). + '</p>'; }
else
{
diff --git a/install/config.sql b/install/config.sql index eaae01cfe..1669502bb 100644 --- a/install/config.sql +++ b/install/config.sql @@ -29,6 +29,7 @@ INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('nbm_send_mail_as INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('nbm_send_detailed_content','true','Send detailed content for notification by mail'); INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('nbm_complementary_mail_content','','Complementary mail content for notification by mail'); INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('nbm_send_recent_post_dates','true','Send recent post by dates for notification by mail'); -INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('email_admin_on_new_user','false','Send an email to the admin when a user registers'); -INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('email_admin_on_comment','false','Send an email to the admin when a valid comment is entered'); -INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('email_admin_on_comment_validation','false','Send an email to the admin when a comment requires validation'); +INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('email_admin_on_new_user','false','Send an email to theadministrators when a user registers'); +INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('email_admin_on_comment','false','Send an email to the administrators when a valid comment is entered'); +INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('email_admin_on_comment_validation','false','Send an email to the administrators when a comment requires validation'); +INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('email_admin_on_picture_uploaded','false','Send an email to the administrators when a picture is uploaded'); diff --git a/install/db/57-database.php b/install/db/57-database.php new file mode 100644 index 000000000..dd872ddfa --- /dev/null +++ b/install/db/57-database.php @@ -0,0 +1,66 @@ +<?php +// +-----------------------------------------------------------------------+ +// | PhpWebGallery - a PHP based picture gallery | +// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | +// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net | +// +-----------------------------------------------------------------------+ +// | file : $Id: 57-database.php 1849 2007-02-22 01:12:32Z rvelices $ +// | last update : $Date: 2007-02-22 02:12:32 +0100 (jeu., 22 févr. 2007) $ +// | last modifier : $Author: rvelices $ +// | revision : $Revision: 1849 $ +// +-----------------------------------------------------------------------+ +// | This program is free software; you can redistribute it and/or modify | +// | it under the terms of the GNU General Public License as published by | +// | the Free Software Foundation | +// | | +// | This program is distributed in the hope that it will be useful, but | +// | WITHOUT ANY WARRANTY; without even the implied warranty of | +// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | +// | General Public License for more details. | +// | | +// | You should have received a copy of the GNU General Public License | +// | along with this program; if not, write to the Free Software | +// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | +// | USA. | +// +-----------------------------------------------------------------------+ + +if (!defined('PHPWG_ROOT_PATH')) +{ + die('Hacking attempt!'); +} + +$upgrade_description = 'Update email_admin_on_new_user, email_admin_on_comment, email_admin_on_comment_validation & Add email_admin_on_picture_uploaded'; + +include_once(PHPWG_ROOT_PATH.'include/constants.php'); + +// +-----------------------------------------------------------------------+ +// | Upgrade content | +// +-----------------------------------------------------------------------+ + +$query = " +UPDATE ".CONFIG_TABLE." set comment = 'Send an email to the administrators when a user registers' where param = 'email_admin_on_new_user'; +"; +pwg_query($query); + +$query = " +UPDATE ".CONFIG_TABLE." set comment = 'Send an email to the administrators when a valid comment is entered' where param = 'email_admin_on_comment'; +"; +pwg_query($query); + +$query = " +UPDATE ".CONFIG_TABLE." set comment = 'Send an email to the administrators when a comment requires validation' where param = 'email_admin_on_comment_validation'; +"; +pwg_query($query); + +$query = " +INSERT INTO ".CONFIG_TABLE." (param,value,comment) VALUES ('email_admin_on_picture_uploaded','false','Send an email to the administrators when a picture is uploaded'); +"; +pwg_query($query); + +echo +"\n" +.'"'.$upgrade_description.'"'.' ended' +."\n" +; + +?> diff --git a/language/en_UK.iso-8859-1/admin.lang.php b/language/en_UK.iso-8859-1/admin.lang.php index 985d63cf0..5004c5b98 100644 --- a/language/en_UK.iso-8859-1/admin.lang.php +++ b/language/en_UK.iso-8859-1/admin.lang.php @@ -82,9 +82,10 @@ $lang['Edit all picture informations'] = 'Edit all picture informations'; $lang['Edit selected tags'] = 'Edit selected tags'; $lang['Edit tags'] = 'Edit tags'; $lang['Elements'] = 'Elements'; -$lang['Email admin when a new user registers'] = 'Email admin when a new user registers'; -$lang['Email admin when a valid comment is entered'] = 'Email admin when a valid comment is entered'; -$lang['Email admin when a comment requires validation'] = 'Email admin when a comment requires validation'; +$lang['Email administrators when a new user registers'] = 'Email admins when a new user registers'; +$lang['Email administrators when a valid comment is entered'] = 'Email admins when a valid comment is entered'; +$lang['Email administrators when a comment requires validation'] = 'Email admins when a comment requires validation'; +$lang['Email administrators when a picture is uploaded'] = 'Email adminis when a picture is uploaded'; $lang['Empty caddie'] = 'Empty caddie'; $lang['Environment'] = 'Environment'; $lang['Expand all categories'] = 'Expand all categories'; diff --git a/language/en_UK.iso-8859-1/help/configuration.html b/language/en_UK.iso-8859-1/help/configuration.html index 30f0b7177..6dc4c67bc 100644 --- a/language/en_UK.iso-8859-1/help/configuration.html +++ b/language/en_UK.iso-8859-1/help/configuration.html @@ -29,10 +29,12 @@ page.</li> <li><strong>Rating by guests</strong>: Even non registered users can rate images.</li> - <li><strong>Email admin when a new user registers</strong>: Administrators will be received mail for each registration.</li> + <li><strong>Email admins when a new user registers</strong>: Administrators will be received mail for each registration.</li> <li><strong>Allow user registration</strong>: Registration is free for all.</li> + <li><strong>Email adminis when a picture is uploaded</strong>: Administrators will be received mail for each picture uploaded by a user.</li> + </ul> <h3>History</h3> @@ -66,10 +68,10 @@ rate images.</li> takes place in screen <span class="pwgScreen">Administration, Pictures, Comments</span>.</li> - <li><strong>Email admin when a valid comment is entered</strong>: + <li><strong>Email admins when a valid comment is entered</strong>: Sends an email to the administrators when a user enters a comment and this comment is validated.</li> - <li><strong>Email admin when a comment requires validation</strong>: + <li><strong>Email admins when a comment requires validation</strong>: Sends an email to the administrators when a user enters a comment that requires validation by the admin. User comments validation takes place in the screen <span class="pwgScreen">Administration, Pictures, Comments</span>.</li> diff --git a/language/fr_FR.iso-8859-1/admin.lang.php b/language/fr_FR.iso-8859-1/admin.lang.php index 7d1d01c56..ab572556b 100644 --- a/language/fr_FR.iso-8859-1/admin.lang.php +++ b/language/fr_FR.iso-8859-1/admin.lang.php @@ -82,9 +82,10 @@ $lang['Edit all picture informations'] = 'Modifier toutes les informations liées $lang['Edit selected tags'] = 'Editer les tags sélectionnés'; $lang['Edit tags'] = 'Editer les tags'; $lang['Elements'] = 'Éléments'; -$lang['Email admin when a new user registers'] = 'Notifier le webmestre lors de l\'inscription d\'un utilisateur'; -$lang['Email admin when a valid comment is entered'] = 'Notifier le webmestre quand un commentaire est enregistré'; -$lang['Email admin when a comment requires validation'] = 'Notifier le webmestre quand un commentaire requiert sa validation'; +$lang['Email administrators when a new user registers'] = 'Notifier les administrateurs lors de l\'inscription d\'un utilisateur'; +$lang['Email administrators when a valid comment is entered'] = 'Notifier les administrateurs quand un commentaire est enregistré'; +$lang['Email administrators when a comment requires validation'] = 'Notifier les administrateurs quand un commentaire requiert sa validation'; +$lang['Email administrators when a picture is uploaded'] = 'Notifier les administrateurs quand une image est téléchargée'; $lang['Empty caddie'] = 'Vider le panier'; $lang['Environment'] = 'Environnement'; $lang['Expand all categories'] = 'Développer toutes les catégories'; diff --git a/language/fr_FR.iso-8859-1/help/configuration.html b/language/fr_FR.iso-8859-1/help/configuration.html index 950144d73..50d2575d8 100644 --- a/language/fr_FR.iso-8859-1/help/configuration.html +++ b/language/fr_FR.iso-8859-1/help/configuration.html @@ -29,10 +29,12 @@ galerie.</li> <li><strong>Notation par les visiteurs</strong>: Même les utilisateurs non enregistrés peuvent noter les images.</li> - <li><strong>Notifier le webmestre lors de l'inscription d'un utilisateur</strong>: Les administrateurs recevront un courriel à chaque inscription.</li> + <li><strong>Notifier les administrateurs lors de l'inscription d'un utilisateur</strong>: Les administrateurs recevront un courriel à chaque inscription.</li> <li><strong>Permettre l'enregistrement des utilisateurs</strong>: L'inscription est libre pour tous.</li> + <li><strong>Notifier les administrateurs quand une image est téléchargée</strong>: Les administrateurs recevront un courriel à chaque image mis à disposition par un utilisateur.</li> + </ul> <h3>Historique</h3> @@ -66,10 +68,10 @@ partie publique. La validation des commentaires utilisateurs a lieu dans l'écran <span class="pwgScreen">Administration, Images, Commentaires</span>.</li> - <li><strong>Notifier le webmestre quand un commentaire est enregistré</strong>: + <li><strong>Notifier les administrateurs quand un commentaire est enregistré</strong>: Envoi un courriel aux administrateurs lorsqu'un utilisateur enregistre un commentaire qui est validé.</li> - <li><strong>Notifier le webmestre quand un commentaire requiert sa validation </strong>: + <li><strong>Notifier les administrateurs quand un commentaire requiert sa validation </strong>: Envoi un courriel aux administrateurs lorsqu'un utilisateur enregistre un commentaire qui demande une validation de la part des administrateurs. La validation des commentaires utilisateurs a lieu dans l'écran <span class="pwgScreen">Administration, Images, Commentaires</span>.</li> diff --git a/register.php b/register.php index 68dd36da5..5d1e4e183 100644 --- a/register.php +++ b/register.php @@ -67,14 +67,13 @@ if (isset($_POST['submit'])) include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); $username = $_POST['login']; $admin_url = get_absolute_root_url() - .'admin.php?page=user_list&username='.$username; + .'admin.php?page=user_list&username='.$username; $content = - 'User: '.$username."\n" + 'User: '.$username."\n" .'Mail: '.$_POST['mail_address']."\n" - .'IP: '.$_SERVER['REMOTE_ADDR']."\n" - .'Browser: '.$_SERVER['HTTP_USER_AGENT']."\n\n" - .l10n('admin').': '.$admin_url; + .get_block_mail_admin_info() + .'Admin'.': '.$admin_url; pwg_mail ( diff --git a/template/yoga/admin/configuration.tpl b/template/yoga/admin/configuration.tpl index 52cb270e2..33da00a98 100644 --- a/template/yoga/admin/configuration.tpl +++ b/template/yoga/admin/configuration.tpl @@ -53,7 +53,7 @@ <li> <label> - <span class="property">{lang:Email admin when a new user registers}</span> + <span class="property">{lang:Email administrators when a new user registers}</span> <input type="checkbox" name="email_admin_on_new_user" {main.EMAIL_ADMIN_ON_NEW_USER} /> </label> </li> @@ -64,6 +64,14 @@ <input type="checkbox" name="allow_user_registration" id="allow_user_registration" {main.ALLOW_USER_REGISTRATION} /> </label> </li> + + <li> + <label> + <span class="property">{lang:Email administrators when a picture is uploaded}</span> + <input type="checkbox" name="email_admin_on_picture_uploaded" {main.EMAIL_ADMIN_ON_PICTURE_UPLOADED} /> + </label> + </li> + </ul> </fieldset> <!-- END main --> @@ -113,14 +121,14 @@ <li> <label> - <span class="property">{lang:Email admin when a valid comment is entered}</span> + <span class="property">{lang:Email administrators when a valid comment is entered}</span> <input type="checkbox" name="email_admin_on_comment" {comments.EMAIL_ADMIN_ON_COMMENT} /> </label> </li> <li> <label> - <span class="property">{lang:Email admin when a comment requires validation}</span> + <span class="property">{lang:Email administrators when a comment requires validation}</span> <input type="checkbox" name="email_admin_on_comment_validation" {comments.EMAIL_ADMIN_ON_COMMENT_VALIDATION} /> </label> </li> diff --git a/upload.php b/upload.php index 380abc46d..36aba5b7d 100644 --- a/upload.php +++ b/upload.php @@ -222,6 +222,36 @@ if ( isset( $_POST['submit'] ) and !isset( $_GET['waiting_id'] ) ) $query.= ';'; pwg_query( $query ); $page['waiting_id'] = mysql_insert_id(); + + if ($conf['email_admin_on_picture_uploaded']) + { + include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); + + $waiting_url = get_absolute_root_url().'admin.php?page=waiting'; + + $content = + 'Category: '.get_cat_display_name($category['upper_names'], null, false)."\n" + .'Picture name: '.$_FILES['picture']['name']."\n" + .'User: '.$_POST['username']."\n" + .'Email: '.$_POST['mail_address']."\n" + .'Picture name: '.$_POST['name']."\n" + .'Author: '.$_POST['author']."\n" + .'Creation Date: '.$_POST['date_creation']."\n" + .'Comment: '.$_POST['comment']."\n" + .get_block_mail_admin_info() + .'Waiting page: '.$waiting_url."\n"; + + pwg_mail + ( + format_email('administrators', get_webmaster_mail_address()), + array + ( + 'subject' => 'PWG picture uploaded by '.$_POST['username'], + 'content' => $content, + 'Bcc' => get_administrators_email() + ) + ); + } } } |