/** * Get HTML for each table row of the database structure table, * And this function returns $odd_row param also * * @param integer $curr current entry * @param boolean $odd_row whether row is odd or not * @param boolean $table_is_view whether table is view or not * @param array $current_table current table * @param string $browse_table_label browse table label action link * @param string $tracking_icon tracking icon * @param boolean $server_slave_status server slave state * @param string $browse_table browse table action link * @param string $tbl_url_query table url query * @param string $search_table search table action link * @param boolean $db_is_system_schema whether db is information schema or not * @param array $titles titles array * @param string $empty_table empty table action link * @param string $drop_query table dropt query * @param string $drop_message table drop message * @param string $collation collation * @param string $formatted_size formatted size * @param string $unit unit * @param string $overhead overhead * @param string $create_time create time * @param string $update_time last update time * @param string $check_time last check time * @param boolean $is_show_stats whether stats is show or not * @param boolean $ignored ignored * @param boolean $do do * @param integer $colspan_for_structure colspan for structure * * @return array $html_output, $odd_row */ function PMA_getHtmlForStructureTableRow($curr, $odd_row, $table_is_view, $current_table, $browse_table_label, $tracking_icon, $server_slave_status, $browse_table, $tbl_url_query, $search_table, $db_is_system_schema, $titles, $empty_table, $drop_query, $drop_message, $collation, $formatted_size, $unit, $overhead, $create_time, $update_time, $check_time, $is_show_stats, $ignored, $do, $colspan_for_structure) { global $db; $html_output = '<tr class="' . ($odd_row ? 'odd' : 'even'); $odd_row = !$odd_row; $html_output .= ($table_is_view ? ' is_view' : '') . '" id="row_tbl_' . $curr . '">'; $html_output .= '<td class="center">' . '<input type="checkbox" name="selected_tbl[]" class="checkall" ' . 'value="' . htmlspecialchars($current_table['TABLE_NAME']) . '" ' . 'id="checkbox_tbl_' . $curr . '" /></td>'; $html_output .= '<th>' . $browse_table_label . (!empty($tracking_icon) ? $tracking_icon : '') . '</th>'; if ($server_slave_status) { $html_output .= '<td class="center">' . ($ignored ? PMA_Util::getImage('s_cancel.png', 'NOT REPLICATED') : '') . ($do ? PMA_Util::getImage('s_success.png', 'REPLICATED') : '') . '</td>'; } //Favorite table anchor. $html_output .= '<td class="center">' . PMA_getHtmlForFavoriteAnchor($db, $current_table['TABLE_NAME'], $titles) . '</td>'; $html_output .= '<td class="center">' . $browse_table . '</td>'; $html_output .= '<td class="center">' . '<a href="tbl_structure.php?' . $tbl_url_query . '">' . $titles['Structure'] . '</a></td>'; $html_output .= '<td class="center">' . $search_table . '</td>'; if (!$db_is_system_schema) { $html_output .= PMA_getHtmlForInsertEmptyDropActionLinks($tbl_url_query, $table_is_view, $titles, $empty_table, $current_table, $drop_query, $drop_message); } // end if (! $db_is_system_schema) // there is a null value in the ENGINE // - when the table needs to be repaired, or // - when it's a view // so ensure that we'll display "in use" below for a table // that needs to be repaired if (isset($current_table['TABLE_ROWS']) && ($current_table['ENGINE'] != null || $table_is_view)) { $html_output .= PMA_getHtmlForNotNullEngineViewTable($table_is_view, $current_table, $collation, $is_show_stats, $tbl_url_query, $formatted_size, $unit, $overhead, $create_time, $update_time, $check_time); } elseif ($table_is_view) { $html_output .= PMA_getHtmlForViewTable($is_show_stats); } else { $html_output .= PMA_getHtmlForRepairtable($colspan_for_structure, $db_is_system_schema); } // end if (isset($current_table['TABLE_ROWS'])) else $html_output .= '</tr>'; return array($html_output, $odd_row); }
$changes = false; $msg = '<div class="error"><img src="themes/dot.gif" ' . 'title="" alt="" class="icon ic_s_error" />' . __("Favorite List is full!") . '</div>'; } else { // Otherwise add to favorite list. $fav_instance->add($db, $favorite_table); } } } $favorite_tables[$user] = $fav_instance->getTables(); $ajax_response = PMA_Response::getInstance(); $ajax_response->addJSON('changes', $changes); if ($changes) { $ajax_response->addJSON('user', $user); $ajax_response->addJSON('favorite_tables', json_encode($favorite_tables)); $ajax_response->addJSON('list', $fav_instance->getHtmlList()); $ajax_response->addJSON('anchor', PMA_getHtmlForFavoriteAnchor($db, $favorite_table, $titles)); } else { $ajax_response->addJSON('message', $msg); } exit; } $response = PMA_Response::getInstance(); $header = $response->getHeader(); $scripts = $header->getScripts(); $scripts->addFile('db_structure.js'); $scripts->addFile('tbl_change.js'); $scripts->addFile('jquery/jquery-ui-timepicker-addon.js'); // Drops/deletes/etc. multiple tables if required if (!empty($_POST['submit_mult']) && isset($_POST['selected_tbl']) || isset($_POST['mult_btn'])) { $action = 'db_structure.php'; $err_url = 'db_structure.php?' . PMA_URL_getCommon($db);
/** * Add or remove favorite tables * * @param string $db current database * * @return void */ function PMA_addRemoveFavoriteTables($db) { $fav_instance = PMA_RecentFavoriteTable::getInstance('favorite'); if (isset($_REQUEST['favorite_tables'])) { $favorite_tables = json_decode($_REQUEST['favorite_tables'], true); } else { $favorite_tables = array(); } // Required to keep each user's preferences separate. $user = sha1($GLOBALS['cfg']['Server']['user']); // Request for Synchronization of favorite tables. if (isset($_REQUEST['sync_favorite_tables'])) { PMA_synchronizeFavoriteTables($fav_instance, $user, $favorite_tables); exit; } $changes = true; $msg = ''; $titles = PMA_Util::buildActionTitles(); $favorite_table = $_REQUEST['favorite_table']; $already_favorite = PMA_checkFavoriteTable($db, $favorite_table); if (isset($_REQUEST['remove_favorite'])) { if ($already_favorite) { // If already in favorite list, remove it. $fav_instance->remove($db, $favorite_table); } } elseif (isset($_REQUEST['add_favorite'])) { if (!$already_favorite) { if (count($fav_instance->getTables()) == $GLOBALS['cfg']['NumFavoriteTables']) { $changes = false; $msg = '<div class="error"><img src="themes/dot.gif" ' . 'title="" alt="" class="icon ic_s_error" />' . __("Favorite List is full!") . '</div>'; } else { // Otherwise add to favorite list. $fav_instance->add($db, $favorite_table); } } } $favorite_tables[$user] = $fav_instance->getTables(); $ajax_response = PMA_Response::getInstance(); $ajax_response->addJSON('changes', $changes); if ($changes) { $ajax_response->addJSON('user', $user); $ajax_response->addJSON('favorite_tables', json_encode($favorite_tables)); $ajax_response->addJSON('list', $fav_instance->getHtmlList()); $ajax_response->addJSON('anchor', PMA_getHtmlForFavoriteAnchor($db, array('TABLE_NAME' => $favorite_table), $titles)); } else { $ajax_response->addJSON('message', $msg); } }
$changes = false; $msg = '<div class="error"><img src="themes/dot.gif" ' . 'title="" alt="" class="icon ic_s_error" />' . __("Favorite List is full!") . '</div>'; } else { // Otherwise add to favorite list. $fav_instance->add($db, $favorite_table); } } } $favorite_tables[$user] = $fav_instance->getTables(); $ajax_response = PMA_Response::getInstance(); $ajax_response->addJSON('changes', $changes); if ($changes) { $ajax_response->addJSON('user', $user); $ajax_response->addJSON('favorite_tables', json_encode($favorite_tables)); $ajax_response->addJSON('list', $fav_instance->getHtmlList()); $ajax_response->addJSON('anchor', PMA_getHtmlForFavoriteAnchor($db, array('TABLE_NAME' => $favorite_table), $titles)); } else { $ajax_response->addJSON('message', $msg); } exit; } $response = PMA_Response::getInstance(); $header = $response->getHeader(); $scripts = $header->getScripts(); $scripts->addFile('db_structure.js'); $scripts->addFile('tbl_change.js'); $scripts->addFile('jquery/jquery-ui-timepicker-addon.js'); // Drops/deletes/etc. multiple tables if required if (!empty($_POST['submit_mult']) && isset($_POST['selected_tbl']) || isset($_POST['mult_btn'])) { $action = 'db_structure.php'; $err_url = 'db_structure.php?' . PMA_URL_getCommon($db);