Example #1
0
/**
 * Inserts existing entries in a PMA_* table by reading a value from an old entry
 *
 * @param   string  The array index, which Relation feature to check
 *                  ('relwork', 'commwork', ...)
 * @param   string  The array index, which PMA-table to update
 *                  ('bookmark', 'relation', ...)
 * @param   array   Which fields will be SELECT'ed from the old entry
 * @param   array   Which fields will be used for the WHERE query
 *                  (array('FIELDNAME' => 'FIELDVALUE'))
 * @param   array   Which fields will be used as new VALUES. These are the important
 *                  keys which differ from the old entry.
 *                  (array('FIELDNAME' => 'NEW FIELDVALUE'))
 * @global  string  relation variable
 *
 * @author          Garvin Hicking <*****@*****.**>
 */
function PMA_duplicate_table($work, $pma_table, $get_fields, $where_fields, $new_fields)
{
    global $cfgRelation;
    $last_id = -1;
    if ($cfgRelation[$work]) {
        $select_parts = array();
        $row_fields = array();
        foreach ($get_fields as $nr => $get_field) {
            $select_parts[] = PMA_backquote($get_field);
            $row_fields[$get_field] = 'cc';
        }
        $where_parts = array();
        foreach ($where_fields as $_where => $_value) {
            $where_parts[] = PMA_backquote($_where) . ' = \'' . PMA_sqlAddslashes($_value) . '\'';
        }
        $new_parts = array();
        $new_value_parts = array();
        foreach ($new_fields as $_where => $_value) {
            $new_parts[] = PMA_backquote($_where);
            $new_value_parts[] = PMA_sqlAddslashes($_value);
        }
        $table_copy_query = 'SELECT ' . implode(', ', $select_parts) . ' FROM ' . PMA_backquote($cfgRelation[$pma_table]) . ' WHERE ' . implode(' AND ', $where_parts);
        $table_copy_rs = PMA_query_as_cu($table_copy_query);
        while ($table_copy_row = @PMA_mysql_fetch_array($table_copy_rs)) {
            $value_parts = array();
            foreach ($table_copy_row as $_key => $_val) {
                if (isset($row_fields[$_key]) && $row_fields[$_key] == 'cc') {
                    $value_parts[] = PMA_sqlAddslashes($_val);
                }
            }
            $new_table_query = 'INSERT IGNORE INTO ' . PMA_backquote($cfgRelation[$pma_table]) . ' (' . implode(', ', $select_parts) . ', ' . implode(', ', $new_parts) . ')' . ' VALUES ' . ' (\'' . implode('\', \'', $value_parts) . '\', \'' . implode('\', \'', $new_value_parts) . '\')';
            $new_table_rs = PMA_query_as_cu($new_table_query);
            $last_id = @function_exists('mysql_insert_id') ? @mysql_insert_id() : -1;
        }
        // end while
        return $last_id;
    }
    return true;
}
 /**
 * The "Table_Stats" constructor
 *
 * @param string table_name The table name
 * @param integer ff The font size
 * @param integer samewidth The max. with among tables
 * @param boolean show_keys Whether to display keys or not
 * @param boolean show_info Whether to display table position or not
 * @global object    The current SVG image document
 * @global integer   The current page number (from the
 *                     $cfg['Servers'][$i]['table_coords'] table)
 * @global array     The relations settings
 * @global string    The current db name
 * @access private
 * @see PMA_SVG, Table_Stats::Table_Stats_setWidth,
        Table_Stats::Table_Stats_setHeight
 */
 function __construct($tableName, $font, $fontSize, $pageNumber, &$same_wide_width, $showKeys = false, $showInfo = false)
 {
     global $svg, $cfgRelation, $db;
     $this->_tableName = $tableName;
     $sql = 'DESCRIBE ' . PMA_backquote($tableName);
     $result = PMA_DBI_try_query($sql, null, PMA_DBI_QUERY_STORE);
     if (!$result || !PMA_DBI_num_rows($result)) {
         $svg->dieSchema($pageNumber, "SVG", sprintf(__('The %s table doesn\'t exist!'), $tableName));
     }
     /*
      * load fields
      * check to see if it will load all fields or only the foreign keys
      */
     if ($showKeys) {
         $indexes = PMA_Index::getFromTable($this->_tableName, $db);
         $all_columns = array();
         foreach ($indexes as $index) {
             $all_columns = array_merge($all_columns, array_flip(array_keys($index->getColumns())));
         }
         $this->fields = array_keys($all_columns);
     } else {
         while ($row = PMA_DBI_fetch_row($result)) {
             $this->fields[] = $row[0];
         }
     }
     $this->_showInfo = $showInfo;
     // height and width
     $this->_setHeightTable($fontSize);
     // setWidth must me after setHeight, because title
     // can include table height which changes table width
     $this->_setWidthTable($font, $fontSize);
     if ($same_wide_width < $this->width) {
         $same_wide_width = $this->width;
     }
     // x and y
     $sql = 'SELECT x, y FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']) . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . ' AND   table_name = \'' . PMA_sqlAddslashes($tableName) . '\'' . ' AND   pdf_page_number = ' . $pageNumber;
     $result = PMA_query_as_controluser($sql, false, PMA_DBI_QUERY_STORE);
     if (!$result || !PMA_DBI_num_rows($result)) {
         $svg->dieSchema($pageNumber, "SVG", sprintf(__('Please configure the coordinates for table %s'), $tableName));
     }
     list($this->x, $this->y) = PMA_DBI_fetch_row($result);
     $this->x = (double) $this->x;
     $this->y = (double) $this->y;
     // displayfield
     $this->displayfield = PMA_getDisplayField($db, $tableName);
     // index
     $result = PMA_DBI_query('SHOW INDEX FROM ' . PMA_backquote($tableName) . ';', null, PMA_DBI_QUERY_STORE);
     if (PMA_DBI_num_rows($result) > 0) {
         while ($row = PMA_DBI_fetch_assoc($result)) {
             if ($row['Key_name'] == 'PRIMARY') {
                 $this->primary[] = $row['Column_name'];
             }
         }
     }
 }
/**
 * Deletes a bookmark
 *
 * @uses    PMA_backquote()
 * @uses    PMA_sqlAddslashes()
 * @uses    PMA_DBI_try_query()
 * @uses    PMA_Bookmark_getParams()
 * @global  resource  the controluser db connection handle
 *
 * @param   string   the current database name
 * @param   integer  the id of the bookmark to get
 *
 * @access  public
 */
function PMA_Bookmark_delete($db, $id)
{
    global $controllink;
    $cfgBookmark = PMA_Bookmark_getParams();
    if (empty($cfgBookmark)) {
        return false;
    }
    $query = 'DELETE FROM ' . PMA_backquote($cfgBookmark['db']) . '.' . PMA_backquote($cfgBookmark['table']) . ' WHERE (user = \'' . PMA_sqlAddslashes($cfgBookmark['user']) . '\'' . '        OR user = \'\')' . ' AND id = ' . $id;
    return PMA_DBI_try_query($query, $controllink);
}
        $message = $strSuccess;
    }
}
if (isset($submittype)) {
    $sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' TYPE = ' . $tbl_type;
    $result = PMA_DBI_query($sql_query);
    $message = $strSuccess;
}
if (isset($submitcollation)) {
    $sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' DEFAULT' . PMA_generateCharsetQueryPart($tbl_collation);
    $result = PMA_DBI_query($sql_query);
    $message = $strSuccess;
    unset($tbl_collation);
}
if (isset($submitoptions)) {
    $sql_query = 'ALTER TABLE ' . PMA_backquote($table) . (isset($pack_keys) ? ' pack_keys=1' : ' pack_keys=0') . (isset($checksum) ? ' checksum=1' : ' checksum=0') . (isset($delay_key_write) ? ' delay_key_write=1' : ' delay_key_write=0') . (!empty($auto_increment) ? ' auto_increment=' . PMA_sqlAddslashes($auto_increment) : '');
    $result = PMA_DBI_query($sql_query);
    $message = $strSuccess;
}
/**
 * Reordering the table has been requested by the user
 */
