-
Notifications
You must be signed in to change notification settings - Fork 36
/
modules.php
154 lines (128 loc) · 7.89 KB
/
modules.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
<?php
$importXml = new \LanSuite\XML();
$installImport = new \LanSuite\Module\Install\Import($importXml);
$install = new \LanSuite\Module\Install\Install($installImport);
switch ($_GET["step"]) {
// Update Modules
case 2:
$res = $db->qry("SELECT name, reqphp, reqmysql FROM %prefix%modules WHERE changeable");
while ($row = $db->fetch_array($res)) {
if ($_POST[$row["name"]]) {
if ($row['reqphp'] and version_compare(phpversion(), $row['reqphp']) < 0) {
$func->information(t('Das Modul %1 kann nicht aktiviert werden, da die PHP Version %2 benötigt wird', $row["name"], $row['reqphp']), NO_LINK);
} else {
$db->qry_first("UPDATE %prefix%modules SET active = 1 WHERE name = %string%", $row["name"]);
}
} elseif (count($_POST)) {
$db->qry_first("UPDATE %prefix%modules SET active = 0 WHERE name = %string%", $row["name"]);
}
}
$db->free_result($res);
$db->qry_first("UPDATE %prefix%modules SET active = 1 WHERE name = 'settings'");
$db->qry_first("UPDATE %prefix%modules SET active = 1 WHERE name = 'banner'");
$db->qry_first("UPDATE %prefix%modules SET active = 1 WHERE name = 'about'");
$install->CreateNewTables(0);
$func->confirmation(t('Änderungen erfolgreich gespeichert.'), "index.php?mod=install&action=modules");
break;
// Question: Reset all Modules
case 3:
$func->question(t('Sollen wirklich <b>\'alle Module\'</b> zurückgesetzt werden?' . HTML_NEWLINE . ' Dies wirkt sich <u>nicht</u> auf die Datenbankeinträge der Module aus, jedoch gehen alle Einstellungen und Menüänderungen verloren, die zu den Modulen getätigt worden sind. Außerdem sind danach nur noch die Standardmodule aktiviert.'), "index.php?mod=install&action=modules&rewrite=all", "index.php?mod=install&action=modules");
break;
// Question: Reset this Module
case 4:
$func->question(t('Soll das Modul <b>\'%1\'</b> wirklich zurückgesetzt werden?<br />Dies wirkt sich <u>nicht</u> auf die Datenbankeinträge des Modules aus, jedoch gehen alle Einstellungen und Menüänderungen verloren, die zu diesem Modul getätigt worden sind.', $_GET["module"]), "index.php?mod=install&action=modules&rewrite={$_GET["module"]}", "index.php?mod=install&action=modules");
break;
// Add Menuentry
case 22:
$db->qry("INSERT INTO %prefix%menu SET caption = 'Neuer Eintrag', requirement = '0', hint = '', link = 'index.php?mod=', needed_config = '', module=%string%, level = 1", $_GET["module"]);
// Menuentries
case 20:
$db->qry("DELETE FROM %prefix%menu WHERE caption='' AND action='' AND file=''");
$dsp->NewContent(t('Modul-Menüeinträge'), t('Hier kannst du die Navigationseinträge dieses Moduls ändern.'));
$dsp->SetForm("index.php?mod=install&action=modules&step=21&module={$_GET["module"]}");
$dsp->AddFieldsetStart(t('Hauptmenüpunkt des Moduls / Modul-Startseite'));
$res = $db->qry("SELECT * FROM %prefix%menu WHERE module=%string% AND level = 0 AND caption != '' ORDER BY requirement, pos", $_GET["module"]);
WriteMenuEntries();
$dsp->AddFieldsetEnd();
$dsp->AddFieldsetStart(t('Untermenüpunkte'));
$res = $db->qry("SELECT * FROM %prefix%menu WHERE module=%string% AND level > 0 AND caption != '' ORDER BY requirement, pos", $_GET["module"]);
WriteMenuEntries();
$dsp->AddFieldsetEnd();
$dsp->AddFieldsetStart(t('Keine Menüpunkte - Interne Verweise'));
$res = $db->qry("SELECT * FROM %prefix%menu WHERE module=%string% AND caption = '' ORDER BY requirement, pos", $_GET["module"]);
WriteMenuEntries();
$dsp->AddFieldsetEnd();
$dsp->AddDoubleRow("", "<a href=\"index.php?mod=install&action=modules&module={$_GET["module"]}&step=22\">".t('Neuen Menüeintrag hinzufügen')."</a>");
$dsp->AddFormSubmitRow(t('Weiter'));
break;
// Change Menuentries
case 21:
foreach ($_POST["caption"] as $key => $val) {
$db->qry(
"UPDATE %prefix%menu SET caption = %string%, requirement = %string%, action = %string%, hint = %string%, link = %string%, file = %string%, pos = %string%, boxid = %int%, needed_config = %string% WHERE id = %int%",
$_POST["caption"][$key],
$_POST["requirement"][$key],
$_POST["action"][$key],
$_POST["hint"][$key],
$_POST["link"][$key],
$_POST["file"][$key],
$_POST["pos"][$key],
$_POST["boxid"][$key],
$_POST["needed_config"][$key],
$key
);
}
$func->confirmation(t('Änderungen erfolgreich gespeichert.'), "index.php?mod=install&action=modules&step=20&module={$_GET["module"]}");
break;
// Delete Menuentry
case 23:
$row = $db->qry_first("SELECT requirement FROM %prefix%menu WHERE id=%int%", $_GET["id"]);
if ($row['requirement'] > 0) {
$func->information(t('Mit diesem Eintrag ist eine Zugriffsberechtigung verknüpft. Du solltest diesen Eintrag daher nicht löschen, da sonst jeder Zugriff auf die betreffende Datei hat.' . HTML_NEWLINE . 'Wenn du nur den Menülink entfernen möchten, lösche die Felder Titel und Linkziel.' . HTML_NEWLINE . 'Wenn du wirklich jedem Zugriff auf die Datei geben möchten, setze den Zugriff auf Jeder und lösche dann den Eintrag.'), "index.php?mod=install&action=modules&step=20&module={$_GET["module"]}");
} else {
$db->qry("DELETE FROM %prefix%menu WHERE id=%int%", $_GET["id"]);
$func->confirmation(t('Der Menü-Eintrag wurde erfolgreich gelöscht'), "index.php?mod=install&action=modules&step=20&module={$_GET["module"]}");
}
break;
// Show Modulelist
default:
// If Rewrite, delete corresponding items
$rewrite_all = 0;
if ($_GET["rewrite"] == "all") {
$db->qry("TRUNCATE TABLE %prefix%config");
$db->qry("TRUNCATE TABLE %prefix%modules");
$db->qry("TRUNCATE TABLE %prefix%menu");
$rewrite_all = 1;
} elseif ($_GET["rewrite"]) {
$db->qry("DELETE FROM %prefix%modules WHERE name = %string%", $_GET["rewrite"]);
$db->qry("DELETE FROM %prefix%menu WHERE module = %string%", $_GET["rewrite"]);
$db->qry("DELETE FROM %prefix%boxes WHERE module = %string%", $_GET["rewrite"]);
$_GET["rewrite"] .= "_";
if ($_GET["rewrite"] == "downloads_") {
$_GET["rewrite"] = "Download";
}
if ($_GET["rewrite"] == "usrmgr_") {
$_GET["rewrite"] = "Userdetails";
}
if ($_GET["rewrite"] == "tournament2_") {
$_GET["rewrite"] = "t";
}
$find_config = $db->qry_first("DELETE FROM %prefix%config WHERE (cfg_group = %string%) OR (cfg_key LIKE %string%)", $_GET["rewrite"], $_GET["rewrite"].'%');
}
// Auto-Load Modules from XML-Files
$install->InsertModules(0);
$install->InsertMenus($rewrite_all);
// Output Module-List
$dsp->NewContent(t('Modulverwaltung'), t('Hier kannst du Module de-/aktivieren, sowie deren Einstellungen verändern.'));
$dsp->AddDoubleRow("", "<a href=\"index.php?mod=install&action=modules&step=3\">".t('Alle Module zurücksetzen')."</a>");
$dsp->AddHRuleRow();
$dsp->SetForm("index.php?mod=install&action=modules&step=2");
$res = $db->qry("SELECT * FROM %prefix%modules ORDER BY changeable DESC, caption");
while ($row = $db->fetch_array($res)) {
$dsp->AddContentLine($install->getModConfigLine($row));
}
$db->free_result($res);
$dsp->AddFormSubmitRow(t('Weiter'));
$dsp->AddBackButton("index.php?mod=install", "install/modules");
break;
}