Ignore:
Timestamp:
Dec 12, 2010, 7:09:27 PM (13 years ago)
Author:
Eric
Message:

merge from trunk to branch 2.16

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/NBC_UserAdvManager/branches/2.16/include/functions.inc.php

    r8088 r8095  
    369369  }
    370370
    371   // Ghost accounts auto deletion
    372   if ((isset($conf_UAM[22]) and $conf_UAM[22] == 'true') and (isset($conf_UAM[23]) and $conf_UAM[23] == 'true'))
    373   {
    374     if (count($collection) > 0)
    375         {
    376         if (in_array($user['id'], $collection))
    377         {
    378         invalidate_user_cache();
    379        
    380         foreach ($collection as $user_id)
    381         {
    382           delete_user($user_id);
    383         }
    384         logout_user();
    385         redirect(UAM_PATH.'del_account.php');
    386         }
    387       else
    388       {
    389         foreach ($collection as $user_id)
    390         {
    391           delete_user($user_id);
    392         }
    393       }
    394     }
    395   }
    396 
    397371  // Ghost accounts auto group or status downgrade with or without information email sending and autodeletion if user already reminded
    398   if ((isset($conf_UAM[22]) and $conf_UAM[22] == 'true') and (isset($conf_UAM[23]) and $conf_UAM[23] == 'false') and ((isset($conf_UAM[27]) and $conf_UAM[27] <> -1) or (isset($conf_UAM[28]) and $conf_UAM[28] <> -1)))
     372  if ((isset($conf_UAM[22]) and $conf_UAM[22] == 'true') and ((isset($conf_UAM[26]) and $conf_UAM[26] <> -1) or (isset($conf_UAM[27]) and $conf_UAM[27] <> -1)))
    399373  {
    400374    if (count($collection) > 0)
     
    450424
    451425            // Change user status
    452             if ($conf_UAM[28] <> -1)
     426            if ($conf_UAM[27] <> -1)
    453427            {
    454428              $query = "
    455429UPDATE ".USER_INFOS_TABLE."
    456 SET status = '".$conf_UAM[28]."'
     430SET status = '".$conf_UAM[27]."'
    457431WHERE user_id = '".$user_id."'
    458432;";
     
    461435
    462436            // Change user group
    463             if ($conf_UAM[27] <> -1)
     437            if ($conf_UAM[26] <> -1)
    464438            {
    465439              $query = "
     
    467441  (user_id, group_id)
    468442VALUES
    469   ('".$user_id."', '".$conf_UAM[27]."')
     443  ('".$user_id."', '".$conf_UAM[26]."')
    470444;";
    471445              pwg_query($query);
     
    473447         
    474448            // Auto send email notification on group / status downgrade only if never reminded before
    475             if (isset($conf_UAM[24]) and $conf_UAM[24] == 'true')
     449            if (isset($conf_UAM[23]) and $conf_UAM[23] == 'true')
    476450            {
    477451              // Set reminder true
     
    508482          }
    509483        }
    510         // Logged-in user cleanup
    511         invalidate_user_cache();
    512         log_user($user['id'], false);
    513         redirect(make_index_url());
     484
     485        if (!$reminder) // If user never reminded for ghost account
     486        {
     487          // Logged-in user cleanup
     488          invalidate_user_cache();
     489          log_user($user['id'], false);
     490          redirect(make_index_url());
     491        }
     492        elseif ($reminder) // If user already reminded for ghost account
     493        {
     494          // Logged-in user cleanup
     495          invalidate_user_cache();
     496          log_user($user['id'], false);
     497          redirect(UAM_PATH.'del_account.php');
     498        }
    514499        }
    515500      else // Process if an admin or webmaster user is logged
     
    561546
    562547            // Change user status
    563             if ($conf_UAM[28] <> -1)
     548            if ($conf_UAM[27] <> -1)
    564549            {
    565550              $query = "
    566551UPDATE ".USER_INFOS_TABLE."
    567 SET status = '".$conf_UAM[28]."'
     552SET status = '".$conf_UAM[27]."'
    568553WHERE user_id = '".$user_id."'
    569554;";
     
    572557
    573558            // Change user group
    574             if ($conf_UAM[27] <> -1)
     559            if ($conf_UAM[26] <> -1)
    575560            {
    576561              $query = "
     
    578563  (user_id, group_id)
    579564VALUES
    580   ('".$user_id."', '".$conf_UAM[27]."')
     565  ('".$user_id."', '".$conf_UAM[26]."')
    581566;";
    582567              pwg_query($query);
     
    584569
    585570            // Auto send email notification on group / status downgrade
    586             if (isset($conf_UAM[24]) and $conf_UAM[24] == 'true')
     571            if (isset($conf_UAM[23]) and $conf_UAM[23] == 'true')
    587572            {
    588573              // Set reminder true
     
    983968// debugging             
    984969// **********************
    985 //$content = get_user_language_desc($conf_UAM[19])."\n\n"
     970//$content = $infos1.get_absolute_root_url()
    986971//MailLog($email,$subject,$content,$language);
    987972// **********************
     
    994979 * Function called from functions.inc.php to send notification email when user have been downgraded
    995980 *
    996  * @param : user id, username, email address, confirmation
     981 * @param : user id, username, email address
    997982 *
    998983 */
     
    10321017  $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('Demotion of %s', stripslashes($username)));
    10331018     
    1034   if (isset($conf_UAM[26]) and $conf_UAM[26] <> '')
     1019  if (isset($conf_UAM[25]) and $conf_UAM[25] <> '')
    10351020  {
    10361021    if (function_exists('get_user_language_desc'))
    10371022    {
    1038       $custom_txt = get_user_language_desc($conf_UAM[26])."\n\n";
    1039     }
    1040     else $custom_txt = l10n($conf_UAM[26])."\n\n";
     1023      $custom_txt = get_user_language_desc($conf_UAM[25])."\n\n";
     1024    }
     1025    else $custom_txt = l10n($conf_UAM[25])."\n\n";
    10411026  }
    10421027
     
    10661051// debugging             
    10671052// **********************
    1068 //$content = ($infos1."\n\n".$infos2."\n\n").get_absolute_root_url();   
     1053//$content = ($custom_txt.l10n_args($infos1)."\n\n".l10n_args($infos2)."\n\n").get_absolute_root_url();   
     1054//MailLog($email,$subject,$content,$language);
     1055// **********************
     1056
     1057// Switching back to default language
     1058switch_lang_back();
     1059}
     1060
     1061/**
     1062 * Function called from UAM_admin.php to send notification email when user registration have been manually validated by admin
     1063 *
     1064 * @param : user id
     1065 *
     1066 */
     1067function validation_mail($id)
     1068{
     1069  global $conf;
     1070
     1071  $conf_UAM = unserialize($conf['UserAdvManager']);
     1072 
     1073        include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
     1074 
     1075        $custom_txt = "";
     1076
     1077// We have to get the user's language in database
     1078  $query ='
     1079SELECT user_id, language
     1080FROM '.USER_INFOS_TABLE.'
     1081WHERE user_id = '.$id.'
     1082;';
     1083  $data = pwg_db_fetch_assoc(pwg_query($query));
     1084
     1085// Check if user is already registered (profile changing) - If not (new registration), language is set to current gallery language
     1086  if (empty($data))
     1087  {
     1088// And switch gallery to this language before using personalized and multilangual contents
     1089    $language = pwg_get_session_var( 'lang_switch', $user['language'] );
     1090    switch_lang_to($language);
     1091  }
     1092  else
     1093  {
     1094// And switch gallery to this language before using personalized and multilangual contents
     1095    $language = $data['language']; // Usefull for debugging
     1096    switch_lang_to($data['language']);
     1097    load_language('plugin.lang', UAM_PATH);
     1098  }
     1099
     1100// Retreive users email and user name from id
     1101  $query ='
     1102SELECT id, username, mail_address
     1103FROM '.USERS_TABLE.'
     1104WHERE id = '.$id.'
     1105;';
     1106  $result = pwg_db_fetch_assoc(pwg_query($query));
     1107
     1108  $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('Validation of %s', stripslashes($result['username'])));
     1109     
     1110  if (isset($conf_UAM[28]) and $conf_UAM[28] <> '')
     1111  {
     1112    if (function_exists('get_user_language_desc'))
     1113    {
     1114      $custom_txt = get_user_language_desc($conf_UAM[28])."\n\n";
     1115    }
     1116    else $custom_txt = l10n($conf_UAM[28])."\n\n";
     1117  }
     1118
     1119  $infos = array(
     1120    get_l10n_args('User: %s', stripslashes($result['username'])),
     1121    get_l10n_args('Email: %s', $result['mail_address']),
     1122    get_l10n_args('', ''),
     1123  );
     1124
     1125// Sending the email with subject and contents
     1126  pwg_mail($result['mail_address'], array(
     1127    'subject' => $subject,
     1128    'content' => (l10n_args($infos)."\n\n".$custom_txt),
     1129  ));
     1130
     1131// **********************
     1132// Email sending debugger
     1133// This is only to trace
     1134// the send of emails for
     1135// debugging             
     1136// **********************
     1137//$email = $result['mail_address'];
     1138//$content = (l10n_args($infos)."\n\n".$custom_txt);   
    10691139//MailLog($email,$subject,$content,$language);
    10701140// **********************
Note: See TracChangeset for help on using the changeset viewer.