diff --git a/libraries/designer.lib.php b/libraries/designer.lib.php index 36a2a6a40f..c1c7db5784 100644 --- a/libraries/designer.lib.php +++ b/libraries/designer.lib.php @@ -157,7 +157,6 @@ function PMA_getHtmlForSchemaExport($db, $page) )->getDisplay(); } - $htmlString = '
'; $htmlString .= '
'; diff --git a/libraries/plugins/schema/TableStats.class.php b/libraries/plugins/schema/TableStats.class.php index 1fb234fd44..02700312d8 100644 --- a/libraries/plugins/schema/TableStats.class.php +++ b/libraries/plugins/schema/TableStats.class.php @@ -136,8 +136,8 @@ abstract class TableStats . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . "." . PMA_Util::backquote($GLOBALS['cfgRelation']['table_coords']) . " WHERE db_name = '" . PMA_Util::sqlAddSlashes($this->db) . "'" - . " AND table_name = '" . PMA_Util::sqlAddSlashes($this->tableName) . "'" - . " AND pdf_page_number = " . $this->pageNumber; + . " AND table_name = '" . PMA_Util::sqlAddSlashes($this->tableName) + . "' AND pdf_page_number = " . $this->pageNumber; $result = PMA_queryAsControlUser( $sql, false, PMA_DatabaseInterface::QUERY_STORE ); diff --git a/libraries/plugins/schema/dia/Dia_Relation_Schema.class.php b/libraries/plugins/schema/dia/Dia_Relation_Schema.class.php index a047d9ebdc..a395ba99ee 100644 --- a/libraries/plugins/schema/dia/Dia_Relation_Schema.class.php +++ b/libraries/plugins/schema/dia/Dia_Relation_Schema.class.php @@ -256,32 +256,37 @@ class PMA_Dia_Relation_Schema extends PMA_Export_Relation_Schema $seen_a_relation = false; foreach ($alltables as $one_table) { $exist_rel = PMA_getForeigners($GLOBALS['db'], $one_table, '', 'both'); - if ($exist_rel) { - $seen_a_relation = true; - foreach ($exist_rel as $master_field => $rel) { - /* put the foreign table on the schema only if selected - * by the user - * (do not use array_search() because we would have to - * to do a === false and this is not PHP3 compatible) - */ - if ($master_field != 'foreign_keys_data') { - if (in_array($rel['foreign_table'], $alltables)) { - $this->_addRelation( - $one_table, $master_field, $rel['foreign_table'], - $rel['foreign_field'], $this->showKeys - ); - } - } else { - foreach ($rel as $key => $one_key) { - if (in_array($one_key['ref_table_name'], $alltables)) { - foreach ($one_key['index_list'] as $index => $one_field) { - $this->_addRelation( - $one_table, $one_field, $one_key['ref_table_name'], - $one_key['ref_index_list'][$index], $this->showKeys - ); - } - } - } + if (!$exist_rel) { + continue; + } + + $seen_a_relation = true; + foreach ($exist_rel as $master_field => $rel) { + /* put the foreign table on the schema only if selected + * by the user + * (do not use array_search() because we would have to + * to do a === false and this is not PHP3 compatible) + */ + if ($master_field != 'foreign_keys_data') { + if (in_array($rel['foreign_table'], $alltables)) { + $this->_addRelation( + $one_table, $master_field, $rel['foreign_table'], + $rel['foreign_field'], $this->showKeys + ); + } + continue; + } + + foreach ($rel as $one_key) { + if (!in_array($one_key['ref_table_name'], $alltables)) { + continue; + } + + foreach ($one_key['index_list'] as $index => $one_field) { + $this->_addRelation( + $one_table, $one_field, $one_key['ref_table_name'], + $one_key['ref_index_list'][$index], $this->showKeys + ); } } } diff --git a/libraries/plugins/schema/eps/Eps_Relation_Schema.class.php b/libraries/plugins/schema/eps/Eps_Relation_Schema.class.php index 95854e6c14..bea5b96b08 100644 --- a/libraries/plugins/schema/eps/Eps_Relation_Schema.class.php +++ b/libraries/plugins/schema/eps/Eps_Relation_Schema.class.php @@ -378,38 +378,43 @@ class PMA_Eps_Relation_Schema extends PMA_Export_Relation_Schema $seen_a_relation = false; foreach ($alltables as $one_table) { $exist_rel = PMA_getForeigners($GLOBALS['db'], $one_table, '', 'both'); - if ($exist_rel) { - $seen_a_relation = true; - foreach ($exist_rel as $master_field => $rel) { - /* put the foreign table on the schema only if selected - * by the user - * (do not use array_search() because we would have to - * to do a === false and this is not PHP3 compatible) - */ - if ($master_field != 'foreign_keys_data') { - if (in_array($rel['foreign_table'], $alltables)) { - $this->_addRelation( - $one_table, $eps->getFont(), $eps->getFontSize(), - $master_field, $rel['foreign_table'], - $rel['foreign_field'], $this->tableDimension - ); - } - } else { - foreach ($rel as $key => $one_key) { - if (in_array($one_key['ref_table_name'], $alltables)) { - foreach ($one_key['index_list'] - as $index => $one_field - ) { - $this->_addRelation( - $one_table, $eps->getFont(), - $eps->getFontSize(), - $one_field, $one_key['ref_table_name'], - $one_key['ref_index_list'][$index], - $this->tableDimension - ); - } - } - } + if (!$exist_rel) { + continue; + } + + $seen_a_relation = true; + foreach ($exist_rel as $master_field => $rel) { + /* put the foreign table on the schema only if selected + * by the user + * (do not use array_search() because we would have to + * to do a === false and this is not PHP3 compatible) + */ + if ($master_field != 'foreign_keys_data') { + if (in_array($rel['foreign_table'], $alltables)) { + $this->_addRelation( + $one_table, $eps->getFont(), $eps->getFontSize(), + $master_field, $rel['foreign_table'], + $rel['foreign_field'], $this->tableDimension + ); + } + continue; + } + + foreach ($rel as $one_key) { + if (!in_array($one_key['ref_table_name'], $alltables)) { + continue; + } + + foreach ($one_key['index_list'] + as $index => $one_field + ) { + $this->_addRelation( + $one_table, $eps->getFont(), + $eps->getFontSize(), + $one_field, $one_key['ref_table_name'], + $one_key['ref_index_list'][$index], + $this->tableDimension + ); } } } diff --git a/libraries/plugins/schema/pdf/Pdf_Relation_Schema.class.php b/libraries/plugins/schema/pdf/Pdf_Relation_Schema.class.php index 0905267455..7e35b46b64 100644 --- a/libraries/plugins/schema/pdf/Pdf_Relation_Schema.class.php +++ b/libraries/plugins/schema/pdf/Pdf_Relation_Schema.class.php @@ -253,8 +253,8 @@ class PMA_Schema_PDF extends PMA_PDF $test_query = 'SELECT * FROM ' . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_Util::backquote($GLOBALS['cfgRelation']['pdf_pages']) - . ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($GLOBALS['db']) . '\'' - . ' AND page_nr = \'' . $this->_exportingPage . '\''; + . ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($GLOBALS['db']) + . '\' AND page_nr = \'' . $this->_exportingPage . '\''; $test_rs = PMA_queryAsControlUser($test_query); $pages = @$GLOBALS['dbi']->fetchAssoc($test_rs); $pg_name = ucfirst($pages['page_descr']); @@ -557,40 +557,45 @@ class PMA_Pdf_Relation_Schema extends PMA_Export_Relation_Schema $seen_a_relation = false; foreach ($alltables as $one_table) { $exist_rel = PMA_getForeigners($GLOBALS['db'], $one_table, '', 'both'); - if ($exist_rel) { - $seen_a_relation = true; - foreach ($exist_rel as $master_field => $rel) { - // put the foreign table on the schema only if selected - // by the user - // (do not use array_search() because we would have to - // to do a === false and this is not PHP3 compatible) - if ($master_field != 'foreign_keys_data') { - if (in_array($rel['foreign_table'], $alltables)) { - $this->_addRelation( - $one_table, - $master_field, - $rel['foreign_table'], - $rel['foreign_field'] - ); - } - } else { - foreach ($rel as $key => $one_key) { - if (in_array($one_key['ref_table_name'], $alltables)) { - foreach ($one_key['index_list'] - as $index => $one_field - ) { - $this->_addRelation( - $one_table, - $one_field, - $one_key['ref_table_name'], - $rel['foreign_field'][$index] - ); - } - } - } + if (!$exist_rel) { + continue; + } + + $seen_a_relation = true; + foreach ($exist_rel as $master_field => $rel) { + // put the foreign table on the schema only if selected + // by the user + // (do not use array_search() because we would have to + // to do a === false and this is not PHP3 compatible) + if ($master_field != 'foreign_keys_data') { + if (in_array($rel['foreign_table'], $alltables)) { + $this->_addRelation( + $one_table, + $master_field, + $rel['foreign_table'], + $rel['foreign_field'] + ); } - } // end while - } // end if + continue; + } + + foreach ($rel as $one_key) { + if (!in_array($one_key['ref_table_name'], $alltables)) { + continue; + } + + foreach ($one_key['index_list'] + as $index => $one_field + ) { + $this->_addRelation( + $one_table, + $one_field, + $one_key['ref_table_name'], + $rel['foreign_field'][$index] + ); + } + } + } // end while } // end while if ($seen_a_relation) { diff --git a/libraries/plugins/schema/svg/Svg_Relation_Schema.class.php b/libraries/plugins/schema/svg/Svg_Relation_Schema.class.php index 9cb0c11482..6a690a6a46 100644 --- a/libraries/plugins/schema/svg/Svg_Relation_Schema.class.php +++ b/libraries/plugins/schema/svg/Svg_Relation_Schema.class.php @@ -350,38 +350,43 @@ class PMA_Svg_Relation_Schema extends PMA_Export_Relation_Schema $seen_a_relation = false; foreach ($alltables as $one_table) { $exist_rel = PMA_getForeigners($GLOBALS['db'], $one_table, '', 'both'); - if ($exist_rel) { - $seen_a_relation = true; - foreach ($exist_rel as $master_field => $rel) { - /* put the foreign table on the schema only if selected - * by the user - * (do not use array_search() because we would have to - * to do a === false and this is not PHP3 compatible) - */ - if ($master_field != 'foreign_keys_data') { - if (in_array($rel['foreign_table'], $alltables)) { - $this->_addRelation( - $one_table, $svg->getFont(), $svg->getFontSize(), - $master_field, $rel['foreign_table'], - $rel['foreign_field'], $this->tableDimension - ); - } - } else { - foreach ($rel as $key => $one_key) { - if (in_array($one_key['ref_table_name'], $alltables)) { - foreach ($one_key['index_list'] - as $index => $one_field - ) { - $this->_addRelation( - $one_table, $svg->getFont(), - $svg->getFontSize(), - $one_field, $one_key['ref_table_name'], - $one_key['ref_index_list'][$index], - $this->tableDimension - ); - } - } - } + if (!$exist_rel) { + continue; + } + + $seen_a_relation = true; + foreach ($exist_rel as $master_field => $rel) { + /* put the foreign table on the schema only if selected + * by the user + * (do not use array_search() because we would have to + * to do a === false and this is not PHP3 compatible) + */ + if ($master_field != 'foreign_keys_data') { + if (in_array($rel['foreign_table'], $alltables)) { + $this->_addRelation( + $one_table, $svg->getFont(), $svg->getFontSize(), + $master_field, $rel['foreign_table'], + $rel['foreign_field'], $this->tableDimension + ); + } + continue; + } + + foreach ($rel as $one_key) { + if (!in_array($one_key['ref_table_name'], $alltables)) { + continue; + } + + foreach ($one_key['index_list'] + as $index => $one_field + ) { + $this->_addRelation( + $one_table, $svg->getFont(), + $svg->getFontSize(), + $one_field, $one_key['ref_table_name'], + $one_key['ref_index_list'][$index], + $this->tableDimension + ); } } }