* @return null
*/
function page_messages($error) {
+ global $adminer;
$uri = preg_replace('~^[^?]*~', '', $_SERVER["REQUEST_URI"]);
$messages = $_SESSION["messages"][$uri];
if ($messages) {
if ($error) {
echo "<div class='error'>$error</div>\n";
}
+ if ($adminer->error) { // separate <div>
+ echo "<div class='error'>$adminer->error</div>\n";
+ }
}
/** Print HTML footer
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/
}
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('<b>%s</b> must return an array.', "$basename.php") . "<br>";
}
}
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 <b>%s</b> in <b>%s</b>.', $class, "$basename.php") . "<br>";
+ } else {
+ $plugins[$class] = new $class;
+ }
}
}
}
'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 <a href="https://www.adminer.org/en/donation/">donating</a>.' => 'Díky za použití Admineru, <a href="https://www.adminer.org/cs/donation/">přispějte</a> na vývoj.',
+ 'Loaded plugins' => 'Nahrané pluginy',
+ '<b>%s</b> must return an array.' => '<b>%s</b> musí vracet pole.',
+ 'Configure <b>%s</b> in <b>%s</b>.' => 'Nakonfigurujte <b>%s</b> v <b>%s</b>.',
'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, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => 'Adminer nepodporuje přístup k databázi bez hesla, <a href="https://www.adminer.org/cs/password/"%s>více informací</a>.',
'Login' => 'Xx',
'Logout' => 'Xx',
'Logged as: %s' => 'Xx: %s',
- 'Loaded plugins' => 'Xx',
'Logout successful.' => 'Xx.',
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => 'Xx <a href="https://www.adminer.org/en/donation/">xx</a>.',
+ 'Loaded plugins' => 'Xx',
+ '<b>%s</b> must return an array.' => '<b>%s</b> xx.',
+ 'Configure <b>%s</b> in <b>%s</b>.' => 'Xx <b>%s</b> xx <b>%s</b>.',
'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, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => 'Xx, <a href="https://www.adminer.org/en/password/"%s>xx</a>.',