diff --git a/adminer/include/design.inc.php b/adminer/include/design.inc.php
index b1c3133e..d717769b 100644
--- a/adminer/include/design.inc.php
+++ b/adminer/include/design.inc.php
@@ -170,6 +170,7 @@ function get_nonce() {
* @return null
*/
function page_messages($error) {
+ global $adminer;
$uri = preg_replace('~^[^?]*~', '', $_SERVER["REQUEST_URI"]);
$messages = $_SESSION["messages"][$uri];
if ($messages) {
@@ -179,6 +180,9 @@ function page_messages($error) {
if ($error) {
echo "
+ echo "
$adminer->error
\n";
+ }
}
/** Print HTML footer
diff --git a/adminer/include/plugins.inc.php b/adminer/include/plugins.inc.php
index dc9cfe2d..d1e9fcb5 100644
--- a/adminer/include/plugins.inc.php
+++ b/adminer/include/plugins.inc.php
@@ -3,6 +3,7 @@ namespace Adminer;
class Plugins extends Adminer {
public $plugins; ///< @var protected(set)
+ public $error = ''; ///< @var protected(set)
/** Register plugins
* @param array object instances or null to autoload plugins from adminer-plugins/
@@ -18,13 +19,23 @@ class Plugins extends Adminer {
}
if (file_exists("$basename.php")) {
$include = include_once "./$basename.php"; // example: return array(new AdminerLoginOtp($secret))
- foreach ($include as $plugin) {
- $plugins[get_class($plugin)] = $plugin;
+ if (is_array($include)) {
+ foreach ($include as $plugin) {
+ $plugins[get_class($plugin)] = $plugin;
+ }
+ } else {
+ $this->error .= lang('
%s must return an array.', "$basename.php") . "
";
}
}
foreach (get_declared_classes() as $class) {
if (!$plugins[$class] && preg_match('~^Adminer\w~i', $class)) {
- $plugins[$class] = new $class; // if the constructor have some required parameters then PHP triggers an error here
+ $reflection = new \ReflectionClass($class);
+ $constructor = $reflection->getConstructor();
+ if ($constructor && $constructor->getNumberOfRequiredParameters()) {
+ $this->error .= lang('Configure
%s in
%s.', $class, "$basename.php") . "
";
+ } else {
+ $plugins[$class] = new $class;
+ }
}
}
}
diff --git a/adminer/lang/cs.inc.php b/adminer/lang/cs.inc.php
index 8a760ce3..6ae4cc96 100644
--- a/adminer/lang/cs.inc.php
+++ b/adminer/lang/cs.inc.php
@@ -11,9 +11,11 @@ $translations = array(
'Login' => 'Přihlásit se',
'Logout' => 'Odhlásit',
'Logged as: %s' => 'Přihlášen jako: %s',
- 'Loaded plugins' => 'Nahrané pluginy',
'Logout successful.' => 'Odhlášení proběhlo v pořádku.',
'Thanks for using Adminer, consider
donating.' => 'Díky za použití Admineru,
přispějte na vývoj.',
+ 'Loaded plugins' => 'Nahrané pluginy',
+ '
%s must return an array.' => '
%s musí vracet pole.',
+ 'Configure
%s in
%s.' => 'Nakonfigurujte
%s v
%s.',
'Invalid credentials.' => 'Neplatné přihlašovací údaje.',
'There is a space in the input password which might be the cause.' => 'Problém může být, že je v zadaném hesle mezera.',
'Adminer does not support accessing a database without a password,
more information.' => 'Adminer nepodporuje přístup k databázi bez hesla,
více informací.',
diff --git a/adminer/lang/xx.inc.php b/adminer/lang/xx.inc.php
index d21ab09b..d0a4b5b5 100644
--- a/adminer/lang/xx.inc.php
+++ b/adminer/lang/xx.inc.php
@@ -11,9 +11,11 @@ $translations = array(
'Login' => 'Xx',
'Logout' => 'Xx',
'Logged as: %s' => 'Xx: %s',
- 'Loaded plugins' => 'Xx',
'Logout successful.' => 'Xx.',
'Thanks for using Adminer, consider
donating.' => 'Xx
xx.',
+ 'Loaded plugins' => 'Xx',
+ '
%s must return an array.' => '
%s xx.',
+ 'Configure
%s in
%s.' => 'Xx
%s xx
%s.',
'Invalid credentials.' => 'Xx.',
'There is a space in the input password which might be the cause.' => 'Xx.',
'Adminer does not support accessing a database without a password,
more information.' => 'Xx,
xx.',