Changeset 1901


Ignore:
Timestamp:
Mar 13, 2007, 12:10:35 AM (17 years ago)
Author:
rub
Message:

Add notification when a picture is loaded.
Change little translations.
Improve mail sent.

Location:
trunk
Files:
1 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/configuration.php

    r1900 r1901  
    5252    'email_admin_on_new_user',
    5353    'allow_user_registration',
     54    'email_admin_on_picture_uploaded',
    5455   );
    5556
  • trunk/include/functions_comment.inc.php

    r1900 r1901  
    195195      include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
    196196
    197       $del_url = get_absolute_root_url().'comments.php?delete='.$comm['id'];
     197      $del_url =
     198          get_absolute_root_url().'comments.php?delete='.$comm['id'];
    198199
    199200      $content =
    200         'Author: '.$comm['author']."\n"
     201         'Author: '.$comm['author']."\n"
    201202        .'Comment: '.$comm['content']."\n"
    202         .'IP: '.$comm['ip']."\n"
    203         .'Browser: '.$comm['agent']."\n\n"
     203        .get_block_mail_admin_info()
    204204        .'Delete: '.$del_url."\n";
    205205
     
    207207      {
    208208        $content .=
    209           'Validate: '.get_absolute_root_url()
    210           .'comments.php?validate='.$comm['id'];
     209          'Validate: '
     210          .get_absolute_root_url().'comments.php?validate='.$comm['id'];
    211211      }
    212212
  • trunk/include/functions_mail.inc.php

    r1828 r1901  
    195195
    196196  return $result;
     197}
     198
     199/* Return a standard block useful for admin mail */
     200function get_block_mail_admin_info()
     201{
     202  global $user;
     203
     204  return
     205    "\n"
     206    .'Connected user: '.$user['username']."\n"
     207    .'IP: '.$_SERVER['REMOTE_ADDR']."\n"
     208    .'Browser: '.$_SERVER['HTTP_USER_AGENT']."\n"
     209    ."\n";
    197210}
    198211
     
    374387  if (($args['content_format'] == 'text/plain') and ($args['email_format'] == 'text/html'))
    375388  {
    376     $content.= '<p>'.nl2br(htmlentities($args['content'])).'</p>';
     389    $content.= '<p>'.
     390                nl2br(
     391                  preg_replace("/(http:\/\/)([^\s,]*)/i",
     392                               "<a href='$1$2'>$1$2</a>",
     393                               htmlentities($args['content']))).
     394                '</p>';
    377395  }
    378396  else
  • trunk/install/config.sql

    r1900 r1901  
    3030INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('nbm_complementary_mail_content','','Complementary mail content for notification by mail');
    3131INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('nbm_send_recent_post_dates','true','Send recent post by dates for notification by mail');
    32 INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('email_admin_on_new_user','false','Send an email to the admin when a user registers');
    33 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');
    34 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');
     32INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('email_admin_on_new_user','false','Send an email to theadministrators when a user registers');
     33INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('email_admin_on_comment','false','Send an email to the administrators when a valid comment is entered');
     34INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('email_admin_on_comment_validation','false','Send an email to the administrators when a comment requires validation');
     35INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('email_admin_on_picture_uploaded','false','Send an email to the administrators when a picture is uploaded');
  • trunk/language/en_UK.iso-8859-1/admin.lang.php

    r1900 r1901  
    8383$lang['Edit tags'] = 'Edit tags';
    8484$lang['Elements'] = 'Elements';
    85 $lang['Email admin when a new user registers'] = 'Email admin when a new user registers';
    86 $lang['Email admin when a valid comment is entered'] = 'Email admin when a valid comment is entered';
    87 $lang['Email admin when a comment requires validation'] = 'Email admin when a comment requires validation';
     85$lang['Email administrators when a new user registers'] = 'Email admins when a new user registers';
     86$lang['Email administrators when a valid comment is entered'] = 'Email admins when a valid comment is entered';
     87$lang['Email administrators when a comment requires validation'] = 'Email admins when a comment requires validation';
     88$lang['Email administrators when a picture is uploaded'] = 'Email adminis when a picture is uploaded';
    8889$lang['Empty caddie'] = 'Empty caddie';
    8990$lang['Environment'] = 'Environment';
  • trunk/language/en_UK.iso-8859-1/help/configuration.html

    r1900 r1901  
    3030rate images.</li>
    3131
    32   <li><strong>Email admin when a new user registers</strong>: Administrators will be received mail for each registration.</li>
     32  <li><strong>Email admins when a new user registers</strong>: Administrators will be received mail for each registration.</li>
    3333
    3434  <li><strong>Allow user registration</strong>: Registration is free for all.</li>
     35
     36  <li><strong>Email adminis when a picture is uploaded</strong>: Administrators will be received mail for each picture uploaded by a user.</li>
    3537
    3638</ul>
     
    6769  Comments</span>.</li>
    6870
    69   <li><strong>Email admin when a valid comment is entered</strong>:
     71  <li><strong>Email admins when a valid comment is entered</strong>:
    7072Sends an email to the administrators when a user enters a comment and this comment is validated.</li>
    7173
    72   <li><strong>Email admin when a comment requires validation</strong>:
     74  <li><strong>Email admins when a comment requires validation</strong>:
    7375Sends an email to the administrators when a user enters a comment that requires validation by the admin.
    7476User comments validation takes place in the screen <span class="pwgScreen">Administration, Pictures, Comments</span>.</li>
  • trunk/language/fr_FR.iso-8859-1/admin.lang.php

    r1900 r1901  
    8383$lang['Edit tags'] = 'Editer les tags';
    8484$lang['Elements'] = 'Éléments';
    85 $lang['Email admin when a new user registers'] = 'Notifier le webmestre lors de l\'inscription d\'un utilisateur';
    86 $lang['Email admin when a valid comment is entered'] = 'Notifier le webmestre quand un commentaire est enregistré';
    87 $lang['Email admin when a comment requires validation'] = 'Notifier le webmestre quand un commentaire requiert sa validation';
     85$lang['Email administrators when a new user registers'] = 'Notifier les administrateurs lors de l\'inscription d\'un utilisateur';
     86$lang['Email administrators when a valid comment is entered'] = 'Notifier les administrateurs quand un commentaire est enregistré';
     87$lang['Email administrators when a comment requires validation'] = 'Notifier les administrateurs quand un commentaire requiert sa validation';
     88$lang['Email administrators when a picture is uploaded'] = 'Notifier les administrateurs quand une image est téléchargée';
    8889$lang['Empty caddie'] = 'Vider le panier';
    8990$lang['Environment'] = 'Environnement';
  • trunk/language/fr_FR.iso-8859-1/help/configuration.html

    r1900 r1901  
    3030non enregistrés peuvent noter les images.</li>
    3131
    32   <li><strong>Notifier le webmestre lors de l'inscription d'un utilisateur</strong>: Les administrateurs recevront un courriel à chaque inscription.</li>
     32  <li><strong>Notifier les administrateurs lors de l'inscription d'un utilisateur</strong>: Les administrateurs recevront un courriel à chaque inscription.</li>
    3333
    3434  <li><strong>Permettre l'enregistrement des utilisateurs</strong>: L'inscription est libre pour tous.</li>
     35
     36  <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>
    3537
    3638</ul>
     
    6769Commentaires</span>.</li>
    6870
    69   <li><strong>Notifier le webmestre quand un commentaire est enregistré</strong>:
     71  <li><strong>Notifier les administrateurs quand un commentaire est enregistré</strong>:
    7072Envoi un courriel aux administrateurs lorsqu'un utilisateur enregistre un commentaire qui est validé.</li>
    7173
    72   <li><strong>Notifier le webmestre quand un commentaire requiert sa validation </strong>:
     74  <li><strong>Notifier les administrateurs quand un commentaire requiert sa validation </strong>:
    7375Envoi un courriel aux administrateurs lorsqu'un utilisateur enregistre un commentaire qui demande une validation de la part des administrateurs.
    7476La validation des commentaires utilisateurs a lieu dans l'écran <span class="pwgScreen">Administration, Images, Commentaires</span>.</li>
  • trunk/register.php

    r1900 r1901  
    6868      $username = $_POST['login'];
    6969      $admin_url = get_absolute_root_url()
    70         .'admin.php?page=user_list&username='.$username;
     70                   .'admin.php?page=user_list&username='.$username;
    7171
    7272      $content =
    73         'User: '.$username."\n"
     73         'User: '.$username."\n"
    7474        .'Mail: '.$_POST['mail_address']."\n"
    75         .'IP: '.$_SERVER['REMOTE_ADDR']."\n"
    76         .'Browser: '.$_SERVER['HTTP_USER_AGENT']."\n\n"
    77         .l10n('admin').': '.$admin_url;
     75        .get_block_mail_admin_info()
     76        .'Admin'.': '.$admin_url;
    7877
    7978      pwg_mail
  • trunk/template/yoga/admin/configuration.tpl

    r1900 r1901  
    5454    <li>
    5555      <label>
    56         <span class="property">{lang:Email admin when a new user registers}</span>
     56        <span class="property">{lang:Email administrators when a new user registers}</span>
    5757        <input type="checkbox" name="email_admin_on_new_user" {main.EMAIL_ADMIN_ON_NEW_USER} />
    5858      </label>
     
    6565      </label>
    6666    </li>
     67
     68    <li>
     69      <label>
     70        <span class="property">{lang:Email administrators when a picture is uploaded}</span>
     71        <input type="checkbox" name="email_admin_on_picture_uploaded" {main.EMAIL_ADMIN_ON_PICTURE_UPLOADED} />
     72      </label>
     73    </li>
     74
    6775  </ul>
    6876</fieldset>
     
    114122    <li>
    115123      <label>
    116         <span class="property">{lang:Email admin when a valid comment is entered}</span>
     124        <span class="property">{lang:Email administrators when a valid comment is entered}</span>
    117125        <input type="checkbox" name="email_admin_on_comment" {comments.EMAIL_ADMIN_ON_COMMENT} />
    118126      </label>
     
    121129    <li>
    122130      <label>
    123         <span class="property">{lang:Email admin when a comment requires validation}</span>
     131        <span class="property">{lang:Email administrators when a comment requires validation}</span>
    124132        <input type="checkbox" name="email_admin_on_comment_validation" {comments.EMAIL_ADMIN_ON_COMMENT_VALIDATION} />
    125133      </label>
  • trunk/upload.php

    r1900 r1901  
    223223    pwg_query( $query );
    224224    $page['waiting_id'] = mysql_insert_id();
     225
     226    if ($conf['email_admin_on_picture_uploaded'])
     227    {
     228      include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
     229
     230      $waiting_url = get_absolute_root_url().'admin.php?page=waiting';
     231
     232      $content =
     233         'Category: '.get_cat_display_name($category['upper_names'], null, false)."\n"
     234        .'Picture name: '.$_FILES['picture']['name']."\n"
     235        .'User: '.$_POST['username']."\n"
     236        .'Email: '.$_POST['mail_address']."\n"
     237        .'Picture name: '.$_POST['name']."\n"
     238        .'Author: '.$_POST['author']."\n"
     239        .'Creation Date: '.$_POST['date_creation']."\n"
     240        .'Comment: '.$_POST['comment']."\n"
     241        .get_block_mail_admin_info()
     242        .'Waiting page: '.$waiting_url."\n";
     243
     244      pwg_mail
     245      (
     246        format_email('administrators', get_webmaster_mail_address()),
     247        array
     248        (
     249          'subject' => 'PWG picture uploaded by '.$_POST['username'],
     250          'content' => $content,
     251          'Bcc' => get_administrators_email()
     252        )
     253      );
     254    }
    225255  }
    226256}
Note: See TracChangeset for help on using the changeset viewer.