if (isset($submitorderby) && !empty($order_field)) {
    $sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' ORDER BY ' . PMA_backquote(urldecode($order_field));
    if (isset($order_order) && $order_order == 'desc') {
        $sql_query .= ' DESC';
    }
    $result = PMA_DBI_query($sql_query);
    $message = $result ? $strSuccess : $strFailed;
}
// end if
Example #5
0
/**
* Set a single mimetype to a certain value.
*
* @param   string   the name of the db
* @param   string   the name of the table
* @param   string   the name of the column
* @param   string   the mimetype of the column
* @param   string   the transformation of the column
* @param   string   the transformation options of the column
* @param   string   (optional) force delete, will erase any existing comments for this column
*
* @return  boolean  true, if comment-query was made.
*
* @global  array    the list of relations settings
*
* @access  public
*/
function PMA_setMIME($db, $table, $key, $mimetype, $transformation, $transformation_options, $forcedelete = false)
{
    global $cfgRelation;
    $test_qry = 'SELECT mimetype, ' . PMA_backquote('comment') . ' FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'' . ' AND column_name = \'' . PMA_sqlAddslashes($key) . '\'';
    $test_rs = PMA_query_as_cu($test_qry, TRUE, PMA_DBI_QUERY_STORE);
    if ($test_rs && PMA_DBI_num_rows($test_rs) > 0) {
        $row = @PMA_DBI_fetch_assoc($test_rs);
        PMA_DBI_free_result($test_rs);
        unset($test_rs);
        if (!$forcedelete && (strlen($mimetype) > 0 || strlen($transformation) > 0 || strlen($transformation_options) > 0 || strlen($row['comment']) > 0)) {
            $upd_query = 'UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . ' SET mimetype = \'' . PMA_sqlAddslashes($mimetype) . '\',' . '     transformation = \'' . PMA_sqlAddslashes($transformation) . '\',' . '     transformation_options = \'' . PMA_sqlAddslashes($transformation_options) . '\'' . ' WHERE db_name  = \'' . PMA_sqlAddslashes($db) . '\'' . ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'' . ' AND column_name = \'' . PMA_sqlAddslashes($key) . '\'';
        } else {
            $upd_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . ' WHERE db_name  = \'' . PMA_sqlAddslashes($db) . '\'' . ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'' . ' AND column_name = \'' . PMA_sqlAddslashes($key) . '\'';
        }
    } elseif (strlen($mimetype) > 0 || strlen($transformation) > 0 || strlen($transformation_options) > 0) {
        $upd_query = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . ' (db_name, table_name, column_name, mimetype, transformation, transformation_options) ' . ' VALUES(' . '\'' . PMA_sqlAddslashes($db) . '\',' . '\'' . PMA_sqlAddslashes($table) . '\',' . '\'' . PMA_sqlAddslashes($key) . '\',' . '\'' . PMA_sqlAddslashes($mimetype) . '\',' . '\'' . PMA_sqlAddslashes($transformation) . '\',' . '\'' . PMA_sqlAddslashes($transformation_options) . '\')';
    }
    if (isset($upd_query)) {
        $upd_rs = PMA_query_as_cu($upd_query);
        PMA_DBI_free_result($upd_rs);
        unset($upd_rs);
        return true;
    } else {
        return false;
    }
}
Example #6
0
">
        <td colspan="3">
        <?php 
    echo '<a href="pdf_pages.php?' . $takeaway . '">';
    if ($cfg['PropertiesIconic']) {
        echo '<img src="' . $pmaThemeImage . 'b_edit.png" border="0" width="16" height="16" hspace="2" align="middle" />';
    }
    echo '' . $strEditPDFPages . '</a>';
    ?>
        </td>
    </tr>

    <!-- PDF schema -->
    <?php 
    // We only show this if we find something in the new pdf_pages table
    $test_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['pdf_pages']) . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
    $test_rs = PMA_query_as_cu($test_query, NULL, PMA_DBI_QUERY_STORE);
    if ($test_rs && PMA_DBI_num_rows($test_rs) > 0) {
        ?>
    <tr bgcolor="<?php 
        echo $cfg['BgcolorTwo'];
        ?>
">
        <td colspan="3">
        <?php 
        echo PMA_generate_common_hidden_inputs($db);
        if ($cfg['PropertiesIconic']) {
            echo '<img src="' . $pmaThemeImage . 'b_view.png" border="0" width="16" height="16" hspace="2" align="middle" />';
        }
        echo $strDisplayPDF;
        ?>
Example #7
0
 /**
  * Function to generate unique condition for specified row.
  *
  * @param   resource    handle for current query
  * @param   integer     number of fields
  * @param   array       meta information about fields
  * @param   array       current row
  *
  * @access  public
  * @author  Michal Cihar (michal@cihar.com)
  * @return  string      calculated condition
  */
 function PMA_getUvaCondition($handle, $fields_cnt, $fields_meta, $row)
 {
     $primary_key = '';
     $unique_key = '';
     $uva_nonprimary_condition = '';
     for ($i = 0; $i < $fields_cnt; ++$i) {
         $field_flags = PMA_DBI_field_flags($handle, $i);
         $meta = $fields_meta[$i];
         // do not use an alias in a condition
         $column_for_condition = $meta->name;
         if (isset($analyzed_sql[0]['select_expr']) && is_array($analyzed_sql[0]['select_expr'])) {
             foreach ($analyzed_sql[0]['select_expr'] as $select_expr_position => $select_expr) {
                 $alias = $analyzed_sql[0]['select_expr'][$select_expr_position]['alias'];
                 if (!empty($alias)) {
                     $true_column = $analyzed_sql[0]['select_expr'][$select_expr_position]['column'];
                     if ($alias == $meta->name) {
                         $column_for_condition = $true_column;
                     }
                     // end if
                 }
                 // end if
             }
             // end while
         }
         // to fix the bug where float fields (primary or not)
         // can't be matched because of the imprecision of
         // floating comparison, use CONCAT
         // (also, the syntax "CONCAT(field) IS NULL"
         // that we need on the next "if" will work)
         if ($meta->type == 'real') {
             $condition = ' CONCAT(' . PMA_backquote($column_for_condition) . ') ';
         } else {
             // string and blob fields have to be converted using
             // the system character set (always utf8) since
             // mysql4.1 can use different charset for fields.
             if (PMA_MYSQL_INT_VERSION >= 40100 && ($meta->type == 'string' || $meta->type == 'blob')) {
                 $condition = ' CONVERT(' . PMA_backquote($column_for_condition) . ' USING utf8) ';
             } else {
                 $condition = ' ' . PMA_backquote($column_for_condition) . ' ';
             }
         }
         // end if... else...
         if (!isset($row[$i]) || is_null($row[$i])) {
             $condition .= 'IS NULL AND';
         } else {
             // timestamp is numeric on some MySQL 4.1
             if ($meta->numeric && $meta->type != 'timestamp') {
                 $condition .= '= ' . $row[$i] . ' AND';
             } elseif ($meta->type == 'blob' && stristr($field_flags, 'BINARY') && !empty($row[$i])) {
                 // use a CAST if possible, to avoid problems
                 // if the field contains wildcard characters % or _
                 if (PMA_MYSQL_INT_VERSION < 40002) {
                     $condition .= 'LIKE 0x' . bin2hex($row[$i]) . ' AND';
                 } else {
                     $condition .= '= CAST(0x' . bin2hex($row[$i]) . ' AS BINARY) AND';
                 }
             } else {
                 $condition .= '= \'' . PMA_sqlAddslashes($row[$i], FALSE, TRUE) . '\' AND';
             }
         }
         if ($meta->primary_key > 0) {
             $primary_key .= $condition;
         } else {
             if ($meta->unique_key > 0) {
                 $unique_key .= $condition;
             }
         }
         $uva_nonprimary_condition .= $condition;
     }
     // end for
     // Correction uva 19991216: prefer primary or unique keys
     // for condition, but use conjunction of all values if no
     // primary key
     if ($primary_key) {
         $uva_condition = $primary_key;
     } else {
         if ($unique_key) {
             $uva_condition = $unique_key;
         } else {
             $uva_condition = $uva_nonprimary_condition;
         }
     }
     return preg_replace('|\\s?AND$|', '', $uva_condition);
 }
Example #8
0
 * Go back to the calling script
 */
// Checks for a valid target script
if (isset($table) && $table == '') {
    unset($table);
}
if (isset($db) && $db == '') {
    unset($db);
}
$is_db = $is_table = FALSE;
if ($goto == 'tbl_properties.php') {
    if (!isset($table)) {
        $goto = 'db_details.php';
    } else {
        PMA_mysql_select_db($db);
        $is_table = @PMA_mysql_query('SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\'');
        if (!($is_table && @mysql_numrows($is_table))) {
            $goto = 'db_details.php';
            unset($table);
        }
    }
    // end if... else...
}
if ($goto == 'db_details.php') {
    if (isset($table)) {
        unset($table);
    }
    if (!isset($db)) {
        $goto = 'main.php';
    } else {
        $is_db = @PMA_mysql_select_db($db);
Example #9
0
/**
 * Deletes a bookmark
 *
 * @global  resource  the controluser db connection handle
 *
 * @param   string   the current database name
 * @param   array    the bookmark parameters for the current user
 * @param   integer  the id of the bookmark to get
 *
 * @access  public
 */
function PMA_deleteBookmarks($db, $cfgBookmark, $id)
{
    global $controllink;
    $query = 'DELETE FROM ' . PMA_backquote($cfgBookmark['db']) . '.' . PMA_backquote($cfgBookmark['table']) . ' WHERE (user = \'' . PMA_sqlAddslashes($cfgBookmark['user']) . '\'' . '        OR user = \'\')' . ' AND id = ' . $id;
    $result = PMA_DBI_try_query($query, $controllink);
}
/**
 * returns details about the TRIGGERs of a specific table
 *
 * @uses    PMA_DBI_fetch_result()
 * @param   string              $db     db name
 * @param   string              $table  table name
 * @param   string              $delimiter  the delimiter to use (may be empty)
 *
 * @return  array               information about triggers (may be empty)
 */
function PMA_DBI_get_triggers($db, $table, $delimiter = '//')
{
    $result = array();
    if (!$GLOBALS['cfg']['Server']['DisableIS']) {
        // Note: in http://dev.mysql.com/doc/refman/5.0/en/faqs-triggers.html
        // their example uses WHERE TRIGGER_SCHEMA='dbname' so let's use this
        // instead of WHERE EVENT_OBJECT_SCHEMA='dbname'
        $triggers = PMA_DBI_fetch_result("SELECT TRIGGER_SCHEMA, TRIGGER_NAME, EVENT_MANIPULATION, ACTION_TIMING, ACTION_STATEMENT, EVENT_OBJECT_SCHEMA, EVENT_OBJECT_TABLE FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA= '" . PMA_sqlAddslashes($db, true) . "' and EVENT_OBJECT_TABLE = '" . PMA_sqlAddslashes($table, true) . "';");
    } else {
        $triggers = PMA_DBI_fetch_result("SHOW TRIGGERS FROM " . PMA_sqlAddslashes($db, true) . " LIKE '" . PMA_sqlAddslashes($table, true) . "';");
    }
    if ($triggers) {
        foreach ($triggers as $trigger) {
            if ($GLOBALS['cfg']['Server']['DisableIS']) {
                $trigger['TRIGGER_NAME'] = $trigger['Trigger'];
                $trigger['ACTION_TIMING'] = $trigger['Timing'];
                $trigger['EVENT_MANIPULATION'] = $trigger['Event'];
                $trigger['EVENT_OBJECT_TABLE'] = $trigger['Table'];
                $trigger['ACTION_STATEMENT'] = $trigger['Statement'];
            }
            $one_result = array();
            $one_result['name'] = $trigger['TRIGGER_NAME'];
            $one_result['action_timing'] = $trigger['ACTION_TIMING'];
            $one_result['event_manipulation'] = $trigger['EVENT_MANIPULATION'];
            // do not prepend the schema name; this way, importing the
            // definition into another schema will work
            $one_result['full_trigger_name'] = PMA_backquote($trigger['TRIGGER_NAME']);
            $one_result['drop'] = 'DROP TRIGGER IF EXISTS ' . $one_result['full_trigger_name'];
            $one_result['create'] = 'CREATE TRIGGER ' . $one_result['full_trigger_name'] . ' ' . $trigger['ACTION_TIMING'] . ' ' . $trigger['EVENT_MANIPULATION'] . ' ON ' . PMA_backquote($trigger['EVENT_OBJECT_TABLE']) . "\n" . ' FOR EACH ROW ' . $trigger['ACTION_STATEMENT'] . "\n" . $delimiter . "\n";
            $result[] = $one_result;
        }
    }
    return $result;
}
    /**
     * this is just a backup, if all is fine this can be deleted later
     *
     * @deprecated
     */
    protected function _checkAgainstPrivTables()
    {
        // 1. get allowed dbs from the "mysql.db" table
        // lem9: User can be blank (anonymous user)
        $local_query = "
            SELECT DISTINCT `Db` FROM `mysql`.`db`
            WHERE `Select_priv` = 'Y'
            AND `User`
            IN ('" . PMA_sqlAddslashes($GLOBALS['cfg']['Server']['user']) . "', '')";
        $tmp_mydbs = PMA_DBI_fetch_result($local_query, null, null,
            $GLOBALS['controllink']);
        if ($tmp_mydbs) {
            // Will use as associative array of the following 2 code
            // lines:
            //   the 1st is the only line intact from before
            //     correction,
            //   the 2nd replaces $dblist[] = $row['Db'];

            // Code following those 2 lines in correction continues
            // populating $dblist[], as previous code did. But it is
            // now populated with actual database names instead of
            // with regular expressions.
            $tmp_alldbs = PMA_DBI_query('SHOW DATABASES;', $GLOBALS['controllink']);
            // loic1: all databases cases - part 2
            if (isset($tmp_mydbs['%'])) {
                while ($tmp_row = PMA_DBI_fetch_row($tmp_alldbs)) {
                    $dblist[] = $tmp_row[0];
                } // end while
            } else {
                while ($tmp_row = PMA_DBI_fetch_row($tmp_alldbs)) {
                    $tmp_db = $tmp_row[0];
                    if (isset($tmp_mydbs[$tmp_db]) && $tmp_mydbs[$tmp_db] == 1) {
                        $dblist[]           = $tmp_db;
                        $tmp_mydbs[$tmp_db] = 0;
                    } elseif (!isset($dblist[$tmp_db])) {
                        foreach ($tmp_mydbs as $tmp_matchpattern => $tmp_value) {
                            // loic1: fixed bad regexp
                            // TODO: db names may contain characters
                            //       that are regexp instructions
                            $re        = '(^|(\\\\\\\\)+|[^\])';
                            $tmp_regex = preg_replace('/' . addcslashes($re,'/') . '%/', '\\1.*', preg_replace('/' . addcslashes($re,'/') . '_/', '\\1.{1}', $tmp_matchpattern));
                            // Fixed db name matching
                            // 2000-08-28 -- Benjamin Gandon
                            if (preg_match('/^' . addcslashes($tmp_regex,'/') . '$/', $tmp_db)) {
                                $dblist[] = $tmp_db;
                                break;
                            }
                        } // end while
                    } // end if ... elseif ...
                } // end while
            } // end else
            PMA_DBI_free_result($tmp_alldbs);
            unset($tmp_mydbs);
        } // end if

        // 2. get allowed dbs from the "mysql.tables_priv" table
        $local_query = 'SELECT DISTINCT Db FROM mysql.tables_priv WHERE Table_priv LIKE \'%Select%\' AND User = \'' . PMA_sqlAddslashes($GLOBALS['cfg']['Server']['user']) . '\'';
        $rs          = PMA_DBI_try_query($local_query, $GLOBALS['controllink']);
        if ($rs && @PMA_DBI_num_rows($rs)) {
            while ($row = PMA_DBI_fetch_assoc($rs)) {
                if (!in_array($row['Db'], $dblist)) {
                    $dblist[] = $row['Db'];
                }
            } // end while
            PMA_DBI_free_result($rs);
        } // end if
    }
Example #12
0
/**
 * Composes the query necessary to create a routine from an HTTP request.
 *
 * @return  string  The CREATE [ROUTINE | PROCEDURE] query.
 */
function PMA_RTN_getQueryFromRequest()
{
    global $_REQUEST, $cfg, $errors, $param_sqldataaccess, $param_directions;
    $_REQUEST['item_type'] = isset($_REQUEST['item_type']) ? $_REQUEST['item_type'] : '';
    $query = 'CREATE ';
    if (!empty($_REQUEST['item_definer'])) {
        if (strpos($_REQUEST['item_definer'], '@') !== false) {
            $arr = explode('@', $_REQUEST['item_definer']);
            $query .= 'DEFINER=' . PMA_backquote($arr[0]);
            $query .= '@' . PMA_backquote($arr[1]) . ' ';
        } else {
            $errors[] = __('The definer must be in the "username@hostname" format');
        }
    }
    if ($_REQUEST['item_type'] == 'FUNCTION' || $_REQUEST['item_type'] == 'PROCEDURE') {
        $query .= $_REQUEST['item_type'] . ' ';
    } else {
        $errors[] = sprintf(__('Invalid routine type: "%s"'), htmlspecialchars($_REQUEST['item_type']));
    }
    if (!empty($_REQUEST['item_name'])) {
        $query .= PMA_backquote($_REQUEST['item_name']);
    } else {
        $errors[] = __('You must provide a routine name');
    }
    $params = '';
    $warned_about_dir = false;
    $warned_about_name = false;
    $warned_about_length = false;
    if (!empty($_REQUEST['item_param_name']) && !empty($_REQUEST['item_param_type']) && !empty($_REQUEST['item_param_length']) && is_array($_REQUEST['item_param_name']) && is_array($_REQUEST['item_param_type']) && is_array($_REQUEST['item_param_length'])) {
        for ($i = 0; $i < count($_REQUEST['item_param_name']); $i++) {
            if (!empty($_REQUEST['item_param_name'][$i]) && !empty($_REQUEST['item_param_type'][$i])) {
                if ($_REQUEST['item_type'] == 'PROCEDURE' && !empty($_REQUEST['item_param_dir'][$i]) && in_array($_REQUEST['item_param_dir'][$i], $param_directions)) {
                    $params .= $_REQUEST['item_param_dir'][$i] . " " . PMA_backquote($_REQUEST['item_param_name'][$i]) . " " . $_REQUEST['item_param_type'][$i];
                } else {
                    if ($_REQUEST['item_type'] == 'FUNCTION') {
                        $params .= PMA_backquote($_REQUEST['item_param_name'][$i]) . " " . $_REQUEST['item_param_type'][$i];
                    } else {
                        if (!$warned_about_dir) {
                            $warned_about_dir = true;
                            $errors[] = sprintf(__('Invalid direction "%s" given for parameter.'), htmlspecialchars($_REQUEST['item_param_dir'][$i]));
                        }
                    }
                }
                if ($_REQUEST['item_param_length'][$i] != '' && !preg_match('@^(DATE|DATETIME|TIME|TINYBLOB|TINYTEXT|BLOB|TEXT|MEDIUMBLOB|MEDIUMTEXT|LONGBLOB|LONGTEXT|SERIAL|BOOLEAN)$@i', $_REQUEST['item_param_type'][$i])) {
                    $params .= "(" . $_REQUEST['item_param_length'][$i] . ")";
                } else {
                    if ($_REQUEST['item_param_length'][$i] == '' && preg_match('@^(ENUM|SET|VARCHAR|VARBINARY)$@i', $_REQUEST['item_param_type'][$i])) {
                        if (!$warned_about_length) {
                            $warned_about_length = true;
                            $errors[] = __('You must provide length/values for routine parameters of type ENUM, SET, VARCHAR and VARBINARY.');
                        }
                    }
                }
                if (!empty($_REQUEST['item_param_opts_text'][$i])) {
                    if (in_array($_REQUEST['item_param_type'][$i], $cfg['ColumnTypes']['STRING'])) {
                        $params .= ' CHARSET ' . strtolower($_REQUEST['item_param_opts_text'][$i]);
                    }
                }
                if (!empty($_REQUEST['item_param_opts_num'][$i])) {
                    if (in_array($_REQUEST['item_param_type'][$i], $cfg['ColumnTypes']['NUMERIC'])) {
                        $params .= ' ' . strtoupper($_REQUEST['item_param_opts_num'][$i]);
                    }
                }
                if ($i != count($_REQUEST['item_param_name']) - 1) {
                    $params .= ", ";
                }
            } else {
                if (!$warned_about_name) {
                    $warned_about_name = true;
                    $errors[] = __('You must provide a name and a type for each routine parameter.');
                    break;
                }
            }
        }
    }
    $query .= "(" . $params . ") ";
    if ($_REQUEST['item_type'] == 'FUNCTION') {
        if (!empty($_REQUEST['item_returntype']) && in_array($_REQUEST['item_returntype'], PMA_getSupportedDatatypes())) {
            $query .= "RETURNS {$_REQUEST['item_returntype']}";
        } else {
            $errors[] = __('You must provide a valid return type for the routine.');
        }
        if (!empty($_REQUEST['item_returnlength']) && !preg_match('@^(DATE|DATETIME|TIME|TINYBLOB|TINYTEXT|BLOB|TEXT|MEDIUMBLOB|MEDIUMTEXT|LONGBLOB|LONGTEXT|SERIAL|BOOLEAN)$@i', $_REQUEST['item_returntype'])) {
            $query .= "(" . $_REQUEST['item_returnlength'] . ")";
        } else {
            if (empty($_REQUEST['item_returnlength']) && preg_match('@^(ENUM|SET|VARCHAR|VARBINARY)$@i', $_REQUEST['item_returntype'])) {
                if (!$warned_about_length) {
                    $warned_about_length = true;
                    $errors[] = __('You must provide length/values for routine parameters of type ENUM, SET, VARCHAR and VARBINARY.');
                }
            }
        }
        if (!empty($_REQUEST['item_returnopts_text'])) {
            if (in_array($_REQUEST['item_returntype'], $cfg['ColumnTypes']['STRING'])) {
                $query .= ' CHARSET ' . strtolower($_REQUEST['item_returnopts_text']);
            }
        }
        if (!empty($_REQUEST['item_returnopts_num'])) {
            if (in_array($_REQUEST['item_returntype'], $cfg['ColumnTypes']['NUMERIC'])) {
                $query .= ' ' . strtoupper($_REQUEST['item_returnopts_num']);
            }
        }
        $query .= ' ';
    }
    if (!empty($_REQUEST['item_comment'])) {
        $query .= "COMMENT '" . PMA_sqlAddslashes($_REQUEST['item_comment']) . "' ";
    }
    if (isset($_REQUEST['item_isdeterministic'])) {
        $query .= 'DETERMINISTIC ';
    } else {
        $query .= 'NOT DETERMINISTIC ';
    }
    if (!empty($_REQUEST['item_sqldataaccess']) && in_array($_REQUEST['item_sqldataaccess'], $param_sqldataaccess)) {
        $query .= $_REQUEST['item_sqldataaccess'] . ' ';
    }
    if (!empty($_REQUEST['item_securitytype'])) {
        if ($_REQUEST['item_securitytype'] == 'DEFINER' || $_REQUEST['item_securitytype'] == 'INVOKER') {
            $query .= 'SQL SECURITY ' . $_REQUEST['item_securitytype'] . ' ';
        }
    }
    if (!empty($_REQUEST['item_definition'])) {
        $query .= $_REQUEST['item_definition'];
    } else {
        $errors[] = __('You must provide a routine definition.');
    }
    return $query;
}
                    break;
                }
                // end if
            }
            // end while
            PMA_DBI_free_result($rs_usr);
            unset($rs_usr, $row, $re0, $re1);
        } else {
            // Finally, let's try to get the user's privileges by using SHOW
            // GRANTS...
            // Maybe we'll find a little CREATE priv there :)
            $rs_usr = PMA_DBI_try_query('SHOW GRANTS FOR ' . $mysql_cur_user_and_host . ';', $controllink, PMA_DBI_QUERY_STORE);
            if (!$rs_usr) {
                // OK, now we'd have to guess the user's hostname, but we
                // only try out the 'username'@'%' case.
                $rs_usr = PMA_DBI_try_query('SHOW GRANTS FOR ' . PMA_convert_using(PMA_sqlAddslashes($mysql_cur_user), 'quoted') . ';', $controllink, PMA_DBI_QUERY_STORE);
            }
            unset($local_query);
            if ($rs_usr) {
                PMA_analyseShowGrant($rs_usr, $is_create_db_priv, $db_to_create, $is_reload_priv, $dbs_where_create_table_allowed);
                PMA_DBI_free_result($rs_usr);
                unset($rs_usr);
            }
            // end if
        }
        // end elseif
    }
    // end if
}
// end else (MySQL < 4.1.2)
// If disabled, don't show it
     //  i n s e r t
     if ($is_insert) {
         // no need to add column into the valuelist
         if (strlen($cur_value)) {
             $query_values[] = $cur_value;
             // first inserted row so prepare the list of fields
             if (empty($value_sets)) {
                 $query_fields[] = PMA_backquote($key);
             }
         }
         //  u p d a t e
     } elseif (!empty($me_fields_null_prev[$key]) && !isset($me_fields_null[$key])) {
         // field had the null checkbox before the update
         // field no longer has the null checkbox
         $query_values[] = PMA_backquote($key) . ' = ' . $cur_value;
     } elseif (empty($me_funcs[$key]) && isset($me_fields_prev[$key]) && "'" . PMA_sqlAddslashes($me_fields_prev[$key]) . "'" == $val) {
         // No change for this column and no MySQL function is used -> next column
         continue;
     } elseif (!empty($val)) {
         // avoid setting a field to NULL when it's already NULL
         // (field had the null checkbox before the update
         //  field still has the null checkbox)
         if (!(!empty($me_fields_null_prev[$key]) && isset($me_fields_null[$key]))) {
             $query_values[] = PMA_backquote($key) . ' = ' . $cur_value;
         }
     }
 }
 // end foreach ($me_fields as $key => $val)
 if (count($query_values) > 0) {
     if ($is_insert) {
         $value_sets[] = implode(', ', $query_values);
/**
 * Set a single mimetype to a certain value.
 *
 * @uses    PMA_DBI_QUERY_STORE
 * @uses    PMA_getRelationsParam()
 * @uses    PMA_backquote()
 * @uses    PMA_sqlAddslashes()
 * @uses    PMA_query_as_cu()
 * @uses    PMA_DBI_num_rows()
 * @uses    PMA_DBI_fetch_assoc()
 * @uses    PMA_DBI_free_result()
 * @uses    strlen()
 * @access  public
 * @param   string   $db        the name of the db
 * @param   string   $table     the name of the table
 * @param   string   $key       the name of the column
 * @param   string   $mimetype  the mimetype of the column
 * @param   string   $transformation    the transformation of the column
 * @param   string   $transformation_options    the transformation options of the column
 * @param   string   $forcedelete   force delete, will erase any existing comments for this column
 * @return  boolean  true, if comment-query was made.
 */
function PMA_setMIME($db, $table, $key, $mimetype, $transformation, $transformation_options, $forcedelete = false)
{
    $cfgRelation = PMA_getRelationsParam();
    if (!$cfgRelation['commwork']) {
        return false;
    }
    $test_qry = '
         SELECT `mimetype`,
                `comment`
           FROM ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . '
          WHERE `db_name`     = \'' . PMA_sqlAddslashes($db) . '\'
            AND `table_name`  = \'' . PMA_sqlAddslashes($table) . '\'
            AND `column_name` = \'' . PMA_sqlAddslashes($key) . '\'';
    $test_rs = PMA_query_as_cu($test_qry, true, PMA_DBI_QUERY_STORE);
    if ($test_rs && PMA_DBI_num_rows($test_rs) > 0) {
        $row = PMA_DBI_fetch_assoc($test_rs);
        PMA_DBI_free_result($test_rs);
        if (!$forcedelete && (strlen($mimetype) || strlen($transformation) || strlen($transformation_options) || strlen($row['comment']))) {
            $upd_query = '
                UPDATE ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . '
                   SET `mimetype`               = \'' . PMA_sqlAddslashes($mimetype) . '\',
                       `transformation`         = \'' . PMA_sqlAddslashes($transformation) . '\',
                       `transformation_options` = \'' . PMA_sqlAddslashes($transformation_options) . '\'';
        } else {
            $upd_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['column_info']);
        }
        $upd_query .= '
            WHERE `db_name`     = \'' . PMA_sqlAddslashes($db) . '\'
              AND `table_name`  = \'' . PMA_sqlAddslashes($table) . '\'
              AND `column_name` = \'' . PMA_sqlAddslashes($key) . '\'';
    } elseif (strlen($mimetype) || strlen($transformation) || strlen($transformation_options)) {
        $upd_query = 'INSERT INTO ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . ' (db_name, table_name, column_name, mimetype, transformation, transformation_options) ' . ' VALUES(' . '\'' . PMA_sqlAddslashes($db) . '\',' . '\'' . PMA_sqlAddslashes($table) . '\',' . '\'' . PMA_sqlAddslashes($key) . '\',' . '\'' . PMA_sqlAddslashes($mimetype) . '\',' . '\'' . PMA_sqlAddslashes($transformation) . '\',' . '\'' . PMA_sqlAddslashes($transformation_options) . '\')';
    }
    if (isset($upd_query)) {
        return PMA_query_as_cu($upd_query);
    } else {
        return false;
    }
}
 unset($fulltext);
 // Builds the 'create table' statement
 $sql_query = 'CREATE TABLE ' . PMA_backquote($table) . ' (' . $sql_query . ')';
 $query_cpy = 'CREATE TABLE ' . PMA_backquote($table) . ' (' . $query_cpy . "\n" . ')';
 // Adds table type, character set and comments
 if (!empty($tbl_type) && $tbl_type != 'Default') {
     $sql_query .= ' ' . PMA_ENGINE_KEYWORD . ' = ' . $tbl_type;
     $query_cpy .= "\n" . PMA_ENGINE_KEYWORD . ' = ' . $tbl_type;
 }
 if (PMA_MYSQL_INT_VERSION >= 40100 && !empty($tbl_collation)) {
     $sql_query .= PMA_generateCharsetQueryPart($tbl_collation);
     $query_cpy .= "\n" . PMA_generateCharsetQueryPart($tbl_collation);
 }
 if (!empty($comment)) {
     $sql_query .= ' COMMENT = \'' . PMA_sqlAddslashes($comment) . '\'';
     $query_cpy .= "\n" . 'COMMENT = \'' . PMA_sqlAddslashes($comment) . '\'';
 }
 // Executes the query
 $error_create = false;
 $result = PMA_DBI_try_query($sql_query) or $error_create = true;
 if ($error_create == false) {
     $sql_query = $query_cpy . ';';
     unset($query_cpy);
     $message = $strTable . ' ' . htmlspecialchars($table) . ' ' . $strHasBeenCreated;
     // garvin: If comments were sent, enable relation stuff
     require_once './libs/relation.lib.php';
     require_once './libs/transformations.lib.php';
     $cfgRelation = PMA_getRelationsParam();
     // garvin: Update comment table, if a comment was set.
     if (isset($field_comments) && is_array($field_comments) && $cfgRelation['commwork'] && PMA_MYSQL_INT_VERSION < 40100) {
         foreach ($field_comments as $fieldindex => $fieldcomment) {
Example #17
0
 /**
  * renames table
  *
  * @param   string  new table name
  * @param   string  new database name
  * @return  boolean success
  */
 function rename($new_name, $new_db = null)
 {
     if (null !== $new_db && $new_db !== $this->getDbName()) {
         // Ensure the target is valid
         if (!$GLOBALS['PMA_List_Database']->exists($new_db)) {
             $this->errors[] = $GLOBALS['strInvalidDatabase'] . ': ' . $new_db;
             return false;
         }
     } else {
         $new_db = $this->getDbName();
     }
     $new_table = new PMA_Table($new_name, $new_db);
     if ($this->getFullName() === $new_table->getFullName()) {
         return true;
     }
     if (!PMA_Table::isValidName($new_name)) {
         $this->errors[] = $GLOBALS['strInvalidTableName'] . ': ' . $new_table->getFullName();
         return false;
     }
     $GLOBALS['sql_query'] = '
         RENAME TABLE ' . $this->getFullName(true) . '
                   TO ' . $new_table->getFullName(true) . ';';
     if (!PMA_DBI_query($GLOBALS['sql_query'])) {
         $this->errors[] = sprintf($GLOBALS['strErrorRenamingTable'], $this->getFullName(), $new_table->getFullName());
         return false;
     }
     $old_name = $this->getName();
     $old_db = $this->getDbName();
     $this->setName($new_name);
     $this->setDbName($new_db);
     /**
      * @todo move into extra function PMA_Relation::renameTable($new_name, $old_name, $new_db, $old_db)
      */
     // garvin: Move old entries from comments to new table
     require_once './libraries/relation.lib.php';
     $GLOBALS['cfgRelation'] = PMA_getRelationsParam();
     if ($GLOBALS['cfgRelation']['commwork']) {
         $remove_query = '
             UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($GLOBALS['cfgRelation']['column_info']) . '
                SET `db_name`    = \'' . PMA_sqlAddslashes($new_db) . '\',
                    `table_name` = \'' . PMA_sqlAddslashes($new_name) . '\'
              WHERE `db_name`    = \'' . PMA_sqlAddslashes($old_db) . '\'
                AND `table_name` = \'' . PMA_sqlAddslashes($old_name) . '\'';
         PMA_query_as_cu($remove_query);
         unset($remove_query);
     }
     if ($GLOBALS['cfgRelation']['displaywork']) {
         $table_query = '
             UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($GLOBALS['cfgRelation']['table_info']) . '
                SET `db_name`    = \'' . PMA_sqlAddslashes($new_db) . '\',
                    `table_name` = \'' . PMA_sqlAddslashes($new_name) . '\'
              WHERE `db_name`    = \'' . PMA_sqlAddslashes($old_db) . '\'
                AND `table_name` = \'' . PMA_sqlAddslashes($old_name) . '\'';
         PMA_query_as_cu($table_query);
         unset($table_query);
     }
     if ($GLOBALS['cfgRelation']['relwork']) {
         $table_query = '
             UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($GLOBALS['cfgRelation']['relation']) . '
                SET `foreign_db`    = \'' . PMA_sqlAddslashes($new_db) . '\',
                    `foreign_table` = \'' . PMA_sqlAddslashes($new_name) . '\'
              WHERE `foreign_db`    = \'' . PMA_sqlAddslashes($old_db) . '\'
                AND `foreign_table` = \'' . PMA_sqlAddslashes($old_name) . '\'';
         PMA_query_as_cu($table_query);
         $table_query = '
             UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($GLOBALS['cfgRelation']['relation']) . '
                SET `master_db`    = \'' . PMA_sqlAddslashes($new_db) . '\',
                    `master_table` = \'' . PMA_sqlAddslashes($new_name) . '\'
              WHERE `master_db`    = \'' . PMA_sqlAddslashes($old_db) . '\'
                AND `master_table` = \'' . PMA_sqlAddslashes($old_name) . '\'';
         PMA_query_as_cu($table_query);
         unset($table_query);
     }
     if ($GLOBALS['cfgRelation']['pdfwork']) {
         $table_query = '
             UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($GLOBALS['cfgRelation']['table_coords']) . '
                SET `db_name`    = \'' . PMA_sqlAddslashes($new_db) . '\',
                    `table_name` = \'' . PMA_sqlAddslashes($new_name) . '\'
              WHERE `db_name`    = \'' . PMA_sqlAddslashes($old_db) . '\'
                AND `table_name` = \'' . PMA_sqlAddslashes($old_name) . '\'';
         PMA_query_as_cu($table_query);
         unset($table_query);
     }
     if ($GLOBALS['cfgRelation']['designerwork']) {
         $table_query = '
             UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($GLOBALS['cfgRelation']['designer_coords']) . '
                SET `db_name`    = \'' . PMA_sqlAddslashes($new_db) . '\',
                    `table_name` = \'' . PMA_sqlAddslashes($new_name) . '\'
              WHERE `db_name`    = \'' . PMA_sqlAddslashes($old_db) . '\'
                AND `table_name` = \'' . PMA_sqlAddslashes($old_name) . '\'';
         PMA_query_as_cu($table_query);
         unset($table_query);
     }
     $this->messages[] = sprintf($GLOBALS['strRenameTableOK'], htmlspecialchars($old_name), htmlspecialchars($new_name));
     return true;
 }
Example #18
0
/**
 * @author  Ivan A Kirillov (Ivan.A.Kirillov@gmail.com)
 * @version $Id$
 * @package phpMyAdmin-Designer
 */
/**
 *
 */
include_once 'pmd_common.php';
require_once './libraries/relation.lib.php';
$table = $T;
$display_field = $F;
if ($cfgRelation['displaywork']) {
    $disp = PMA_getDisplayField($db, $table);
    if ($disp) {
        if ($display_field != $disp) {
            $upd_query = 'UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_info']) . ' SET display_field = \'' . PMA_sqlAddslashes($display_field) . '\'' . ' WHERE db_name  = \'' . PMA_sqlAddslashes($db) . '\'' . ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'';
        } else {
            $upd_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_info']) . ' WHERE db_name  = \'' . PMA_sqlAddslashes($db) . '\'' . ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'';
        }
    } elseif ($display_field != '') {
        $upd_query = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_info']) . '(db_name, table_name, display_field) ' . ' VALUES(' . '\'' . PMA_sqlAddslashes($db) . '\',' . '\'' . PMA_sqlAddslashes($table) . '\',' . '\'' . PMA_sqlAddslashes($display_field) . '\')';
    }
    if (isset($upd_query)) {
        $upd_rs = PMA_query_as_controluser($upd_query);
    }
}
// end if
header("Content-Type: text/xml; charset=utf-8");
header("Cache-Control: no-cache");
die("<root act='save_pos' return='strModifications'></root>");
Example #19
0
 *       function. This needs further reseach because a procedure
 *       does not necessarily contain a SELECT statement that
 *       produces something to see. But it seems we could at least
 *       get the number of rows affected. We would have to
 *       use the CLIENT_MULTI_RESULTS flag to get the result set
 *       and also the call status. All this does not fit well with
 *       our current sql.php.
 *       Of course the interface would need a way to pass calling parameters.
 *       Also, support DEFINER (like we do in export).
 * @version $Id$
 * @package phpMyAdmin
 */
if (!defined('PHPMYADMIN')) {
    exit;
}
$routines = PMA_DBI_fetch_result('SELECT SPECIFIC_NAME,ROUTINE_NAME,ROUTINE_TYPE,DTD_IDENTIFIER FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA= \'' . PMA_sqlAddslashes($db, true) . '\';');
if ($routines) {
    PMA_generate_slider_effect('routines', $strRoutines);
    echo '<fieldset>' . "\n";
    echo ' <legend>' . $strRoutines . '</legend>' . "\n";
    echo '<table border="0">';
    echo sprintf('<tr>
                      <th>%s</th>
                      <th>&nbsp;</th>
                      <th>&nbsp;</th>
                      <th>%s</th>
                      <th>%s</th>
                </tr>', $strName, $strType, $strRoutineReturnType);
    $ct = 0;
    $delimiter = '//';
    foreach ($routines as $routine) {
 /**
  * Finds all related tables
  *
  * @param   string   wether to go from master to foreign or vice versa
  *
  * @return  boolean  always TRUE
  *
  * @global  array    the list of tables that we still couldn't connect
  * @global  array    the list of allready connected tables
  * @global  string   the current databse name
  * @global  string   the super user connection id
  * @global  array    the list of relation settings
  *
  * @access  private
  */
 function PMA_getRelatives($from)
 {
     global $tab_left, $tab_know, $fromclause;
     global $controllink, $db, $cfgRelation;
     if ($from == 'master') {
         $to = 'foreign';
     } else {
         $to = 'master';
     }
     $in_know = '(\'' . implode('\', \'', $tab_know) . '\')';
     $in_left = '(\'' . implode('\', \'', $tab_left) . '\')';
     $rel_query = 'SELECT *' . ' FROM ' . PMA_backquote($cfgRelation['relation']) . ' WHERE ' . $from . '_db   = \'' . PMA_sqlAddslashes($db) . '\'' . ' AND ' . $to . '_db   = \'' . PMA_sqlAddslashes($db) . '\'' . ' AND ' . $from . '_table IN ' . $in_know . ' AND ' . $to . '_table IN ' . $in_left;
     PMA_DBI_select_db($cfgRelation['db'], $controllink);
     $relations = @PMA_DBI_query($rel_query, $controllink);
     PMA_DBI_select_db($db, $controllink);
     while ($row = PMA_DBI_fetch_assoc($relations)) {
         $found_table = $row[$to . '_table'];
         if (isset($tab_left[$found_table])) {
             $fromclause .= "\n" . ' LEFT JOIN ' . PMA_backquote($row[$to . '_table']) . ' ON ' . PMA_backquote($row[$from . '_table']) . '.' . PMA_backquote($row[$from . '_field']) . ' = ' . PMA_backquote($row[$to . '_table']) . '.' . PMA_backquote($row[$to . '_field']) . ' ';
             $tab_know[$found_table] = $found_table;
             $tab_left = PMA_arrayShort($tab_left, $found_table);
         }
     }
     // end while
     return TRUE;
 }
Example #21
0
         $cur_value = $me_funcs[$encoded_key] . '(' . $val . '), ';
     } elseif (preg_match('@^(NOW|CURDATE|CURTIME|UTC_DATE|UTC_TIME|UTC_TIMESTAMP|UNIX_TIMESTAMP|RAND|USER|LAST_INSERT_ID)$@', $me_funcs[$encoded_key])) {
         $cur_value = $me_funcs[$encoded_key] . '(), ';
     } else {
         $cur_value = $me_funcs[$encoded_key] . '(' . $val . '), ';
     }
     //  i n s e r t
     if ($is_insert) {
         // no need to add column into the valuelist
         $valuelist .= $cur_value;
         //  u p d a t e
     } elseif (isset($me_fields_null_prev) && isset($me_fields_null_prev[$encoded_key]) && !empty($me_fields_null_prev[$encoded_key]) && !isset($me_fields_null[$encoded_key])) {
         // field had the null checkbox before the update
         // field no longer has the null checkbox
         $valuelist .= PMA_backquote($key) . ' = ' . $cur_value;
     } elseif (empty($me_funcs[$encoded_key]) && isset($me_fields_prev) && isset($me_fields_prev[$encoded_key]) && "'" . PMA_sqlAddslashes(urldecode($me_fields_prev[$encoded_key])) . "'" == $val) {
         // No change for this column and no MySQL function is used -> next column
         continue;
     } elseif (!empty($val)) {
         // avoid setting a field to NULL when it's already NULL
         // (field had the null checkbox before the update
         //  field still has the null checkbox)
         if (!(isset($me_fields_null_prev) && isset($me_fields_null_prev[$encoded_key]) && !empty($me_fields_null_prev[$encoded_key]) && isset($me_fields_null[$encoded_key]))) {
             $valuelist .= PMA_backquote($key) . ' = ' . $cur_value;
         }
     }
 }
 // end while
 // get rid of last ,
 $valuelist = preg_replace('@, $@', '', $valuelist);
 // Builds the sql query
Example #22
0
$go_sql = FALSE;
$executed_queries = 0;
$run_query = TRUE;
$charset_conversion = FALSE;
$reset_charset = FALSE;
$bookmark_created = FALSE;
// Bookmark Support: get a query back from bookmark if required
if (!empty($id_bookmark)) {
    $id_bookmark = (int) $id_bookmark;
    require_once './libraries/bookmark.lib.php';
    switch ($action_bookmark) {
        case 0:
            // bookmarked query that have to be run
            $import_text = PMA_Bookmark_get($db, $id_bookmark, 'id', isset($action_bookmark_all));
            if (isset($bookmark_variable) && !empty($bookmark_variable)) {
                $import_text = preg_replace('|/\\*(.*)\\[VARIABLE\\](.*)\\*/|imsU', '${1}' . PMA_sqlAddslashes($bookmark_variable) . '${2}', $import_text);
            }
            // refresh left frame on changes in table or db structure
            if (preg_match('/^(CREATE|ALTER|DROP)\\s+(VIEW|TABLE|DATABASE|SCHEMA)\\s+/i', $import_text)) {
                $GLOBALS['reload'] = true;
            }
            break;
        case 1:
            // bookmarked query that have to be displayed
            $import_text = PMA_Bookmark_get($db, $id_bookmark);
            $run_query = FALSE;
            break;
        case 2:
            // bookmarked query that have to be deleted
            $import_text = PMA_Bookmark_get($db, $id_bookmark);
            PMA_Bookmark_delete($db, $id_bookmark);
Example #23
0
    $l_tbl_type = strtolower($tbl_type);
    if (($l_tbl_type === 'myisam' || $l_tbl_type === 'isam') && isset($_REQUEST['new_pack_keys']) && $_REQUEST['new_pack_keys'] != (string) $pack_keys) {
        $table_alters[] = 'pack_keys = ' . $_REQUEST['new_pack_keys'];
    }
    $checksum = empty($checksum) ? '0' : '1';
    $_REQUEST['new_checksum'] = empty($_REQUEST['new_checksum']) ? '0' : '1';
    if ($l_tbl_type === 'myisam' && $_REQUEST['new_checksum'] !== $checksum) {
        $table_alters[] = 'checksum = ' . $_REQUEST['new_checksum'];
    }
    $delay_key_write = empty($delay_key_write) ? '0' : '1';
    $_REQUEST['new_delay_key_write'] = empty($_REQUEST['new_delay_key_write']) ? '0' : '1';
    if ($l_tbl_type === 'myisam' && $_REQUEST['new_delay_key_write'] !== $delay_key_write) {
        $table_alters[] = 'delay_key_write = ' . $_REQUEST['new_delay_key_write'];
    }
    if (($l_tbl_type === 'myisam' || $l_tbl_type === 'innodb') && !empty($_REQUEST['new_auto_increment']) && (!isset($auto_increment) || $_REQUEST['new_auto_increment'] !== $auto_increment)) {
        $table_alters[] = 'auto_increment = ' . PMA_sqlAddslashes($_REQUEST['new_auto_increment']);
    }
    if (count($table_alters) > 0) {
        $sql_query = 'ALTER TABLE ' . PMA_backquote($GLOBALS['table']);
        $sql_query .= "\r\n" . implode("\r\n", $table_alters);
        $message .= PMA_DBI_query($sql_query) ? $strSuccess : $strError;
        $reread_info = true;
        unset($table_alters);
    }
}
/**
 * Reordering the table has been requested by the user
 */
if (isset($_REQUEST['submitorderby']) && !empty($_REQUEST['order_field'])) {
    $sql_query = '
        ALTER TABLE ' . PMA_backquote($GLOBALS['table']) . '
Example #24
0
 /**
  * The "PMA_RT" constructor
  *
  * @param   mixed    The scaling factor
  * @param   integer  The page number to draw (from the
  *                   $cfg['Servers'][$i]['table_coords'] table)
  * @param   boolean  Whether to display table position or not
  * @param   boolean  Was originally whether to use one color per
  *                   relation or not, now enables/disables color
  *                   everywhere, due to some problems printing with color
  * @param   boolean  Whether to draw grids or not
  * @param   boolean  Whether all tables should have the same width or not
  *
  * @global  object   The current PDF document
  * @global  string   The current db name
  * @global  array    The relations settings
  *
  * @access  private
  *
  * @see     PMA_PDF
  */
 function PMA_RT($which_rel, $show_info = 0, $change_color = 0, $show_grid = 0, $all_tab_same_wide = 0, $orientation = 'L', $paper = 'A4')
 {
     global $pdf, $db, $cfgRelation, $with_doc;
     // Font face depends on the current language
     $this->ff = str_replace('"', '', substr($GLOBALS['right_font_family'], 0, strpos($GLOBALS['right_font_family'], ',')));
     $this->same_wide = $all_tab_same_wide;
     // Initializes a new document
     $pdf = new PMA_PDF('L', 'mm', $paper);
     $pdf->title = sprintf($GLOBALS['strPdfDbSchema'], $GLOBALS['db'], $which_rel);
     $pdf->cMargin = 0;
     $pdf->Open();
     $pdf->SetTitle($pdf->title);
     $pdf->SetAuthor('phpMyAdmin ' . PMA_VERSION);
     $pdf->AliasNbPages();
     // fonts added to phpMyAdmin and considered non-standard by fpdf
     // (Note: those tahoma fonts are iso-8859-2 based)
     if ($this->ff == 'tahoma') {
         $pdf->AddFont('tahoma', '', 'tahoma.php');
         $pdf->AddFont('tahoma', 'B', 'tahomab.php');
     }
     $pdf->SetFont($this->ff, '', 14);
     $pdf->SetAutoPageBreak('auto');
     // Gets tables on this page
     $tab_sql = 'SELECT table_name FROM ' . PMA_backquote($cfgRelation['table_coords']) . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . ' AND pdf_page_number = ' . $which_rel;
     $tab_rs = PMA_query_as_cu($tab_sql);
     if (!$tab_rs || !mysql_num_rows($tab_rs) > 0) {
         $pdf->PMA_PDF_die($GLOBALS['strPdfNoTables']);
         //            die('No tables');
     }
     while ($curr_table = @PMA_mysql_fetch_array($tab_rs)) {
         $alltables[] = PMA_sqlAddslashes($curr_table['table_name']);
         //$intable     = '\'' . implode('\', \'', $alltables) . '\'';
     }
     //              make doc                    //
     if ($with_doc) {
         $pdf->SetAutoPageBreak('auto', 15);
         $pdf->cMargin = 1;
         PMA_RT_DOC($alltables);
         $pdf->SetAutoPageBreak('auto');
         $pdf->cMargin = 0;
     }
     $pdf->Addpage();
     if ($with_doc) {
         $pdf->SetLink($pdf->PMA_links['RT']['-'], -1);
         $pdf->Bookmark($GLOBALS['strRelationalSchema']);
         $pdf->SetAlias('{00}', $pdf->PageNo());
         $this->t_marg = 18;
         $this->b_marg = 18;
     }
     /* snip */
     foreach ($alltables as $table) {
         if (!isset($this->tables[$table])) {
             $this->tables[$table] = new PMA_RT_Table($table, $this->ff, $this->tablewidth);
         }
         if ($this->same_wide) {
             $this->tables[$table]->width = $this->tablewidth;
         }
         $this->PMA_RT_setMinMax($this->tables[$table]);
     }
     // Defines the scale factor
     $this->scale = ceil(max(($this->x_max - $this->x_min) / ($pdf->fh - $this->r_marg - $this->l_marg), ($this->y_max - $this->y_min) / ($pdf->fw - $this->t_marg - $this->b_marg)) * 100) / 100;
     $pdf->PMA_PDF_setScale($this->scale, $this->x_min, $this->y_min, $this->l_marg, $this->t_marg);
     // Builds and save the PDF document
     $pdf->PMA_PDF_setLineWidthScale(0.1);
     if ($show_grid) {
         $pdf->SetFontSize(10);
         $this->PMA_RT_strokeGrid();
     }
     $pdf->PMA_PDF_setFontSizeScale(14);
     //        $sql    = 'SELECT * FROM ' . PMA_backquote($cfgRelation['relation'])
     //                .   ' WHERE master_db   = \'' . PMA_sqlAddslashes($db) . '\' '
     //                .   ' AND foreign_db    = \'' . PMA_sqlAddslashes($db) . '\' '
     //                .   ' AND master_table  IN (' . $intable . ')'
     //                .   ' AND foreign_table IN (' . $intable . ')';
     //        $result =  PMA_query_as_cu($sql);
     //
     // lem9:
     // previous logic was checking master tables and foreign tables
     // but I think that looping on every table of the pdf page as a master
     // and finding its foreigns is OK (then we can support innodb)
     $seen_a_relation = FALSE;
     foreach ($alltables as $one_table) {
         $exist_rel = PMA_getForeigners($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 (PMA_isInto($rel['foreign_table'], $alltables) > -1) {
                     $this->PMA_RT_addRelation($one_table, $master_field, $rel['foreign_table'], $rel['foreign_field']);
                 }
             }
             // end while
         }
         // end if
     }
     // end while
     // loic1: also show tables without relations
     //        $norelations     = TRUE;
     //        if ($result && mysql_num_rows($result) > 0) {
     //            $norelations = FALSE;
     //            while ($row = PMA_mysql_fetch_array($result)) {
     //                $this->PMA_RT_addRelation($row['master_table'] , $row['master_field'], $row['foreign_table'], $row['foreign_field']);
     //            }
     //        }
     //        if ($norelations == FALSE) {
     if ($seen_a_relation) {
         $this->PMA_RT_drawRelations($change_color);
     }
     $this->PMA_RT_drawTables($show_info, $change_color);
     $this->PMA_RT_showRt();
 }
Example #25
0
</form>
    <?php 
    // Now if we already have chosen a page number then we should show the
    // tables involved
    if (isset($chpage) && $chpage > 0) {
        echo "\n";
        ?>
<hr />

<h2><?php 
        echo $strSelectTables;
        ?>
</h2>

<?php 
        $page_query = 'SELECT * FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']) . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . ' AND pdf_page_number = ' . $chpage;
        $page_rs = PMA_query_as_cu($page_query, FALSE, $query_default_option);
        $array_sh_page = array();
        $draginit = '';
        $reset_draginit = '';
        $i = 0;
        while ($temp_sh_page = @PMA_DBI_fetch_assoc($page_rs)) {
            $array_sh_page[] = $temp_sh_page;
        }
        // garvin: Display WYSIWYG-PDF parts?
        if ($cfg['WYSIWYG-PDF']) {
            if (!isset($_POST['with_field_names']) && !isset($_POST['showwysiwyg'])) {
                $with_field_names = TRUE;
            }
            ?>
<script type="text/javascript" language="javascript" src="./js/dom-drag.js"></script>
Example #26
0
        $message->display();
    }
    // end if
}
// end if (!$is_information_schema)
// not sure about displaying the PDF dialog in case db is information_schema
if ($cfgRelation['pdfwork'] && $num_tables > 0) {
    ?>
    <!-- Work on PDF Pages -->

    <?php 
    // We only show this if we find something in the new pdf_pages table
    $test_query = '
         SELECT *
           FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages']) . '
          WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
    $test_rs = PMA_query_as_cu($test_query, null, PMA_DBI_QUERY_STORE);
    if ($test_rs && PMA_DBI_num_rows($test_rs) > 0) {
        ?>
    <!-- PDF schema -->
    <form method="post" action="pdf_schema.php">
    <fieldset>
        <legend>
        <?php 
        echo PMA_generate_common_hidden_inputs($db);
        if ($cfg['PropertiesIconic']) {
            echo '<img class="icon" src="' . $pmaThemeImage . 'b_view.png"' . ' alt="" width="16" height="16" />';
        }
        echo $strDisplayPDF;
        ?>
:
Example #27
0
}
$sql .= ' INFILE \'' . PMA_sqlAddslashes($import_file) . '\'';
if (isset($ldi_replace)) {
    $sql .= ' REPLACE';
} elseif (isset($ldi_ignore)) {
    $sql .= ' IGNORE';
}
$sql .= ' INTO TABLE ' . PMA_backquote($table);
if (strlen($ldi_terminated) > 0) {
    $sql .= ' FIELDS TERMINATED BY \'' . $ldi_terminated . '\'';
}
if (strlen($ldi_enclosed) > 0) {
    $sql .= ' ENCLOSED BY \'' . PMA_sqlAddslashes($ldi_enclosed) . '\'';
}
if (strlen($ldi_escaped) > 0) {
    $sql .= ' ESCAPED BY \'' . PMA_sqlAddslashes($ldi_escaped) . '\'';
}
if (strlen($ldi_new_line) > 0) {
    if ($ldi_new_line == 'auto') {
        $ldi_new_line = PMA_whichCrlf() == "\n" ? '\\n' : '\\r\\n';
    }
    $sql .= ' LINES TERMINATED BY \'' . $ldi_new_line . '\'';
}
if ($skip_queries > 0) {
    $sql .= ' IGNORE ' . $skip_queries . ' LINES';
    $skip_queries = 0;
}
if (strlen($ldi_columns) > 0) {
    $sql .= ' (';
    $tmp = preg_split('/,( ?)/', $ldi_columns);
    $cnt_tmp = count($tmp);
Example #28
0
/**
 * Displays the body of the results table
 *
 * @uses    $_SESSION['tmp_user_values']['disp_direction']
 * @uses    $_SESSION['tmp_user_values']['repeat_cells']
 * @uses    $_SESSION['tmp_user_values']['max_rows']
 * @uses    $_SESSION['tmp_user_values']['display_text']
 * @uses    $_SESSION['tmp_user_values']['display_binary']
 * @uses    $_SESSION['tmp_user_values']['display_binary_as_hex']
 * @uses    $_SESSION['tmp_user_values']['display_blob']
 * @param   integer  the link id associated to the query which results have
 *                   to be displayed
 * @param   array    which elements to display
 * @param   array    the list of relations
 * @param   array    the analyzed query
 *
 * @return  boolean  always true
 *
 * @global  string   $db                the database name
 * @global  string   $table             the table name
 * @global  string   $goto              the URL to go back in case of errors
 * @global  string   $sql_query         the SQL query
 * @global  array    $fields_meta       the list of fields properties
 * @global  integer  $fields_cnt        the total number of fields returned by
 *                                      the SQL query
 * @global  array    $vertical_display  informations used with vertical display
 *                                      mode
 * @global  array    $highlight_columns column names to highlight
 * @global  array    $row               current row data
 *
 * @access  private
 *
 * @see     PMA_displayTable()
 */
function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql)
{
    global $db, $table, $goto;
    global $sql_query, $fields_meta, $fields_cnt;
    global $vertical_display, $highlight_columns;
    global $row;
    // mostly because of browser transformations, to make the row-data accessible in a plugin
    $url_sql_query = $sql_query;
    // query without conditions to shorten URLs when needed, 200 is just
    // guess, it should depend on remaining URL length
    if (isset($analyzed_sql) && isset($analyzed_sql[0]) && isset($analyzed_sql[0]['querytype']) && $analyzed_sql[0]['querytype'] == 'SELECT' && strlen($sql_query) > 200) {
        $url_sql_query = 'SELECT ';
        if (isset($analyzed_sql[0]['queryflags']['distinct'])) {
            $url_sql_query .= ' DISTINCT ';
        }
        $url_sql_query .= $analyzed_sql[0]['select_expr_clause'];
        if (!empty($analyzed_sql[0]['from_clause'])) {
            $url_sql_query .= ' FROM ' . $analyzed_sql[0]['from_clause'];
        }
    }
    if (!is_array($map)) {
        $map = array();
    }
    $row_no = 0;
    $vertical_display['edit'] = array();
    $vertical_display['delete'] = array();
    $vertical_display['data'] = array();
    $vertical_display['row_delete'] = array();
    // Correction University of Virginia 19991216 in the while below
    // Previous code assumed that all tables have keys, specifically that
    // the phpMyAdmin GUI should support row delete/edit only for such
    // tables.
    // Although always using keys is arguably the prescribed way of
    // defining a relational table, it is not required. This will in
    // particular be violated by the novice.
    // We want to encourage phpMyAdmin usage by such novices. So the code
    // below has been changed to conditionally work as before when the
    // table being displayed has one or more keys; but to display
    // delete/edit options correctly for tables without keys.
    $odd_row = true;
    while ($row = PMA_DBI_fetch_row($dt_result)) {
        // lem9: "vertical display" mode stuff
        if ($row_no != 0 && $_SESSION['tmp_user_values']['repeat_cells'] != 0 && !($row_no % $_SESSION['tmp_user_values']['repeat_cells']) && ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal' || $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped')) {
            echo '<tr>' . "\n";
            if ($vertical_display['emptypre'] > 0) {
                echo '    <th colspan="' . $vertical_display['emptypre'] . '">' . "\n" . '        &nbsp;</th>' . "\n";
            }
            foreach ($vertical_display['desc'] as $val) {
                echo $val;
            }
            if ($vertical_display['emptyafter'] > 0) {
                echo '    <th colspan="' . $vertical_display['emptyafter'] . '">' . "\n" . '        &nbsp;</th>' . "\n";
            }
            echo '</tr>' . "\n";
        }
        // end if
        $class = $odd_row ? 'odd' : 'even';
        $odd_row = !$odd_row;
        if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal' || $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped') {
            // loic1: pointer code part
            echo '    <tr class="' . $class . '">' . "\n";
            $class = '';
        }
        // 1. Prepares the row
        // 1.1 Results from a "SELECT" statement -> builds the
        //     WHERE clause to use in links (a unique key if possible)
        /**
         * @todo $where_clause could be empty, for example a table
         *       with only one field and it's a BLOB; in this case,
         *       avoid to display the delete and edit links
         */
        list($where_clause, $clause_is_unique) = PMA_getUniqueCondition($dt_result, $fields_cnt, $fields_meta, $row);
        $where_clause_html = urlencode($where_clause);
        // 1.2 Defines the URLs for the modify/delete link(s)
        if ($is_display['edit_lnk'] != 'nn' || $is_display['del_lnk'] != 'nn') {
            // We need to copy the value or else the == 'both' check will always return true
            if ($GLOBALS['cfg']['PropertiesIconic'] === 'both') {
                $iconic_spacer = '<div class="nowrap">';
            } else {
                $iconic_spacer = '';
            }
            // 1.2.1 Modify link(s)
            if ($is_display['edit_lnk'] == 'ur') {
                // update row case
                $_url_params = array('db' => $db, 'table' => $table, 'where_clause' => $where_clause, 'clause_is_unique' => $clause_is_unique, 'sql_query' => $url_sql_query, 'goto' => 'sql.php');
                $edit_url = 'tbl_change.php' . PMA_generate_common_url($_url_params);
                $edit_str = PMA_getIcon('b_edit.png', $GLOBALS['strEdit'], true);
            }
            // end if (1.2.1)
            if (isset($GLOBALS['cfg']['Bookmark']['table']) && isset($GLOBALS['cfg']['Bookmark']['db']) && $table == $GLOBALS['cfg']['Bookmark']['table'] && $db == $GLOBALS['cfg']['Bookmark']['db'] && isset($row[1]) && isset($row[0])) {
                $_url_params = array('db' => $row[1], 'id_bookmark' => $row[0], 'action_bookmark' => '0', 'action_bookmark_all' => '1', 'SQL' => $GLOBALS['strExecuteBookmarked']);
                $bookmark_go = '<a href="import.php' . PMA_generate_common_url($_url_params) . ' " title="' . $GLOBALS['strExecuteBookmarked'] . '">';
                $bookmark_go .= PMA_getIcon('b_bookmark.png', $GLOBALS['strExecuteBookmarked'], true);
                $bookmark_go .= '</a>';
            } else {
                $bookmark_go = '';
            }
            // 1.2.2 Delete/Kill link(s)
            if ($is_display['del_lnk'] == 'dr') {
                // delete row case
                $_url_params = array('db' => $db, 'table' => $table, 'sql_query' => $url_sql_query, 'zero_rows' => $GLOBALS['strDeleted'], 'goto' => empty($goto) ? 'tbl_sql.php' : $goto);
                $lnk_goto = 'sql.php' . PMA_generate_common_url($_url_params, 'text');
                $del_query = 'DELETE FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) . ' WHERE ' . $where_clause . ($clause_is_unique ? '' : ' LIMIT 1');
                $_url_params = array('db' => $db, 'table' => $table, 'sql_query' => $del_query, 'zero_rows' => $GLOBALS['strDeleted'], 'goto' => $lnk_goto);
                $del_url = 'sql.php' . PMA_generate_common_url($_url_params);
                $js_conf = 'DELETE FROM ' . PMA_jsFormat($db) . '.' . PMA_jsFormat($table) . ' WHERE ' . PMA_jsFormat($where_clause, false) . ($clause_is_unique ? '' : ' LIMIT 1');
                $del_str = PMA_getIcon('b_drop.png', $GLOBALS['strDelete'], true);
            } elseif ($is_display['del_lnk'] == 'kp') {
                // kill process case
                $_url_params = array('db' => $db, 'table' => $table, 'sql_query' => $url_sql_query, 'goto' => 'main.php');
                $lnk_goto = 'sql.php' . PMA_generate_common_url($_url_params, 'text');
                $_url_params = array('db' => 'mysql', 'sql_query' => 'KILL ' . $row[0], 'goto' => $lnk_goto);
                $del_url = 'sql.php' . PMA_generate_common_url($_url_params);
                $del_query = 'KILL ' . $row[0];
                $js_conf = 'KILL ' . $row[0];
                $del_str = PMA_getIcon('b_drop.png', $GLOBALS['strKill'], true);
            }
            // end if (1.2.2)
            // 1.3 Displays the links at left if required
            if ($GLOBALS['cfg']['ModifyDeleteAtLeft'] && ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal' || $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped')) {
                $doWriteModifyAt = 'left';
                require './libraries/display_tbl_links.lib.php';
            }
            // end if (1.3)
        }
        // end if (1)
        // 2. Displays the rows' values
        for ($i = 0; $i < $fields_cnt; ++$i) {
            $meta = $fields_meta[$i];
            $pointer = $i;
            // garvin: See if this column should get highlight because it's used in the
            //  where-query.
            if (isset($highlight_columns) && (isset($highlight_columns[$meta->name]) || isset($highlight_columns[PMA_backquote($meta->name)]))) {
                $condition_field = true;
            } else {
                $condition_field = false;
            }
            $mouse_events = '';
            if ($_SESSION['tmp_user_values']['disp_direction'] == 'vertical' && (!isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1')) {
                if ($GLOBALS['cfg']['BrowsePointerEnable'] == true) {
                    $mouse_events .= ' onmouseover="setVerticalPointer(this, ' . $row_no . ', \'over\', \'odd\', \'even\', \'hover\', \'marked\');"' . ' onmouseout="setVerticalPointer(this, ' . $row_no . ', \'out\', \'odd\', \'even\', \'hover\', \'marked\');" ';
                }
                if ($GLOBALS['cfg']['BrowseMarkerEnable'] == true) {
                    $mouse_events .= ' onmousedown="setVerticalPointer(this, ' . $row_no . ', \'click\', \'odd\', \'even\', \'hover\', \'marked\'); setCheckboxColumn(\'id_rows_to_delete' . $row_no . '\');" ';
                } else {
                    $mouse_events .= ' onmousedown="setCheckboxColumn(\'id_rows_to_delete' . $row_no . '\');" ';
                }
            }
            // end if
            // garvin: Wrap MIME-transformations. [MIME]
            $default_function = 'default_function';
            // default_function
            $transform_function = $default_function;
            $transform_options = array();
            if ($GLOBALS['cfgRelation']['mimework'] && $GLOBALS['cfg']['BrowseMIME']) {
                if (isset($GLOBALS['mime_map'][$meta->name]['mimetype']) && isset($GLOBALS['mime_map'][$meta->name]['transformation']) && !empty($GLOBALS['mime_map'][$meta->name]['transformation'])) {
                    $include_file = $GLOBALS['mime_map'][$meta->name]['transformation'];
                    if (file_exists('./libraries/transformations/' . $include_file)) {
                        $transformfunction_name = str_replace('.inc.php', '', $GLOBALS['mime_map'][$meta->name]['transformation']);
                        require_once './libraries/transformations/' . $include_file;
                        if (function_exists('PMA_transformation_' . $transformfunction_name)) {
                            $transform_function = 'PMA_transformation_' . $transformfunction_name;
                            $transform_options = PMA_transformation_getOptions(isset($GLOBALS['mime_map'][$meta->name]['transformation_options']) ? $GLOBALS['mime_map'][$meta->name]['transformation_options'] : '');
                            $meta->mimetype = str_replace('_', '/', $GLOBALS['mime_map'][$meta->name]['mimetype']);
                        }
                    }
                    // end if file_exists
                }
                // end if transformation is set
            }
            // end if mime/transformation works.
            $_url_params = array('db' => $db, 'table' => $table, 'where_clause' => $where_clause, 'transform_key' => $meta->name);
            if (!empty($sql_query)) {
                $_url_params['sql_query'] = $url_sql_query;
            }
            $transform_options['wrapper_link'] = PMA_generate_common_url($_url_params);
            // n u m e r i c
            if ($meta->numeric == 1) {
                // lem9: if two fields have the same name (this is possible
                //       with self-join queries, for example), using $meta->name
                //       will show both fields NULL even if only one is NULL,
                //       so use the $pointer
                if (!isset($row[$i]) || is_null($row[$i])) {
                    $vertical_display['data'][$row_no][$i] = '    <td align="right"' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '"><i>NULL</i></td>' . "\n";
                } elseif ($row[$i] != '') {
                    $nowrap = ' nowrap';
                    $where_comparison = ' = ' . $row[$i];
                    $vertical_display['data'][$row_no][$i] = '<td align="right"' . PMA_prepare_row_data($mouse_events, $class, $condition_field, $analyzed_sql, $meta, $map, $row[$i], $transform_function, $default_function, $nowrap, $where_comparison, $transform_options);
                } else {
                    $vertical_display['data'][$row_no][$i] = '    <td align="right"' . $mouse_events . ' class="' . $class . ' nowrap' . ($condition_field ? ' condition' : '') . '">&nbsp;</td>' . "\n";
                }
                //  b l o b
            } elseif (stristr($meta->type, 'BLOB')) {
                // loic1 : PMA_mysql_fetch_fields returns BLOB in place of
                // TEXT fields type so we have to ensure it's really a BLOB
                $field_flags = PMA_DBI_field_flags($dt_result, $i);
                if (stristr($field_flags, 'BINARY')) {
                    // rajk - for blobstreaming
                    $bs_reference_exists = $allBSTablesExist = FALSE;
                    // load PMA configuration
                    $PMA_Config = $_SESSION['PMA_Config'];
                    // if PMA configuration exists
                    if ($PMA_Config) {
                        // load BS variables
                        $pluginsExist = $PMA_Config->get('BLOBSTREAMING_PLUGINS_EXIST');
                        // if BS plugins exist
                        if ($pluginsExist) {
                            // load BS databases
                            $bs_tables = $PMA_Config->get('BLOBSTREAMABLE_DATABASES');
                            // if BS db array and specified db string not empty and valid
                            if (!empty($bs_tables) && strlen($db) > 0) {
                                $bs_tables = $bs_tables[$db];
                                if (isset($bs_tables)) {
                                    $allBSTablesExist = TRUE;
                                    // check if BS tables exist for given database
                                    foreach ($bs_tables as $table_key => $bs_tbl) {
                                        if (!$bs_tables[$table_key]['Exists']) {
                                            $allBSTablesExist = FALSE;
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    // if necessary BS tables exist
                    if ($allBSTablesExist) {
                        $bs_reference_exists = PMA_BS_ReferenceExists($row[$i], $db);
                    }
                    // if valid BS reference exists
                    if ($bs_reference_exists) {
                        $blobtext = PMA_BS_CreateReferenceLink($row[$i], $db);
                    } else {
                        $blobtext = PMA_handle_non_printable_contents('BLOB', isset($row[$i]) ? $row[$i] : '', $transform_function, $transform_options, $default_function, $meta);
                    }
                    $vertical_display['data'][$row_no][$i] = '    <td align="left"' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '">' . $blobtext . '</td>';
                    unset($blobtext);
                    // not binary:
                } else {
                    if (!isset($row[$i]) || is_null($row[$i])) {
                        $vertical_display['data'][$row_no][$i] = '    <td' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '"><i>NULL</i></td>' . "\n";
                    } elseif ($row[$i] != '') {
                        // garvin: if a transform function for blob is set, none of these replacements will be made
                        if (PMA_strlen($row[$i]) > $GLOBALS['cfg']['LimitChars'] && $_SESSION['tmp_user_values']['display_text'] == 'P') {
                            $row[$i] = PMA_substr($row[$i], 0, $GLOBALS['cfg']['LimitChars']) . '...';
                        }
                        // loic1: displays all space characters, 4 space
                        // characters for tabulations and <cr>/<lf>
                        $row[$i] = $default_function != $transform_function ? $transform_function($row[$i], $transform_options, $meta) : $default_function($row[$i], array(), $meta);
                        $vertical_display['data'][$row_no][$i] = '    <td' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '">' . $row[$i] . '</td>' . "\n";
                    } else {
                        $vertical_display['data'][$row_no][$i] = '    <td' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '">&nbsp;</td>' . "\n";
                    }
                }
                // n o t   n u m e r i c   a n d   n o t   B L O B
            } else {
                if (!isset($row[$i]) || is_null($row[$i])) {
                    $vertical_display['data'][$row_no][$i] = '    <td' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '"><i>NULL</i></td>' . "\n";
                } elseif ($row[$i] != '') {
                    // loic1: support blanks in the key
                    $relation_id = $row[$i];
                    // nijel: Cut all fields to $GLOBALS['cfg']['LimitChars']
                    // lem9: (unless it's a link-type transformation)
                    if (PMA_strlen($row[$i]) > $GLOBALS['cfg']['LimitChars'] && $_SESSION['tmp_user_values']['display_text'] == 'P' && !strpos($transform_function, 'link') === true) {
                        $row[$i] = PMA_substr($row[$i], 0, $GLOBALS['cfg']['LimitChars']) . '...';
                    }
                    // loic1: displays special characters from binaries
                    $field_flags = PMA_DBI_field_flags($dt_result, $i);
                    if (isset($meta->_type) && $meta->_type === MYSQLI_TYPE_BIT) {
                        $row[$i] = PMA_printable_bit_value($row[$i], $meta->length);
                    } elseif (stristr($field_flags, 'BINARY') && $meta->type == 'string') {
                        if ($_SESSION['tmp_user_values']['display_binary'] || isset($GLOBALS['is_analyse']) && $GLOBALS['is_analyse']) {
                            // user asked to see the real contents of BINARY
                            // fields, or we detected a PROCEDURE ANALYSE in
                            // the query (results are reported as being
                            // binary strings)
                            if ($_SESSION['tmp_user_values']['display_binary_as_hex']) {
                                $row[$i] = bin2hex($row[$i]);
                            } else {
                                $row[$i] = htmlspecialchars(PMA_replace_binary_contents($row[$i]));
                            }
                        } else {
                            // we show the BINARY message and field's size
                            // (or maybe use a transformation)
                            $row[$i] = PMA_handle_non_printable_contents('BINARY', $row[$i], $transform_function, $transform_options, $default_function, $meta);
                        }
                    }
                    // garvin: transform functions may enable no-wrapping:
                    $function_nowrap = $transform_function . '_nowrap';
                    $bool_nowrap = $default_function != $transform_function && function_exists($function_nowrap) ? $function_nowrap($transform_options) : false;
                    // loic1: do not wrap if date field type
                    $nowrap = preg_match('@DATE|TIME@i', $meta->type) || $bool_nowrap ? ' nowrap' : '';
                    $where_comparison = ' = \'' . PMA_sqlAddslashes($row[$i]) . '\'';
                    $vertical_display['data'][$row_no][$i] = '<td ' . PMA_prepare_row_data($mouse_events, $class, $condition_field, $analyzed_sql, $meta, $map, $row[$i], $transform_function, $default_function, $nowrap, $where_comparison, $transform_options);
                } else {
                    $vertical_display['data'][$row_no][$i] = '    <td' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '">&nbsp;</td>' . "\n";
                }
            }
            // lem9: output stored cell
            if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal' || $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped') {
                echo $vertical_display['data'][$row_no][$i];
            }
            if (isset($vertical_display['rowdata'][$i][$row_no])) {
                $vertical_display['rowdata'][$i][$row_no] .= $vertical_display['data'][$row_no][$i];
            } else {
                $vertical_display['rowdata'][$i][$row_no] = $vertical_display['data'][$row_no][$i];
            }
        }
        // end for (2)
        // 3. Displays the modify/delete links on the right if required
        if ($GLOBALS['cfg']['ModifyDeleteAtRight'] && ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal' || $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped')) {
            $doWriteModifyAt = 'right';
            require './libraries/display_tbl_links.lib.php';
        }
        // end if (3)
        if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal' || $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped') {
            ?>
</tr>
            <?php 
        }
        // end if
        // 4. Gather links of del_urls and edit_urls in an array for later
        //    output
        if (!isset($vertical_display['edit'][$row_no])) {
            $vertical_display['edit'][$row_no] = '';
            $vertical_display['delete'][$row_no] = '';
            $vertical_display['row_delete'][$row_no] = '';
        }
        $column_style_vertical = '';
        if ($GLOBALS['cfg']['BrowsePointerEnable'] == true) {
            $column_style_vertical .= ' onmouseover="setVerticalPointer(this, ' . $row_no . ', \'over\', \'odd\', \'even\', \'hover\', \'marked\');"' . ' onmouseout="setVerticalPointer(this, ' . $row_no . ', \'out\', \'odd\', \'even\', \'hover\', \'marked\');"';
        }
        $column_marker_vertical = '';
        if ($GLOBALS['cfg']['BrowseMarkerEnable'] == true) {
            $column_marker_vertical .= 'setVerticalPointer(this, ' . $row_no . ', \'click\', \'odd\', \'even\', \'hover\', \'marked\');';
        }
        if (!empty($del_url) && $is_display['del_lnk'] != 'kp') {
            $vertical_display['row_delete'][$row_no] .= '    <td align="center" class="' . $class . '" ' . $column_style_vertical . '>' . "\n" . '        <input type="checkbox" id="id_rows_to_delete' . $row_no . '[%_PMA_CHECKBOX_DIR_%]" name="rows_to_delete[' . $where_clause_html . ']"' . ' onclick="' . $column_marker_vertical . 'copyCheckboxesRange(\'rowsDeleteForm\', \'id_rows_to_delete' . $row_no . '\',\'[%_PMA_CHECKBOX_DIR_%]\');"' . ' value="' . htmlspecialchars($del_query) . '" ' . (isset($GLOBALS['checkall']) ? 'checked="checked"' : '') . ' />' . "\n" . '    </td>' . "\n";
        } else {
            unset($vertical_display['row_delete'][$row_no]);
        }
        if (isset($edit_url)) {
            $vertical_display['edit'][$row_no] .= '    <td align="center" class="' . $class . '" ' . $column_style_vertical . '>' . "\n" . PMA_linkOrButton($edit_url, $edit_str, array(), false) . $bookmark_go . '    </td>' . "\n";
        } else {
            unset($vertical_display['edit'][$row_no]);
        }
        if (isset($del_url)) {
            $vertical_display['delete'][$row_no] .= '    <td align="center" class="' . $class . '" ' . $column_style_vertical . '>' . "\n" . PMA_linkOrButton($del_url, $del_str, isset($js_conf) ? $js_conf : '', false) . '    </td>' . "\n";
        } else {
            unset($vertical_display['delete'][$row_no]);
        }
        echo $_SESSION['tmp_user_values']['disp_direction'] == 'horizontal' || $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped' ? "\n" : '';
        $row_no++;
    }
    // end while
    // this is needed by PMA_displayTable() to generate the proper param
    // in the multi-edit and multi-delete form
    return $clause_is_unique;
}
Example #29
0
    ?>
    </select>
    <input type="submit" name="show_versions_submit" value="<?php 
    echo $strTrackingShowVersions;
    ?>
" />
    </form>
<?php 
}
?>
<br />
<?php 
/*
 * List versions of current table
 */
$sql_query = " SELECT * FROM " . PMA_backquote($GLOBALS['cfg']['Server']['pmadb']) . "." . PMA_backquote($GLOBALS['cfg']['Server']['tracking']) . " WHERE " . PMA_backquote('db_name') . " = '" . PMA_sqlAddslashes($_REQUEST['db']) . "' " . " AND " . PMA_backquote('table_name') . " = '" . PMA_sqlAddslashes($_REQUEST['table']) . "' " . " ORDER BY " . PMA_backquote('version') . " DESC ";
$sql_result = PMA_query_as_controluser($sql_query);
$last_version = 0;
$maxversion = PMA_DBI_fetch_array($sql_result);
$last_version = $maxversion['version'];
if ($last_version > 0) {
    ?>
    <table id="versions" class="data">
    <thead>
    <tr>
        <th><?php 
    echo $strDatabase;
    ?>
</th>
        <th><?php 
    echo $strTable;
Example #30
0
/**
 * Displays the body of the results table
 *
 * @param   integer  the link id associated to the query which results have
 *                   to be displayed
 * @param   array    which elements to display
 * @param   array    the list of relations
 * @param   array    the analyzed query
 *
 * @return  boolean  always true
 *
 * @global  string   $db                the database name
 * @global  string   $table             the table name
 * @global  string   $goto              the url to go back in case of errors
 * @global  boolean  $dontlimitchars    whether to limit the number of displayed
 *                                      characters of text type fields or not
 * @global  string   $sql_query         the sql query
 * @global  integer  $pos               the current position in results
 * @global  integer  $session_max_rows  the maximum number of rows per page
 * @global  array    $fields_meta       the list of fields properties
 * @global  integer  $fields_cnt        the total number of fields returned by
 *                                      the sql query
 * @global  array    $vertical_display  informations used with vertical display
 *                                      mode
 * @global  string   $disp_direction    the display mode
 *                                      (horizontal/vertical/horizontalflipped)
 * @global  integer  $repeat_cells      the number of row to display between two
 *                                      table headers
 * @global  array    $highlight_columns collumn names to highlight
 * @gloabl  array    $row               current row data
 *
 * @access  private
 *
 * @see     PMA_displayTable()
 */
function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql)
{
    global $db, $table, $goto, $dontlimitchars;
    global $sql_query, $pos, $session_max_rows, $fields_meta, $fields_cnt;
    global $vertical_display, $disp_direction, $repeat_cells, $highlight_columns;
    global $row;
    // mostly because of browser transformations, to make the row-data accessible in a plugin
    $url_sql_query = $sql_query;
    // query without conditions to shorten urls when needed, 200 is just
    // guess, it should depend on remaining url length
    if (isset($analyzed_sql) && isset($analyzed_sql[0]) && isset($analyzed_sql[0]['querytype']) && $analyzed_sql[0]['querytype'] == 'SELECT' && strlen($sql_query) > 200) {
        $url_sql_query = 'SELECT ';
        if (isset($analyzed_sql[0]['queryflags']['distinct'])) {
            $url_sql_query .= ' DISTINCT ';
        }
        $url_sql_query .= $analyzed_sql[0]['select_expr_clause'];
        if (!empty($analyzed_sql[0]['from_clause'])) {
            $url_sql_query .= ' FROM ' . $analyzed_sql[0]['from_clause'];
        }
    }
    if (!is_array($map)) {
        $map = array();
    }
    $row_no = 0;
    $vertical_display['edit'] = array();
    $vertical_display['delete'] = array();
    $vertical_display['data'] = array();
    $vertical_display['row_delete'] = array();
    // Correction uva 19991216 in the while below
    // Previous code assumed that all tables have keys, specifically that
    // the phpMyAdmin GUI should support row delete/edit only for such
    // tables.
    // Although always using keys is arguably the prescribed way of
    // defining a relational table, it is not required. This will in
    // particular be violated by the novice.
    // We want to encourage phpMyAdmin usage by such novices. So the code
    // below has been changed to conditionally work as before when the
    // table being displayed has one or more keys; but to display
    // delete/edit options correctly for tables without keys.
    // loic1: use 'PMA_mysql_fetch_array' rather than 'PMA_mysql_fetch_row'
    //        to get the NULL values
    // rabus: This function needs a little rework.
    //        Using MYSQL_BOTH just pollutes the memory!
    // ne0x:  Use function PMA_DBI_fetch_array() due to mysqli
    //        compatibility. Now this function is wrapped.
    $odd_row = true;
    while ($row = PMA_DBI_fetch_row($dt_result)) {
        // lem9: "vertical display" mode stuff
        if ($row_no != 0 && $repeat_cells != 0 && !($row_no % $repeat_cells) && ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped')) {
            echo '<tr>' . "\n";
            if ($vertical_display['emptypre'] > 0) {
                echo '    <th colspan="' . $vertical_display['emptypre'] . '">' . "\n" . '        &nbsp;</th>' . "\n";
            }
            foreach ($vertical_display['desc'] as $val) {
                echo $val;
            }
            if ($vertical_display['emptyafter'] > 0) {
                echo '    <th colspan="' . $vertical_display['emptyafter'] . '">' . "\n" . '        &nbsp;</th>' . "\n";
            }
            echo '</tr>' . "\n";
        }
        // end if
        $class = $odd_row ? 'odd' : 'even';
        $odd_row = !$odd_row;
        if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') {
            // loic1: pointer code part
            echo '    <tr class="' . $class . '">' . "\n";
            $class = '';
        }
        // 1. Prepares the row (gets primary keys to use)
        // 1.1 Results from a "SELECT" statement -> builds the
        //     "primary" key to use in links
        $uva_condition = urlencode(PMA_getUvaCondition($dt_result, $fields_cnt, $fields_meta, $row));
        // 1.2 Defines the urls for the modify/delete link(s)
        $url_query = PMA_generate_common_url($db, $table) . '&amp;pos=' . $pos . '&amp;session_max_rows=' . $session_max_rows . '&amp;disp_direction=' . $disp_direction . '&amp;repeat_cells=' . $repeat_cells . '&amp;dontlimitchars=' . $dontlimitchars;
        if ($is_display['edit_lnk'] != 'nn' || $is_display['del_lnk'] != 'nn') {
            // We need to copy the value or else the == 'both' check will always return true
            if ($GLOBALS['cfg']['PropertiesIconic'] === 'both') {
                $iconic_spacer = '<div class="nowrap">';
            } else {
                $iconic_spacer = '';
            }
            // 1.2.1 Modify link(s)
            if ($is_display['edit_lnk'] == 'ur') {
                // update row case
                $lnk_goto = 'sql.php';
                $edit_url = 'tbl_change.php' . '?' . $url_query . '&amp;primary_key=' . $uva_condition . '&amp;sql_query=' . urlencode($url_sql_query) . '&amp;goto=' . urlencode($lnk_goto);
                if ($GLOBALS['cfg']['PropertiesIconic'] === false) {
                    $edit_str = $GLOBALS['strEdit'];
                } else {
                    $edit_str = $iconic_spacer . '<img class="icon" width="16" height="16" src="' . $GLOBALS['pmaThemeImage'] . 'b_edit.png" alt="' . $GLOBALS['strEdit'] . '" title="' . $GLOBALS['strEdit'] . '" />';
                    if ($GLOBALS['cfg']['PropertiesIconic'] === 'both') {
                        $edit_str .= ' ' . $GLOBALS['strEdit'] . '</div>';
                    }
                }
            }
            // end if (1.2.1)
            if ($table == $GLOBALS['cfg']['Bookmark']['table'] && $db == $GLOBALS['cfg']['Bookmark']['db'] && isset($row[1]) && isset($row[0])) {
                $bookmark_go = '<a href="import.php?' . PMA_generate_common_url($row[1], '') . '&amp;id_bookmark=' . $row[0] . '&amp;action_bookmark=0' . '&amp;action_bookmark_all=1' . '&amp;SQL=' . $GLOBALS['strExecuteBookmarked'] . ' " title="' . $GLOBALS['strExecuteBookmarked'] . '">';
                if ($GLOBALS['cfg']['PropertiesIconic'] === false) {
                    $bookmark_go .= $GLOBALS['strExecuteBookmarked'];
                } else {
                    $bookmark_go .= $iconic_spacer . '<img class="icon" width="16" height="16" src="' . $GLOBALS['pmaThemeImage'] . 'b_bookmark.png" alt="' . $GLOBALS['strExecuteBookmarked'] . '" title="' . $GLOBALS['strExecuteBookmarked'] . '" />';
                    if ($GLOBALS['cfg']['PropertiesIconic'] === 'both') {
                        $bookmark_go .= ' ' . $GLOBALS['strExecuteBookmarked'] . '</div>';
                    }
                }
                $bookmark_go .= '</a>';
            } else {
                $bookmark_go = '';
            }
            // 1.2.2 Delete/Kill link(s)
            if ($is_display['del_lnk'] == 'dr') {
                // delete row case
                $lnk_goto = 'sql.php' . '?' . str_replace('&amp;', '&', $url_query) . '&sql_query=' . urlencode($url_sql_query) . '&zero_rows=' . urlencode(htmlspecialchars($GLOBALS['strDeleted'])) . '&goto=' . (empty($goto) ? 'tbl_properties.php' : $goto);
                $del_query = urlencode('DELETE FROM ' . PMA_backquote($table) . ' WHERE') . $uva_condition . '+LIMIT+1';
                $del_url = 'sql.php' . '?' . $url_query . '&amp;sql_query=' . $del_query . '&amp;zero_rows=' . urlencode(htmlspecialchars($GLOBALS['strDeleted'])) . '&amp;goto=' . urlencode($lnk_goto);
                $js_conf = 'DELETE FROM ' . PMA_jsFormat($table) . ' WHERE ' . trim(PMA_jsFormat(urldecode($uva_condition), false)) . ' LIMIT 1';
                if ($GLOBALS['cfg']['PropertiesIconic'] === false) {
                    $del_str = $GLOBALS['strDelete'];
                } else {
                    $del_str = $iconic_spacer . '<img class="icon" width="16" height="16" src="' . $GLOBALS['pmaThemeImage'] . 'b_drop.png" alt="' . $GLOBALS['strDelete'] . '" title="' . $GLOBALS['strDelete'] . '" />';
                    if ($GLOBALS['cfg']['PropertiesIconic'] === 'both') {
                        $del_str .= ' ' . $GLOBALS['strDelete'] . '</div>';
                    }
                }
            } elseif ($is_display['del_lnk'] == 'kp') {
                // kill process case
                $lnk_goto = 'sql.php' . '?' . str_replace('&amp;', '&', $url_query) . '&sql_query=' . urlencode($url_sql_query) . '&goto=main.php';
                $del_url = 'sql.php?' . PMA_generate_common_url('mysql') . '&amp;sql_query=' . urlencode('KILL ' . $row[0]) . '&amp;goto=' . urlencode($lnk_goto);
                $del_query = urlencode('KILL ' . $row[0]);
                $js_conf = 'KILL ' . $row[0];
                if ($GLOBALS['cfg']['PropertiesIconic'] === false) {
                    $del_str = $GLOBALS['strKill'];
                } else {
                    $del_str = $iconic_spacer . '<img class="icon" width="16" height="16" src="' . $GLOBALS['pmaThemeImage'] . 'b_drop.png" alt="' . $GLOBALS['strKill'] . '" title="' . $GLOBALS['strKill'] . '" />';
                    if ($GLOBALS['cfg']['PropertiesIconic'] === 'both') {
                        $del_str .= ' ' . $GLOBALS['strKill'] . '</div>';
                    }
                }
            }
            // end if (1.2.2)
            // 1.3 Displays the links at left if required
            if ($GLOBALS['cfg']['ModifyDeleteAtLeft'] && ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped')) {
                $doWriteModifyAt = 'left';
                require './libraries/display_tbl_links.lib.php';
            }
            // end if (1.3)
        }
        // end if (1)
        // 2. Displays the rows' values
        for ($i = 0; $i < $fields_cnt; ++$i) {
            $meta = $fields_meta[$i];
            // loic1: To fix bug #474943 under php4, the row pointer will
            //        depend on whether the "is_null" php4 function is
            //        available or not
            $pointer = function_exists('is_null') ? $i : $meta->name;
            // garvin: See if this column should get highlight because it's used in the
            //  where-query.
            if (isset($highlight_columns) && (isset($highlight_columns[$meta->name]) || isset($highlight_columns[PMA_backquote($meta->name)]))) {
                $condition_field = true;
            } else {
                $condition_field = false;
            }
            $mouse_events = '';
            if ($disp_direction == 'vertical' && (!isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1')) {
                if ($GLOBALS['cfg']['BrowsePointerEnable'] == true) {
                    $mouse_events .= ' onmouseover="setVerticalPointer(this, ' . $row_no . ', \'over\', \'odd\', \'even\', \'hover\', \'marked\');"' . ' onmouseout="setVerticalPointer(this, ' . $row_no . ', \'out\', \'odd\', \'even\', \'hover\', \'marked\');" ';
                }
                if ($GLOBALS['cfg']['BrowseMarkerEnable'] == true) {
                    $mouse_events .= ' onmousedown="setVerticalPointer(this, ' . $row_no . ', \'click\', \'odd\', \'even\', \'hover\', \'marked\'); setCheckboxColumn(\'id_rows_to_delete' . $row_no . '\');" ';
                } else {
                    $mouse_events .= ' onmousedown="setCheckboxColumn(\'id_rows_to_delete' . $row_no . '\');" ';
                }
            }
            // end if
            // garvin: Wrap MIME-transformations. [MIME]
            $default_function = 'default_function';
            // default_function
            $transform_function = $default_function;
            $transform_options = array();
            if ($GLOBALS['cfgRelation']['mimework'] && $GLOBALS['cfg']['BrowseMIME']) {
                if (isset($GLOBALS['mime_map'][$meta->name]['mimetype']) && isset($GLOBALS['mime_map'][$meta->name]['transformation']) && !empty($GLOBALS['mime_map'][$meta->name]['transformation'])) {
                    $include_file = PMA_sanitizeTransformationFile($GLOBALS['mime_map'][$meta->name]['transformation']);
                    if (file_exists('./libraries/transformations/' . $include_file)) {
                        $transformfunction_name = preg_replace('@(\\.inc\\.php3?)$@i', '', $GLOBALS['mime_map'][$meta->name]['transformation']);
                        require_once './libraries/transformations/' . $include_file;
                        if (function_exists('PMA_transformation_' . $transformfunction_name)) {
                            $transform_function = 'PMA_transformation_' . $transformfunction_name;
                            $transform_options = PMA_transformation_getOptions(isset($GLOBALS['mime_map'][$meta->name]['transformation_options']) ? $GLOBALS['mime_map'][$meta->name]['transformation_options'] : '');
                            $meta->mimetype = str_replace('_', '/', $GLOBALS['mime_map'][$meta->name]['mimetype']);
                        }
                    }
                    // end if file_exists
                }
                // end if transformation is set
            }
            // end if mime/transformation works.
            $transform_options['wrapper_link'] = '?' . (isset($url_query) ? $url_query : '') . '&amp;primary_key=' . (isset($uva_condition) ? $uva_condition : '') . '&amp;sql_query=' . (isset($sql_query) ? urlencode($url_sql_query) : '') . '&amp;goto=' . (isset($sql_goto) ? urlencode($lnk_goto) : '') . '&amp;transform_key=' . urlencode($meta->name);
            // n u m e r i c
            if ($meta->numeric == 1) {
                // lem9: if two fields have the same name (this is possible
                //       with self-join queries, for example), using $meta->name
                //       will show both fields NULL even if only one is NULL,
                //       so use the $pointer
                //      (works only if function_exists('is_null')
                // PS:   why not always work with the number ($i), since
                //       the default second parameter of
                //       mysql_fetch_array() is MYSQL_BOTH, so we always get
                //       associative and numeric indices?
                //if (!isset($row[$meta->name])
                if (!isset($row[$i]) || is_null($row[$i])) {
                    $vertical_display['data'][$row_no][$i] = '    <td align="right"' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '"><i>NULL</i></td>' . "\n";
                } elseif ($row[$i] != '') {
                    $vertical_display['data'][$row_no][$i] = '    <td align="right"' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . ' nowrap">';
                    if (isset($analyzed_sql[0]['select_expr']) && is_array($analyzed_sql[0]['select_expr'])) {
                        foreach ($analyzed_sql[0]['select_expr'] as $select_expr_position => $select_expr) {
                            $alias = $analyzed_sql[0]['select_expr'][$select_expr_position]['alias'];
                            if (isset($alias) && strlen($alias)) {
                                $true_column = $analyzed_sql[0]['select_expr'][$select_expr_position]['column'];
                                if ($alias == $meta->name) {
                                    $meta->name = $true_column;
                                }
                                // end if
                            }
                            // end if
                        }
                        // end while
                    }
                    if (isset($map[$meta->name])) {
                        // Field to display from the foreign table?
                        if (isset($map[$meta->name][2]) && strlen($map[$meta->name][2])) {
                            $dispsql = 'SELECT ' . PMA_backquote($map[$meta->name][2]) . ' FROM ' . PMA_backquote($map[$meta->name][3]) . '.' . PMA_backquote($map[$meta->name][0]) . ' WHERE ' . PMA_backquote($map[$meta->name][1]) . ' = ' . $row[$i];
                            $dispresult = PMA_DBI_try_query($dispsql, null, PMA_DBI_QUERY_STORE);
                            if ($dispresult && PMA_DBI_num_rows($dispresult) > 0) {
                                list($dispval) = PMA_DBI_fetch_row($dispresult, 0);
                            } else {
                                $dispval = $GLOBALS['strLinkNotFound'];
                            }
                            @PMA_DBI_free_result($dispresult);
                        } else {
                            $dispval = '';
                        }
                        // end if... else...
                        if (isset($GLOBALS['printview']) && $GLOBALS['printview'] == '1') {
                            $vertical_display['data'][$row_no][$i] .= ($transform_function != $default_function ? $transform_function($row[$i], $transform_options, $meta) : $transform_function($row[$i], array(), $meta)) . ' <code>[-&gt;' . $dispval . ']</code>';
                        } else {
                            $title = !empty($dispval) ? ' title="' . htmlspecialchars($dispval) . '"' : '';
                            $vertical_display['data'][$row_no][$i] .= '<a href="sql.php?' . PMA_generate_common_url($map[$meta->name][3], $map[$meta->name][0]) . '&amp;pos=0&amp;session_max_rows=' . $session_max_rows . '&amp;dontlimitchars=' . $dontlimitchars . '&amp;sql_query=' . urlencode('SELECT * FROM ' . PMA_backquote($map[$meta->name][0]) . ' WHERE ' . PMA_backquote($map[$meta->name][1]) . ' = ' . $row[$i]) . '"' . $title . '>' . ($transform_function != $default_function ? $transform_function($row[$i], $transform_options, $meta) : $transform_function($row[$i], array(), $meta)) . '</a>';
                        }
                    } else {
                        $vertical_display['data'][$row_no][$i] .= $transform_function != $default_function ? $transform_function($row[$i], $transform_options, $meta) : $transform_function($row[$i], array(), $meta);
                    }
                    $vertical_display['data'][$row_no][$i] .= '</td>' . "\n";
                } else {
                    $vertical_display['data'][$row_no][$i] = '    <td align="right"' . $mouse_events . ' class="' . $class . ' nowrap' . ($condition_field ? ' condition' : '') . '">&nbsp;</td>' . "\n";
                }
                //  b l o b
            } elseif ($GLOBALS['cfg']['ShowBlob'] == false && stristr($meta->type, 'BLOB')) {
                // loic1 : PMA_mysql_fetch_fields returns BLOB in place of
                // TEXT fields type, however TEXT fields must be displayed
                // even if $GLOBALS['cfg']['ShowBlob'] is false -> get the true type
                // of the fields.
                $field_flags = PMA_DBI_field_flags($dt_result, $i);
                if (stristr($field_flags, 'BINARY')) {
                    $blobtext = '[BLOB';
                    if (!isset($row[$i]) || is_null($row[$i])) {
                        $blobtext .= ' - NULL';
                        $blob_size = 0;
                    } elseif (isset($row[$i])) {
                        $blob_size = strlen($row[$i]);
                        $display_blob_size = PMA_formatByteDown($blob_size, 3, 1);
                        $blobtext .= ' - ' . $display_blob_size[0] . ' ' . $display_blob_size[1];
                        unset($display_blob_size);
                    }
                    $blobtext .= ']';
                    if (strpos($transform_function, 'octetstream')) {
                        $blobtext = $row[$i];
                    }
                    if ($blob_size > 0) {
                        $blobtext = $default_function != $transform_function ? $transform_function($blobtext, $transform_options, $meta) : $default_function($blobtext, array(), $meta);
                    }
                    unset($blob_size);
                    $vertical_display['data'][$row_no][$i] = '    <td align="left"' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '">' . $blobtext . '</td>';
                } else {
                    if (!isset($row[$i]) || is_null($row[$i])) {
                        $vertical_display['data'][$row_no][$i] = '    <td' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '"><i>NULL</i></td>' . "\n";
                    } elseif ($row[$i] != '') {
                        // garvin: if a transform function for blob is set, none of these replacements will be made
                        if (PMA_strlen($row[$i]) > $GLOBALS['cfg']['LimitChars'] && $dontlimitchars != 1) {
                            $row[$i] = PMA_substr($row[$i], 0, $GLOBALS['cfg']['LimitChars']) . '...';
                        }
                        // loic1: displays all space characters, 4 space
                        // characters for tabulations and <cr>/<lf>
                        $row[$i] = $default_function != $transform_function ? $transform_function($row[$i], $transform_options, $meta) : $default_function($row[$i], array(), $meta);
                        $vertical_display['data'][$row_no][$i] = '    <td' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '">' . $row[$i] . '</td>' . "\n";
                    } else {
                        $vertical_display['data'][$row_no][$i] = '    <td' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '">&nbsp;</td>' . "\n";
                    }
                }
            } else {
                if (!isset($row[$i]) || is_null($row[$i])) {
                    $vertical_display['data'][$row_no][$i] = '    <td' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '"><i>NULL</i></td>' . "\n";
                } elseif ($row[$i] != '') {
                    // loic1: support blanks in the key
                    $relation_id = $row[$i];
                    // nijel: Cut all fields to $GLOBALS['cfg']['LimitChars']
                    // lem9: (unless it's a link-type transformation)
                    if (PMA_strlen($row[$i]) > $GLOBALS['cfg']['LimitChars'] && $dontlimitchars != 1 && !strpos($transform_function, 'link') === true) {
                        $row[$i] = PMA_substr($row[$i], 0, $GLOBALS['cfg']['LimitChars']) . '...';
                    }
                    // loic1: displays special characters from binaries
                    $field_flags = PMA_DBI_field_flags($dt_result, $i);
                    if (stristr($field_flags, 'BINARY')) {
                        $row[$i] = str_replace("", '\\0', $row[$i]);
                        $row[$i] = str_replace("", '\\b', $row[$i]);
                        $row[$i] = str_replace("\n", '\\n', $row[$i]);
                        $row[$i] = str_replace("\r", '\\r', $row[$i]);
                        $row[$i] = str_replace("", '\\Z', $row[$i]);
                        $row[$i] = $default_function != $transform_function ? $transform_function($row[$i], $transform_options, $meta) : $default_function($row[$i], array(), $meta);
                    } else {
                        $row[$i] = $default_function != $transform_function ? $transform_function($row[$i], $transform_options, $meta) : $default_function($row[$i], array(), $meta);
                    }
                    // garvin: transform functions may enable nowrapping:
                    $function_nowrap = $transform_function . '_nowrap';
                    $bool_nowrap = $default_function != $transform_function && function_exists($function_nowrap) ? $function_nowrap($transform_options) : false;
                    // loic1: do not wrap if date field type
                    $nowrap = preg_match('@DATE|TIME@i', $meta->type) || $bool_nowrap ? ' nowrap' : '';
                    $vertical_display['data'][$row_no][$i] = '    <td' . $mouse_events . ' class="' . $class . $nowrap . ($condition_field ? ' condition' : '') . '">';
                    if (isset($analyzed_sql[0]['select_expr']) && is_array($analyzed_sql[0]['select_expr'])) {
                        foreach ($analyzed_sql[0]['select_expr'] as $select_expr_position => $select_expr) {
                            $alias = $analyzed_sql[0]['select_expr'][$select_expr_position]['alias'];
                            if (isset($alias) && strlen($alias)) {
                                $true_column = $analyzed_sql[0]['select_expr'][$select_expr_position]['column'];
                                if ($alias == $meta->name) {
                                    $meta->name = $true_column;
                                }
                                // end if
                            }
                            // end if
                        }
                        // end while
                    }
                    if (isset($map[$meta->name])) {
                        // Field to display from the foreign table?
                        if (isset($map[$meta->name][2]) && strlen($map[$meta->name][2])) {
                            $dispsql = 'SELECT ' . PMA_backquote($map[$meta->name][2]) . ' FROM ' . PMA_backquote($map[$meta->name][3]) . '.' . PMA_backquote($map[$meta->name][0]) . ' WHERE ' . PMA_backquote($map[$meta->name][1]) . ' = \'' . PMA_sqlAddslashes($row[$i]) . '\'';
                            $dispresult = PMA_DBI_try_query($dispsql, null, PMA_DBI_QUERY_STORE);
                            if ($dispresult && PMA_DBI_num_rows($dispresult) > 0) {
                                list($dispval) = PMA_DBI_fetch_row($dispresult);
                                @PMA_DBI_free_result($dispresult);
                            } else {
                                $dispval = $GLOBALS['strLinkNotFound'];
                            }
                        } else {
                            $dispval = '';
                        }
                        $title = !empty($dispval) ? ' title="' . htmlspecialchars($dispval) . '"' : '';
                        $vertical_display['data'][$row_no][$i] .= '<a href="sql.php?' . PMA_generate_common_url($map[$meta->name][3], $map[$meta->name][0]) . '&amp;pos=0&amp;session_max_rows=' . $session_max_rows . '&amp;dontlimitchars=' . $dontlimitchars . '&amp;sql_query=' . urlencode('SELECT * FROM ' . PMA_backquote($map[$meta->name][0]) . ' WHERE ' . PMA_backquote($map[$meta->name][1]) . ' = \'' . PMA_sqlAddslashes($relation_id) . '\'') . '"' . $title . '>' . $row[$i] . '</a>';
                    } else {
                        $vertical_display['data'][$row_no][$i] .= $row[$i];
                    }
                    $vertical_display['data'][$row_no][$i] .= '</td>' . "\n";
                } else {
                    $vertical_display['data'][$row_no][$i] = '    <td' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '">&nbsp;</td>' . "\n";
                }
            }
            // lem9: output stored cell
            if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') {
                echo $vertical_display['data'][$row_no][$i];
            }
            if (isset($vertical_display['rowdata'][$i][$row_no])) {
                $vertical_display['rowdata'][$i][$row_no] .= $vertical_display['data'][$row_no][$i];
            } else {
                $vertical_display['rowdata'][$i][$row_no] = $vertical_display['data'][$row_no][$i];
            }
        }
        // end for (2)
        // 3. Displays the modify/delete links on the right if required
        if ($GLOBALS['cfg']['ModifyDeleteAtRight'] && ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped')) {
            $doWriteModifyAt = 'right';
            require './libraries/display_tbl_links.lib.php';
        }
        // end if (3)
        if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') {
            ?>
</tr>
            <?php 
        }
        // end if
        // 4. Gather links of del_urls and edit_urls in an array for later
        //    output
        if (!isset($vertical_display['edit'][$row_no])) {
            $vertical_display['edit'][$row_no] = '';
            $vertical_display['delete'][$row_no] = '';
            $vertical_display['row_delete'][$row_no] = '';
        }
        $column_style_vertical = '';
        if ($GLOBALS['cfg']['BrowsePointerEnable'] == true) {
            $column_style_vertical .= ' onmouseover="setVerticalPointer(this, ' . $row_no . ', \'over\', \'odd\', \'even\', \'hover\', \'marked\');"' . ' onmouseout="setVerticalPointer(this, ' . $row_no . ', \'out\', \'odd\', \'even\', \'hover\', \'marked\');"';
        }
        $column_marker_vertical = '';
        if ($GLOBALS['cfg']['BrowseMarkerEnable'] == true) {
            $column_marker_vertical .= 'setVerticalPointer(this, ' . $row_no . ', \'click\', \'odd\', \'even\', \'hover\', \'marked\');';
        }
        if (!empty($del_url) && $is_display['del_lnk'] != 'kp') {
            $vertical_display['row_delete'][$row_no] .= '    <td align="center" class="' . $class . '" ' . $column_style_vertical . '>' . "\n" . '        <input type="checkbox" id="id_rows_to_delete' . $row_no . '[%_PMA_CHECKBOX_DIR_%]" name="rows_to_delete[' . $uva_condition . ']"' . ' onclick="' . $column_marker_vertical . 'copyCheckboxesRange(\'rowsDeleteForm\', \'id_rows_to_delete' . $row_no . '\',\'[%_PMA_CHECKBOX_DIR_%]\');"' . ' value="' . $del_query . '" ' . (isset($GLOBALS['checkall']) ? 'checked="checked"' : '') . ' />' . "\n" . '    </td>' . "\n";
        } else {
            unset($vertical_display['row_delete'][$row_no]);
        }
        if (isset($edit_url)) {
            $vertical_display['edit'][$row_no] .= '    <td align="center" class="' . $class . '" ' . $column_style_vertical . '>' . "\n" . PMA_linkOrButton($edit_url, $edit_str, array(), false) . $bookmark_go . '    </td>' . "\n";
        } else {
            unset($vertical_display['edit'][$row_no]);
        }
        if (isset($del_url)) {
            $vertical_display['delete'][$row_no] .= '    <td align="center" class="' . $class . '" ' . $column_style_vertical . '>' . "\n" . PMA_linkOrButton($del_url, $del_str, isset($js_conf) ? $js_conf : '', false) . '    </td>' . "\n";
        } else {
            unset($vertical_display['delete'][$row_no]);
        }
        echo $disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped' ? "\n" : '';
        $row_no++;
    }
    // end while
    if (isset($url_query)) {
        $GLOBALS['url_query'] = $url_query;
    }
    return true;
}