Ignore:
Timestamp:
Nov 19, 2009, 10:54:46 PM (15 years ago)
Author:
Eric
Message:

[NBC_UserAdvManager] Merged from trunk to branch 2.12
Bug 1238 fixed - Simple custom email text wasn't send when Extended Description plugin wasn't set
Bug 1245 fixed - Semicolons (;) are no longer allowed in text areas (mail info text, ConfirmMail text, reminder text,...). They'll be replaced by dots (.).
Bug 1248 fixed - Php notice on user registration with a forbidden email domain
Bug 1250 fixed - Email provider didn't work after the third exclusion in list

Location:
extensions/NBC_UserAdvManager/branches/2.12
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • extensions/NBC_UserAdvManager/branches/2.12/admin/UserAdvManager_admin.php

    r4168 r4317  
    4545$error = array();
    4646$UserAdvManager_Password_Test_Score = 0;
     47$pattern = '/;/';
     48$replacement = '.';
     49
     50$UserAdvManager_MailInfo_Error_Txt = false;
     51$UserAdvManager_ConfirmMail_Error_Txt = false;
     52$UserAdvManager_Reminder_Error_Txt = false;
     53$UserAdvManager_ConfirmMail_Error_Txt1 = false;
     54$UserAdvManager_ConfirmMail_Error_Txt2 = false;
    4755
    4856// +-----------------------------------------------------------------------+
     
    6068       
    6169        if (isset($_POST['submit']) and !is_adviser() and isset($_POST['UserAdvManager_Mail_Info']) and isset($_POST['UserAdvManager_No_Casse']) and isset($_POST['UserAdvManager_Username_Char']) and isset($_POST['UserAdvManager_Confirm_Mail']) and isset($_POST['UserAdvManager_No_Comment_Anonymous']) and isset($_POST['UserAdvManager_Password_Enforced']) and isset($_POST['UserAdvManager_AdminPassword_Enforced']) and isset($_POST['UserAdvManager_GhostUser_Tracker']))
    62   {
     70  { 
    6371                $_POST['UserAdvManager_MailInfo_Text'] = str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UserAdvManager_MailInfo_Text']));
     72   
    6473                $_POST['UserAdvManager_ConfirmMail_Text'] = str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UserAdvManager_ConfirmMail_Text']));
    6574
    66   $_POST['UserAdvManager_GhostTracker_ReminderText'] = str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UserAdvManager_GhostTracker_ReminderText']));
     75    $_POST['UserAdvManager_GhostTracker_ReminderText'] = str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UserAdvManager_GhostTracker_ReminderText']));
     76
     77
     78/* Control of semicolons - Replaced by dots - Warning message is displayed */   
     79    if ((preg_match($pattern, $_POST['UserAdvManager_MailInfo_Text'])) or (preg_match($pattern, $_POST['UserAdvManager_GhostTracker_ReminderText'])) or (preg_match($pattern, $_POST['UserAdvManager_ConfirmMail_Text'])))
     80    {
     81      if (preg_match($pattern, $_POST['UserAdvManager_MailInfo_Text']))
     82      {
     83        $_POST['UserAdvManager_MailInfo_Text'] = preg_replace($pattern, $replacement, $_POST['UserAdvManager_MailInfo_Text']);
     84        $UserAdvManager_MailInfo_Error_Txt = true;
     85      }
     86     
     87      if (preg_match($pattern, $_POST['UserAdvManager_ConfirmMail_Text']))
     88      {
     89        $_POST['UserAdvManager_ConfirmMail_Text'] = preg_replace($pattern, $replacement, $_POST['UserAdvManager_ConfirmMail_Text']);
     90        $UserAdvManager_ConfirmMail_Error_Txt = true;
     91      }
     92     
     93      if (preg_match($pattern, $_POST['UserAdvManager_GhostTracker_ReminderText']))
     94      {
     95        $_POST['UserAdvManager_GhostTracker_ReminderText'] = preg_replace($pattern, $replacement, $_POST['UserAdvManager_GhostTracker_ReminderText']);
     96        $UserAdvManager_Reminder_Error_Txt = true;
     97      }
     98     
     99      array_push($page['errors'], l10n('mail_text_error'));
     100    }
    67101               
    68102                $newconf_nbc_UserAdvManager = $_POST['UserAdvManager_Mail_Info'].';'.$_POST['UserAdvManager_No_Casse'].';'.$_POST['UserAdvManager_Confirm_Mail'].';'.(isset($_POST['UserAdvManager_No_Confirm_Group'])?$_POST['UserAdvManager_No_Confirm_Group']:'').';'.(isset($_POST['UserAdvManager_Validated_Group'])?$_POST['UserAdvManager_Validated_Group']:'').';'.(isset($_POST['UserAdvManager_Validated_Status'])?$_POST['UserAdvManager_Validated_Status']:'').';'.$_POST['UserAdvManager_No_Comment_Anonymous'].';'.$_POST['UserAdvManager_Username_Char'].';'.$_POST['UserAdvManager_Username_List'].';'.(isset($_POST['UserAdvManager_No_Confirm_Status'])?$_POST['UserAdvManager_No_Confirm_Status']:'').';'.$_POST['UserAdvManager_MailInfo_Text'].';'.$_POST['UserAdvManager_ConfirmMail_Text'].';'.$_POST['UserAdvManager_MailExclusion'].';'.$_POST['UserAdvManager_MailExclusion_List'].';'.$_POST['UserAdvManager_Password_Enforced'].';'.$_POST['UserAdvManager_Password_Score'].';'.$_POST['UserAdvManager_AdminPassword_Enforced'].';'.$_POST['UserAdvManager_GhostUser_Tracker'].';'.$_POST['UserAdvManager_GhostTracker_DayLimit'].';'.$_POST['UserAdvManager_GhostTracker_ReminderText'];
     
    107141  $result = pwg_query($query);
    108142       
    109   while ($row = mysql_fetch_array($result))
     143  while ($row = mysql_fetch_assoc($result))
    110144  {
    111145    $groups[$row['id']] = $row['name'];
     
    214248    'UserAdvManager_GHOSTRACKER_REMINDERTEXT' => $conf_nbc_UserAdvManager[19],
    215249                'UserAdvManager_PASSWORD_TEST_SCORE'      => $UserAdvManager_Password_Test_Score,
     250    'UserAdvManager_ERROR_REPORTS1'           => $UserAdvManager_MailInfo_Error_Txt,
     251    'UserAdvManager_ERROR_REPORTS2'           => $UserAdvManager_ConfirmMail_Error_Txt,
     252    'UserAdvManager_ERROR_REPORTS3'           => $UserAdvManager_Reminder_Error_Txt,
    216253    )
    217254  );
     
    238275                  $result = pwg_query($query);
    239276                       
    240                   while($row = mysql_fetch_array($result))
     277                  while($row = mysql_fetch_assoc($result))
    241278                {
    242                                 $msg_error1 .= (($msg_error1 <> '') ? '<br/>' : '') . l10n('Err_audit_no_casse').$row['username'];
     279                                $msg_error1 .= (($msg_error1 <> '') ? '<br/>' : '') . l10n('Err_audit_no_casse').stripslashes($row['username']);
    243280                        }
    244281                }
     
    256293                        $result = pwg_query($query);
    257294                       
    258                         while($row = mysql_fetch_array($result))
     295                        while($row = mysql_fetch_assoc($result))
    259296                        {
    260                                 if (!ValidateUsername($row['username']))
    261                                         $msg_error2 .= (($msg_error2 <> '') ? '<br/>' : '') . l10n('Err_audit_username_char').$row['username'];
     297                                if (!ValidateUsername(stripslashes($row['username'])))
     298                                        $msg_error2 .= (($msg_error2 <> '') ? '<br/>' : '') . l10n('Err_audit_username_char').stripslashes($row['username']);
    262299                        }
    263300                }
     
    275312                  $result = pwg_query($query);
    276313                       
    277                   while($row = mysql_fetch_array($result))
     314                  while($row = mysql_fetch_assoc($result))
    278315                  {
    279316                                $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array();
     
    284321                                  if (preg_match($pattern, $row['mail_address']))
    285322                                  {
    286                                                 $msg_error3 .=  (($msg_error3 <> '') ? '<br/>' : '') . l10n('Err_audit_email_forbidden').$row['username'].' ('.$row['mail_address'].')';
     323                                                $msg_error3 .=  (($msg_error3 <> '') ? '<br/>' : '') . l10n('Err_audit_email_forbidden').stripslashes($row['username']).' ('.$row['mail_address'].')';
    287324                                        }
    288325                                }
     
    340377                {
    341378                $_POST['UserAdvManager_ConfirmMail_ReMail_Txt1'] = str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UserAdvManager_ConfirmMail_ReMail_Txt1']));
     379
    342380                $_POST['UserAdvManager_ConfirmMail_ReMail_Txt2'] = str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UserAdvManager_ConfirmMail_ReMail_Txt2']));
     381
     382/* Control of semicolons - Replaced by dots - Warning message displayed */
     383    if ((preg_match($pattern, $_POST['UserAdvManager_ConfirmMail_ReMail_Txt1'])) or (preg_match($pattern, $_POST['UserAdvManager_ConfirmMail_ReMail_Txt2'])))
     384    {
     385      if ((preg_match($pattern, $_POST['UserAdvManager_ConfirmMail_ReMail_Txt1'])))
     386      {
     387        $_POST['UserAdvManager_ConfirmMail_ReMail_Txt1'] = preg_replace($pattern, $replacement, $_POST['UserAdvManager_ConfirmMail_ReMail_Txt1']);
     388        $UserAdvManager_ConfirmMail_Error_Txt1 = true;
     389      }
     390     
     391      if ((preg_match($pattern, $_POST['UserAdvManager_ConfirmMail_ReMail_Txt2'])))
     392      {
     393        $_POST['UserAdvManager_ConfirmMail_ReMail_Txt2'] = preg_replace($pattern, $replacement, $_POST['UserAdvManager_ConfirmMail_ReMail_Txt2']);
     394       
     395        $UserAdvManager_ConfirmMail_Error_Txt2 = true;
     396      }
     397     
     398      array_push($page['errors'], l10n('mail_text_error'));
     399    }
    343400                 
    344401                $newconf_nbc_UserAdvManager_ConfirmMail = $_POST['UserAdvManager_ConfirmMail_TimeOut'].';'.$_POST['UserAdvManager_ConfirmMail_Delay'].';'.$_POST['UserAdvManager_ConfirmMail_ReMail_Txt1'].';'.$_POST['UserAdvManager_ConfirmMail_Remail'].';'.$_POST['UserAdvManager_ConfirmMail_ReMail_Txt2'];
     
    371428    'UserAdvManager_CONFIRMMAIL_REMAIL_TXT1'            => $conf_nbc_UserAdvManager_ConfirmMail[2],
    372429    'UserAdvManager_CONFIRMMAIL_REMAIL_TXT2'            => $conf_nbc_UserAdvManager_ConfirmMail[4],
     430    'UserAdvManager_ERROR_REPORTS1'             => $UserAdvManager_ConfirmMail_Error_Txt1,
     431    'UserAdvManager_ERROR_REPORTS2'             => $UserAdvManager_ConfirmMail_Error_Txt2,
    373432        )
    374433          );           
     
    588647WHERE id = '".$user_id."'
    589648;";
    590                                         $data = mysql_fetch_array(pwg_query($query));
     649                                        $data = mysql_fetch_assoc(pwg_query($query));
    591650                               
    592                 ResendMail2User($typemail,$user_id,$data['username'],$data['mail_address'],true);
     651                ResendMail2User($typemail,$user_id,stripslashes($data['username']),$data['mail_address'],true);
    593652        }
    594653        array_push(
     
    673732;";
    674733                                       
    675                                         $data = mysql_fetch_array(pwg_query($query));
     734                                        $data = mysql_fetch_assoc(pwg_query($query));
    676735                               
    677                 ResendMail2User($typemail,$user_id,$data['username'],$data['mail_address'],false);                             
     736                ResendMail2User($typemail,$user_id,stripslashes($data['username']),$data['mail_address'],false);                               
    678737        }
    679738        array_push(
     
    757816;";
    758817                                       
    759                                         $data = mysql_fetch_array(pwg_query($query));
     818                                        $data = mysql_fetch_assoc(pwg_query($query));
    760819                               
    761820                ForceValidation($data['id']);                           
     
    788847                $result = pwg_query($query);
    789848         
    790     while ($row = mysql_fetch_array($result))
     849    while ($row = mysql_fetch_assoc($result))
    791850    {
    792851      $groups[$row['id']] = $row['name'];
     
    884943                'U_PROFILE' => $profile_url.$local_user['id'],
    885944                'U_PERM' => $perm_url.$local_user['id'],
    886                 'USERNAME' => $local_user['username']
     945                'USERNAME' => stripslashes($local_user['username'])
    887946                                                .($local_user['id'] == $conf['guest_id']
    888947                                                ? '<BR />['.l10n('is_the_guest').']' : '')
     
    11121171;";
    11131172                                       
    1114                                         $data = mysql_fetch_array(pwg_query($query));
     1173                                        $data = mysql_fetch_assoc(pwg_query($query));
    11151174                               
    1116                 ghostreminder($user_id,$data['username'],$data['mail_address']);                               
     1175                ghostreminder($user_id,stripslashes($data['username']),$data['mail_address']);                         
    11171176        }
    11181177        array_push(
     
    11561215          $result = pwg_query($query);
    11571216         
    1158           while ($row = mysql_fetch_array($result))
     1217          while ($row = mysql_fetch_assoc($result))
    11591218          {
    11601219            list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();'));
     
    11831242          $result = pwg_query($query);
    11841243         
    1185           while($row = mysql_fetch_array($result))
     1244          while($row = mysql_fetch_assoc($result))
    11861245          {
    11871246            list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();'));
     
    12761335                'ID' => $local_user['id'],
    12771336                'CHECKED' => $checked,
    1278                 'USERNAME' => $local_user['username']
     1337                'USERNAME' => stripslashes($local_user['username'])
    12791338                                                .($local_user['id'] == $conf['guest_id']
    12801339                                                ? '<BR />['.l10n('is_the_guest').']' : '')
  • extensions/NBC_UserAdvManager/branches/2.12/admin/confirmmail.tpl

    r4160 r4317  
    2121   
    2222{if $UserAdvManager_CONFIRMMAIL_REMAIL_TRUE}
     23  {if $UserAdvManager_ERROR_REPORTS1}
     24                <li><label>{'UserAdvManager_ConfirmMail_ReMail_Txt1'|@translate}</label><br>
     25                <textarea name="UserAdvManager_ConfirmMail_ReMail_Txt1" id="UserAdvManager_ConfirmMail_ReMail_Txt1" rows="10" cols="80" style="color: red" {$TAG_INPUT_ENABLED}>{$UserAdvManager_CONFIRMMAIL_REMAIL_TXT1}</textarea><br><br>
     26          </li>
     27  {else}
    2328                <li><label>{'UserAdvManager_ConfirmMail_ReMail_Txt1'|@translate}</label><br>
    2429                <textarea name="UserAdvManager_ConfirmMail_ReMail_Txt1" id="UserAdvManager_ConfirmMail_ReMail_Txt1" rows="10" cols="80" {$TAG_INPUT_ENABLED}>{$UserAdvManager_CONFIRMMAIL_REMAIL_TXT1}</textarea><br><br>
    2530          </li>
    26                
    27     <li><label>{'UserAdvManager_ConfirmMail_ReMail_Txt2'|@translate}</label><br>
    28                 <textarea name="UserAdvManager_ConfirmMail_ReMail_Txt2" id="UserAdvManager_ConfirmMail_ReMail_Txt2" rows="10" cols="80" {$TAG_INPUT_ENABLED}>{$UserAdvManager_CONFIRMMAIL_REMAIL_TXT2}</textarea><br>
    29           </li>
     31  {/if}
    3032{else}
    3133                <li><label>{'UserAdvManager_ConfirmMail_ReMail_Txt1'|@translate}</label><br>
    3234                <textarea  name="UserAdvManager_ConfirmMail_ReMail_Txt1" id="UserAdvManager_ConfirmMail_ReMail_Txt1" rows="10" cols="80" readonly{$TAG_INPUT_ENABLED}>{$UserAdvManager_CONFIRMMAIL_REMAIL_TXT1}</textarea><br><br>
    3335          </li>
    34                
     36{/if}
     37
     38{if $UserAdvManager_CONFIRMMAIL_REMAIL_TRUE}
     39  {if $UserAdvManager_ERROR_REPORTS2}
     40    <li><label>{'UserAdvManager_ConfirmMail_ReMail_Txt2'|@translate}</label><br>
     41                <textarea name="UserAdvManager_ConfirmMail_ReMail_Txt2" id="UserAdvManager_ConfirmMail_ReMail_Txt2" rows="10" cols="80" style="color: red" {$TAG_INPUT_ENABLED}>{$UserAdvManager_CONFIRMMAIL_REMAIL_TXT2}</textarea><br>
     42          </li>
     43  {else}               
     44    <li><label>{'UserAdvManager_ConfirmMail_ReMail_Txt2'|@translate}</label><br>
     45                <textarea name="UserAdvManager_ConfirmMail_ReMail_Txt2" id="UserAdvManager_ConfirmMail_ReMail_Txt2" rows="10" cols="80" {$TAG_INPUT_ENABLED}>{$UserAdvManager_CONFIRMMAIL_REMAIL_TXT2}</textarea><br>
     46          </li>
     47  {/if}
     48{else}
    3549    <li><label>{'UserAdvManager_ConfirmMail_ReMail_Txt2'|@translate}</label><br>
    3650                <textarea name="UserAdvManager_ConfirmMail_ReMail_Txt2" id="UserAdvManager_ConfirmMail_ReMail_Txt2" rows="10" cols="80" readonly {$TAG_INPUT_ENABLED}>{$UserAdvManager_CONFIRMMAIL_REMAIL_TXT2}</textarea><br>
  • extensions/NBC_UserAdvManager/branches/2.12/admin/global.tpl

    r4160 r4317  
    6969     
    7070{if $UserAdvManager_GHOSTRACKER_TRUE}
     71  {if $UserAdvManager_ERROR_REPORTS3}
     72        <li><label>{'UserAdvManager_GhostTracker_ReminderText'|@translate}</label><br><br>
     73        <textarea name="UserAdvManager_GhostTracker_ReminderText" id="UserAdvManager_GhostTracker_ReminderText" rows="10" cols="80" style="color: red" {$TAG_INPUT_ENABLED}>{$UserAdvManager_GHOSTRACKER_REMINDERTEXT}</textarea><br><br>
     74        </li>
     75  {else}
    7176        <li><label>{'UserAdvManager_GhostTracker_ReminderText'|@translate}</label><br><br>
    7277        <textarea name="UserAdvManager_GhostTracker_ReminderText" id="UserAdvManager_GhostTracker_ReminderText" rows="10" cols="80" {$TAG_INPUT_ENABLED}>{$UserAdvManager_GHOSTRACKER_REMINDERTEXT}</textarea><br><br>
    7378        </li>
     79  {/if}
    7480{else}
    7581        <li><label>{'UserAdvManager_GhostTracker_ReminderText'|@translate}</label><br><br>
     
    9096        </li>
    9197
    92 {if $UserAdvManager_MAIL_INFO_TRUE}     
     98{if $UserAdvManager_MAIL_INFO_TRUE}
     99  {if $UserAdvManager_ERROR_REPORTS1}     
     100        <li><label>{'UserAdvManager_MailInfo_Text'|@translate}</label><br><br>
     101        <textarea name="UserAdvManager_MailInfo_Text" id="UserAdvManager_MailInfo_Text" rows="10" cols="80" style="color: red"  {$TAG_INPUT_ENABLED}>{$UserAdvManager_MAILINFO_TEXT}</textarea><br><br>
     102        </li>
     103  {else}
    93104        <li><label>{'UserAdvManager_MailInfo_Text'|@translate}</label><br><br>
    94105        <textarea name="UserAdvManager_MailInfo_Text" id="UserAdvManager_MailInfo_Text" rows="10" cols="80" {$TAG_INPUT_ENABLED}>{$UserAdvManager_MAILINFO_TEXT}</textarea><br><br>
    95106        </li>
     107  {/if}
    96108{else}
    97109        <li><label>{'UserAdvManager_MailInfo_Text'|@translate}</label><br><br>
     
    105117        </li>
    106118
    107 {if $UserAdvManager_CONFIRM_MAIL_TRUE}     
     119{if $UserAdvManager_CONFIRM_MAIL_TRUE}
     120  {if $UserAdvManager_ERROR_REPORTS2}     
     121        <li><label>{'UserAdvManager_ConfirmMail_Text'|@translate}</label><br><br>
     122        <textarea name="UserAdvManager_ConfirmMail_Text" id="UserAdvManager_ConfirmMail_Text" rows="10" cols="80" style="color: red" {$TAG_INPUT_ENABLED}>{$UserAdvManager_CONFIRMMAIL_TEXT}</textarea><br><br>
     123        </li>
     124  {else}
    108125        <li><label>{'UserAdvManager_ConfirmMail_Text'|@translate}</label><br><br>
    109126        <textarea name="UserAdvManager_ConfirmMail_Text" id="UserAdvManager_ConfirmMail_Text" rows="10" cols="80" {$TAG_INPUT_ENABLED}>{$UserAdvManager_CONFIRMMAIL_TEXT}</textarea><br><br>
    110127        </li>
     128  {/if}
    111129{else}
    112130        <li><label>{'UserAdvManager_ConfirmMail_Text'|@translate}</label><br><br>
  • extensions/NBC_UserAdvManager/branches/2.12/include/functions_UserAdvManager.inc.php

    r4188 r4317  
    1818  {
    1919    case 1:
    20       $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('Add of %s', $username));
     20      $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('Add of %s', stripslashes($username)));
    2121      $password = $password <> '' ? $password : l10n('UserAdvManager_empty_pwd');
    2222     
    23       if (function_exists('get_user_language_desc') and isset($conf_nbc_UserAdvManager[10]) and $conf_nbc_UserAdvManager[10] <> '')
    24         $infos1_perso = get_user_language_desc($conf_nbc_UserAdvManager[10])."\n\n";
     23      if (isset($conf_nbc_UserAdvManager[10]) and $conf_nbc_UserAdvManager[10] <> '')
     24      {
     25        if (function_exists('get_user_language_desc'))
     26        {
     27          $infos1_perso = get_user_language_desc($conf_nbc_UserAdvManager[10])."\n\n";
     28        }
     29        else $infos1_perso = l10n($conf_nbc_UserAdvManager[10])."\n\n";
     30      }
    2531     
    2632      break;
    2733     
    2834    case 2:
    29       $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('Update of %s', $username));
     35      $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('Update of %s', stripslashes($username)));
    3036      $password = $password <> '' ? $password : l10n('UserAdvManager_empty_pwd');
    3137
     
    3339       
    3440    case 3:
    35       $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('Update of %s', $username));
     41      $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('Update of %s', stripslashes($username)));
    3642      $password = $password <> '' ? $password : l10n('UserAdvManager_no_update_pwd');
    3743
     
    4248  {
    4349    $infos1 = array(
    44       get_l10n_args('infos_mail %s', $username),
    45       get_l10n_args('User: %s', $username),
     50      get_l10n_args('infos_mail %s', stripslashes($username)),
     51      get_l10n_args('User: %s', stripslashes($username)),
    4652      get_l10n_args('Password: %s', $password),
    4753      get_l10n_args('Email: %s', $email),
     
    5965    );
    6066
    61     if (function_exists('get_user_language_desc') and isset($conf_nbc_UserAdvManager[11]) and $conf_nbc_UserAdvManager[11] <> '')
    62       $infos2_perso = get_user_language_desc($conf_nbc_UserAdvManager[11])."\n\n";
     67    if (isset($conf_nbc_UserAdvManager[11]) and $conf_nbc_UserAdvManager[11] <> '')
     68    {
     69      if (function_exists('get_user_language_desc'))
     70      {
     71        $infos2_perso = get_user_language_desc($conf_nbc_UserAdvManager[11])."\n\n";
     72      }
     73      else $infos2_perso = l10n($conf_nbc_UserAdvManager[11])."\n\n";
     74    }
    6375  }
    6476
     
    108120      $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('Reminder_with_key_of_%s', $username));
    109121     
    110       if (function_exists('get_user_language_desc') and 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)
     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)
    111123      {
    112                                 $infos1 = get_user_language_desc($conf_nbc_UserAdvManager_ConfirmMail[2])."\n\n";
    113                        
    114                                 $infos2 = array
    115                                 (
    116                                         get_l10n_args('Link: %s', ResetConfirmMail($user_id)),
    117                                         get_l10n_args('', ''),
    118                                 );
     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        );       
    119135                        }
     136     
    120137                break;
    121138     
    122139    case 2:
    123       $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('Reminder_without_key_of_%s', $username));
    124      
    125       if (function_exists('get_user_language_desc') and 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)
     140      $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('Reminder_without_key_of_%s',$username));
     141     
     142      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)
    126143      {
    127                                 $infos1 = get_user_language_desc($conf_nbc_UserAdvManager_ConfirmMail[2])."\n\n";
     144        if (function_exists('get_user_language_desc'))
     145        {
     146          $infos1 = get_user_language_desc($conf_nbc_UserAdvManager_ConfirmMail[2])."\n\n";
     147        }
     148        else $infos1 = l10n($conf_nbc_UserAdvManager_ConfirmMail[2])."\n\n";                           
    128149      }
     150     
    129151    break;
    130152        }
     153 
    131154  pwg_mail($email, array(
    132155    'subject' => $subject,
     
    157180  $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('Ghost_remainder_of_%s', $username));
    158181     
    159   if (function_exists('get_user_language_desc') and isset($conf_nbc_UserAdvManager[19]) and $conf_nbc_UserAdvManager[19] <> '' and isset($conf_nbc_UserAdvManager[17]) and $conf_nbc_UserAdvManager[17] == 'true')
    160   {
    161     $infos1 = get_user_language_desc($conf_nbc_UserAdvManager[19])."\n\n";
     182  if (isset($conf_nbc_UserAdvManager[19]) and $conf_nbc_UserAdvManager[19] <> '' and isset($conf_nbc_UserAdvManager[17]) and $conf_nbc_UserAdvManager[17] == 'true')
     183  {
     184    if (function_exists('get_user_language_desc'))
     185    {
     186      $infos1 = get_user_language_desc($conf_nbc_UserAdvManager[19])."\n\n";
     187    }
     188    else $infos1 = l10n($conf_nbc_UserAdvManager[19])."\n\n";
     189   
    162190    resetlastvisit($user_id);
    163191  }
     
    351379WHERE id = '".$id."'
    352380;";
    353     $data = mysql_fetch_array(pwg_query($query));
     381    $data = mysql_fetch_assoc(pwg_query($query));
    354382       
    355383    if (!empty($data) and isset($data['user_id']) and !isset($data['date_check']))
     
    517545WHERE user_id = '".$id."'
    518546;";
    519     $data = mysql_fetch_array(pwg_query($query));
     547    $data = mysql_fetch_assoc(pwg_query($query));
    520548
    521549    if (!empty($data) and isset($data['user_id']) and !isset($data['date_check']))
     
    588616    list($username) = mysql_fetch_row(pwg_query($query));
    589617
    590     return isset($username) ? $username : '';
     618    return isset($username) ? stripslashes($username) : '';
    591619  }
    592620}
     
    616644
    617645/* Function called from main.inc.php - Check if user's email is in excluded email providers list */
     646/* Doesn't work on call - Must be copied in main.inc.php to work */
    618647function ValidateEmailProvider($email)
    619648{
     
    629658                        $pattern = '/'.$conf_nbc_MailExclusion[$i].'/';
    630659                        if (preg_match($pattern, $ncsemail))
     660      {
    631661                        return false;
    632                 else
     662      }
     663      else
     664      {
    633665                        return true;
     666      }
    634667                }
    635668        }
     
    690723        $result = pwg_query($query);
    691724     
    692   while ($row = mysql_fetch_array($result))
     725  while ($row = mysql_fetch_assoc($result))
    693726  {
    694727        $user = $row;
     
    717750                $result = pwg_query($query);
    718751       
    719     while ($row = mysql_fetch_array($result))
     752    while ($row = mysql_fetch_assoc($result))
    720753    {
    721754        array_push(
     
    755788        $result = pwg_query($query);
    756789     
    757   while ($row = mysql_fetch_array($result))
     790  while ($row = mysql_fetch_assoc($result))
    758791  {
    759792        $user = $row;
  • extensions/NBC_UserAdvManager/branches/2.12/language/de_DE/plugin.lang.php

    r4250 r4317  
    172172$lang['GhostTracker_Init_OK'] = 'Geist Tracker neu gehstellt !';
    173173// --------- End: New or revised $lang ---- from version 2.12.2
     174// --------- Starting below: New or revised $lang ---- from version 2.12.7
     175/* TODO */$lang['mail_text_error'] = '<b>Warning!</b> - Semicolons (;) are not allowed in addtionnal email text. This Character have been automatically replaced by a dot (.). For information, the amended text(s) is(are) shown in red in the corresponding field(s). Please, check it(them) out.';
     176// --------- End: New or revised $lang ---- from version 2.12.7
    174177
    175178
  • extensions/NBC_UserAdvManager/branches/2.12/language/en_UK/plugin.lang.php

    r4250 r4317  
    173173$lang['GhostTracker_Init_OK'] = 'Ghost Tracker reset done !';
    174174// --------- End: New or revised $lang ---- from version 2.12.2
     175// --------- Starting below: New or revised $lang ---- from version 2.12.7
     176$lang['mail_text_error'] = '<b>Warning!</b> - Semicolons (;) are not allowed in addtionnal email text. This Character have been automatically replaced by a dot (.). For information, the amended text(s) is(are) shown in red in the corresponding field(s). Please, check it(them) out.';
     177// --------- End: New or revised $lang ---- from version 2.12.7
    175178
    176179
  • extensions/NBC_UserAdvManager/branches/2.12/language/es_ES/plugin.lang.php

    r4250 r4317  
    173173$lang['GhostTracker_Init_OK'] = '¡Ghost Tracker restablecer hecho!';
    174174// --------- End: New or revised $lang ---- from version 2.12.2
     175// --------- Starting below: New or revised $lang ---- from version 2.12.7
     176/* TODO */$lang['mail_text_error'] = '<b>Warning!</b> - Semicolons (;) are not allowed in addtionnal email text. This Character have been automatically replaced by a dot (.). For information, the amended text(s) is(are) shown in red in the corresponding field(s). Please, check it(them) out.';
     177// --------- End: New or revised $lang ---- from version 2.12.7
    175178
    176179
  • extensions/NBC_UserAdvManager/branches/2.12/language/fr_FR/plugin.lang.php

    r4250 r4317  
    172172$lang['GhostTracker_Init_OK'] = 'Initialisation Ghost Tracker effectuée !';
    173173// --------- End: New or revised $lang ---- from version 2.12.2
     174// --------- Starting below: New or revised $lang ---- from version 2.12.7
     175$lang['mail_text_error'] = '<b>Attention!</b> - Le point-virgule (;) n\'est pas autorisé dans le texte additionnel des emails. Ce caractère a été automatiquement remplacé par un point (.). Pour information, le(s) texte(s) modifié(s) est(sont) affiché(s) en rouge dans le(s) champ(s) correspondant(s). Veuillez le(s) vérifier.';
     176// --------- End: New or revised $lang ---- from version 2.12.7
    174177
    175178
  • extensions/NBC_UserAdvManager/branches/2.12/language/it_IT/plugin.lang.php

    r4250 r4317  
    173173/* TODO */$lang['GhostTracker_Init_OK'] = 'Ghost Tracker reset done !';
    174174// --------- End: New or revised $lang ---- from version 2.12.2
     175// --------- Starting below: New or revised $lang ---- from version 2.12.7
     176/* TODO */$lang['mail_text_error'] = '<b>Warning!</b> - Semicolons (;) are not allowed in addtionnal email text. This Character have been automatically replaced by a dot (.). For information, the amended text(s) is(are) shown in red in the corresponding field(s). Please, check it(them) out.';
     177// --------- End: New or revised $lang ---- from version 2.12.7
    175178
    176179
  • extensions/NBC_UserAdvManager/branches/2.12/main.inc.php

    r4250 r4317  
    22/*
    33Plugin Name: NBC UserAdvManager
    4 Version: 2.12.6
     4Version: 2.12.7
    55Description: Renforcer les possibilités de gestion des utilisateurs - Enforce users management
    66Plugin URI: http://fr.piwigo.org/ext/extension_view.php?eid=216
     
    9999-- 2.12.6 : Bug 1236 fixed -  Admins was unable to add a new user in the user_list page.
    100100            Beginning of IT translations
     101           
     102-- 2.12.7 : Bug 1238 fixed - Simple custom email text wasn't send when Extended Description plugin wasn't set
     103            Bug 1245 fixed - Semicolons (;) are no longer allowed in text areas (mail info text, ConfirmMail text, reminder text,...). They'll be replaced by dots (.).
     104            Bug 1248 fixed - Php notice on user registration with a forbidden email domain
     105            Bug 1250 fixed - Email provider didn't work after the third exclusion in list
     106            Escaping all special characters typed in login name and recover them
    101107*/
    102108
     
    286292from '.USERS_TABLE.'
    287293where upper('.$conf['user_fields']['email'].') = upper(\''.$_POST['email'].'\');';
    288       list($count) = mysql_fetch_array(pwg_query($query));
    289       if ($count != 0)
    290       {
    291         return l10n('reg_err_mail_address_dbl');
    292       }
    293     }
    294   }
    295   else
    296   {
    297     /* ***************************** */
    298     /* Standard Piwigo's email check */
    299     /* ***************************** */
    300     $atom   = '[-a-z0-9!#$%&\'*+\\/=?^_`{|}~]';   // before  arobase
    301     $domain = '([a-z0-9]([-a-z0-9]*[a-z0-9]+)?)'; // domain name
    302     $regex = '/^' . $atom . '+' . '(\.' . $atom . '+)*' . '@' . '(' . $domain . '{1,63}\.)+' . $domain . '{2,63}$/i';
    303 
    304     if (!preg_match($regex, $_POST['mail_address']))
    305     {
    306       return l10n('reg_err_mail_address');
    307     }
    308    
    309     if (!empty($_POST['mail_address']))
    310     {
    311       $query = '
    312 select count(*)
    313 from '.USERS_TABLE.'
    314 where upper('.$conf['user_fields']['email'].') = upper(\''.$_POST['mail_address'].'\');';
    315       list($count) = mysql_fetch_array(pwg_query($query));
     294      list($count) = mysql_fetch_assoc(pwg_query($query));
    316295      if ($count != 0)
    317296      {
     
    372351
    373352  /* Email without forbidden domains */
    374   if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['mail_address']) and !ValidateEmailProvider($_POST['mail_address']))
    375   {
    376     //$_POST['mail_address'] = '';
    377     return($lang['reg_err_login1'] = l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'");
    378   }
     353  /* This doesn't work */
     354//  if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['mail_address']) and !ValidateEmailProvider($_POST['mail_address']))
     355//  {
     356//    $_POST['mail_address'] = '';
     357//    return($lang['reg_err_login1'] = l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'");
     358//  }
     359  /* This work with a code copy of ValidateEmailProvider() function */
     360  if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['mail_address']))
     361  {
     362    $ncsemail = strtolower($_POST['mail_address']);
     363    $conf_nbc_MailExclusion = preg_split("/[\s,]+/",$conf_nbc_UserAdvManager[13]);
     364    for ($i = 0 ; $i < count($conf_nbc_MailExclusion) ; $i++)
     365    {
     366      $pattern = '/'.$conf_nbc_MailExclusion[$i].'/';
     367      if (preg_match($pattern, $ncsemail))
     368      {
     369        $_POST['mail_address'] = '';                             
     370        return($lang['reg_err_login1'] = l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'");
     371      }
     372    }
     373        } 
    379374}
    380375
     
    393388    {
    394389      /* Email without forbidden domains */
    395       if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['mail_address']))
    396       {
    397         if (!ValidateEmailProvider($_POST['mail_address']))
     390      /* This doesn't work */
     391//      if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['mail_address']))
     392//      {
     393//        if (!ValidateEmailProvider($_POST['mail_address']))
     394//        {
     395//          $template->append('errors', l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'");
     396//          unset($_POST['validate']);
     397//        }
     398//      }
     399        /* This work with a code copy of ValidateEmailProvider() function */
     400        if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['mail_address']))
    398401        {
    399           $template->append('errors', l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'");
    400           unset($_POST['validate']);
     402          $ncsemail = strtolower($_POST['mail_address']);
     403          $conf_nbc_MailExclusion = preg_split("/[\s,]+/",$conf_nbc_UserAdvManager[13]);
     404          for ($i = 0 ; $i < count($conf_nbc_MailExclusion) ; $i++)
     405          {
     406            $pattern = '/'.$conf_nbc_MailExclusion[$i].'/';
     407            if (preg_match($pattern, $ncsemail))
     408            {                           
     409              $template->append('errors', l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'");
     410              unset($_POST['validate']);
     411            }
     412          }
    401413        }
    402       }
    403414
    404415      $typemail = 3;
     
    424435     
    425436      /* Sending registration confirmation by email */
    426       if (( isset($conf_nbc_UserAdvManager[0]) and $conf_nbc_UserAdvManager[0] == 'true') or ( isset($conf_nbc_UserAdvManager[2]) and $conf_nbc_UserAdvManager[2] == 'true'))
     437      if ((isset($conf_nbc_UserAdvManager[0]) and $conf_nbc_UserAdvManager[0] == 'true') or (isset($conf_nbc_UserAdvManager[2]) and $conf_nbc_UserAdvManager[2] == 'true'))
    427438      {
    428439        $confirm_mail_need = false;
    429440             
    430         if (!empty($_POST['mail_address']) and ValidateEmailProvider($_POST['mail_address']))
     441        if (!empty($_POST['mail_address']))
    431442        {
    432443          $query = '
     
    438449          list($current_email) = mysql_fetch_row(pwg_query($query));
    439450     
    440           if ( $_POST['mail_address'] != $current_email and ( isset($conf_nbc_UserAdvManager[2]) and $conf_nbc_UserAdvManager[2] == 'true') )
     451          if ($_POST['mail_address'] != $current_email and ( isset($conf_nbc_UserAdvManager[2]) and $conf_nbc_UserAdvManager[2] == 'true'))
    441452       
    442453            $confirm_mail_need = true;
    443454        }
    444455       
    445         if ((!empty($_POST['use_new_pwd']) and ( isset($conf_nbc_UserAdvManager[0]) and $conf_nbc_UserAdvManager[0] == 'true') or $confirm_mail_need) )
     456        if ((!empty($_POST['use_new_pwd']) and (isset($conf_nbc_UserAdvManager[0]) and $conf_nbc_UserAdvManager[0] == 'true') or $confirm_mail_need))
    446457        {
    447458          $query = '
     
    513524
    514525      /* Email without forbidden domains */
    515       if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['email']) and !ValidateEmailProvider($_POST['email']))
    516       {
    517         $template->append('errors', l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'");
    518         unset($_POST['submit_add']);
     526      /* This doesn't work */
     527//      if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['email']) and !ValidateEmailProvider($_POST['email']))
     528//      {
     529//        $template->append('errors', l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'");
     530//        unset($_POST['submit_add']);
     531//      }
     532      /* This work with a code copy of ValidateEmailProvider() function */
     533      if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['email']))
     534      {
     535        $ncsemail = strtolower($_POST['email']);
     536        $conf_nbc_MailExclusion = preg_split("/[\s,]+/",$conf_nbc_UserAdvManager[13]);
     537        for ($i = 0 ; $i < count($conf_nbc_MailExclusion) ; $i++)
     538        {
     539          $pattern = '/'.$conf_nbc_MailExclusion[$i].'/';
     540          if (preg_match($pattern, $ncsemail))
     541          {                     
     542            $template->append('errors', l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'");
     543            unset($_POST['submit_add']);
     544          }
     545        }
    519546      }
    520547    }
Note: See TracChangeset for help on using the changeset viewer.