Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 279 lines (263 sloc) 13.092 kb
667bfec4 » jakubvrana
2007-07-02 Decomposition
1 <?php
116faf2e » jakubvrana
2008-01-08 Mass delete
2 $table_status = table_status($_GET["select"]);
3 $indexes = indexes($_GET["select"]);
ffcea8b5 » jakubvrana
2007-07-06 Rights
4 $fields = fields($_GET["select"]);
64ba9242 » jakubvrana
2009-06-21 Comments
5 $rights = array(); // privilege => 0
6 $columns = array(); // selectable columns
02a851c7 » jakubvrana
2007-08-24 Shorten texts in PHP
7 unset($text_length);
ffcea8b5 » jakubvrana
2007-07-06 Rights
8 foreach ($fields as $key => $field) {
c64c4fd1 » jakubvrana
2009-07-27 Adminer class
9 $name = $adminer->fieldName($field);
116c8736 » jakubvrana
2009-07-21 Ignore tables and fields with empty name
10 if (isset($field["privileges"]["select"]) && strlen($name)) {
1e4d11e9 » jakubvrana
2009-07-23 Select from foreign keys in Editor
11 $columns[$key] = html_entity_decode(strip_tags($name));
5abd943c » jakubvrana
2009-07-13 Change simple preg_match to ereg
12 if (ereg('text|blob', $field["type"])) {
d24ad780 » jakubvrana
2009-07-27 Select boxes customization
13 $text_length = $adminer->selectLengthProcess();
16c4ddb4 » jakubvrana
2009-07-13 Single faster POST query with primary key
14 }
ffcea8b5 » jakubvrana
2007-07-06 Rights
15 }
430034c3 » jakubvrana
2007-07-09 Cottage homework
16 $rights += $field["privileges"];
17 }
18
ba9c9a52 » jakubvrana
2009-07-24 Display SQL function with braces in select heading
19 function apply_sql_function($function, $column) {
20 return ($function
d6373d2a » jakubvrana
2009-07-27 Typo (fixes #2827668)
21 ? ($function == "distinct" ? "COUNT(DISTINCT " : strtoupper("$function(")) . "$column)"
ba9c9a52 » jakubvrana
2009-07-24 Display SQL function with braces in select heading
22 : $column
23 );
24 }
25
d24ad780 » jakubvrana
2009-07-27 Select boxes customization
26 list($select, $group) = $adminer->selectColumnsProcess($columns, $indexes);
07e1ae10 » jakubvrana
2009-07-28 FOUND_ROWS only with GROUP BY
27 $where = $adminer->selectSearchProcess($fields, $indexes);
28 $order = $adminer->selectOrderProcess($fields, $indexes);
d24ad780 » jakubvrana
2009-07-27 Select boxes customization
29 $limit = $adminer->selectLimitProcess();
4c736a0a » jakubvrana
2009-06-22 Use group by in export
30 $from = ($select ? implode(", ", $select) : "*") . " FROM " . idf_escape($_GET["select"]) . ($where ? " WHERE " . implode(" AND ", $where) : "");
31 $group_by = ($group && count($group) < count($select) ? " GROUP BY " . implode(", ", $group) : "") . ($order ? " ORDER BY " . implode(", ", $order) : "");
116faf2e » jakubvrana
2008-01-08 Mass delete
32
33 if ($_POST && !$error) {
56948c93 » jakubvrana
2009-07-16 $_POST[check] may be empty
34 $where_check = "(" . implode(") OR (", array_map('where_check', (array) $_POST["check"])) . ")";
a3d2266a » jakubvrana
2009-07-28 Order by first index in Editor by default
35 $primary = ($indexes["PRIMARY"] ? ($select ? array_flip($indexes["PRIMARY"]["columns"]) : array()) : null); // empty array means that all primary fields are selected
d24ad780 » jakubvrana
2009-07-27 Select boxes customization
36 foreach ($select as $key => $val) {
37 $val = $_GET["columns"][$key];
38 if (!$val["fun"]) {
39 unset($primary[$val["col"]]);
40 }
41 }
78639a98 » jakubvrana
2008-10-01 Function results in edit
42 if ($_POST["export"]) {
9890b6c2 » jakubvrana
2008-08-18 Export Output in select.inc.php
43 dump_headers($_GET["select"]);
f48161b4 » jakubvrana
2008-08-18 CSV Byte-order-mark
44 dump_table($_GET["select"], "");
16c4ddb4 » jakubvrana
2009-07-13 Single faster POST query with primary key
45 if (!is_array($_POST["check"]) || $primary === array()) {
46 dump_data($_GET["select"], "INSERT", "SELECT $from" . (is_array($_POST["check"]) ? ($where ? " AND " : " WHERE ") . "($where_check)" : "") . $group_by);
47 } else {
fa5c952a » jakubvrana
2009-06-15 Use extended INSERT in select export
48 $union = array();
f7452add » jakubvrana
2009-04-01 Import and export
49 foreach ($_POST["check"] as $val) {
16c4ddb4 » jakubvrana
2009-07-13 Single faster POST query with primary key
50 // where is not unique so OR can't be used
c16c57b1 » jakubvrana
2009-07-11 E-mail sending
51 $union[] = "(SELECT $from " . ($where ? "AND " : "WHERE ") . where_check($val) . $group_by . " LIMIT 1)";
116faf2e » jakubvrana
2008-01-08 Mass delete
52 }
fa5c952a » jakubvrana
2009-06-15 Use extended INSERT in select export
53 dump_data($_GET["select"], "INSERT", implode(" UNION ALL ", $union));
116faf2e » jakubvrana
2008-01-08 Mass delete
54 }
78639a98 » jakubvrana
2008-10-01 Function results in edit
55 exit;
56 }
1a6a73ad » jakubvrana
2009-07-28 Rename selectExtra to selectEmail
57 if (!$adminer->selectEmailProcess($where)) {
00d9b361 » jakubvrana
2009-07-24 E-mail sending only in Editor
58 if (!$_POST["import"]) { // edit
59 $result = true;
60 $affected = 0;
61 $command = ($_POST["delete"] ? ($_POST["all"] && !$where ? "TRUNCATE " : "DELETE FROM ") : ($_POST["clone"] ? "INSERT INTO " : "UPDATE ")) . idf_escape($_GET["select"]);
62 if (!$_POST["delete"]) {
63 $set = array();
64 foreach ($columns as $name => $val) { //! should check also for edit or insert privileges
a0def479 » jakubvrana
2009-07-27 Date localization
65 $val = process_input($fields[$name]);
00d9b361 » jakubvrana
2009-07-24 E-mail sending only in Editor
66 if ($_POST["clone"]) {
67 $set[] = ($val !== false ? $val : idf_escape($name));
68 } elseif ($val !== false) {
69 $set[] = idf_escape($name) . " = $val";
70 }
e7eb28d3 » jakubvrana
2008-12-30 CSV import
71 }
00d9b361 » jakubvrana
2009-07-24 E-mail sending only in Editor
72 $command .= ($_POST["clone"] ? "\nSELECT " . implode(", ", $set) . "\nFROM " . idf_escape($_GET["select"]) : " SET\n" . implode(",\n", $set));
e7eb28d3 » jakubvrana
2008-12-30 CSV import
73 }
00d9b361 » jakubvrana
2009-07-24 E-mail sending only in Editor
74 if ($_POST["delete"] || $set) {
75 if ($_POST["all"] || ($primary === array() && $_POST["check"])) {
76 $result = queries($command . ($_POST["all"] ? ($where ? "\nWHERE " . implode(" AND ", $where) : "") : "\nWHERE $where_check"));
77 $affected = $dbh->affected_rows;
78 } else {
79 foreach ((array) $_POST["check"] as $val) {
80 // where is not unique so OR can't be used
988a29fc » jakubvrana
2009-07-28 Don't use aggregation functions in unique_idf
81 $result = queries($command . "\nWHERE " . where_check($val) . (count($group) < count($select) ? "" : "\nLIMIT 1"));
00d9b361 » jakubvrana
2009-07-24 E-mail sending only in Editor
82 if (!$result) {
83 break;
84 }
85 $affected += $dbh->affected_rows;
38059b61 » jakubvrana
2009-06-30 Remove empty if
86 }
e7eb28d3 » jakubvrana
2008-12-30 CSV import
87 }
78639a98 » jakubvrana
2008-10-01 Function results in edit
88 }
00d9b361 » jakubvrana
2009-07-24 E-mail sending only in Editor
89 query_redirect(queries(), remove_from_uri("page"), lang('%d item(s) have been affected.', $affected), $result, false, !$result);
90 //! display edit page in case of an error
91 } elseif (is_string($file = get_file("csv_file"))) {
92 $file = preg_replace("~^\xEF\xBB\xBF~", '', $file); //! character set
93 $cols = "";
94 $rows = array(); //! packet size
95 preg_match_all('~("[^"]*"|[^"\\n]+)+~', $file, $matches);
96 foreach ($matches[0] as $key => $val) {
97 $row = array();
98 preg_match_all('~(("[^"]*")+|[^,]*),~', "$val,", $matches2);
99 if (!$key && !array_diff($matches2[1], array_keys($fields))) { //! doesn't work with column names containing ",\n
100 // first row corresponds to column names - use it for table structure
101 $cols = " (" . implode(", ", array_map('idf_escape', $matches2[1])) . ")";
102 } else {
103 foreach ($matches2[1] as $col) {
104 $row[] = (!strlen($col) ? "NULL" : $dbh->quote(str_replace('""', '"', preg_replace('~^"|"$~', '', $col))));
105 }
106 $rows[] = "\n(" . implode(", ", $row) . ")";
d83b6548 » jakubvrana
2009-04-16 Detect import errors
107 }
108 }
00d9b361 » jakubvrana
2009-07-24 E-mail sending only in Editor
109 $result = queries("INSERT INTO " . idf_escape($_GET["select"]) . "$cols VALUES" . implode(",", $rows));
110 query_redirect(queries(), remove_from_uri("page"), lang('%d row(s) has been imported.', $dbh->affected_rows), $result, false, !$result);
111 } else {
112 $error = upload_error($file);
d83b6548 » jakubvrana
2009-04-16 Detect import errors
113 }
ec23248c » jakubvrana
2008-08-16 Exportable select
114 }
116faf2e » jakubvrana
2008-01-08 Mass delete
115 }
c16c57b1 » jakubvrana
2009-07-11 E-mail sending
116
c64c4fd1 » jakubvrana
2009-07-27 Adminer class
117 page_header(lang('Select') . ": " . $adminer->tableName($table_status), $error);
116faf2e » jakubvrana
2008-01-08 Mass delete
118
40992714 » jakubvrana
2009-01-23 Cross links to select and table (bug #2236232)
119 echo "<p>";
430034c3 » jakubvrana
2007-07-09 Cottage homework
120 if (isset($rights["insert"])) {
3d254a33 » jakubvrana
2007-07-15 TODO
121 //! pass search values forth and back
40992714 » jakubvrana
2009-01-23 Cross links to select and table (bug #2236232)
122 echo '<a href="' . htmlspecialchars($SELF) . 'edit=' . urlencode($_GET['select']) . '">' . lang('New item') . '</a> ';
667bfec4 » jakubvrana
2007-07-02 Decomposition
123 }
c64c4fd1 » jakubvrana
2009-07-27 Adminer class
124 echo $adminer->selectLinks($table_status);
667bfec4 » jakubvrana
2007-07-02 Decomposition
125
ffcea8b5 » jakubvrana
2007-07-06 Rights
126 if (!$columns) {
ace55ed1 » jakubvrana
2009-07-11 HTML instead of XHTML
127 echo "<p class='error'>" . lang('Unable to select the table') . ($fields ? "" : ": " . htmlspecialchars($dbh->error)) . ".\n";
ffcea8b5 » jakubvrana
2007-07-06 Rights
128 } else {
5ee29cb0 » jakubvrana
2008-08-07 Select columns, aggregation
129 echo "<form action='' id='form'>\n";
d24ad780 » jakubvrana
2009-07-27 Select boxes customization
130 echo "<div style='display: none;'>";
131 echo (strlen($_GET["server"]) ? '<input type="hidden" name="server" value="' . htmlspecialchars($_GET["server"]) . '">' : "");
ace55ed1 » jakubvrana
2009-07-11 HTML instead of XHTML
132 echo '<input type="hidden" name="db" value="' . htmlspecialchars($_GET["db"]) . '">';
133 echo '<input type="hidden" name="select" value="' . htmlspecialchars($_GET["select"]) . '">';
d24ad780 » jakubvrana
2009-07-27 Select boxes customization
134 echo "</div>\n";
135 $adminer->selectColumnsPrint($select, $columns);
136 $adminer->selectSearchPrint($where, $columns, $indexes);
137 $adminer->selectOrderPrint($order, $columns, $indexes);
138 $adminer->selectLimitPrint($limit);
139 $adminer->selectLengthPrint($text_length);
140 $adminer->selectActionPrint($text_length);
ffcea8b5 » jakubvrana
2007-07-06 Rights
141 echo "</form>\n";
142
07e1ae10 » jakubvrana
2009-07-28 FOUND_ROWS only with GROUP BY
143 $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"]) : "") : "");
c64c4fd1 » jakubvrana
2009-07-27 Adminer class
144 echo $adminer->selectQuery($query);
8b745113 » jakubvrana
2008-09-01 Print SQL query (fixes #2082448)
145
5f16c75c » jakubvrana
2009-05-08 Prepare for version 2
146 $result = $dbh->query($query);
21ea4aea » jakubvrana
2007-09-03 Check errors
147 if (!$result) {
ace55ed1 » jakubvrana
2009-07-11 HTML instead of XHTML
148 echo "<p class='error'>" . htmlspecialchars($dbh->error) . "\n";
ffcea8b5 » jakubvrana
2007-07-06 Rights
149 } else {
f2365d08 » jakubvrana
2009-07-11 Typo
150 $email_fields = array();
e7eb28d3 » jakubvrana
2008-12-30 CSV import
151 echo "<form action='' method='post' enctype='multipart/form-data'>\n";
21ea4aea » jakubvrana
2007-09-03 Check errors
152 if (!$result->num_rows) {
ace55ed1 » jakubvrana
2009-07-11 HTML instead of XHTML
153 echo "<p class='message'>" . lang('No rows.') . "\n";
21ea4aea » jakubvrana
2007-09-03 Check errors
154 } else {
ba90d60b » jakubvrana
2009-07-14 Introduce adminer_select_val
155 $rows = array();
156 while ($row = $result->fetch_assoc()) {
157 $rows[] = $row;
158 }
159 $result->free();
4cdc4598 » jakubvrana
2009-07-16 FOUND_ROWS works with last SELECT
160 // use count($rows) without LIMIT, COUNT(*) without grouping, FOUND_ROWS otherwise (slowest)
07e1ae10 » jakubvrana
2009-07-28 FOUND_ROWS only with GROUP BY
161 $found_rows = (intval($limit) && $group && count($group) < count($select)
4cdc4598 » jakubvrana
2009-07-16 FOUND_ROWS works with last SELECT
162 ? $dbh->result($dbh->query(" SELECT FOUND_ROWS()")) // space to allow mysql.trace_mode
163 : count($rows)
164 );
ba90d60b » jakubvrana
2009-07-14 Introduce adminer_select_val
165
1e4d11e9 » jakubvrana
2009-07-23 Select from foreign keys in Editor
166 $foreign_keys = column_foreign_keys($_GET["select"]);
c64c4fd1 » jakubvrana
2009-07-27 Adminer class
167 $descriptions = $adminer->rowDescriptions($rows, $foreign_keys);
21ea4aea » jakubvrana
2007-09-03 Check errors
168
c64c4fd1 » jakubvrana
2009-07-27 Adminer class
169 $backward_keys = $adminer->backwardKeys($_GET["select"]);
336f521f » jakubvrana
2009-07-21 Get table names of backward keys only once
170 $table_names = array_keys($backward_keys);
171 if ($table_names) {
c64c4fd1 » jakubvrana
2009-07-27 Adminer class
172 $table_names = array_combine($table_names, array_map(array($adminer, 'tableName'), array_map('table_status', $table_names)));
336f521f » jakubvrana
2009-07-21 Get table names of backward keys only once
173 }
c42c46a2 » jakubvrana
2009-07-15 Table relations
174
d30facef » jakubvrana
2009-05-01 Remove useless table attributes (thanks to Juraj Krivda)
175 echo "<table cellspacing='0' class='nowrap'>\n";
ba90d60b » jakubvrana
2009-07-14 Introduce adminer_select_val
176 echo "<thead><tr><td><input type='checkbox' id='all-page' onclick='form_check(this, /check/);'>";
50341236 » jakubvrana
2009-07-23 Apply field name with functions
177 $names = array();
178 reset($select);
6c97b806 » jakubvrana
2009-07-27 Display only first five columns in Editor example
179 $order = 0;
ba90d60b » jakubvrana
2009-07-14 Introduce adminer_select_val
180 foreach ($rows[0] as $key => $val) {
50341236 » jakubvrana
2009-07-23 Apply field name with functions
181 $val = $_GET["columns"][key($select)];
ba9c9a52 » jakubvrana
2009-07-24 Display SQL function with braces in select heading
182 $field = $fields[$select ? $val["col"] : $key];
6c97b806 » jakubvrana
2009-07-27 Display only first five columns in Editor example
183 $name = ($field ? $adminer->fieldName($field, $order) : "*");
116c8736 » jakubvrana
2009-07-21 Ignore tables and fields with empty name
184 if (strlen($name)) {
6c97b806 » jakubvrana
2009-07-27 Display only first five columns in Editor example
185 $order++;
50341236 » jakubvrana
2009-07-23 Apply field name with functions
186 $names[$key] = $name;
988a29fc » jakubvrana
2009-07-28 Don't use aggregation functions in unique_idf
187 echo '<th><a href="' . htmlspecialchars(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
116c8736 » jakubvrana
2009-07-21 Ignore tables and fields with empty name
188 }
50341236 » jakubvrana
2009-07-23 Apply field name with functions
189 next($select);
ba90d60b » jakubvrana
2009-07-14 Introduce adminer_select_val
190 }
c42c46a2 » jakubvrana
2009-07-15 Table relations
191 echo ($backward_keys ? "<th>" . lang('Relations') : "") . "</thead>\n";
228e43a0 » jakubvrana
2009-07-20 Row descriptions in select
192 foreach ($descriptions as $n => $row) {
988a29fc » jakubvrana
2009-07-28 Don't use aggregation functions in unique_idf
193 $unique_idf = implode('&amp;', unique_idf($rows[$n], $indexes));
ace55ed1 » jakubvrana
2009-07-11 HTML instead of XHTML
194 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="' . htmlspecialchars($SELF) . 'edit=' . urlencode($_GET['select']) . '&amp;' . $unique_idf . '">' . lang('edit') . '</a>');
21ea4aea » jakubvrana
2007-09-03 Check errors
195 foreach ($row as $key => $val) {
78e49f01 » jakubvrana
2009-07-24 Pass $field to select_val
196 if (isset($names[$key])) {
d6e3fc71 » jakubvrana
2009-07-22 Link e-mails
197 if (strlen($val) && (!isset($email_fields[$key]) || strlen($email_fields[$key]))) {
50341236 » jakubvrana
2009-07-23 Apply field name with functions
198 $email_fields[$key] = (is_email($val) ? $names[$key] : ""); //! filled e-mails may be contained on other pages
116c8736 » jakubvrana
2009-07-21 Ignore tables and fields with empty name
199 }
5911cf17 » jakubvrana
2009-07-21 Always call select_val
200 $link = "";
a0def479 » jakubvrana
2009-07-27 Date localization
201 $val = $adminer->editVal($val, $fields[$key]);
116c8736 » jakubvrana
2009-07-21 Ignore tables and fields with empty name
202 if (!isset($val)) {
203 $val = "<i>NULL</i>";
21ea4aea » jakubvrana
2007-09-03 Check errors
204 } else {
97b8c7b6 » jakubvrana
2009-07-24 Display images in Editor
205 if (ereg('blob|binary', $fields[$key]["type"]) && strlen($val)) {
206 $link = htmlspecialchars($SELF . 'download=' . urlencode($_GET["select"]) . '&field=' . urlencode($key) . '&') . $unique_idf;
207 }
116c8736 » jakubvrana
2009-07-21 Ignore tables and fields with empty name
208 if (!strlen(trim($val, " \t"))) {
209 $val = "&nbsp;";
97b8c7b6 » jakubvrana
2009-07-24 Display images in Editor
210 } elseif (strlen($text_length) && ereg('blob|text', $fields[$key]["type"]) && is_utf8($val)) {
35c8c6ba » jakubvrana
2009-07-23 Respect zero text length
211 $val = nl2br(shorten_utf8($val, max(0, intval($text_length)))); // usage of LEFT() would reduce traffic but complicate query
116c8736 » jakubvrana
2009-07-21 Ignore tables and fields with empty name
212 } else {
213 $val = nl2br(htmlspecialchars($val));
21ea4aea » jakubvrana
2007-09-03 Check errors
214 }
116c8736 » jakubvrana
2009-07-21 Ignore tables and fields with empty name
215
216 // link related items
217 foreach ((array) $foreign_keys[$key] as $foreign_key) {
218 if (count($foreign_keys[$key]) == 1 || count($foreign_key["source"]) == 1) {
219 foreach ($foreign_key["source"] as $i => $source) {
220 $link .= where_link($i, $foreign_key["target"][$i], $rows[$n][$source]);
221 }
222 $link = htmlspecialchars((strlen($foreign_key["db"]) ? preg_replace('~([?&]db=)[^&]+~', '\\1' . urlencode($foreign_key["db"]), $SELF) : $SELF) . 'select=' . urlencode($foreign_key["table"])) . $link; // InnoDB supports non-UNIQUE keys
223 break;
21ea4aea » jakubvrana
2007-09-03 Check errors
224 }
ffcea8b5 » jakubvrana
2007-07-06 Rights
225 }
fa3dd557 » jakubvrana
2007-07-02 Parent
226 }
d6e3fc71 » jakubvrana
2009-07-22 Link e-mails
227 if (!$link && is_email($val)) {
228 $link = "mailto:$val";
229 }
c64c4fd1 » jakubvrana
2009-07-27 Adminer class
230 $val = $adminer->selectVal($val, $link, $fields[$key]);
116c8736 » jakubvrana
2009-07-21 Ignore tables and fields with empty name
231 echo "<td>$val";
667bfec4 » jakubvrana
2007-07-02 Decomposition
232 }
233 }
c42c46a2 » jakubvrana
2009-07-15 Table relations
234 if ($backward_keys) {
235 echo "<td>";
236 foreach ($backward_keys as $table => $keys) {
237 foreach ($keys as $columns) {
238 echo ' <a href="' . htmlspecialchars($SELF) . 'select=' . urlencode($table);
239 $i = 0;
240 foreach ($columns as $column => $val) {
228e43a0 » jakubvrana
2009-07-20 Row descriptions in select
241 echo where_link($i, $column, $rows[$n][$val]);
c42c46a2 » jakubvrana
2009-07-15 Table relations
242 $i++;
243 }
336f521f » jakubvrana
2009-07-21 Get table names of backward keys only once
244 echo "\">$table_names[$table]</a>";
c42c46a2 » jakubvrana
2009-07-15 Table relations
245 }
246 }
247 }
ba90d60b » jakubvrana
2009-07-14 Introduce adminer_select_val
248 echo "\n";
5ab708a1 » jakubvrana
2007-07-25 Compact pages
249 }
21ea4aea » jakubvrana
2007-09-03 Check errors
250 echo "</table>\n";
e4b188cd » jakubvrana
2008-09-01 Display found rows
251
4cdc4598 » jakubvrana
2009-07-16 FOUND_ROWS works with last SELECT
252 if (intval($limit) && count($group) >= count($select)) {
253 // slow with big tables
254 ob_flush();
255 flush();
256 $found_rows = $dbh->result($dbh->query("SELECT COUNT(*) FROM " . idf_escape($_GET["select"]) . ($where ? " WHERE " . implode(" AND ", $where) : "")));
257 }
e4b188cd » jakubvrana
2008-09-01 Display found rows
258 echo "<p>";
259 if (intval($limit) && $found_rows > $limit) {
64ba9242 » jakubvrana
2009-06-21 Comments
260 // display first, previous 3, next 3 and last page
21ea4aea » jakubvrana
2007-09-03 Check errors
261 $max_page = floor(($found_rows - 1) / $limit);
c565c545 » jakubvrana
2009-07-15 Let pagination function return
262 echo lang('Page') . ":" . pagination(0) . ($_GET["page"] > 3 ? " ..." : "");
21ea4aea » jakubvrana
2007-09-03 Check errors
263 for ($i = max(1, $_GET["page"] - 2); $i < min($max_page, $_GET["page"] + 3); $i++) {
c565c545 » jakubvrana
2009-07-15 Let pagination function return
264 echo pagination($i);
21ea4aea » jakubvrana
2007-09-03 Check errors
265 }
c565c545 » jakubvrana
2009-07-15 Let pagination function return
266 echo ($_GET["page"] + 3 < $max_page ? " ..." : "") . pagination($max_page);
5ab708a1 » jakubvrana
2007-07-25 Compact pages
267 }
ace55ed1 » jakubvrana
2009-07-11 HTML instead of XHTML
268 echo " (" . lang('%d row(s)', $found_rows) . ') <label><input type="checkbox" name="all" value="1">' . lang('whole result') . "</label>\n";
8b745113 » jakubvrana
2008-09-01 Print SQL query (fixes #2082448)
269
3c860b78 » jakubvrana
2009-07-13 Name Edit button on select.inc.php
270 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");
ace55ed1 » jakubvrana
2009-07-11 HTML instead of XHTML
271 echo "<fieldset><legend>" . lang('Export') . "</legend><div>$dump_output $dump_format <input type='submit' name='export' value='" . lang('Export') . "'></div></fieldset>\n";
667bfec4 » jakubvrana
2007-07-02 Decomposition
272 }
ace55ed1 » jakubvrana
2009-07-11 HTML instead of XHTML
273 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";
c16c57b1 » jakubvrana
2009-07-11 E-mail sending
274
1a6a73ad » jakubvrana
2009-07-28 Rename selectExtra to selectEmail
275 $adminer->selectEmailPrint(array_filter($email_fields, 'strlen'));
c16c57b1 » jakubvrana
2009-07-11 E-mail sending
276
e7eb28d3 » jakubvrana
2008-12-30 CSV import
277 echo "</form>\n";
667bfec4 » jakubvrana
2007-07-02 Decomposition
278 }
279 }
Something went wrong with that request. Please try again.