Skip to content

Commit c5c1b31

Browse files
authored
MA-501
1 parent f696eb2 commit c5c1b31

File tree

5 files changed

+222
-269
lines changed

5 files changed

+222
-269
lines changed

plugins/massiveAdmin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
register_plugin(
2323
$thisfile, //Plugin id
2424
'Massive Admin Theme', //Plugin name
25-
'5.0', //Plugin version
25+
'5.0.1', //Plugin version
2626
'Multicolor', //Plugin author
2727
'https://multicolor.stargard.pl', //author website
2828
'Admin theme with new function', //Plugin description

plugins/massiveAdmin/class/massiveAdmin.class.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,9 @@ public function submitHideAdminSection()
309309
$hideplugin = $_POST['hideplugin'];
310310
$hidei18n = $_POST['hidei18n'];
311311
$hidepages = $_POST['hidepages'];
312-
$hideuser = $_POST['hideuser'];
313312
$hidesupport = $_POST['hidesupport'];
314313
$hidesettings = $_POST['hidesettings'];
314+
$hideuser = $_POST['user'];
315315

316316
$json = '{
317317
"hidefiles": "' . $hidefiles . '",
@@ -320,13 +320,12 @@ public function submitHideAdminSection()
320320
"hidei18n": "' . $hidei18n . '",
321321
"hideplugin":"' . $hideplugin . '",
322322
"hidepages": "' . $hidepages . '",
323-
"hideuser": "' . $hideuser . '",
324-
"hidesupport": "' . $hidesupport . '",
323+
"hidesupport": "' . $hidesupport . '",
325324
"hidesettings": "' . $hidesettings . '"
326325
}';
327326

328327
$massiveHiddenSection = GSDATAOTHERPATH . '/massiveHiddenSection/';
329-
$filejson = 'userhidden.json';
328+
$filejson = $hideuser . '.json';
330329
$finaljson = $massiveHiddenSection . $filejson;
331330
$chmod_mode = 0755;
332331
$folder_exists = file_exists($massiveHiddenSection) || mkdir($massiveHiddenSection, $chmod_mode);
Lines changed: 71 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?php
2+
global $USR;
3+
24
$massiveHiddenSection = GSDATAOTHERPATH . '/massiveHiddenSection/';
3-
$filejson = 'userhidden.json';
5+
$filejson = $USR . '.json';
46
$finaljson = $massiveHiddenSection . $filejson;
57

68

@@ -9,7 +11,7 @@
911
file_put_contents($finaljson, '');
1012
};
1113

12-
$datee = file_get_contents($finaljson);
14+
$datee = @file_get_contents($finaljson);
1315
$data = json_decode($datee);
1416

1517

@@ -18,111 +20,87 @@
1820
<script>
1921
document.body.setAttribute('data-login', '<?php echo $_COOKIE['GS_ADMIN_USERNAME']; ?>');
2022

23+
24+
2125

2226

27+
if (document.querySelector("#nav_pages") !== null) {
28+
if ("<?php if (isset($data->hidepages)) {
29+
echo $data->hidepages;
30+
}; ?>" == "hide") {
31+
document.querySelector("#nav_pages").remove()
32+
};
33+
};
2334

24-
const userHideListString = "<?php if (isset($data->hideuser)) {
25-
echo $data->hideuser;
26-
}; ?>";
27-
const userAfterSplit = userHideListString.split(',');
28-
29-
30-
userAfterSplit.forEach(e => {
31-
32-
33-
if (e == document.body.getAttribute('data-login')) {
34-
console.log('tak!');
35-
36-
37-
38-
39-
40-
41-
42-
43-
44-
if (document.querySelector("#nav_pages") !== null) {
45-
if ("<?php if (isset($data->hidepages)) {
46-
echo $data->hidepages;
47-
}; ?>" == "hide") {
48-
document.querySelector("#nav_pages").remove()
49-
};
50-
};
51-
52-
if (document.querySelector("#nav_upload") !== null) {
53-
if ("<?php if (isset($data->hidefiles)) {
54-
echo $data->hidefiles;
55-
}; ?>" == "hide") {
56-
document.querySelector("#nav_upload").remove()
57-
};
58-
};
59-
60-
if (document.querySelector("#nav_theme") !== null) {
61-
if ("<?php if (isset($data->hidethemes)) {
62-
echo $data->hidethemes;
63-
}; ?>" == "hide") {
64-
document.querySelector("#nav_theme").remove()
65-
};
66-
};
67-
68-
if (document.querySelector("#nav_plugins") !== null) {
69-
if ("<?php if (isset($data->hideplugin)) {
70-
echo $data->hideplugin;
71-
}; ?>" == "hide") {
72-
document.querySelector("#nav_plugins").remove()
73-
};
74-
};
35+
if (document.querySelector("#nav_upload") !== null) {
36+
if ("<?php if (isset($data->hidefiles)) {
37+
echo $data->hidefiles;
38+
}; ?>" == "hide") {
39+
document.querySelector("#nav_upload").remove()
40+
};
41+
};
7542

