Skip to content

Commit 2ed8ed5

Browse files
committed
Upgrading from last version in SVN
1 parent 00d5a81 commit 2ed8ed5

File tree

5 files changed

+156
-15
lines changed

5 files changed

+156
-15
lines changed

dfx-random-user-id.php

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,21 @@
33
Plugin Name: Random User IDs
44
Plugin URI: https://davefx.com/random-user-id
55
Description: Sets random user IDs for created users. Randomizes the user ID for the default user, if it exists.
6-
Version: 20170521
6+
Version: 20170526
77
Author: David Marín Carreño (DaveFX)
88
Author URI: https://davefx.com
99
License: GPL3
1010
License URI: https://www.gnu.org/licenses/gpl-3.0.html
11-
Text Domain: dfx-random-user-id
11+
Text Domain: random-user-ids
1212
Domain Path: /languages
1313
*/
1414

1515
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
1616

17+
// Javascript MAX_SAFE_INTEGER = 9007199254740991
18+
// so we define the maximum ID to be one bit shorter
19+
define('DFX_RANDOM_USER_MAX_ID', ( ( 9007199254740991 + 1 ) / 2 ) - 1 );
20+
1721
if ( ! function_exists( 'dfx_random_user_id_user_register' ) ) {
1822

1923
/**
@@ -30,7 +34,7 @@ function dfx_random_user_id_user_register( $data, $update ) {
3034

3135
// Locate a yet-unused user_id
3236
do {
33-
$ID = random_int( 1, PHP_INT_MAX );
37+
$ID = random_int( 1, DFX_RANDOM_USER_MAX_ID );
3438
} while ( get_userdata( $ID ) );
3539

3640
$data += compact( 'ID' );
@@ -65,7 +69,7 @@ function dfx_random_user_randomize_first_user() {
6569

6670
// Locate a yet-unused user_id
6771
do {
68-
$new_id = random_int( 1, PHP_INT_MAX );
72+
$new_id = random_int( 1, DFX_RANDOM_USER_MAX_ID );
6973
} while ( get_userdata( $new_id ) );
7074

7175

@@ -98,26 +102,26 @@ function dfx_random_user_show_activation_msg() {
98102

99103
$first_user_new_id = get_option( 'dfx_randomuserid_first_user_moved_to' );
100104

101-
$message = '<p>' . __( 'Random User IDs plugin has been successfully activated.', 'dfx-random-user-id' ) . '</p>';
105+
$message = '<p>' . __( 'Random User IDs plugin has been successfully activated.', 'random-user-ids' ) . '</p>';
102106

103107
if ( ! $first_user_new_id ) {
104-
$message .= '<p>' . __( 'There was no user with ID=1 already, so no user ID has been randomized.', 'dfx-random-user-id' ) . '</p>';
108+
$message .= '<p>' . __( 'There was no user with ID=1 already, so no user ID has been randomized.', 'random-user-ids' ) . '</p>';
105109
} else {
106110

107111
$admin_user = get_userdata( $first_user_new_id );
108112

109-
$message .= sprintf( '<p>' . __( 'The ID for user `%s` has been moved from 1 to %d.', 'dfx-random-user-id' ) . '</p>', $admin_user->nickname, $first_user_new_id );
113+
$message .= sprintf( '<p>' . __( 'The ID for user `%s` has been moved from 1 to %d.', 'random-user-ids' ) . '</p>', $admin_user->nickname, $first_user_new_id );
110114

111-
$message .= '<p>' . __( 'This plugin is designed to better being activated in first place, before any other plugin or theme', 'dfx-random-user-id' ) . '</p>';
115+
$message .= '<p>' . __( 'This plugin is designed to better being activated in first place, before any other plugin or theme', 'random-user-ids' ) . '</p>';
112116

113-
$message .= '<p>' . sprintf( __( 'If there are any previously installed theme or plugin that added tables to the database, you should check if any field in these tables includes user_ids, and manually replace all the rows referencing user_id 1 with the new user_id %d', 'dfx-random-user-id' ), $first_user_new_id ) . '</p>';
117+
$message .= '<p>' . sprintf( __( 'If there are any previously installed theme or plugin that added tables to the database, you should check if any field in these tables includes user_ids, and manually replace all the rows referencing user_id 1 with the new user_id %d', 'random-user-ids' ), $first_user_new_id ) . '</p>';
114118

115119
}
116120

117121
?>
118122
<div class="updated notice is-dismissible" data-notice="dfx_random_user_activation_msg">
119123
<p><?= $message ?></p>
120-
<p style="text-align: right;"><a href="?dfx_randomuserid_dismiss_notice"><?= __( 'Dismiss', 'dfx-random-user-id' ) ?></a></p>
124+
<p style="text-align: right;"><a href="?dfx_randomuserid_dismiss_notice"><?= __( 'Dismiss', 'random-user-ids' ) ?></a></p>
121125
</div>
122126
<?php
123127
}
@@ -142,3 +146,10 @@ function dfx_random_user_dismissed_activation_msg() {
142146
}
143147

144148
add_action( 'admin_init', 'dfx_random_user_dismissed_activation_msg' );
149+
150+
if ( ! function_exists( 'dfx_random_user_load_textdomain' ) ) {
151+
function dfx_random_user_load_textdomain() {
152+
load_plugin_textdomain( 'random-user-ids', false, dirname( plugin_basename(__FILE__) ) . '/languages/' );
153+
}
154+
}
155+
add_action('plugins_loaded', 'dfx_random_user_load_textdomain');

languages/es.mo

2 KB
Binary file not shown.

languages/es.po

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Translation of Plugins - Random User IDs - Stable (latest release) in Spanish (Spain)
2+
# This file is distributed under the same license as the Plugins - Random User IDs - Stable (latest release) package.
3+
msgid ""
4+
msgstr ""
5+
"PO-Revision-Date: +0000\n"
6+
"MIME-Version: 1.0\n"
7+
"Content-Type: text/plain; charset=UTF-8\n"
8+
"Content-Transfer-Encoding: 8bit\n"
9+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
10+
"X-Generator: GlotPress/2.4.0-alpha\n"
11+
"Language: es\n"
12+
"Project-Id-Version: Plugins - Random User IDs - Stable (latest release)\n"
13+
14+
#. Author URI of the plugin/theme
15+
msgid "https://davefx.com"
16+
msgstr "https://davefx.com"
17+
18+
#. Author of the plugin/theme
19+
msgid "David Marín Carreño (DaveFX)"
20+
msgstr "David Marín Carreño (DaveFX)"
21+
22+
#. Description of the plugin/theme
23+
msgid "Sets random user IDs for created users. Randomizes the user ID for the default user, if it exists."
24+
msgstr "Establece IDs de usuario aleatorios para los usuarios que se creen. Aleatoriza el ID del usuario predeterminado, si existe."
25+
26+
#. Plugin URI of the plugin/theme
27+
msgid "https://davefx.com/random-user-id"
28+
msgstr "https://davefx.com/random-user-id"
29+
30+
#. Plugin Name of the plugin/theme
31+
msgid "Random User IDs"
32+
msgstr "IDs de usuario aleatorios"
33+
34+
#: dfx-random-user-id.php:120
35+
msgid "Dismiss"
36+
msgstr "Descartar"
37+
38+
#: dfx-random-user-id.php:113
39+
msgid "If there are any previously installed theme or plugin that added tables to the database, you should check if any field in these tables includes user_ids, and manually replace all the rows referencing user_id 1 with the new user_id %d"
40+
msgstr "Si hay algún tema o plugin instalado que añada tablas a la base de datos, deberías comprobar si algún campo de esas tablas incluye identificadores de usuario, y reemplazar manualmente todas las filas que hagan referencia al usuario con ID 1 con el nuevo ID de usuario %d"
41+
42+
#: dfx-random-user-id.php:111
43+
msgid "This plugin is designed to better being activated in first place, before any other plugin or theme"
44+
msgstr "Este plugin está diseñado para ser activado en primer lugar, antes que ningún otro plugin o tema."
45+
46+
#: dfx-random-user-id.php:109
47+
msgid "The ID for user `%s` has been moved from 1 to %d."
48+
msgstr "El ID de usuario `%s`se ha movido desde 1 hasta %d."
49+
50+
#: dfx-random-user-id.php:104
51+
msgid "There was no user with ID=1 already, so no user ID has been randomized."
52+
msgstr "No existía ningún usuario con ID=1, por lo que no se ha aleatorizado ningún ID de usuario."
53+
54+
#: dfx-random-user-id.php:101
55+
msgid "Random User IDs plugin has been successfully activated."
56+
msgstr "El plugin «IDs de usuario aleatorios» ha sido activado con éxito."

languages/random-user-ids.pot

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Copyright (C) 2017 Random User IDs
2+
# This file is distributed under the same license as the Random User IDs package.
3+
msgid ""
4+
msgstr ""
5+
"Project-Id-Version: Random User IDs 20170524\n"
6+
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/random-user-ids-"
7+
"svn\n"
8+
"POT-Creation-Date: 2017-05-24 08:42:31+00:00\n"
9+
"MIME-Version: 1.0\n"
10+
"Content-Type: text/plain; charset=UTF-8\n"
11+
"Content-Transfer-Encoding: 8bit\n"
12+
"PO-Revision-Date: 2017-MO-DA HO:MI+ZONE\n"
13+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14+
"Language-Team: LANGUAGE <LL@li.org>\n"
15+
16+
#: dfx-random-user-id.php:101
17+
msgid "Random User IDs plugin has been successfully activated."
18+
msgstr ""
19+
20+
#: dfx-random-user-id.php:104
21+
msgid "There was no user with ID=1 already, so no user ID has been randomized."
22+
msgstr ""
23+
24+
#: dfx-random-user-id.php:109
25+
msgid "The ID for user `%s` has been moved from 1 to %d."
26+
msgstr ""
27+
28+
#: dfx-random-user-id.php:111
29+
msgid ""
30+
"This plugin is designed to better being activated in first place, before any "
31+
"other plugin or theme"
32+
msgstr ""
33+
34+
#: dfx-random-user-id.php:113
35+
msgid ""
36+
"If there are any previously installed theme or plugin that added tables to "
37+
"the database, you should check if any field in these tables includes "
38+
"user_ids, and manually replace all the rows referencing user_id 1 with the "
39+
"new user_id %d"
40+
msgstr ""
41+
42+
#: dfx-random-user-id.php:120
43+
msgid "Dismiss"
44+
msgstr ""
45+
46+
#. Plugin Name of the plugin/theme
47+
msgid "Random User IDs"
48+
msgstr ""
49+
50+
#. Plugin URI of the plugin/theme
51+
msgid "https://davefx.com/random-user-id"
52+
msgstr ""
53+
54+
#. Description of the plugin/theme
55+
msgid ""
56+
"Sets random user IDs for created users. Randomizes the user ID for the "
57+
"default user, if it exists."
58+
msgstr ""
59+
60+
#. Author of the plugin/theme
61+
msgid "David Marín Carreño (DaveFX)"
62+
msgstr ""
63+
64+
#. Author URI of the plugin/theme
65+
msgid "https://davefx.com"
66+
msgstr ""

readme.txt

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,20 @@ Donate link: https://paypal.me/davefx
44
Tags: security, user ids
55
Requires at least: 3.1
66
Tested up to: 4.8
7-
Stable tag: 20170520
7+
Stable tag: 20170526
88
License: GPLv3
99
License URI: http://www.gnu.org/licenses/gpl-3.0.html
1010

11-
This WordPress plugin randomizes the user_id for the user created on WordPress setup,
12-
removing one potential attack factor from the site.
11+
This WordPress plugin randomizes the user_id for the user created on WordPress setup, removing one potential attack factor from the site.
12+
13+
It also randomizes the ID for all other users created after its setup. At this moment, this feature requires the patch from WP Issue https://core.trac.wordpress.org/ticket/40545
14+
15+
== Changelog ==
16+
17+
= 20170526 =
18+
19+
* Now the maximum generated ID is Javascript's MAX_SAFE_INTEGER / 2, so we shouldn't
20+
generate problems with the Javascript layer
21+
22+
1323

14-
It also randomizes the ID for all other users created after its setup. At this moment,
15-
this feature requires the patch from WP Issue https://core.trac.wordpress.org/ticket/40545

0 commit comments

Comments
 (0)