Ignore:
Timestamp:
Nov 29, 2009, 2:18:37 AM (14 years ago)
Author:
Eric
Message:

[NBC_UserAdvManager] Pre 2.13

  • Translations improvements.
  • Bug 1260 fixed - Username case sensitivity is now fully functionnal in all users entries (user registration and admin panel)
  • Code refactory and improvements.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/NBC_UserAdvManager/trunk/main.inc.php

    r4380 r4384  
    99*/
    1010
     11/* History:  NBC_UserAdvManager_PATH.'Changelog.txt.php' */
     12
    1113/*
    12  ***** Plugin history (branch 2.10)*****
    13 
    14 -- 2.10.0-beta : Initial beta release for Piwigo compatibility
    15 -- 2.10.1-beta : Small correction on generated path
    16 -- 2.10.2-beta : Bug resolved on register validation page
    17 
    18 -- 2.10.3 : Final and fully functional release
    19                                                 Bug resolved on plugin activation
    20 
    21 -- 2.10.4 : Bug fixed on profiles update
    22 
    23 -- 2.10.5 : Improved code on profiles update
    24 
    25 -- 2.10.6 : Old language packs (iso) deleted (forget from PWG 1.7.x version)
    26 
    27 -- 2.10.7 : Bug fixed on user's validation email sending
    28 
    29 -- 2.10.8 : ConfirmMail page looks better (Sylvia theme only)
    30                                                 Improved code for checking author on guest comments
    31 
    32 -- 2.10.9 : Bug fixed - Missing english translation
    33                                                 Bug fixed - Notice on forbidden characters function use
    34                                                 Bug fixed - Audit on forbidden characters in username didn't work
    35                                                 Adding of email provider exclusion (like *@hotmail.com) - Warning ! -> Known bug : This feature doesn't work on user profile page. So, already registered users can change their email address to a forbiden one.
    36 
    37 -- 2.10.9a : Email provider exclusion is no longer case sensitive
    38 
    39 -- 2.10.9b : Bug fixed - Home icon wasn't linked to gallery url in ConfirmMail page. If GALLERY_URL is not set, Home icon gets the pwg root path.
    40 
    41 -- 2.10.9c : Bug fixed - If Email provider exclusion is set off, new registered user will have a PHP notice on "Undefined variable: ncsemail"
    42 
    43 -- 2.10.9d : Code simplification - need no more ""template"" sub-directory in plugin directory for enhance "back link" icon in ConfirMail.tpl
    44 
    45 -- 2.10.9e : Compatibility improvement with PHP 5.3 - Some old functions will be deprecated like :
    46                                                         ereg replaced by preg_match
    47                                                         eregi replace by preg_match with "i" moderator
    48                                                         split replace by preg_split
    49                                
    50 -- 2.10.9f : Compatibility bug fixed when used with DynamicRecentPeriod plugin
    51 
    52 
    53  ***** Plugin history (branch 2.11)*****
    54 
    55 -- 2.11.0 : New tabsheet menu to manage ConfirMail functions (setting a timeout without validation, Cleanup expired user's accounts, Force confirmation, Renew validation key, list unvalidated users,...)
    56                                                 Beautify plugin's main admin panel
    57                                                
    58 -- 2.11.1 : Bug fixed with install and upgrade functions
    59                                                 Language files correction
    60 
    61 -- 2.11.2 : Bug fixed on bad query for unvalidated users display in unvalidated users list
    62                                                 Bug fixed : Sql syntax error on plugin activation
    63 
    64 -- 2.11.3 : On Patricia's request (french forum and bug 1173), the unvalidated users management tab shows users according with the settings of unvalidated group and / or unvalidated status.
    65                                                 Feature 1172 added : Email providers exclusion list can be set with CR/LF between each entry. The comma seperator (,) is still mandatory.
    66                                                 Bug 1175 fixed : Bad translation tag in french language file.
    67                                                 Improvement of unvalidated users management tab (feature 1174)- Expired users are displayed in red color text.
    68 
    69 -- 2.11.4 : Bug 1177 fixed : Width of excluded email providers list reset to ancient value (80 col)
    70                                                 Bug 1179 fixed : Adding a notice in plugin inline documentation for use of validation groups and status. A default group must be set in Piwigo's groups settings and the "Guest" (or another user) must be set as default for status values.
    71                                                 Bug 1182 fixed : Language tag missing in confirmation email generation
    72 
    73 -- 2.11.5 : Bug 1195 fixed : Registration displays the good title
    74 
    75 
    76  ***** Plugin history (branch 2.12)*****
    77 
    78 -- 2.12.0 : Bug 1206 fixed : All plugin functionnalities work in user's profile page
    79             Plugin's core code and admin panel refactoring
    80             Password control and enforcement : A complexity score is computed on user registration. If this score is less than the goal set by admin, the password choosen is rejected.
    81             Feature 1194 "Ghost Tracker" added : New plugin tab displays users who don't comes back to the gallery since x days. Ability to send email reminders and to delete reminded but "dead" users. It's the reason why this feature is called "Ghost Tracker".
    82 
    83 -- 2.12.1 : Rollback on admin panel improvement (it was a bad idea)
    84 
    85 -- 2.12.2 : Bug 1221 fixed - Adding of a new funtion to populate the lastvisit table on Ghost Tracker activation
    86             Bug 1224 fixed - Error in database after plugin activation
    87             Bug 1225 fixed - "Reminder" status don't change from "false" to "true" after the sent of a reminder email
    88             Some code beautify (SQL requests and HTML 4 strict for tpl)
    89 
    90 -- 2.12.3 : Bug 1226 fixed - "duplicate key error" when lastvisit table is not empty and on using Ghost Tracker init function
    91 
    92 -- 2.12.4 : Adding a password field control for SendMail2User - Neighborhood plugin compatibility improvement
    93             Bug 1229 fixed - Email was no longer mandatory when plugin was active, even if Piwigo's email madatory option was set.
    94 
    95 -- 2.12.5 : Bug 1233 fixed -  "duplicate key error" when a user wants to register with an existing username. In fact, all standard Piwigo's register controls didn't work when plugin was activated. That fixes this too.
    96             Adding DE, ES and IT languages. All translations are not finalized and could be improved.
    97             Adding of description.txt file in language directories.
    98 
    99 -- 2.12.6 : Bug 1236 fixed -  Admins was unable to add a new user in the user_list page.
    100             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
    107 
    108 
    109  ***** Plugin history (branch 2.13)*****
    110  
    111 -- 2.13.0 : Bug 1246
    112             Evolution 1239 - New option to add a new tab that shows the number of days since their last visit for each registered user.
    113             Bug 1257 fixed - If email exclusion list begins with a CR-LF, an informative warning message is displayed (I was unable to delete automatically this CR-LF).
    114             Bug 1259 fixed - PHP notice on user addition by admin in user_list page.
    115             Bug 1260
    116             Evolution 1273 - Adding of reminder field in advanced user management tab. This allows to see if a reminder have already been send.
    117             Evolution 1292 - Adding of navigation bar in tabs where users are listed (when more than 1 page is needed to display users).
    118             Some code and translations refactory.
    119 */
    120 
    121 /*
    122 
    12314 ***** TODO List *****
    12415++ Adding ASC and DESC ordering for user's lists tables (Ghost Tracker, UserList and Unvalidated)
     
    14435  ++ new copied user will (or not) get the same language
    14536  ... and so on
    146  
    14737*/
    14838
     
    323213
    324214  /* Username non case sensitive */
    325   if (isset($conf_nbc_UserAdvManager[1]) and $conf_nbc_UserAdvManager[1] == 'true')
    326   {
    327     $new_username =  NotSensibleSearchUsername($_POST['login']);
    328     $_POST['login'] = $new_username == '' ? $_POST['login'] : $new_username;
     215  if (isset($conf_nbc_UserAdvManager[1]) and $conf_nbc_UserAdvManager[1] == 'true' and NotSensibleSearchUsername($_POST['login']))
     216  {
     217    return($lang['reg_err_login5'] = l10n('reg_err_login5'));
    329218  }
    330219
    331220  /* Username without forbidden keys */
    332   if (isset($conf_nbc_UserAdvManager[7]) and $conf_nbc_UserAdvManager[7] == 'true' and !empty($_POST['login']) and !ValidateUsername($_POST['login']))
     221  if (isset($conf_nbc_UserAdvManager[7]) and $conf_nbc_UserAdvManager[7] == 'true' and !empty($_POST['login']) and ValidateUsername($_POST['login']))
    333222  {
    334223    $_POST['login'] = '';
     
    337226
    338227  /* Email without forbidden domains */
    339   /* This doesn't work */
    340 //  if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['mail_address']) and !ValidateEmailProvider($_POST['mail_address']))
    341 //  {
    342 //    $_POST['mail_address'] = '';
    343 //    return($lang['reg_err_login1'] = l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'");
    344 //  }
    345   /* This work with a code copy of ValidateEmailProvider() function */
    346   if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['mail_address']))
    347   {
    348     $ncsemail = strtolower($_POST['mail_address']);
    349     $conf_nbc_MailExclusion = preg_split("/[\s,]+/",$conf_nbc_UserAdvManager[13]);
    350     for ($i = 0 ; $i < count($conf_nbc_MailExclusion) ; $i++)
    351     {
    352       $pattern = '/'.$conf_nbc_MailExclusion[$i].'/';
    353       if (preg_match($pattern, $ncsemail))
    354       {
    355         $_POST['mail_address'] = '';                             
    356         return($lang['reg_err_login1'] = l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'");
    357       }
    358     }
    359         } 
     228  if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['mail_address']) and ValidateEmailProvider($_POST['mail_address']))
     229  {
     230    $_POST['mail_address'] = '';
     231    return($lang['reg_err_login1'] = l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'");
     232  }
    360233}
    361234
     
    374247    {
    375248      /* Email without forbidden domains */
    376       /* This doesn't work */
    377 //      if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['mail_address']))
    378 //      {
    379 //        if (!ValidateEmailProvider($_POST['mail_address']))
    380 //        {
    381 //          $template->append('errors', l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'");
    382 //          unset($_POST['validate']);
    383 //        }
    384 //      }
    385         /* This work with a code copy of ValidateEmailProvider() function */
    386         if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['mail_address']))
     249      if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['mail_address']))
     250      {
     251        if (ValidateEmailProvider($_POST['mail_address']))
    387252        {
    388           $ncsemail = strtolower($_POST['mail_address']);
    389           $conf_nbc_MailExclusion = preg_split("/[\s,]+/",$conf_nbc_UserAdvManager[13]);
    390           for ($i = 0 ; $i < count($conf_nbc_MailExclusion) ; $i++)
    391           {
    392             $pattern = '/'.$conf_nbc_MailExclusion[$i].'/';
    393             if (preg_match($pattern, $ncsemail))
    394             {                           
    395               $template->append('errors', l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'");
    396               unset($_POST['validate']);
    397             }
    398           }
     253          $template->append('errors', l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'");
     254          unset($_POST['validate']);
    399255        }
     256      }
    400257
    401258      $typemail = 3;
     
    459316
    460317add_event_handler('init', 'UserAdvManager_InitPage');
    461  
     318/* *** Important ! This is necessary to make email exclusion work in admin's users management panel *** */
    462319function UserAdvManager_InitPage()
    463320{
     
    466323
    467324  $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array();
    468  
    469   /* Username non case sensitive */
    470   if (isset($conf_nbc_UserAdvManager[1]) and $conf_nbc_UserAdvManager[1] == 'true')
    471   {
    472     $lang['reg_err_login5'] = l10n('reg_err_login5');
    473   }
    474  
    475 
    476  
    477 /* User identification */
    478   if (script_basename() == 'identification')
    479   {
    480     if (isset($_POST['login']))
    481     {
    482       /* User non case sensitive */
    483       if (isset($conf_nbc_UserAdvManager[1]) and $conf_nbc_UserAdvManager[1] == 'true' )
    484       {
    485         $new_username =  NotSensibleSearchUsername($_POST['username']);
    486         $_POST['username'] = $new_username == '' ? $_POST['username'] : $new_username;
    487       }
    488     }
    489   }
    490 
    491325
    492326/* Admin user management */
     
    495329    if (isset($_POST['submit_add']))
    496330    {
    497       /* User non case sensitive */
    498       if (isset($conf_nbc_UserAdvManager[1]) and $conf_nbc_UserAdvManager[1] == 'true' )
    499       {
    500         $new_username =  NotSensibleSearchUsername($_POST['login']);
    501         $_POST['login'] = $new_username == '' ? $_POST['login'] : $new_username;
    502       }
    503 
    504       /* Username without forbidden keys */
    505       if (isset($conf_nbc_UserAdvManager[7]) and $conf_nbc_UserAdvManager[7] == 'true' and !empty($_POST['login']) and !ValidateUsername($_POST['login']))
    506       {
    507         $template->append('errors', l10n('reg_err_login6')."'".$conf_nbc_UserAdvManager[8]."'");
     331      /* Email without forbidden domains */
     332      if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['email']) and ValidateEmailProvider($_POST['email']))
     333      {
     334        $template->append('errors', l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'");
    508335        unset($_POST['submit_add']);
    509       }
    510 
    511       /* Email without forbidden domains */
    512       /* This doesn't work */
    513 //      if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['email']) and !ValidateEmailProvider($_POST['email']))
    514 //      {
    515 //        $template->append('errors', l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'");
    516 //        unset($_POST['submit_add']);
    517 //      }
    518       /* This work with a code copy of ValidateEmailProvider() function */
    519       if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['email']))
    520       {
    521         $ncsemail = strtolower($_POST['email']);
    522         $conf_nbc_MailExclusion = preg_split("/[\s,]+/",$conf_nbc_UserAdvManager[13]);
    523         for ($i = 0 ; $i < count($conf_nbc_MailExclusion) ; $i++)
    524         {
    525           $pattern = '/'.$conf_nbc_MailExclusion[$i].'/';
    526           if (preg_match($pattern, $ncsemail))
    527           {                     
    528             $template->append('errors', l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'");
    529             unset($_POST['submit_add']);
    530           }
    531         }
    532336      }
    533337    }
Note: See TracChangeset for help on using the changeset viewer.