Changeset 25360


Ignore:
Timestamp:
11/06/13 18:57:53 (6 years ago)
Author:
mistic100
Message:

feature 2995: New email template
restore get_l10n_args removed at r25357
apply changes to NBM

Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/functions_notification_by_mail.inc.php

    r25018 r25360  
    257257  if ($is_action_send) 
    258258  { 
    259     $nbm_user['theme'] = $user['theme']; 
    260     $env_nbm['mail_template'] = get_mail_template($env_nbm['email_format'], $nbm_user['theme']); 
     259    $env_nbm['mail_template'] = get_mail_template($env_nbm['email_format']); 
    261260    $env_nbm['mail_template']->set_filename('notification_by_mail', 'notification_by_mail.tpl'); 
    262261  } 
     
    424423        set_user_on_env_nbm($nbm_user, true); 
    425424 
    426         $subject = '['.$conf['gallery_title'].']: '.($is_subscribe ? l10n('Subscribe to notification by mail'): l10n('Unsubscribe from notification by mail')); 
     425        $subject = '['.$conf['gallery_title'].'] '.($is_subscribe ? l10n('Subscribe to notification by mail'): l10n('Unsubscribe from notification by mail')); 
    427426 
    428427        // Assign current var for nbm mail 
     
    440439          ) 
    441440        ); 
    442  
    443         if (pwg_mail 
    444             ( 
    445               format_email(stripslashes($nbm_user['username']), $nbm_user['mail_address']), 
    446               array 
    447               ( 
    448                 'from' => $env_nbm['send_as_mail_formated'], 
    449                 'subject' => $subject, 
    450                 'email_format' => $env_nbm['email_format'], 
    451                 'content' => $env_nbm['mail_template']->parse('notification_by_mail', true), 
    452                 'content_format' => $env_nbm['email_format'], 
    453                 'theme' => $nbm_user['theme'] 
    454               ) 
    455             )) 
     441         
     442        $ret = pwg_mail( 
     443          array( 
     444            'name' => stripslashes($nbm_user['username']), 
     445            'email' => $nbm_user['mail_address'], 
     446            ), 
     447          array( 
     448            'from' => $env_nbm['send_as_mail_formated'], 
     449            'subject' => $subject, 
     450            'email_format' => $env_nbm['email_format'], 
     451            'content' => $env_nbm['mail_template']->parse('notification_by_mail', true), 
     452            'content_format' => $env_nbm['email_format'], 
     453            ) 
     454          ); 
     455 
     456        if ($ret) 
    456457        { 
    457458          inc_mail_sent_success($nbm_user); 
  • trunk/admin/notification_by_mail.php

    r25018 r25360  
    306306            if ($exist_data) 
    307307            { 
    308               $subject = '['.$conf['gallery_title'].']: '.l10n('New photos added'); 
     308              $subject = '['.$conf['gallery_title'].'] '.l10n('New photos added'); 
    309309 
    310310              // Assign current var for nbm mail 
     
    378378                ) 
    379379              ); 
    380  
    381               if (pwg_mail 
    382                   ( 
    383                     format_email(stripslashes($nbm_user['username']), $nbm_user['mail_address']), 
    384                     array 
    385                     ( 
    386                       'from' => $env_nbm['send_as_mail_formated'], 
    387                       'subject' => $subject, 
    388                       'email_format' => $env_nbm['email_format'], 
    389                       'content' => $env_nbm['mail_template']->parse('notification_by_mail', true), 
    390                       'content_format' => $env_nbm['email_format'], 
    391                       'theme' => $nbm_user['theme'] 
    392                     ) 
    393                   )) 
     380               
     381              $ret = pwg_mail( 
     382                array( 
     383                  'name' => stripslashes($nbm_user['username']), 
     384                  'email' => $nbm_user['mail_address'], 
     385                  ), 
     386                array( 
     387                  'from' => $env_nbm['send_as_mail_formated'], 
     388                  'subject' => $subject, 
     389                  'email_format' => $env_nbm['email_format'], 
     390                  'content' => $env_nbm['mail_template']->parse('notification_by_mail', true), 
     391                  'content_format' => $env_nbm['email_format'], 
     392                  ) 
     393                ); 
     394 
     395              if ($ret) 
    394396              { 
    395397                inc_mail_sent_success($nbm_user); 
  • trunk/include/functions.inc.php

    r25288 r25360  
    10271027 * @return string 
    10281028 */ 
    1029 function get_l10n_args($key, $args) 
     1029function get_l10n_args($key, $args='') 
    10301030{ 
    10311031  if (is_array($args)) 
  • trunk/include/functions_comment.inc.php

    r25357 r25360  
    233233      $comment_url = get_absolute_root_url().'comments.php?comment_id='.$comm['id']; 
    234234 
    235       $content = array( 
    236         l10n('Author: %s', stripslashes($comm['author']) ), 
    237         l10n('Email: %s', stripslashes($comm['email']) ), 
    238         l10n('Comment: %s', stripslashes($comm['content']) ), 
    239         '', 
    240         l10n('Manage this user comment: %s', $comment_url), 
     235      $keyargs_content = array( 
     236        get_l10n_args('Author: %s', stripslashes($comm['author']) ), 
     237        get_l10n_args('Email: %s', stripslashes($comm['email']) ), 
     238        get_l10n_args('Comment: %s', stripslashes($comm['content']) ), 
     239        get_l10n_args(''), 
     240        get_l10n_args('Manage this user comment: %s', $comment_url), 
    241241      ); 
    242242 
    243243      if ('moderate' == $comment_action) 
    244244      { 
    245         $content[] = l10n('(!) This comment requires validation'); 
     245        $keyargs_content[] = get_l10n_args('(!) This comment requires validation'); 
    246246      } 
    247247 
    248248      pwg_mail_notification_admins( 
    249         l10n('Comment by %s', stripslashes($comm['author']) ), 
    250         implode("\n", $content) 
     249        get_l10n_args('Comment by %s', stripslashes($comm['author']) ), 
     250        $keyargs_content 
    251251      ); 
    252252    } 
     
    374374      $comment_url = get_absolute_root_url().'comments.php?comment_id='.$comment['comment_id']; 
    375375 
    376       $content = array( 
    377         l10n('Author: %s', stripslashes($GLOBALS['user']['username']) ), 
    378         l10n('Comment: %s', stripslashes($comment['content']) ), 
    379         '', 
    380         l10n('Manage this user comment: %s', $comment_url), 
    381         l10n('(!) This comment requires validation'), 
     376      $keyargs_content = array( 
     377        get_l10n_args('Author: %s', stripslashes($GLOBALS['user']['username']) ), 
     378        get_l10n_args('Comment: %s', stripslashes($comment['content']) ), 
     379        get_l10n_args(''), 
     380        get_l10n_args('Manage this user comment: %s', $comment_url), 
     381        get_l10n_args('(!) This comment requires validation'), 
    382382      ); 
    383383 
    384384      pwg_mail_notification_admins( 
    385         l10n('Comment by %s', stripslashes($GLOBALS['user']['username']) ), 
    386         implode("\n", $content) 
     385        get_l10n_args('Comment by %s', stripslashes($GLOBALS['user']['username']) ), 
     386        $keyargs_content 
    387387      ); 
    388388    } 
     
    411411  include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); 
    412412 
    413   $content = array( 
    414     l10n('Author: %s', $comment['author']), 
     413  $keyargs_content = array( 
     414    get_l10n_args('Author: %s', $comment['author']), 
    415415    ); 
    416416 
    417417  if ($action=='delete') 
    418418  { 
    419     $content[] = l10n('This author removed the comment with id %d', $comment['comment_id']); 
    420   } 
    421   else 
    422   { 
    423     $content[] = l10n('This author modified following comment:'); 
    424     $content[] = l10n('Comment: %s', $comment['content']); 
     419    $keyargs_content[] = get_l10n_args('This author removed the comment with id %d', $comment['comment_id']); 
     420  } 
     421  else 
     422  { 
     423    $keyargs_content[] = get_l10n_args('This author modified following comment:'); 
     424    $keyargs_content[] = get_l10n_args('Comment: %s', $comment['content']); 
    425425  } 
    426426 
    427427  pwg_mail_notification_admins( 
    428     l10n('Comment by %s', $comment['author']), 
    429                 implode("\n", $content) 
    430                 ); 
     428    get_l10n_args('Comment by %s', $comment['author']), 
     429    $keyargs_content 
     430    ); 
    431431} 
    432432 
  • trunk/include/functions_mail.inc.php

    r25358 r25360  
    169169 
    170170/** 
     171 * Return string email format (text/html or text/plain) 
     172 * @param bool is_html 
     173 * @return string 
     174 */ 
     175function get_str_email_format($is_html) 
     176{ 
     177  return ($is_html ? 'text/html' : 'text/plain'); 
     178} 
     179 
     180/** 
    171181 * Switch language to specified language 
    172182 * All entries are push on language stack 
     
    256266 * Send a notification email to all administrators 
    257267 * current user (if admin) is not notified 
    258  * @param string $subject 
    259  * @param string $content 
     268 * @param string|array $subject 
     269 * @param string|array $content 
    260270 * @param boolean $send_technical_details - send user IP and browser 
    261271 * @return boolean 
     
    267277    return false; 
    268278  } 
    269    
    270   // for backward compatibility < 2.6 
    271   if (is_array($subject)) 
    272   { 
    273     $subject = l10n_args($subject); 
    274   } 
    275   if (is_array($content)) 
    276   { 
    277     $content = l10n_args($content); 
    278   } 
    279279 
    280280  global $conf, $user; 
    281    
     281 
     282  if (is_array($subject) or is_array($content)) 
     283  { 
     284    switch_lang_to(get_default_language()); 
     285 
     286    if (is_array($subject)) 
     287    { 
     288      $subject = l10n_args($subject); 
     289    } 
     290    if (is_array($content)) 
     291    { 
     292      $content = l10n_args($content); 
     293    } 
     294 
     295    switch_lang_back(); 
     296  } 
     297 
    282298  $tpl_vars = array(); 
    283299  if ($send_technical_details) 
    284300  { 
    285     $tpl_vars['TECHNICAL'] =  
    286       l10n('Connected user: %s', stripslashes($user['username'])) ."\n". 
    287       l10n('IP: %s', $_SERVER['REMOTE_ADDR']) . "\n" . 
    288       l10n('Browser: %s', $_SERVER['HTTP_USER_AGENT']); 
     301    $tpl_vars['TECHNICAL'] = array( 
     302      'username' => stripslashes($user['username']), 
     303      'ip' => $_SERVER['REMOTE_ADDR'], 
     304      'user_agent' => $_SERVER['HTTP_USER_AGENT'], 
     305      ); 
    289306  } 
    290307 
  • trunk/include/functions_user.inc.php

    r25357 r25360  
    230230      $admin_url = get_absolute_root_url().'admin.php?page=user_list&username='.$login; 
    231231 
    232       $content = array( 
    233         l10n('User: %s', stripslashes($login) ), 
    234         l10n('Email: %s', $_POST['mail_address']), 
    235         '', 
    236         l10n('Admin: %s', $admin_url), 
     232      $keyargs_content = array( 
     233        get_l10n_args('User: %s', stripslashes($login) ), 
     234        get_l10n_args('Email: %s', $_POST['mail_address']), 
     235        get_l10n_args(''), 
     236        get_l10n_args('Admin: %s', $admin_url), 
    237237        ); 
    238238 
    239239      pwg_mail_notification_admins( 
    240         l10n('Registration of %s', stripslashes($login) ), 
    241         implode("\n", $content) 
     240        get_l10n_args('Registration of %s', stripslashes($login) ), 
     241        $keyargs_content 
    242242        ); 
    243243    } 
  • trunk/themes/default/template/mail/text/html/notification_admin.tpl

    r25358 r25360  
    33{if isset($TECHNICAL)} 
    44<p style="padding-top:10px;font-size:11px;"> 
    5 {$TECHNICAL|nl2br} 
     5{'Connected user: %s'|translate:$TECHNICAL.username}<br> 
     6{'IP: %s'|translate:$TECHNICAL.ip}<br> 
     7{'Browser: %s'|translate:$TECHNICAL.user_agent} 
    68</p> 
    79{/if} 
  • trunk/themes/default/template/mail/text/html/notification_by_mail.tpl

    r8723 r25360  
    3939<p>{'See you soon,'|@translate}</p> 
    4040<p style="text-align:center">{$SEND_AS_NAME}</p> 
     41<hr> 
    4142<p> 
    42 <br><hr> 
    4343{'To unsubscribe'|@translate}{', click on'|@translate} <a href="{$UNSUBSCRIBE_LINK}">{$UNSUBSCRIBE_LINK}</a><br> 
    4444{'To subscribe'|@translate}{', click on'|@translate} <a href="{$SUBSCRIBE_LINK}">{$SUBSCRIBE_LINK}</a><br> 
    4545{'If you encounter problems or have any question, please send a message to'|@translate} <a href="mailto:{$CONTACT_EMAIL}?subject={'[NBM] Problems or questions'|@translate}">{$CONTACT_EMAIL}</a><br> 
    46 <hr><br> 
    4746</p> 
     47<hr> 
    4848{if not empty($recent_posts)} 
    4949</div> 
  • trunk/themes/default/template/mail/text/plain/notification_admin.tpl

    r25357 r25360  
    33{if isset($TECHNICAL)} 
    44----------------------------- 
    5 {$TECHNICAL} 
     5{'Connected user: %s'|translate:$TECHNICAL.username} 
     6{'IP: %s'|translate:$TECHNICAL.ip} 
     7{'Browser: %s'|translate:$TECHNICAL.user_agent} 
    68{/if} 
  • trunk/tools/triggers_list.php

    r25202 r25360  
    569569), 
    570570array( 
    571   'name' => 'mail_group_assign_vars', 
    572   'type' => 'trigger_event', 
    573   'vars' => array('array', 'assign_vars'), 
    574   'files' => array('include\functions_mail.inc.php (pwg_mail_group)'), 
    575 ), 
    576 array( 
    577571  'name' => 'nbm_event_handler_added', 
    578572  'type' => 'trigger_action', 
     
    707701), 
    708702array( 
    709   'name' => 'send_mail', 
    710   'type' => 'trigger_event', 
    711   'vars' => array('bool', 'result', 'string', 'mail_to', 'string', 'mail_subject', 'string', 'mail_content', 'array', 'mail_headers'), 
     703  'name' => 'before_send_mail', 
     704  'type' => 'trigger_event', 
     705  'vars' => array('bool', 'result', 'mixed', 'to', 'array', 'arguments', 'PHPMailer', 'mail'), 
    712706  'files' => array('include\functions_mail.inc.php (pwg_mail)'), 
    713707), 
    714708array( 
    715   'name' => 'send_mail_content', 
    716   'type' => 'trigger_event', 
    717   'vars' => array('string', 'content'), 
    718   'files' => array('include\functions_mail.inc.php (pwg_mail)'), 
    719 ), 
    720 array( 
    721   'name' => 'send_mail_headers', 
    722   'type' => 'trigger_event', 
    723   'vars' => array('array', 'headers'), 
    724   'files' => array('include\functions_mail.inc.php (pwg_mail)'), 
    725 ), 
    726 array( 
    727   'name' => 'send_mail_subject', 
    728   'type' => 'trigger_event', 
    729   'vars' => array('string', 'cvt_subject'), 
    730   'files' => array('include\functions_mail.inc.php (pwg_mail)'), 
    731 ), 
    732 array( 
    733   'name' => 'send_mail_to', 
    734   'type' => 'trigger_event', 
    735   'vars' => array('string', 'to'), 
     709  'name' => 'before_parse_mail_template', 
     710  'type' => 'trigger_action', 
     711  'vars' => array('string', 'cache_key', 'string', 'content_type'), 
    736712  'files' => array('include\functions_mail.inc.php (pwg_mail)'), 
    737713), 
Note: See TracChangeset for help on using the changeset viewer.