~ubuntu-branches/ubuntu/dapper/phpmyadmin/dapper

« back to all changes in this revision

Viewing changes to tbl_properties_table_info.php

  • Committer: Bazaar Package Importer
  • Author(s): Piotr Roszatycki
  • Date: 2006-04-14 14:47:28 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20060414144728-beg0typednbav31s
Tags: 4:2.8.0.3-1
* New upstream release.
* Security fix: XSS vulnerability (calling directly css files under themes)
  See: http://www.phpmyadmin.net/home_page/security.php?issue=PMASA-2006-1
  See: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2006-1678
  Closes: #362567.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php
2
 
/* $Id: tbl_properties_table_info.php,v 2.17 2005/10/11 14:00:41 cybot_tm Exp $ */
3
 
// vim: expandtab sw=4 ts=4 sts=4:
4
 
 
5
 
// this should be recoded as functions, to avoid messing with global
6
 
// variables
7
 
 
8
 
require_once('./libraries/common.lib.php');
9
 
 
10
 
// Check parameters
11
 
PMA_checkParameters(array('db', 'table'));
12
 
 
13
 
/**
14
 
 * Defining global variables, in case this script is included by a function.
15
 
 * This is necessary because this script can be included by header.inc.php.
16
 
 */
17
 
global $showtable, $tbl_is_view, $tbl_type, $show_comment, $tbl_collation,
18
 
       $table_info_num_rows, $auto_increment;
19
 
 
20
 
/**
21
 
 * Gets table informations
22
 
 */
23
 
 
24
 
// Seems we need to do this in MySQL 5.0.2,
25
 
// otherwise error #1046, no database selected
26
 
PMA_DBI_select_db($db);
27
 
 
28
 
// The 'show table' statement works correct since 3.23.03
29
 
$table_info_result   = PMA_DBI_query('SHOW TABLE STATUS LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\';', NULL, PMA_DBI_QUERY_STORE);
30
 
 
31
 
// need this test because when we are creating a table, we get 0 rows
32
 
// from the SHOW TABLE query
33
 
// and we don't want to mess up the $tbl_type coming from the form
34
 
 
35
 
if ($table_info_result && PMA_DBI_num_rows($table_info_result) > 0) {
36
 
    $showtable           = PMA_DBI_fetch_assoc($table_info_result);
37
 
    if (!isset($showtable['Type']) && isset($showtable['Engine'])) {
38
 
        $showtable['Type'] =& $showtable['Engine'];
39
 
    }
40
 
    // MySQL < 5.0.13 returns "view", >= 5.0.13 returns "VIEW"
41
 
    if (PMA_MYSQL_INT_VERSION >= 50000 && !isset($showtable['Type']) && isset($showtable['Comment']) && strtoupper($showtable['Comment']) == 'VIEW') {
42
 
        $tbl_is_view     = TRUE;
43
 
        $tbl_type        = $strView;
44
 
        $show_comment    = NULL;
45
 
    } else {
46
 
        $tbl_is_view     = FALSE;
47
 
        $tbl_type        = isset($showtable['Type']) ? strtoupper($showtable['Type']) : '';
48
 
        // a new comment could be coming from tbl_properties_operations.php
49
 
        // and we want to show it in the header
50
 
        if (isset($submitcomment) && isset($comment)) {
51
 
            $show_comment = $comment;
52
 
        } else {
53
 
            $show_comment    = (isset($showtable['Comment']) ? $showtable['Comment'] : '');
54
 
        }
55
 
    }
56
 
    $tbl_collation       = empty($showtable['Collation']) ? '' : $showtable['Collation'];
57
 
    
58
 
    if ( NULL === $showtable['Rows'] ) {
59
 
        $showtable['Rows']   = PMA_countRecords( $GLOBALS['db'],
60
 
            $showtable['Name'], $return = true, $force_exact = true );
61
 
    }
62
 
    $table_info_num_rows = (isset($showtable['Rows']) ? $showtable['Rows'] : 0);
63
 
    $auto_increment      = (isset($showtable['Auto_increment']) ? $showtable['Auto_increment'] : '');
64
 
 
65
 
    $tmp                 = isset($showtable['Create_options']) ? explode(' ', $showtable['Create_options']) : array();
66
 
    $tmp_cnt             = count($tmp);
67
 
    for ($i = 0; $i < $tmp_cnt; $i++) {
68
 
        $tmp1            = explode('=', $tmp[$i]);
69
 
        if (isset($tmp1[1])) {
70
 
            $$tmp1[0]    = $tmp1[1];
71
 
        }
72
 
    } // end for
73
 
    PMA_DBI_free_result($table_info_result);
74
 
    unset($tmp1, $tmp, $table_info_result);
75
 
} // end if
76
 
?>