/**
 * Returns the html for the list filter
 *
 * @param Object $ServerStatusData An instance of the PMA_ServerStatusData class
 *
 * @return string
 */
function getFilterHtml($ServerStatusData)
{
    $filterAlert = '';
    if (!empty($_REQUEST['filterAlert'])) {
        $filterAlert = ' checked="checked"';
    }
    $filterText = '';
    if (!empty($_REQUEST['filterText'])) {
        $filterText = htmlspecialchars($_REQUEST['filterText']);
    }
    $dontFormat = '';
    if (!empty($_REQUEST['dontFormat'])) {
        $dontFormat = ' checked="checked"';
    }
    $retval = '';
    $retval .= '<fieldset id="tableFilter">';
    $retval .= '<legend>' . __('Filters') . '</legend>';
    $retval .= '<form action="server_status_variables.php?' . PMA_generate_common_url() . '">';
    $retval .= '<input type="submit" value="' . __('Refresh') . '" />';
    $retval .= '<div class="formelement">';
    $retval .= '<label for="filterText">' . __('Containing the word:') . '</label>';
    $retval .= '<input name="filterText" type="text" id="filterText" ' . 'style="vertical-align: baseline;" value="' . $filterText . '" />';
    $retval .= '</div>';
    $retval .= '<div class="formelement">';
    $retval .= '<input' . $filterAlert . ' type="checkbox" name="filterAlert" id="filterAlert" />';
    $retval .= '<label for="filterAlert">';
    $retval .= __('Show only alert values');
    $retval .= '</label>';
    $retval .= '</div>';
    $retval .= '<div class="formelement">';
    $retval .= '<select id="filterCategory" name="filterCategory">';
    $retval .= '<option value="">' . __('Filter by category…') . '</option>';
    foreach ($ServerStatusData->sections as $section_id => $section_name) {
        if (isset($ServerStatusData->categoryUsed[$section_id])) {
            if (!empty($_REQUEST['filterCategory']) && $_REQUEST['filterCategory'] == $section_id) {
                $selected = ' selected="selected"';
            } else {
                $selected = '';
            }
            $retval .= '<option' . $selected . ' value="' . $section_id . '">';
            $retval .= htmlspecialchars($section_name) . '</option>';
        }
    }
    $retval .= '</select>';
    $retval .= '</div>';
    $retval .= '<div class="formelement">';
    $retval .= '<input' . $dontFormat . ' type="checkbox" name="dontFormat" id="dontFormat" />';
    $retval .= '<label for="dontFormat">';
    $retval .= __('Show unformatted values');
    $retval .= '</label>';
    $retval .= '</div>';
    $retval .= '</form>';
    $retval .= '</fieldset>';
    return $retval;
}
Beispiel #2
0
                            PMA_BS_DropTables($db);
                        }
                        break;
                        // repair BLOB repository
                    // repair BLOB repository
                    case "repair":
                        // check if a blobstreaming table is missing
                        foreach ($bs_tables as $table_key => $tbl) {
                            if (!$bs_tables[$table_key]['Exists']) {
                                PMA_DBI_select_db($db);
                                PMA_DBI_query(PMA_BS_GetTableStruct($table_key));
                            }
                        }
                }
                // refresh side menu
                PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . 'db_operations.php?' . PMA_generate_common_url('', '', '&') . (isset($db) ? '&db=' . urlencode($db) : '') . (isset($token) ? '&token=' . urlencode($token) : '') . (isset($goto) ? '&goto=' . urlencode($goto) : '') . 'reload=1&purge=1');
            }
            // end  if ($PMA_Config->get('BLOBSTREAMING_PLUGINS_EXIST'))
        }
        // end if ($PMA_Config->get('PBXT_NAME') !== strtolower($db))
    }
}
/**
 * Settings for relations stuff
 */
require_once './libraries/relation.lib.php';
$cfgRelation = PMA_getRelationsParam();
/**
 * Check if comments were updated
 * (must be done before displaying the menu tabs)
 */
Beispiel #3
0
/**
 * returns last error message or false if no errors occured
 *
 * @uses    PMA_DBI_convert_message()
 * @uses    $GLOBALS['errno']
 * @uses    $GLOBALS['userlink']
 * @uses    $GLOBALS['strServerNotResponding']
 * @uses    $GLOBALS['strSocketProblem']
 * @uses    $GLOBALS['strDetails']
 * @uses    mysql_errno()
 * @uses    mysql_error()
 * @uses    defined()
 * @uses    PMA_generate_common_url()
 * @param   resource        $link   mysql link
 * @return  string|boolean  $error or false
 */
function PMA_DBI_getError($link = null)
{
    $GLOBALS['errno'] = 0;
    /* Treat false same as null because of controllink */
    if ($link === false) {
        $link = null;
    }
    if (null === $link && isset($GLOBALS['userlink'])) {
        $link =& $GLOBALS['userlink'];
        // Do not stop now. On the initial connection, we don't have a $link,
        // we don't have a $GLOBALS['userlink'], but we can catch the error code
        //    } else {
        //            return false;
    }
    if (null !== $link && false !== $link) {
        $error_number = mysql_errno($link);
        $error_message = mysql_error($link);
    } else {
        $error_number = mysql_errno();
        $error_message = mysql_error();
    }
    if (0 == $error_number) {
        return false;
    }
    // keep the error number for further check after the call to PMA_DBI_getError()
    $GLOBALS['errno'] = $error_number;
    if (!empty($error_message)) {
        $error_message = PMA_DBI_convert_message($error_message);
    }
    $error_message = htmlspecialchars($error_message);
    // Some errors messages cannot be obtained by mysql_error()
    if ($error_number == 2002) {
        $error = '#' . (string) $error_number . ' - ' . $GLOBALS['strServerNotResponding'] . ' ' . $GLOBALS['strSocketProblem'];
    } elseif ($error_number == 2003) {
        $error = '#' . (string) $error_number . ' - ' . $GLOBALS['strServerNotResponding'];
    } elseif ($error_number == 1005) {
        /* InnoDB contraints, see
         * http://dev.mysql.com/doc/refman/5.0/en/innodb-foreign-key-constraints.html
         */
        $error = '#' . (string) $error_number . ' - ' . $error_message . ' (<a href="server_engines.php' . PMA_generate_common_url(array('engine' => 'InnoDB', 'page' => 'Status')) . '">' . $GLOBALS['strDetails'] . '</a>)';
    } else {
        $error = '#' . (string) $error_number . ' - ' . $error_message;
    }
    return $error;
}
 /**
  * Displays an error message
  *
  * @param integer $pageNumber    ID of the chosen page
  * @param string  $type          Schema Type
  * @param string  $error_message The error mesage
  *
  * @global array    the PMA configuration array
  * @global string   the current database name
  *
  * @access public
  *
  * @return void
  */
 function dieSchema($pageNumber, $type = '', $error_message = '')
 {
     global $db;
     echo "<p><strong>" . __("SCHEMA ERROR: ") . $type . "</strong></p>" . "\n";
     if (!empty($error_message)) {
         $error_message = htmlspecialchars($error_message);
     }
     echo '<p>' . "\n";
     echo '    ' . $error_message . "\n";
     echo '</p>' . "\n";
     echo '<a href="schema_edit.php?' . PMA_generate_common_url($db) . '&do=selectpage&chpage=' . $pageNumber . '&action_choose=0' . '">' . __('Back') . '</a>';
     echo "\n";
     exit;
 }
    echo 'phpMyAdmin';
}
?>
</title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php 
echo $GLOBALS['charset'];
?>
" />
<?php 
if (!empty($GLOBALS['cfg']['PmaAbsoluteUri'])) {
    echo '<base href="' . $GLOBALS['cfg']['PmaAbsoluteUri'] . '" />' . "\n";
}
?>
    <link rel="stylesheet" type="text/css" href="<?php 
echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : './';
?>
css/phpmyadmin.css.php?<?php 
echo PMA_generate_common_url();
?>
&amp;js_frame=<?php 
echo isset($print_view) ? 'print' : 'right';
?>
" />
    <link rel="stylesheet" type="text/css" href="<?php 
echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : './';
?>
css/print.css?<?php 
echo PMA_generate_common_url();
?>
" media="print" />
Beispiel #6
0
 } else {
     $separator = '        <span class="separator"> - </span>' . "\n";
 }
 if ($GLOBALS['cfg']['NavigationBarIconic'] !== true) {
     $item .= '%4$s: ';
 }
 $item .= '%3$s</a>' . "\n";
 echo '<div id="serverinfo">' . "\n";
 printf($item, $GLOBALS['cfg']['DefaultTabServer'], PMA_generate_common_url(), htmlspecialchars($server_info), $GLOBALS['strServer'], 's_host.png');
 if (isset($GLOBALS['db']) && strlen($GLOBALS['db'])) {
     echo $separator;
     printf($item, $GLOBALS['cfg']['DefaultTabDatabase'], PMA_generate_common_url($GLOBALS['db']), htmlspecialchars($GLOBALS['db']), $GLOBALS['strDatabase'], 's_db.png');
     if (isset($GLOBALS['table']) && strlen($GLOBALS['table'])) {
         require_once './libraries/tbl_info.inc.php';
         echo $separator;
         printf($item, $GLOBALS['cfg']['DefaultTabTable'], PMA_generate_common_url($GLOBALS['db'], $GLOBALS['table']), htmlspecialchars($GLOBALS['table']), isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? $GLOBALS['strView'] : $GLOBALS['strTable'], (isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? 'b_views' : 's_tbl') . '.png');
         /**
          * Displays table comment
          * @uses $show_comment from libraries/tbl_info.inc.php
          * @uses $GLOBALS['avoid_show_comment'] from tbl_relation.php
          */
         if (!empty($show_comment) && !isset($GLOBALS['avoid_show_comment'])) {
             if (strstr($show_comment, '; InnoDB free')) {
                 $show_comment = preg_replace('@; InnoDB free:.*?$@', '', $show_comment);
             }
             echo '<span class="table_comment" id="span_table_comment">' . '&quot;' . htmlspecialchars($show_comment) . '&quot;</span>' . "\n";
         }
         // end if
     } else {
         // no table selected, display database comment if present
         /**
Beispiel #7
0
if (PMA_MYSQL_INT_VERSION >= 40101) {
    $db_collation = PMA_getDbCollation($db);
}
?>

<table border="0" cellpadding="2" cellspacing="0">
    <!-- Create a new table -->
        <form method="post" action="tbl_create.php" onsubmit="return (emptyFormElements(this, 'table') && checkFormElementInRange(this, 'num_fields', 1))">
     <tr>
     <td class="tblHeaders" colspan="3" nowrap="nowrap"><?php 
echo PMA_generate_common_hidden_inputs($db);
if ($cfg['PropertiesIconic']) {
    echo '<img src="' . $pmaThemeImage . 'b_newtbl.png" border="0" width="16" height="16" hspace="2" align="middle" />';
}
// if you want navigation:
$strDBLink = '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . PMA_generate_common_url() . '&amp;db=' . urlencode($GLOBALS['db']) . '">' . htmlspecialchars($GLOBALS['db']) . '</a>';
// else use
// $strDBLink = htmlspecialchars($db);
echo '             ' . sprintf($strCreateNewTable, $strDBLink) . ':&nbsp;' . "\n";
echo '     </td></tr>';
echo '     <tr bgcolor="' . $cfg['BgcolorOne'] . '"><td nowrap="nowrap">';
echo '             ' . $strName . ':&nbsp;' . "\n";
echo '     </td>';
echo '     <td nowrap="nowrap">';
echo '             ' . '<input type="text" name="table" maxlength="64" size="30" class="textfield" />';
echo '     </td><td>&nbsp;</td></tr>';
echo '     <tr bgcolor="' . $cfg['BgcolorOne'] . '"><td nowrap="nowrap">';
echo '             ' . $strFields . ':&nbsp;' . "\n";
echo '     </td>';
echo '     <td nowrap="nowrap">';
echo '             ' . '<input type="text" name="num_fields" size="2" class="textfield" />' . "\n";
Beispiel #8
0
    /**
     * Displays a message at the top of the "main" (right) frame
     *
     * @param   string  the message to display
     *
     * @global  array   the configuration array
     *
     * @access  public
     */
    function PMA_showMessage($message)
    {
        global $cfg;
        // Sanitizes $message
        $message = PMA_sanitize($message);
        // Corrects the tooltip text via JS if required
        if (!empty($GLOBALS['table']) && $cfg['ShowTooltip']) {
            $result = PMA_DBI_try_query('SHOW TABLE STATUS FROM ' . PMA_backquote($GLOBALS['db']) . ' LIKE \'' . PMA_sqlAddslashes($GLOBALS['table'], TRUE) . '\'');
            if ($result) {
                $tbl_status = PMA_DBI_fetch_assoc($result);
                $tooltip = empty($tbl_status['Comment']) ? '' : $tbl_status['Comment'] . ' ';
                $tooltip .= '(' . $tbl_status['Rows'] . ' ' . $GLOBALS['strRows'] . ')';
                PMA_DBI_free_result($result);
                $md5_tbl = md5($GLOBALS['table']);
                echo "\n";
                ?>
<script type="text/javascript" language="javascript1.2">
<!--
if (typeof(document.getElementById) != 'undefined'
    && typeof(window.parent.frames['nav']) != 'undefined'
    && typeof(window.parent.frames['nav'].document) != 'undefined' && typeof(window.parent.frames['nav'].document) != 'unknown'
    && (window.parent.frames['nav'].document.getElementById('<?php 
                echo 'tbl_' . $md5_tbl;
                ?>
'))
    && typeof(window.parent.frames['nav'].document.getElementById('<?php 
                echo 'tbl_' . $md5_tbl;
                ?>
')) != 'undefined'
    && typeof(window.parent.frames['nav'].document.getElementById('<?php 
                echo 'tbl_' . $md5_tbl;
                ?>
').title) == 'string') {
    window.parent.frames['nav'].document.getElementById('<?php 
                echo 'tbl_' . $md5_tbl;
                ?>
').title = '<?php 
                echo PMA_jsFormat($tooltip, FALSE);
                ?>
';
}
//-->
</script>
                <?php 
            }
            // end if
        }
        // end if... else if
        // Checks if the table needs to be repaired after a TRUNCATE query.
        if (isset($GLOBALS['table']) && isset($GLOBALS['sql_query']) && $GLOBALS['sql_query'] == 'TRUNCATE TABLE ' . PMA_backquote($GLOBALS['table'])) {
            if (!isset($tbl_status)) {
                $result = @PMA_DBI_try_query('SHOW TABLE STATUS FROM ' . PMA_backquote($GLOBALS['db']) . ' LIKE \'' . PMA_sqlAddslashes($GLOBALS['table'], TRUE) . '\'');
                if ($result) {
                    $tbl_status = PMA_DBI_fetch_assoc($result);
                    PMA_DBI_free_result($result);
                }
            }
            if (isset($tbl_status) && (int) $tbl_status['Index_length'] > 1024) {
                PMA_DBI_try_query('REPAIR TABLE ' . PMA_backquote($GLOBALS['table']));
            }
        }
        unset($tbl_status);
        echo "\n";
        ?>
<br />
<div align="<?php 
        echo $GLOBALS['cell_align_left'];
        ?>
">
    <table border="<?php 
        echo $cfg['Border'];
        ?>
" cellpadding="5" cellspacing="1">
    <tr>
        <th<?php 
        echo $GLOBALS['theme'] != 'original' ? ' class="tblHeaders"' : ' bgcolor="' . $cfg['ThBgcolor'] . '"';
        ?>
>
            <b><?php 
        echo $message;
        ?>
</b>
        </th>
    </tr>
        <?php 
        if ($cfg['ShowSQL'] == TRUE && (!empty($GLOBALS['sql_query']) || !empty($GLOBALS['display_query']))) {
            $local_query = !empty($GLOBALS['display_query']) ? $GLOBALS['display_query'] : ($cfg['SQP']['fmtType'] == 'none' && isset($GLOBALS['unparsed_sql']) && $GLOBALS['unparsed_sql'] != '' ? $GLOBALS['unparsed_sql'] : $GLOBALS['sql_query']);
            // Basic url query part
            $url_qpart = '?' . PMA_generate_common_url(isset($GLOBALS['db']) ? $GLOBALS['db'] : '', isset($GLOBALS['table']) ? $GLOBALS['table'] : '');
            echo "\n";
            ?>
    <tr>
        <td bgcolor="<?php 
            echo $cfg['BgcolorOne'];
            ?>
">
            <?php 
            echo "\n";
            // Html format the query to be displayed
            // The nl2br function isn't used because its result isn't a valid
            // xhtml1.0 statement before php4.0.5 ("<br>" and not "<br />")
            // If we want to show some sql code it is easiest to create it here
            /* SQL-Parser-Analyzer */
            $sqlnr = 1;
            if (!empty($GLOBALS['show_as_php'])) {
                $new_line = '\'<br />' . "\n" . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;. \' ';
            }
            if (isset($new_line)) {
                /* SQL-Parser-Analyzer */
                $query_base = PMA_sqlAddslashes(htmlspecialchars($local_query));
                /* SQL-Parser-Analyzer */
                $query_base = preg_replace("@((\r\n)|(\r)|(\n))+@", $new_line, $query_base);
            } else {
                $query_base = $local_query;
            }
            // Here we append the LIMIT added for navigation, to
            // enable its display. Adding it higher in the code
            // to $local_query would create a problem when
            // using the Refresh or Edit links.
            // Only append it on SELECTs.
            // FIXME: what would be the best to do when someone
            // hits Refresh: use the current LIMITs ?
            // TODO: use the parser instead of preg_match()
            if (preg_match('@^SELECT[[:space:]]+@i', $query_base) && isset($GLOBALS['sql_limit_to_append'])) {
                $query_base .= $GLOBALS['sql_limit_to_append'];
            }
            if (!empty($GLOBALS['show_as_php'])) {
                $query_base = '$sql  = \'' . $query_base;
            } else {
                if (!empty($GLOBALS['validatequery'])) {
                    $query_base = PMA_validateSQL($query_base);
                } else {
                    // avoid reparsing query:
                    if (isset($GLOBALS['parsed_sql']) && $query_base == $GLOBALS['parsed_sql']['raw']) {
                        $parsed_sql = $GLOBALS['parsed_sql'];
                    } else {
                        $parsed_sql = PMA_SQP_parse($query_base);
                    }
                    $query_base = PMA_formatSql($parsed_sql, $query_base);
                }
            }
            // Prepares links that may be displayed to edit/explain the query
            // (don't go to default pages, we must go to the page
            // where the query box is available)
            // (also, I don't see why we should check the goto variable)
            //if (!isset($GLOBALS['goto'])) {
            //$edit_target = (isset($GLOBALS['table'])) ? $cfg['DefaultTabTable'] : $cfg['DefaultTabDatabase'];
            $edit_target = isset($GLOBALS['db']) ? isset($GLOBALS['table']) ? 'tbl_properties.php' : 'db_details.php' : '';
            //} else if ($GLOBALS['goto'] != 'main.php') {
            //    $edit_target = $GLOBALS['goto'];
            //} else {
            //    $edit_target = '';
            //}
            if (isset($cfg['SQLQuery']['Edit']) && $cfg['SQLQuery']['Edit'] == TRUE && !empty($edit_target)) {
                $onclick = '';
                if ($cfg['QueryFrameJS'] && $cfg['QueryFrame']) {
                    $onclick = 'onclick="focus_querywindow(\'' . urlencode($local_query) . '\'); return false;"';
                }
                $edit_link = '&nbsp;[<a href="' . $edit_target . $url_qpart . '&amp;sql_query=' . urlencode($local_query) . '&amp;show_query=1#querybox" ' . $onclick . '>' . $GLOBALS['strEdit'] . '</a>]';
            } else {
                $edit_link = '';
            }
            // Want to have the query explained (Mike Beck 2002-05-22)
            // but only explain a SELECT (that has not been explained)
            /* SQL-Parser-Analyzer */
            if (isset($cfg['SQLQuery']['Explain']) && $cfg['SQLQuery']['Explain'] == TRUE) {
                // Detect if we are validating as well
                // To preserve the validate uRL data
                if (!empty($GLOBALS['validatequery'])) {
                    $explain_link_validate = '&amp;validatequery=1';
                } else {
                    $explain_link_validate = '';
                }
                $explain_link = '&nbsp;[<a href="read_dump.php' . $url_qpart . $explain_link_validate . '&amp;sql_query=';
                if (preg_match('@^SELECT[[:space:]]+@i', $local_query)) {
                    $explain_link .= urlencode('EXPLAIN ' . $local_query) . '">' . $GLOBALS['strExplain'];
                } else {
                    if (preg_match('@^EXPLAIN[[:space:]]+SELECT[[:space:]]+@i', $local_query)) {
                        $explain_link .= urlencode(substr($local_query, 8)) . '">' . $GLOBALS['strNoExplain'];
                    } else {
                        $explain_link = '';
                    }
                }
                if (!empty($explain_link)) {
                    $explain_link .= '</a>]';
                }
            } else {
                $explain_link = '';
            }
            //show explain
            // Also we would like to get the SQL formed in some nice
            // php-code (Mike Beck 2002-05-22)
            if (isset($cfg['SQLQuery']['ShowAsPHP']) && $cfg['SQLQuery']['ShowAsPHP'] == TRUE) {
                $php_link = '&nbsp;[<a href="read_dump.php' . $url_qpart . '&amp;show_query=1' . '&amp;sql_query=' . urlencode($local_query) . '&amp;show_as_php=';
                if (!empty($GLOBALS['show_as_php'])) {
                    $php_link .= '0">' . $GLOBALS['strNoPhp'];
                } else {
                    $php_link .= '1">' . $GLOBALS['strPhp'];
                }
                $php_link .= '</a>]';
                if (isset($GLOBALS['show_as_php']) && $GLOBALS['show_as_php'] == '1') {
                    $php_link .= '&nbsp;[<a href="read_dump.php' . $url_qpart . '&amp;show_query=1' . '&amp;sql_query=' . urlencode($local_query) . '">' . $GLOBALS['strRunQuery'] . '</a>]';
                }
            } else {
                $php_link = '';
            }
            //show as php
            // Refresh query
            if (isset($cfg['SQLQuery']['Refresh']) && $cfg['SQLQuery']['Refresh'] && preg_match('@^(SELECT|SHOW)[[:space:]]+@i', $local_query)) {
                $refresh_link = '&nbsp;[<a href="read_dump.php' . $url_qpart . '&amp;show_query=1' . '&amp;sql_query=' . urlencode($local_query) . '">';
                $refresh_link .= $GLOBALS['strRefresh'];
                $refresh_link .= '</a>]';
            } else {
                $refresh_link = '';
            }
            //show as php
            if (isset($cfg['SQLValidator']['use']) && $cfg['SQLValidator']['use'] == TRUE && isset($cfg['SQLQuery']['Validate']) && $cfg['SQLQuery']['Validate'] == TRUE) {
                $validate_link = '&nbsp;[<a href="read_dump.php' . $url_qpart . '&amp;show_query=1' . '&amp;sql_query=' . urlencode($local_query) . '&amp;validatequery=';
                if (!empty($GLOBALS['validatequery'])) {
                    $validate_link .= '0">' . $GLOBALS['strNoValidateSQL'];
                } else {
                    $validate_link .= '1">' . $GLOBALS['strValidateSQL'];
                }
                $validate_link .= '</a>]';
            } else {
                $validate_link = '';
            }
            //validator
            // Displays the message
            echo '            <b>' . $GLOBALS['strSQLQuery'] . ':</b>&nbsp;';
            echo '<br />' . "\n";
            echo '            ' . $query_base;
            unset($local_query);
            //Clean up the end of the PHP
            if (!empty($GLOBALS['show_as_php'])) {
                echo '\';';
            }
            echo "\n";
            ?>
        </td>
    </tr>
    <?php 
            if (!empty($edit_target)) {
                echo '<tr><td bgcolor="' . $cfg['BgcolorOne'] . '" align="center">';
                echo $edit_link . $explain_link . $php_link . $refresh_link . $validate_link;
                echo '</td></tr>' . "\n";
            }
        }
        echo "\n";
        ?>
    </table>
</div><br />
        <?php 
    }
if (!$is_backup) {
    $header_cells[] = $strIndex;
}
$header_cells[] = '<abbr title="AUTO_INCREMENT">' . ($display_type == 'horizontal' ? 'A_I' : 'AUTO_INCREMENT') . '</abbr>';
require_once './libraries/relation.lib.php';
require_once './libraries/transformations.lib.php';
$cfgRelation = PMA_getRelationsParam();
$comments_map = array();
$mime_map = array();
$available_mime = array();
$comments_map = PMA_getComments($db, $table);
$header_cells[] = $strComments;
if ($cfgRelation['mimework'] && $cfg['BrowseMIME']) {
    $mime_map = PMA_getMIME($db, $table);
    $available_mime = PMA_getAvailableMIMEtypes();
    $hint = '<br />' . sprintf($strMIME_transformation_note, '<a href="transformation_overview.php?' . PMA_generate_common_url($db, $table) . '" target="_blank">', '</a>');
    $header_cells[] = $strMIME_MIMEtype;
    $header_cells[] = $strMIME_transformation;
    $header_cells[] = $strMIME_transformation_options . PMA_showHint($strMIME_transformation_options_note . $hint);
}
// garvin: workaround for field_fulltext, because its submitted indizes contain
//         the index as a value, not a key. Inserted here for easier maintaineance
//         and less code to change in existing files.
if (isset($field_fulltext) && is_array($field_fulltext)) {
    foreach ($field_fulltext as $fulltext_nr => $fulltext_indexkey) {
        $submit_fulltext[$fulltext_indexkey] = $fulltext_indexkey;
    }
}
for ($i = 0; $i < $num_fields; $i++) {
    if (!empty($regenerate)) {
        // An error happened with previous inputs, so we will restore the data
Beispiel #10
0
/**
 * returns html code for db link to default db page
 *
 * @param string $database database
 *
 * @return  string  html link to default db page
 */
function PMA_getDbLink($database = null)
{
    if (!strlen($database)) {
        if (!strlen($GLOBALS['db'])) {
            return '';
        }
        $database = $GLOBALS['db'];
    } else {
        $database = PMA_unescape_mysql_wildcards($database);
    }
    return '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . PMA_generate_common_url($database) . '" title="' . sprintf(__('Jump to database &quot;%s&quot;.'), htmlspecialchars($database)) . '">' . htmlspecialchars($database) . '</a>';
}
 * Gets some core libraries
 */
require_once './libraries/common.lib.php';
/**
 * Handles some variables that may have been sent by the calling script
 * Note: this can be called also from the db panel to get the privileges of
 *       a db, in which case we want to keep displaying the tabs of
 *       the Database panel
 */
if (empty($viewing_mode)) {
    unset($db, $table);
}
/**
 * Set parameters for links
 */
$url_query = PMA_generate_common_url(isset($db) ? $db : '');
/**
 * Defines the urls to return to in case of error in a sql statement
 */
$err_url = 'main.php' . $url_query;
/**
 * Displays the headers
 */
require_once './libraries/header.inc.php';
/**
 * Checks for superuser privileges
 */
$is_superuser = PMA_isSuperuser();
// now, select the mysql db
if ($is_superuser) {
    PMA_DBI_select_db('mysql', $userlink);
/**
 * Prepares the displayable content of a data cell in Browse mode,
 * taking into account foreign key description field and transformations
 *
 * @uses    is_array()
 * @uses    PMA_backquote()
 * @uses    PMA_DBI_try_query()
 * @uses    PMA_DBI_num_rows()
 * @uses    PMA_DBI_fetch_row()
 * @uses    $GLOBALS['strLinkNotFound']
 * @uses    PMA_DBI_free_result()
 * @uses    $GLOBALS['printview']
 * @uses    htmlspecialchars()
 * @uses    PMA_generate_common_url()
 * @param   string  $mouse_events
 * @param   string  $class
 * @param   string  $condition_field
 * @param   string  $analyzed_sql
 * @param   object  $meta   the meta-information about this field
 * @param   string  $map
 * @param   string  $data
 * @param   string  $transform_function
 * @param   string  $default_function
 * @param   string  $nowrap
 * @param   string  $where_comparison
 * @return  string  formatted data
 */
function PMA_prepare_row_data($mouse_events, $class, $condition_field, $analyzed_sql, $meta, $map, $data, $transform_function, $default_function, $nowrap, $where_comparison, $transform_options)
{
    // continue the <td> tag started before calling this function:
    $result = $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) {
                    // this change in the parameter does not matter
                    // outside of the function
                    $meta->name = $true_column;
                }
                // end if
            }
            // end if
        }
        // end foreach
    }
    // end if
    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]) . $where_comparison;
            $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') {
            $result .= ($transform_function != $default_function ? $transform_function($data, $transform_options, $meta) : $transform_function($data, array(), $meta)) . ' <code>[-&gt;' . $dispval . ']</code>';
        } else {
            if ('K' == $_SESSION['tmp_user_values']['relational_display']) {
                // user chose "relational key" in the display options, so
                // the title contains the display field
                $title = !empty($dispval) ? ' title="' . htmlspecialchars($dispval) . '"' : '';
            } else {
                $title = ' title="' . htmlspecialchars($data) . '"';
            }
            $_url_params = array('db' => $map[$meta->name][3], 'table' => $map[$meta->name][0], 'pos' => '0', 'sql_query' => 'SELECT * FROM ' . PMA_backquote($map[$meta->name][3]) . '.' . PMA_backquote($map[$meta->name][0]) . ' WHERE ' . PMA_backquote($map[$meta->name][1]) . $where_comparison);
            $result .= '<a href="sql.php' . PMA_generate_common_url($_url_params) . '"' . $title . '>';
            if ($transform_function != $default_function) {
                // always apply a transformation on the real data,
                // not on the display field
                $result .= $transform_function($data, $transform_options, $meta);
            } else {
                if ('D' == $_SESSION['tmp_user_values']['relational_display']) {
                    // user chose "relational display field" in the
                    // display options, so show display field in the cell
                    $result .= $transform_function($dispval, array(), $meta);
                } else {
                    // otherwise display data in the cell
                    $result .= $transform_function($data, array(), $meta);
                }
            }
            $result .= '</a>';
        }
    } else {
        $result .= $transform_function != $default_function ? $transform_function($data, $transform_options, $meta) : $transform_function($data, array(), $meta);
    }
    $result .= '</td>' . "\n";
    return $result;
}
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php 
echo $charset;
?>
" />
<link rel="icon" href="./favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />
<title><?php 
echo $strSQLResult;
?>
 - phpMyAdmin <?php 
echo PMA_VERSION;
?>
</title>
<link rel="stylesheet" type="text/css" href="phpmyadmin.css.php?<?php 
echo PMA_generate_common_url('', '');
?>
&amp;js_frame=print&amp;nocache=<?php 
echo $_SESSION['PMA_Config']->getThemeUniqueValue();
?>
" />
</style>
</head>

<body bgcolor="#ffffff">
<h1><?php 
echo $strSQLResult;
?>
</h1>
<p>
    <strong><?php 
    $form_param = array_shift($forms_keys);
}
$form_display = new FormDisplay();
foreach ($forms[$form_param] as $form_name => $form) {
    // skip Developer form if no setting is available
    if ($form_name == 'Developer' && !$GLOBALS['cfg']['UserprefsDeveloperTab']) {
        continue;
    }
    $form_display->registerForm($form_name, $form, 1);
}
if (isset($_POST['revert'])) {
    // revert erroneous fields to their default values
    $form_display->fixErrors();
    // redirect
    $url_params = array('form' => $form_param);
    PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . 'prefs_forms.php' . PMA_generate_common_url($url_params, '&'));
    exit;
}
$error = null;
if ($form_display->process(false) && !$form_display->hasErrors()) {
    // save settings
    $old_settings = PMA_load_userprefs();
    $result = PMA_save_userprefs(ConfigFile::getInstance()->getConfigArray());
    if ($result === true) {
        // reload config
        $GLOBALS['PMA_Config']->loadUserPreferences();
        $hash = ltrim(filter_input(INPUT_POST, 'tab_hash'), '#');
        PMA_userprefs_redirect($forms, $old_settings, 'prefs_forms.php', array('form' => $form_param), $hash);
        exit;
    } else {
        $error = $result;
Beispiel #15
0
</th>
    <th class="value"><?php 
    echo $overhead_formatted . ' ' . $overhead_unit;
    ?>
</th>
    <?php 
}
?>
</tr>
</tbody>
</table>

<div class="clearfloat">
<?php 
// Check all tables url
$checkall_url = 'db_structure.php?' . PMA_generate_common_url($db);
?>
<img class="selectallarrow" src="<?php 
echo $pmaThemeImage . 'arrow_' . $text_dir . '.png';
?>
"
    width="38" height="22" alt="<?php 
echo __('With selected:');
?>
" />
<a href="<?php 
echo $checkall_url;
?>
&amp;checkall=1"
    onclick="if (markAllRows('tablesForm')) return false;">
    <?php 
Beispiel #16
0
if (!defined('PHPMYADMIN')) {
    exit;
}
/**
 * Gets some core libraries
 */
require_once './libraries/common.inc.php';
require_once './libraries/bookmark.lib.php';
// Check parameters
PMA_checkParameters(array('db', 'table'));
if (PMA_MYSQL_INT_VERSION >= 50002 && $db === 'information_schema') {
    $db_is_information_schema = true;
} else {
    $db_is_information_schema = false;
}
/**
 * Set parameters for links
 * @deprecated
 */
$url_query = PMA_generate_common_url($db, $table);
$url_params['db'] = $db;
$url_params['table'] = $table;
/**
 * Defines the urls to return to in case of error in a sql statement
 */
$err_url_0 = $cfg['DefaultTabDatabase'] . PMA_generate_common_url(array('db' => $db));
$err_url = $cfg['DefaultTabTable'] . PMA_generate_common_url($url_params);
/**
 * Ensures the database and the table exist (else move to the "parent" script)
 */
require_once './libraries/db_table_exists.lib.php';
Beispiel #17
0
?>
</td>
        <td rowspan="2">
<?php 
echo '            <select name="table_select[]" size="6" multiple="multiple">' . "\n";
foreach ($tables_names_only as $each_table) {
    if (in_array($each_table, $tables_selected)) {
        $is_selected = ' selected="selected"';
    } else {
        $is_selected = '';
    }
    echo '                <option value="' . htmlspecialchars($each_table) . '"' . $is_selected . '>' . str_replace(' ', '&nbsp;', htmlspecialchars($each_table)) . '</option>' . "\n";
}
// end while
echo '            </select>' . "\n";
$alter_select = '<a href="db_search.php' . PMA_generate_common_url(array_merge($url_params, array('selectall' => 1))) . '#db_search"' . ' onclick="setSelectOptions(\'db_search\', \'table_select[]\', true); return false;">' . __('Select All') . '</a>' . '&nbsp;/&nbsp;' . '<a href="db_search.php' . PMA_generate_common_url(array_merge($url_params, array('unselectall' => 1))) . '#db_search"' . ' onclick="setSelectOptions(\'db_search\', \'table_select[]\', false); return false;">' . __('Unselect All') . '</a>';
?>
        </td>
    </tr>
    <tr><td class="right vbottom">
            <?php 
echo $alter_select;
?>
</td>
    </tr>
    <tr><td class="right">
            <?php 
echo __('Inside column:');
?>
</td>
        <td><input type="text" name="field_str" size="60"
<?php

/* $Id: tbl_move_copy.php 9657 2006-11-02 10:51:57Z nijel $ */
// vim: expandtab sw=4 ts=4 sts=4:
/**
 * Gets some core libs
 */
require_once './libs/common.lib.php';
require_once './libs/Table.class.php';
// Check parameters
PMA_checkParameters(array('db', 'table'));
/**
 * Defines the url to return to in case of error in a sql statement
 */
$err_url = 'tbl_sql.php?' . PMA_generate_common_url($db, $table);
/**
 * Selects the database to work with
 */
PMA_DBI_select_db($db);
/**
 * A target table name has been sent to this script -> do the work
 */
if (isset($new_name) && trim($new_name) != '') {
    if ($db == $target_db && $table == $new_name) {
        $message = isset($submit_move) ? $strMoveTableSameNames : $strCopyTableSameNames;
    } else {
        PMA_Table::moveCopy($db, $table, $target_db, $new_name, $what, isset($submit_move), 'one_table');
        $js_to_run = 'functions.js';
        $message = isset($submit_move) ? $strMoveTableOK : $strCopyTableOK;
        $message = sprintf($message, htmlspecialchars($table), htmlspecialchars($new_name));
        $reload = 1;
Beispiel #19
0
            $goto .= '&primary_key[]=' . $pk;
        }
    }
} elseif (isset($after_insert) && $after_insert == 'edit_next') {
    $goto = 'tbl_change.php?' . PMA_generate_common_url($db, $table, '&') . '&goto=' . urlencode($goto) . '&pos=' . $pos . '&session_max_rows=' . $session_max_rows . '&disp_direction=' . $disp_direction . '&repeat_cells=' . $repeat_cells . '&dontlimitchars=' . $dontlimitchars . '&after_insert=' . $after_insert . (empty($sql_query) ? '' : '&sql_query=' . urlencode($sql_query));
    if (isset($primary_key)) {
        foreach ($primary_key as $pk) {
            $local_query = 'SELECT * FROM ' . PMA_backquote($table) . ' WHERE ' . str_replace('` =', '` >', urldecode($pk)) . ' LIMIT 1;';
            $res = PMA_DBI_query($local_query);
            $row = PMA_DBI_fetch_row($res);
            $meta = PMA_DBI_get_fields_meta($res);
            $goto .= '&primary_key[]=' . urlencode(PMA_getUvaCondition($res, count($row), $meta, $row));
        }
    }
} elseif ($goto == 'sql.php') {
    $goto = 'sql.php?' . PMA_generate_common_url($db, $table, '&') . '&pos=' . $pos . '&session_max_rows=' . $session_max_rows . '&disp_direction=' . $disp_direction . '&repeat_cells=' . $repeat_cells . '&dontlimitchars=' . $dontlimitchars . '&sql_query=' . urlencode($sql_query);
} elseif (!empty($goto)) {
    // Security checkings
    $is_gotofile = preg_replace('@^([^?]+).*$@', '\\1', $goto);
    if (!@file_exists('./' . $is_gotofile)) {
        $goto = !isset($table) || !strlen($table) ? 'db_details.php' : 'tbl_properties.php';
        $is_gotofile = TRUE;
    } else {
        $is_gotofile = $is_gotofile == $goto;
    }
}
// Defines the url to return in case of failure of the query
if (isset($err_url)) {
    $err_url = urldecode($err_url);
} else {
    $err_url = str_replace('&', '&amp;', $goto) . (empty($primary_key) ? '' : '&amp;primary_key=' . (is_array($primary_key) ? $primary_key[0] : $primary_key));
Beispiel #20
0
/**
 * Displays operations that are available on results.
 *
 * @param   array   the display mode
 * @param   array   the analyzed query
 *
 * @global  string   $db                the database name
 * @global  string   $table             the table name
 * @global  boolean  $dontlimitchars    whether to limit the number of displayed
 *                                      characters of text type fields or not
 * @global  integer  $pos               the current postion of the first record
 *                                      to be displayed
 * @global  string   $sql_query         the current sql query
 * @global  integer  $unlim_num_rows    the total number of rows returned by the
 *                                      sql query without any programmatically
 *                                      appended "LIMIT" clause
 * @global  string   $disp_direction    the display mode
 *                                      (horizontal/vertical/horizontalflipped)
 * @global  integer  $repeat_cells      the number of row to display between two
 *                                      table headers
 *
 * @access  private
 *
 * @see     PMA_showMessage(), PMA_setDisplayMode(),
 *          PMA_displayTableNavigation(), PMA_displayTableHeaders(),
 *          PMA_displayTableBody(), PMA_displayResultsOperations()
 */
function PMA_displayResultsOperations($the_disp_mode, $analyzed_sql)
{
    global $db, $table, $dontlimitchars, $pos, $sql_query, $unlim_num_rows, $disp_direction, $repeat_cells;
    $header_shown = FALSE;
    $header = '<fieldset><legend>' . $GLOBALS['strQueryResultsOperations'] . '</legend>';
    if ($the_disp_mode[6] == '1' || $the_disp_mode[9] == '1') {
        // Displays "printable view" link if required
        if ($the_disp_mode[9] == '1') {
            if (!$header_shown) {
                echo $header;
                $header_shown = TRUE;
            }
            $url_query = '?' . PMA_generate_common_url($db, $table) . '&amp;pos=' . $pos . '&amp;session_max_rows=' . $GLOBALS['session_max_rows'] . '&amp;disp_direction=' . $disp_direction . '&amp;repeat_cells=' . $repeat_cells . '&amp;printview=1' . '&amp;sql_query=' . urlencode($sql_query);
            echo '    <!-- Print view -->' . "\n";
            echo PMA_linkOrButton('sql.php' . $url_query . (isset($dontlimitchars) && $dontlimitchars == '1' ? '&amp;dontlimitchars=1' : ''), ($GLOBALS['cfg']['PropertiesIconic'] ? '<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_print.png" height="16" width="16" alt="' . $GLOBALS['strPrintView'] . '"/>' : '') . $GLOBALS['strPrintView'], '', true, true, 'print_view') . "\n";
            if (!$dontlimitchars) {
                echo '    &nbsp;&nbsp;' . "\n";
                echo PMA_linkOrButton('sql.php' . $url_query . '&amp;dontlimitchars=1', ($GLOBALS['cfg']['PropertiesIconic'] ? '<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_print.png" height="16" width="16" alt="' . $GLOBALS['strPrintViewFull'] . '"/>' : '') . $GLOBALS['strPrintViewFull'], '', true, true, 'print_view') . "\n";
            }
        }
        // end displays "printable view"
        echo "\n";
    }
    // Export link
    // (the url_query has extra parameters that won't be used to export)
    // (the single_table parameter is used in display_export.lib.php
    //  to hide the SQL and the structure export dialogs)
    if (isset($analyzed_sql[0]) && $analyzed_sql[0]['querytype'] == 'SELECT' && !isset($printview)) {
        if (isset($analyzed_sql[0]['table_ref'][0]['table_true_name']) && !isset($analyzed_sql[0]['table_ref'][1]['table_true_name'])) {
            $single_table = '&amp;single_table=true';
        } else {
            $single_table = '';
        }
        if (!$header_shown) {
            echo $header;
            $header_shown = TRUE;
        }
        echo '    <!-- Export -->' . "\n";
        echo '    &nbsp;&nbsp;' . "\n";
        echo PMA_linkOrButton('tbl_properties_export.php' . $url_query . '&amp;unlim_num_rows=' . $unlim_num_rows . $single_table, ($GLOBALS['cfg']['PropertiesIconic'] ? '<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_tblexport.png" height="16" width="16" alt="' . $GLOBALS['strExport'] . '" />' : '') . $GLOBALS['strExport'], '', true, true, '') . "\n";
    }
    if ($header_shown) {
        echo '</fieldset><br />';
    }
}
        <?php 
        echo $strReferentialIntegrity;
        ?>
<br />
        <?php 
        echo "\n";
        foreach ($foreign as $master => $arr) {
            $join_query = 'SELECT ' . PMA_backquote($GLOBALS['table']) . '.* FROM ' . PMA_backquote($GLOBALS['table']) . ' LEFT JOIN ' . PMA_backquote($arr['foreign_table']);
            if ($arr['foreign_table'] == $GLOBALS['table']) {
                $foreign_table = $GLOBALS['table'] . '1';
                $join_query .= ' AS ' . PMA_backquote($foreign_table);
            } else {
                $foreign_table = $arr['foreign_table'];
            }
            $join_query .= ' ON ' . PMA_backquote($GLOBALS['table']) . '.' . PMA_backquote($master) . ' = ' . PMA_backquote($foreign_table) . '.' . PMA_backquote($arr['foreign_field']) . ' WHERE ' . PMA_backquote($foreign_table) . '.' . PMA_backquote($arr['foreign_field']) . ' IS NULL AND ' . PMA_backquote($GLOBALS['table']) . '.' . PMA_backquote($master) . ' IS NOT NULL';
            $this_url_params = array_merge($url_params, array('sql_query' => $join_query));
            echo '        <li>' . '<a href="sql.php' . PMA_generate_common_url($this_url_params) . '">' . $master . '&nbsp;->&nbsp;' . $arr['foreign_table'] . '.' . $arr['foreign_field'] . '</a></li>' . "\n";
        }
        //  foreach $foreign
        unset($foreign_table, $join_query);
        ?>
    </ul>
        <?php 
    }
    // end if ($result)
}
// end  if (!empty($cfg['Server']['relation']))
/**
 * Displays the footer
 */
require_once './libraries/footer.inc.php';
/**
 * Get some core libs
 */
require_once './libs/common.lib.php';
require_once './libs/Table.class.php';
$js_to_run = 'functions.js';
if (isset($table)) {
    $table = PMA_sanitize($table);
}
require_once './libs/header.inc.php';
// Check parameters
PMA_checkParameters(array('db', 'table'));
/**
 * Defines the url to return to in case of error in a sql statement
 */
$err_url = $cfg['DefaultTabTable'] . '?' . PMA_generate_common_url($db, $table);
/**
 * Selects the database to work with
 */
PMA_DBI_select_db($db);
/**
 * The form used to define the structure of the table has been submitted
 */
$abort = false;
if (isset($submit_num_fields)) {
    $regenerate = true;
    $num_fields = $orig_num_fields + $added_fields;
} elseif (isset($do_save_data)) {
    $sql_query = $query_cpy = '';
    // Transforms the radio button field_key into 3 arrays
    $field_cnt = count($field_name);
        echo '<input type="hidden" name="dbname" value="' . htmlspecialchars($dbname) . '" />' . "\n";
        echo '<br />' . "\n";
    }

    echo '</fieldset>' . "\n";
    PMA_displayPrivTable('*', '*', false);
    echo '    <fieldset id="fieldset_add_user_footer" class="tblFooters">' . "\n"
       . '        <input type="submit" name="adduser_submit" value="' . __('Go') . '" />' . "\n"
       . '    </fieldset>' . "\n"
       . '</form>' . "\n";
} else {
    // check the privileges for a particular database.
    $user_form = '<form id="usersForm" action="server_privileges.php"><fieldset>' . "\n"
       . '<legend>' . "\n"
       . PMA_getIcon('b_usrcheck.png')
       . '    ' . sprintf(__('Users having access to &quot;%s&quot;'), '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . PMA_generate_common_url($checkprivs) . '">' .  htmlspecialchars($checkprivs) . '</a>') . "\n"
       . '</legend>' . "\n"
       . '<table id="dbspecificuserrights" class="data">' . "\n"
       . '<thead>' . "\n"
       . '    <tr><th>' . __('User') . '</th>' . "\n"
       . '        <th>' . __('Host') . '</th>' . "\n"
       . '        <th>' . __('Type') . '</th>' . "\n"
       . '        <th>' . __('Privileges') . '</th>' . "\n"
       . '        <th>' . __('Grant') . '</th>' . "\n"
       . '        <th>' . __('Action') . '</th>' . "\n"
       . '    </tr>' . "\n"
       . '</thead>' . "\n"
       . '<tbody>' . "\n";
    $odd_row = true;
    unset($row, $row1, $row2);
Beispiel #24
0
require_once './libraries/grab_globals.lib.php';
require_once './libraries/common.lib.php';
if (!isset($db)) {
    $db = '';
}
/**
 * Increases the max. allowed time to run a script
 */
@set_time_limit($cfg['ExecTimeLimit']);
/**
 * Defines the url to return to in case of error in a sql statement
 */
if (!isset($goto) || !preg_match('@^(db_details|tbl_properties)(_[a-z]*)?\\.php$@i', $goto)) {
    $goto = 'db_details.php';
}
$err_url = $goto . '?' . PMA_generate_common_url($db) . (preg_match('@^tbl_properties(_[a-z]*)?\\.php$@', $goto) ? '&amp;table=' . urlencode($table) : '');
/**
 * Set up default values for some variables
 */
$view_bookmark = 0;
$sql_bookmark = isset($sql_bookmark) ? $sql_bookmark : '';
$sql_query = isset($sql_query) ? $sql_query : '';
if (!empty($sql_localfile) && !empty($cfg['UploadDir'])) {
    if (substr($cfg['UploadDir'], -1) != '/') {
        $cfg['UploadDir'] .= '/';
    }
    $sql_file = $cfg['UploadDir'] . $sql_localfile;
} else {
    if (empty($sql_file)) {
        $sql_file = 'none';
    }
                <?php 
echo PMA_generate_common_hidden_inputs($db, $table);
?>
                <input type="hidden" name="reload" value="1" />
                <input type="hidden" name="what" value="data" />
            </th>
        </tr>
        <tr>
            <td bgcolor="<?php 
echo $cfg['BgcolorOne'];
?>
" nowrap="nowrap">
                <select name="target_db">
<?php 
// The function used below is defined in "common.lib.php"
PMA_availableDatabases('main.php?' . PMA_generate_common_url());
for ($i = 0; $i < $num_dbs; $i++) {
    echo '                            ';
    echo '<option value="' . htmlspecialchars($dblist[$i]) . '">' . htmlspecialchars($dblist[$i]) . '</option>';
    echo "\n";
}
// end for
?>
                </select>
                &nbsp;<b>.</b>&nbsp;
                <input type="text" size="20" name="new_name" value="<?php 
echo htmlspecialchars($table);
?>
" class="textfield" onfocus="this.select()" />
            </td>
            <td align="<?php 
 if ($is_backup) {
     $_form_params['field_length_orig[' . $i . ']'] = $length;
 }
 // column length
 if (isset($extracted_fieldspec) && ('set' == $extracted_fieldspec['type'] || 'enum' == $extracted_fieldspec['type'])) {
     $binary = 0;
     $unsigned = 0;
     $zerofill = 0;
 } else {
     $binary = false;
     $unsigned = stristr($row['Type'], 'unsigned');
     $zerofill = stristr($row['Type'], 'zerofill');
 }
 $length_to_display = $length;
 $content_cells[$i][$ci] = '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '"' . ' type="text" name="field_length[' . $i . ']" size="' . $length_values_input_size . '"' . ' value="' . htmlspecialchars($length_to_display) . '"' . ' class="textfield" />' . '<p class="enum_notice" id="enum_notice_' . $i . '_' . ($ci - $ci_offset) . '">';
 $content_cells[$i][$ci] .= __('ENUM or SET data too long?') . '<a onclick="return false;" href="enum_editor.php?' . PMA_generate_common_url() . '&amp;values=' . urlencode($length_to_display) . '&amp;field=' . (isset($row['Field']) ? urlencode($row['Field']) : "") . '" class="open_enum_editor" target="_blank"> ' . __('Get more editing space') . '</a></p>';
 $ci++;
 // column default
 /**
 * having NULL enabled does not implicit having Default with NULL
 *
     if (isset($row)
  && !isset($row['Default']) && isset($row['Null']) && $row['Null'] == 'YES') {
    $row['Default'] = 'NULL';
     }
 */
 // old column default
 if ($is_backup) {
     $_form_params['field_default_orig[' . $i . ']'] = isset($row['Default']) ? $row['Default'] : '';
 }
 // here we put 'NONE' as the default value of drop-down; otherwise
    $response->addJSON('field_type', $properties['type']);
    $response->addJSON('field_collation', $properties['collation']);
    $response->addJSON('field_operators', $properties['func']);
    $response->addJSON('field_value', $properties['value']);
    exit;
}
// Gets some core libraries
require_once './libraries/tbl_common.inc.php';
$url_query .= '&amp;goto=tbl_select.php&amp;back=tbl_select.php';
// Gets tables informations
require_once './libraries/tbl_info.inc.php';
if (!isset($goto)) {
    $goto = $GLOBALS['cfg']['DefaultTabTable'];
}
// Defines the url to return to in case of error in the next sql statement
$err_url = $goto . '?' . PMA_generate_common_url($db, $table);
//Set default datalabel if not selected
if (!isset($_POST['zoom_submit']) || $_POST['dataLabel'] == '') {
    $dataLabel = PMA_getDisplayField($db, $table);
}
// Displays the zoom search form
$response->addHTML($table_search->getSelectionForm($goto, $dataLabel));
/*
 * Handle the input criteria and generate the query result
 * Form for displaying query results
 */
if (isset($zoom_submit) && $_POST['criteriaColumnNames'][0] != 'pma_null' && $_POST['criteriaColumnNames'][1] != 'pma_null' && $_POST['criteriaColumnNames'][0] != $_POST['criteriaColumnNames'][1]) {
    //Query generation part
    $sql_query = $table_search->buildSqlQuery();
    $sql_query .= ' LIMIT ' . $maxPlotLimit;
    //Query execution part
Beispiel #28
0
 if ($GLOBALS['cfg']['NavigationBarIconic'] !== true) {
     $item .= '%4$s: ';
 }
 $item .= '%3$s</a>' . "\n";
 echo '<div id="serverinfo">' . "\n";
 printf($item, $GLOBALS['cfg']['DefaultTabServer'], PMA_generate_common_url(), htmlspecialchars($server_info), __('Server'), 's_host.png');
 if (strlen($GLOBALS['db'])) {
     echo $separator;
     printf($item, $GLOBALS['cfg']['DefaultTabDatabase'], PMA_generate_common_url($GLOBALS['db']), htmlspecialchars($GLOBALS['db']), __('Database'), 's_db.png');
     // if the table is being dropped, $_REQUEST['purge'] is set
     // (it always contains "1")
     // so do not display the table name in upper div
     if (strlen($GLOBALS['table']) && !isset($_REQUEST['purge'])) {
         require_once './libraries/tbl_info.inc.php';
         echo $separator;
         printf($item, $GLOBALS['cfg']['DefaultTabTable'], PMA_generate_common_url($GLOBALS['db'], $GLOBALS['table']), str_replace(' ', '&nbsp;', htmlspecialchars($GLOBALS['table'])), isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? __('View') : __('Table'), (isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? 'b_views' : 's_tbl') . '.png');
         /**
          * Displays table comment
          * @uses $show_comment from libraries/tbl_info.inc.php
          * @uses $GLOBALS['avoid_show_comment'] from tbl_relation.php
          */
         if (!empty($show_comment) && !isset($GLOBALS['avoid_show_comment'])) {
             if (strstr($show_comment, '; InnoDB free')) {
                 $show_comment = preg_replace('@; InnoDB free:.*?$@', '', $show_comment);
             }
             echo '<span class="table_comment" id="span_table_comment">' . '&quot;' . htmlspecialchars($show_comment) . '&quot;</span>' . "\n";
         }
         // end if
     } else {
         // no table selected, display database comment if present
         /**
Beispiel #29
0
 /**
  * prints out the preview for this theme
  *
  * @uses    $this->getName()
  * @uses    $this->getVersion()
  * @uses    $this->getId()
  * @uses    $this->getPath()
  * @uses    $GLOBALS['strThemeNoPreviewAvailable']
  * @uses    $GLOBALS['strTakeIt']
  * @uses    PMA_generate_common_url()
  * @uses    addslashes()
  * @uses    file_exists()
  * @uses    htmlspecialchars()
  */
 function printPreview()
 {
     echo '<div class="theme_preview">';
     echo '<h2>' . htmlspecialchars($this->getName()) . ' (' . htmlspecialchars($this->getVersion()) . ')</h2>' . '<p>' . '<a target="_top" href="index.php' . PMA_generate_common_url(array('set_theme' => $this->getId())) . '"' . ' onclick="takeThis(\'' . addslashes($this->getId()) . '\');' . ' return false;">';
     if (@file_exists($this->getPath() . '/screen.png')) {
         // if screen exists then output
         echo '<img src="' . $this->getPath() . '/screen.png" border="1"' . ' alt="' . htmlspecialchars($this->getName()) . '"' . ' title="' . htmlspecialchars($this->getName()) . '" /><br />';
     } else {
         echo $GLOBALS['strThemeNoPreviewAvailable'];
     }
     echo '[ <strong>' . $GLOBALS['strTakeIt'] . '</strong> ]</a>' . '</p>' . '</div>';
 }
    // Not a valid db name -> back to the welcome page
    if (strlen($db)) {
        $is_db = PMA_DBI_select_db($db);
    }
    if (! strlen($db) || !$is_db) {
        PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . 'main.php?' . PMA_generate_common_url('', '', '&') . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1');
        exit;
    }
} // end if (ensures db exists)

/**
 * Changes database charset if requested by the user
 */
if (isset($submitcollation) && !empty($db_collation)) {
    list($db_charset) = explode('_', $db_collation);
    $sql_query        = 'ALTER DATABASE ' . PMA_backquote($db) . ' DEFAULT' . PMA_generateCharsetQueryPart($db_collation);
    $result           = PMA_DBI_query($sql_query);
    $message          = PMA_Message::success();
    unset($db_charset, $db_collation);
}

$GLOBALS['js_include'][] = 'functions.js';
require_once './libraries/header.inc.php';

/**
 * Set parameters for links
 */
$url_query = PMA_generate_common_url($db);

?>