43+
if (document.querySelector("#nav_theme") !== null) {
44+
if ("<?php if (isset($data->hidethemes)) {
45+
echo $data->hidethemes;
46+
}; ?>" == "hide") {
47+
document.querySelector("#nav_theme").remove()
48+
};
49+
};
7650

77-
if (document.querySelector("#nav_backups") !== null) {
78-
if ("<?php if (isset($data->hidebackup)) {
79-
echo $data->hidebackup;
80-
} ?>" == "hide") {
81-
document.querySelector("#nav_backups").remove()
82-
};
83-
};
51+
if (document.querySelector("#nav_plugins") !== null) {
52+
if ("<?php if (isset($data->hideplugin)) {
53+
echo $data->hideplugin;
54+
}; ?>" == "hide") {
55+
document.querySelector("#nav_plugins").remove()
56+
};
57+
};
8458

8559

86-
if (document.querySelector("#nav_i18n_gallery") !== null) {
87-
if ("<?php if (isset($data->hidei18n)) {
88-
echo $data->hidei18n;
89-
}; ?>" == "hide") {
90-
document.querySelector("#nav_i18n_gallery").remove()
91-
};
92-
};
60+
if (document.querySelector("#nav_backups") !== null) {
61+
if ("<?php if (isset($data->hidebackup)) {
62+
echo $data->hidebackup;
63+
} ?>" == "hide") {
64+
document.querySelector("#nav_backups").remove()
65+
};
66+
};
9367

94-
if (document.querySelector(".support") !== null) {
95-
if ("<?php if (isset($data->hidesupport)) {
96-
echo $data->hidesupport;
97-
}; ?>" == "hide") {
98-
document.querySelector(".support").remove()
99-
};
100-
};
10168

102-
if (document.querySelector('#sb_massiveAdmin') !== null) {
103-
if ("<?php if (isset($data->hidesettings)) {
104-
echo $data->hidesettings;
105-
}; ?>" == "hide") {
69+
if (document.querySelector("#nav_i18n_gallery") !== null) {
70+
if ("<?php if (isset($data->hidei18n)) {
71+
echo $data->hidei18n;
72+
}; ?>" == "hide") {
73+
document.querySelector("#nav_i18n_gallery").remove()
74+
};
75+
};
10676

107-
if (document.querySelector('#pages') == null) {
108-
document.querySelectorAll(' .snav #sb_massiveAdmin').forEach(x => {
109-
x.remove();
110-
});
111-
};
77+
if (document.querySelector(".support") !== null) {
78+
if ("<?php if (isset($data->hidesupport)) {
79+
echo $data->hidesupport;
80+
}; ?>" == "hide") {
81+
document.querySelector(".support").remove()
82+
};
83+
};
11284

113-
};
114-
};
85+
if (document.querySelector('#sb_massiveAdmin') !== null) {
86+
if ("<?php if (isset($data->hidesettings)) {
87+
echo $data->hidesettings;
88+
}; ?>" == "hide") {
11589

116-
if (document.querySelector(`a[href="settings.php#profile"]`) !== null) {
117-
if ("<?php if (isset($data->hidesettings)) {
118-
echo $data->hidesettings;
119-
}; ?>" == "hide") {
120-
document.querySelector('a[href="settings.php#profile"]').remove()
121-
};
90+
if (document.querySelector('#pages') == null) {
91+
document.querySelectorAll(' .snav #sb_massiveAdmin').forEach(x => {
92+
x.remove();
93+
});
12294
};
12395

12496
};
97+
};
12598

126-
127-
});
99+
if (document.querySelector(`a[href="settings.php#profile"]`) !== null) {
100+
if ("<?php if (isset($data->hidesettings)) {
101+
echo $data->hidesettings;
102+
}; ?>" == "hide") {
103+
document.querySelector('a[href="settings.php#profile"]').remove()
104+
};
105+
};
128106
</script>

0 commit comments

Comments
 (0)