示例#1
0
     }
     if (is_adminer_ajax()) {
         exit;
     }
     echo "</table>\n";
 }
 if (($rows || $page) && !is_adminer_ajax()) {
     $exact_count = true;
     if ($_GET["page"] != "last") {
         if (!+$limit) {
             $found_rows = count($rows);
         } elseif ($jush != "sql" || !$is_group) {
             $found_rows = $is_group ? false : found_rows($table_status, $where);
             if ($found_rows < max(10000.0, 2 * ($page + 1) * $limit)) {
                 // slow with big tables
                 $found_rows = reset(slow_query(count_rows($TABLE, $where, $is_group, $group)));
             } else {
                 $exact_count = false;
             }
         }
     }
     if (+$limit && ($found_rows === false || $found_rows > $limit || $page)) {
         echo "<p class='pages'>";
         // display first, previous 4, next 4 and last page
         $max_page = $found_rows === false ? $page + (count($rows) >= $limit ? 2 : 1) : floor(($found_rows - 1) / $limit);
         if ($jush != "simpledb") {
             echo '<a href="' . h(remove_from_uri("page")) . "\" onclick=\"pageClick(this.href, +prompt('" . lang('Page') . "', '" . ($page + 1) . "'), event); return false;\">" . lang('Page') . "</a>:";
             echo adminer_pagination(0, $page) . ($page > 5 ? " ..." : "");
             for ($i = max(1, $page - 4); $i < min($max_page, $page + 5); $i++) {
                 echo adminer_pagination($i, $page);
             }
示例#2
0
         echo "</tr>\n";
         // close to allow white-space: pre
     }
     if (is_ajax()) {
         exit;
     }
     echo "</table>\n";
     echo !$group && $select ? "" : "<script type='text/javascript'>tableCheck();</script>\n";
 }
 if (($rows || $page) && !is_ajax()) {
     $exact_count = true;
     if ($_GET["page"] != "last" && +$limit && !$is_group && ($found_rows >= $limit || $page)) {
         $found_rows = found_rows($table_status, $where);
         if ($found_rows < max(10000.0, 2 * ($page + 1) * $limit)) {
             // slow with big tables
             $found_rows = reset(slow_query("SELECT COUNT(*) FROM " . table($TABLE) . ($where ? " WHERE " . implode(" AND ", $where) : "")));
         } else {
             $exact_count = false;
         }
     }
     echo "<p class='pages'>";
     if (+$limit && ($found_rows === false || $found_rows > $limit)) {
         // display first, previous 4, next 4 and last page
         $max_page = $found_rows === false ? $page + (count($rows) >= $limit ? 2 : 1) : floor(($found_rows - 1) / $limit);
         echo '<a href="' . h(remove_from_uri("page")) . "\" onclick=\"pageClick(this.href, +prompt('" . lang('Page') . "', '" . ($page + 1) . "'), event); return false;\">" . lang('Page') . "</a>:";
         echo pagination(0, $page) . ($page > 5 ? " ..." : "");
         for ($i = max(1, $page - 4); $i < min($max_page, $page + 5); $i++) {
             echo pagination($i, $page);
         }
         echo ($page + 5 < $max_page ? " ..." : "") . ($exact_count && $found_rows !== false ? pagination($max_page, $page) : ' <a href="' . h(remove_from_uri("page") . "&page=last") . '">' . lang('last') . "</a>");
     }
示例#3
0
 /** Get cached list of databases
  * @param bool
  * @return array
  */
 function get_databases($flush)
 {
     global $connection;
     // SHOW DATABASES can take a very long time so it is cached
     $return = get_session("dbs");
     if ($return === null) {
         $query = $connection->server_info >= 5 ? "SELECT SCHEMA_NAME FROM information_schema.SCHEMATA" : "SHOW DATABASES";
         // SHOW DATABASES can be disabled by skip_show_database
         $return = $flush ? slow_query($query) : get_vals($query);
         restart_session();
         set_session("dbs", $return);
         stop_session();
     }
     return $return;
 }