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.= '

'.nl2br(htmlentities($args['content'])).'

'; + $content.= '

'. + nl2br( + preg_replace("/(http:\/\/)([^\s,]*)/i", + "$1$2", + htmlentities($args['content']))). + '

'; } 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 @@ + 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.
  • Rating by guests: Even non registered users can rate images.
  • -
  • Email admin when a new user registers: Administrators will be received mail for each registration.
  • +
  • Email admins when a new user registers: Administrators will be received mail for each registration.
  • Allow user registration: Registration is free for all.
  • +
  • Email adminis when a picture is uploaded: Administrators will be received mail for each picture uploaded by a user.
  • +

    History

    @@ -66,10 +68,10 @@ rate images. takes place in screen Administration, Pictures, Comments. -
  • Email admin when a valid comment is entered: +
  • Email admins when a valid comment is entered: Sends an email to the administrators when a user enters a comment and this comment is validated.
  • -
  • Email admin when a comment requires validation: +
  • Email admins when a comment requires validation: 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 Administration, Pictures, Comments.
  • 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 $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.
  • Notation par les visiteurs: Même les utilisateurs non enregistrés peuvent noter les images.
  • -
  • Notifier le webmestre lors de l'inscription d'un utilisateur: Les administrateurs recevront un courriel à chaque inscription.
  • +
  • Notifier les administrateurs lors de l'inscription d'un utilisateur: Les administrateurs recevront un courriel à chaque inscription.
  • Permettre l'enregistrement des utilisateurs: L'inscription est libre pour tous.
  • +
  • Notifier les administrateurs quand une image est téléchargée: Les administrateurs recevront un courriel à chaque image mis à disposition par un utilisateur.
  • +

    Historique

    @@ -66,10 +68,10 @@ partie publique. La validation des commentaires utilisateurs a lieu dans l'écran Administration, Images, Commentaires. -
  • Notifier le webmestre quand un commentaire est enregistré: +
  • Notifier les administrateurs quand un commentaire est enregistré: Envoi un courriel aux administrateurs lorsqu'un utilisateur enregistre un commentaire qui est validé.
  • -
  • Notifier le webmestre quand un commentaire requiert sa validation : +
  • Notifier les administrateurs quand un commentaire requiert sa validation : 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 Administration, Images, Commentaires.
  • 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 @@
  • @@ -64,6 +64,14 @@ + +
  • + +
  • + @@ -113,14 +121,14 @@
  • 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() + ) + ); + } } }