mirror of
https://github.com/vrana/adminer.git
synced 2025-08-26 07:44:37 +02:00
Load long texts for inline-edit by AJAX
Display link to current page only under AJAX
This commit is contained in:
@@ -130,7 +130,7 @@ document.getElementById('username').focus();
|
||||
*/
|
||||
function selectQuery($query) {
|
||||
global $jush;
|
||||
return "<p><a href='" . h(remove_from_uri("page")) . "&page=last' title='" . lang('Page') . ": " . lang('last') . "'>>></a> <code class='jush-$jush'>" . h(str_replace("\n", " ", $query)) . "</code> <a href='" . h(ME) . "sql=" . urlencode($query) . "'>" . lang('Edit') . "</a> <a href='" . h($_SERVER["REQUEST_URI"]) . "'>#</a>\n";
|
||||
return "<p><a href='" . h(remove_from_uri("page")) . "&page=last' title='" . lang('Page') . ": " . lang('last') . "'>>></a> <code class='jush-$jush'>" . h(str_replace("\n", " ", $query)) . "</code> <a href='" . h(ME) . "sql=" . urlencode($query) . "'>" . lang('Edit') . "</a>" . (is_ajax() ? " <a href='" . h($_SERVER["REQUEST_URI"]) . "'>#</a>" : "") . "\n";
|
||||
}
|
||||
|
||||
/** Description of a row in a table
|
||||
|
@@ -10,7 +10,7 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
|
||||
global $LANG, $HTTPS, $adminer, $connection, $drivers;
|
||||
header("Content-Type: text/html; charset=utf-8");
|
||||
$adminer->headers();
|
||||
if ($_SERVER["HTTP_X_REQUESTED_WITH"] != "XMLHttpRequest") {
|
||||
if (!is_ajax()) {
|
||||
$title_all = $title . ($title2 != "" ? ": " . h($title2) : "");
|
||||
$protocol = ($HTTPS ? "https" : "http");
|
||||
?>
|
||||
@@ -81,7 +81,7 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
|
||||
*/
|
||||
function page_footer($missing = "") {
|
||||
global $adminer;
|
||||
if ($_SERVER["HTTP_X_REQUESTED_WITH"] != "XMLHttpRequest") {
|
||||
if (!is_ajax()) {
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -335,6 +335,13 @@ function auth_url($driver, $server, $username) {
|
||||
;
|
||||
}
|
||||
|
||||
/** Find whether it is an AJAX request
|
||||
* @return bool
|
||||
*/
|
||||
function is_ajax() {
|
||||
return ($_SERVER["HTTP_X_REQUESTED_WITH"] == "XMLHttpRequest");
|
||||
}
|
||||
|
||||
/** Send Location header and exit
|
||||
* @param string null to only set a message
|
||||
* @param string
|
||||
@@ -346,7 +353,7 @@ function redirect($location, $message = null) {
|
||||
$_SESSION["messages"][] = $message;
|
||||
}
|
||||
if (isset($location)) {
|
||||
if ($_SERVER["HTTP_X_REQUESTED_WITH"] != "XMLHttpRequest") {
|
||||
if (!is_ajax()) {
|
||||
header("Location: " . ($location != "" ? $location : "."));
|
||||
exit;
|
||||
}
|
||||
|
Reference in New Issue
Block a user