Ignore:
Timestamp:
Nov 30, 2009, 10:14:50 PM (15 years ago)
Author:
Eric
Message:

[NBC_UserAdvManager] Pre 2.13

  • Bug 1246 fixed - Extended Description tags are working again ! Caution : The language used and saved in database is the one configured by default in the visitor's browser and not the language given by Language Switch.
  • Adding of round() for calculating the number of days between two visits.
  • FR and EN language files refactoring
File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/NBC_UserAdvManager/trunk/include/functions_UserAdvManager.inc.php

    r4384 r4399  
    1414        $infos1_perso = "";
    1515  $infos2_perso = "";
     16
     17/* We have to get the user's language in database */
     18  $query ='
     19SELECT user_id, language
     20FROM '.USER_INFOS_TABLE.'
     21WHERE user_id = '.$id.'
     22;';
     23  $data = mysql_fetch_assoc(pwg_query($query));
     24  $language = $data['language'];
     25/* And switch gallery to this language before using personalized and multilangual contents */
     26  switch_lang_to($data['language']);
    1627
    1728  switch($typemail)
     
    7586  }
    7687
     88/* Sending the email with subject and contents */
    7789  pwg_mail($email, array(
    7890    'subject' => $subject,
     
    8092  ));
    8193
     94/* Switching back to default language */
     95switch_lang_back();
     96
     97/* ********************** */
     98/* Email sending debugger */
     99/* This is only to trace  */
     100/* the send of emails for */
     101/* debugging              */
     102/* ********************** */ 
     103//  MailLog($email,$subject, $content);
     104/* ********************** */
     105}
     106
     107
     108/* Email sending debugger function */
     109//function MailLog  ($to, $subject, $content)
     110//{
     111//   $fo=fopen (NBC_UserAdvManager_PATH.'admin/maillog.txt','a') ;
     112//   fwrite($fo,"======================\n") ;
     113//   fwrite($fo,'le ' . date('D, d M Y H:i:s') . "\r\n");
     114//   fwrite($fo,$to . "\n" . $subject . "\r\n") ;
     115//   fwrite($fo, "\n" . $content . "\r\n") ;
     116   //fwrite($fo, 'Langue : '."\n" . $language . "\r\n") ;
     117//   fclose($fo) ;
     118   //return mail ($to,$subject) ;
     119//}
     120
     121
     122/* Function called from UserAdvManager_admin.php to resend validation email with or without new validation key */
     123function ResendMail2User($typemail, $user_id, $username, $email, $confirm)
     124{
     125  global $conf;
     126  $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array();
     127        $conf_nbc_UserAdvManager_ConfirmMail = isset($conf['nbc_UserAdvManager_ConfirmMail']) ? explode(";" , $conf['nbc_UserAdvManager_ConfirmMail']) : array();
     128 
     129        include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
     130 
     131        $infos1_perso = "";
     132  $infos2_perso = "";
     133 
     134/* We have to get the user's language in database */
     135  $query ='
     136SELECT user_id, language
     137FROM '.USER_INFOS_TABLE.'
     138WHERE user_id = '.$id.'
     139;';
     140  $data = mysql_fetch_assoc(pwg_query($query));
     141  $language = $data['language'];
     142/* And switch gallery to this language before using personalized and multilangual contents */
     143  switch_lang_to($data['language']);
     144
     145  switch($typemail)
     146  {
     147    case 1:
     148      $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('Reminder_with_key_of_%s', $username));
     149     
     150      if (isset($conf_nbc_UserAdvManager_ConfirmMail[2]) and $conf_nbc_UserAdvManager_ConfirmMail[2] <> '' and isset($conf_nbc_UserAdvManager_ConfirmMail[3]) and $conf_nbc_UserAdvManager_ConfirmMail[3] == 'true' and $confirm)
     151      {
     152        if (function_exists('get_user_language_desc'))
     153        {
     154          $infos1 = get_user_language_desc($conf_nbc_UserAdvManager_ConfirmMail[2])."\n\n";
     155        }
     156                                else $infos1 = l10n($conf_nbc_UserAdvManager_ConfirmMail[2])."\n\n";
     157
     158        $infos2 = array
     159        (
     160          get_l10n_args('Link: %s', ResetConfirmMail($user_id)),
     161          get_l10n_args('', ''),
     162        );       
     163                        }
     164
     165/* Set reminder true */     
     166      $query = "
     167UPDATE ".USER_CONFIRM_MAIL_TABLE."
     168SET reminder = 'true'
     169WHERE user_id = '".$user_id."'
     170;";
     171      pwg_query($query);
     172     
     173                break;
     174     
     175    case 2:
     176      $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('Reminder_without_key_of_%s',$username));
     177     
     178      if (isset($conf_nbc_UserAdvManager_ConfirmMail[2]) and $conf_nbc_UserAdvManager_ConfirmMail[2] <> '' and isset($conf_nbc_UserAdvManager_ConfirmMail[3]) and $conf_nbc_UserAdvManager_ConfirmMail[3] == 'true' and !$confirm)
     179      {
     180        if (function_exists('get_user_language_desc'))
     181        {
     182          $infos1 = get_user_language_desc($conf_nbc_UserAdvManager_ConfirmMail[2])."\n\n";
     183        }
     184        else $infos1 = l10n($conf_nbc_UserAdvManager_ConfirmMail[2])."\n\n";
     185      }
     186     
     187/* Set reminder true */     
     188      $query = "
     189UPDATE ".USER_CONFIRM_MAIL_TABLE."
     190SET reminder = 'true'
     191WHERE user_id = '".$user_id."'
     192;";
     193      pwg_query($query);
     194     
     195    break;
     196        }
     197 
     198  pwg_mail($email, array(
     199    'subject' => $subject,
     200    'content' => ($infos1."\n\n").(isset($infos2) ? l10n_args($infos2)."\n\n" : "").get_absolute_root_url(),
     201  ));
     202
     203/* Switching back to default language */
     204switch_lang_back();
    82205/* ********************** */
    83206/* Email sending debugger */
     
    91214
    92215
    93 /* Email sending debugger function */
    94 //function MailLog  ($to, $subject)
    95 //{
    96 //   $fo=fopen (NBC_UserAdvManager_PATH.'admin/maillog.txt','a') ;
    97 //   fwrite($fo,"======================\n") ;
    98 //   fwrite($fo,'le ' . date('D, d M Y H:i:s') . "\r\n");
    99 //   fwrite($fo,$to . "\n" . $subject . "\r\n") ;
    100 //   fclose($fo) ;
    101    //return mail ($to,$subject) ;
    102 //}
    103 
    104 
    105 /* Function called from UserAdvManager_admin.php to resend validation email with or without new validation key */
    106 function ResendMail2User($typemail, $user_id, $username, $email, $confirm)
     216/* Function called from UserAdvManager_admin.php to send a reminder mail for ghost users */
     217function ghostreminder($user_id, $username, $email)
    107218{
    108219  global $conf;
    109220  $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array();
    110         $conf_nbc_UserAdvManager_ConfirmMail = isset($conf['nbc_UserAdvManager_ConfirmMail']) ? explode(";" , $conf['nbc_UserAdvManager_ConfirmMail']) : array();
    111221 
    112222        include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
    113223 
    114224        $infos1_perso = "";
    115   $infos2_perso = "";
    116 
    117   switch($typemail)
    118   {
    119     case 1:
    120       $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('Reminder_with_key_of_%s', $username));
    121      
    122       if (isset($conf_nbc_UserAdvManager_ConfirmMail[2]) and $conf_nbc_UserAdvManager_ConfirmMail[2] <> '' and isset($conf_nbc_UserAdvManager_ConfirmMail[3]) and $conf_nbc_UserAdvManager_ConfirmMail[3] == 'true' and $confirm)
    123       {
    124         if (function_exists('get_user_language_desc'))
    125         {
    126           $infos1 = get_user_language_desc($conf_nbc_UserAdvManager_ConfirmMail[2])."\n\n";
    127         }
    128                                 else $infos1 = l10n($conf_nbc_UserAdvManager_ConfirmMail[2])."\n\n";
    129 
    130         $infos2 = array
    131         (
    132           get_l10n_args('Link: %s', ResetConfirmMail($user_id)),
    133           get_l10n_args('', ''),
    134         );       
    135                         }
    136 
    137 /* Set reminder true */     
    138       $query = "
    139 UPDATE ".USER_CONFIRM_MAIL_TABLE."
    140 SET reminder = 'true'
    141 WHERE user_id = '".$user_id."'
    142 ;";
    143       pwg_query($query);
    144      
    145                 break;
    146      
    147     case 2:
    148       $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('Reminder_without_key_of_%s',$username));
    149      
    150       if (isset($conf_nbc_UserAdvManager_ConfirmMail[2]) and $conf_nbc_UserAdvManager_ConfirmMail[2] <> '' and isset($conf_nbc_UserAdvManager_ConfirmMail[3]) and $conf_nbc_UserAdvManager_ConfirmMail[3] == 'true' and !$confirm)
    151       {
    152         if (function_exists('get_user_language_desc'))
    153         {
    154           $infos1 = get_user_language_desc($conf_nbc_UserAdvManager_ConfirmMail[2])."\n\n";
    155         }
    156         else $infos1 = l10n($conf_nbc_UserAdvManager_ConfirmMail[2])."\n\n";
    157       }
    158      
    159 /* Set reminder true */     
    160       $query = "
    161 UPDATE ".USER_CONFIRM_MAIL_TABLE."
    162 SET reminder = 'true'
    163 WHERE user_id = '".$user_id."'
    164 ;";
    165       pwg_query($query);
    166      
    167     break;
    168         }
    169  
    170   pwg_mail($email, array(
    171     'subject' => $subject,
    172     'content' => ($infos1."\n\n").(isset($infos2) ? l10n_args($infos2)."\n\n" : "").get_absolute_root_url(),
    173   ));
    174 
    175 /* ********************** */
    176 /* Email sending debugger */
    177 /* This is only to trace  */
    178 /* the send of emails for */
    179 /* debugging              */
    180 /* ********************** */ 
    181 //  MailLog($email,$subject);
    182 /* ********************** */
    183 }
    184 
    185 
    186 /* Function called from UserAdvManager_admin.php to send a reminder mail for ghost users */
    187 function ghostreminder($user_id, $username, $email)
    188 {
    189   global $conf;
    190   $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array();
    191  
    192         include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
    193  
    194         $infos1_perso = "";
     225
     226/* We have to get the user's language in database */
     227  $query ='
     228SELECT user_id, language
     229FROM '.USER_INFOS_TABLE.'
     230WHERE user_id = '.$id.'
     231;';
     232  $data = mysql_fetch_assoc(pwg_query($query));
     233  $language = $data['language'];
     234/* And switch gallery to this language before using personalized and multilangual contents */
     235  switch_lang_to($data['language']);
    195236
    196237  $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('Ghost_remainder_of_%s', $username));
     
    212253  ));
    213254
     255/* Switching back to default language */
     256switch_lang_back();
    214257/* ********************** */
    215258/* Email sending debugger */
Note: See TracChangeset for help on using the changeset viewer.