Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: d42d931929
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 74 lines (69 sloc) 2.719 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* DB search optimisation
*
* @package PhpMyAdmin
*/

require_once 'libraries/common.inc.php';
require_once 'libraries/CommonFunctions.class.php';

$db = $_GET['db'];
$table_term = $_GET['table'];
$common_functions = PMA_CommonFunctions::getInstance();
$common_url_query = PMA_generate_common_url($GLOBALS['db']);
$tables_full = $common_functions->getTableList($db);
$tables_response = array();

foreach ($tables_full as $key => $table) {
    if (strpos($key, $table_term) !== false) {
        $link = '<li class="ajax_table"><a class="tableicon" title="'
            . htmlspecialchars($link_title)
            . ': ' . htmlspecialchars($table['Comment'])
            . ' ('
            . $common_functions->formatNumber($table['Rows'], 0)
            . ' ' . __('Rows') . ')"' . ' id="quick_'
            . htmlspecialchars($table_db . '.' . $table['Name']) . '"'
            . ' href="' . $GLOBALS['cfg']['LeftDefaultTabTable'] . '?'
            . $common_url_query
            . '&amp;table=' . urlencode($table['Name'])
            . '&amp;goto=' . $GLOBALS['cfg']['LeftDefaultTabTable']
            . '" >';
        $attr = array(
            'id' => 'icon_' . htmlspecialchars($table_db . '.' . $table['Name'])
        );
        if (PMA_Table::isView($table_db, $table['Name'])) {
            $link .= $common_functions->getImage(
                's_views.png', htmlspecialchars($link_title), $attr
            );
        } else {
            $link .= $common_functions->getImage(
                'b_browse.png', htmlspecialchars($link_title), $attr
            );
        }
        $link .= '</a>';
        // link for the table name itself
        $href = $GLOBALS['cfg']['DefaultTabTable'] . '?'
                . $common_url_query . '&amp;table='
                . urlencode($table['Name']) . '&amp;pos=0';
        $link .= '<a href="' . $href . '" title="'
            . htmlspecialchars(
                $common_functions->getTitleForTarget(
                    $GLOBALS['cfg']['DefaultTabTable']
                )
                . ': ' . $table['Comment']
                . ' (' .
                $common_functions->formatNumber($table['Rows'], 0)
                . ' ' . __('Rows') . ')'
            )
            . '" id="' . htmlspecialchars($table_db . '.' . $table['Name'])
            . '">'
            // preserve spaces in table name
            . str_replace(' ', '&nbsp;', htmlspecialchars($table['disp_name']))
            . '</a>';
        $link .= '</li>' . "\n";
        $table['line'] = $link;
        $tables_response[] = $table;
    }
}

$response = PMA_Response::getInstance();
$response->addJSON('tables', $tables_response);
?>
Something went wrong with that request. Please try again.