diff --git a/plugins/fk-disable.php b/plugins/fk-disable.php new file mode 100644 index 00000000..bd11866b --- /dev/null +++ b/plugins/fk-disable.php @@ -0,0 +1,53 @@ +deleteAllBetween($beginning, $end, str_replace($textToDelete, '', $string)); // recursion to ensure all occurrences are replaced + } + + public function head(){ + if (!isset($_GET['sql'])) { + return; + } + + $query = trim($_POST['query']); + + if($_POST['fk_disable']){ + if($query) { + $query = trim($this->deleteAllBetween("-- FK:D0", "-- FK:D1", $query)); + $_POST['query'] = "-- FK:D0\nSET FOREIGN_KEY_CHECKS=0;\n-- FK:D1\n\n{$query}\n\n-- FK:D0\nSET FOREIGN_KEY_CHECKS=1;\n-- FK:D1"; + } + $fk_disable_checked = ($_POST['fk_disable']) ? 'checked="checked"' : ""; + } + + ?> + + type="text/javascript"> + + function domReady(fn) { + document.addEventListener("DOMContentLoaded", fn); + if (document.readyState === "interactive" || document.readyState === "complete" ) { + fn(); + } + } + + domReady(() => { + document.querySelectorAll('#form p')[1].insertAdjacentHTML('beforeend', '') + }) + + +