Add notification when a picture is loaded.

Change little translations.
Improve mail sent.

git-svn-id: http://piwigo.org/svn/trunk@1901 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
rub 2007-03-12 23:10:35 +00:00
commit 17246da089
12 changed files with 159 additions and 30 deletions

View file

@ -51,6 +51,7 @@ else
$main_checkboxes = array(
'email_admin_on_new_user',
'allow_user_registration',
'email_admin_on_picture_uploaded',
);
$history_checkboxes = array(

View file

@ -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

View file

@ -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
{

View file

@ -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');

View file

@ -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"
;
?>

View file

@ -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';

View file

@ -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>

View file

@ -82,9 +82,10 @@ $lang['Edit all picture informations'] = 'Modifier toutes les informations li
$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';

View file

@ -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>

View file

@ -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
(

View file

@ -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>

View file

@ -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()
)
);
}
}
}