Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 310 lines (294 sloc) 13.795 kb
667bfec Decomposition
jakubvrana authored
1 <?php
116faf2 Mass delete
jakubvrana authored
2 $table_status = table_status($_GET["select"]);
3 $indexes = indexes($_GET["select"]);
ffcea8b Rights
jakubvrana authored
4 $fields = fields($_GET["select"]);
64ba924 Comments
jakubvrana authored
5 $rights = array(); // privilege => 0
6 $columns = array(); // selectable columns
02a851c Shorten texts in PHP
jakubvrana authored
7 unset($text_length);
ffcea8b Rights
jakubvrana authored
8 foreach ($fields as $key => $field) {
c64c4fd Adminer class
jakubvrana authored
9 $name = $adminer->fieldName($field);
116c873 Ignore tables and fields with empty name
jakubvrana authored
10 if (isset($field["privileges"]["select"]) && strlen($name)) {
1e4d11e Select from foreign keys in Editor
jakubvrana authored
11 $columns[$key] = html_entity_decode(strip_tags($name));
5abd943 Change simple preg_match to ereg
jakubvrana authored
12 if (ereg('text|blob', $field["type"])) {
d24ad78 Select boxes customization
jakubvrana authored
13 $text_length = $adminer->selectLengthProcess();
16c4ddb Single faster POST query with primary key
jakubvrana authored
14 }
ffcea8b Rights
jakubvrana authored
15 }
430034c Cottage homework
jakubvrana authored
16 $rights += $field["privileges"];
17 }
18
d24ad78 Select boxes customization
jakubvrana authored
19 list($select, $group) = $adminer->selectColumnsProcess($columns, $indexes);
07e1ae1 FOUND_ROWS only with GROUP BY
jakubvrana authored
20 $where = $adminer->selectSearchProcess($fields, $indexes);
21 $order = $adminer->selectOrderProcess($fields, $indexes);
d24ad78 Select boxes customization
jakubvrana authored
22 $limit = $adminer->selectLimitProcess();
4c736a0 Use group by in export
jakubvrana authored
23 $from = ($select ? implode(", ", $select) : "*") . " FROM " . idf_escape($_GET["select"]) . ($where ? " WHERE " . implode(" AND ", $where) : "");
24 $group_by = ($group && count($group) < count($select) ? " GROUP BY " . implode(", ", $group) : "") . ($order ? " ORDER BY " . implode(", ", $order) : "");
116faf2 Mass delete
jakubvrana authored
25
26 if ($_POST && !$error) {
56948c9 $_POST[check] may be empty
jakubvrana authored
27 $where_check = "(" . implode(") OR (", array_map('where_check', (array) $_POST["check"])) . ")";
a3d2266 Order by first index in Editor by default
jakubvrana authored
28 $primary = ($indexes["PRIMARY"] ? ($select ? array_flip($indexes["PRIMARY"]["columns"]) : array()) : null); // empty array means that all primary fields are selected
d24ad78 Select boxes customization
jakubvrana authored
29 foreach ($select as $key => $val) {
30 $val = $_GET["columns"][$key];
31 if (!$val["fun"]) {
32 unset($primary[$val["col"]]);
33 }
34 }
78639a9 Function results in edit
jakubvrana authored
35 if ($_POST["export"]) {
9890b6c Export Output in select.inc.php
jakubvrana authored
36 dump_headers($_GET["select"]);
f48161b CSV Byte-order-mark
jakubvrana authored
37 dump_table($_GET["select"], "");
e4f5d17 Dump column names in CSV select export
jakubvrana authored
38 if ($_POST["format"] != "sql") { // Editor doesn't send format
39 dump_csv($select ? $select : array_keys($fields));
40 }
16c4ddb Single faster POST query with primary key
jakubvrana authored
41 if (!is_array($_POST["check"]) || $primary === array()) {
42 dump_data($_GET["select"], "INSERT", "SELECT $from" . (is_array($_POST["check"]) ? ($where ? " AND " : " WHERE ") . "($where_check)" : "") . $group_by);
43 } else {
fa5c952 Use extended INSERT in select export
jakubvrana authored
44 $union = array();
f7452ad Import and export
jakubvrana authored
45 foreach ($_POST["check"] as $val) {
16c4ddb Single faster POST query with primary key
jakubvrana authored
46 // where is not unique so OR can't be used
c16c57b E-mail sending
jakubvrana authored
47 $union[] = "(SELECT $from " . ($where ? "AND " : "WHERE ") . where_check($val) . $group_by . " LIMIT 1)";
116faf2 Mass delete
jakubvrana authored
48 }
fa5c952 Use extended INSERT in select export
jakubvrana authored
49 dump_data($_GET["select"], "INSERT", implode(" UNION ALL ", $union));
116faf2 Mass delete
jakubvrana authored
50 }
25f01d3 Compress export and import
jakubvrana authored
51 dump();
78639a9 Function results in edit
jakubvrana authored
52 exit;
53 }
1a6a73a Rename selectExtra to selectEmail
jakubvrana authored
54 if (!$adminer->selectEmailProcess($where)) {
00d9b36 E-mail sending only in Editor
jakubvrana authored
55 if (!$_POST["import"]) { // edit
56 $result = true;
57 $affected = 0;
58 $command = ($_POST["delete"] ? ($_POST["all"] && !$where ? "TRUNCATE " : "DELETE FROM ") : ($_POST["clone"] ? "INSERT INTO " : "UPDATE ")) . idf_escape($_GET["select"]);
28b2b8d Readable variable initialization
jakubvrana authored
59 $set = array();
00d9b36 E-mail sending only in Editor
jakubvrana authored
60 if (!$_POST["delete"]) {
61 foreach ($columns as $name => $val) { //! should check also for edit or insert privileges
a0def47 Date localization
jakubvrana authored
62 $val = process_input($fields[$name]);
00d9b36 E-mail sending only in Editor
jakubvrana authored
63 if ($_POST["clone"]) {
64 $set[] = ($val !== false ? $val : idf_escape($name));
65 } elseif ($val !== false) {
66 $set[] = idf_escape($name) . " = $val";
67 }
e7eb28d CSV import
jakubvrana authored
68 }
00d9b36 E-mail sending only in Editor
jakubvrana authored
69 $command .= ($_POST["clone"] ? "\nSELECT " . implode(", ", $set) . "\nFROM " . idf_escape($_GET["select"]) : " SET\n" . implode(",\n", $set));
e7eb28d CSV import
jakubvrana authored
70 }
00d9b36 E-mail sending only in Editor
jakubvrana authored
71 if ($_POST["delete"] || $set) {
72 if ($_POST["all"] || ($primary === array() && $_POST["check"])) {
73 $result = queries($command . ($_POST["all"] ? ($where ? "\nWHERE " . implode(" AND ", $where) : "") : "\nWHERE $where_check"));
74 $affected = $dbh->affected_rows;
75 } else {
76 foreach ((array) $_POST["check"] as $val) {
77 // where is not unique so OR can't be used
988a29f Don't use aggregation functions in unique_idf
jakubvrana authored
78 $result = queries($command . "\nWHERE " . where_check($val) . (count($group) < count($select) ? "" : "\nLIMIT 1"));
00d9b36 E-mail sending only in Editor
jakubvrana authored
79 if (!$result) {
80 break;
81 }
82 $affected += $dbh->affected_rows;
38059b6 Remove empty if
jakubvrana authored
83 }
e7eb28d CSV import
jakubvrana authored
84 }
78639a9 Function results in edit
jakubvrana authored
85 }
00d9b36 E-mail sending only in Editor
jakubvrana authored
86 query_redirect(queries(), remove_from_uri("page"), lang('%d item(s) have been affected.', $affected), $result, false, !$result);
87 //! display edit page in case of an error
25f01d3 Compress export and import
jakubvrana authored
88 } elseif (is_string($file = get_file("csv_file", true))) {
00d9b36 E-mail sending only in Editor
jakubvrana authored
89 $file = preg_replace("~^\xEF\xBB\xBF~", '', $file); //! character set
cb370a8 Respect max_allowed_packet in CSV import
jakubvrana authored
90 $affected = 0;
91 $length = 0;
92 $result = true;
93 $query = "INSERT INTO " . idf_escape($_GET["select"]);
94 $packet_size = $dbh->result($dbh->query("SELECT @@max_allowed_packet"));
95 $rows = array();
96 preg_match_all('~("[^"]*"|[^"\\n])+~', $file, $matches);
00d9b36 E-mail sending only in Editor
jakubvrana authored
97 foreach ($matches[0] as $key => $val) {
98 $row = array();
cb370a8 Respect max_allowed_packet in CSV import
jakubvrana authored
99 preg_match_all('~(("[^"]*")+|[^,]*),~', "$val,", $matches2);
00d9b36 E-mail sending only in Editor
jakubvrana authored
100 if (!$key && !array_diff($matches2[1], array_keys($fields))) { //! doesn't work with column names containing ",\n
101 // first row corresponds to column names - use it for table structure
cb370a8 Respect max_allowed_packet in CSV import
jakubvrana authored
102 $query .= " (" . implode(", ", array_map('idf_escape', $matches2[1])) . ")";
00d9b36 E-mail sending only in Editor
jakubvrana authored
103 } else {
104 foreach ($matches2[1] as $col) {
105 $row[] = (!strlen($col) ? "NULL" : $dbh->quote(str_replace('""', '"', preg_replace('~^"|"$~', '', $col))));
106 }
cb370a8 Respect max_allowed_packet in CSV import
jakubvrana authored
107 $s = "\n(" . implode(", ", $row) . ")";
108 $length += 1 + strlen($s); // 1 - separator length
109 if ($rows && $length > $packet_size) {
110 $result = queries($query . implode(",", $rows));
111 if (!$result) {
112 break;
113 }
114 $affected += $dbh->affected_rows;
115 $length = strlen($query);
116 $rows = array();
117 }
118 $rows[] = $s;
d83b654 Detect import errors
jakubvrana authored
119 }
cb370a8 Respect max_allowed_packet in CSV import
jakubvrana authored
120 if (!$key) {
121 $query .= " VALUES";
122 $length += strlen($query);
123 }
124 }
125 if ($result) {
126 $result = queries($query . implode(",", $rows));
127 $affected += $dbh->affected_rows;
d83b654 Detect import errors
jakubvrana authored
128 }
cb370a8 Respect max_allowed_packet in CSV import
jakubvrana authored
129 query_redirect(queries(), remove_from_uri("page"), lang('%d row(s) have been imported.', $affected), $result, false, !$result);
00d9b36 E-mail sending only in Editor
jakubvrana authored
130 } else {
131 $error = upload_error($file);
d83b654 Detect import errors
jakubvrana authored
132 }
ec23248 Exportable select
jakubvrana authored
133 }
116faf2 Mass delete
jakubvrana authored
134 }
c16c57b E-mail sending
jakubvrana authored
135
c64c4fd Adminer class
jakubvrana authored
136 page_header(lang('Select') . ": " . $adminer->tableName($table_status), $error);
116faf2 Mass delete
jakubvrana authored
137
98507da Function verify_version doesn't use version parameter
jakubvrana authored
138 $foreign_keys = column_foreign_keys($_GET["select"]);
4099271 Cross links to select and table (bug #2236232)
jakubvrana authored
139 echo "<p>";
430034c Cottage homework
jakubvrana authored
140 if (isset($rights["insert"])) {
98507da Function verify_version doesn't use version parameter
jakubvrana authored
141 $set = "";
142 foreach ((array) $_GET["where"] as $val) {
143 if (count($foreign_keys[$val["col"]]) == 1 && ($val["op"] == "="
144 || ($val["op"] == "" && !ereg('[_%]', $val["val"])) // LIKE in Editor
145 )) {
146 $set .= "&set" . urlencode("[" . bracket_escape($val["col"]) . "]") . "=" . urlencode($val["val"]);
147 }
148 }
149 echo '<a href="' . h(ME . 'edit=' . urlencode($_GET['select']) . $set) . '">' . lang('New item') . '</a> ';
667bfec Decomposition
jakubvrana authored
150 }
c64c4fd Adminer class
jakubvrana authored
151 echo $adminer->selectLinks($table_status);
667bfec Decomposition
jakubvrana authored
152
ffcea8b Rights
jakubvrana authored
153 if (!$columns) {
689699a Shortcut for htmlspecialchars
jakubvrana authored
154 echo "<p class='error'>" . lang('Unable to select the table') . ($fields ? "" : ": " . h($dbh->error)) . ".\n";
ffcea8b Rights
jakubvrana authored
155 } else {
5ee29cb Select columns, aggregation
jakubvrana authored
156 echo "<form action='' id='form'>\n";
d24ad78 Select boxes customization
jakubvrana authored
157 echo "<div style='display: none;'>";
689699a Shortcut for htmlspecialchars
jakubvrana authored
158 echo (strlen($_GET["server"]) ? '<input type="hidden" name="server" value="' . h($_GET["server"]) . '">' : "");
7b34625 Variable db is not used in Editor
jakubvrana authored
159 echo (strlen($_GET["db"]) ? '<input type="hidden" name="db" value="' . h($_GET["db"]) . '">' : ""); // not used in Editor
689699a Shortcut for htmlspecialchars
jakubvrana authored
160 echo '<input type="hidden" name="select" value="' . h($_GET["select"]) . '">';
d24ad78 Select boxes customization
jakubvrana authored
161 echo "</div>\n";
162 $adminer->selectColumnsPrint($select, $columns);
163 $adminer->selectSearchPrint($where, $columns, $indexes);
164 $adminer->selectOrderPrint($order, $columns, $indexes);
165 $adminer->selectLimitPrint($limit);
166 $adminer->selectLengthPrint($text_length);
167 $adminer->selectActionPrint($text_length);
ffcea8b Rights
jakubvrana authored
168 echo "</form>\n";
169
07e1ae1 FOUND_ROWS only with GROUP BY
jakubvrana authored
170 $query = "SELECT " . (intval($limit) && $group && count($group) < count($select) ? "SQL_CALC_FOUND_ROWS " : "") . $from . $group_by . (strlen($limit) ? " LIMIT " . intval($limit) . (intval($_GET["page"]) ? " OFFSET " . ($limit * $_GET["page"]) : "") : "");
c64c4fd Adminer class
jakubvrana authored
171 echo $adminer->selectQuery($query);
8b74511 Print SQL query (fixes #2082448)
jakubvrana authored
172
5f16c75 Prepare for version 2
jakubvrana authored
173 $result = $dbh->query($query);
21ea4ae Check errors
jakubvrana authored
174 if (!$result) {
689699a Shortcut for htmlspecialchars
jakubvrana authored
175 echo "<p class='error'>" . h($dbh->error) . "\n";
ffcea8b Rights
jakubvrana authored
176 } else {
f2365d0 Typo
jakubvrana authored
177 $email_fields = array();
e7eb28d CSV import
jakubvrana authored
178 echo "<form action='' method='post' enctype='multipart/form-data'>\n";
21ea4ae Check errors
jakubvrana authored
179 if (!$result->num_rows) {
ace55ed HTML instead of XHTML
jakubvrana authored
180 echo "<p class='message'>" . lang('No rows.') . "\n";
21ea4ae Check errors
jakubvrana authored
181 } else {
ba90d60 Introduce adminer_select_val
jakubvrana authored
182 $rows = array();
183 while ($row = $result->fetch_assoc()) {
184 $rows[] = $row;
185 }
4cdc459 FOUND_ROWS works with last SELECT
jakubvrana authored
186 // use count($rows) without LIMIT, COUNT(*) without grouping, FOUND_ROWS otherwise (slowest)
07e1ae1 FOUND_ROWS only with GROUP BY
jakubvrana authored
187 $found_rows = (intval($limit) && $group && count($group) < count($select)
4cdc459 FOUND_ROWS works with last SELECT
jakubvrana authored
188 ? $dbh->result($dbh->query(" SELECT FOUND_ROWS()")) // space to allow mysql.trace_mode
189 : count($rows)
190 );
ba90d60 Introduce adminer_select_val
jakubvrana authored
191
c64c4fd Adminer class
jakubvrana authored
192 $descriptions = $adminer->rowDescriptions($rows, $foreign_keys);
21ea4ae Check errors
jakubvrana authored
193
c64c4fd Adminer class
jakubvrana authored
194 $backward_keys = $adminer->backwardKeys($_GET["select"]);
dc4fcf4 PHP 4 compatibility
jakubvrana authored
195 $table_names = array();
196 if ($backward_keys) {
197 foreach ($backward_keys as $key => $val) {
198 $val = $adminer->tableName(table_status($key));
199 if (strlen($val)) {
200 $table_names[$key] = $val;
201 }
202 }
336f521 Get table names of backward keys only once
jakubvrana authored
203 }
c42c46a Table relations
jakubvrana authored
204
bcff025 Click on row selects it (fixes #2844098)
jakubvrana authored
205 echo "<table cellspacing='0' class='nowrap' onclick='table_click(event);'>\n";
ba90d60 Introduce adminer_select_val
jakubvrana authored
206 echo "<thead><tr><td><input type='checkbox' id='all-page' onclick='form_check(this, /check/);'>";
5034123 Apply field name with functions
jakubvrana authored
207 $names = array();
208 reset($select);
23df820 Distinguish no column order in fieldName
jakubvrana authored
209 $order = 1;
ba90d60 Introduce adminer_select_val
jakubvrana authored
210 foreach ($rows[0] as $key => $val) {
5034123 Apply field name with functions
jakubvrana authored
211 $val = $_GET["columns"][key($select)];
ba9c9a5 Display SQL function with braces in select heading
jakubvrana authored
212 $field = $fields[$select ? $val["col"] : $key];
6c97b80 Display only first five columns in Editor example
jakubvrana authored
213 $name = ($field ? $adminer->fieldName($field, $order) : "*");
116c873 Ignore tables and fields with empty name
jakubvrana authored
214 if (strlen($name)) {
6c97b80 Display only first five columns in Editor example
jakubvrana authored
215 $order++;
5034123 Apply field name with functions
jakubvrana authored
216 $names[$key] = $name;
689699a Shortcut for htmlspecialchars
jakubvrana authored
217 echo '<th><a href="' . h(remove_from_uri('(order|desc)[^=]*') . '&order%5B0%5D=' . urlencode($key) . ($_GET["order"] == array($key) && !$_GET["desc"][0] ? '&desc%5B0%5D=1' : '')) . '">' . apply_sql_function($val["fun"], $name) . "</a>"; //! columns looking like functions
116c873 Ignore tables and fields with empty name
jakubvrana authored
218 }
5034123 Apply field name with functions
jakubvrana authored
219 next($select);
ba90d60 Introduce adminer_select_val
jakubvrana authored
220 }
8f525c4 Hide empty table names in Relations
jakubvrana authored
221 echo ($table_names ? "<th>" . lang('Relations') : "") . "</thead>\n";
228e43a Row descriptions in select
jakubvrana authored
222 foreach ($descriptions as $n => $row) {
988a29f Don't use aggregation functions in unique_idf
jakubvrana authored
223 $unique_idf = implode('&amp;', unique_idf($rows[$n], $indexes));
12c042c Function htmlspecialchars now uses ENT_QUOTES
jakubvrana authored
224 echo "<tr" . odd() . "><td><input type='checkbox' name='check[]' value='$unique_idf' onclick=\"this.form['all'].checked = false; form_uncheck('all-page');\">" . (count($select) != count($group) || information_schema($_GET["db"]) ? '' : " <a href='" . h(ME) . "edit=" . urlencode($_GET['select']) . "&amp;$unique_idf'>" . lang('edit') . "</a>");
21ea4ae Check errors
jakubvrana authored
225 foreach ($row as $key => $val) {
78e49f0 Pass $field to select_val
jakubvrana authored
226 if (isset($names[$key])) {
d6e3fc7 Link e-mails
jakubvrana authored
227 if (strlen($val) && (!isset($email_fields[$key]) || strlen($email_fields[$key]))) {
5034123 Apply field name with functions
jakubvrana authored
228 $email_fields[$key] = (is_email($val) ? $names[$key] : ""); //! filled e-mails may be contained on other pages
116c873 Ignore tables and fields with empty name
jakubvrana authored
229 }
5911cf1 Always call select_val
jakubvrana authored
230 $link = "";
a0def47 Date localization
jakubvrana authored
231 $val = $adminer->editVal($val, $fields[$key]);
116c873 Ignore tables and fields with empty name
jakubvrana authored
232 if (!isset($val)) {
233 $val = "<i>NULL</i>";
21ea4ae Check errors
jakubvrana authored
234 } else {
97b8c7b Display images in Editor
jakubvrana authored
235 if (ereg('blob|binary', $fields[$key]["type"]) && strlen($val)) {
98507da Function verify_version doesn't use version parameter
jakubvrana authored
236 $link = h(ME . 'download=' . urlencode($_GET["select"]) . '&field=' . urlencode($key) . '&') . $unique_idf;
97b8c7b Display images in Editor
jakubvrana authored
237 }
116c873 Ignore tables and fields with empty name
jakubvrana authored
238 if (!strlen(trim($val, " \t"))) {
239 $val = "&nbsp;";
97b8c7b Display images in Editor
jakubvrana authored
240 } elseif (strlen($text_length) && ereg('blob|text', $fields[$key]["type"]) && is_utf8($val)) {
35c8c6b Respect zero text length
jakubvrana authored
241 $val = nl2br(shorten_utf8($val, max(0, intval($text_length)))); // usage of LEFT() would reduce traffic but complicate query
116c873 Ignore tables and fields with empty name
jakubvrana authored
242 } else {
689699a Shortcut for htmlspecialchars
jakubvrana authored
243 $val = nl2br(h($val));
21ea4ae Check errors
jakubvrana authored
244 }
116c873 Ignore tables and fields with empty name
jakubvrana authored
245
db46fc2 Maintain insert prefill value
jakubvrana authored
246 if (!$link) { // link related items
247 foreach ((array) $foreign_keys[$key] as $foreign_key) {
248 if (count($foreign_keys[$key]) == 1 || count($foreign_key["source"]) == 1) {
249 foreach ($foreign_key["source"] as $i => $source) {
250 $link .= where_link($i, $foreign_key["target"][$i], $rows[$n][$source]);
251 }
252 $link = h((strlen($foreign_key["db"]) ? preg_replace('~([?&]db=)[^&]+~', '\\1' . urlencode($foreign_key["db"]), ME) : ME) . 'select=' . urlencode($foreign_key["table"]) . $link); // InnoDB supports non-UNIQUE keys
253 break;
116c873 Ignore tables and fields with empty name
jakubvrana authored
254 }
21ea4ae Check errors
jakubvrana authored
255 }
ffcea8b Rights
jakubvrana authored
256 }
fa3dd55 Parent
jakubvrana authored
257 }
d6e3fc7 Link e-mails
jakubvrana authored
258 if (!$link && is_email($val)) {
259 $link = "mailto:$val";
260 }
c64c4fd Adminer class
jakubvrana authored
261 $val = $adminer->selectVal($val, $link, $fields[$key]);
116c873 Ignore tables and fields with empty name
jakubvrana authored
262 echo "<td>$val";
667bfec Decomposition
jakubvrana authored
263 }
264 }
8f525c4 Hide empty table names in Relations
jakubvrana authored
265 if ($table_names) {
c42c46a Table relations
jakubvrana authored
266 echo "<td>";
8f525c4 Hide empty table names in Relations
jakubvrana authored
267 foreach ($table_names as $table => $name) {
268 foreach ($backward_keys[$table] as $columns) {
db46fc2 Maintain insert prefill value
jakubvrana authored
269 $link = ME . 'select=' . urlencode($table);
c42c46a Table relations
jakubvrana authored
270 $i = 0;
271 foreach ($columns as $column => $val) {
db46fc2 Maintain insert prefill value
jakubvrana authored
272 $link .= where_link($i++, $column, $rows[$n][$val]);
c42c46a Table relations
jakubvrana authored
273 }
db46fc2 Maintain insert prefill value
jakubvrana authored
274 echo " <a href='" . h($link) . "'>$name</a>";
c42c46a Table relations
jakubvrana authored
275 }
276 }
277 }
ba90d60 Introduce adminer_select_val
jakubvrana authored
278 echo "\n";
5ab708a Compact pages
jakubvrana authored
279 }
21ea4ae Check errors
jakubvrana authored
280 echo "</table>\n";
e4b188c Display found rows
jakubvrana authored
281
4cdc459 FOUND_ROWS works with last SELECT
jakubvrana authored
282 if (intval($limit) && count($group) >= count($select)) {
283 // slow with big tables
284 ob_flush();
285 flush();
286 $found_rows = $dbh->result($dbh->query("SELECT COUNT(*) FROM " . idf_escape($_GET["select"]) . ($where ? " WHERE " . implode(" AND ", $where) : "")));
287 }
e4b188c Display found rows
jakubvrana authored
288 echo "<p>";
289 if (intval($limit) && $found_rows > $limit) {
64ba924 Comments
jakubvrana authored
290 // display first, previous 3, next 3 and last page
21ea4ae Check errors
jakubvrana authored
291 $max_page = floor(($found_rows - 1) / $limit);
c565c54 Let pagination function return
jakubvrana authored
292 echo lang('Page') . ":" . pagination(0) . ($_GET["page"] > 3 ? " ..." : "");
21ea4ae Check errors
jakubvrana authored
293 for ($i = max(1, $_GET["page"] - 2); $i < min($max_page, $_GET["page"] + 3); $i++) {
c565c54 Let pagination function return
jakubvrana authored
294 echo pagination($i);
21ea4ae Check errors
jakubvrana authored
295 }
c565c54 Let pagination function return
jakubvrana authored
296 echo ($_GET["page"] + 3 < $max_page ? " ..." : "") . pagination($max_page);
5ab708a Compact pages
jakubvrana authored
297 }
ace55ed HTML instead of XHTML
jakubvrana authored
298 echo " (" . lang('%d row(s)', $found_rows) . ') <label><input type="checkbox" name="all" value="1">' . lang('whole result') . "</label>\n";
8b74511 Print SQL query (fixes #2082448)
jakubvrana authored
299
3c860b7 Name Edit button on select.inc.php
jakubvrana authored
300 echo (information_schema($_GET["db"]) ? "" : "<fieldset><legend>" . lang('Edit') . "</legend><div><input type='submit' name='edit' value='" . lang('Edit') . "'> <input type='submit' name='clone' value='" . lang('Clone') . "'> <input type='submit' name='delete' value='" . lang('Delete') . "'$confirm></div></fieldset>\n");
25f01d3 Compress export and import
jakubvrana authored
301 echo "<fieldset><legend>" . lang('Export') . "</legend><div>$dump_output $dump_format $dump_compress <input type='submit' name='export' value='" . lang('Export') . "'></div></fieldset>\n";
667bfec Decomposition
jakubvrana authored
302 }
ace55ed HTML instead of XHTML
jakubvrana authored
303 echo "<fieldset><legend>" . lang('CSV Import') . "</legend><div><input type='hidden' name='token' value='$token'><input type='file' name='csv_file'> <input type='submit' name='import' value='" . lang('Import') . "'></div></fieldset>\n";
c16c57b E-mail sending
jakubvrana authored
304
1a6a73a Rename selectExtra to selectEmail
jakubvrana authored
305 $adminer->selectEmailPrint(array_filter($email_fields, 'strlen'));
c16c57b E-mail sending
jakubvrana authored
306
e7eb28d CSV import
jakubvrana authored
307 echo "</form>\n";
667bfec Decomposition
jakubvrana authored
308 }
309 }
Something went wrong with that request. Please try again.