This repository was archived by the owner on Aug 2, 2024. It is now read-only.
forked from vrana/adminer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
121 lines (106 loc) · 3.66 KB
/
Copy pathindex.php
File metadata and controls
121 lines (106 loc) · 3.66 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<?php
if (file_exists("ip_filter.php"))
{
// user defined script with possibility to filter by IP
include_once "ip_filter.php";
}
define("CURRENT_DIR", __DIR__."/");
if (file_exists("adminer.php"))
{
define("ADMINER_WEB_PATH", "");
define("ADMINER_DIR", "");
}
else
{
define("ADMINER_WEB_PATH", "adminer/");
define("ADMINER_DIR", CURRENT_DIR.ADMINER_WEB_PATH);
}
function adminer_object()
{
// required to run any plugin
include_once CURRENT_DIR."plugins/plugin.php";
// autoloader
foreach (glob(CURRENT_DIR."plugins/*.php") as $filename) {
include_once $filename;
}
$plugins = array(
// specify enabled plugins here
new AdminerFileUpload((str_repeat("../", substr_count(ADMINER_WEB_PATH, "/")))."data/"),
new AdminerSlugify,
new AdminerForeignSystem,
);
$_php_my_admin_plugins = array();
include_once (CURRENT_DIR."plugins/ux/_php_my_admin_plugins.php");
$plugins += $_php_my_admin_plugins;
// my
class MyAdminerModifies
{
function head()
{
?>
<link rel="shortcut icon" type="image/x-icon" href="<?=ADMINER_WEB_PATH?>static/favicon.ico">
<link rel="apple-touch-icon" href="<?=ADMINER_WEB_PATH?>static/favicon.ico">
<link rel="stylesheet" type="text/css" href="<?=ADMINER_WEB_PATH?>static/default.css" />
<?php if (file_exists(CURRENT_DIR."adminer.css")) { ?>
<link rel="stylesheet" type="text/css" href="adminer.css" />
<?php } else if (file_exists(CURRENT_DIR."designs/nette-mod/adminer.css")) { /* default skin */ ?>
<link rel="stylesheet" type="text/css" href="designs/nette-mod/adminer.css" />
<?php } ?>
<script type="text/javascript" src="<?=ADMINER_WEB_PATH?>static/functions.js"<?=nonce()?>></script>
<script type="text/javascript" src="<?=ADMINER_WEB_PATH?>static/editing.js"<?=nonce()?>></script>
<script<?=nonce()?>>
// store as separate function for possibility to use it in js-plugins
function adminerFixResourcesRelatedPath()
{
var inputs = document.getElementsByTagName("INPUT");
var i, cnt = inputs.length;
for (i=0; i<cnt; i++)
if ((inputs[i].type == "image") && (inputs[i].getAttribute("src").indexOf("../") === 0))
{
inputs[i].src = inputs[i].getAttribute("src").replace("../adminer/", "<?=ADMINER_WEB_PATH?>");
}
}
document.addEventListener("DOMContentLoaded", function(event)
{
adminerFixResourcesRelatedPath();
});
</script>
<?php if (file_exists("externals/jush")) { ?>
<link rel="stylesheet" type="text/css" href="externals/jush/jush.css" />
<script type="text/javascript" src="externals/jush/modules/jush.js"<?=nonce()?>></script>
<script type="text/javascript" src="externals/jush/modules/jush-textarea.js"<?=nonce()?>></script>
<script type="text/javascript" src="externals/jush/modules/jush-txt.js"<?=nonce()?>></script>
<script type="text/javascript" src="externals/jush/modules/jush-sql.js"<?=nonce()?>></script>
<?php } ?>
<?php
return false; // do not use default adminer.css + few other files
}
}
$plugins[] = new MyAdminerModifies();
//
/* It is possible to combine customization and plugins:
class AdminerCustomization extends AdminerPlugin {
}
return new AdminerCustomization($plugins);
*/
class myAdminerWithPlugins extends AdminerPlugin
{
function login($login, $password)
{
// using localhost allow no password access
if ($_SERVER["HTTP_HOST"] && (gethostbyname($_SERVER["HTTP_HOST"]) == "127.0.0.1"))
return true;
return parent::login($login, $password);
}
}
return new myAdminerWithPlugins($plugins);
}
// include original Adminer or Adminer Editor
if (ADMINER_DIR != "")
{
chdir(ADMINER_DIR);
include "index.php";
}
else
include "adminer.php";
?>