bug #2794840 [core] Cannot redeclare pma_tableheader()
This commit is contained in:
@@ -8,6 +8,7 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA
|
|||||||
3.3.0.0 (not yet released)
|
3.3.0.0 (not yet released)
|
||||||
+ patch #2794819 [navi] Filter for displayed table names,
|
+ patch #2794819 [navi] Filter for displayed table names,
|
||||||
thanks to Michael Valushko - dylfin
|
thanks to Michael Valushko - dylfin
|
||||||
|
- bug #2794840 [core] Cannot redeclare pma_tableheader()
|
||||||
|
|
||||||
3.2.0.0 (not yet released)
|
3.2.0.0 (not yet released)
|
||||||
- [core] better support for vendor customisation (based on what Debian needs)
|
- [core] better support for vendor customisation (based on what Debian needs)
|
||||||
|
120
db_structure.php
120
db_structure.php
@@ -24,7 +24,14 @@ if (empty($is_info)) {
|
|||||||
|| isset($mult_btn)) {
|
|| isset($mult_btn)) {
|
||||||
$action = 'db_structure.php';
|
$action = 'db_structure.php';
|
||||||
$err_url = 'db_structure.php?'. PMA_generate_common_url($db);
|
$err_url = 'db_structure.php?'. PMA_generate_common_url($db);
|
||||||
require './libraries/mult_submits.inc.php';
|
|
||||||
|
// see bug #2794840; in this case, code path is:
|
||||||
|
// db_structure.php -> libraries/mult_submits.inc.php -> sql.php
|
||||||
|
// -> db_structure.php and if we got an error on the multi submit,
|
||||||
|
// we must display it here and not call again mult_submits.inc.php
|
||||||
|
if (!$error) {
|
||||||
|
require './libraries/mult_submits.inc.php';
|
||||||
|
}
|
||||||
if (empty($message)) {
|
if (empty($message)) {
|
||||||
$message = PMA_Message::success();
|
$message = PMA_Message::success();
|
||||||
}
|
}
|
||||||
@@ -60,115 +67,8 @@ require_once './libraries/bookmark.lib.php';
|
|||||||
require_once './libraries/mysql_charsets.lib.php';
|
require_once './libraries/mysql_charsets.lib.php';
|
||||||
$db_collation = PMA_getDbCollation($db);
|
$db_collation = PMA_getDbCollation($db);
|
||||||
|
|
||||||
// Display function
|
// in a separate file to avoid redeclaration of functions in some code paths
|
||||||
/**
|
require_once './libraries/db_structure.lib.php';
|
||||||
* void PMA_TableHeader([bool $db_is_information_schema = false])
|
|
||||||
* display table header (<table><thead>...</thead><tbody>)
|
|
||||||
*
|
|
||||||
* @uses PMA_showHint()
|
|
||||||
* @uses $GLOBALS['cfg']['PropertiesNumColumns']
|
|
||||||
* @uses $GLOBALS['is_show_stats']
|
|
||||||
* @uses $GLOBALS['strTable']
|
|
||||||
* @uses $GLOBALS['strAction']
|
|
||||||
* @uses $GLOBALS['strRecords']
|
|
||||||
* @uses $GLOBALS['strApproximateCount']
|
|
||||||
* @uses $GLOBALS['strType']
|
|
||||||
* @uses $GLOBALS['strCollation']
|
|
||||||
* @uses $GLOBALS['strSize']
|
|
||||||
* @uses $GLOBALS['strOverhead']
|
|
||||||
* @uses $GLOBALS['structure_tbl_col_cnt']
|
|
||||||
* @uses PMA_SortableTableHeader()
|
|
||||||
* @param boolean $db_is_information_schema
|
|
||||||
*/
|
|
||||||
function PMA_TableHeader($db_is_information_schema = false)
|
|
||||||
{
|
|
||||||
$cnt = 0; // Let's count the columns...
|
|
||||||
|
|
||||||
if ($db_is_information_schema) {
|
|
||||||
$action_colspan = 3;
|
|
||||||
} else {
|
|
||||||
$action_colspan = 6;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '<table class="data" style="float: left;">' . "\n"
|
|
||||||
.'<thead>' . "\n"
|
|
||||||
.'<tr><th></th>' . "\n"
|
|
||||||
.' <th>' . PMA_SortableTableHeader($GLOBALS['strTable'], 'table') . '</th>' . "\n"
|
|
||||||
.' <th colspan="' . $action_colspan . '">' . "\n"
|
|
||||||
.' ' . $GLOBALS['strAction'] . "\n"
|
|
||||||
.' </th>'
|
|
||||||
.' <th>' . PMA_SortableTableHeader($GLOBALS['strRecords'], 'records')
|
|
||||||
.PMA_showHint(PMA_sanitize($GLOBALS['strApproximateCount'])) . "\n"
|
|
||||||
.' </th>' . "\n";
|
|
||||||
if (!($GLOBALS['cfg']['PropertiesNumColumns'] > 1)) {
|
|
||||||
echo ' <th>' . PMA_SortableTableHeader($GLOBALS['strType'], 'type') . '</th>' . "\n";
|
|
||||||
$cnt++;
|
|
||||||
echo ' <th>' . PMA_SortableTableHeader($GLOBALS['strCollation'], 'collation') . '</th>' . "\n";
|
|
||||||
$cnt++;
|
|
||||||
}
|
|
||||||
if ($GLOBALS['is_show_stats']) {
|
|
||||||
echo ' <th>' . PMA_SortableTableHeader($GLOBALS['strSize'], 'size') . '</th>' . "\n"
|
|
||||||
. ' <th>' . PMA_SortableTableHeader($GLOBALS['strOverhead'], 'overhead') . '</th>' . "\n";
|
|
||||||
$cnt += 2;
|
|
||||||
}
|
|
||||||
echo '</tr>' . "\n";
|
|
||||||
echo '</thead>' . "\n";
|
|
||||||
echo '<tbody>' . "\n";
|
|
||||||
$GLOBALS['structure_tbl_col_cnt'] = $cnt + $action_colspan + 3;
|
|
||||||
} // end function PMA_TableHeader()
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a clickable column header for table information
|
|
||||||
*
|
|
||||||
* @param string title to use for the link
|
|
||||||
* @param string corresponds to sortable data name mapped in libraries/db_info.inc.php
|
|
||||||
* @returns string link to be displayed in the table header
|
|
||||||
*/
|
|
||||||
function PMA_SortableTableHeader($title, $sort)
|
|
||||||
{
|
|
||||||
// Set some defaults
|
|
||||||
$requested_sort = 'table';
|
|
||||||
$requested_sort_order = 'ASC';
|
|
||||||
$sort_order = 'ASC';
|
|
||||||
|
|
||||||
// If the user requested a sort
|
|
||||||
if (isset($_REQUEST['sort'])) {
|
|
||||||
$requested_sort = $_REQUEST['sort'];
|
|
||||||
|
|
||||||
if (isset($_REQUEST['sort_order'])) {
|
|
||||||
$requested_sort_order = $_REQUEST['sort_order'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$order_img = '';
|
|
||||||
$order_link_params = array();
|
|
||||||
$order_link_params['title'] = $GLOBALS['strSort'];
|
|
||||||
|
|
||||||
// If this column was requested to be sorted.
|
|
||||||
if ($requested_sort == $sort) {
|
|
||||||
if ($requested_sort_order == 'ASC') {
|
|
||||||
$sort_order = 'DESC';
|
|
||||||
$order_img = ' <img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 's_desc.png" width="11" height="9" alt="'. $GLOBALS['strDescending'] . '" title="'. $GLOBALS['strDescending'] . '" id="sort_arrow" />';
|
|
||||||
$order_link_params['onmouseover'] = 'if(document.getElementById(\'sort_arrow\')){ document.getElementById(\'sort_arrow\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_asc.png\'; }';
|
|
||||||
$order_link_params['onmouseout'] = 'if(document.getElementById(\'sort_arrow\')){ document.getElementById(\'sort_arrow\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_desc.png\'; }';
|
|
||||||
} else {
|
|
||||||
$order_img = ' <img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 's_asc.png" width="11" height="9" alt="'. $GLOBALS['strAscending'] . '" title="'. $GLOBALS['strAscending'] . '" id="sort_arrow" />';
|
|
||||||
$order_link_params['onmouseover'] = 'if(document.getElementById(\'sort_arrow\')){ document.getElementById(\'sort_arrow\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_desc.png\'; }';
|
|
||||||
$order_link_params['onmouseout'] = 'if(document.getElementById(\'sort_arrow\')){ document.getElementById(\'sort_arrow\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_asc.png\'; }';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$_url_params = array(
|
|
||||||
'db' => $_REQUEST['db'],
|
|
||||||
);
|
|
||||||
|
|
||||||
$url = 'db_structure.php'.PMA_generate_common_url($_url_params);
|
|
||||||
// We set the position back to 0 every time they sort.
|
|
||||||
$url .= "&pos=0&sort=$sort&sort_order=$sort_order";
|
|
||||||
|
|
||||||
return PMA_linkOrButton($url, $title . $order_img, $order_link_params);
|
|
||||||
}
|
|
||||||
|
|
||||||
$titles = array();
|
$titles = array();
|
||||||
if (true == $cfg['PropertiesIconic']) {
|
if (true == $cfg['PropertiesIconic']) {
|
||||||
|
121
libraries/db_structure.lib.php
Normal file
121
libraries/db_structure.lib.php
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
<?php
|
||||||
|
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @version $Id$
|
||||||
|
* @package phpMyAdmin
|
||||||
|
*/
|
||||||
|
if (! defined('PHPMYADMIN')) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Display function
|
||||||
|
/**
|
||||||
|
* void PMA_TableHeader([bool $db_is_information_schema = false])
|
||||||
|
* display table header (<table><thead>...</thead><tbody>)
|
||||||
|
*
|
||||||
|
* @uses PMA_showHint()
|
||||||
|
* @uses $GLOBALS['cfg']['PropertiesNumColumns']
|
||||||
|
* @uses $GLOBALS['is_show_stats']
|
||||||
|
* @uses $GLOBALS['strTable']
|
||||||
|
* @uses $GLOBALS['strAction']
|
||||||
|
* @uses $GLOBALS['strRecords']
|
||||||
|
* @uses $GLOBALS['strApproximateCount']
|
||||||
|
* @uses $GLOBALS['strType']
|
||||||
|
* @uses $GLOBALS['strCollation']
|
||||||
|
* @uses $GLOBALS['strSize']
|
||||||
|
* @uses $GLOBALS['strOverhead']
|
||||||
|
* @uses $GLOBALS['structure_tbl_col_cnt']
|
||||||
|
* @uses PMA_SortableTableHeader()
|
||||||
|
* @param boolean $db_is_information_schema
|
||||||
|
*/
|
||||||
|
function PMA_TableHeader($db_is_information_schema = false)
|
||||||
|
{
|
||||||
|
$cnt = 0; // Let's count the columns...
|
||||||
|
|
||||||
|
if ($db_is_information_schema) {
|
||||||
|
$action_colspan = 3;
|
||||||
|
} else {
|
||||||
|
$action_colspan = 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<table class="data" style="float: left;">' . "\n"
|
||||||
|
.'<thead>' . "\n"
|
||||||
|
.'<tr><th></th>' . "\n"
|
||||||
|
.' <th>' . PMA_SortableTableHeader($GLOBALS['strTable'], 'table') . '</th>' . "\n"
|
||||||
|
.' <th colspan="' . $action_colspan . '">' . "\n"
|
||||||
|
.' ' . $GLOBALS['strAction'] . "\n"
|
||||||
|
.' </th>'
|
||||||
|
.' <th>' . PMA_SortableTableHeader($GLOBALS['strRecords'], 'records')
|
||||||
|
.PMA_showHint(PMA_sanitize($GLOBALS['strApproximateCount'])) . "\n"
|
||||||
|
.' </th>' . "\n";
|
||||||
|
if (!($GLOBALS['cfg']['PropertiesNumColumns'] > 1)) {
|
||||||
|
echo ' <th>' . PMA_SortableTableHeader($GLOBALS['strType'], 'type') . '</th>' . "\n";
|
||||||
|
$cnt++;
|
||||||
|
echo ' <th>' . PMA_SortableTableHeader($GLOBALS['strCollation'], 'collation') . '</th>' . "\n";
|
||||||
|
$cnt++;
|
||||||
|
}
|
||||||
|
if ($GLOBALS['is_show_stats']) {
|
||||||
|
echo ' <th>' . PMA_SortableTableHeader($GLOBALS['strSize'], 'size') . '</th>' . "\n"
|
||||||
|
. ' <th>' . PMA_SortableTableHeader($GLOBALS['strOverhead'], 'overhead') . '</th>' . "\n";
|
||||||
|
$cnt += 2;
|
||||||
|
}
|
||||||
|
echo '</tr>' . "\n";
|
||||||
|
echo '</thead>' . "\n";
|
||||||
|
echo '<tbody>' . "\n";
|
||||||
|
$GLOBALS['structure_tbl_col_cnt'] = $cnt + $action_colspan + 3;
|
||||||
|
} // end function PMA_TableHeader()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a clickable column header for table information
|
||||||
|
*
|
||||||
|
* @param string title to use for the link
|
||||||
|
* @param string corresponds to sortable data name mapped in libraries/db_info.inc.php
|
||||||
|
* @returns string link to be displayed in the table header
|
||||||
|
*/
|
||||||
|
function PMA_SortableTableHeader($title, $sort)
|
||||||
|
{
|
||||||
|
// Set some defaults
|
||||||
|
$requested_sort = 'table';
|
||||||
|
$requested_sort_order = 'ASC';
|
||||||
|
$sort_order = 'ASC';
|
||||||
|
|
||||||
|
// If the user requested a sort
|
||||||
|
if (isset($_REQUEST['sort'])) {
|
||||||
|
$requested_sort = $_REQUEST['sort'];
|
||||||
|
|
||||||
|
if (isset($_REQUEST['sort_order'])) {
|
||||||
|
$requested_sort_order = $_REQUEST['sort_order'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$order_img = '';
|
||||||
|
$order_link_params = array();
|
||||||
|
$order_link_params['title'] = $GLOBALS['strSort'];
|
||||||
|
|
||||||
|
// If this column was requested to be sorted.
|
||||||
|
if ($requested_sort == $sort) {
|
||||||
|
if ($requested_sort_order == 'ASC') {
|
||||||
|
$sort_order = 'DESC';
|
||||||
|
$order_img = ' <img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 's_desc.png" width="11" height="9" alt="'. $GLOBALS['strDescending'] . '" title="'. $GLOBALS['strDescending'] . '" id="sort_arrow" />';
|
||||||
|
$order_link_params['onmouseover'] = 'if(document.getElementById(\'sort_arrow\')){ document.getElementById(\'sort_arrow\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_asc.png\'; }';
|
||||||
|
$order_link_params['onmouseout'] = 'if(document.getElementById(\'sort_arrow\')){ document.getElementById(\'sort_arrow\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_desc.png\'; }';
|
||||||
|
} else {
|
||||||
|
$order_img = ' <img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 's_asc.png" width="11" height="9" alt="'. $GLOBALS['strAscending'] . '" title="'. $GLOBALS['strAscending'] . '" id="sort_arrow" />';
|
||||||
|
$order_link_params['onmouseover'] = 'if(document.getElementById(\'sort_arrow\')){ document.getElementById(\'sort_arrow\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_desc.png\'; }';
|
||||||
|
$order_link_params['onmouseout'] = 'if(document.getElementById(\'sort_arrow\')){ document.getElementById(\'sort_arrow\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_asc.png\'; }';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$_url_params = array(
|
||||||
|
'db' => $_REQUEST['db'],
|
||||||
|
);
|
||||||
|
|
||||||
|
$url = 'db_structure.php'.PMA_generate_common_url($_url_params);
|
||||||
|
// We set the position back to 0 every time they sort.
|
||||||
|
$url .= "&pos=0&sort=$sort&sort_order=$sort_order";
|
||||||
|
|
||||||
|
return PMA_linkOrButton($url, $title . $order_img, $order_link_params);
|
||||||
|
} // end function PMA_SortableTableHeader()
|
||||||
|
?>
|
Reference in New Issue
Block a user