Changeset 8072


Ignore:
Timestamp:
Dec 10, 2010, 5:48:18 PM (13 years ago)
Author:
Eric
Message:

Bug 2053 fixed - Manual validation by admins wasn't working correctly

Location:
extensions/NBC_UserAdvManager/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • extensions/NBC_UserAdvManager/trunk/admin/UAM_admin.php

    r8065 r8072  
    631631       
    632632  if (isset($conf_UAM[1]) and ($conf_UAM[1]=='true' or $conf_UAM[1]=='local') and ((isset($conf_UAM[2]) and $conf_UAM[2] <> '-1') or (isset($conf_UAM[8]) and $conf_UAM[8] <> '-1')))
    633   {   
     633  {
    634634// +-----------------------------------------------------------------------+
    635635// |                           initialization                              |
     
    640640        die('Hacking attempt!');
    641641    }
    642          
     642
    643643    include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
    644644
     
    965965                foreach ($collection as $user_id)
    966966        {
    967                                   $query = "
    968 SELECT id, username, mail_address
    969   FROM ".USERS_TABLE."
    970 WHERE id = '".$user_id."'
    971 ;";
    972                                        
    973                                         $data = pwg_db_fetch_assoc(pwg_query($query));
    974                                
    975                 ForceValidation($data['id']);                           
     967          ForceValidation($user_id);
    976968        }
    977969        array_push(
  • extensions/NBC_UserAdvManager/trunk/changelog.txt.php

    r8065 r8072  
    212212***************************************
    213213-- 2.16.0 : Bug 1430 and 1840 fixed - Automated tasks are available to delete or downgrade ghost users with or without email notification
     214            Bug 1585 fixed - UAM version is set in database to improve future upgrades
     215            Bug 2011 fixed - Text fields are no longer locked if related option button is not set and saved. Now this fields and unused options are hidden
     216            Bug 2046 fixed - Using Piwigo's $conf['insensitive_case_logon'] = true option works again with UAM
     217            Bug 2053 fixed - Manual validation by admins wasn't working correctly
    214218
    215219*/
  • extensions/NBC_UserAdvManager/trunk/include/functions.inc.php

    r8065 r8072  
    363363  $page['filtered_users'] = get_ghosts_autotasks();
    364364
    365   // Ghost accounts auto deletion
    366   if ((isset($conf_UAM[22]) and $conf_UAM[22] == 'true') and (isset($conf_UAM[23]) and $conf_UAM[23] == 'true'))
    367365  {       
    368366                foreach($page['filtered_users'] as $listed_user)
     
    14261424 * @param : User id
    14271425 *
    1428  * @return : Bool
    1429  *
    14301426 */
    14311427function ForceValidation($id)
     
    14361432
    14371433  $conf_UAM = unserialize($conf['UserAdvManager']);
    1438        
    1439   $query = "
    1440 SELECT COUNT(*)
    1441   FROM ".USER_CONFIRM_MAIL_TABLE."
    1442 WHERE user_id = '".$id."'
    1443 ;";
    1444   list($count) = pwg_db_fetch_row(pwg_query($query));
    1445 
    1446   if ($count == 1)
    1447   {
    1448     $query = "
    1449 SELECT user_id, status, date_check
    1450   FROM ".USER_CONFIRM_MAIL_TABLE."
    1451 WHERE user_id = '".$id."'
    1452 ;";
    1453     $data = pwg_db_fetch_assoc(pwg_query($query));
    1454 
    1455     if (!empty($data) and isset($data['user_id']) and !isset($data['date_check']))
    1456     {     
    1457                         list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();'));
    1458 
    1459                         $query = "
     1434
     1435  if (isset($conf_UAM[1]) and $conf_UAM[1] == 'true')
     1436  {
     1437    list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();'));
     1438
     1439                $query = "
    14601440UPDATE ".USER_CONFIRM_MAIL_TABLE."
    14611441SET date_check='".$dbnow."'
    1462 WHERE user_id = '".$data['user_id']."'
     1442WHERE user_id = '".$id."'
     1443;";
     1444    pwg_query($query);
     1445             
     1446                if ($conf_UAM[2] <> -1)
     1447                {
     1448                        $query = "
     1449DELETE FROM ".USER_GROUP_TABLE."
     1450WHERE user_id = '".$id."'
     1451  AND group_id = '".$conf_UAM[2]."'
    14631452;";
    14641453                        pwg_query($query);
    1465              
    1466                         if ($conf_UAM[2] <> -1)
    1467                         {
    1468                                 $query = "
     1454                }
     1455 
     1456                if ($conf_UAM[3] <> -1)
     1457                {
     1458                        $query = "
    14691459DELETE FROM ".USER_GROUP_TABLE."
    1470 WHERE user_id = '".$data['user_id']."'
    1471   AND group_id = '".$conf_UAM[2]."'
    1472 ;";
    1473                                 pwg_query($query);
    1474                         }
    1475  
    1476                         if ($conf_UAM[3] <> -1)
    1477                         {
    1478                                 $query = "
    1479 DELETE FROM ".USER_GROUP_TABLE."
    1480 WHERE user_id = '".$data['user_id']."'
     1460WHERE user_id = '".$id."'
    14811461  AND group_id = '".$conf_UAM[3]."'
    1482                                 ;";
    1483                                 pwg_query($query);
     1462;";
     1463      pwg_query($query);
    14841464       
    1485                                 $query = "
     1465                        $query = "
    14861466INSERT INTO ".USER_GROUP_TABLE."
    14871467  (user_id, group_id)
    14881468VALUES
    1489   ('".$data['user_id']."', '".$conf_UAM[3]."')
    1490 ;";
    1491                                 pwg_query($query);
    1492                         }
    1493 
    1494                         if (($conf_UAM[4] <> -1 or isset($data['status'])))
    1495                         {
    1496                                 $query = "
     1469  ('".$id."', '".$conf_UAM[3]."')
     1470;";
     1471                        pwg_query($query);
     1472    }
     1473
     1474                if ($conf_UAM[4] <> -1)
     1475                {
     1476                        $query = "
    14971477UPDATE ".USER_INFOS_TABLE."
    1498 SET status = '".(isset($data['status']) ? $data['status'] : $conf_UAM[4])."'
    1499 WHERE user_id = '".$data['user_id']."'
    1500 ;";
    1501                                 pwg_query($query);
    1502                         }
    1503                         // Refresh user's category cache
    1504                         invalidate_user_cache();
    1505                         return true;
     1478SET status = '".$conf_UAM[4]."'
     1479WHERE user_id = '".$id."'
     1480;";
     1481                        pwg_query($query);
    15061482                }
    1507         }
     1483  }
     1484  elseif (isset($conf_UAM[1]) and $conf_UAM[1] == 'local')
     1485  {
     1486    list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();'));
     1487
     1488    if ($conf_UAM[2] <> -1)
     1489    {
     1490                  $query = "
     1491DELETE FROM ".USER_GROUP_TABLE."
     1492WHERE user_id = '".$id."'
     1493  AND group_id = '".$conf_UAM[2]."'
     1494;";
     1495                  pwg_query($query);
     1496    }
     1497
     1498    if ($conf_UAM[3] <> -1)
     1499    {
     1500      $query = "
     1501DELETE FROM ".USER_GROUP_TABLE."
     1502WHERE user_id = '".$id."'
     1503  AND group_id = '".$conf_UAM[3]."'
     1504;";
     1505      pwg_query($query);
     1506       
     1507                  $query = "
     1508INSERT INTO ".USER_GROUP_TABLE."
     1509  (user_id, group_id)
     1510VALUES
     1511  ('".$id."', '".$conf_UAM[3]."')
     1512;";
     1513                  pwg_query($query);
     1514    }
     1515
     1516    if ($conf_UAM[4] <> -1)
     1517    {
     1518                  $query = "
     1519UPDATE ".USER_INFOS_TABLE."
     1520SET status = '".$conf_UAM[4]."'
     1521WHERE user_id = '".$id."'
     1522;";
     1523      pwg_query($query);
     1524    }
     1525  }
    15081526}
    15091527
Note: See TracChangeset for help on using the changeset viewer.