Changeset 4135


Ignore:
Timestamp:
Oct 28, 2009, 3:36:29 PM (14 years ago)
Author:
Eric
Message:

[NBC_UserAdvManager] pre 2.12.0 identified as 2.12.0a :

  • Improving plugin upgrade process
  • Adding new function (Ghost Tracker - Tracking of ghost users) from bug 1194 : Only admin panel and database requests are coded.
  • Language files updated for new Ghost Tracker feature.
Location:
extensions/NBC_UserAdvManager/trunk
Files:
8 edited

Legend:

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

    r4124 r4135  
    3636               l10n('Tab_UserManager'),
    3737               $my_base_url.'&tab=usermanager');
     38$tabsheet->add('ghosttracker',
     39               l10n('Tab_GhostTracker'),
     40               $my_base_url.'&tab=ghosttracker');
    3841$tabsheet->select($page['tab']);
    3942$tabsheet->assign();
     
    5659  case 'global':
    5760       
    58         if (isset($_POST['submit']) and !is_adviser() and isset($_POST['UserAdvManager_Mail_Info']) and isset($_POST['UserAdvManager_No_Casse']) and isset($_POST['UserAdvManager_Username_Char']) and isset($_POST['UserAdvManager_Confirm_Mail']) and isset($_POST['UserAdvManager_No_Comment_Anonymous']) and isset($_POST['UserAdvManager_Password_Enforced']) and isset($_POST['UserAdvManager_AdminPassword_Enforced']))
     61        if (isset($_POST['submit']) and !is_adviser() and isset($_POST['UserAdvManager_Mail_Info']) and isset($_POST['UserAdvManager_No_Casse']) and isset($_POST['UserAdvManager_Username_Char']) and isset($_POST['UserAdvManager_Confirm_Mail']) and isset($_POST['UserAdvManager_No_Comment_Anonymous']) and isset($_POST['UserAdvManager_Password_Enforced']) and isset($_POST['UserAdvManager_AdminPassword_Enforced']) and isset($_POST['UserAdvManager_GhostUser_Tracker']))
    5962  {
    6063                $_POST['UserAdvManager_MailInfo_Text'] = str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UserAdvManager_MailInfo_Text']));
    6164                $_POST['UserAdvManager_ConfirmMail_Text'] = str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UserAdvManager_ConfirmMail_Text']));
    6265               
    63                 $newconf_nbc_UserAdvManager = $_POST['UserAdvManager_Mail_Info'].';'.$_POST['UserAdvManager_No_Casse'].';'.$_POST['UserAdvManager_Confirm_Mail'].';'.(isset($_POST['UserAdvManager_No_Confirm_Group'])?$_POST['UserAdvManager_No_Confirm_Group']:'').';'.(isset($_POST['UserAdvManager_Validated_Group'])?$_POST['UserAdvManager_Validated_Group']:'').';'.(isset($_POST['UserAdvManager_Validated_Status'])?$_POST['UserAdvManager_Validated_Status']:'').';'.$_POST['UserAdvManager_No_Comment_Anonymous'].';'.$_POST['UserAdvManager_Username_Char'].';'.$_POST['UserAdvManager_Username_List'].';'.(isset($_POST['UserAdvManager_No_Confirm_Status'])?$_POST['UserAdvManager_No_Confirm_Status']:'').';'.$_POST['UserAdvManager_MailInfo_Text'].';'.$_POST['UserAdvManager_ConfirmMail_Text'].';'.$_POST['UserAdvManager_MailExclusion'].';'.$_POST['UserAdvManager_MailExclusion_List'].';'.$_POST['UserAdvManager_Password_Enforced'].';'.$_POST['UserAdvManager_Password_Score'].';'.$_POST['UserAdvManager_AdminPassword_Enforced'];
     66                $newconf_nbc_UserAdvManager = $_POST['UserAdvManager_Mail_Info'].';'.$_POST['UserAdvManager_No_Casse'].';'.$_POST['UserAdvManager_Confirm_Mail'].';'.(isset($_POST['UserAdvManager_No_Confirm_Group'])?$_POST['UserAdvManager_No_Confirm_Group']:'').';'.(isset($_POST['UserAdvManager_Validated_Group'])?$_POST['UserAdvManager_Validated_Group']:'').';'.(isset($_POST['UserAdvManager_Validated_Status'])?$_POST['UserAdvManager_Validated_Status']:'').';'.$_POST['UserAdvManager_No_Comment_Anonymous'].';'.$_POST['UserAdvManager_Username_Char'].';'.$_POST['UserAdvManager_Username_List'].';'.(isset($_POST['UserAdvManager_No_Confirm_Status'])?$_POST['UserAdvManager_No_Confirm_Status']:'').';'.$_POST['UserAdvManager_MailInfo_Text'].';'.$_POST['UserAdvManager_ConfirmMail_Text'].';'.$_POST['UserAdvManager_MailExclusion'].';'.$_POST['UserAdvManager_MailExclusion_List'].';'.$_POST['UserAdvManager_Password_Enforced'].';'.$_POST['UserAdvManager_Password_Score'].';'.$_POST['UserAdvManager_AdminPassword_Enforced'].';'.$_POST['UserAdvManager_GhostUser_Tracker'];
    6467               
    6568                $conf['nbc_UserAdvManager'] = $newconf_nbc_UserAdvManager;
     
    204207    'UserAdvManager_ADMINPASSWENF_TRUE'   => $conf_nbc_UserAdvManager[16]=='true' ?  'checked="checked"' : '' ,
    205208                'UserAdvManager_ADMINPASSWENF_FALSE'  => $conf_nbc_UserAdvManager[16]=='false' ?  'checked="checked"' : '' ,
     209    'UserAdvManager_GHOSTRACKER_TRUE'     => $conf_nbc_UserAdvManager[17]=='true' ?  'checked="checked"' : '' ,
     210                'UserAdvManager_GHOSTRACKER_FALSE'    => $conf_nbc_UserAdvManager[17]=='false' ?  'checked="checked"' : '' ,
    206211                'UserAdvManager_PASSWORD_TEST_SCORE'  => $UserAdvManager_Password_Test_Score,
    207212    )
     
    913918                array_push($page['infos'], l10n('Err_UserManager_Settings'));
    914919  }
     920  break;
     921
     922
     923// *************************************************************************
     924// +-----------------------------------------------------------------------+
     925// |                           Ghost Tracker page                          |
     926// +-----------------------------------------------------------------------+
     927// *************************************************************************
     928  case 'ghosttracker':
     929  $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array();
     930       
     931  if (isset($conf_nbc_UserAdvManager[17]) and $conf_nbc_UserAdvManager[17]=='true')
     932  {
     933// +-----------------------------------------------------------------------+
     934// |                           initialization                              |
     935// +-----------------------------------------------------------------------+
     936
     937                if (!defined('PHPWG_ROOT_PATH'))
     938    {
     939        die('Hacking attempt!');
     940    }
     941         
     942    include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
     943
     944// +-----------------------------------------------------------------------+
     945// | Check Access and exit when user status is not ok                      |
     946// +-----------------------------------------------------------------------+
     947                check_status(ACCESS_ADMINISTRATOR);
     948
     949    $page['order_by_items'] = array(
     950      'id' => l10n('registration_date'),
     951      'username' => l10n('Username'),
     952      'level' => l10n('Privacy level'),
     953      'language' => l10n('language'),
     954    );
     955
     956// +-----------------------------------------------------------------------+
     957// |                               user list                               |
     958// +-----------------------------------------------------------------------+
     959
     960                $page['filtered_users'] = get_unvalid_user_list();
     961
     962// +-----------------------------------------------------------------------+
     963// |                            selected users                             |
     964// +-----------------------------------------------------------------------+
     965                if (isset($_POST['Del_Selected']))
     966                {
     967                $collection = array();
     968
     969                        switch ($_POST['target'])
     970        {
     971                case 'all' :
     972        {
     973                foreach($page['filtered_users'] as $local_user)
     974                {
     975                        array_push($collection, $local_user['id']);
     976                }
     977                                        break;
     978                                }
     979        case 'selection' :
     980        {
     981                if (isset($_POST['selection']))
     982                {
     983                        $collection = $_POST['selection'];
     984                }
     985                break;
     986        }
     987                        }
     988
     989                        if (count($collection) == 0)
     990        {
     991                array_push($page['errors'], l10n('Select at least one user'));
     992                }
     993                }
     994
     995// +-----------------------------------------------------------------------+
     996// |                             delete users                              |
     997// +-----------------------------------------------------------------------+
     998                if (isset($_POST['Del_Selected']) and count($collection) > 0)
     999        {
     1000                if (in_array($conf['guest_id'], $collection))
     1001                {
     1002                array_push($page['errors'], l10n('Guest cannot be deleted'));
     1003        }
     1004        if (($conf['guest_id'] != $conf['default_user_id']) and
     1005                in_array($conf['default_user_id'], $collection))
     1006        {
     1007                array_push($page['errors'], l10n('Default user cannot be deleted'));
     1008        }
     1009        if (in_array($conf['webmaster_id'], $collection))
     1010        {
     1011                array_push($page['errors'], l10n('Webmaster cannot be deleted'));
     1012        }
     1013        if (in_array($user['id'], $collection))
     1014        {
     1015                array_push($page['errors'], l10n('You cannot delete your account'));
     1016        }
     1017
     1018                        if (count($page['errors']) == 0)
     1019        {
     1020                foreach ($collection as $user_id)
     1021        {
     1022                delete_user($user_id);
     1023        }
     1024                array_push(
     1025                $page['infos'],
     1026                l10n_dec(
     1027                '%d user deleted', '%d users deleted',
     1028                count($collection)
     1029                )
     1030        );
     1031
     1032        foreach ($page['filtered_users'] as $filter_key => $filter_user)
     1033        {
     1034                if (in_array($filter_user['id'], $collection))
     1035                {
     1036                        unset($page['filtered_users'][$filter_key]);
     1037                }
     1038                }
     1039                        }
     1040                }
     1041
     1042// +-----------------------------------------------------------------------+
     1043// |                 Resend new validation key to users                    |
     1044// +-----------------------------------------------------------------------+
     1045// +-----------------------------------------------------------------------+
     1046// |                            selected users                             |
     1047// +-----------------------------------------------------------------------+
     1048                if (isset($_POST['Mail_With_Key']))
     1049                {
     1050                $collection = array();
     1051
     1052                        switch ($_POST['target'])
     1053        {
     1054                case 'all' :
     1055        {
     1056                foreach($page['filtered_users'] as $local_user)
     1057                {
     1058                        array_push($collection, $local_user['id']);
     1059                }
     1060                break;
     1061                                }
     1062        case 'selection' :
     1063        {
     1064                if (isset($_POST['selection']))
     1065                {
     1066                        $collection = $_POST['selection'];
     1067                }
     1068                break;
     1069        }
     1070                        }
     1071
     1072        if (count($collection) == 0)
     1073        {
     1074                array_push($page['errors'], l10n('Select at least one user'));
     1075        }
     1076                }
     1077// +-----------------------------------------------------------------------+
     1078// |                 Resend new validation key to users                    |
     1079// +-----------------------------------------------------------------------+
     1080                if (isset($_POST['Mail_With_Key']) and count($collection) > 0)
     1081                {
     1082                        if (in_array($conf['guest_id'], $collection))
     1083                {
     1084                array_push($page['errors'], l10n('No_validation_for_Guest'));
     1085        }
     1086        if (($conf['guest_id'] != $conf['default_user_id']) and
     1087                in_array($conf['default_user_id'], $collection))
     1088        {
     1089                array_push($page['errors'], l10n('No_validation_for_default_user'));
     1090        }
     1091                if (in_array($conf['webmaster_id'], $collection))
     1092        {
     1093                array_push($page['errors'], l10n('No_validation_for_Webmaster'));
     1094        }
     1095        if (in_array($user['id'], $collection))
     1096        {
     1097                array_push($page['errors'], l10n('No_validation_for_your_account'));
     1098        }
     1099
     1100        if (count($page['errors']) == 0)
     1101        {
     1102                foreach ($collection as $user_id)
     1103        {       
     1104                $typemail = 1;
     1105                                  $query = "
     1106                                                SELECT id, username, mail_address
     1107                                                FROM ".USERS_TABLE."
     1108                                                WHERE id = '".$user_id."'
     1109                                                ;";
     1110                                        $data = mysql_fetch_array(pwg_query($query));
     1111                               
     1112                ResendMail2User($typemail,$user_id,$data['username'],$data['mail_address'],true);
     1113        }
     1114        array_push(
     1115                $page['infos'],
     1116                l10n_dec(
     1117                        '%d_Mail_With_Key', '%d_Mails_With_Key',
     1118                count($collection)
     1119                )
     1120        );
     1121       
     1122                                $page['filtered_users'] = get_unvalid_user_list();
     1123                        }
     1124                }
     1125
     1126// +-----------------------------------------------------------------------+
     1127// |             Send reminder without new key to users                    |
     1128// +-----------------------------------------------------------------------+
     1129// +-----------------------------------------------------------------------+
     1130// |                            selected users                             |
     1131// +-----------------------------------------------------------------------+
     1132                if (isset($_POST['Mail_Without_Key']))
     1133                {
     1134                $collection = array();
     1135
     1136                        switch ($_POST['target'])
     1137        {
     1138                case 'all' :
     1139        {
     1140                foreach($page['filtered_users'] as $local_user)
     1141                {
     1142                        array_push($collection, $local_user['id']);
     1143                }
     1144                break;
     1145                                }
     1146        case 'selection' :
     1147        {
     1148                if (isset($_POST['selection']))
     1149                {
     1150                        $collection = $_POST['selection'];
     1151                }
     1152                break;
     1153        }
     1154                        }
     1155
     1156        if (count($collection) == 0)
     1157        {
     1158                array_push($page['errors'], l10n('Select at least one user'));
     1159        }
     1160                }
     1161// +-----------------------------------------------------------------------+
     1162// |             Send reminder without new key to users                    |
     1163// +-----------------------------------------------------------------------+
     1164                if (isset($_POST['Mail_Without_Key']) and count($collection) > 0)
     1165                {
     1166                        if (in_array($conf['guest_id'], $collection))
     1167                {
     1168                array_push($page['errors'], l10n('No_validation_for_Guest'));
     1169        }
     1170        if (($conf['guest_id'] != $conf['default_user_id']) and
     1171                in_array($conf['default_user_id'], $collection))
     1172        {
     1173                array_push($page['errors'], l10n('No_validation_for_default_user'));
     1174        }
     1175                if (in_array($conf['webmaster_id'], $collection))
     1176        {
     1177                array_push($page['errors'], l10n('No_validation_for_Webmaster'));
     1178        }
     1179        if (in_array($user['id'], $collection))
     1180        {
     1181                array_push($page['errors'], l10n('No_validation_for_your_account'));
     1182        }
     1183
     1184        if (count($page['errors']) == 0)
     1185        {
     1186                foreach ($collection as $user_id)
     1187        {
     1188                $typemail = 2;
     1189                                  $query = "
     1190                                                SELECT id, username, mail_address
     1191                                                FROM ".USERS_TABLE."
     1192                                                WHERE id = '".$user_id."'
     1193                                        ;";
     1194                                       
     1195                                        $data = mysql_fetch_array(pwg_query($query));
     1196                               
     1197                ResendMail2User($typemail,$user_id,$data['username'],$data['mail_address'],false);                             
     1198        }
     1199        array_push(
     1200                $page['infos'],
     1201                l10n_dec(
     1202                        '%d_Reminder_Sent', '%d_Reminders_Sent',
     1203                count($collection)
     1204                )
     1205        );
     1206       
     1207                                $page['filtered_users'] = get_unvalid_user_list();
     1208                        }
     1209                }
     1210
     1211// +-----------------------------------------------------------------------+
     1212// |                                                                            Force validation                                                         |
     1213// +-----------------------------------------------------------------------+
     1214// +-----------------------------------------------------------------------+
     1215// |                            selected users                             |
     1216// +-----------------------------------------------------------------------+
     1217                if (isset($_POST['Force_Validation']))
     1218                {
     1219                $collection = array();
     1220
     1221                        switch ($_POST['target'])
     1222        {
     1223                case 'all' :
     1224        {
     1225                foreach($page['filtered_users'] as $local_user)
     1226                {
     1227                        array_push($collection, $local_user['id']);
     1228                }
     1229                break;
     1230                                }
     1231        case 'selection' :
     1232        {
     1233                if (isset($_POST['selection']))
     1234                {
     1235                        $collection = $_POST['selection'];
     1236                }
     1237                break;
     1238        }
     1239                        }
     1240
     1241        if (count($collection) == 0)
     1242        {
     1243                array_push($page['errors'], l10n('Select at least one user'));
     1244        }
     1245                }
     1246// +-----------------------------------------------------------------------+
     1247// |                                                                            Force validation                                                         |
     1248// +-----------------------------------------------------------------------+
     1249                if (isset($_POST['Force_Validation']) and count($collection) > 0)
     1250                {
     1251                        if (in_array($conf['guest_id'], $collection))
     1252                {
     1253                array_push($page['errors'], l10n('No_validation_for_Guest'));
     1254        }
     1255        if (($conf['guest_id'] != $conf['default_user_id']) and
     1256                in_array($conf['default_user_id'], $collection))
     1257        {
     1258                array_push($page['errors'], l10n('No_validation_for_default_user'));
     1259        }
     1260                if (in_array($conf['webmaster_id'], $collection))
     1261        {
     1262                array_push($page['errors'], l10n('No_validation_for_Webmaster'));
     1263        }
     1264        if (in_array($user['id'], $collection))
     1265        {
     1266                array_push($page['errors'], l10n('No_validation_for_your_account'));
     1267        }
     1268
     1269        if (count($page['errors']) == 0)
     1270        {
     1271                foreach ($collection as $user_id)
     1272        {
     1273                                  $query = "
     1274                                                SELECT id, username, mail_address
     1275                                                FROM ".USERS_TABLE."
     1276                                                WHERE id = '".$user_id."'
     1277                                        ;";
     1278                                       
     1279                                        $data = mysql_fetch_array(pwg_query($query));
     1280                               
     1281                ForceValidation($data['id']);                           
     1282        }
     1283        array_push(
     1284                $page['infos'],
     1285                l10n_dec(
     1286                        '%d_Validated_User', '%d_Validated_Users',
     1287                count($collection)
     1288                )
     1289        );
     1290
     1291                                $page['filtered_users'] = get_unvalid_user_list();
     1292                        }
     1293                }
     1294               
     1295
     1296// +-----------------------------------------------------------------------+
     1297// |                              groups list                              |
     1298// +-----------------------------------------------------------------------+
     1299
     1300                $groups[-1] = '------------';
     1301
     1302    $query = '
     1303      SELECT id, name
     1304      FROM '.GROUPS_TABLE.'
     1305      ORDER BY name ASC
     1306      ;';
     1307
     1308                $result = pwg_query($query);
     1309         
     1310    while ($row = mysql_fetch_array($result))
     1311    {
     1312      $groups[$row['id']] = $row['name'];
     1313    }
     1314
     1315// +-----------------------------------------------------------------------+
     1316// |                           Template Init                               |
     1317// +-----------------------------------------------------------------------+
     1318                $base_url = PHPWG_ROOT_PATH.'admin.php?page=user_list';
     1319
     1320    if (isset($_GET['start']) and is_numeric($_GET['start']))
     1321    {
     1322      $start = $_GET['start'];
     1323    }
     1324    else
     1325    {
     1326      $start = 0;
     1327    }
     1328
     1329    $template->assign(
     1330      array(
     1331        'F_ADD_ACTION' => $base_url,
     1332        'F_USERNAME' => @htmlentities($_GET['username']),
     1333        'F_FILTER_ACTION' => get_root_url().'admin.php'
     1334        )
     1335          );
     1336
     1337/* Hide radio-button if not allow to assign adviser */
     1338                if ($conf['allow_adviser'])
     1339        {
     1340        $template->assign('adviser', true);
     1341        }
     1342
     1343// +-----------------------------------------------------------------------+
     1344// |                               user list                               |
     1345// +-----------------------------------------------------------------------+
     1346
     1347                $profile_url = get_root_url().'admin.php?page=profile&user_id=';
     1348                $perm_url = get_root_url().'admin.php?page=user_perm&user_id=';
     1349
     1350    $visible_user_list = array();
     1351    foreach ($page['filtered_users'] as $num => $local_user)
     1352    {
     1353/* simulate LIMIT $start, $conf['users_page'] */
     1354                        if ($num < $start)
     1355      {
     1356        continue;
     1357      }
     1358      if ($num >= $start + $conf['users_page'])
     1359      {
     1360        break;
     1361      }
     1362
     1363      $visible_user_list[] = $local_user;
     1364                }
     1365   
     1366                foreach ($visible_user_list as $local_user)
     1367    {
     1368      $groups_string = preg_replace(
     1369        '/(\d+)/e',
     1370        "\$groups['$1']",
     1371        implode(
     1372                ', ',
     1373            $local_user['groups']
     1374         )
     1375                        );
     1376
     1377                if (isset($_POST['pref_submit'])
     1378                and isset($_POST['selection'])
     1379        and in_array($local_user['id'], $_POST['selection']))
     1380                {
     1381                                $checked = 'checked="checked"';
     1382                }
     1383                        else
     1384        {
     1385                $checked = '';
     1386        }
     1387
     1388        $properties = array();
     1389        if ( $local_user['level'] != 0 )
     1390                        {
     1391                $properties[] = l10n( sprintf('Level %d', $local_user['level']) );
     1392                        }
     1393        $properties[] =
     1394                (isset($local_user['enabled_high']) and ($local_user['enabled_high'] == 'true'))
     1395                ? l10n('is_high_enabled') : l10n('is_high_disabled');
     1396
     1397                        $expiration = expiration($local_user['id']);
     1398             
     1399                $template->append(
     1400                'users',
     1401        array(
     1402                'ID' => $local_user['id'],
     1403                'CHECKED' => $checked,
     1404                'U_PROFILE' => $profile_url.$local_user['id'],
     1405                'U_PERM' => $perm_url.$local_user['id'],
     1406                'USERNAME' => $local_user['username']
     1407                                                .($local_user['id'] == $conf['guest_id']
     1408                                                ? '<BR />['.l10n('is_the_guest').']' : '')
     1409                .($local_user['id'] == $conf['default_user_id']
     1410                ? '<BR />['.l10n('is_the_default').']' : ''),
     1411                                        'STATUS' => l10n('user_status_'.
     1412                                                $local_user['status']).(($local_user['adviser'] == 'true')
     1413                ? '<BR />['.l10n('adviser').']' : ''),
     1414                                        'EMAIL' => get_email_address_as_display_text($local_user['email']),
     1415                'GROUPS' => $groups_string,
     1416                'REGISTRATION' => $local_user['registration_date'],
     1417                'EXPIRATION' => $expiration,
     1418                                )
     1419                        );
     1420                }
     1421
     1422// +-----------------------------------------------------------------------+
     1423// |                             errors display                            |
     1424// +-----------------------------------------------------------------------+
     1425                if ( isset ($errors) and count($errors) != 0)
     1426                {
     1427                $template->assign('errors',array());
     1428                        foreach ($errors as $error)
     1429                {
     1430                                array_push($page['errors'], $error);
     1431                }
     1432                } 
     1433
     1434// +-----------------------------------------------------------------------+
     1435// |                           templates display                           |
     1436// +-----------------------------------------------------------------------+
     1437                $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/ghosttracker.tpl');
     1438    $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
     1439  }
     1440  else
     1441  {
     1442                array_push($page['infos'], l10n('Err_GhostTracker_Settings'));
     1443  }
    9151444  break;
    9161445}
  • extensions/NBC_UserAdvManager/trunk/admin/global.tpl

    r4124 r4135  
    4747        <textarea name="UserAdvManager_MailExclusion_List" id="UserAdvManager_MailExclusion_List" rows="3" cols="80" {$TAG_INPUT_ENABLED}>{$UserAdvManager_MAILEXCLUSION_LIST}</textarea><br><br>
    4848        </li>
     49
     50        <li><label>{'UserAdvManager_GhostTracker'|@translate}</label><br>
     51        <input type="radio" value="true" {$UserAdvManager_GHOSTRACKER_TRUE} name="UserAdvManager_GhostUser_Tracker">{'UserAdvManager_GhostTracker_true'|@translate}<br>
     52        <input type="radio" value="false" {$UserAdvManager_GHOSTRACKER_FALSE} name="UserAdvManager_GhostUser_Tracker">{'UserAdvManager_GhostTracker_false'|@translate}<br><br>
     53        </li>
     54
    4955    </ul>
    5056   
  • extensions/NBC_UserAdvManager/trunk/include/constants.php

    r3742 r4135  
    22global $prefixeTable;
    33define('USER_CONFIRM_MAIL_TABLE', $prefixeTable.'user_confirm_mail');
     4define('USER_LASTVISIT_TABLE', $prefixeTable.'user_lastvisit_check');
    45?>
  • extensions/NBC_UserAdvManager/trunk/include/functions_UserAdvManager.inc.php

    r4124 r4135  
    738738 * Returns a password's score for password complexity check
    739739 *
    740  * @param password entered
     740 * @param password filled by user
    741741 *
    742742 * Thanx to MathieuGut from http://m-gut.developpez.com
     
    810810  return $finalscore;
    811811}
     812
     813/* Function called from maintain.inc.php - to determine if database upgrade is needed */
     814function table_exist($table)
     815{
     816  $query = 'DESC '.$table.';';
     817  return (bool)($res=mysql_query($query));
     818}
    812819?>
  • extensions/NBC_UserAdvManager/trunk/language/en_UK/plugin.lang.php

    r4124 r4135  
    99$lang['Title_Tab1'] = 'UserAdvManager - Global Configuration';
    1010$lang['Tab_Global'] = 'Global Configuration';
    11 $lang['UserAdvManager_Title'] = 'Advanced users settings';
     11$lang['UserAdvManager_Title1'] = 'Users registration management';
     12$lang['UserAdvManager_Title2'] = 'Registration validation and groups / status management';
    1213$lang['UserAdvManager_Mail_Info'] = ' Mail information user';
    1314$lang['UserAdvManager_Mail_Info_true'] = ' Send an information mail to the user when he registes or updates his profile.';
    14 $lang['UserAdvManager_Mail_Info_false'] = ' Turns off the sending of mail.';
     15$lang['UserAdvManager_Mail_Info_false'] = ' Turns off the sending of mail. (default)';
    1516$lang['UserAdvManager_MailInfo_Text'] = ' Text used to introduce the email sent to user to allow him to validate his email address<br><b style="color: red;">(!!! </b><b style="text-decoration: underline; color: red;">WARNING !</b> <b style="color: red;">Use the multi language tags from Extended Description plugin if this plugin is activated !!!)</b>';
    1617$lang['UserAdvManager_No_Casse'] = ' User insensitive';
    1718$lang['UserAdvManager_No_Casse_true'] = ' Make the user account insensitive at the registration and the identification step';
    18 $lang['UserAdvManager_No_Casse_false'] = ' Let the user-sensitive.';
     19$lang['UserAdvManager_No_Casse_false'] = ' Let the user-sensitive. (default)';
    1920$lang['UserAdvManager_Username_Char'] = ' Limited charset for unsername';
    2021$lang['UserAdvManager_Username_Char_true'] = ' The following characters will be forbidden for username choice';
    21 $lang['UserAdvManager_Username_Char_false'] = ' Use the default username charset control.';
     22$lang['UserAdvManager_Username_Char_false'] = ' Use the default username charset control. (default)';
     23$lang['UserAdvManager_Password_Enforced'] = 'Strengthening passwords - Enabling this option makes the seizure of the password required for visitors registration. Also, the password entered by the visitor will meet with a score of complexity.';
     24$lang['UserAdvManager_Password_Enforced_Info'] = '<b style="text-decoration: underline; color: green;">Explanations:</b> <b style="color: green;">A password score is calculated on the basic parameters: length, type of characters used (letters, digits, uppercase, lowercase, special characters). If the password of the user does not score, the score reached is displayed with the minimal score to reach and an indication to increase the value of this score. To give you an idea, a score below 100 is considered "low complexity". Between 100 and 500, the complexity is increased and average. Beyond 500, that\'s Fort Knox! ;-)<br>You can do your passwords complexity tests by using the field below. This will allow you to get an idea of the score to define a custom complexity.</b>';
     25$lang['UserAdvManager_PasswordTest'] = 'Passowrd to test : ';
     26$lang['UserAdvManager_ScoreTest'] = 'Score : ';
     27$lang['PasswordTest'] = 'Score calculation';
     28$lang['UserAdvManager_Password_Enforced_true'] = ' Strong password required - Enter the minimum score (floor value) of passwords complexity == ';
     29$lang['UserAdvManager_Password_Enforced_false'] = ' Do not strengthen passwords. (default)';
     30$lang['UserAdvManager_AdminPassword_Enforced'] = 'Apply also the passwords complexity control when an administrator create a user? Note: If the created user wishes to change his password and strengthening passwords for users is active, he will be subject to the rules set.';
     31$lang['UserAdvManager_AdminPassword_Enforced_true'] = 'Enable strengthening passwords for admins.';
     32$lang['UserAdvManager_AdminPassword_Enforced_false'] = 'Disable strengthening passwords for admins. (default)';
    2233$lang['UserAdvManager_Confirm_Mail'] = 'Email address confirmation';
    2334$lang['UserAdvManager_Confirm_Mail_true'] = ' Send an email to user to allow him to validate his email and his registration.';
    24 $lang['UserAdvManager_Confirm_Mail_false'] = ' Use the default Piwigo registration system (without registration validation).';
     35$lang['UserAdvManager_Confirm_Mail_false'] = ' Use the default Piwigo registration system (without registration validation). (default)';
    2536$lang['UserAdvManager_ConfirmMail_Text'] = ' Text used to introduce the email sent to user to allow him to validate his email address<br><b style="color: red;">(!!! </b><b style="text-decoration: underline; color: red;">WARNING !</b> <b style="color: red;">Use the multi language tags from Extended Description plugin if this plugin is activated !!!)</b>';
    2637$lang['UserAdvManager_Confirm_Group_Notice'] = 'WARNING : Using validation groups requires that you have created at least one user group and is defined "by default" in Piwigo\'s user groups management.';
     
    3243$lang['UserAdvManager_No_Comment_Anonymous'] = 'Nickname are mandatory for comments';
    3344$lang['UserAdvManager_No_Comment_Anonymous_true'] = ' The author field have to be filled to send a comment.';
    34 $lang['UserAdvManager_No_Comment_Anonymous_false'] = ' Use the default Piwigo settings on comments sending.';
     45$lang['UserAdvManager_No_Comment_Anonymous_false'] = ' Use the default Piwigo settings on comments sending. (default)';
    3546$lang['UserAdvManager_MailExclusion'] = 'Email provider exclusion';
    3647$lang['UserAdvManager_MailExclusion_true'] = ' Set the email provider exclusion ON (i.e. : @hotmail.* or @msn.*)';
    37 $lang['UserAdvManager_MailExclusion_false'] = ' Set the email provider exclusion OFF.';
     48$lang['UserAdvManager_MailExclusion_false'] = ' Set the email provider exclusion OFF. (default)';
    3849$lang['UserAdvManager_MailExclusion_List'] = ' If email provider exclusion is set to ON, fill the email domains to exclude below. You have to use the following format :<br>@[domaine_name].[domaine_extension] - Example : @hotmail.com<br>Seperate the different domains with a comma (,)<br>';
    39 $lang['audit'] = 'Audit';
    40 $lang['submit'] = 'Submit';
     50$lang['UserAdvManager_GhostTracker'] = 'Ghost Tracker - Allows to manage registered users according their last visit date (see the "Ghost Tracker" tab) :';
     51$lang['UserAdvManager_GhostTracker_true'] = ' Enable Ghost Tracker.';
     52$lang['UserAdvManager_GhostTracker_false'] = ' Disable Ghost Tracker. (Default)';
     53$lang['audit'] = 'Audit parameters';
     54$lang['submit'] = 'Save parameters';
    4155
    4256
     
    4761$lang['UserAdvManager_ConfirmMail_Info'] = 'Time limitation for validation of registration :<br>If you enable this option, select the desired time (x) )in the field below. Visitors who register will then have x days to validate their registration. After this period the validation link they have received by mail will be expired.<br>';
    4862$lang['UserAdvManager_ConfirmMail_TimeOut_true'] = 'Enable limiting the registration deadline.';
    49 $lang['UserAdvManager_ConfirmMail_TimeOut_false'] = 'Disable limiting the registration deadline.';
     63$lang['UserAdvManager_ConfirmMail_TimeOut_false'] = 'Disable limiting the registration deadline. (Default)';
    5064$lang['UserAdvManager_ConfirmMail_TimeOut'] = 'Validation delay :';
    5165$lang['UserAdvManager_ConfirmMail_Delay_Info'] = 'Enter the number of days before expiry of the registration validation : ';
    52 /* This function can't work due to no access to server's cron functionnalities */
    53 //$lang['UserAdvManager_ConfirmMail_AutoDel'] = 'Suppression automatique des comptes non validés après le délai d\'expiration : ';
    54 //$lang['UserAdvManager_ConfirmMail_AutoDel_true'] = 'Activer la suppression automatique - <b style="text-decoration: blink underline;">ATTENTION !</b> La suppression est aveugle et sans notification.';
    55 //$lang['UserAdvManager_ConfirmMail_AutoDel_false'] = 'Désactiver la suppression automatique.';
    5666$lang['UserAdvManager_ConfirmMail_Remail'] = 'Enable or disable email reminder of unvalidated registers :';
    5767$lang['UserAdvManager_ConfirmMail_Remail_true'] = 'Enable email reminder';
    58 $lang['UserAdvManager_ConfirmMail_Remail_false'] = 'Disable email reminder';
     68$lang['UserAdvManager_ConfirmMail_Remail_false'] = 'Disable email reminder. (Default)';
    5969$lang['UserAdvManager_ConfirmMail_ReMail_Txt1'] = 'Custom content of the recall message with regeneration of validation key.<br>If left blank, the recall mail will include only the validation link. It is therefore strongly advised to take a little explanatory text. (NB: The text pre-filled with the installation of the plugin is given as an example)<br><br><b style="color: red;">(!!! </b><b style="text-decoration: underline; color: red;">WARNING !</b> <b style="color: red;">Text modification is available ONLY if email reminder is enabled. Use the multi language tags from Extended Description plugin if this plugin is activated !!!)</b>';
    6070$lang['UserAdvManager_ConfirmMail_ReMail_Txt2'] = 'Custom content of the recall message without regeneration of validation key.<br>If left blank, the recall mail will include only the validation link. It is therefore strongly advised to take a little explanatory text. (NB: The text pre-filled with the installation of the plugin is given as an example)<br><br><b style="color: red;">(!!! </b><b style="text-decoration: underline; color: red;">WARNING !</b> <b style="color: red;">Text modification is available ONLY if email reminder is enabled. Use the multi language tags from Extended Description plugin if this plugin is activated !!!)</b>';
     
    103113$lang['Err_audit_advise'] = '<b>you have to perform corrections to comply with new rules that you have activated.<br>Use a database management utility to correct user accounts directly in the table ### _USERS';
    104114$lang['UserAdvManager_Empty Author'] = 'The author field have to be filled to send a comment.';
     115$lang['reg_err_login3'] = 'Security : Password is mandatory !';
     116$lang['reg_err_login4_%s'] = 'Security : A control system calculates a score on the chosen passwords complexity. The complexity of your password is too low (score = %s). Please, choose a new password more secure by following these rules:<br>
     117- Use letters and numbers<br>
     118- Use lowercase and uppercase<br>
     119- Increase its length (number of characters)<br>
     120The minimum passwords score required by the administrator is: ';
    105121if ( isset($conf_UserAdvManager[1]) and $conf_UserAdvManager[1] == 'true' )
    106122        $lang['reg_err_login5'] = 'Username already exist, WARNING name is case insensitive (Shift = Tiny).';
     
    112128$lang['Err_ConfirmMail_Settings'] = 'This page will be available only if "Email address confirmation" is activated in tab "Global Configuration".';
    113129$lang['Err_UserManager_Settings'] = 'This page is available only if "Enable limiting the registration deadline" is active in the "ConfirmMail Settings" tab and an unvalidated users group is set in "Global Configuration" tab.';
     130$lang['Err_GhostTracker_Settings'] = 'This page is available only if "Ghost Tracker" is active in the "Global Configuration" tab.';
    114131$lang['No_validation_for_Guest'] = 'The "Guest" account is not subject to validation';
    115132$lang['No_validation_for_default_user'] = 'The default account is not subject to validation';
  • extensions/NBC_UserAdvManager/trunk/language/fr_FR/plugin.lang.php

    r4124 r4135  
    2121$lang['UserAdvManager_Username_Char_true'] = ' Interdire les caractères saisis dans le champs ci-après pour le nom d\'utilisateur lors de l\'inscription == ';
    2222$lang['UserAdvManager_Username_Char_false'] = ' Laisser le contrôle par défaut du nom d\'utilisateur. (valeur par défaut)';
    23 $lang['UserAdvManager_Password_Enforced'] = 'Renforcement des mots de passe - Activer cette option rend la saisie du mot de passe obligatoire à l\'inscription des visiteurs. De plus, le mot de passe saisi par le visiteur devra répondre à un score de fiabilité.';
    24 $lang['UserAdvManager_Password_Enforced_Info'] = '<b style="text-decoration: underline; color: green;">Explications :</b> <b style="color: green;">Le score d\'un mot de passe est calculé en fonction des paramètres de base : longueur, types de caractères utilisés(lettres, chiffres, majuscules, minuscules, caractères spéciaux). Si le mot de passe de l\'utilisateur ne répond pas au score, le score réalisé est affiché ainsi que le score planchet et une indication pour augmenter la valeur de ce score. Pour donner un ordre d\'idée, un score inférieur à 100 est considéré comme faible. Entre 100 et 500, la fiabilité est renforcée. Au dela de 500, c\'est Fort Knox !! ;-)<br>Vous pouvez tester la fiabilité d\'un mot de passe en utilisant les champs ci-dessous (pour test uniquement !)</b>';
     23$lang['UserAdvManager_Password_Enforced'] = 'Renforcement des mots de passe - Activer cette option rend la saisie du mot de passe obligatoire à l\'inscription des visiteurs. De plus, le mot de passe saisi par le visiteur devra répondre à un score de complexité.';
     24$lang['UserAdvManager_Password_Enforced_Info'] = '<b style="text-decoration: underline; color: green;">Explications :</b> <b style="color: green;">Le score d\'un mot de passe est calculé en fonction des paramètres de base : longueur, types de caractères utilisés(lettres, chiffres, majuscules, minuscules, caractères spéciaux). Si le mot de passe de l\'utilisateur ne répond pas au score, le score réalisé est affiché ainsi que le score minimum à atteindre et une indication pour augmenter la valeur de ce score. Pour donner un ordre d\'idée, un score inférieur à 100 est considéré comme faible. Entre 100 et 500, la complexité est renforcée et dans la moyenne. Au dela de 500, c\'est Fort Knox !! ;-)<br>Vous pouvez faire vos essais de complexité d\'un mot de passe en utilisant le champ ci-dessous. Cela vous permettra de vous faire une idée du score à définir pour une complexité personnalisée.</b>';
    2525$lang['UserAdvManager_PasswordTest'] = 'Mot de passe à tester : ';
    2626$lang['UserAdvManager_ScoreTest'] = 'Score obtenu : ';
    2727$lang['PasswordTest'] = 'Calcul du score';
    28 $lang['UserAdvManager_Password_Enforced_true'] = ' Mot de passe renforcé obligatoire - Saisir le score minimum (valeur planchet) de fiabilité du mots de passe == ';
     28$lang['UserAdvManager_Password_Enforced_true'] = ' Mot de passe renforcé obligatoire - Saisir le score minimum (valeur plancher) de complexité du mots de passe == ';
    2929$lang['UserAdvManager_Password_Enforced_false'] = ' Ne pas renforcer les mots de passe. (valeur par défaut)';
    3030$lang['UserAdvManager_AdminPassword_Enforced'] = 'Appliquer également le contrôle du renforcement de mots de passe lorsqu\'un administrateur créé un utilisateur? A noter : Si l\'utilisateur ainsi créé désire changer de mot de passe et que le renforcement des mots de passe pour les utilisateurs est actif, il sera soumis à la règle configurée.';
     
    4848$lang['UserAdvManager_MailExclusion_false'] = ' Désactiver l\'exclusion des domaines de messagerie. (valeur par défaut)';
    4949$lang['UserAdvManager_MailExclusion_List'] = ' Si l\'exclusion de domaines de messagerie est activée, saisissez les domaines à exclure ici. Il faut respecter le format suivant :<br>@[nom_du_domaine].[extension_du_domaine] - Exemple : @hotmail.com<br><br>Séparez les domaines par une virgule<br>';
     50$lang['UserAdvManager_GhostTracker'] = 'Gestion des visiteurs fantômes - Permet de gérer les inscrits en fonction de leur date de dernière visite (voir onglet "Ghost Tracker") :';
     51$lang['UserAdvManager_GhostTracker_true'] = ' Activer la gestion des visiteurs fantômes.';
     52$lang['UserAdvManager_GhostTracker_false'] = ' Désactiver la gestion des visiteurs fantômes. (valeur par défaut)';
    5053$lang['audit'] = 'Auditer les paramètres';
    5154$lang['submit'] = 'Sauvegarder les paramètres';
     
    6164$lang['UserAdvManager_ConfirmMail_TimeOut'] = 'Délai d\activation :';
    6265$lang['UserAdvManager_ConfirmMail_Delay_Info'] = 'Saisissez ici le nombre de jours avant expiration de la validation d\'inscription : ';
    63 /* This function can't work due to no access to server's cron functionnalities */
    64 //$lang['UserAdvManager_ConfirmMail_AutoDel'] = 'Suppression automatique des comptes non validés après le délai d\'expiration : ';
    65 //$lang['UserAdvManager_ConfirmMail_AutoDel_true'] = 'Activer la suppression automatique - <b style="text-decoration: blink underline;">ATTENTION !</b> La suppression est aveugle et sans notification.';
    66 //$lang['UserAdvManager_ConfirmMail_AutoDel_false'] = 'Désactiver la suppression automatique.';
    6766$lang['UserAdvManager_ConfirmMail_Remail'] = 'Activer ou désactiver la fonctionnalité de rappel des inscrits non validés :<br>';
    6867$lang['UserAdvManager_ConfirmMail_Remail_true'] = 'Activer le rappel par mail.';
     
    7675$lang['Title_Tab3'] = 'UserAdvManager - Gestion des visiteurs';
    7776$lang['Tab_UserManager'] = 'Gestion des visiteurs';
     77$lang['UserAdvManager_ConfirmMail_User_List'] = 'Lorsque la limitation du délai d\'inscription est activée, vous trouverez ci-dessous la liste des utilisateurs en attente de validation d\'inscription <b style="text-decoration: underline;">qu\'ils soient ou pas</b> dans les délais pour la valider.<br><br>Dans cette vue, vous pouvez :
     78<br><br>
     79- Supprimer manuellement les comptes <b>(purge manuelle)</b>
     80<br>
     81- Générer l\'email de rappel <b>sans génération</b> d\'une nouvelle clef. Rappel : Cette fonction ne réinitialise pas la date d\'inscription du visiteur ciblé et le délai d\'expiration est toujours d\'actualité.
     82<br>
     83- Générer l\'email de rappel <b>avec génération</b> d\'une nouvelle clef. Rappel : Cette fonction réinitialise également la date d\'inscription du visiteur ciblé ce qui équivaut à prolonger le délai de validation.<br>
     84- Valider manuellement une inscription en attente de validation même si la date d\'expiration est révolue <b>(forçage de la validation)</b>.
     85<br>';
     86$lang['Registration_Date'] = 'Date d\'enregistrement';
     87
     88
     89/* UserManager Tab */
     90$lang['UserManager_Title'] = 'Gestion avancée des visiteurs fantômes';
     91$lang['Title_Tab3'] = 'UserAdvManager - Ghost Tracker';
     92$lang['Tab_GhostTracker'] = 'Ghost Tracker';
    7893$lang['UserAdvManager_ConfirmMail_User_List'] = 'Lorsque la limitation du délai d\'inscription est activée, vous trouverez ci-dessous la liste des utilisateurs en attente de validation d\'inscription <b style="text-decoration: underline;">qu\'ils soient ou pas</b> dans les délais pour la valider.<br><br>Dans cette vue, vous pouvez :
    7994<br><br>
     
    129144$lang['Err_ConfirmMail_Settings'] = 'Cette page n\'est accessible que si "Confirmation de l\'adresse email" est actif dans l\'onglet "Configuration Générale".';
    130145$lang['Err_UserManager_Settings'] = 'Cette page n\'est accessible que si "Délai de validation d\'inscription" est actif dans l\'onglet "Configuration de ConfirmMail" et si un groupe de visiteurs non validés est configuré dans l\'onglet "Configuration Générale".';
     146$lang['Err_GhostTracker_Settings'] = 'Cette page n\'est accessible que si "Gestion des visiteurs fantômes" est actif dans l\'onglet "Configuration Générale".';
    131147$lang['No_validation_for_Guest'] = 'Le compte Guest n\'est pas soumis à validation';
    132148$lang['No_validation_for_default_user'] = 'Le compte par défaut n\'est pas soumis à validation';
  • extensions/NBC_UserAdvManager/trunk/main.inc.php

    r4124 r4135  
    22/*
    33Plugin Name: NBC UserAdvManager
    4 Version: 2.11.5
     4Version: 2.12.0a
    55Description: Permet de renforcer les possibilités de gestion des utilisateurs - Enforce users management
    66Plugin URI: http://fr.piwigo.org/ext/extension_view.php?eid=216
     
    6060
    6161-- 2.11.3 : On Patricia's request (french forum and bug 1173), the unvalidated users management tab shows users according with the settings of unvalidated group and / or unvalidated status.
    62                                                 Feature 1172 : Email providers exclusion list can be set with CR/LF between each entry. The comma seperator (,) is still mandatory.
     62                                                Feature 1172 added : Email providers exclusion list can be set with CR/LF between each entry. The comma seperator (,) is still mandatory.
    6363                                                Bug 1175 fixed : Bad translation tag in french language file.
    6464                                                Improvement of unvalidated users management tab (feature 1174)- Expired users are displayed in red color text.
     
    7171
    7272-- pre 2.12.0 : Bug 1206 fixed : All plugin functionnalities work in user's profile page
    73             Plugin's core code and admin panel refactoring
    74             Password control and enforcement : A complexity score is computed on user registration. If this score is less than the goal set by admin, the password choosen is rejected.
     73                Plugin's core code and admin panel refactoring
     74                Password control and enforcement : A complexity score is computed on user registration. If this score is less than the goal set by admin, the password choosen is rejected.
     75                Feature 1194 "Ghost Tracker" added : New plugin tab displays users who don't comes back to the gallery since x days. Ability to send email reminders and to delete reminded but "dead" users. It's the reason why this feature is called "Ghost Tracker".
    7576*/
    7677
     
    7980 ***** TODO List *****
    8081
    81 ++ No validation needed for admins users comments (new trigger needed in comments.php)
    82 
    83 ++ No single email check for admins (new trigger needed in (functions_user.inc.php ?))
     82++ No validation needed for admins users comments (new trigger needed in comments.php ?)
     83
     84++ No single email check for admins (new trigger needed in functions_user.inc.php ?)
    8485
    8586++ Password control and enforcement
     
    357358}
    358359
     360
    359361add_event_handler('user_comment_check', 'UserAdvManager_CheckEmptyCommentAuthor', 50, 2);
    360362
  • extensions/NBC_UserAdvManager/trunk/maintain.inc.php

    r4124 r4135  
    55
    66include_once (NBC_UserAdvManager_PATH.'include/constants.php');
     7include_once (NBC_UserAdvManager_PATH.'include/functions_UserAdvManager.inc.php');
    78
    89function plugin_install()
     
    1213  $q = '
    1314    INSERT INTO '.CONFIG_TABLE.' (param, value, comment)
    14     VALUES ("nbc_UserAdvManager","true;false;false;-1;-1;-1;false;false;;-1;;;false;;false;100;false","Parametres du plugin nbc UserAdvManager")
     15    VALUES ("nbc_UserAdvManager","true;false;false;-1;-1;-1;false;false;;-1;;;false;;false;100;false,false","Parametres du plugin nbc UserAdvManager")
    1516  ;';
    1617  pwg_query($q);
     
    3738      status enum('webmaster','admin','normal','generic','guest') default NULL,
    3839      date_check datetime default NULL,
     40      lastvisit DATETIME NULL DEFAULT NULL,
     41      reminder ENUM('true','false') NULL DEFAULT NULL
    3942      PRIMARY KEY  (id)
     43    )
     44  ;";
     45  pwg_query($q);
     46
     47        $q = "
     48    CREATE TABLE IF NOT EXISTS ".USER_LASTVISIT_TABLE." (
     49      user_id SMALLINT(5) NOT NULL DEFAULT '0',
     50      lastvisit DATETIME NULL DEFAULT NULL,
     51      reminder ENUM('true','false') NULL,
     52      PRIMARY KEY (`user_id`)
    4053    )
    4154  ;";
     
    4760          global $conf;
    4861       
    49 /* Check for upgrade */
     62/* Check for upgrade from 2.10 */
    5063          $query = '
    5164    SELECT *
    52                 FROM '.CONFIG_TABLE.'
     65                  FROM '.CONFIG_TABLE.'
    5366    WHERE param = "nbc_UserAdvManager_ConfirmMail"
    5467  ;';
     
    6073                upgrade_210();
    6174        }
     75
     76/* Check for upgrade from 2.11 */
     77  if (!table_exist(USER_LASTVISIT_TABLE))
     78  {
     79    /* upgrade from branch 2.11 */
     80                upgrade_211();
     81  }
    6282}
     83
    6384
    6485function plugin_uninstall()
     
    88109  $q = 'DROP TABLE '.USER_CONFIRM_MAIL_TABLE.';';
    89110  pwg_query( $q );
     111
     112  $q = 'DROP TABLE '.USER_LASTVISIT_TABLE.';';
     113  pwg_query( $q );
    90114}
    91115
     116/* upgrade from branch 2.10 */
    92117function upgrade_210()
    93118{
     
    107132  ;';
    108133  pwg_query($q);
     134
     135upgrade_211();
     136}
     137
     138/* upgrade from branch 2.11 */
     139function upgrade_211()
     140{
     141        global $conf;
     142
     143  $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array();
     144
     145  if ((!isset($conf_nbc_UserAdvManager[14]) and !isset($conf_nbc_UserAdvManager[15])) and !isset($conf_nbc_UserAdvManager[16]) and !isset($conf_nbc_UserAdvManager[17]))
     146  {
     147    $upgrade_nbc_UserAdvManager = $conf_nbc_UserAdvManager[0].';'.$conf_nbc_UserAdvManager[1].';'.$conf_nbc_UserAdvManager[2].';'.$conf_nbc_UserAdvManager[3].';'.$conf_nbc_UserAdvManager[4].';'.$conf_nbc_UserAdvManager[5].';'.$conf_nbc_UserAdvManager[6].';'.$conf_nbc_UserAdvManager[7].';'.$conf_nbc_UserAdvManager[8].';'.$conf_nbc_UserAdvManager[9].';'.$conf_nbc_UserAdvManager[10].';'.$conf_nbc_UserAdvManager[11].';'.$conf_nbc_UserAdvManager[12].';'.$conf_nbc_UserAdvManager[13].';false;100;false;false';
     148               
     149                $query = '
     150                UPDATE '.CONFIG_TABLE.'
     151                SET value="'.$upgrade_nbc_UserAdvManager.'"
     152                WHERE param="nbc_UserAdvManager"
     153                LIMIT 1
     154                ;';
     155               
     156                pwg_query($query);
     157  }
     158 
     159        $q = "
     160    CREATE TABLE IF NOT EXISTS ".USER_LASTVISIT_TABLE." (
     161      user_id SMALLINT(5) NOT NULL DEFAULT '0',
     162      lastvisit DATETIME NULL DEFAULT NULL,
     163      reminder ENUM('true','false') NULL,
     164      PRIMARY KEY (`user_id`)
     165    )
     166  ;";
     167  pwg_query($q);
    109168}
    110169?>
Note: See TracChangeset for help on using the changeset viewer.