-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathdesigns.php
More file actions
54 lines (47 loc) · 1.71 KB
/
Copy pathdesigns.php
File metadata and controls
54 lines (47 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/** Allow switching designs
* @link https://www.adminer.org/plugins/#use
* @author Jakub Vrana, https://www.vrana.cz/
* @license https://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
*/
class AdminerDesigns extends Adminer\Plugin {
protected $designs;
/**
* @param list<string> $designs URL in key, name in value
*/
function __construct(array $designs) {
$this->designs = $designs;
}
function afterConnect() {
if (isset($_POST["design"]) && Adminer\verify_token()) {
Adminer\restart_session();
$_SESSION["design"] = $_POST["design"];
Adminer\redirect(Adminer\relative_uri());
}
}
function css() {
$return = array();
if (array_key_exists($_SESSION["design"], $this->designs)) {
$return[$_SESSION["design"]] = (preg_match('~-dark~', $_SESSION["design"]) ? "dark" : "light");
}
return $return;
}
function navigation($missing) {
echo "<form action='' method='post' style='position: fixed; bottom: .5em; right: .5em;'>";
echo Adminer\html_select("design", array("" => "(design)") + $this->designs, $_SESSION["design"], Adminer\on('change', 'formSubmit'));
echo Adminer\input_token();
echo "</form>\n";
}
function screenshot() {
return "https://www.adminer.org/static/plugins/designs.png";
}
protected $translations = array(
'cs' => array('' => 'Umožní změnit vzhled'),
'de' => array('' => 'Designwechsel ermöglichen'),
'pl' => array('' => 'Zezwalaj na przełączanie motywów'),
'ro' => array('' => 'Permiteți comutarea designurilor'),
'ja' => array('' => 'テーマ設定を有効化'),
'hr' => array('' => 'Omogućuje promjenu dizajna'),
);
}