Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Introduce queries_redirect function

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1190 7c3ca157-0c34-0410-bff1-cbf682f78f5c
  • Loading branch information...
commit dbdd40a19cabc2682d1ca627098dd144cae67877 1 parent 50881f8
jakubvrana authored
View
2  adminer/database.inc.php
@@ -27,7 +27,7 @@
if (!$row) {
queries("DROP DATABASE " . idf_escape(DB));
}
- query_redirect(queries(), preg_replace('~db=[^&]*&~', '', ME) . "db=" . urlencode($_POST["name"]), lang('Database has been renamed.'), !$row, false, $row);
+ queries_redirect(preg_replace('~db=[^&]*&~', '', ME) . "db=" . urlencode($_POST["name"]), lang('Database has been renamed.'), !$row);
}
} else {
// alter database
View
2  adminer/db.inc.php
@@ -33,7 +33,7 @@
}
}
}
- query_redirect(queries(), substr(ME, 0, -1), $message, $result, false, !$result);
+ queries_redirect(substr(ME, 0, -1), $message, $result);
}
page_header(lang('Database') . ": " . h(DB), $error, false);
View
2  adminer/include/editing.inc.php
@@ -282,7 +282,7 @@ function drop_create($drop, $create, $location, $message_drop, $message_alter, $
}
$dropped = strlen($name) && ($_POST["dropped"] || queries($drop));
$created = queries($create);
- if (!query_redirect(queries(), $location, (strlen($name) ? $message_alter : $message_create), $created, false, !$created) && $dropped) {
+ if (!queries_redirect($location, (strlen($name) ? $message_alter : $message_create), $created) && $dropped) {
$_SESSION["messages"][] = $message_drop;
}
return $dropped;
View
9 adminer/include/functions.inc.php
@@ -252,6 +252,15 @@ function queries($query = null) {
return $connection->query($query);
}
+/** Redirect by remembered queries
+* @param string
+* @param string
+* @param bool
+*/
+function queries_redirect($location, $message, $redirect) {
+ return query_redirect(queries(), $location, $message, $redirect, false, !$redirect);
+}
+
/** Remove parameter from query string
* @param string
* @return string
View
2  adminer/processlist.inc.php
@@ -6,7 +6,7 @@
$killed++;
}
}
- query_redirect(queries(), ME . "processlist=", lang('%d process(es) have been killed.', $killed), $killed || !$_POST["kill"], false, !$killed && $_POST["kill"]);
+ queries_redirect(ME . "processlist=", lang('%d process(es) have been killed.', $killed), $killed || !$_POST["kill"]);
}
page_header(lang('Process list'), $error);
View
4 adminer/select.inc.php
@@ -85,7 +85,7 @@
}
}
}
- query_redirect(queries(), remove_from_uri("page"), lang('%d item(s) have been affected.', $affected), $result, false, !$result);
+ queries_redirect(remove_from_uri("page"), lang('%d item(s) have been affected.', $affected), $result);
//! display edit page in case of an error
} elseif (is_string($file = get_file("csv_file", true))) {
$file = preg_replace("~^\xEF\xBB\xBF~", '', $file); //! character set
@@ -111,7 +111,7 @@
}
}
}
- query_redirect(queries(), remove_from_uri("page"), lang('%d row(s) have been imported.', $affected), $result, false, !$result);
+ queries_redirect(remove_from_uri("page"), lang('%d row(s) have been imported.', $affected), $result);
} else {
$error = upload_error($file);
}
View
2  adminer/user.inc.php
@@ -91,7 +91,7 @@
}
}
}
- query_redirect(queries(), ME . "privileges=", (isset($_GET["host"]) ? lang('User has been altered.') : lang('User has been created.')), !$error, false, $error);
+ queries_redirect(ME . "privileges=", (isset($_GET["host"]) ? lang('User has been altered.') : lang('User has been created.')), !$error);
if ($old_user != $new_user) {
// delete new user in case of an error
$connection->query("DROP USER $new_user");
Please sign in to comment.
Something went wrong with that request. Please try again.