Changeset 9360


Ignore:
Timestamp:
02/23/11 11:44:07 (9 years ago)
Author:
plg
Message:

feature added: ability to avoid sending technical details with pwg_mail_notification_admins

change: pwg_mail_notification_admins forces the format to be text/plain

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_mail.inc.php

    r8728 r9360  
    278278 * @return boolean (Ok or not) 
    279279 */ 
    280 function pwg_mail_notification_admins($keyargs_subject, $keyargs_content) 
    281 { 
     280function pwg_mail_notification_admins($keyargs_subject, $keyargs_content, $send_technical_details=true) 
     281{ 
     282  global $conf, $user; 
     283   
    282284  // Check arguments 
    283   if 
    284     ( 
    285       empty($keyargs_subject) or 
    286       empty($keyargs_content) 
    287     ) 
     285  if (empty($keyargs_subject) or empty($keyargs_content)) 
    288286  { 
    289287    return false; 
    290288  } 
    291289 
    292   global $conf, $user; 
    293290  $return = true; 
    294291 
     
    296293 
    297294  $query = ' 
    298 select 
    299   U.'.$conf['user_fields']['username'].' as username, 
    300   U.'.$conf['user_fields']['email'].' as mail_address 
    301 from 
    302   '.USERS_TABLE.' as U, 
    303   '.USER_INFOS_TABLE.' as I 
    304 where 
    305   I.user_id =  U.'.$conf['user_fields']['id'].' and 
    306   I.status in (\'webmaster\',  \'admin\') and 
    307   '.$conf['user_fields']['email'].' is not null and 
    308   I.user_id <> '.$user['id'].' 
    309 order by 
    310   username 
    311 '; 
     295SELECT 
     296    u.'.$conf['user_fields']['username'].' AS username, 
     297    u.'.$conf['user_fields']['email'].' AS mail_address 
     298  FROM '.USERS_TABLE.' AS u 
     299    JOIN '.USER_INFOS_TABLE.' AS i ON i.user_id =  u.'.$conf['user_fields']['id'].' 
     300  WHERE i.status in (\'webmaster\',  \'admin\') 
     301    AND '.$conf['user_fields']['email'].' IS NOT NULL 
     302    AND i.user_id <> '.$user['id'].' 
     303  ORDER BY username 
     304;'; 
    312305 
    313306  $datas = pwg_query($query); 
     
    325318  if (count($admins) > 0) 
    326319  { 
    327     $keyargs_content_admin_info = array 
    328     ( 
     320    $keyargs_content_admin_info = array( 
    329321      get_l10n_args('Connected user: %s', stripslashes($user['username'])), 
    330322      get_l10n_args('IP: %s', $_SERVER['REMOTE_ADDR']), 
    331323      get_l10n_args('Browser: %s', $_SERVER['HTTP_USER_AGENT']) 
    332     ); 
     324      ); 
    333325 
    334326    switch_lang_to(get_default_language()); 
    335327 
    336     $return = pwg_mail 
    337     ( 
    338       '', 
    339       array 
    340       ( 
    341         'Bcc' => $admins, 
     328    $content = l10n_args($keyargs_content)."\n"; 
     329    if ($send_technical_details) 
     330    { 
     331      $content.= "\n".l10n_args($keyargs_content_admin_info)."\n"; 
     332    } 
     333 
     334    $return = pwg_mail( 
     335      implode(', ', $admins), 
     336      array( 
    342337        'subject' => '['.$conf['gallery_title'].'] '.l10n_args($keyargs_subject), 
    343         'content' => 
    344            l10n_args($keyargs_content)."\n\n" 
    345           .l10n_args($keyargs_content_admin_info)."\n", 
    346         'content_format' => 'text/plain' 
    347       ) 
    348     ) and $return; 
    349  
     338        'content' => $content, 
     339        'content_format' => 'text/plain', 
     340        'email_format' => 'text/plain', 
     341        ) 
     342      ); 
     343     
    350344    switch_lang_back(); 
    351345  } 
Note: See TracChangeset for help on using the changeset viewer.