Changeset 6354


Ignore:
Timestamp:
May 25, 2010, 6:11:02 PM (14 years ago)
Author:
Eric
Message:

[NBC_UserAdvManager]

  • Bug 1687 fixed: Case sensitivity function removed because intégrated Piwigo's core
Location:
extensions/NBC_UserAdvManager/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • extensions/NBC_UserAdvManager/trunk/ConfirmMail.php

    r5633 r6354  
    1414load_language('plugin.lang', UAM_PATH);
    1515
    16 /**
    17  * set in ./language/en_UK.iso-8859-1/local.lang.php (maybe to create)
    18  * for example for clear theme:
    19   $lang['Theme: clear'] = 'This is the clear theme based on yoga template. '.
    20   ' A standard template/theme of PhpWebgallery.';
    21  *
    22  * Don't forget php tags !!!
    23  *
    24  * Another way is to code it thru the theme itself in ./themeconf.inc.php
    25  */
    26 
    2716$title= l10n('confirm_mail_page_title');
    2817$page['body_id'] = 'theAboutPage';
     
    3120@include(PHPWG_ROOT_PATH.'template/'.$user['template'].
    3221  '/theme/'.$user['theme'].'/themeconf.inc.php');
     22
    3323
    3424if (isset($_GET['key']))
  • extensions/NBC_UserAdvManager/trunk/admin/UAM_admin.php

    r6251 r6354  
    102102  case 'global':
    103103
    104         if (isset($_POST['submit']) and !is_adviser() and isset($_POST['UAM_Mail_Info']) and isset($_POST['UAM_No_Casse']) and isset($_POST['UAM_Username_Char']) and isset($_POST['UAM_Confirm_Mail']) and isset($_POST['UAM_No_Comment_Anonymous']) and isset($_POST['UAM_Password_Enforced']) and isset($_POST['UAM_AdminPassword_Enforced']) and isset($_POST['UAM_GhostUser_Tracker']) and isset($_POST['UAM_Admin_ConfMail']))
     104        if (isset($_POST['submit']) and !is_adviser() and isset($_POST['UAM_Mail_Info']) and isset($_POST['UAM_Username_Char']) and isset($_POST['UAM_Confirm_Mail']) and isset($_POST['UAM_No_Comment_Anonymous']) and isset($_POST['UAM_Password_Enforced']) and isset($_POST['UAM_AdminPassword_Enforced']) and isset($_POST['UAM_GhostUser_Tracker']) and isset($_POST['UAM_Admin_ConfMail']))
    105105  {
    106106
     
    122122                $newconf_UAM = array(
    123123      $_POST['UAM_Mail_Info'],
    124       $_POST['UAM_No_Casse'],
    125124      $_POST['UAM_Confirm_Mail'],
    126125      (isset($_POST['UAM_No_Confirm_Group'])?$_POST['UAM_No_Confirm_Group']:''),
     
    220219    $groups[$row['id']] = $row['name'];
    221220/* configuration value for unvalidated users */
     221    if (isset($conf_UAM[2]) and $conf_UAM[2] == $row['id'])
     222    {
     223                $No_Valid = $row['id'];
     224                }
     225/* configuration value for validated users */
    222226    if (isset($conf_UAM[3]) and $conf_UAM[3] == $row['id'])
    223     {
    224                 $No_Valid = $row['id'];
    225                 }
    226 /* configuration value for validated users */
    227     if (isset($conf_UAM[4]) and $conf_UAM[4] == $row['id'])
    228227                {
    229228                $Valid = $row['id'];
     
    257256  {
    258257          $status_options[$status] = l10n('user_status_'.$status);
    259           if (isset($conf_UAM[9]) and $conf_UAM[9] == $status)
     258          if (isset($conf_UAM[8]) and $conf_UAM[8] == $status)
    260259          {
    261260            $No_Valid_Status = $status;
     
    276275  {
    277276          $status_options[$status] = l10n('user_status_'.$status);
    278           if (isset($conf_UAM[5]) and $conf_UAM[5] == $status)
     277          if (isset($conf_UAM[4]) and $conf_UAM[4] == $status)
    279278                {
    280279                  $Valid_Status = $status;
     
    305304                'UAM_MAIL_INFO_TRUE'             => $conf_UAM[0]=='true' ?  'checked="checked"' : '' ,
    306305                'UAM_MAIL_INFO_FALSE'            => $conf_UAM[0]=='false' ?  'checked="checked"' : '' ,
    307                 'UAM_MAILINFO_TEXT'              => $conf_UAM[10],
    308                 'UAM_NO_CASSE_TRUE'              => $conf_UAM[1]=='true' ?  'checked="checked"' : '' ,
    309                 'UAM_NO_CASSE_FALSE'             => $conf_UAM[1]=='false' ?  'checked="checked"' : '' ,
    310                 'UAM_USERNAME_CHAR_TRUE'         => $conf_UAM[7]=='true' ?  'checked="checked"' : '' ,
    311                 'UAM_USERNAME_CHAR_FALSE'        => $conf_UAM[7]=='false' ?  'checked="checked"' : '' ,
    312                 'UAM_USERNAME_CHAR_LIST'         => $conf_UAM[8],
    313                 'UAM_CONFIRM_MAIL_TRUE'          => $conf_UAM[2]=='true' ?  'checked="checked"' : '' ,
    314                 'UAM_CONFIRM_MAIL_FALSE'         => $conf_UAM[2]=='false' ?  'checked="checked"' : '' ,
    315                 'UAM_CONFIRMMAIL_TEXT'           => $conf_UAM[11],
    316                 'UAM_No_Confirm_Group'           => $conf_UAM[3],
    317                 'UAM_Validated_Group'            => $conf_UAM[4],
    318                 'UAM_No_Confirm_Status'          => $conf_UAM[9],
    319                 'UAM_Validated_Status'           => $conf_UAM[5],
    320                 'UAM_NO_COMMENT_ANO_TRUE'        => $conf_UAM[6]=='true' ?  'checked="checked"' : '' ,
    321                 'UAM_NO_COMMENT_ANO_FALSE'       => $conf_UAM[6]=='false' ?  'checked="checked"' : '' ,
    322                 'UAM_MAILEXCLUSION_TRUE'         => $conf_UAM[12]=='true' ?  'checked="checked"' : '' ,
    323                 'UAM_MAILEXCLUSION_FALSE'        => $conf_UAM[12]=='false' ?  'checked="checked"' : '' ,
    324                 'UAM_MAILEXCLUSION_LIST'         => $conf_UAM[13],
    325                 'UAM_PASSWORDENF_TRUE'           => $conf_UAM[14]=='true' ?  'checked="checked"' : '' ,
    326                 'UAM_PASSWORDENF_FALSE'          => $conf_UAM[14]=='false' ?  'checked="checked"' : '' ,
    327                 'UAM_PASSWORD_SCORE'             => $conf_UAM[15],
    328     'UAM_ADMINPASSWENF_TRUE'         => $conf_UAM[16]=='true' ?  'checked="checked"' : '' ,
    329                 'UAM_ADMINPASSWENF_FALSE'        => $conf_UAM[16]=='false' ?  'checked="checked"' : '' ,
    330     'UAM_GHOSTRACKER_TRUE'           => $conf_UAM[17]=='true' ?  'checked="checked"' : '' ,
    331                 'UAM_GHOSTRACKER_FALSE'          => $conf_UAM[17]=='false' ?  'checked="checked"' : '' ,
    332     'UAM_GHOSTRACKER_DAYLIMIT'       => $conf_UAM[18],
    333     'UAM_GHOSTRACKER_REMINDERTEXT'   => $conf_UAM[19],
    334     'UAM_ADDLASTVISIT_TRUE'          => $conf_UAM[20]=='true' ?  'checked="checked"' : '' ,
    335     'UAM_ADDLASTVISIT_FALSE'         => $conf_UAM[20]=='false' ?  'checked="checked"' : '' ,
    336     'UAM_ADMINCONFMAIL_TRUE'         => $conf_UAM[21]=='true' ?  'checked="checked"' : '' ,
    337     'UAM_ADMINCONFMAIL_FALSE'        => $conf_UAM[21]=='false' ?  'checked="checked"' : '' ,
     306                'UAM_MAILINFO_TEXT'              => $conf_UAM[9],
     307                'UAM_USERNAME_CHAR_TRUE'         => $conf_UAM[6]=='true' ?  'checked="checked"' : '' ,
     308                'UAM_USERNAME_CHAR_FALSE'        => $conf_UAM[6]=='false' ?  'checked="checked"' : '' ,
     309                'UAM_USERNAME_CHAR_LIST'         => $conf_UAM[7],
     310                'UAM_CONFIRM_MAIL_TRUE'          => $conf_UAM[1]=='true' ?  'checked="checked"' : '' ,
     311                'UAM_CONFIRM_MAIL_FALSE'         => $conf_UAM[1]=='false' ?  'checked="checked"' : '' ,
     312                'UAM_CONFIRMMAIL_TEXT'           => $conf_UAM[10],
     313                'UAM_No_Confirm_Group'           => $conf_UAM[2],
     314                'UAM_Validated_Group'            => $conf_UAM[3],
     315                'UAM_No_Confirm_Status'          => $conf_UAM[8],
     316                'UAM_Validated_Status'           => $conf_UAM[4],
     317                'UAM_NO_COMMENT_ANO_TRUE'        => $conf_UAM[5]=='true' ?  'checked="checked"' : '' ,
     318                'UAM_NO_COMMENT_ANO_FALSE'       => $conf_UAM[5]=='false' ?  'checked="checked"' : '' ,
     319                'UAM_MAILEXCLUSION_TRUE'         => $conf_UAM[11]=='true' ?  'checked="checked"' : '' ,
     320                'UAM_MAILEXCLUSION_FALSE'        => $conf_UAM[11]=='false' ?  'checked="checked"' : '' ,
     321                'UAM_MAILEXCLUSION_LIST'         => $conf_UAM[12],
     322                'UAM_PASSWORDENF_TRUE'           => $conf_UAM[13]=='true' ?  'checked="checked"' : '' ,
     323                'UAM_PASSWORDENF_FALSE'          => $conf_UAM[13]=='false' ?  'checked="checked"' : '' ,
     324                'UAM_PASSWORD_SCORE'             => $conf_UAM[14],
     325    'UAM_ADMINPASSWENF_TRUE'         => $conf_UAM[15]=='true' ?  'checked="checked"' : '' ,
     326                'UAM_ADMINPASSWENF_FALSE'        => $conf_UAM[15]=='false' ?  'checked="checked"' : '' ,
     327    'UAM_GHOSTRACKER_TRUE'           => $conf_UAM[16]=='true' ?  'checked="checked"' : '' ,
     328                'UAM_GHOSTRACKER_FALSE'          => $conf_UAM[16]=='false' ?  'checked="checked"' : '' ,
     329    'UAM_GHOSTRACKER_DAYLIMIT'       => $conf_UAM[17],
     330    'UAM_GHOSTRACKER_REMINDERTEXT'   => $conf_UAM[18],
     331    'UAM_ADDLASTVISIT_TRUE'          => $conf_UAM[19]=='true' ?  'checked="checked"' : '' ,
     332    'UAM_ADDLASTVISIT_FALSE'         => $conf_UAM[19]=='false' ?  'checked="checked"' : '' ,
     333    'UAM_ADMINCONFMAIL_TRUE'         => $conf_UAM[20]=='true' ?  'checked="checked"' : '' ,
     334    'UAM_ADMINCONFMAIL_FALSE'        => $conf_UAM[20]=='false' ?  'checked="checked"' : '' ,
    338335                'UAM_PASSWORD_TEST_SCORE'        => $UAM_Password_Test_Score,
    339336    'UAM_ERROR_REPORTS4'             => $UAM_Exclusionlist_Error,
     
    355352               
    356353/* username insensible a la casse */
    357     if (isset($conf_UAM[3]) and $conf_UAM[3] == 'true')
     354    if (isset($conf_UAM[2]) and $conf_UAM[2] == 'true')
    358355          {
    359356                        $query = "
     
    379376               
    380377/* Username without forbidden keys */
    381     if ( isset($conf_UAM[7]) and $conf_UAM[7] == 'true' )
     378    if ( isset($conf_UAM[6]) and $conf_UAM[6] == 'true' )
    382379          {
    383380                        $query = "
     
    398395               
    399396/* Email without forbidden domain */
    400     if ( isset($conf_UAM[12]) and $conf_UAM[12] == 'true' )
     397    if ( isset($conf_UAM[11]) and $conf_UAM[11] == 'true' )
    401398          {
    402399                        $query = "
     
    409406                  while($row = pwg_db_fetch_assoc($result))
    410407                  {
    411                           $conf_MailExclusion = preg_split("/[\s,]+/",$conf_UAM[13]);
     408                          $conf_MailExclusion = preg_split("/[\s,]+/",$conf_UAM[12]);
    412409                          for ($i = 0 ; $i < count($conf_MailExclusion) ; $i++)
    413410                          {
     
    467464  $conf_UAM = unserialize($conf['UserAdvManager']);
    468465 
    469   if (isset($conf_UAM[20]) and $conf_UAM[20]=='true')
     466  if (isset($conf_UAM[19]) and $conf_UAM[19]=='true')
    470467  {
    471468// +-----------------------------------------------------------------------+
     
    555552      $deltadays = floor($deltasecs / 86400);// Convert result from seconds to days
    556553     
    557       if (isset($conf_UAM[17]) and $conf_UAM[17]=='true' and $conf_UAM[18] <> '')
     554      if (isset($conf_UAM[16]) and $conf_UAM[16]=='true' and $conf_UAM[17] <> '')
    558555      {
    559         if ($deltadays <= ($conf_UAM[18]/2))
     556        if ($deltadays <= ($conf_UAM[17]/2))
    560557        {
    561558          $display = 'green';
    562559        }
    563560       
    564         if (($deltadays > ($conf_UAM[18]/2)) and ($deltadays < $conf_UAM[18]))
     561        if (($deltadays > ($conf_UAM[17]/2)) and ($deltadays < $conf_UAM[17]))
    565562        {
    566563          $display = 'orange';
    567564        }
    568565       
    569         if ($deltadays >= $conf_UAM[18])
     566        if ($deltadays >= $conf_UAM[17])
    570567        {
    571568          $display = 'red';
     
    629626  $conf_UAM_ConfirmMail = unserialize($conf['UserAdvManager_ConfirmMail']);
    630627       
    631   if (isset($conf_UAM[2]) and $conf_UAM[2]=='true' and ((isset($conf_UAM[3]) and $conf_UAM[3] <> '-1') or (isset($conf_UAM[9]) and $conf_UAM[9] <> '-1')) and isset($conf_UAM_ConfirmMail[0]) and $conf_UAM_ConfirmMail[0]=='true')
     628  if (isset($conf_UAM[1]) and $conf_UAM[1]=='true' and ((isset($conf_UAM[2]) and $conf_UAM[2] <> '-1') or (isset($conf_UAM[8]) and $conf_UAM[8] <> '-1')) and isset($conf_UAM_ConfirmMail[0]) and $conf_UAM_ConfirmMail[0]=='true')
    632629  {
    633630// +-----------------------------------------------------------------------+
     
    11811178  $conf_UAM = unserialize($conf['UserAdvManager']);
    11821179       
    1183   if (isset($conf_UAM[17]) and $conf_UAM[17]=='true')
     1180  if (isset($conf_UAM[16]) and $conf_UAM[16]=='true')
    11841181  {
    11851182// +-----------------------------------------------------------------------+
  • extensions/NBC_UserAdvManager/trunk/admin/template/global.tpl

    r5716 r6354  
    6969      <fieldset>
    7070        <ul>
    71           <li>
    72             <label class="cluetip" title="{'UAM_casenTitle'|translate}|{'UAM_casenTitle_d'|translate}">
    73               {'UAM_No_Casse'|@translate}
    74             </label>
    75           <br><br>
    76             <input type="radio" value="false" {$UAM_NO_CASSE_FALSE} name="UAM_No_Casse">
    77               {'UAM_No_Casse_false'|@translate}<br>
    78             <input type="radio" value="true" {$UAM_NO_CASSE_TRUE} name="UAM_No_Casse">
    79               {'UAM_No_Casse_true'|@translate}<br><br>
    80           </li>
    81      
    8271          <li>
    8372            <label class="cluetip" title="{'UAM_carexcTitle'|translate}|{'UAM_carexcTitle_d'|translate}">
  • extensions/NBC_UserAdvManager/trunk/include/functions.inc.php

    r5633 r6354  
    4545      $password = $password <> '' ? $password : l10n('UAM_empty_pwd');
    4646     
    47       if (isset($conf_UAM[10]) and $conf_UAM[10] <> '')
     47      if (isset($conf_UAM[9]) and $conf_UAM[9] <> '')
    4848      {
    4949        if (function_exists('get_user_language_desc'))
    5050        {
    51           $infos1_perso = get_user_language_desc($conf_UAM[10])."\n\n";
     51          $infos1_perso = get_user_language_desc($conf_UAM[9])."\n\n";
    5252        }
    53         else $infos1_perso = l10n($conf_UAM[10])."\n\n";
     53        else $infos1_perso = l10n($conf_UAM[9])."\n\n";
    5454      }
    5555     
     
    8181
    8282
    83   if ( isset($conf_UAM[2]) and $conf_UAM[2] == 'true' and $confirm)
     83  if ( isset($conf_UAM[1]) and $conf_UAM[1] == 'true' and $confirm)
    8484  {
    8585    $infos2 = array
     
    8989    );
    9090
    91     if (isset($conf_UAM[11]) and $conf_UAM[11] <> '')
     91    if (isset($conf_UAM[10]) and $conf_UAM[10] <> '')
    9292    {
    9393      if (function_exists('get_user_language_desc'))
    9494      {
    95         $infos2_perso = get_user_language_desc($conf_UAM[11])."\n\n";
     95        $infos2_perso = get_user_language_desc($conf_UAM[10])."\n\n";
    9696      }
    97       else $infos2_perso = l10n($conf_UAM[11])."\n\n";
     97      else $infos2_perso = l10n($conf_UAM[10])."\n\n";
    9898    }
    9999  }
     
    275275  $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('Ghost_reminder_of_%s', $username));     
    276276
    277   if (isset($conf_UAM[19]) and $conf_UAM[19] <> '' and isset($conf_UAM[17]) and $conf_UAM[17] == 'true')
     277  if (isset($conf_UAM[18]) and $conf_UAM[18] <> '' and isset($conf_UAM[16]) and $conf_UAM[16] == 'true')
    278278  {
    279279    if (function_exists('get_user_language_desc'))
    280280    {
    281       $infos1 = get_user_language_desc($conf_UAM[19])."\n\n";
     281      $infos1 = get_user_language_desc($conf_UAM[18])."\n\n";
    282282    }
    283283    else
    284284    {
    285       $infos1 = l10n($conf_UAM[19])."\n\n";
     285      $infos1 = l10n($conf_UAM[18])."\n\n";
    286286    }
    287287
     
    359359WHERE user_id = '".$user_id."'
    360360  AND (
     361    group_id = '".$conf_UAM[2]."'
     362  OR
    361363    group_id = '".$conf_UAM[3]."'
    362   OR
    363     group_id = '".$conf_UAM[4]."'
    364364  )
    365365;";
    366366    pwg_query($query);
    367367
    368     if (!is_admin() and $conf_UAM[9] <> -1)
     368    if (!is_admin() and $conf_UAM[8] <> -1)
    369369    {
    370370      $query = "
    371371UPDATE ".USER_INFOS_TABLE."
    372 SET status = '".$conf_UAM[9]."'
     372SET status = '".$conf_UAM[8]."'
    373373WHERE user_id = '".$user_id."'
    374374;";
     
    376376    }
    377377
    378     if ( $conf_UAM[3] <> -1 )
     378    if ( $conf_UAM[2] <> -1 )
    379379    {
    380380      $query = "
     
    382382  (user_id, group_id)
    383383VALUES
    384   ('".$user_id."', '".$conf_UAM[3]."')
     384  ('".$user_id."', '".$conf_UAM[2]."')
    385385;";
    386386      pwg_query($query);
     
    525525                                                pwg_query($query);
    526526     
    527                                                 if ($conf_UAM[3] <> -1) // Delete user from unvalidated users group
     527                                                if ($conf_UAM[2] <> -1) // Delete user from unvalidated users group
    528528                                                {
    529529                                                        $query = "
    530530DELETE FROM ".USER_GROUP_TABLE."
    531531WHERE user_id = '".$data['user_id']."'
    532   AND group_id = '".$conf_UAM[3]."'
     532  AND group_id = '".$conf_UAM[2]."'
    533533;";
    534534                                                        pwg_query($query);
    535535                                                }
    536536           
    537                                                 if ($conf_UAM[4] <> -1) // Add user to validated users group
     537                                                if ($conf_UAM[3] <> -1) // Add user to validated users group
    538538                                                {
    539539                                                        $query = "
     
    541541  (user_id, group_id)
    542542VALUES
    543   ('".$data['user_id']."', '".$conf_UAM[4]."')
     543  ('".$data['user_id']."', '".$conf_UAM[3]."')
    544544;";
    545545                                                        pwg_query($query);
    546546                                                }
    547547
    548                                                 if (($conf_UAM[5] <> -1 or isset($data['status']))) // Change user's status
     548                                                if (($conf_UAM[4] <> -1 or isset($data['status']))) // Change user's status
    549549                                                {
    550550                                                        $query = "
    551551UPDATE ".USER_INFOS_TABLE."
    552 SET status = '".(isset($data['status']) ? $data['status'] : $conf_UAM[5])."'
     552SET status = '".(isset($data['status']) ? $data['status'] : $conf_UAM[4])."'
    553553WHERE user_id = '".$data['user_id']."'
    554554;";
     
    577577                                        pwg_query($query);
    578578     
     579                                        if ($conf_UAM[2] <> -1)
     580                                        {
     581                                                $query = "
     582DELETE FROM ".USER_GROUP_TABLE."
     583WHERE user_id = '".$data['user_id']."'
     584AND group_id = '".$conf_UAM[2]."'
     585;";
     586                                                pwg_query($query);
     587                                        }
     588   
    579589                                        if ($conf_UAM[3] <> -1)
    580590                                        {
     
    585595;";
    586596                                                pwg_query($query);
    587                                         }
    588    
    589                                         if ($conf_UAM[4] <> -1)
    590                                         {
    591                                                 $query = "
    592 DELETE FROM ".USER_GROUP_TABLE."
    593 WHERE user_id = '".$data['user_id']."'
    594 AND group_id = '".$conf_UAM[4]."'
    595 ;";
    596                                                 pwg_query($query);
    597597
    598598                                                $query = "
     
    600600  (user_id, group_id)
    601601VALUES
    602   ('".$data['user_id']."', '".$conf_UAM[4]."')
     602  ('".$data['user_id']."', '".$conf_UAM[3]."')
    603603;";
    604604                                                pwg_query($query);
    605605                                        }
    606606
    607                                         if (($conf_UAM[5] <> -1 or isset($data['status'])))
     607                                        if (($conf_UAM[4] <> -1 or isset($data['status'])))
    608608                                        {
    609609                                                $query = "
    610610UPDATE ".USER_INFOS_TABLE."
    611 SET status = '".(isset($data['status']) ? $data['status'] : $conf_UAM[5])."'
     611SET status = '".(isset($data['status']) ? $data['status'] : $conf_UAM[4])."'
    612612WHERE user_id = '".$data['user_id']."'
    613613;";
     
    662662                        pwg_query($query);
    663663             
     664                        if ($conf_UAM[2] <> -1)
     665                        {
     666                                $query = "
     667DELETE FROM ".USER_GROUP_TABLE."
     668WHERE user_id = '".$data['user_id']."'
     669  AND group_id = '".$conf_UAM[2]."'
     670;";
     671                                pwg_query($query);
     672                        }
     673 
    664674                        if ($conf_UAM[3] <> -1)
    665675                        {
     
    668678WHERE user_id = '".$data['user_id']."'
    669679  AND group_id = '".$conf_UAM[3]."'
    670 ;";
    671                                 pwg_query($query);
    672                         }
    673  
    674                         if ($conf_UAM[4] <> -1)
    675                         {
    676                                 $query = "
    677 DELETE FROM ".USER_GROUP_TABLE."
    678 WHERE user_id = '".$data['user_id']."'
    679   AND group_id = '".$conf_UAM[4]."'
    680680                                ;";
    681681                                pwg_query($query);
     
    685685  (user_id, group_id)
    686686VALUES
    687   ('".$data['user_id']."', '".$conf_UAM[4]."')
     687  ('".$data['user_id']."', '".$conf_UAM[3]."')
    688688;";
    689689                                pwg_query($query);
    690690                        }
    691691
    692                         if (($conf_UAM[5] <> -1 or isset($data['status'])))
     692                        if (($conf_UAM[4] <> -1 or isset($data['status'])))
    693693                        {
    694694                                $query = "
    695695UPDATE ".USER_INFOS_TABLE."
    696 SET status = '".(isset($data['status']) ? $data['status'] : $conf_UAM[5])."'
     696SET status = '".(isset($data['status']) ? $data['status'] : $conf_UAM[4])."'
    697697WHERE user_id = '".$data['user_id']."'
    698698;";
     
    706706}
    707707
    708 /* Function called from main.inc.php - Get username case insensitive */
    709 function NotSensibleSearchUsername($username)
    710 {
    711   global $conf;
    712  
    713   if (isset($username))
    714   {
    715     $query = "
    716 SELECT ".$conf['user_fields']['username']."
    717 FROM ".USERS_TABLE."
    718 WHERE LOWER(".stripslashes($conf['user_fields']['username']).") = '".strtolower($username)."'
    719 ;";
    720     $users = pwg_db_num_rows(pwg_query($query));
    721     if ($users > 0)
    722     {
    723       return true;
    724     }
    725     else
    726     {
    727       return false;
    728     }
    729   }
    730 }
    731 
    732708
    733709/* Function called from main.inc.php - Check if username matches forbidden caracters */
     
    738714  $conf_UAM = unserialize($conf['UserAdvManager']);
    739715
    740   if (isset($login) and isset($conf_UAM[8]) and $conf_UAM[8] <> '')
    741   {
    742     $conf_CharExclusion = preg_split("/,/",$conf_UAM[8]);
     716  if (isset($login) and isset($conf_UAM[7]) and $conf_UAM[7] <> '')
     717  {
     718    $conf_CharExclusion = preg_split("/,/",$conf_UAM[7]);
    743719    for ($i = 0 ; $i < count($conf_CharExclusion) ; $i++)
    744720    {
     
    765741  $conf_UAM = unserialize($conf['UserAdvManager']);
    766742 
    767         if (isset($email) and isset($conf_UAM[13]) and $conf_UAM[13] <> '')
     743        if (isset($email) and isset($conf_UAM[12]) and $conf_UAM[12] <> '')
    768744        {
    769745                //$ncsemail = strtolower($email);
    770                 $conf_MailExclusion = preg_split("/[\s,]+/",$conf_UAM[13]);
     746                $conf_MailExclusion = preg_split("/[\s,]+/",$conf_UAM[12]);
    771747                for ($i = 0 ; $i < count($conf_MailExclusion) ; $i++)
    772748                {
     
    816792  OR TO_DAYS(NOW()) - TO_DAYS(ui.registration_date) < "'.$conf_UAM_ConfirmMail[1].'")';
    817793
    818         if ($conf_UAM[3] <> '-1' and $conf_UAM[9] == '-1')
     794        if ($conf_UAM[2] <> '-1' and $conf_UAM[8] == '-1')
    819795  {
    820796    $query.= '
    821   AND ug.group_id = '.$conf_UAM[3];
    822   }
    823   if ($conf_UAM[3] == '-1' and $conf_UAM[9] <> '-1')
     797  AND ug.group_id = '.$conf_UAM[2];
     798  }
     799  if ($conf_UAM[2] == '-1' and $conf_UAM[8] <> '-1')
    824800  {
    825801    $query.= '
    826   AND ui.status = \''.$conf_UAM[9]."'";
    827   }
    828   if ($conf_UAM[3] <> '-1' and $conf_UAM[9] <> '-1')
     802  AND ui.status = \''.$conf_UAM[8]."'";
     803  }
     804  if ($conf_UAM[2] <> '-1' and $conf_UAM[8] <> '-1')
    829805  {
    830806    $query.= '
    831   AND ug.group_id = \''.$conf_UAM[3]."'";
     807  AND ug.group_id = \''.$conf_UAM[2]."'";
    832808  }
    833809  $query.= '
     
    896872  INNER JOIN '.USER_LASTVISIT_TABLE.' AS lv
    897873    ON u.'.$conf['user_fields']['id'].' = lv.user_id
    898 WHERE (TO_DAYS(NOW()) - TO_DAYS(lv.lastvisit) >= "'.$conf_UAM[18].'")
     874WHERE (TO_DAYS(NOW()) - TO_DAYS(lv.lastvisit) >= "'.$conf_UAM[17].'")
    899875ORDER BY id ASC;';
    900876
  • extensions/NBC_UserAdvManager/trunk/include/upgradedb.inc.php

    r6255 r6354  
    204204
    205205                pwg_query($query);
     206   
     207    upgrade_2153_2154();
     208}
     209
     210/* upgrade from branch 2.15.3 to 2.15.4 */
     211/* ************************************ */
     212function upgrade_2153_2154()
     213{
     214  global $conf;
     215
     216/* Upgrading options */
     217  $query = '
     218SELECT value
     219  FROM '.CONFIG_TABLE.'
     220WHERE param = "UserAdvManager"
     221;';
     222
     223  $result = pwg_query($query);
     224  $conf_UAM = pwg_db_fetch_assoc($result);
     225   
     226  $Newconf_UAM = unserialize($conf_UAM['value']);
     227 
     228  $Newconf_UAM[0] = $Newconf_UAM[0];
     229  $Newconf_UAM[1] = $Newconf_UAM[2];
     230  $Newconf_UAM[2] = $Newconf_UAM[3];
     231  $Newconf_UAM[3] = $Newconf_UAM[4];
     232  $Newconf_UAM[4] = $Newconf_UAM[5];
     233  $Newconf_UAM[5] = $Newconf_UAM[6];
     234  $Newconf_UAM[6] = $Newconf_UAM[7];
     235  $Newconf_UAM[7] = $Newconf_UAM[8];
     236  $Newconf_UAM[8] = $Newconf_UAM[9];
     237  $Newconf_UAM[9] = $Newconf_UAM[10];
     238  $Newconf_UAM[10] = $Newconf_UAM[11];
     239  $Newconf_UAM[11] = $Newconf_UAM[12];
     240  $Newconf_UAM[12] = $Newconf_UAM[13];
     241  $Newconf_UAM[13] = $Newconf_UAM[14];
     242  $Newconf_UAM[14] = $Newconf_UAM[15];
     243  $Newconf_UAM[15] = $Newconf_UAM[16];
     244  $Newconf_UAM[16] = $Newconf_UAM[17];
     245  $Newconf_UAM[17] = $Newconf_UAM[18];
     246  $Newconf_UAM[18] = $Newconf_UAM[19];
     247  $Newconf_UAM[19] = $Newconf_UAM[20];
     248  $Newconf_UAM[20] = $Newconf_UAM[21];
     249  unset($Newconf_UAM[21]);
     250 
     251  $update_conf = serialize($Newconf_UAM);
     252   
     253  $query = '
     254      UPDATE '.CONFIG_TABLE.'
     255                        SET value="'.addslashes($update_conf).'"
     256                        WHERE param="UserAdvManager"
     257                        LIMIT 1
     258                ;';
     259
     260                pwg_query($query);
    206261}
    207262?>
  • extensions/NBC_UserAdvManager/trunk/main.inc.php

    r6255 r6354  
    8080  if (!is_admin() and !is_a_guest())
    8181  {
    82     if ((isset($conf_UAM[17]) and $conf_UAM[17] == 'true') or (isset($conf_UAM[20]) and $conf_UAM[20] == 'true'))
     82    if ((isset($conf_UAM[16]) and $conf_UAM[16] == 'true') or (isset($conf_UAM[19]) and $conf_UAM[19] == 'true'))
    8383    {
    8484
     
    129129 
    130130  /* Sending registration confirmation by email */
    131   if ((isset($conf_UAM[0]) and $conf_UAM[0] == 'true') or (isset($conf_UAM[2]) and $conf_UAM[2] == 'true'))
    132   {
    133     if (is_admin() and isset($conf_UAM[21]) and $conf_UAM[21] == 'true')
     131  if ((isset($conf_UAM[0]) and $conf_UAM[0] == 'true') or (isset($conf_UAM[1]) and $conf_UAM[1] == 'true'))
     132  {
     133    if (is_admin() and isset($conf_UAM[20]) and $conf_UAM[20] == 'true')
    134134    {
    135135    $passwd = (isset($_POST['password'])) ? $_POST['password'] : '';
    136136    SendMail2User(1, $register_user['id'], $register_user['username'], $passwd, $register_user['email'], true);
    137137    }
    138     elseif (is_admin() and isset($conf_UAM[21]) and $conf_UAM[21] == 'false')
     138    elseif (is_admin() and isset($conf_UAM[20]) and $conf_UAM[20] == 'false')
    139139    {
    140140    $passwd = (isset($_POST['password'])) ? $_POST['password'] : '';
     
    253253
    254254  /* Password enforcement control */
    255   if (isset($conf_UAM[14]) and $conf_UAM[14] == 'true' and !empty($conf_UAM[15]))
     255  if (isset($conf_UAM[13]) and $conf_UAM[13] == 'true' and !empty($conf_UAM[14]))
    256256  {
    257257    if (!empty($user['password']) and !is_admin())
     
    259259      $PasswordCheck = testpassword($user['password']);
    260260 
    261       if ($PasswordCheck < $conf_UAM[15])
     261      if ($PasswordCheck < $conf_UAM[14])
    262262      {
    263263        $message = get_l10n_args('reg_err_login4_%s', $PasswordCheck);
    264         return($lang['reg_err_pass'] = l10n_args($message).$conf_UAM[15]);
    265       }
    266     }
    267     else if (!empty($user['password']) and is_admin() and isset($conf_UAM[16]) and $conf_UAM[16] == 'true')
     264        return($lang['reg_err_pass'] = l10n_args($message).$conf_UAM[14]);
     265      }
     266    }
     267    else if (!empty($user['password']) and is_admin() and isset($conf_UAM[15]) and $conf_UAM[15] == 'true')
    268268    {
    269269      $PasswordCheck = testpassword($user['password']);
    270270 
    271       if ($PasswordCheck < $conf_UAM[15])
     271      if ($PasswordCheck < $conf_UAM[14])
    272272      {
    273273        $message = get_l10n_args('reg_err_login4_%s', $PasswordCheck);
    274         return($lang['reg_err_pass'] = l10n_args($message).$conf_UAM[15]);
    275       }
    276     }
    277   }
    278 
    279   /* Username non case sensitive */
    280   if (isset($conf_UAM[1]) and $conf_UAM[1] == 'true' and NotSensibleSearchUsername($_POST['login']))
    281   {
    282     return($lang['reg_err_login5'] = l10n('reg_err_login5'));
     274        return($lang['reg_err_pass'] = l10n_args($message).$conf_UAM[14]);
     275      }
     276    }
    283277  }
    284278
    285279  /* Username without forbidden keys */
    286   if (isset($conf_UAM[7]) and $conf_UAM[7] == 'true' and !empty($_POST['login']) and ValidateUsername($_POST['login']) and !is_admin())
     280  if (isset($conf_UAM[6]) and $conf_UAM[6] == 'true' and !empty($_POST['login']) and ValidateUsername($_POST['login']) and !is_admin())
    287281  {
    288282    $_POST['login'] = '';
    289     return($lang['reg_err_login1'] = l10n('reg_err_login6')."'".$conf_UAM[8]."'");
     283    return($lang['reg_err_login1'] = l10n('reg_err_login6')."'".$conf_UAM[7]."'");
    290284  }
    291285
    292286  /* Email without forbidden domains */
    293   if (isset($conf_UAM[12]) and $conf_UAM[12] == 'true' and !empty($_POST['mail_address']) and ValidateEmailProvider($_POST['mail_address']) and !is_admin())
     287  if (isset($conf_UAM[11]) and $conf_UAM[11] == 'true' and !empty($_POST['mail_address']) and ValidateEmailProvider($_POST['mail_address']) and !is_admin())
    294288  {
    295289    $_POST['mail_address'] = '';
    296     return($lang['reg_err_login1'] = l10n('reg_err_login7')."'".$conf_UAM[13]."'");
     290    return($lang['reg_err_login1'] = l10n('reg_err_login7')."'".$conf_UAM[12]."'");
    297291  }
    298292}
     
    312306    {
    313307      /* Email without forbidden domains */
    314       if (isset($conf_UAM[12]) and $conf_UAM[12] == 'true' and !empty($_POST['mail_address']))
     308      if (isset($conf_UAM[11]) and $conf_UAM[11] == 'true' and !empty($_POST['mail_address']))
    315309      {
    316310        if (ValidateEmailProvider($_POST['mail_address']))
    317311        {
    318           $template->append('errors', l10n('reg_err_login7')."'".$conf_UAM[13]."'");
     312          $template->append('errors', l10n('reg_err_login7')."'".$conf_UAM[12]."'");
    319313          unset($_POST['validate']);
    320314        }
     
    328322       
    329323        /* Password enforcement control */
    330         if (isset($conf_UAM[14]) and $conf_UAM[14] == 'true' and !empty($conf_UAM[15]))
     324        if (isset($conf_UAM[13]) and $conf_UAM[13] == 'true' and !empty($conf_UAM[14]))
    331325        {
    332326          $PasswordCheck = testpassword($_POST['use_new_pwd']);
    333327         
    334           if ($PasswordCheck < $conf_UAM[15])
     328          if ($PasswordCheck < $conf_UAM[14])
    335329          {
    336330            $message = get_l10n_args('reg_err_login4_%s', $PasswordCheck);
    337             $template->append('errors', l10n_args($message).$conf_UAM[15]);
     331            $template->append('errors', l10n_args($message).$conf_UAM[14]);
    338332            unset($_POST['use_new_pwd']);
    339333            unset($_POST['validate']);
     
    343337     
    344338      /* Sending registration confirmation by email */
    345       if ((isset($conf_UAM[0]) and $conf_UAM[0] == 'true') or (isset($conf_UAM[2]) and $conf_UAM[2] == 'true'))
     339      if ((isset($conf_UAM[0]) and $conf_UAM[0] == 'true') or (isset($conf_UAM[1]) and $conf_UAM[1] == 'true'))
    346340      {
    347341        $confirm_mail_need = false;
     
    357351          list($current_email) = pwg_db_fetch_row(pwg_query($query));
    358352     
    359           if ($_POST['mail_address'] != $current_email and ( isset($conf_UAM[2]) and $conf_UAM[2] == 'true'))
     353          if ($_POST['mail_address'] != $current_email and ( isset($conf_UAM[1]) and $conf_UAM[1] == 'true'))
    360354       
    361355            $confirm_mail_need = true;
     
    395389    {
    396390      /* Email without forbidden domains */
    397       if (isset($conf_UAM[12]) and $conf_UAM[12] == 'true' and !empty($_POST['email']) and ValidateEmailProvider($_POST['email']))
    398       {
    399         $template->append('errors', l10n('reg_err_login7')."'".$conf_UAM[13]."'");
     391      if (isset($conf_UAM[11]) and $conf_UAM[11] == 'true' and !empty($_POST['email']) and ValidateEmailProvider($_POST['email']))
     392      {
     393        $template->append('errors', l10n('reg_err_login7')."'".$conf_UAM[12]."'");
    400394        unset($_POST['submit_add']);
    401395      }
     
    415409
    416410/* User creation OR update */
    417   if (isset($conf_UAM[6]) and $conf_UAM[6] == 'true' and $conf['comments_forall'] == 'true' and $comm['author'] == 'guest')
     411  if (isset($conf_UAM[5]) and $conf_UAM[5] == 'true' and $conf['comments_forall'] == 'true' and $comm['author'] == 'guest')
    418412  {
    419413    $comment_action = 'reject';
  • extensions/NBC_UserAdvManager/trunk/maintain.inc.php

    r6255 r6354  
    163163/* ****************************** */
    164164// In preparation of next releases
    165 /*   $query = '
     165   $query = '
    166166SELECT param
    167167  FROM '.CONFIG_TABLE.'
     
    172172  if ($count == 2)
    173173  {
    174     upgrade_2151_2152();
    175   }
    176 */
     174    $query = '
     175SELECT value
     176  FROM '.CONFIG_TABLE.'
     177WHERE param = "UserAdvManager"
     178;';
     179
     180    $result = pwg_query($query);
     181    $conf = pwg_db_fetch_assoc($result);
     182   
     183    $conf_UAM = unserialize($conf['value']);
     184    $Nb_values = count($conf_UAM);
     185    if ($Nb_values = 22)
     186    {
     187      upgrade_2153_2154();
     188    }
     189  }
     190
    177191load_conf_from_db('param like \'UserAdvManager\\_%\'');
    178192}
Note: See TracChangeset for help on using the changeset viewer.