Version Description
- Encrypt database passwords
Download this release
Release Info
Developer | arisoft |
Plugin | ARI Adminer – WordPress Database Manager |
Version | 1.1.0 |
Comparing to | |
See all releases |
Code changes from version 1.0.8 to 1.1.0
- ari-adminer.php +1 -1
- includes/class-installer.php +26 -0
- includes/defines.php +4 -1
- includes/entities/class-connection.php +32 -1
- includes/helpers/class-crypt.php +71 -0
- includes/helpers/class-helper.php +61 -0
- includes/helpers/class-settings.php +57 -0
- includes/models/class-connections.php +36 -0
- install/install.sql +1 -0
- languages/ari-adminer.pot +34 -8
- readme.txt +7 -1
- uninstall.php +6 -0
ari-adminer.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: ARI Adminer
|
4 |
Plugin URI: http://wp-quiz.ari-soft.com/plugins/wordpress-adminer.html
|
5 |
Description: Powerful, compact and easy to use database manager plugin for WordPress.
|
6 |
-
Version: 1.0
|
7 |
Author: ARI Soft
|
8 |
Author URI: http://www.ari-soft.com
|
9 |
Text Domain: ari-adminer
|
3 |
Plugin Name: ARI Adminer
|
4 |
Plugin URI: http://wp-quiz.ari-soft.com/plugins/wordpress-adminer.html
|
5 |
Description: Powerful, compact and easy to use database manager plugin for WordPress.
|
6 |
+
Version: 1.1.0
|
7 |
Author: ARI Soft
|
8 |
Author URI: http://www.ari-soft.com
|
9 |
Text Domain: ari-adminer
|
includes/class-installer.php
CHANGED
@@ -4,6 +4,7 @@ namespace Ari_Adminer;
|
|
4 |
use Ari\App\Installer as Ari_Installer;
|
5 |
use Ari\Database\Helper as DB;
|
6 |
use Ari\Wordpress\Security as Security;
|
|
|
7 |
|
8 |
class Installer extends Ari_Installer {
|
9 |
function __construct( $options = array() ) {
|
@@ -43,6 +44,8 @@ class Installer extends Ari_Installer {
|
|
43 |
|
44 |
update_option( ARIADMINER_VERSION_OPTION, $this->options->version );
|
45 |
|
|
|
|
|
46 |
return true;
|
47 |
}
|
48 |
|
@@ -58,4 +61,27 @@ class Installer extends Ari_Installer {
|
|
58 |
}
|
59 |
}
|
60 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
}
|
4 |
use Ari\App\Installer as Ari_Installer;
|
5 |
use Ari\Database\Helper as DB;
|
6 |
use Ari\Wordpress\Security as Security;
|
7 |
+
use Ari_Adminer\Helpers\Helper as Helper;
|
8 |
|
9 |
class Installer extends Ari_Installer {
|
10 |
function __construct( $options = array() ) {
|
44 |
|
45 |
update_option( ARIADMINER_VERSION_OPTION, $this->options->version );
|
46 |
|
47 |
+
$this->ensure_crypt_key();
|
48 |
+
|
49 |
return true;
|
50 |
}
|
51 |
|
61 |
}
|
62 |
}
|
63 |
}
|
64 |
+
|
65 |
+
private function ensure_crypt_key() {
|
66 |
+
$crypt_key = Helper::get_crypt_key();
|
67 |
+
|
68 |
+
if ( strlen( $crypt_key ) > 0 )
|
69 |
+
return ;
|
70 |
+
|
71 |
+
$crypt_key = Helper::get_random_string();
|
72 |
+
if ( Helper::save_crypt_key( $crypt_key ) ) {
|
73 |
+
Helper::re_crypt_passwords( $crypt_key, '' );
|
74 |
+
}
|
75 |
+
}
|
76 |
+
|
77 |
+
protected function update_to_1_1_0() {
|
78 |
+
if ( ! DB::column_exists( '#__ariadminer_connections', 'crypt' ) ) {
|
79 |
+
$this->db->query(
|
80 |
+
sprintf(
|
81 |
+
'ALTER TABLE `%1$sariadminer_connections` ADD COLUMN `crypt` tinyint(1) unsigned NOT NULL DEFAULT "0"',
|
82 |
+
$this->db->prefix
|
83 |
+
)
|
84 |
+
);
|
85 |
+
}
|
86 |
+
}
|
87 |
}
|
includes/defines.php
CHANGED
@@ -1,11 +1,14 @@
|
|
1 |
<?php
|
2 |
-
define( 'ARIADMINER_VERSION', '1.0
|
3 |
define( 'ARIADMINER_SLUG', 'ari-adminer' );
|
4 |
define( 'ARIADMINER_ASSETS_URL', ARIADMINER_URL . 'assets/' );
|
5 |
define( 'ARIADMINER_VERSION_OPTION', 'ari_adminer' );
|
6 |
define( 'ARIADMINER_INSTALL_PATH', ARIADMINER_PATH . 'install/' );
|
7 |
define( 'ARIADMINER_CAPABILITY_RUN', 'run_adminer' );
|
8 |
|
|
|
|
|
|
|
9 |
define( 'ARIADMINER_THEMES_PATH', ARIADMINER_PATH . 'assets/themes/' );
|
10 |
define( 'ARIADMINER_THEMES_URL', ARIADMINER_URL . 'assets/themes/' );
|
11 |
define( 'ARIADMINER_THEME_DEFAULT', 'flat' );
|
1 |
<?php
|
2 |
+
define( 'ARIADMINER_VERSION', '1.1.0' );
|
3 |
define( 'ARIADMINER_SLUG', 'ari-adminer' );
|
4 |
define( 'ARIADMINER_ASSETS_URL', ARIADMINER_URL . 'assets/' );
|
5 |
define( 'ARIADMINER_VERSION_OPTION', 'ari_adminer' );
|
6 |
define( 'ARIADMINER_INSTALL_PATH', ARIADMINER_PATH . 'install/' );
|
7 |
define( 'ARIADMINER_CAPABILITY_RUN', 'run_adminer' );
|
8 |
|
9 |
+
define( 'ARIADMINER_CONFIG_PATH', WP_CONTENT_DIR . '/ari-adminer-config.php' );
|
10 |
+
define( 'ARIADMINER_CONFIG_TMPL', "<?php\r\ndefined( 'ABSPATH' ) or die( 'Access forbidden!' );\r\ndefine( 'ARIADMINER_CRYPT_KEY', '%1\$s' );" );
|
11 |
+
|
12 |
define( 'ARIADMINER_THEMES_PATH', ARIADMINER_PATH . 'assets/themes/' );
|
13 |
define( 'ARIADMINER_THEMES_URL', ARIADMINER_URL . 'assets/themes/' );
|
14 |
define( 'ARIADMINER_THEME_DEFAULT', 'flat' );
|
includes/entities/class-connection.php
CHANGED
@@ -3,6 +3,8 @@ namespace Ari_Adminer\Entities;
|
|
3 |
|
4 |
use Ari\Entities\Entity as Entity;
|
5 |
use Ari_Adminer\Utils\Db_Driver as DB_Driver;
|
|
|
|
|
6 |
|
7 |
class Connection extends Entity {
|
8 |
public $connection_id;
|
@@ -25,6 +27,8 @@ class Connection extends Entity {
|
|
25 |
|
26 |
public $author_id = 0;
|
27 |
|
|
|
|
|
28 |
function __construct( $db ) {
|
29 |
parent::__construct( 'ariadminer_connections', 'connection_id', $db );
|
30 |
}
|
@@ -52,7 +56,34 @@ class Connection extends Entity {
|
|
52 |
$this->modified = $now;
|
53 |
}
|
54 |
|
55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
}
|
57 |
|
58 |
public function validate() {
|
3 |
|
4 |
use Ari\Entities\Entity as Entity;
|
5 |
use Ari_Adminer\Utils\Db_Driver as DB_Driver;
|
6 |
+
use Ari_Adminer\Helpers\Helper as Helper;
|
7 |
+
use Ari_Adminer\Helpers\Crypt as Crypt;
|
8 |
|
9 |
class Connection extends Entity {
|
10 |
public $connection_id;
|
27 |
|
28 |
public $author_id = 0;
|
29 |
|
30 |
+
public $crypt = 0;
|
31 |
+
|
32 |
function __construct( $db ) {
|
33 |
parent::__construct( 'ariadminer_connections', 'connection_id', $db );
|
34 |
}
|
56 |
$this->modified = $now;
|
57 |
}
|
58 |
|
59 |
+
$plain_pass = $this->pass;
|
60 |
+
|
61 |
+
if ( strlen( $plain_pass ) > 0 && Helper::support_crypt() ) {
|
62 |
+
$crypt_key = Helper::get_crypt_key();
|
63 |
+
|
64 |
+
$this->pass = Crypt::crypt( $plain_pass, $crypt_key );
|
65 |
+
$this->crypt = 1;
|
66 |
+
}
|
67 |
+
|
68 |
+
$res = parent::store( $force_insert );
|
69 |
+
|
70 |
+
$this->pass = $plain_pass;
|
71 |
+
|
72 |
+
return $res;
|
73 |
+
}
|
74 |
+
|
75 |
+
public function load( $keys, $reset = true ) {
|
76 |
+
$res = parent::load( $keys, $reset );
|
77 |
+
|
78 |
+
if ( $res ) {
|
79 |
+
if ( $this->crypt && strlen( $this->pass ) > 0 && Helper::support_crypt() ) {
|
80 |
+
$crypt_key = Helper::get_crypt_key();
|
81 |
+
|
82 |
+
$this->pass = Crypt::decrypt( $this->pass, $crypt_key );
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
+
return $res;
|
87 |
}
|
88 |
|
89 |
public function validate() {
|
includes/helpers/class-crypt.php
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Ari_Adminer\Helpers;
|
3 |
+
|
4 |
+
define( 'ARI_CRYPT_OPENSSL_INSTALLED', extension_loaded( 'openssl' ) );
|
5 |
+
|
6 |
+
class Crypt {
|
7 |
+
const METHOD = 'aes-256-cbc';
|
8 |
+
|
9 |
+
static public function crypt( $message, $key, $encode = true ) {
|
10 |
+
if ( ! ARI_CRYPT_OPENSSL_INSTALLED )
|
11 |
+
return $message;
|
12 |
+
|
13 |
+
$nonce_size = openssl_cipher_iv_length( self::METHOD );
|
14 |
+
$nonce = openssl_random_pseudo_bytes( $nonce_size );
|
15 |
+
|
16 |
+
$cipher_text = openssl_encrypt(
|
17 |
+
$message,
|
18 |
+
self::METHOD,
|
19 |
+
$key,
|
20 |
+
OPENSSL_RAW_DATA,
|
21 |
+
$nonce
|
22 |
+
);
|
23 |
+
|
24 |
+
$res = $nonce . $cipher_text;
|
25 |
+
|
26 |
+
if ( $encode ) {
|
27 |
+
$res = base64_encode( $res );
|
28 |
+
}
|
29 |
+
|
30 |
+
return $res;
|
31 |
+
}
|
32 |
+
|
33 |
+
static public function decrypt( $message, $key, $decode = true ) {
|
34 |
+
if ( ! ARI_CRYPT_OPENSSL_INSTALLED )
|
35 |
+
return $message;
|
36 |
+
|
37 |
+
if ( $decode ) {
|
38 |
+
$message = base64_decode($message, true);
|
39 |
+
|
40 |
+
if ( false === $message ) {
|
41 |
+
throw new \InvalidArgumentException( 'Encryption failure' );
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
$nonce_size = openssl_cipher_iv_length( self::METHOD );
|
46 |
+
$nonce = mb_substr( $message, 0, $nonce_size, '8bit' );
|
47 |
+
$cipher_text = mb_substr( $message, $nonce_size, null, '8bit' );
|
48 |
+
|
49 |
+
$decrypted_message = openssl_decrypt(
|
50 |
+
$cipher_text,
|
51 |
+
self::METHOD,
|
52 |
+
$key,
|
53 |
+
OPENSSL_RAW_DATA,
|
54 |
+
$nonce
|
55 |
+
);
|
56 |
+
|
57 |
+
return $decrypted_message;
|
58 |
+
}
|
59 |
+
|
60 |
+
public static function support_crypt() {
|
61 |
+
if ( ! ARI_CRYPT_OPENSSL_INSTALLED )
|
62 |
+
return false;
|
63 |
+
|
64 |
+
$crypt_methods = openssl_get_cipher_methods();
|
65 |
+
|
66 |
+
if ( ! in_array( self::METHOD, $crypt_methods ) )
|
67 |
+
return false;
|
68 |
+
|
69 |
+
return true;
|
70 |
+
}
|
71 |
+
}
|
includes/helpers/class-helper.php
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
namespace Ari_Adminer\Helpers;
|
3 |
|
4 |
use Ari_Adminer\Utils\Db_Driver as DB_Driver;
|
|
|
5 |
|
6 |
class Helper {
|
7 |
private static $system_args = array(
|
@@ -101,4 +102,64 @@ class Helper {
|
|
101 |
|
102 |
return $label;
|
103 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
}
|
2 |
namespace Ari_Adminer\Helpers;
|
3 |
|
4 |
use Ari_Adminer\Utils\Db_Driver as DB_Driver;
|
5 |
+
use Ari_Adminer\Models\Connections as Connections_Model;
|
6 |
|
7 |
class Helper {
|
8 |
private static $system_args = array(
|
102 |
|
103 |
return $label;
|
104 |
}
|
105 |
+
|
106 |
+
public static function get_random_string() {
|
107 |
+
mt_srand( (float) microtime() * 1000000 );
|
108 |
+
$key = mt_rand();
|
109 |
+
|
110 |
+
return md5( $key );
|
111 |
+
}
|
112 |
+
|
113 |
+
public static function save_crypt_key( $crypt_key ) {
|
114 |
+
if ( ! ( $fh = fopen( ARIADMINER_CONFIG_PATH, 'w+' ) ) ) {
|
115 |
+
return false;
|
116 |
+
}
|
117 |
+
|
118 |
+
$config = sprintf( ARIADMINER_CONFIG_TMPL, addcslashes( $crypt_key, "'" ) );
|
119 |
+
if ( false === fwrite( $fh, $config ) ) {
|
120 |
+
return false;
|
121 |
+
}
|
122 |
+
|
123 |
+
fclose( $fh );
|
124 |
+
|
125 |
+
return true;
|
126 |
+
}
|
127 |
+
|
128 |
+
public static function get_crypt_key() {
|
129 |
+
$crypt_key = '';
|
130 |
+
|
131 |
+
if ( defined( 'ARIADMINER_CRYPT_KEY' ) ) {
|
132 |
+
$crypt_key = ARIADMINER_CRYPT_KEY;
|
133 |
+
} else {
|
134 |
+
if ( file_exists( ARIADMINER_CONFIG_PATH ) ) {
|
135 |
+
require_once ARIADMINER_CONFIG_PATH;
|
136 |
+
|
137 |
+
if ( defined( 'ARIADMINER_CRYPT_KEY' ) ) {
|
138 |
+
$crypt_key = ARIADMINER_CRYPT_KEY;
|
139 |
+
}
|
140 |
+
}
|
141 |
+
}
|
142 |
+
|
143 |
+
return $crypt_key;
|
144 |
+
}
|
145 |
+
|
146 |
+
public static function support_crypt() {
|
147 |
+
$crypt_key = self::get_crypt_key();
|
148 |
+
|
149 |
+
if ( strlen( $crypt_key ) === 0 || ! Crypt::support_crypt() ) {
|
150 |
+
return false;
|
151 |
+
}
|
152 |
+
|
153 |
+
return true;
|
154 |
+
}
|
155 |
+
|
156 |
+
public static function re_crypt_passwords( $new_crypt_key, $old_crypt_key ) {
|
157 |
+
$connections_model = new Connections_Model(
|
158 |
+
array(
|
159 |
+
'class_prefix' => 'Ari_Adminer',
|
160 |
+
)
|
161 |
+
);
|
162 |
+
|
163 |
+
return $connections_model->re_crypt_passwords( $new_crypt_key, $old_crypt_key );
|
164 |
+
}
|
165 |
}
|
includes/helpers/class-settings.php
CHANGED
@@ -85,6 +85,18 @@ class Settings {
|
|
85 |
ARIADMINER_SETTINGS_GENERAL_PAGE,
|
86 |
ARIADMINER_SETTINGS_GENERAL_SECTION
|
87 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
}
|
89 |
|
90 |
public static function options() {
|
@@ -233,6 +245,20 @@ class Settings {
|
|
233 |
echo $html;
|
234 |
}
|
235 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
public static function sanitize( $input ) {
|
237 |
$new_input = array();
|
238 |
|
@@ -298,6 +324,37 @@ class Settings {
|
|
298 |
$new_input['roles'] = $prev_roles;
|
299 |
}
|
300 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
301 |
return $new_input;
|
302 |
}
|
303 |
}
|
85 |
ARIADMINER_SETTINGS_GENERAL_PAGE,
|
86 |
ARIADMINER_SETTINGS_GENERAL_SECTION
|
87 |
);
|
88 |
+
|
89 |
+
add_settings_field(
|
90 |
+
'crypt_key',
|
91 |
+
self::format_option_name(
|
92 |
+
__( 'Crypt key', 'ari-adminer' ),
|
93 |
+
|
94 |
+
__( 'Define an unique string which will be used to encrypt database passwords. Requires OpenSSL PHP extension.', 'ari-adminer' )
|
95 |
+
),
|
96 |
+
array( __CLASS__, 'render_general_crypt_key' ),
|
97 |
+
ARIADMINER_SETTINGS_GENERAL_PAGE,
|
98 |
+
ARIADMINER_SETTINGS_GENERAL_SECTION
|
99 |
+
);
|
100 |
}
|
101 |
|
102 |
public static function options() {
|
245 |
echo $html;
|
246 |
}
|
247 |
|
248 |
+
public static function render_general_crypt_key() {
|
249 |
+
$val = Helper::get_crypt_key();
|
250 |
+
|
251 |
+
$html = sprintf(
|
252 |
+
'<p>
|
253 |
+
<input type="text" name="%1$s[crypt_key]" id="tbxAdminerCryptKey" size="40" value="%2$s" />
|
254 |
+
</p>',
|
255 |
+
ARIADMINER_SETTINGS_NAME,
|
256 |
+
esc_attr( $val )
|
257 |
+
);
|
258 |
+
|
259 |
+
echo $html;
|
260 |
+
}
|
261 |
+
|
262 |
public static function sanitize( $input ) {
|
263 |
$new_input = array();
|
264 |
|
324 |
$new_input['roles'] = $prev_roles;
|
325 |
}
|
326 |
|
327 |
+
$new_crypt_key = isset( $input['crypt_key'] ) ? trim( $input['crypt_key'] ) : '';
|
328 |
+
$old_crypt_key = Helper::get_crypt_key();
|
329 |
+
|
330 |
+
if ( empty( $new_crypt_key ) ) {
|
331 |
+
if ( ! empty( $old_crypt_key ) ) {
|
332 |
+
$new_crypt_key = $old_crypt_key;
|
333 |
+
} else {
|
334 |
+
$new_crypt_key = Helper::get_random_string();
|
335 |
+
}
|
336 |
+
}
|
337 |
+
|
338 |
+
if ( ( $new_crypt_key != $old_crypt_key ) ) {
|
339 |
+
if ( ! Helper::save_crypt_key( $new_crypt_key ) ) {
|
340 |
+
add_settings_error(
|
341 |
+
'invalid-crypt-key',
|
342 |
+
'',
|
343 |
+
__( 'A crypt key could not be saved.', 'ari-adminer' ),
|
344 |
+
'error'
|
345 |
+
);
|
346 |
+
} else {
|
347 |
+
if ( ! Helper::re_crypt_passwords( $new_crypt_key, $old_crypt_key ) ) {
|
348 |
+
add_settings_error(
|
349 |
+
'invalid-re-crypt-pass',
|
350 |
+
'',
|
351 |
+
__( 'Passwords could not be re-crypted with new crypt key.', 'ari-adminer' ),
|
352 |
+
'error'
|
353 |
+
);
|
354 |
+
}
|
355 |
+
}
|
356 |
+
}
|
357 |
+
|
358 |
return $new_input;
|
359 |
}
|
360 |
}
|
includes/models/class-connections.php
CHANGED
@@ -4,6 +4,8 @@ namespace Ari_Adminer\Models;
|
|
4 |
use Ari\Models\Model as Model;
|
5 |
use Ari\Utils\Request as Request;
|
6 |
use Ari\Utils\Array_Helper as Array_Helper;
|
|
|
|
|
7 |
|
8 |
class Connections extends Model {
|
9 |
protected $sort_columns = array( 'title' );
|
@@ -147,4 +149,38 @@ class Connections extends Model {
|
|
147 |
|
148 |
return ( false !== $result );
|
149 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
}
|
4 |
use Ari\Models\Model as Model;
|
5 |
use Ari\Utils\Request as Request;
|
6 |
use Ari\Utils\Array_Helper as Array_Helper;
|
7 |
+
use Ari_Adminer\Helpers\Helper as Helper;
|
8 |
+
use Ari_Adminer\Helpers\Crypt as Crypt;
|
9 |
|
10 |
class Connections extends Model {
|
11 |
protected $sort_columns = array( 'title' );
|
149 |
|
150 |
return ( false !== $result );
|
151 |
}
|
152 |
+
|
153 |
+
public function re_crypt_passwords( $new_crypt_key, $old_crypt_key ) {
|
154 |
+
if ( ! Helper::support_crypt() )
|
155 |
+
return false;
|
156 |
+
|
157 |
+
$connections = $this->db->get_results(
|
158 |
+
sprintf(
|
159 |
+
'SELECT `connection_id`,`pass`,`crypt` FROM `%1$sariadminer_connections` WHERE LENGTH(`pass`) > 0',
|
160 |
+
$this->db->prefix
|
161 |
+
),
|
162 |
+
OBJECT
|
163 |
+
);
|
164 |
+
|
165 |
+
if ( count( $connections ) == 0 )
|
166 |
+
return true;
|
167 |
+
|
168 |
+
foreach ( $connections as $connection ) {
|
169 |
+
$plain_pass = $connection->crypt ? Crypt::decrypt( $connection->pass, $old_crypt_key ) : $connection->pass;
|
170 |
+
$pass = Crypt::crypt( $plain_pass, $new_crypt_key );
|
171 |
+
|
172 |
+
$this->db->query(
|
173 |
+
$this->db->prepare(
|
174 |
+
sprintf(
|
175 |
+
'UPDATE `%1$sariadminer_connections` SET `pass` = %%s,`crypt` = 1 WHERE `connection_id` = %%d',
|
176 |
+
$this->db->prefix
|
177 |
+
),
|
178 |
+
$pass,
|
179 |
+
$connection->connection_id
|
180 |
+
)
|
181 |
+
);
|
182 |
+
}
|
183 |
+
|
184 |
+
return true;
|
185 |
+
}
|
186 |
}
|
install/install.sql
CHANGED
@@ -9,5 +9,6 @@ CREATE TABLE IF NOT EXISTS `#__ariadminer_connections` (
|
|
9 |
`created` datetime NOT NULL,
|
10 |
`modified` datetime NOT NULL,
|
11 |
`author_id` int(11) DEFAULT NULL,
|
|
|
12 |
PRIMARY KEY (`connection_id`)
|
13 |
) CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
9 |
`created` datetime NOT NULL,
|
10 |
`modified` datetime NOT NULL,
|
11 |
`author_id` int(11) DEFAULT NULL,
|
12 |
+
`crypt` tinyint(1) unsigned NOT NULL DEFAULT '0',
|
13 |
PRIMARY KEY (`connection_id`)
|
14 |
) CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
languages/ari-adminer.pot
CHANGED
@@ -5,9 +5,9 @@
|
|
5 |
msgid ""
|
6 |
msgstr ""
|
7 |
"Project-Id-Version: ARI "
|
8 |
-
"Adminer v 1.
|
9 |
"POT-Creation-Date: "
|
10 |
-
"2017-03-
|
11 |
"PO-Revision-Date: \n"
|
12 |
"Last-Translator: Your "
|
13 |
"Name <you@example.com>\n"
|
@@ -174,15 +174,15 @@ msgstr ""
|
|
174 |
msgid "No results found"
|
175 |
msgstr ""
|
176 |
|
177 |
-
#: includes/helpers/class-helper.php:
|
178 |
msgid "MySQL"
|
179 |
msgstr ""
|
180 |
|
181 |
-
#: includes/helpers/class-helper.php:
|
182 |
msgid "SQLite"
|
183 |
msgstr ""
|
184 |
|
185 |
-
#: includes/helpers/class-helper.php:
|
186 |
msgid "PostgreSQL"
|
187 |
msgstr ""
|
188 |
|
@@ -256,18 +256,44 @@ msgid ""
|
|
256 |
"plugin."
|
257 |
msgstr ""
|
258 |
|
259 |
-
#: includes/helpers/class-settings.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
260 |
msgid "Advanced"
|
261 |
msgstr ""
|
262 |
|
263 |
-
#: includes/helpers/class-settings.php:
|
264 |
msgid "Simple"
|
265 |
msgstr ""
|
266 |
|
267 |
-
#: includes/helpers/class-settings.php:
|
268 |
msgid "Stop on logout"
|
269 |
msgstr ""
|
270 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
271 |
#: includes/utils/dbcheck/class-db-check.php:25
|
272 |
#, php-format
|
273 |
msgid ""
|
5 |
msgid ""
|
6 |
msgstr ""
|
7 |
"Project-Id-Version: ARI "
|
8 |
+
"Adminer v 1.1.0\n"
|
9 |
"POT-Creation-Date: "
|
10 |
+
"2017-03-24 19:51+0300\n"
|
11 |
"PO-Revision-Date: \n"
|
12 |
"Last-Translator: Your "
|
13 |
"Name <you@example.com>\n"
|
174 |
msgid "No results found"
|
175 |
msgstr ""
|
176 |
|
177 |
+
#: includes/helpers/class-helper.php:91
|
178 |
msgid "MySQL"
|
179 |
msgstr ""
|
180 |
|
181 |
+
#: includes/helpers/class-helper.php:95
|
182 |
msgid "SQLite"
|
183 |
msgstr ""
|
184 |
|
185 |
+
#: includes/helpers/class-helper.php:99
|
186 |
msgid "PostgreSQL"
|
187 |
msgstr ""
|
188 |
|
256 |
"plugin."
|
257 |
msgstr ""
|
258 |
|
259 |
+
#: includes/helpers/class-settings.php:92
|
260 |
+
msgid "Crypt key"
|
261 |
+
msgstr ""
|
262 |
+
|
263 |
+
#: includes/helpers/class-settings.php:94
|
264 |
+
msgid ""
|
265 |
+
"Define an unique string "
|
266 |
+
"which will be used to "
|
267 |
+
"encrypt database "
|
268 |
+
"passwords. Requires "
|
269 |
+
"OpenSSL PHP extension."
|
270 |
+
msgstr ""
|
271 |
+
|
272 |
+
#: includes/helpers/class-settings.php:174
|
273 |
msgid "Advanced"
|
274 |
msgstr ""
|
275 |
|
276 |
+
#: includes/helpers/class-settings.php:176
|
277 |
msgid "Simple"
|
278 |
msgstr ""
|
279 |
|
280 |
+
#: includes/helpers/class-settings.php:205
|
281 |
msgid "Stop on logout"
|
282 |
msgstr ""
|
283 |
|
284 |
+
#: includes/helpers/class-settings.php:343
|
285 |
+
msgid ""
|
286 |
+
"A crypt key could not be "
|
287 |
+
"saved."
|
288 |
+
msgstr ""
|
289 |
+
|
290 |
+
#: includes/helpers/class-settings.php:351
|
291 |
+
msgid ""
|
292 |
+
"Passwords could not be "
|
293 |
+
"re-crypted with new "
|
294 |
+
"crypt key."
|
295 |
+
msgstr ""
|
296 |
+
|
297 |
#: includes/utils/dbcheck/class-db-check.php:25
|
298 |
#, php-format
|
299 |
msgid ""
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://wp-quiz.ari-soft.com/plugins/wordpress-adminer.html
|
|
4 |
Tags: adminer, sql, database, mysql, report, sqlite, table, postgresql, dump, backup, import, export, phpmyadmin
|
5 |
Requires at least: 3.4
|
6 |
Tested up to: 4.7.3
|
7 |
-
Stable tag: 1.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -69,6 +69,9 @@ Sure, it is available [here](http://www.ari-soft.com/docs/wordpress/ari-adminer/
|
|
69 |
|
70 |
== Changelog ==
|
71 |
|
|
|
|
|
|
|
72 |
= 1.0.8 =
|
73 |
* Update Adminer to v. 4.3.0
|
74 |
|
@@ -99,6 +102,9 @@ Sure, it is available [here](http://www.ari-soft.com/docs/wordpress/ari-adminer/
|
|
99 |
|
100 |
== Upgrade Notice ==
|
101 |
|
|
|
|
|
|
|
102 |
= 1.0.8 =
|
103 |
* Update Adminer to v. 4.3.0
|
104 |
|
4 |
Tags: adminer, sql, database, mysql, report, sqlite, table, postgresql, dump, backup, import, export, phpmyadmin
|
5 |
Requires at least: 3.4
|
6 |
Tested up to: 4.7.3
|
7 |
+
Stable tag: 1.1.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
69 |
|
70 |
== Changelog ==
|
71 |
|
72 |
+
= 1.1.0 =
|
73 |
+
* Encrypt database passwords
|
74 |
+
|
75 |
= 1.0.8 =
|
76 |
* Update Adminer to v. 4.3.0
|
77 |
|
102 |
|
103 |
== Upgrade Notice ==
|
104 |
|
105 |
+
= 1.1.0 =
|
106 |
+
* Encrypt database passwords
|
107 |
+
|
108 |
= 1.0.8 =
|
109 |
* Update Adminer to v. 4.3.0
|
110 |
|
uninstall.php
CHANGED
@@ -19,6 +19,12 @@ function execute_queries( $queries ) {
|
|
19 |
}
|
20 |
}
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
if ( ! is_multisite() ) {
|
23 |
execute_queries( $queries );
|
24 |
delete_option( 'ari_adminer' );
|
19 |
}
|
20 |
}
|
21 |
|
22 |
+
$config_path = WP_CONTENT_DIR . '/ari-adminer-config.php';
|
23 |
+
|
24 |
+
if ( @file_exists( $config_path ) ) {
|
25 |
+
@unlink( $config_path );
|
26 |
+
}
|
27 |
+
|
28 |
if ( ! is_multisite() ) {
|
29 |
execute_queries( $queries );
|
30 |
delete_option( 'ari_adminer' );
|