Ignore:
Timestamp:
Nov 30, 2012, 10:04:06 PM (11 years ago)
Author:
Eric
Message:

Next version is 2.41.2 :
Bug 2765 fixed - Code cleanup
Bug 2796 fixed - Use of php date() function instead od MySql NOW() - Usefull if MySql server is not set at the same date-time as Apache/Php server

Location:
extensions/UserAdvManager/trunk
Files:
16 edited

Legend:

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

    r18999 r19234  
    16171617        while ($row = pwg_db_fetch_assoc($result))
    16181618        {
    1619           list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();'));
     1619          $dbnow = date("Y-m-d H:i:s");
    16201620           
    16211621          $query = '
     
    16451645        while($row = pwg_db_fetch_assoc($result))
    16461646        {
    1647           list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();'));
     1647          $dbnow = date("Y-m-d H:i:s");
    16481648           
    16491649          $query = '
  • extensions/UserAdvManager/trunk/changelog.txt.php

    r18799 r19234  
    358358            Add da_DK, thanks to : Kaare
    359359
     360-- 2.41.2 : Bug 2765 fixed - Code cleanup
     361            Bug 2788 fixed : Warning message on email exclusion no more remains if misconfiguration is fixed. But it's still necessary to refresh the current page once for the warning message to disappear.
     362            Bug 2796 fixed - Use of php date() function instead od MySql NOW() - Usefull if MySql server is not set at the same date-time as Apache/Php server
     363            Update da_DK, thanks to : Kaare
     364            Update it_IT, thanks to : virgigiole
     365            Update lv_LV, thanks to : agrisans
    360366*/
    361367?>
  • extensions/UserAdvManager/trunk/include/functions.inc.php

    r19063 r19234  
    6666    if ((isset($conf_UAM[15]) and $conf_UAM[15] == 'true') or (isset($conf_UAM[18]) and $conf_UAM[18] == 'true'))
    6767    {
    68 
    69                                                 $userid = get_userid($user['username']);
     68      $userid = get_userid($user['username']);
    7069         
    7170      // Looking for existing entry in last visit table
     
    7675WHERE user_id = '.$userid.'
    7776;';
    78        
     77
    7978      $count = pwg_db_num_rows(pwg_query($query));
    80          
     79
    8180      if ($count == 0)
    8281      {
     
    385384        }       
    386385      }
    387        
     386
    388387      if (((!empty($_POST['use_new_pwd']) and (isset($conf_UAM[0]) and $conf_UAM[0] == 'true')) or $confirm_mail_need))
    389388      {
     
    393392WHERE '.$conf['user_fields']['id'].' = \''.$user['id'].'\'
    394393;';
    395        
     394
    396395        list($username) = pwg_db_fetch_row(pwg_query($query));
    397396        SendMail2User($typemail, $user['id'], $username, $_POST['use_new_pwd'], $_POST['mail_address'], $confirm_mail_need);
     
    412411{
    413412  global $conf, $user;
    414  
     413
    415414  include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
    416  
     415
    417416  $conf_UAM = unserialize($conf['UserAdvManager']);
    418  
     417
    419418  // Performing GhostTracker scheduled tasks
    420419  // ---------------------------------------
     
    522521    die('Hacking attempt!');
    523522  }
    524          
     523
    525524  include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
    526525
    527526  $conf_UAM = unserialize($conf['UserAdvManager']);
    528  
     527
    529528  $collection = array();
    530529  $reminder = false;
    531  
     530
    532531  $page['filtered_users'] = get_ghosts_autotasks();
    533532
     
    542541  {
    543542    if (count($collection) > 0)
    544         {
     543    {
    545544      // Process if a non-admin nor webmaster user is logged
    546545      // ---------------------------------------------------
    547546      if (in_array($user['id'], $collection))
    548                         {
     547                        {
    549548        // Check lastvisit reminder state
    550549        // ------------------------------
     
    579578          redirect(make_index_url().'?UAM_msg=deleted', 0);
    580579        }
    581                 }
     580      }
    582581      else // Process if an admin or webmaster user is logged
    583582      {
     
    608607            // Reset of lastvisit date
    609608            // -----------------------
    610             list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();'));
     609            $dbnow = date("Y-m-d H:i:s");
    611610
    612611                        $query = '
     
    633632;';
    634633                        pwg_query($query);
    635                                                                                                 }
     634            }
    636635
    637636            // Change user status
     
    687686              // Reset confirmed user status to unvalidated
    688687              // ------------------------------------------
    689                                                                                                 $query = '
     688              $query = '
    690689UPDATE '.USER_CONFIRM_MAIL_TABLE.'
    691690SET date_check = NULL
    692691WHERE user_id = '.$user_id.'
    693692;';
    694                                                                                                 pwg_query($query);
     693              pwg_query($query);
    695694
    696695              // Get users information for email notification
    697696              // --------------------------------------------
    698                                                                                                 $query = '
     697              $query = '
    699698SELECT id, username, mail_address
    700699FROM '.USERS_TABLE.'
    701700WHERE id = '.$user_id.'
    702701;';
    703                                                                                                 $data = pwg_db_fetch_assoc(pwg_query($query));
    704            
     702              $data = pwg_db_fetch_assoc(pwg_query($query));
     703
    705704              demotion_mail($user_id, $data['username'], $data['mail_address']);
    706705            }
     
    733732    die('Hacking attempt!');
    734733  }
    735          
     734
    736735  include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
    737736
    738737  $conf_UAM = unserialize($conf['UserAdvManager']);
    739  
     738
    740739  $collection = array();
    741740  $reminder = false;
    742  
     741
    743742  $page['filtered_users'] = get_unvalid_user_autotasks();
    744743
     
    757756      // ---------------------------------------------------
    758757      if (in_array($user['id'], $collection))
    759                 {
     758      {
    760759        // Check ConfirmMail reminder state
    761760        // --------------------------------
     
    780779        if (!$reminder and isset($conf_UAM[32]) and $conf_UAM[32] == 'true')
    781780        {
    782                         $typemail = 1;
    783          
     781          $typemail = 1;
     782
    784783          // Get current user information
    785784          // ----------------------------
     
    807806          redirect(make_index_url().'?UAM_msg=deleted', 0);
    808807        }
    809                 }
     808      }
    810809      else // Process if an admin or webmaster user is logged
    811810      {
     
    895894    UAM_ConfirmMail();
    896895  }
    897 
    898 }
     896}
     897
    899898
    900899/**
     
    919918      $patterns[] = '#\[myurl\]#i';
    920919      $replacements[] = get_gallery_home_url();
    921    
     920
    922921      if (function_exists('get_user_language_desc'))
    923922      {
     
    925924      }
    926925      else $custom_text = l10n(preg_replace($patterns, $replacements, $conf_UAM[40]));
    927      
     926
    928927      $page["errors"][]=$custom_text;
    929928    }
     
    944943      }
    945944      else $custom_text = l10n(preg_replace($patterns, $replacements, $conf_UAM[23]));
    946      
     945
    947946      $page["errors"][]=$custom_text;
    948947    }
     
    963962      }
    964963      else $custom_text = l10n(preg_replace($patterns, $replacements, $conf_UAM[31]));
    965      
     964
    966965      $page["errors"][]=$custom_text;
    967966    }
    968967  }
    969968}
     969
     970
    970971/**
    971972 * Triggered on init
     
    975976function UAM_ConfirmMail()
    976977{
    977 
    978978  if (isset($_GET['key']) and isset($_GET['userid']))
    979979  {
    980  
    981980    global $user, $lang, $conf, $page;
    982    
     981
    983982    $key = $_GET['key'];
    984983    $userid = $_GET['userid'];
     
    986985    $conf_UAM_ConfirmMail = unserialize($conf['UserAdvManager_ConfirmMail']);
    987986    $conf_UAM = unserialize($conf['UserAdvManager']);
    988  
     987
    989988    $query = '
    990   SELECT '.USERS_TABLE.'.username
    991   FROM '.USERS_TABLE.'
    992   WHERE ('.USERS_TABLE.'.id ='.$userid.')
    993   ;';
     989SELECT '.USERS_TABLE.'.username
     990FROM '.USERS_TABLE.'
     991WHERE ('.USERS_TABLE.'.id ='.$userid.')
     992;';
    994993    $result = pwg_db_fetch_assoc(pwg_query($query));
    995  
     994
    996995    if (VerifyConfirmMail($key))
    997996    {
     
    10031002  // ----------------------------------------------
    10041003      $query = '
    1005   SELECT language
    1006   FROM '.USER_INFOS_TABLE.'
    1007   WHERE '.USER_INFOS_TABLE.'.user_id ='.$userid.'
    1008   ;';
     1004SELECT language
     1005FROM '.USER_INFOS_TABLE.'
     1006WHERE '.USER_INFOS_TABLE.'.user_id ='.$userid.'
     1007;';
    10091008      $data = pwg_db_fetch_assoc(pwg_query($query));
    1010  
     1009
    10111010  // Check if user is already registered (profile changing) - If not (new registration), language is set to current gallery language
    10121011  // -------------------------------------------------------------------------------------------------------------------------------
     
    10251024        load_language('plugin.lang', UAM_PATH);
    10261025      }
    1027  
     1026
    10281027      if (isset($conf_UAM_ConfirmMail[5]) and !empty($conf_UAM_ConfirmMail[5]))
    10291028      {
     
    10361035        $patterns[] = '#\[myurl\]#i';
    10371036        $replacements[] = get_gallery_home_url();
    1038  
     1037
    10391038        if (function_exists('get_user_language_desc'))
    10401039        {
     
    10461045        }
    10471046        $page['infos'][]=$custom_text;
    1048         //print_r($custom_text);
    1049       }
    1050       //log_user($userid, true);
     1047      }
    10511048    } 
    10521049    else
     
    10621059        $patterns[] = '#\[myurl\]#i';
    10631060        $replacements[] = get_gallery_home_url();
    1064      
     1061
    10651062        if (function_exists('get_user_language_desc'))
    10661063        {
     
    10711068          $custom_text = l10n(preg_replace($patterns, $replacements, $conf_UAM_ConfirmMail[6]));
    10721069        }
    1073        
     1070
    10741071        $page['errors'][]=$custom_text;
    10751072      }
     
    10771074  }
    10781075}
     1076
     1077
    10791078/**
    10801079 * Triggered on render_lost_password_mail_content
     
    10911090{
    10921091  global $conf;
    1093  
     1092
    10941093  load_language('plugin.lang', UAM_PATH);
    1095  
     1094
    10961095  $conf_UAM = unserialize($conf['UserAdvManager']);
    1097  
     1096
    10981097  if (isset($conf_UAM[28]) and $conf_UAM[28] == 'true')
    10991098  {
     
    11031102    $patterns[] = '#\[myurl\]#i';
    11041103    $replacements[] = get_gallery_home_url();
    1105    
     1104
    11061105    $infos = preg_replace($patterns, $replacements, $conf_UAM[29])."\n"."\n".$infos;
    11071106  }
     
    11221121  $conf_UAM = unserialize($conf['UserAdvManager']);
    11231122
    1124                 include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
    1125 
    1126                 $infos1_perso = "";
     1123  include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
     1124
     1125        $infos1_perso = "";
    11271126  $infos2_perso = "";
    11281127  $subject = "";
     
    11661165        $patterns[] = '#\[mygallery\]#i';
    11671166        $replacements[] = $conf['gallery_title'];
    1168    
     1167
    11691168        if (function_exists('get_user_language_desc'))
    11701169        {
     
    11751174
    11761175      break;
    1177      
     1176
    11781177    case 2: // Confirmation email on user profile update - With information email if modification done in user profile
    11791178      if (isset($conf_UAM[41]) and !empty($conf_UAM[41]))
     
    11851184        $patterns[] = '#\[mygallery\]#i';
    11861185        $replacements[] = $conf['gallery_title'];
    1187    
     1186
    11881187        if (function_exists('get_user_language_desc'))
    11891188        {
     
    12051204        $patterns[] = '#\[myurl\]#i';
    12061205        $replacements[] = get_gallery_home_url();
    1207    
     1206
    12081207        if (function_exists('get_user_language_desc'))
    12091208        {
     
    12371236
    12381237      break;
    1239        
     1238
    12401239    case 3: // Only information email send to user if checked
    12411240      if (isset($conf_UAM[43]) and !empty($conf_UAM[43]))
     
    12471246        $patterns[] = '#\[mygallery\]#i';
    12481247        $replacements[] = $conf['gallery_title'];
    1249    
     1248
    12501249        if (function_exists('get_user_language_desc'))
    12511250        {
     
    12671266        $patterns[] = '#\[myurl\]#i';
    12681267        $replacements[] = get_gallery_home_url();
    1269    
     1268
    12701269        if (function_exists('get_user_language_desc'))
    12711270        {
     
    13031302  if (isset($conf_UAM[1]) and ($conf_UAM[1] == 'true' or $conf_UAM[1] == 'local')  and $confirm) // Add confirmation link ?
    13041303  {
    1305     $infos2 = array
    1306     (
     1304    $infos2 = array(
    13071305      get_l10n_args('UAM_Link: %s', AddConfirmMail($id, $email)),
    13081306      get_l10n_args('', ''),
     
    13191317      $patterns[] = '#\[myurl\]#i';
    13201318      $replacements[] = get_gallery_home_url();
    1321      
     1319
    13221320      if (isset($conf_UAM_ConfirmMail[0]) and $conf_UAM_ConfirmMail[0] == 'true') // [Kdays] replacement only if related option is active
    13231321      {
     
    13251323        $replacements[] = $conf_UAM_ConfirmMail[1];
    13261324      }
    1327      
     1325
    13281326      if (function_exists('get_user_language_desc'))
    13291327      {
     
    13391337                {
    13401338                switch_lang_to(get_default_language());
    1341                
     1339
    13421340                load_language('plugin.lang', UAM_PATH);
    13431341                $subject = get_l10n_args('UAM_Subject admin validation for %s',$username);
    13441342
    13451343                  $content = array(
    1346                 get_l10n_args('UAM_Manual_validation_needed_for %s', stripslashes($username)),
    1347     get_l10n_args('', ''),
    1348     get_l10n_args('UAM_Link: %s', AddConfirmMail($id, $email)),
    1349     );
    1350 
    1351     UAM_mail_notification_admins($subject, $content);
     1344                  get_l10n_args('UAM_Manual_validation_needed_for %s', stripslashes($username)),
     1345        get_l10n_args('', ''),
     1346        get_l10n_args('UAM_Link: %s', AddConfirmMail($id, $email)),
     1347      );
     1348
     1349      UAM_mail_notification_admins($subject, $content);
    13521350                }
    13531351                else
     
    13761374{
    13771375  global $conf, $user;
    1378  
     1376
    13791377  // Check arguments
    13801378  if (empty($keyargs_subject) or empty($keyargs_content))
     
    14461444  $conf_UAM_ConfirmMail = unserialize($conf['UserAdvManager_ConfirmMail']);
    14471445 
    1448                 include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
     1446  include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
    14491447 
    14501448// We have to get the user's language in database
     
    14571455  $data = pwg_db_fetch_assoc(pwg_query($query));
    14581456  $language = $data['language'];
    1459  
     1457
    14601458// And switch gallery to this language before using personalized and multilangual contents
    14611459// ---------------------------------------------------------------------------------------
    14621460  switch_lang_to($data['language']);
    1463    
     1461
    14641462  load_language('plugin.lang', UAM_PATH);
    14651463
     
    14671465  {
    14681466    case 1: //Generating email content for remind with a new key
     1467      if (isset($conf_UAM[42]) and !empty($conf_UAM[42]))
     1468      {
     1469        // Management of Extension flags ([username], [mygallery])
     1470        // -------------------------------------------------------
     1471        $patterns[] = '#\[username\]#i';
     1472        $replacements[] = $username;
     1473        $patterns[] = '#\[mygallery\]#i';
     1474        $replacements[] = $conf['gallery_title'];
     1475
     1476        if (function_exists('get_user_language_desc'))
     1477        {
     1478          $subject = get_user_language_desc(preg_replace($patterns, $replacements, $conf_UAM[42]))."\n\n";
     1479        }
     1480        else $subject = l10n(preg_replace($patterns, $replacements, $conf_UAM[42]))."\n\n";
     1481      }
     1482
     1483      if (isset($conf_UAM_ConfirmMail[2]) and !empty($conf_UAM_ConfirmMail[2]) and isset($conf_UAM_ConfirmMail[3]) and $conf_UAM_ConfirmMail[3] == 'true' and $confirm)
     1484      {
     1485                // Management of Extension flags ([username], [mygallery], [myurl], [Kdays])
     1486        // -------------------------------------------------------------------------
     1487        $patterns[] = '#\[username\]#i';
     1488        $replacements[] = $username;
     1489        $patterns[] = '#\[mygallery\]#i';
     1490        $replacements[] = $conf['gallery_title'];
     1491        $patterns[] = '#\[myurl\]#i';
     1492        $replacements[] = get_gallery_home_url();
     1493
     1494        if (isset($conf_UAM_ConfirmMail[0]) and $conf_UAM_ConfirmMail[0] == 'true') // [Kdays] replacement only if related option is active
     1495        {
     1496          $patterns[] = '#\[Kdays\]#i';
     1497          $replacements[] = $conf_UAM_ConfirmMail[1];
     1498        }
     1499
     1500        if (function_exists('get_user_language_desc'))
     1501        {
     1502          $infos1 = get_user_language_desc(preg_replace($patterns, $replacements, $conf_UAM_ConfirmMail[2]))."\n\n";
     1503        }
     1504                                else $infos1 = l10n(preg_replace($patterns, $replacements, $conf_UAM_ConfirmMail[2]))."\n\n";
     1505
     1506        $infos2 = array
     1507        (
     1508          get_l10n_args('UAM_Link: %s', ResetConfirmMail($user_id)),
     1509          get_l10n_args('', ''),
     1510        );
     1511      }
     1512
     1513// Set reminder true
     1514// -----------------     
     1515      $query = '
     1516UPDATE '.USER_CONFIRM_MAIL_TABLE.'
     1517SET reminder = "true"
     1518WHERE user_id = '.$user_id.'
     1519;';
     1520      pwg_query($query);
     1521
     1522      break;
     1523
     1524    case 2: //Generating email content for remind without a new key
    14691525      if (isset($conf_UAM[42]) and !empty($conf_UAM[42]))
    14701526      {
     
    14821538        else $subject = l10n(preg_replace($patterns, $replacements, $conf_UAM[42]))."\n\n";
    14831539      }
    1484      
    1485       if (isset($conf_UAM_ConfirmMail[2]) and !empty($conf_UAM_ConfirmMail[2]) and isset($conf_UAM_ConfirmMail[3]) and $conf_UAM_ConfirmMail[3] == 'true' and $confirm)
    1486       {
    1487                 // Management of Extension flags ([username], [mygallery], [myurl], [Kdays])
    1488         // -------------------------------------------------------------------------
    1489         $patterns[] = '#\[username\]#i';
    1490         $replacements[] = $username;
    1491         $patterns[] = '#\[mygallery\]#i';
    1492         $replacements[] = $conf['gallery_title'];
    1493         $patterns[] = '#\[myurl\]#i';
    1494         $replacements[] = get_gallery_home_url();
    1495 
    1496         if (isset($conf_UAM_ConfirmMail[0]) and $conf_UAM_ConfirmMail[0] == 'true') // [Kdays] replacement only if related option is active
    1497         {
    1498           $patterns[] = '#\[Kdays\]#i';
    1499           $replacements[] = $conf_UAM_ConfirmMail[1];
    1500         }
    1501 
    1502         if (function_exists('get_user_language_desc'))
    1503         {
    1504           $infos1 = get_user_language_desc(preg_replace($patterns, $replacements, $conf_UAM_ConfirmMail[2]))."\n\n";
    1505         }
    1506                                 else $infos1 = l10n(preg_replace($patterns, $replacements, $conf_UAM_ConfirmMail[2]))."\n\n";
    1507 
    1508         $infos2 = array
    1509         (
    1510           get_l10n_args('UAM_Link: %s', ResetConfirmMail($user_id)),
    1511           get_l10n_args('', ''),
    1512         );       
    1513                                                 }
    1514 
    1515 // Set reminder true
    1516 // -----------------     
    1517       $query = '
    1518 UPDATE '.USER_CONFIRM_MAIL_TABLE.'
    1519 SET reminder = "true"
    1520 WHERE user_id = '.$user_id.'
    1521 ;';
    1522       pwg_query($query);
    1523      
    1524                                 break;
    1525      
    1526     case 2: //Generating email content for remind without a new key
    1527       if (isset($conf_UAM[42]) and !empty($conf_UAM[42]))
    1528       {
    1529         // Management of Extension flags ([username], [mygallery])
    1530         // -------------------------------------------------------
    1531         $patterns[] = '#\[username\]#i';
    1532         $replacements[] = $username;
    1533         $patterns[] = '#\[mygallery\]#i';
    1534         $replacements[] = $conf['gallery_title'];
    1535    
    1536         if (function_exists('get_user_language_desc'))
    1537         {
    1538           $subject = get_user_language_desc(preg_replace($patterns, $replacements, $conf_UAM[42]))."\n\n";
    1539         }
    1540         else $subject = l10n(preg_replace($patterns, $replacements, $conf_UAM[42]))."\n\n";
    1541       }
    1542      
     1540
    15431541      if (isset($conf_UAM_ConfirmMail[4]) and !empty($conf_UAM_ConfirmMail[4]) and isset($conf_UAM_ConfirmMail[3]) and $conf_UAM_ConfirmMail[3] == 'true' and !$confirm)
    15441542      {
     
    15571555          $replacements[] = $conf_UAM_ConfirmMail[1];
    15581556        }
    1559        
     1557
    15601558        if (function_exists('get_user_language_desc'))
    15611559        {
     
    15641562        else $infos1 = l10n(preg_replace($patterns, $replacements, $conf_UAM_ConfirmMail[4]))."\n\n";
    15651563      }
    1566      
     1564
    15671565// Set reminder true
    15681566// -----------------
     
    16001598  $conf_UAM = unserialize($conf['UserAdvManager']);
    16011599  $subject = "";
    1602  
    1603                 include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
     1600
     1601  include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
    16041602
    16051603// We have to get the user's language in database
     
    16161614// ---------------------------------------------------------------------------------------
    16171615  switch_lang_to($data['language']);
    1618    
     1616
    16191617  load_language('plugin.lang', UAM_PATH);
    16201618
     
    16821680
    16831681  $conf_UAM = unserialize($conf['UserAdvManager']);
     1682
     1683  include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
    16841684 
    1685                 include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
    1686  
    1687                 $custom_txt = "";
    1688                 $subject = "";
     1685        $custom_txt = "";
     1686        $subject = "";
    16891687
    16901688// We have to get the user's language in database
     
    16951693WHERE user_id = '.$id.'
    16961694;';
     1695
    16971696  $data = pwg_db_fetch_assoc(pwg_query($query));
    16981697
     
    17301729    else $subject = l10n(preg_replace($patterns, $replacements, $conf_UAM[44]))."\n\n";
    17311730  }
    1732      
     1731
    17331732  if (isset($conf_UAM[24]) and !empty($conf_UAM[24]))
    17341733  {
     
    17871786
    17881787  $conf_UAM = unserialize($conf['UserAdvManager']);
    1789  
    1790                 include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
    1791  
    1792                 $custom_txt = "";
     1788
     1789  include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
     1790
     1791        $custom_txt = "";
    17931792  $subject = "";
    17941793
     
    18001799WHERE user_id = '.$id.'
    18011800;';
     1801
    18021802  $data = pwg_db_fetch_assoc(pwg_query($query));
    18031803
     
    18271827WHERE id = '.$id.'
    18281828;';
     1829
    18291830  $result = pwg_db_fetch_assoc(pwg_query($query));
    18301831
     
    18441845    else $subject = l10n(preg_replace($patterns, $replacements, $conf_UAM[46]))."\n\n";
    18451846  }
    1846      
     1847
    18471848  if (isset($conf_UAM[27]) and !empty($conf_UAM[27]))
    18481849  {
     
    18941895    $query = '
    18951896SELECT COUNT(*)
    1896   FROM '.USER_CONFIRM_MAIL_TABLE.'
     1897FROM '.USER_CONFIRM_MAIL_TABLE.'
    18971898WHERE id = "'.$id.'"
    18981899;';
     
    19201921  $Confirm_Mail_ID = FindAvailableConfirmMailID();
    19211922
    1922   list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();'));
    1923  
     1923  $dbnow = date("Y-m-d H:i:s");
     1924
    19241925  if (isset($Confirm_Mail_ID))
    19251926  {
     
    19301931;';
    19311932    list($status) = pwg_db_fetch_row(pwg_query($query));
    1932    
     1933
    19331934    $query = '
    19341935INSERT INTO '.USER_CONFIRM_MAIL_TABLE.'
     
    19371938  ("'.$Confirm_Mail_ID.'", '.$user_id.', "'.$email.'", "'.$status.'", null)
    19381939;';
     1940
    19391941    pwg_query($query);
    19401942
     
    19501952  )
    19511953;';
     1954
    19521955    pwg_query($query);
    19531956
     
    19611964WHERE user_id = '.$user_id.'
    19621965;';
     1966
    19631967      pwg_query($query);
    19641968    }
     
    19741978  ('.$user_id.', '.$conf_UAM[2].')
    19751979;';
     1980
    19761981      pwg_query($query);
    19771982    }
     
    19861991WHERE user_id = '.$user_id.'
    19871992;';
     1993
    19881994      pwg_query($query);
    19891995    }
    1990    
     1996
    19911997    // Set UAM_validated field to false in #_users table
    19921998    // -------------------------------------------------
    19931999    SetUnvalidated($user_id);
    1994    
     2000
    19952001    if ( $conf['guest_access'] )
    19962002    {
     
    20152021{
    20162022  global $conf;
    2017  
     2023
    20182024  $conf_UAM = unserialize($conf['UserAdvManager']);
    20192025
     
    20292035  )
    20302036;';
     2037
    20312038  pwg_query($query);
    20322039
     
    20382045WHERE user_id = '.$user_id.'
    20392046;';
     2047
    20402048    pwg_query($query);
    20412049  }
     
    20492057  ('.$user_id.', '.$conf_UAM[2].')
    20502058;';
     2059
    20512060    pwg_query($query);
    20522061  }
     
    20602069  ('.$user_id.', "'.$conf_UAM[35].'")
    20612070;';
     2071
    20622072    pwg_query($query);
    20632073  }
     
    20762086{
    20772087  global $conf;
    2078  
     2088
    20792089  $Confirm_Mail_ID = FindAvailableConfirmMailID();
    20802090
    2081   list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();'));
    2082  
     2091  $dbnow = date("Y-m-d H:i:s");
     2092
    20832093  if (isset($Confirm_Mail_ID))
    20842094  {
     
    20882098WHERE user_id = '.$user_id.'
    20892099;';
     2100
    20902101    pwg_query($query);
    20912102
     
    20952106WHERE user_id = '.$user_id.'
    20962107;';
     2108
    20972109    pwg_query($query);
    2098    
     2110
    20992111    if ( $conf['guest_access'] )
    21002112    {
     
    21192131  global $conf;
    21202132
    2121   list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();'));
     2133  $dbnow = date("Y-m-d H:i:s");
    21222134
    21232135  $query = '
     
    21262138WHERE user_id = '.$user_id.'
    21272139;';
     2140
    21282141  pwg_query($query);
    21292142}
     
    21402153WHERE user_id = '.$user_id.'
    21412154;';
     2155
    21422156  pwg_query($query);
    21432157}
     2158
    21442159
    21452160/**
     
    21532168WHERE user_id = '.$user_id.'
    21542169;';
     2170
    21552171  pwg_query($query);
    21562172}
     
    21742190
    21752191  $tab = pwg_db_fetch_row(pwg_query($query));
    2176  
     2192
    21772193  $values = explode(',', $tab[0]);
    21782194
    21792195  unset($values[array_search($user_id, $values)]);
    2180      
     2196
    21812197  $query = '
    21822198UPDATE '.CONFIG_TABLE.'
     
    22022218
    22032219  include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
    2204  
     2220
    22052221  $conf_UAM = unserialize($conf['UserAdvManager']);
    22062222
     
    22122228WHERE id = "'.$id.'"
    22132229;';
     2230
    22142231  list($count) = pwg_db_fetch_row(pwg_query($query));
    22152232
     
    22302247WHERE user_id = '.$data['user_id'].'
    22312248;';
     2249
    22322250      list($registration_date) = pwg_db_fetch_row(pwg_query($query));
    22332251
     
    22362254      if (!empty($registration_date))
    22372255      {
    2238                                                                 // Verify Confirmmail with time limit ON
    2239                                 // -------------------------------------
    2240                                                                 if (isset ($conf_UAM_ConfirmMail[1]))
    2241                                                                 {
    2242                                                                                 // Dates formating and compare
    2243                                         // ---------------------------
    2244                                                                                 $today = date("d-m-Y"); // Get today's date
    2245                                                                                 list($day, $month, $year) = explode('-', $today); // explode date of today                                               
    2246                                                                         $daytimestamp = mktime(0, 0, 0, $month, $day, $year);// Generate UNIX timestamp
    2247 
    2248                                                                 list($regdate, $regtime) = explode(' ', $registration_date); // Explode date and time from registration date
    2249                                                                                 list($regyear, $regmonth, $regday) = explode('-', $regdate); // Explode date from registration date
    2250                                                                                 $regtimestamp = mktime(0, 0, 0, $regmonth, $regday, $regyear);// Generate UNIX timestamp
    2251 
    2252                                                                                 $deltasecs = $daytimestamp - $regtimestamp;// Compare the 2 UNIX timestamps     
    2253                                                                                 $deltadays = floor($deltasecs / 86400);// Convert result from seconds to days
    2254 
    2255                                                                                 // Condition with the value set for time limit
    2256                                         // -------------------------------------------
    2257                                                                                 if ($deltadays <= $conf_UAM_ConfirmMail[1]) // If Nb of days is less than the limit set
    2258                                                                                 {
    2259                                                                                                 list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();'));
    2260 
    2261                                         // Update ConfirmMail table
    2262                                         // ------------------------
    2263                                                                                                 $query = '
     2256        // Verify Confirmmail with time limit ON
     2257                // -------------------------------------
     2258                                if (isset ($conf_UAM_ConfirmMail[1]))
     2259        {
     2260                                  // Dates formating and compare
     2261                        // ---------------------------
     2262                                        $today = date("d-m-Y"); // Get today's date
     2263                                        list($day, $month, $year) = explode('-', $today); // explode date of today                                               
     2264                                        $daytimestamp = mktime(0, 0, 0, $month, $day, $year);// Generate UNIX timestamp
     2265
     2266                                list($regdate, $regtime) = explode(' ', $registration_date); // Explode date and time from registration date
     2267                                        list($regyear, $regmonth, $regday) = explode('-', $regdate); // Explode date from registration date
     2268                                        $regtimestamp = mktime(0, 0, 0, $regmonth, $regday, $regyear);// Generate UNIX timestamp
     2269
     2270          $deltasecs = $daytimestamp - $regtimestamp;// Compare the 2 UNIX timestamps   
     2271                                        $deltadays = floor($deltasecs / 86400);// Convert result from seconds to days
     2272
     2273                                        // Condition with the value set for time limit
     2274                        // -------------------------------------------
     2275                                        if ($deltadays <= $conf_UAM_ConfirmMail[1]) // If Nb of days is less than the limit set
     2276          {
     2277            $dbnow = date("Y-m-d H:i:s");
     2278
     2279                        // Update ConfirmMail table
     2280                        // ------------------------
     2281                                                $query = '
    22642282UPDATE '.USER_CONFIRM_MAIL_TABLE.'
    22652283SET date_check="'.$dbnow.'", reminder="false"
    22662284WHERE id = "'.$id.'"
    22672285;';
    2268                                                                                                 pwg_query($query);
    2269 
    2270                                         // Update LastVisit table - Force reminder field to false
    2271                                         // Usefull when a user has been automatically downgraded and revalidate its registration
    2272                                         // -------------------------------------------------------------------------------------
    2273                                                                                                 $query = '
     2286                                                pwg_query($query);
     2287
     2288                        // Update LastVisit table - Force reminder field to false
     2289                        // Usefull when a user has been automatically downgraded and revalidate its registration
     2290                        // -------------------------------------------------------------------------------------
     2291                                                $query = '
    22742292UPDATE '.USER_LASTVISIT_TABLE.'
    22752293SET reminder="false"
    22762294WHERE user_id = "'.$data['user_id'].'"
    22772295;';
    2278                                                                                                 pwg_query($query);
     2296                                                pwg_query($query);
    22792297     
    2280                                                                                                 if ($conf_UAM[2] <> -1) // Delete user from unvalidated users group
    2281                                                                                                 {
    2282                                                                                                                 $query = '
     2298                                                if ($conf_UAM[2] <> -1) // Delete user from unvalidated users group
     2299                                                {
     2300              $query = '
    22832301DELETE FROM '.USER_GROUP_TABLE.'
    22842302WHERE user_id = '.$data['user_id'].'
    22852303  AND group_id = '.$conf_UAM[2].'
    22862304;';
    2287                                                                                                                 pwg_query($query);
    2288                                                                                                 }
    2289 
    2290                                                                                                 if ($conf_UAM[3] <> -1) // Add user to validated users group
    2291                                                                                                 {
    2292                                                                                                                 $query = '
     2305                                                        pwg_query($query);
     2306            }
     2307
     2308                                                if ($conf_UAM[3] <> -1) // Add user to validated users group
     2309                                                {
     2310              $query = '
    22932311INSERT INTO '.USER_GROUP_TABLE.'
    22942312  (user_id, group_id)
     
    22962314  ('.$data['user_id'].', '.$conf_UAM[3].')
    22972315;';
    2298                                                                                                                 pwg_query($query);
    2299                                                                                                 }
    2300 
    2301                                                                                                 if ($conf_UAM[4] <> -1) // Change user's status
    2302                                                                                                 {
    2303                                                                                                                 $query = '
     2316                                                        pwg_query($query);
     2317            }
     2318
     2319                                                if ($conf_UAM[4] <> -1) // Change user's status
     2320                                                {
     2321              $query = '
    23042322UPDATE '.USER_INFOS_TABLE.'
    23052323SET status = "'.$conf_UAM[4].'"
    23062324WHERE user_id = '.$data['user_id'].'
    23072325;';
    2308                                                                                                                 pwg_query($query);
    2309                                                                                                 }
    2310 
    2311                                                                                                 if ($conf_UAM[36] <> -1) // Change user's privacy level
    2312                                                                                                 {
    2313                                                                                                                 $query = '
     2326                                                        pwg_query($query);
     2327            }
     2328
     2329                                                if ($conf_UAM[36] <> -1) // Change user's privacy level
     2330                                                {
     2331              $query = '
    23142332UPDATE '.USER_INFOS_TABLE.'
    23152333SET level = "'.$conf_UAM[36].'"
    23162334WHERE user_id = '.$data['user_id'].'
    23172335;';
    2318                                                                                                                 pwg_query($query);
    2319                                                                                                 }
    2320 
    2321                                                                                                 // Set UAM_validated field to True in #_users table
    2322                                                                                                 $query = '
     2336                                                        pwg_query($query);
     2337            }
     2338
     2339                                                // Set UAM_validated field to True in #_users table
     2340                                                $query = '
    23232341UPDATE '.USERS_TABLE.'
    23242342SET UAM_validated = "true"
    23252343WHERE id = '.$data['user_id'].'
    23262344;';
    2327                                                                                                 pwg_query($query);
    2328 
    2329                                                                                                 // Refresh user's category cache
    2330                                                 // -----------------------------
    2331                                                                                                 invalidate_user_cache();
    2332 
    2333                                                                                                 return true;
    2334                                                                                 }
    2335                                                                                 elseif ($deltadays > $conf_UAM_ConfirmMail[1]) // If timelimit exeeds
    2336                                                                                 {
    2337                                                                                                 return false;
    2338                                                                                 }
    2339                                                                 }
    2340                                                                 // Verify Confirmmail with time limit OFF
    2341                                 // --------------------------------------
    2342                                                                 else
    2343                                                                 {
    2344                                                                                 list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();'));
    2345 
    2346                                 // Update ConfirmMail table
    2347                                 // ------------------------
    2348                                                                                 $query = '
     2345                                                pwg_query($query);
     2346
     2347                                                // Refresh user's category cache
     2348            // -----------------------------
     2349                                                invalidate_user_cache();
     2350
     2351                                                return true;
     2352          }
     2353          elseif ($deltadays > $conf_UAM_ConfirmMail[1]) // If timelimit exeeds
     2354          {
     2355            return false;
     2356          }
     2357        }
     2358        // Verify Confirmmail with time limit OFF
     2359        // --------------------------------------
     2360        else
     2361        {
     2362          $dbnow = date("Y-m-d H:i:s");
     2363
     2364          // Update ConfirmMail table
     2365          // ------------------------
     2366                                        $query = '
    23492367UPDATE '.USER_CONFIRM_MAIL_TABLE.'
    23502368SET date_check="'.$dbnow.'"
    23512369WHERE id = "'.$id.'"
    23522370;';
    2353                                                                                 pwg_query($query);
    2354 
    2355                                 // Update LastVisit table - Force reminder field to false
    2356                                 // Usefull when a user has been automatically downgraded and revalidate its registration
    2357                                 // -------------------------------------------------------------------------------------
    2358                                                                                 $query = '
     2371                                        pwg_query($query);
     2372
     2373          // Update LastVisit table - Force reminder field to false
     2374          // Usefull when a user has been automatically downgraded and revalidate its registration
     2375          // -------------------------------------------------------------------------------------
     2376          $query = '
    23592377UPDATE '.USER_LASTVISIT_TABLE.'
    23602378SET reminder="false"
    23612379WHERE user_id = "'.$data['user_id'].'"
    23622380;';
    2363                                 pwg_query($query);
    2364 
    2365                                                                                 if ($conf_UAM[2] <> -1) // Delete user from unvalidated users group
    2366                                                                                 {
    2367                                                                                                 $query = '
     2381          pwg_query($query);
     2382
     2383          if ($conf_UAM[2] <> -1) // Delete user from unvalidated users group
     2384          {
     2385            $query = '
    23682386DELETE FROM '.USER_GROUP_TABLE.'
    23692387WHERE user_id = '.$data['user_id'].'
    23702388AND group_id = '.$conf_UAM[2].'
    23712389;';
    2372                                                                                                 pwg_query($query);
    2373                                                                                 }
    2374 
    2375                                                                                 if ($conf_UAM[3] <> -1)
    2376                                                                                 {
    2377                                                                                                 $query = '
     2390            pwg_query($query);
     2391          }
     2392
     2393          if ($conf_UAM[3] <> -1)
     2394          {
     2395            $query = '
    23782396DELETE FROM '.USER_GROUP_TABLE.'
    23792397WHERE user_id = '.$data['user_id'].'
    23802398AND group_id = '.$conf_UAM[3].'
    23812399;';
    2382                                                                                                 pwg_query($query);
    2383 
    2384                                                                                                 $query = '
     2400            pwg_query($query);
     2401
     2402            $query = '
    23852403INSERT INTO '.USER_GROUP_TABLE.'
    23862404  (user_id, group_id)
     
    23882406  ('.$data['user_id'].', '.$conf_UAM[3].')
    23892407;';
    2390                                                                                                 pwg_query($query);
    2391                                                                                 }
    2392 
    2393                                                                                 if ($conf_UAM[4] <> -1) // Change user's status
    2394                                                                                 {
    2395                                                                                                 $query = '
     2408            pwg_query($query);
     2409          }
     2410
     2411          if ($conf_UAM[4] <> -1) // Change user's status
     2412          {
     2413            $query = '
    23962414UPDATE '.USER_INFOS_TABLE.'
    23972415SET status = "'.$conf_UAM[4].'"
    23982416WHERE user_id = '.$data['user_id'].'
    23992417;';
    2400                                                                                                 pwg_query($query);
    2401                                                                                 }
    2402 
    2403                                                                                 if ($conf_UAM[36] <> -1) // Change user's privacy level
    2404                                                                                 {
    2405                                                                                                 $query = '
     2418            pwg_query($query);
     2419          }
     2420
     2421          if ($conf_UAM[36] <> -1) // Change user's privacy level
     2422          {
     2423            $query = '
    24062424UPDATE '.USER_INFOS_TABLE.'
    24072425SET level = "'.$conf_UAM[36].'"
    24082426WHERE user_id = '.$data['user_id'].'
    24092427;';
    2410                                                                                                 pwg_query($query);
    2411                                                                                 }
    2412 
    2413                                                                                 // Set UAM_validated field to True in #_users table
    2414                                                                                 $query = '
     2428            pwg_query($query);
     2429          }
     2430
     2431          // Set UAM_validated field to True in #_users table
     2432          $query = '
    24152433UPDATE '.USERS_TABLE.'
    24162434SET UAM_validated = "true"
    24172435WHERE id = '.$data['user_id'].'
    24182436;';
    2419                                                                                 pwg_query($query);
    2420 
    2421                                                                                 // Refresh user's category cache
    2422                                 // -----------------------------
    2423                                                                                 invalidate_user_cache();
    2424 
    2425                                                                                 return true;
    2426                                                                 }
    2427                                                 }
    2428                                 }
     2437          pwg_query($query);
     2438
     2439          // Refresh user's category cache
     2440          // -----------------------------
     2441          invalidate_user_cache();
     2442
     2443          return true;
     2444        }
     2445      }
     2446    }
    24292447    else if (!empty($data) and !is_null($data['date_check']))
    24302448    {
    24312449      return false;
    24322450    }
    2433                 }
     2451  }
    24342452  else
    24352453    return false;
     
    24512469                if (isset($conf_UAM[1]) and $conf_UAM[1] == 'true') // Set date of validation
    24522470                {
    2453                                 list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();'));
    2454 
    2455                                 $query = '
     2471      $dbnow = date("Y-m-d H:i:s");
     2472
     2473                        $query = '
    24562474UPDATE '.USER_CONFIRM_MAIL_TABLE.'
    24572475SET date_check="'.$dbnow.'"
    24582476WHERE user_id = '.$id.'
    24592477;';
    2460                                 pwg_query($query);
     2478                        pwg_query($query);
    24612479                }
    24622480
     
    24702488                                pwg_query($query);
    24712489                }
    2472  
     2490
    24732491                if ($conf_UAM[3] <> -1) // Set user's valid group
    24742492                {
    2475                                 $query = '
     2493      $query = '
    24762494DELETE FROM '.USER_GROUP_TABLE.'
    24772495WHERE user_id = '.$id.'
    24782496                AND group_id = '.$conf_UAM[3].'
    24792497;';
    2480                                 pwg_query($query);
    2481        
    2482                                 $query = '
     2498      pwg_query($query);
     2499
     2500      $query = '
    24832501INSERT INTO '.USER_GROUP_TABLE.'
    24842502                (user_id, group_id)
     
    24862504                ('.$id.', '.$conf_UAM[3].')
    24872505;';
    2488                                 pwg_query($query);
     2506      pwg_query($query);
    24892507                }
    24902508
    24912509                if ($conf_UAM[4] <> -1) // Set user's valid status
    24922510                {
    2493                                 $query = '
     2511      $query = '
    24942512UPDATE '.USER_INFOS_TABLE.'
    24952513SET status = "'.$conf_UAM[4].'"
    24962514WHERE user_id = '.$id.'
    24972515;';
    2498                                 pwg_query($query);
     2516      pwg_query($query);
    24992517                }
    25002518
    25012519                if ($conf_UAM[36] <> -1) // Set user's valid privacy level
    25022520                {
    2503                                 $query = '
     2521      $query = '
    25042522UPDATE '.USER_INFOS_TABLE.'
    25052523SET level = "'.$conf_UAM[36].'"
    25062524WHERE user_id = '.$id.'
    25072525;';
    2508                                 pwg_query($query);
     2526      pwg_query($query);
    25092527                }
    25102528
     
    25912609
    25922610  $conf_UAM = unserialize($conf['UserAdvManager']);
    2593  
     2611
    25942612                if (isset($email) and isset($conf_UAM[11]) and !empty($conf_UAM[11]))
    25952613                {
    2596                                 $conf_MailExclusion = preg_split("/[\s,]+/",$conf_UAM[11]);
    2597                                 for ($i = 0 ; $i < count($conf_MailExclusion) ; $i++)
    2598                                 {
    2599                                                 $pattern = '/'.$conf_MailExclusion[$i].'/i';
    2600                                                 if (preg_match($pattern, $email))
    2601       {
    2602                 return true;
    2603       }
    2604                                 }
    2605                 }
    2606   else
    2607   {
    2608     return false;
    2609   }
     2614      $conf_MailExclusion = preg_split("/[\s,]+/",$conf_UAM[11]);
     2615      for ($i = 0 ; $i < count($conf_MailExclusion) ; $i++)
     2616      {
     2617        $pattern = '/'.$conf_MailExclusion[$i].'/i';
     2618        if (preg_match($pattern, $email))
     2619        {
     2620          return true;
     2621        }
     2622      }
     2623    }
     2624    else
     2625    {
     2626      return false;
     2627    }
    26102628}
    26112629
     
    26192637function get_unvalid_user_list()
    26202638{
    2621                 global $conf, $page;
    2622          
    2623                 // Get ConfirmMail configuration
     2639  global $conf, $page;
     2640
     2641  // Get ConfirmMail configuration
    26242642  // -----------------------------
    26252643  $conf_UAM_ConfirmMail = unserialize($conf['UserAdvManager_ConfirmMail']);
     
    26272645  // ---------------------
    26282646  $conf_UAM = unserialize($conf['UserAdvManager']);
    2629  
     2647
    26302648  $users = array();
    26312649
    2632                 // Search users depending expiration date
     2650  // Search users depending expiration date
    26332651  // --------------------------------------
    26342652  $query = '
     
    26522670;';
    26532671
    2654                 $result = pwg_query($query);
    2655      
     2672  $result = pwg_query($query);
     2673
    26562674  while ($row = pwg_db_fetch_assoc($result))
    26572675  {
    2658                 $user = $row;
     2676    $user = $row;
    26592677    $user['groups'] = array();
    26602678
    26612679    array_push($users, $user);
    2662                 }
    2663 
    2664                 // Add groups list
     2680  }
     2681
     2682  // Add groups list
    26652683  // ---------------
    26662684  $user_ids = array();
    26672685  foreach ($users as $i => $user)
    26682686  {
    2669                 $user_ids[$i] = $user['id'];
    2670                 }
     2687    $user_ids[$i] = $user['id'];
     2688  }
    26712689
    26722690                $user_nums = array_flip($user_ids);
     
    26742692  if (count($user_ids) > 0)
    26752693  {
    2676                 $query = '
     2694    $query = '
    26772695SELECT user_id, group_id
    26782696  FROM '.USER_GROUP_TABLE.'
     
    26802698;';
    26812699       
    2682                                 $result = pwg_query($query);
     2700    $result = pwg_query($query);
    26832701       
    26842702    while ($row = pwg_db_fetch_assoc($result))
    26852703    {
    2686                 array_push(
    2687                 $users[$user_nums[$row['user_id']]]['groups'],
     2704      array_push(
     2705        $users[$user_nums[$row['user_id']]]['groups'],
    26882706        $row['group_id']
    2689                                                 );
    2690                                 }
    2691                 }
    2692 
    2693                 return $users;
     2707      );
     2708    }
     2709  }
     2710
     2711  return $users;
    26942712}
    26952713
     
    27042722function get_unvalid_user_autotasks()
    27052723{
    2706                 global $conf, $page;
    2707          
    2708                 // Get ConfirmMail configuration
     2724  global $conf, $page;
     2725
     2726  // Get ConfirmMail configuration
    27092727  // -----------------------------
    27102728  $conf_UAM_ConfirmMail = unserialize($conf['UserAdvManager_ConfirmMail']);
    2711  
     2729
    27122730  $users = array();
    27132731
    2714                 // search users depending expiration date
     2732  // search users depending expiration date
    27152733  // --------------------------------------
    27162734  $query = '
     
    27242742ORDER BY ui.registration_date ASC;';
    27252743
    2726                 $result = pwg_query($query);
     2744  $result = pwg_query($query);
    27272745
    27282746  while ($row = pwg_db_fetch_assoc($result))
    27292747  {
    27302748    array_push($users, $row);
    2731                 }
    2732 
    2733                 return $users;
     2749  }
     2750
     2751  return $users;
    27342752}
    27352753
     
    27432761function get_ghost_user_list()
    27442762{
    2745                 global $conf, $page;
     2763  global $conf, $page;
    27462764
    27472765  $conf_UAM = unserialize($conf['UserAdvManager']);
     
    27492767  $users = array();
    27502768
    2751                 // Search users depending expiration date
     2769  // Search users depending expiration date
    27522770  // --------------------------------------
    27532771  $query = '
     
    27632781ORDER BY lv.lastvisit ASC;';
    27642782
    2765                 $result = pwg_query($query);
     2783  $result = pwg_query($query);
    27662784     
    27672785  while ($row = pwg_db_fetch_assoc($result))
    27682786  {
    2769                 $user = $row;
     2787    $user = $row;
    27702788    $user['groups'] = array();
    27712789
    27722790    array_push($users, $user);
    2773                 }
    2774 
    2775                 // Add groups list
     2791  }
     2792
     2793  // Add groups list
    27762794  // ---------------
    27772795  $user_ids = array();
     
    27792797  {
    27802798        $user_ids[$i] = $user['id'];
    2781                 }
    2782 
    2783                 return $users;
     2799  }
     2800
     2801  return $users;
    27842802}
    27852803
     
    27932811function get_ghosts_autotasks()
    27942812{
    2795                 global $conf, $page;
     2813  global $conf, $page;
    27962814
    27972815  $conf_UAM = unserialize($conf['UserAdvManager']);
    2798  
     2816
    27992817  $users = array();
    28002818 
    2801                 // Search users depending expiration date and reminder sent
     2819  // Search users depending expiration date and reminder sent
    28022820  // --------------------------------------------------------
    28032821  $query = '
     
    28102828ORDER BY lv.lastvisit ASC;';
    28112829
    2812                 $result = pwg_query($query);
     2830  $result = pwg_query($query);
    28132831     
    2814                 while ($row = pwg_db_fetch_assoc($result))
     2832  while ($row = pwg_db_fetch_assoc($result))
    28152833  {
    28162834    array_push($users, $row);
    2817                 }
    2818  
    2819                 return $users;
     2835  }
     2836
     2837  return $users;
    28202838}
    28212839
     
    28292847function get_user_list()
    28302848{
    2831                 global $conf, $page;
    2832  
     2849  global $conf, $page;
     2850
    28332851  $users = array();
    28342852
    2835                 // Search users depending expiration date with exclusion of Adult_Content generic users
     2853  // Search users depending expiration date with exclusion of Adult_Content generic users
    28362854  // ------------------------------------------------------------------------------------
    28372855  $query = '
     
    28492867;';
    28502868
    2851                 $result = pwg_query($query);
     2869  $result = pwg_query($query);
    28522870     
    28532871  while ($row = pwg_db_fetch_assoc($result))
    28542872  {
    2855                 $user = $row;
     2873    $user = $row;
    28562874    $user['groups'] = array();
    28572875
    28582876    array_push($users, $user);
    2859                 }
    2860 
    2861                 // Add groups list
     2877  }
     2878
     2879  // Add groups list
    28622880  // ---------------
    28632881  $user_ids = array();
    28642882  foreach ($users as $i => $user)
    28652883  {
    2866                         $user_ids[$i] = $user['id'];
    2867                 }
    2868 
    2869                 return $users;
     2884    $user_ids[$i] = $user['id'];
     2885  }
     2886
     2887  return $users;
    28702888}
    28712889
     
    28822900{
    28832901        global $conf, $page;
    2884          
    2885                 // Get ConfirmMail configuration
     2902
     2903  // Get ConfirmMail configuration
    28862904  // -----------------------------
    28872905  $conf_UAM_ConfirmMail = unserialize($conf['UserAdvManager_ConfirmMail']);
    28882906         
    2889                 // Get UAM configuration
     2907  // Get UAM configuration
    28902908  // ---------------------
    28912909  $conf_UAM = unserialize($conf['UserAdvManager']);
    2892        
    2893                 $query = '
     2910
     2911  $query = '
    28942912SELECT registration_date
    28952913  FROM '.USER_INFOS_TABLE.'
    28962914WHERE user_id = '.$id.'
    28972915;';
    2898                 list($registration_date) = pwg_db_fetch_row(pwg_query($query));
     2916  list($registration_date) = pwg_db_fetch_row(pwg_query($query));
    28992917
    29002918//              Time limit process             
    29012919// ******************************************** 
    2902                 if (!empty($registration_date))
    2903   {
    2904                                 // Dates formating and compare
    2905                 // ---------------------------
    2906                                 $today = date("d-m-Y"); // Get today's date
    2907                                 list($day, $month, $year) = explode('-', $today); // explode date of today                                               
    2908                         $daytimestamp = mktime(0, 0, 0, $month, $day, $year);// Generate UNIX timestamp
    2909                
    2910                 list($regdate, $regtime) = explode(' ', $registration_date); // Explode date and time from registration date
    2911                                 list($regyear, $regmonth, $regday) = explode('-', $regdate); // Explode date from registration date
    2912                                 $regtimestamp = mktime(0, 0, 0, $regmonth, $regday, $regyear);// Generate UNIX timestamp
    2913                        
    2914                                 $deltasecs = $daytimestamp - $regtimestamp;// Compare the 2 UNIX timestamps     
    2915                                 $deltadays = floor($deltasecs / 86400);// Convert result from seconds to days
    2916 
    2917                                 // Condition with the value set for time limit
     2920  if (!empty($registration_date))
     2921  {
     2922    // Dates formating and compare
     2923    // ---------------------------
     2924    $today = date("d-m-Y"); // Get today's date
     2925    list($day, $month, $year) = explode('-', $today); // explode date of today                                           
     2926    $daytimestamp = mktime(0, 0, 0, $month, $day, $year);// Generate UNIX timestamp
     2927
     2928    list($regdate, $regtime) = explode(' ', $registration_date); // Explode date and time from registration date
     2929    list($regyear, $regmonth, $regday) = explode('-', $regdate); // Explode date from registration date
     2930    $regtimestamp = mktime(0, 0, 0, $regmonth, $regday, $regyear);// Generate UNIX timestamp
     2931
     2932    $deltasecs = $daytimestamp - $regtimestamp;// Compare the 2 UNIX timestamps
     2933    $deltadays = floor($deltasecs / 86400);// Convert result from seconds to days
     2934
     2935    // Condition with the value set for time limit
    29182936    // -------------------------------------------
    2919                                 if ($deltadays <= $conf_UAM_ConfirmMail[1]) // If Nb of days is less than the limit set
    2920                                 {
    2921                                                 return false;
    2922                                 }
    2923                                 else
    2924                                 {
    2925                                                 return true;
    2926                                 }
    2927                 }
     2937    if ($deltadays <= $conf_UAM_ConfirmMail[1]) // If Nb of days is less than the limit set
     2938    {
     2939      return false;
     2940    }
     2941    else
     2942    {
     2943      return true;
     2944    }
     2945  }
    29282946}
    29292947
     
    29672985                                $points = $points + 1;
    29682986
    2969                                 // Adding bonus points for lowercase
     2987      // Adding bonus points for lowercase
    29702988      // ---------------------------------
    29712989                  $point_lowercase = 1;
     
    29762994      // --------------------------------------
    29772995      $points = $points + 2;
    2978                
     2996
    29792997      // Adding bonus points for uppercase
    29802998      // ---------------------------------
     
    29863004      // ------------------------------------
    29873005      $points = $points + 3;
    2988                
     3006
    29893007      // Adding bonus points for numbers
    29903008      // -------------------------------
     
    30413059  $t = array();
    30423060  $v = false;
    3043  
     3061
    30443062  $query = '
    30453063SELECT value
     
    30473065WHERE param = "UserAdvManager_Redir"
    30483066;';
    3049  
     3067
    30503068  if ($v = (($t = pwg_db_fetch_row(pwg_query($query))) !== false))
    30513069  {
     
    30763094
    30773095  $result = pwg_db_fetch_assoc(pwg_query($query));
    3078  
     3096
    30793097  if($result['UAM_pwdreset'] == 'true')
    30803098  {
     
    31543172{
    31553173  global $template;
    3156  
     3174
    31573175  $template->append('plugin_user_list_column_titles', l10n('UAM_PwdReset'));
    3158  
     3176
    31593177  $user_ids = array();
    3160  
     3178
    31613179  foreach ($visible_user_list as $i => $user)
    31623180  {
    31633181    $user_ids[$i] = $user['id'];
    31643182  }
    3165  
     3183
    31663184  $user_nums = array_flip($user_ids);
    31673185
     
    31763194;';
    31773195    $result = pwg_query($query);
    3178    
     3196
    31793197    while ($row = mysql_fetch_array($result))
    31803198    {
     
    31883206      }
    31893207      else $pwdreset = l10n('UAM_PwdReset_NA');
    3190      
     3208
    31913209                  $visible_user_list[$user_nums[$row['id']]]['plugin_columns'][] = $pwdreset; // Shows users password state in user_list
    31923210    }
     
    32633281    $j++;
    32643282  }
    3265  
     3283
    32663284  // Saving UAM configuration
    32673285  // ------------------------
     
    33273345{
    33283346  global $prefixeTable, $dblayer, $conf;
    3329  
     3347
    33303348  define('DEFAULT_PREFIX_TABLE', 'piwigo_');
    3331  
     3349
    33323350  $Backup_File = UAM_PATH.'/include/backup/UAM_dbbackup.sql';
    33333351
     
    34003418      continue;
    34013419    }
    3402    
     3420
    34033421    $query.= ' '.$sql_line;
    3404    
     3422
    34053423    // if we reached the end of query, we execute it and reinitialize the
    34063424    // variable "query"
  • extensions/UserAdvManager/trunk/language/de_DE/help.lang.php

    r14861 r19234  
    11<?php
    2 //global $lang;
    32
    43$lang['UAM_confirmTitle_d'] = '- Informationen E-Mail generation<br>
  • extensions/UserAdvManager/trunk/language/de_DE/plugin.lang.php

    r18466 r19234  
    11<?php
    2 
    3 //global $lang,$conf;
    4 
    5 //$conf_UAM = unserialize($conf['UserAdvManager']);
    6 
    72
    83/* UserManager Tab */
  • extensions/UserAdvManager/trunk/language/en_UK/help.lang.php

    r18158 r19234  
    11<?php
    2 //global $lang;
    32
    43$lang['UAM_carexcTitle_d'] = 'It may be interesting to prohibit certain characters in usernames (example: refuse login names containing @). This option allows to exclude characters or sequence of characters, events.<br>
  • extensions/UserAdvManager/trunk/language/en_UK/plugin.lang.php

    r18431 r19234  
    11<?php
    2 
    3 //global $lang,$conf;
    4 
    5 //$conf_UAM = unserialize($conf['UserAdvManager']);
    6 
    72
    83/* UserManager Tab */
  • extensions/UserAdvManager/trunk/language/es_ES/help.lang.php

    r17800 r19234  
    11<?php
    2 //global $lang;
    32
    43$lang['UAM_confirmTitle_d'] = '
  • extensions/UserAdvManager/trunk/language/es_ES/plugin.lang.php

    r18505 r19234  
    11<?php
    2 
    3 //global $lang,$conf;
    4 
    5 //$conf_UAM = unserialize($conf['UserAdvManager']);
    6 
    72
    83/* UserManager Tab */
  • extensions/UserAdvManager/trunk/language/fr_FR/help.lang.php

    r18158 r19234  
    11<?php
    2 //global $lang;
    32
    43$lang['UAM_carexcTitle_d'] = 'Il peut être intéressant d\'interdire certains caractères dans les noms d\'utilisateurs (exemple : refuser les logins contenant un @). Cette option permet d\'exclure les caractères, ou suite de caractères, indésirables.<br>NB: l\'option permet également d\'exclure des mots complets.
  • extensions/UserAdvManager/trunk/language/fr_FR/plugin.lang.php

    r18431 r19234  
    11<?php
    2 
    3 //global $lang,$conf;
    4 
    5 //$conf_UAM = unserialize($conf['UserAdvManager']);
    6 
    72
    83/* UserManager Tab */
  • extensions/UserAdvManager/trunk/language/hu_HU/plugin.lang.php

    r18206 r19234  
    11<?php
    2 
    3 //global $lang,$conf;
    4 
    5 //$conf_UAM = unserialize($conf['UserAdvManager']);
    6 
    72
    83/* UserManager Tab */
  • extensions/UserAdvManager/trunk/language/it_IT/help.lang.php

    r18898 r19234  
    11<?php
    2 //global $lang;
    32
    43$lang['UAM_confirmTitle_d'] = '
  • extensions/UserAdvManager/trunk/language/it_IT/plugin.lang.php

    r18509 r19234  
    11<?php
    2 
    3 //global $lang,$conf;
    4 
    5 //$conf_UAM = unserialize($conf['UserAdvManager']);
    6 
    72
    83/* UserManager Tab */
  • extensions/UserAdvManager/trunk/language/lv_LV/help.lang.php

    r19051 r19234  
    11<?php
    2 //global $lang;
    32
    43$lang['UAM_confirmTitle_d'] = '- Informācijas e-pasta ģenerēšana<br>
  • extensions/UserAdvManager/trunk/language/lv_LV/plugin.lang.php

    r18538 r19234  
    11<?php
    2 
    3 //global $lang,$conf;
    4 
    5 //$conf_UAM = unserialize($conf['UserAdvManager']);
    6 
    72
    83/* UserManager Tab */
Note: See TracChangeset for help on using the changeset viewer.