$show_comment = preg_replace('@; InnoDB free:.*?$@', '', $show_comment); } echo '<span class="table_comment" id="span_table_comment">' . '"' . htmlspecialchars($show_comment) . '"</span>' . "\n"; } // end if } else { // no table selected, display database comment if present /** * Settings for relations stuff */ require_once './libraries/relation.lib.php'; $cfgRelation = PMA_getRelationsParam(); // Get additional information about tables for tooltip is done // in libraries/db_info.inc.php only once if ($cfgRelation['commwork']) { $comment = PMA_getDbComment($GLOBALS['db']); /** * Displays table comment */ if (!empty($comment)) { echo '<span class="table_comment"' . ' id="span_table_comment">"' . htmlspecialchars($comment) . '"</span>' . "\n"; } // end if } } } } echo '</div>'; } /** * Sets a variable to remember headers have been sent
/** * Gets the comments for all columns of a table or the db itself * * @param string $db the name of the db to check for * @param string $table the name of the table to check for * * @return array [column_name] = comment * * @access public */ function PMA_getComments($db, $table = '') { $comments = array(); if ($table != '') { // MySQL native column comments $columns = $GLOBALS['dbi']->getColumns($db, $table, null, true); if ($columns) { foreach ($columns as $column) { if (!empty($column['Comment'])) { $comments[$column['Field']] = $column['Comment']; } } } } else { $comments[] = PMA_getDbComment($db); } return $comments; }
$header->enablePrintView(); /** * Gets the relations settings */ $cfgRelation = PMA_getRelationsParam(); require_once 'libraries/transformations.lib.php'; /** * Check parameters */ PMA\libraries\Util::checkParameters(array('db')); /** * Defines the url to return to in case of error in a sql statement */ $err_url = 'db_sql.php' . PMA_URL_getCommon(array('db' => $db)); if ($cfgRelation['commwork']) { $comment = PMA_getDbComment($db); /** * Displays DB comment */ if ($comment) { echo '<p>', __('Database comment'), '<br /><i>', htmlspecialchars($comment), '</i></p>'; } // end if } /** * Selects the database and gets tables names */ $GLOBALS['dbi']->selectDb($db); $tables = $GLOBALS['dbi']->getTables($db); $count = 0; foreach ($tables as $table) {
/** * Returns the breadcrumbs as HTML * * @return string HTML formatted breadcrumbs */ private function _getBreadcrumbs() { $retval = ''; $tbl_is_view = PMA_Table::isView($this->_db, $this->_table); $server_info = !empty($GLOBALS['cfg']['Server']['verbose']) ? $GLOBALS['cfg']['Server']['verbose'] : $GLOBALS['cfg']['Server']['host']; $server_info .= empty($GLOBALS['cfg']['Server']['port']) ? '' : ':' . $GLOBALS['cfg']['Server']['port']; $separator = "<span class='separator item'> ยป</span>"; $item = '<a href="%1$s%2$s" class="item">'; if (PMA_Util::showText('TabsMode')) { $item .= '%4$s: '; } $item .= '%3$s</a>'; $retval .= "<div id='floating_menubar'></div>"; $retval .= "<div id='serverinfo'>"; if (PMA_Util::showIcons('TabsMode')) { $retval .= PMA_Util::getImage('s_host.png', '', array('class' => 'item')); } $retval .= sprintf($item, $GLOBALS['cfg']['DefaultTabServer'], PMA_URL_getCommon(), htmlspecialchars($server_info), __('Server')); if (mb_strlen($this->_db)) { $retval .= $separator; if (PMA_Util::showIcons('TabsMode')) { $retval .= PMA_Util::getImage('s_db.png', '', array('class' => 'item')); } $retval .= sprintf($item, $GLOBALS['cfg']['DefaultTabDatabase'], PMA_URL_getCommon(array('db' => $this->_db)), htmlspecialchars($this->_db), __('Database')); // if the table is being dropped, $_REQUEST['purge'] is set to '1' // so do not display the table name in upper div if (mb_strlen($this->_table) && !(isset($_REQUEST['purge']) && $_REQUEST['purge'] == '1')) { include './libraries/tbl_info.inc.php'; $retval .= $separator; if (PMA_Util::showIcons('TabsMode')) { $icon = $tbl_is_view ? 'b_views.png' : 's_tbl.png'; $retval .= PMA_Util::getImage($icon, '', array('class' => 'item')); } $retval .= sprintf($item, $GLOBALS['cfg']['DefaultTabTable'], PMA_URL_getCommon(array('db' => $this->_db, 'table' => $this->_table)), str_replace(' ', ' ', htmlspecialchars($this->_table)), $tbl_is_view ? __('View') : __('Table')); /** * Displays table comment */ if (!empty($show_comment) && !isset($GLOBALS['avoid_show_comment'])) { if (mb_strstr($show_comment, '; InnoDB free')) { $show_comment = preg_replace('@; InnoDB free:.*?$@', '', $show_comment); } $retval .= '<span class="table_comment"'; $retval .= ' id="span_table_comment">"'; $retval .= htmlspecialchars($show_comment); $retval .= '"</span>'; } // end if } else { // no table selected, display database comment if present $cfgRelation = PMA_getRelationsParam(); // Get additional information about tables for tooltip is done // in libraries/db_info.inc.php only once if ($cfgRelation['commwork']) { $comment = PMA_getDbComment($this->_db); /** * Displays table comment */ if (!empty($comment)) { $retval .= '<span class="table_comment"' . ' id="span_table_comment">"' . htmlspecialchars($comment) . '"</span>'; } // end if } } } $retval .= '<div class="clearfloat"></div>'; $retval .= '</div>'; return $retval; }
/** * Gets the comments for all rows of a table or the db itself * * @param string $db the name of the db to check for * @param string $table the name of the table to check for * * @return array [field_name] = comment * * @access public */ function PMA_getComments($db, $table = '') { $comments = array(); if ($table != '') { // MySQL native column comments $fields = PMA_DBI_get_columns($db, $table, null, true); if ($fields) { foreach ($fields as $field) { if (!empty($field['Comment'])) { $comments[$field['Field']] = $field['Comment']; } } } } else { $comments[] = PMA_getDbComment($db); } return $comments; }
// 2. there is only one database available (ie either only one database exists // or $GLOBALS['cfg']['Servers']['only_db'] is defined and is not an array) // In this case, the database should not be collapsible/expandable $img_plus = '<img class="icon" id="el%dImg" src="' . $pmaThemeImage . 'b_plus.png"' . ' width="9" height="9" alt="+" />'; $img_minus = '<img class="icon" id="el%dImg" src="' . $pmaThemeImage . 'b_minus.png"' . ' width="9" height="9" alt="-" />'; $href_left = '<a onclick="if (toggle(\'%d\')) return false;"' . ' href="navigation.php?%s" target="_self">'; $element_counter = 0; if ($GLOBALS['cfg']['LeftFrameLight'] && strlen($GLOBALS['db'])) { $table_list = PMA_getTableList($GLOBALS['db']); $table_count = count($table_list); // show selected databasename as link to DefaultTabDatabase-page // with table count in () $common_url_query = PMA_generate_common_url($GLOBALS['db']); $db_tooltip = ''; if ($GLOBALS['cfg']['ShowTooltip'] && $GLOBALS['cfgRelation']['commwork']) { $_db_tooltip = PMA_getDbComment($GLOBALS['db']); if ($_db_tooltip) { $db_tooltip = $_db_tooltip; } } $disp_name = $GLOBALS['db']; if ($db_tooltip && $GLOBALS['cfg']['ShowTooltipAliasDB']) { $disp_name = $db_tooltip; $disp_name_cut = $db_tooltip; $db_tooltip = $GLOBALS['db']; } ?> <p><a class="item" href="<?php echo $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . $common_url_query; ?>
/** * Returns the comment associated with node * This method should be overridden by specific type of nodes * * @return string */ public function getComment() { return PMA_getDbComment($this->real_name); }