Changeset 25360 for trunk/include


Ignore:
Timestamp:
Nov 6, 2013, 6:57:53 PM (10 years ago)
Author:
mistic100
Message:

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

Location:
trunk/include
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • 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    }
Note: See TracChangeset for help on using the changeset viewer.