forked from DSB/MySQLDumper
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmenu.php
164 lines (140 loc) · 4.82 KB
/
menu.php
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<?php
/**
* ---------------------------------------------------------------------
MyOOS [Dumper]
https://www.oos-shop.de/
Copyright (c) 2013 - 2024 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
MySqlDumper
https://www.mysqldumper.de
Copyright (C)2004-2011 Daniel Schlichtholz ([email protected])
----------------------------------------------------------------------
Released under the GNU General Public License
----------------------------------------------------------------------
*/
define('OOS_VALID_MOD', true);
if (!@ob_start('ob_gzhandler')) {
@ob_start();
}
global $config, $databases;
require_once './inc/header.php';
require './inc/template.php';
$lang_old = $config['language'];
$config_refresh = '';
// define template
$tpl = new MODTemplate();
$tpl->set_filenames(
[
'header' => 'tpl/menu/header.tpl',
'footer' => 'tpl/menu/footer.tpl',
'content' => 'tpl/menu/content.tpl', ]
);
$tpl->assign_vars(
[
'MOD_VERSION' => MOD_VERSION,
'CONFIG_HOMEPAGE' => $config['homepage'],
'CONFIG_THEME' => $config['theme'], ]
);
if (isset($_POST['selected_config']) || isset($_GET['config'])) {
if (isset($_POST['selected_config'])) {
$new_config = $_POST['selected_config'];
}
// Configuration was switched in content frame?
if (isset($_GET['config'])) {
$new_config = $_GET['config'];
}
// restore the last active menuitem
if (is_readable($config['paths']['config'].$new_config.'.php')) {
clearstatcache();
unset($databases);
$databases = [];
if (read_config($new_config)) {
$config['config_file'] = $new_config;
$_SESSION['config_file'] = $new_config; //$config['config_file'];
$config_refresh = '
<script>
if (parent.MyOOS_Dumper_content.location.href.indexOf("config_overview.php")!=-1)
{
var selected_div=parent.MyOOS_Dumper_content.document.getElementById("sel").value;
}
else selected_div=\'\';
parent.MyOOS_Dumper_content.location.href=\'config_overview.php?config='.urlencode((string) $new_config).'&sel=\'+selected_div</script>';
}
if (isset($_GET['config'])) {
$config_refresh = '';
} //Neu-Aufruf bei Uebergabe aus Content-Bereich verhindern
}
}
echo MODHeader(1);
echo headline('', 0);
if ($config_refresh > '') {
$tpl->assign_block_vars('CONFIG_REFRESH_TRUE', []);
$tpl->assign_var('CONFIG_REFRESH', $config_refresh);
}
// changed language
if ($config['language'] != $lang_old) {
$tpl->assign_block_vars('CHANGED_LANGUAGE', []);
}
if (isset($_GET['action'])) {
if ('dbrefresh' == $_GET['action']) {
// remember the name of the selected database
$old_dbname = $databases['Name'][$databases['db_selected_index']] ?? '';
SetDefault();
// select old database if it still is there
SelectDB($old_dbname);
$tpl->assign_block_vars('DB_REFRESH', []);
}
}
if (isset($_POST['dbindex'])) {
$dbindex = intval($_POST['dbindex']);
$databases['db_selected_index'] = $dbindex;
$databases['db_actual'] = $databases['Name'][$dbindex];
SelectDB($dbindex);
WriteParams(0);
$tpl->assign_block_vars('DB_REFRESH', []);
} else {
$dbindex = 0;
}
if (isset($_GET['dbindex'])) {
$dbindex = intval($_GET['dbindex']);
$databases['db_selected_index'] = $dbindex;
$databases['db_actual'] = $databases['Name'][$dbindex];
SelectDB($dbindex);
WriteParams(0);
}
if (isset($databases['Name']) && (is_countable($databases['Name']) ? count($databases['Name']) : 0) > 0) {
$tpl->assign_block_vars('MAINTENANCE', []);
$tpl->assign_vars(
[
'DB_ACTUAL' => $databases['db_actual'],
'DB_SELECTED_INDEX' => $databases['db_selected_index'], ]
);
}
$tpl->assign_var('GET_FILELIST', get_config_filelist());
if (isset($databases['Name']) && (is_countable($databases['Name']) ? count($databases['Name']) : 0) > 0) {
$tpl->assign_block_vars('DB_LIST', []);
$datenbanken = is_countable($databases['Name']) ? count($databases['Name']) : 0;
for ($i = 0; $i < $datenbanken; ++$i) {
$selected = ($i == $databases['db_selected_index']) ? ' selected' : '';
$tpl->assign_block_vars(
'DB_LIST.DB_ROW',
[
'ID' => $i,
'NAME' => $databases['Name'][$i],
'SELECTED' => $selected, ]
);
}
} else {
$tpl->assign_block_vars('NO_DB_FOUND', []);
}
$tpl->assign_var('PIC_CACHE', PicCache());
if (!isset($databases['Name']) || (is_countable($databases['Name']) ? count($databases['Name']) : 0) < 1) {
$tpl->assign_block_vars('DB_NAME_TRUE', []);
} else {
$tpl->assign_block_vars('DB_NAME_FALSE', []);
}
$tpl->pparse('header');
$tpl->pparse('content');
$tpl->pparse('footer');
ob_end_flush();