Example #1
0
} else {
    $num_rows = 0;
}

if (empty($_REQUEST['dontlimitchars'])) {
    $dontlimitchars = false;
} else {
    $dontlimitchars = true;
    $url_params['dontlimitchars'] = 1;
}

/**
 * Displays the sub-page heading
 */
echo '<h2>' . "\n"
   . PMA_getImage('s_tbl.png')
   . '    ' . __('Binary log') . "\n"
   . '</h2>' . "\n";

/**
 * Display log selector.
 */
if (count($binary_logs) > 1) {
    echo '<form action="server_binlog.php" method="get">';
    echo PMA_generate_common_hidden_inputs($url_params);
    echo '<fieldset><legend>';
    echo __('Select binary log to view');
    echo '</legend><select name="log">';
    $full_size = 0;
    foreach ($binary_logs as $each_log) {
        echo '<option value="' . $each_log['Log_name'] . '"';
} elseif (!isset($cfg['Export']['method'])) {
    $cfg['Export']['method'] = 'quick';
}
// The export method (quick, custom or custom-no-form)
echo '<input type="hidden" name="export_method" value="' . htmlspecialchars($cfg['Export']['method']) . '" />';
if (isset($_GET['sql_query'])) {
    echo '<input type="hidden" name="sql_query" value="' . htmlspecialchars($_GET['sql_query']) . '" />' . "\n";
} elseif (!empty($sql_query)) {
    echo '<input type="hidden" name="sql_query" value="' . htmlspecialchars($sql_query) . '" />' . "\n";
}
?>

<div class="exportoptions" id="header">
    <h2>
        <?php 
echo PMA_getImage('b_export.png', __('Export'));
?>
        <?php 
if ($export_type == 'server') {
    echo __('Exporting databases from the current server');
} elseif ($export_type == 'database') {
    printf(__('Exporting tables from "%s" database'), htmlspecialchars($db));
} else {
    printf(__('Exporting rows from "%s" table'), htmlspecialchars($table));
}
?>
    </h2>
</div>

<div class="exportoptions" id="quick_or_custom">
    <h3><?php 
Example #3
0
/**
 * Creates one row for the parameter table used in the routine editor.
 *
 * @param   array    $routine    Data for the routine returned by
 *                               PMA_RTN_getDataFromRequest() or
 *                               PMA_RTN_getDataFromName()
 * @param   mixed    $index      Either a numeric index of the row being processed
 *                               or NULL to create a template row for AJAX request
 * @param   string   $class      Class used to hide the direction column, if the
 *                               row is for a stored function.
 *
 * @return    string    HTML code of one row of parameter table for the editor.
 */
function PMA_RTN_getParameterRow($routine = array(), $index = null, $class = '')
{
    global $param_directions, $param_opts_num, $titles;
    if ($index === null) {
        // template row for AJAX request
        $i = 0;
        $index = '%s';
        $drop_class = '';
        $routine = array('item_param_dir' => array(0 => ''), 'item_param_name' => array(0 => ''), 'item_param_type' => array(0 => ''), 'item_param_length' => array(0 => ''), 'item_param_opts_num' => array(0 => ''), 'item_param_opts_text' => array(0 => ''));
    } else {
        if (!empty($routine)) {
            // regular row for routine editor
            $drop_class = ' hide';
            $i = $index;
        } else {
            // No input data. This shouldn't happen,
            // but better be safe than sorry.
            return '';
        }
    }
    // Create the output
    $retval = "";
    $retval .= "        <tr>\n";
    $retval .= "            <td class='routine_direction_cell{$class}'>\n";
    $retval .= "                <select name='item_param_dir[{$index}]'>\n";
    foreach ($param_directions as $key => $value) {
        $selected = "";
        if (!empty($routine['item_param_dir'][$i]) && $routine['item_param_dir'][$i] == $value) {
            $selected = " selected='selected'";
        }
        $retval .= "                    <option{$selected}>{$value}</option>\n";
    }
    $retval .= "                </select>\n";
    $retval .= "            </td>\n";
    $retval .= "            <td><input name='item_param_name[{$index}]' type='text'\n";
    $retval .= "                       value='{$routine['item_param_name'][$i]}' /></td>\n";
    $retval .= "            <td><select name='item_param_type[{$index}]'>";
    $retval .= PMA_getSupportedDatatypes(true, $routine['item_param_type'][$i]) . "\n";
    $retval .= "            </select></td>\n";
    $retval .= "            <td>\n";
    $retval .= "                <input id='item_param_length_{$index}'\n";
    $retval .= "                       name='item_param_length[{$index}]' type='text'\n";
    $retval .= "                       value='{$routine['item_param_length'][$i]}' />\n";
    $retval .= "                <div class='enum_hint'>\n";
    $retval .= "                    <a class='open_enum_editor' target='_blank'\n";
    $retval .= "                       href='enum_editor.php?" . PMA_generate_common_url() . "&amp;values=" . $routine['item_param_length'][$i] . "&amp;field=" . $routine['item_param_name'][$i] . "'>\n";
    $retval .= "                        " . PMA_getImage('b_edit', '', array('title' => __('ENUM/SET editor'))) . "\n";
    $retval .= "                    </a>\n";
    $retval .= "                </div>\n";
    $retval .= "            </td>\n";
    $retval .= "            <td class='hide no_len'>---</td>\n";
    $retval .= "            <td class='routine_param_opts_text'>\n";
    $retval .= PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_CHARSET, "item_param_opts_text[{$index}]", null, $routine['item_param_opts_text'][$i]);
    $retval .= "            </td>\n";
    $retval .= "            <td class='hide no_opts'>---</td>\n";
    $retval .= "            <td class='routine_param_opts_num'>\n";
    $retval .= "                <select name='item_param_opts_num[{$index}]'>\n";
    $retval .= "                    <option value=''></option>";
    foreach ($param_opts_num as $key => $value) {
        $selected = "";
        if (!empty($routine['item_param_opts_num'][$i]) && $routine['item_param_opts_num'][$i] == $value) {
            $selected = " selected='selected'";
        }
        $retval .= "<option{$selected}>{$value}</option>";
    }
    $retval .= "\n                </select>\n";
    $retval .= "            </td>\n";
    $retval .= "            <td class='routine_param_remove{$drop_class}'>\n";
    $retval .= "                <a href='#' class='routine_param_remove_anchor'>\n";
    $retval .= "                    {$titles['Drop']}\n";
    $retval .= "                </a>\n";
    $retval .= "            </td>\n";
    $retval .= "        </tr>\n";
    return $retval;
}
Example #4
0
function printMonitor()
{
    global $server_status, $server_db_isLocal;
    ?>
    <div class="tabLinks" style="display:none;">
        <a href="#pauseCharts">
            <?php 
    echo PMA_getImage('play.png');
    ?>
            <?php 
    echo __('Start Monitor');
    ?>
        </a>
        <a href="#settingsPopup" rel="popupLink" style="display:none;">
            <?php 
    echo PMA_getImage('s_cog.png');
    ?>
            <?php 
    echo __('Settings');
    ?>
        </a>
        <?php 
    if (!PMA_DRIZZLE) {
        ?>
        <a href="#monitorInstructionsDialog">
            <?php 
        echo PMA_getImage('b_help.png');
        ?>
            <?php 
        echo __('Instructions/Setup');
        ?>
        </a>
        <?php 
    }
    ?>
        <a href="#endChartEditMode" style="display:none;">
            <?php 
    echo PMA_getImage('s_okay.png');
    ?>
            <?php 
    echo __('Done rearranging/editing charts');
    ?>
        </a>
    </div>

    <div class="popupContent settingsPopup">
        <a href="#addNewChart">
            <?php 
    echo PMA_getImage('b_chart.png');
    ?>
            <?php 
    echo __('Add chart');
    ?>
        </a>
        <a href="#rearrangeCharts"><?php 
    echo PMA_getImage('b_tblops.png');
    echo __('Rearrange/edit charts');
    ?>
</a>
        <div class="clearfloat paddingtop"></div>
        <div class="floatleft">
            <?php 
    echo __('Refresh rate') . '<br />';
    refreshList('gridChartRefresh', 5, array(2, 3, 4, 5, 10, 20, 40, 60, 120, 300, 600, 1200));
    ?>
<br />
        </div>
        <div class="floatleft">
            <?php 
    echo __('Chart columns');
    ?>
 <br />
            <select name="chartColumns">
                <option>1</option>
                <option>2</option>
                <option>3</option>
                <option>4</option>
                <option>5</option>
                <option>6</option>
                <option>7</option>
                <option>8</option>
                <option>9</option>
                <option>10</option>
            </select>
        </div>

        <div class="clearfloat paddingtop">
        <b><?php 
    echo __('Chart arrangement');
    ?>
</b> <?php 
    echo PMA_showHint(__('The arrangement of the charts is stored to the browsers local storage. You may want to export it if you have a complicated set up.'));
    ?>
<br/>
        <a href="#importMonitorConfig"><?php 
    echo __('Import');
    ?>
</a>&nbsp;&nbsp;<a href="#exportMonitorConfig"><?php 
    echo __('Export');
    ?>
</a>&nbsp;&nbsp;<a href="#clearMonitorConfig"><?php 
    echo __('Reset to default');
    ?>
</a>
        </div>
    </div>

    <div id="monitorInstructionsDialog" title="<?php 
    echo __('Monitor Instructions');
    ?>
" style="display:none;">
        <?php 
    echo __('The phpMyAdmin Monitor can assist you in optimizing the server configuration and track down time intensive queries. For the latter you will need to set log_output to \'TABLE\' and have either the slow_query_log or general_log enabled. Note however, that the general_log produces a lot of data and increases server load by up to 15%');
    ?>
    <?php 
    if (PMA_MYSQL_INT_VERSION < 50106) {
        ?>
        <p>
        <?php 
        echo PMA_getImage('s_attention.png');
        ?>
        <?php 
        echo __('Unfortunately your Database server does not support logging to table, which is a requirement for analyzing the database logs with phpMyAdmin. Logging to table is supported by MySQL 5.1.6 and onwards. You may still use the server charting features however.');
        ?>
        </p>
    <?php 
    } else {
        ?>
        <p></p>
        <img class="ajaxIcon" src="<?php 
        echo $GLOBALS['pmaThemeImage'];
        ?>
ajax_clock_small.gif" alt="Loading" />
        <div class="ajaxContent"></div>
        <div class="monitorUse" style="display:none;">
            <p></p>
            <?php 
        echo '<strong>';
        echo __('Using the monitor:');
        echo '</strong><p>';
        echo __('Your browser will refresh all displayed charts in a regular interval. You may add charts and change the refresh rate under \'Settings\', or remove any chart using the cog icon on each respective chart.');
        echo '</p><p>';
        echo __('To display queries from the logs, select the relevant time span on any chart by holding down the left mouse button and panning over the chart. Once confirmed, this will load a table of grouped queries, there you may click on any occuring SELECT statements to further analyze them.');
        echo '</p>';
        ?>
            <p>
            <?php 
        echo PMA_getImage('s_attention.png');
        ?>
            <?php 
        echo '<strong>';
        echo __('Please note:');
        echo '</strong><br />';
        echo __('Enabling the general_log may increase the server load by 5-15%. Also be aware that generating statistics from the logs is a load intensive task, so it is advisable to select only a small time span and to disable the general_log and empty its table once monitoring is not required any more.');
        ?>
            </p>
        </div>
    <?php 
    }
    ?>
    </div>

    <div id="addChartDialog" title="<?php 
    echo __('Add chart');
    ?>
" style="display:none;">
        <div id="tabGridVariables">
            <p><input type="text" name="chartTitle" value="<?php 
    echo __('Chart Title');
    ?>
" /></p>

            <input type="radio" name="chartType" value="preset" id="chartPreset" />
            <label for="chartPreset"><?php 
    echo __('Preset chart');
    ?>
</label>
            <select name="presetCharts"></select><br/>

            <input type="radio" name="chartType" value="variable" id="chartStatusVar" checked="checked" />
            <label for="chartStatusVar"><?php 
    echo __('Status variable(s)');
    ?>
</label><br/>
            <div id="chartVariableSettings">
                <label for="chartSeries"><?php 
    echo __('Select series:');
    ?>
</label><br />
                <select id="chartSeries" name="varChartList" size="1">
                    <option><?php 
    echo __('Commonly monitored');
    ?>
</option>
                    <option>Processes</option>
                    <option>Questions</option>
                    <option>Connections</option>
                    <option>Bytes_sent</option>
                    <option>Bytes_received</option>
                    <option>Threads_connected</option>
                    <option>Created_tmp_disk_tables</option>
                    <option>Handler_read_first</option>
                    <option>Innodb_buffer_pool_wait_free</option>
                    <option>Key_reads</option>
                    <option>Open_tables</option>
                    <option>Select_full_join</option>
                    <option>Slow_queries</option>
                </select><br />
                <label for="variableInput"><?php 
    echo __('or type variable name:');
    ?>
 </label>
                <input type="text" name="variableInput" id="variableInput" />
                <p></p>
                <input type="checkbox" name="differentialValue" id="differentialValue" value="differential" checked="checked" />
                <label for="differentialValue"><?php 
    echo __('Display as differential value');
    ?>
</label><br />
                <input type="checkbox" id="useDivisor" name="useDivisor" value="1" />
                <label for="useDivisor"><?php 
    echo __('Apply a divisor');
    ?>
</label>
                <span class="divisorInput" style="display:none;">
                    <input type="text" name="valueDivisor" size="4" value="1" />
                    (<a href="#kibDivisor"><?php 
    echo __('KiB');
    ?>
</a>, <a href="#mibDivisor"><?php 
    echo __('MiB');
    ?>
</a>)
                </span><br />

                <input type="checkbox" id="useUnit" name="useUnit" value="1" />
                <label for="useUnit"><?php 
    echo __('Append unit to data values');
    ?>
</label>

                <span class="unitInput" style="display:none;">
                    <input type="text" name="valueUnit" size="4" value="" />
                </span>
                <p>
                    <a href="#submitAddSeries"><b><?php 
    echo __('Add this series');
    ?>
</b></a>
                    <span id="clearSeriesLink" style="display:none;">
                       | <a href="#submitClearSeries"><?php 
    echo __('Clear series');
    ?>
</a>
                    </span>
                </p>
                <?php 
    echo __('Series in Chart:');
    ?>
<br/>
                <span id="seriesPreview">
                <i><?php 
    echo __('None');
    ?>
</i>
                </span>
            </div>
        </div>
    </div>

    <!-- For generic use -->
    <div id="emptyDialog" title="Dialog" style="display:none;">
    </div>

    <?php 
    if (!PMA_DRIZZLE) {
        ?>
    <div id="logAnalyseDialog" title="<?php 
        echo __('Log statistics');
        ?>
" style="display:none;">
        <p> <?php 
        echo __('Selected time range:');
        ?>
        <input type="text" name="dateStart" class="datetimefield" value="" /> -
        <input type="text" name="dateEnd" class="datetimefield" value="" /></p>
        <input type="checkbox" id="limitTypes" value="1" checked="checked" />
        <label for="limitTypes">
            <?php 
        echo __('Only retrieve SELECT,INSERT,UPDATE and DELETE Statements');
        ?>
        </label>
        <br/>
        <input type="checkbox" id="removeVariables" value="1" checked="checked" />
        <label for="removeVariables">
            <?php 
        echo __('Remove variable data in INSERT statements for better grouping');
        ?>
        </label>

        <?php 
        echo '<p>';
        echo __('Choose from which log you want the statistics to be generated from.');
        echo '</p><p>';
        echo __('Results are grouped by query text.');
        echo '</p>';
        ?>
    </div>

    <div id="queryAnalyzerDialog" title="<?php 
        echo __('Query analyzer');
        ?>
" style="display:none;">
        <textarea id="sqlquery"> </textarea>
        <p></p>
        <div class="placeHolder"></div>
    </div>
    <?php 
    }
    ?>

    <table border="0" class="clearfloat" id="chartGrid">

    </table>
    <div id="logTable">
        <br/>
    </div>

    <script type="text/javascript">
        variableNames = [ <?php 
    $i = 0;
    foreach ($server_status as $name => $value) {
        if (is_numeric($value)) {
            if ($i++ > 0) {
                echo ", ";
            }
            echo "'" . $name . "'";
        }
    }
    ?>
 ];
    </script>
<?php 
}
                json_encode(
                    array(
                        'success' => false,
                        'error' => __('Setting variable failed')
                    )
                )
            );
            break;
        }
    }
}

/**
 * Displays the sub-page heading
 */
echo '<h2>' . PMA_getImage('s_vars.png')
   . '' . __('Server variables and settings') . "\n"
   . PMA_showMySQLDocu('server_system_variables', 'server_system_variables')
   . '</h2>' . "\n";

/**
 * Sends the queries and buffers the results
 */
$serverVarsSession = PMA_DBI_fetch_result('SHOW SESSION VARIABLES;', 0, 1);
$serverVars = PMA_DBI_fetch_result('SHOW GLOBAL VARIABLES;', 0, 1);


/**
 * Displays the page
 */
?>
Example #6
0
                </td><td>
                    <input type="submit" class="submit" name="add_field" value="<?php 
echo __('Add a value');
?>
" />
                </td></tr>
            </table>
        </div>
        <hr class='enum_editor_no_js' />
        <div id="enum_editor_output">
        <h3><?php 
echo __('Output');
?>
</h3>
        <p><?php 
echo PMA_getImage('s_info.png') . __('Copy and paste the joined values into the "Length/Values" field');
?>
</p>
            <?php 
// Escape quotes and slashes for usage with MySQL
foreach ($values as $key => $value) {
    $values[$key] = "'";
    $values[$key] .= str_replace(array("'", "\\", "&#39;", "&#92;"), array("''", '\\\\', "''", '\\\\'), $value);
    $values[$key] .= "'";
}
// Print out the values as a string
?>
            <textarea id="joined_values" cols="95" rows="5"><?php 
echo join(",", $values);
?>
</textarea>
" />
    <?php 
if ($import_type == 'server') {
    echo PMA_generate_common_hidden_inputs('', '', 1);
} elseif ($import_type == 'database') {
    echo PMA_generate_common_hidden_inputs($db, '', 1);
} else {
    echo PMA_generate_common_hidden_inputs($db, $table, 1);
}
echo '    <input type="hidden" name="import_type" value="' . $import_type . '" />' . "\n";
?>

    <div class="exportoptions" id="header">
        <h2>
            <?php 
echo PMA_getImage('b_import.png', __('Import'));
?>
            <?php 
if ($import_type == 'server') {
    echo __('Importing into the current server');
} elseif ($import_type == 'database') {
    printf(__('Importing into the database "%s"'), htmlspecialchars($db));
} else {
    printf(__('Importing into the table "%s"'), htmlspecialchars($table));
}
?>
        </h2>
    </div>

    <div class="importoptions">
        <h3><?php 
}
/**
 *
 */
require_once './libraries/check_user_privileges.lib.php';
$is_create_table_priv = true;
?>
    <form id="create_table_form_minimal" method="post" action="tbl_create.php"<?php 
echo $GLOBALS['cfg']['AjaxEnable'] ? ' class="ajax"' : '';
?>
>
<fieldset>
    <legend>
<?php 
if ($GLOBALS['cfg']['PropertiesIconic']) {
    echo PMA_getImage('b_newtbl.png');
}
echo __('Create table');
?>
    </legend>
    <?php 
echo PMA_generate_common_hidden_inputs($db);
?>
    <div class="formelement">
        <?php 
echo __('Name');
?>
:
        <input type="text" name="table" maxlength="64" size="30" />
    </div>
    <div class="formelement">
Example #9
0
        <th><?php 
    echo __('Action');
    ?>
</th>
        <th><?php 
    echo __('Show');
    ?>
</th>
    </tr>
    </thead>
    <tbody>
    <?php 
    // Print out information about versions
    $drop_image_or_text = '';
    if (true == $GLOBALS['cfg']['PropertiesIconic']) {
        $drop_image_or_text .= PMA_getImage('b_drop.png', __('Delete tracking data for this table'));
    }
    if ('both' === $GLOBALS['cfg']['PropertiesIconic'] || false === $GLOBALS['cfg']['PropertiesIconic']) {
        $drop_image_or_text .= __('Drop');
    }
    $style = 'odd';
    while ($one_result = PMA_DBI_fetch_array($all_tables_result)) {
        list($table_name, $version_number) = $one_result;
        $table_query = ' SELECT * FROM ' . PMA_backquote($GLOBALS['cfg']['Server']['pmadb']) . '.' . PMA_backquote($GLOBALS['cfg']['Server']['tracking']) . ' WHERE `db_name` = \'' . PMA_sqlAddSlashes($_REQUEST['db']) . '\' AND `table_name`  = \'' . PMA_sqlAddSlashes($table_name) . '\' AND `version` = \'' . $version_number . '\'';
        $table_result = PMA_query_as_controluser($table_query);
        $version_data = PMA_DBI_fetch_array($table_result);
        if ($version_data['tracking_active'] == 1) {
            $version_status = __('active');
        } else {
            $version_status = __('not active');
        }
Example #10
0
    $str1 = '<select name="logtype">' .
            '<option value="schema"' . ($selection_schema ? ' selected="selected"' : '') . '>' . __('Structure only') . '</option>' .
            '<option value="data"' . ($selection_data ? ' selected="selected"' : ''). '>' . __('Data only') . '</option>' .
            '<option value="schema_and_data"' . ($selection_both ? ' selected="selected"' : '') . '>' . __('Structure and data') . '</option>' .
            '</select>';
    $str2 = '<input type="text" name="date_from" value="' . htmlspecialchars($_REQUEST['date_from']) . '" size="19" />';
    $str3 = '<input type="text" name="date_to" value="' . htmlspecialchars($_REQUEST['date_to']) . '" size="19" />';
    $str4 = '<input type="text" name="users" value="' . htmlspecialchars($_REQUEST['users']) . '" />';
    $str5 = '<input type="submit" name="list_report" value="' . __('Go') . '" />';

    printf(__('Show %1$s with dates from %2$s to %3$s by user %4$s %5$s'), $str1, $str2, $str3, $str4, $str5);

    // Prepare delete link content here
    $drop_image_or_text = '';
    if (true == $GLOBALS['cfg']['PropertiesIconic']) {
        $drop_image_or_text .= PMA_getImage('b_drop.png', __('Delete tracking data row from report'));
    }
    if ('both' === $GLOBALS['cfg']['PropertiesIconic'] || false === $GLOBALS['cfg']['PropertiesIconic']) {
        $drop_image_or_text .= __('Delete');
    }

    /*
     *  First, list tracked data definition statements
     */
    $i = 1;
    if (count($data['ddlog']) == 0 && count($data['dmlog']) == 0) {
        $msg = PMA_Message::notice(__('No data'));
        $msg->display();
    }

    if ($selection_schema || $selection_both  && count($data['ddlog']) > 0) {
Example #11
0
 }
 printf($item, $GLOBALS['cfg']['DefaultTabServer'], PMA_generate_common_url(), htmlspecialchars($server_info), __('Server'));
 if (strlen($GLOBALS['db'])) {
     echo $separator;
     if ($GLOBALS['cfg']['NavigationBarIconic']) {
         echo PMA_getImage('s_db.png', '', array('class' => 'item')) . "\n";
     }
     printf($item, $GLOBALS['cfg']['DefaultTabDatabase'], PMA_generate_common_url($GLOBALS['db']), htmlspecialchars($GLOBALS['db']), __('Database'));
     // if the table is being dropped, $_REQUEST['purge'] is set to '1'
     // so do not display the table name in upper div
     if (strlen($GLOBALS['table']) && !(isset($_REQUEST['purge']) && $_REQUEST['purge'] == '1')) {
         include_once './libraries/tbl_info.inc.php';
         echo $separator;
         if ($GLOBALS['cfg']['NavigationBarIconic']) {
             $icon = isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? 'b_views.png' : 's_tbl.png';
             echo PMA_getImage($icon, '', array('class' => 'item')) . "\n";
         }
         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'));
         /**
          * Displays table comment
          */
         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
         // add recently used table and reload the navigation
         if ($GLOBALS['cfg']['LeftRecentTable'] > 0) {
             PMA_addRecentTable($GLOBALS['db'], $GLOBALS['table']);
Example #12
0
/**
 * display unordered list of tables
 * calls itself recursively if table in given list
 * is a list itself
 *
 * @global  integer the element counter
 * @global  string  html code for '-' image
 * @global  string  html code for '+' image
 * @global  string  html code for self link
 * @param array   $tables         array of tables/tablegroups
 * @param boolean $visible        whether the list is visible or not
 * @param string  $tab_group_full full tab group name
 * @param string  $table_db       db of this table
 */
function PMA_displayTableList($tables, $visible = false, $tab_group_full = '', $table_db = '')
{
    if (!is_array($tables) || count($tables) === 0) {
        return;
    }
    global $element_counter, $img_minus, $img_plus, $href_left;
    $sep = $GLOBALS['cfg']['LeftFrameTableSeparator'];
    if ($visible) {
        echo '<ul id="subel' . $element_counter . '">';
    } else {
        echo '<ul id="subel' . $element_counter . '" style="display: none">';
    }
    foreach ($tables as $group => $table) {
        // only allow grouping if the group has more than 1 table
        if (isset($table['is' . $sep . 'group']) && $table['tab' . $sep . 'count'] > 1) {
            $common_url_query = $GLOBALS['common_url_query'] . '&amp;tbl_group=' . urlencode($tab_group_full . $group);
            $element_counter++;
            echo '<li>' . "\n";
            if ($visible && (isset($_REQUEST['tbl_group']) && (strpos($_REQUEST['tbl_group'], $group) === 0 || strpos($_REQUEST['tbl_group'], $sep . $group) !== false) || strpos($GLOBALS['table'], $group) === 0)) {
                printf($href_left, $element_counter, $GLOBALS['common_url_query'] . '&amp;tbl_group=' . $tab_group_full);
                printf($img_minus, $element_counter);
            } else {
                printf($href_left, $element_counter, $common_url_query);
                printf($img_plus, $element_counter);
            }
            echo '</a>';
            ?>
            <a href="index.php?<?php 
            echo $common_url_query;
            ?>
"
                target="_parent"
                onclick="
                    if (! toggle('<?php 
            echo $element_counter;
            ?>
', true))
                        window.parent.goTo('./navigation.php?<?php 
            echo $common_url_query;
            ?>
');
                    window.parent.goTo('./<?php 
            echo $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . $common_url_query;
            ?>
', 'main');
                    return false;">
                <?php 
            if ($GLOBALS['text_dir'] === 'rtl') {
                echo ' <bdo dir="ltr">(' . $table['tab' . $sep . 'count'] . ')</bdo> ';
            }
            echo htmlspecialchars(substr($group, 0, strlen($group) - strlen($sep)));
            if ($GLOBALS['text_dir'] === 'ltr') {
                echo ' <bdo dir="ltr">(' . $table['tab' . $sep . 'count'] . ')</bdo> ';
            }
            ?>
            </a>
            <?php 
            unset($table['is' . $sep . 'group']);
            unset($table['tab' . $sep . 'group']);
            unset($table['tab' . $sep . 'count']);
            if ($visible && (isset($_REQUEST['tbl_group']) && (strpos($_REQUEST['tbl_group'], $group) === 0 || strpos($_REQUEST['tbl_group'], $sep . $group) !== false) || strpos($GLOBALS['table'], $group) === 0)) {
                PMA_displayTableList($table, true, $tab_group_full . $group, $table_db);
            } else {
                PMA_displayTableList($table, false, '', $table_db);
            }
            echo '</li>' . "\n";
        } elseif (is_array($table)) {
            // the table was not grouped because it is the only one with its prefix
            while (isset($table['is' . $sep . 'group'])) {
                // get the array with the actual table information
                foreach ($table as $value) {
                    if (is_array($value)) {
                        $table = $value;
                    }
                }
            }
            $link_title = PMA_getTitleForTarget($GLOBALS['cfg']['LeftDefaultTabTable']);
            // quick access icon next to each table name
            echo '<li>' . "\n";
            echo '<a class="tableicon" title="' . htmlspecialchars($link_title) . ': ' . htmlspecialchars($table['Comment']) . ' (' . PMA_formatNumber($table['Rows'], 0) . ' ' . __('Rows') . ')"' . ' id="quick_' . htmlspecialchars($table_db . '.' . $table['Name']) . '"' . ' href="' . $GLOBALS['cfg']['LeftDefaultTabTable'] . '?' . $GLOBALS['common_url_query'] . '&amp;table=' . urlencode($table['Name']) . '&amp;goto=' . $GLOBALS['cfg']['LeftDefaultTabTable'] . '" >';
            $attr = array('id' => 'icon_' . htmlspecialchars($table_db . '.' . $table['Name']));
            if (PMA_Table::isView($table_db, $table['Name'])) {
                echo PMA_getImage('s_views.png', htmlspecialchars($link_title), $attr);
            } else {
                echo PMA_getImage('b_browse.png', htmlspecialchars($link_title), $attr);
            }
            echo '</a>';
            // link for the table name itself
            $href = $GLOBALS['cfg']['DefaultTabTable'] . '?' . $GLOBALS['common_url_query'] . '&amp;table=' . urlencode($table['Name']) . '&amp;pos=0';
            echo '<a href="' . $href . '" title="' . htmlspecialchars(PMA_getTitleForTarget($GLOBALS['cfg']['DefaultTabTable']) . ': ' . $table['Comment'] . ' (' . PMA_formatNumber($table['Rows'], 0) . ' ' . __('Rows')) . ')"' . ' id="' . htmlspecialchars($table_db . '.' . $table['Name']) . '">' . str_replace(' ', '&nbsp;', htmlspecialchars($table['disp_name'])) . '</a>';
            echo '</li>' . "\n";
        }
    }
    echo '</ul>';
}
/**
 * requirements
 */
require_once 'libraries/common.inc.php';

/**
 * Does the common work
 */
require 'libraries/server_common.inc.php';


/**
 * Displays the sub-page heading
 */
echo '<h2>' . "\n"
   . '    ' .  PMA_getImage('s_asci.png')
   . '' . __('Character Sets and Collations') . "\n"
   . '</h2>' . "\n";

/**
 * Includes the required charset library
 */
require_once 'libraries/mysql_charsets.lib.php';


/**
 * Outputs the result
 */
echo '<div id="div_mysql_charset_collations">' . "\n"
   . '<table class="data noclick">' . "\n"
   . '<tr><th>' . __('Collation') . '</th>' . "\n"
/**
 * DB search optimisation
 *
 * @package PhpMyAdmin
 */
require_once 'libraries/common.inc.php';
require_once 'libraries/common.lib.php';
$db = $_GET['db'];
$table_term = $_GET['table'];
$common_url_query = PMA_generate_common_url($GLOBALS['db']);
$tables_full = PMA_getTableList($db);
$tables_response = array();
foreach ($tables_full as $key => $table) {
    if (strpos($key, $table_term) !== false) {
        $link = '<li class="ajax_table"><a class="tableicon" title="' . htmlspecialchars($link_title) . ': ' . htmlspecialchars($table['Comment']) . ' (' . PMA_formatNumber($table['Rows'], 0) . ' ' . __('Rows') . ')"' . ' id="quick_' . htmlspecialchars($table_db . '.' . $table['Name']) . '"' . ' href="' . $GLOBALS['cfg']['LeftDefaultTabTable'] . '?' . $common_url_query . '&amp;table=' . urlencode($table['Name']) . '&amp;goto=' . $GLOBALS['cfg']['LeftDefaultTabTable'] . '" >';
        $attr = array('id' => 'icon_' . htmlspecialchars($table_db . '.' . $table['Name']));
        if (PMA_Table::isView($table_db, $table['Name'])) {
            $link .= PMA_getImage('s_views.png', htmlspecialchars($link_title), $attr);
        } else {
            $link .= PMA_getImage('b_browse.png', htmlspecialchars($link_title), $attr);
        }
        $link .= '</a>';
        // link for the table name itself
        $href = $GLOBALS['cfg']['DefaultTabTable'] . '?' . $common_url_query . '&amp;table=' . urlencode($table['Name']) . '&amp;pos=0';
        $link .= '<a href="' . $href . '" title="' . htmlspecialchars(PMA_getTitleForTarget($GLOBALS['cfg']['DefaultTabTable']) . ': ' . $table['Comment'] . ' (' . PMA_formatNumber($table['Rows'], 0) . ' ' . __('Rows') . ')') . '" id="' . htmlspecialchars($table_db . '.' . $table['Name']) . '">' . str_replace(' ', '&nbsp;', htmlspecialchars($table['disp_name'])) . '</a>';
        $link .= '</li>' . "\n";
        $table['line'] = $link;
        $tables_response[] = $table;
    }
}
PMA_ajaxResponse('', true, array('tables' => $tables_response));
Example #15
0
 $_url_params['sort_by'] = 'SCHEMA_NAME';
 $_url_params['sort_order'] = $sort_by == 'SCHEMA_NAME' && $sort_order == 'asc' ? 'desc' : 'asc';
 echo '<table id="tabledatabases" class="data">' . "\n" . '<thead>' . "\n" . '<tr>' . "\n" . ($is_superuser || $cfg['AllowUserDropDatabase'] ? '        <th></th>' . "\n" : '') . '    <th><a href="./server_databases.php' . PMA_generate_common_url($_url_params) . '">' . "\n" . '            ' . __('Database') . "\n" . ($sort_by == 'SCHEMA_NAME' ? '                ' . PMA_getImage('s_' . $sort_order . '.png', $sort_order == 'asc' ? __('Ascending') : __('Descending')) . "\n" : '') . '        </a></th>' . "\n";
 $table_columns = 3;
 foreach ($column_order as $stat_name => $stat) {
     if (array_key_exists($stat_name, $first_database)) {
         if ($stat['format'] === 'byte') {
             $table_columns += 2;
             $colspan = ' colspan="2"';
         } else {
             $table_columns++;
             $colspan = '';
         }
         $_url_params['sort_by'] = $stat_name;
         $_url_params['sort_order'] = $sort_by == $stat_name && $sort_order == 'desc' ? 'asc' : 'desc';
         echo '    <th' . $colspan . '>' . '<a href="./server_databases.php' . PMA_generate_common_url($_url_params) . '">' . "\n" . '            ' . $stat['disp_name'] . "\n" . ($sort_by == $stat_name ? '            ' . PMA_getImage('s_' . $sort_order . '.png', $sort_order == 'asc' ? __('Ascending') : __('Descending')) . "\n" : '') . '        </a></th>' . "\n";
     }
 }
 foreach ($replication_types as $type) {
     if ($type == "master") {
         $name = __('Master replication');
     } elseif ($type == "slave") {
         $name = __('Slave replication');
     }
     if (${"server_{$type}_status"}) {
         echo '    <th>' . $name . '</th>' . "\n";
     }
 }
 if ($is_superuser && !PMA_DRIZZLE) {
     echo '    <th>' . ($cfg['PropertiesIconic'] ? '' : __('Action')) . "\n" . '    </th>' . "\n";
 }
Example #16
0
/**
 * Displays the headers of the results table
 *
 * @param array   &$is_display                 which elements to display
 * @param array   &$fields_meta                the list of fields properties
 * @param integer $fields_cnt                  the total number of fields returned by the SQL query
 * @param array   $analyzed_sql                the analyzed query
 * @param string  $sort_expression             sort expression
 * @param string  $sort_expression_nodirection sort expression without direction
 * @param string  $sort_direction              sort direction
 *
 * @return  boolean  $clause_is_unique
 *
 * @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  integer  $num_rows         the total number of rows returned by the
 *                                     SQL query
 * @global  array    $vertical_display informations used with vertical display
 *                                     mode
 *
 * @access  private
 *
 * @see     PMA_displayTable()
 */
function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $analyzed_sql = '', $sort_expression, $sort_expression_nodirection, $sort_direction)
{
    global $db, $table, $goto;
    global $sql_query, $num_rows;
    global $vertical_display, $highlight_columns;
    // required to generate sort links that will remember whether the
    // "Show all" button has been clicked
    $sql_md5 = md5($GLOBALS['sql_query']);
    $session_max_rows = $_SESSION['tmp_user_values']['query'][$sql_md5]['max_rows'];
    if ($analyzed_sql == '') {
        $analyzed_sql = array();
    }
    // can the result be sorted?
    if ($is_display['sort_lnk'] == '1') {
        // Just as fallback
        $unsorted_sql_query = $sql_query;
        if (isset($analyzed_sql[0]['unsorted_query'])) {
            $unsorted_sql_query = $analyzed_sql[0]['unsorted_query'];
        }
        // Handles the case of multiple clicks on a column's header
        // which would add many spaces before "ORDER BY" in the
        // generated query.
        $unsorted_sql_query = trim($unsorted_sql_query);
        // sorting by indexes, only if it makes sense (only one table ref)
        if (isset($analyzed_sql) && isset($analyzed_sql[0]) && isset($analyzed_sql[0]['querytype']) && $analyzed_sql[0]['querytype'] == 'SELECT' && isset($analyzed_sql[0]['table_ref']) && count($analyzed_sql[0]['table_ref']) == 1) {
            // grab indexes data:
            $indexes = PMA_Index::getFromTable($table, $db);
            // do we have any index?
            if ($indexes) {
                if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal' || $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped') {
                    $span = $fields_cnt;
                    if ($is_display['edit_lnk'] != 'nn') {
                        $span++;
                    }
                    if ($is_display['del_lnk'] != 'nn') {
                        $span++;
                    }
                    if ($is_display['del_lnk'] != 'kp' && $is_display['del_lnk'] != 'nn') {
                        $span++;
                    }
                } else {
                    $span = $num_rows + floor($num_rows / $_SESSION['tmp_user_values']['repeat_cells']) + 1;
                }
                echo '<form action="sql.php" method="post">' . "\n";
                echo PMA_generate_common_hidden_inputs($db, $table);
                echo __('Sort by key') . ': <select name="sql_query" class="autosubmit">' . "\n";
                $used_index = false;
                $local_order = isset($sort_expression) ? $sort_expression : '';
                foreach ($indexes as $index) {
                    $asc_sort = '`' . implode('` ASC, `', array_keys($index->getColumns())) . '` ASC';
                    $desc_sort = '`' . implode('` DESC, `', array_keys($index->getColumns())) . '` DESC';
                    $used_index = $used_index || $local_order == $asc_sort || $local_order == $desc_sort;
                    if (preg_match('@(.*)([[:space:]](LIMIT (.*)|PROCEDURE (.*)|FOR UPDATE|LOCK IN SHARE MODE))@is', $unsorted_sql_query, $my_reg)) {
                        $unsorted_sql_query_first_part = $my_reg[1];
                        $unsorted_sql_query_second_part = $my_reg[2];
                    } else {
                        $unsorted_sql_query_first_part = $unsorted_sql_query;
                        $unsorted_sql_query_second_part = '';
                    }
                    echo '<option value="' . htmlspecialchars($unsorted_sql_query_first_part . "\n" . ' ORDER BY ' . $asc_sort . $unsorted_sql_query_second_part) . '"' . ($local_order == $asc_sort ? ' selected="selected"' : '') . '>' . htmlspecialchars($index->getName()) . ' (' . __('Ascending') . ')</option>';
                    echo '<option value="' . htmlspecialchars($unsorted_sql_query_first_part . "\n" . ' ORDER BY ' . $desc_sort . $unsorted_sql_query_second_part) . '"' . ($local_order == $desc_sort ? ' selected="selected"' : '') . '>' . htmlspecialchars($index->getName()) . ' (' . __('Descending') . ')</option>';
                }
                echo '<option value="' . htmlspecialchars($unsorted_sql_query) . '"' . ($used_index ? '' : ' selected="selected"') . '>' . __('None') . '</option>';
                echo '</select>' . "\n";
                echo '<noscript><input type="submit" value="' . __('Go') . '" /></noscript>';
                echo '</form>' . "\n";
            }
        }
    }
    // Output data needed for grid editing
    echo '<input id="save_cells_at_once" type="hidden" value="' . $GLOBALS['cfg']['SaveCellsAtOnce'] . '" />';
    echo '<div class="common_hidden_inputs">';
    echo PMA_generate_common_hidden_inputs($db, $table);
    echo '</div>';
    // Output data needed for column reordering and show/hide column
    if (PMA_isSelect()) {
        // generate the column order, if it is set
        $pmatable = new PMA_Table($GLOBALS['table'], $GLOBALS['db']);
        $col_order = $pmatable->getUiProp(PMA_Table::PROP_COLUMN_ORDER);
        if ($col_order) {
            echo '<input id="col_order" type="hidden" value="' . implode(',', $col_order) . '" />';
        }
        $col_visib = $pmatable->getUiProp(PMA_Table::PROP_COLUMN_VISIB);
        if ($col_visib) {
            echo '<input id="col_visib" type="hidden" value="' . implode(',', $col_visib) . '" />';
        }
        // generate table create time
        if (!PMA_Table::isView($GLOBALS['table'], $GLOBALS['db'])) {
            echo '<input id="table_create_time" type="hidden" value="' . PMA_Table::sGetStatusInfo($GLOBALS['db'], $GLOBALS['table'], 'Create_time') . '" />';
        }
    }
    $vertical_display['emptypre'] = 0;
    $vertical_display['emptyafter'] = 0;
    $vertical_display['textbtn'] = '';
    // Display options (if we are not in print view)
    if (!(isset($GLOBALS['printview']) && $GLOBALS['printview'] == '1')) {
        echo '<form method="post" action="sql.php" name="displayOptionsForm" id="displayOptionsForm"';
        if ($GLOBALS['cfg']['AjaxEnable']) {
            echo ' class="ajax" ';
        }
        echo '>';
        $url_params = array('db' => $db, 'table' => $table, 'sql_query' => $sql_query, 'goto' => $goto, 'display_options_form' => 1);
        echo PMA_generate_common_hidden_inputs($url_params);
        echo '<br />';
        PMA_generate_slider_effect('displayoptions', __('Options'));
        echo '<fieldset>';
        echo '<div class="formelement">';
        $choices = array('P' => __('Partial texts'), 'F' => __('Full texts'));
        PMA_display_html_radio('display_text', $choices, $_SESSION['tmp_user_values']['display_text']);
        echo '</div>';
        // prepare full/partial text button or link
        $url_params_full_text = array('db' => $db, 'table' => $table, 'sql_query' => $sql_query, 'goto' => $goto, 'full_text_button' => 1);
        if ($_SESSION['tmp_user_values']['display_text'] == 'F') {
            // currently in fulltext mode so show the opposite link
            $tmp_image_file = $GLOBALS['pmaThemeImage'] . 's_partialtext.png';
            $tmp_txt = __('Partial texts');
            $url_params_full_text['display_text'] = 'P';
        } else {
            $tmp_image_file = $GLOBALS['pmaThemeImage'] . 's_fulltext.png';
            $tmp_txt = __('Full texts');
            $url_params_full_text['display_text'] = 'F';
        }
        $tmp_image = '<img class="fulltext" src="' . $tmp_image_file . '" alt="' . $tmp_txt . '" title="' . $tmp_txt . '" />';
        $tmp_url = 'sql.php' . PMA_generate_common_url($url_params_full_text);
        $full_or_partial_text_link = PMA_linkOrButton($tmp_url, $tmp_image, array(), false);
        unset($tmp_image_file, $tmp_txt, $tmp_url, $tmp_image);
        if ($GLOBALS['cfgRelation']['relwork'] && $GLOBALS['cfgRelation']['displaywork']) {
            echo '<div class="formelement">';
            $choices = array('K' => __('Relational key'), 'D' => __('Relational display column'));
            PMA_display_html_radio('relational_display', $choices, $_SESSION['tmp_user_values']['relational_display']);
            echo '</div>';
        }
        echo '<div class="formelement">';
        PMA_display_html_checkbox('display_binary', __('Show binary contents'), !empty($_SESSION['tmp_user_values']['display_binary']), false);
        echo '<br />';
        PMA_display_html_checkbox('display_blob', __('Show BLOB contents'), !empty($_SESSION['tmp_user_values']['display_blob']), false);
        echo '<br />';
        PMA_display_html_checkbox('display_binary_as_hex', __('Show binary contents as HEX'), !empty($_SESSION['tmp_user_values']['display_binary_as_hex']), false);
        echo '</div>';
        // I would have preferred to name this "display_transformation".
        // This is the only way I found to be able to keep this setting sticky
        // per SQL query, and at the same time have a default that displays
        // the transformations.
        echo '<div class="formelement">';
        PMA_display_html_checkbox('hide_transformation', __('Hide browser transformation'), !empty($_SESSION['tmp_user_values']['hide_transformation']), false);
        echo '</div>';
        if (!PMA_DRIZZLE) {
            echo '<div class="formelement">';
            $choices = array('GEOM' => __('Geometry'), 'WKT' => __('Well Known Text'), 'WKB' => __('Well Known Binary'));
            PMA_display_html_radio('geometry_display', $choices, $_SESSION['tmp_user_values']['geometry_display']);
            echo '</div>';
        }
        echo '<div class="clearfloat"></div>';
        echo '</fieldset>';
        echo '<fieldset class="tblFooters">';
        echo '<input type="submit" value="' . __('Go') . '" />';
        echo '</fieldset>';
        echo '</div>';
        echo '</form>';
    }
    // Start of form for multi-rows edit/delete/export
    if ($is_display['del_lnk'] == 'dr' || $is_display['del_lnk'] == 'kp') {
        echo '<form method="post" action="tbl_row_action.php" name="resultsForm" id="resultsForm"';
        if ($GLOBALS['cfg']['AjaxEnable']) {
            echo ' class="ajax" ';
        }
        echo '>' . "\n";
        echo PMA_generate_common_hidden_inputs($db, $table, 1);
        echo '<input type="hidden" name="goto"             value="sql.php" />' . "\n";
    }
    echo '<table id="table_results" class="data';
    if ($GLOBALS['cfg']['AjaxEnable']) {
        echo ' ajax';
    }
    echo '">' . "\n";
    if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal' || $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped') {
        echo '<thead><tr>' . "\n";
    }
    // 1. Displays the full/partial text button (part 1)...
    if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal' || $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped') {
        $colspan = $is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn' ? ' colspan="4"' : '';
    } else {
        $rowspan = $is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn' ? ' rowspan="4"' : '';
    }
    //     ... before the result table
    if ($is_display['edit_lnk'] == 'nn' && $is_display['del_lnk'] == 'nn' && $is_display['text_btn'] == '1') {
        $vertical_display['emptypre'] = $is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn' ? 4 : 0;
        if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal' || $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped') {
            ?>
    <th colspan="<?php 
            echo $fields_cnt;
            ?>
"></th>
</tr>
<tr>
            <?php 
            // end horizontal/horizontalflipped mode
        } else {
            ?>
<tr>
    <th colspan="<?php 
            echo $num_rows + floor($num_rows / $_SESSION['tmp_user_values']['repeat_cells']) + 1;
            ?>
"></th>
</tr>
            <?php 
        }
        // end vertical mode
    } elseif (($GLOBALS['cfg']['RowActionLinks'] == 'left' || $GLOBALS['cfg']['RowActionLinks'] == 'both') && $is_display['text_btn'] == '1') {
        $vertical_display['emptypre'] = $is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn' ? 4 : 0;
        if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal' || $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped') {
            ?>
                <th <?php 
            echo $colspan;
            ?>
><?php 
            echo $full_or_partial_text_link;
            ?>
</th>
            <?php 
            // end horizontal/horizontalflipped mode
        } else {
            $vertical_display['textbtn'] = '    <th ' . $rowspan . ' valign="middle">' . "\n" . '        ' . "\n" . '    </th>' . "\n";
        }
        // end vertical mode
    } elseif (($GLOBALS['cfg']['RowActionLinks'] == 'left' || $GLOBALS['cfg']['RowActionLinks'] == 'both') && ($is_display['edit_lnk'] != 'nn' || $is_display['del_lnk'] != 'nn')) {
        $vertical_display['emptypre'] = $is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn' ? 4 : 0;
        if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal' || $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped') {
            ?>
    <td<?php 
            echo $colspan;
            ?>
></td>
            <?php 
            // end horizontal/horizontalfipped mode
        } else {
            $vertical_display['textbtn'] = '    <td' . $rowspan . '></td>' . "\n";
        }
        // end vertical mode
    } elseif ($GLOBALS['cfg']['RowActionLinks'] == 'none' && ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal' || $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped')) {
        echo '<th></th>';
    }
    // 2. Displays the fields' name
    // 2.0 If sorting links should be used, checks if the query is a "JOIN"
    //     statement (see 2.1.3)
    // 2.0.1 Prepare Display column comments if enabled ($GLOBALS['cfg']['ShowBrowseComments']).
    //       Do not show comments, if using horizontalflipped mode, because of space usage
    if ($GLOBALS['cfg']['ShowBrowseComments'] && $_SESSION['tmp_user_values']['disp_direction'] != 'horizontalflipped') {
        $comments_map = array();
        if (isset($analyzed_sql[0]) && is_array($analyzed_sql[0])) {
            foreach ($analyzed_sql[0]['table_ref'] as $tbl) {
                $tb = $tbl['table_true_name'];
                $comments_map[$tb] = PMA_getComments($db, $tb);
                unset($tb);
            }
        }
    }
    if ($GLOBALS['cfgRelation']['commwork'] && $GLOBALS['cfgRelation']['mimework'] && $GLOBALS['cfg']['BrowseMIME'] && !$_SESSION['tmp_user_values']['hide_transformation']) {
        include_once './libraries/transformations.lib.php';
        $GLOBALS['mime_map'] = PMA_getMIME($db, $table);
    }
    // See if we have to highlight any header fields of a WHERE query.
    // Uses SQL-Parser results.
    $highlight_columns = array();
    if (isset($analyzed_sql) && isset($analyzed_sql[0]) && isset($analyzed_sql[0]['where_clause_identifiers'])) {
        $wi = 0;
        if (isset($analyzed_sql[0]['where_clause_identifiers']) && is_array($analyzed_sql[0]['where_clause_identifiers'])) {
            foreach ($analyzed_sql[0]['where_clause_identifiers'] as $wci_nr => $wci) {
                $highlight_columns[$wci] = 'true';
            }
        }
    }
    if (PMA_isSelect()) {
        // prepare to get the column order, if available
        $pmatable = new PMA_Table($GLOBALS['table'], $GLOBALS['db']);
        $col_order = $pmatable->getUiProp(PMA_Table::PROP_COLUMN_ORDER);
        $col_visib = $pmatable->getUiProp(PMA_Table::PROP_COLUMN_VISIB);
    } else {
        $col_order = false;
        $col_visib = false;
    }
    for ($j = 0; $j < $fields_cnt; $j++) {
        // assign $i with appropriate column order
        $i = $col_order ? $col_order[$j] : $j;
        //  See if this column should get highlight because it's used in the
        //  where-query.
        if (isset($highlight_columns[$fields_meta[$i]->name]) || isset($highlight_columns[PMA_backquote($fields_meta[$i]->name)])) {
            $condition_field = true;
        } else {
            $condition_field = false;
        }
        // 2.0 Prepare comment-HTML-wrappers for each row, if defined/enabled.
        if (isset($comments_map) && isset($comments_map[$fields_meta[$i]->table]) && isset($comments_map[$fields_meta[$i]->table][$fields_meta[$i]->name])) {
            $comments = '<span class="tblcomment">' . htmlspecialchars($comments_map[$fields_meta[$i]->table][$fields_meta[$i]->name]) . '</span>';
        } else {
            $comments = '';
        }
        // 2.1 Results can be sorted
        if ($is_display['sort_lnk'] == '1') {
            // 2.1.1 Checks if the table name is required; it's the case
            //       for a query with a "JOIN" statement and if the column
            //       isn't aliased, or in queries like
            //       SELECT `1`.`master_field` , `2`.`master_field`
            //       FROM `PMA_relation` AS `1` , `PMA_relation` AS `2`
            if (isset($fields_meta[$i]->table) && strlen($fields_meta[$i]->table)) {
                $sort_tbl = PMA_backquote($fields_meta[$i]->table) . '.';
            } else {
                $sort_tbl = '';
            }
            // 2.1.2 Checks if the current column is used to sort the
            //       results
            // the orgname member does not exist for all MySQL versions
            // but if found, it's the one on which to sort
            $name_to_use_in_sort = $fields_meta[$i]->name;
            $is_orgname = false;
            if (isset($fields_meta[$i]->orgname) && strlen($fields_meta[$i]->orgname)) {
                $name_to_use_in_sort = $fields_meta[$i]->orgname;
                $is_orgname = true;
            }
            // $name_to_use_in_sort might contain a space due to
            // formatting of function expressions like "COUNT(name )"
            // so we remove the space in this situation
            $name_to_use_in_sort = str_replace(' )', ')', $name_to_use_in_sort);
            if (empty($sort_expression)) {
                $is_in_sort = false;
            } else {
                // Field name may be preceded by a space, or any number
                // of characters followed by a dot (tablename.fieldname)
                // so do a direct comparison for the sort expression;
                // this avoids problems with queries like
                // "SELECT id, count(id)..." and clicking to sort
                // on id or on count(id).
                // Another query to test this:
                // SELECT p.*, FROM_UNIXTIME(p.temps) FROM mytable AS p
                // (and try clicking on each column's header twice)
                if (!empty($sort_tbl) && strpos($sort_expression_nodirection, $sort_tbl) === false && strpos($sort_expression_nodirection, '(') === false) {
                    $sort_expression_nodirection = $sort_tbl . $sort_expression_nodirection;
                }
                $is_in_sort = str_replace('`', '', $sort_tbl) . $name_to_use_in_sort == str_replace('`', '', $sort_expression_nodirection) ? true : false;
            }
            // 2.1.3 Check the field name for a bracket.
            //       If it contains one, it's probably a function column
            //       like 'COUNT(`field`)'
            //       It still might be a column name of a view. See bug #3383711
            //       Check is_orgname.
            if (strpos($name_to_use_in_sort, '(') !== false && !$is_orgname) {
                $sort_order = "\n" . 'ORDER BY ' . $name_to_use_in_sort . ' ';
            } else {
                $sort_order = "\n" . 'ORDER BY ' . $sort_tbl . PMA_backquote($name_to_use_in_sort) . ' ';
            }
            unset($name_to_use_in_sort);
            unset($is_orgname);
            // 2.1.4 Do define the sorting URL
            if (!$is_in_sort) {
                // patch #455484 ("Smart" order)
                $GLOBALS['cfg']['Order'] = strtoupper($GLOBALS['cfg']['Order']);
                if ($GLOBALS['cfg']['Order'] === 'SMART') {
                    $sort_order .= preg_match('@time|date@i', $fields_meta[$i]->type) ? 'DESC' : 'ASC';
                } else {
                    $sort_order .= $GLOBALS['cfg']['Order'];
                }
                $order_img = '';
            } elseif ('DESC' == $sort_direction) {
                $sort_order .= ' ASC';
                $order_img = ' ' . PMA_getImage('s_desc.png', __('Descending'), array('class' => "soimg{$i}", 'title' => ''));
                $order_img .= ' ' . PMA_getImage('s_asc.png', __('Ascending'), array('class' => "soimg{$i} hide", 'title' => ''));
            } else {
                $sort_order .= ' DESC';
                $order_img = ' ' . PMA_getImage('s_asc.png', __('Ascending'), array('class' => "soimg{$i}", 'title' => ''));
                $order_img .= ' ' . PMA_getImage('s_desc.png', __('Descending'), array('class' => "soimg{$i} hide", 'title' => ''));
            }
            if (preg_match('@(.*)([[:space:]](LIMIT (.*)|PROCEDURE (.*)|FOR UPDATE|LOCK IN SHARE MODE))@is', $unsorted_sql_query, $regs3)) {
                $sorted_sql_query = $regs3[1] . $sort_order . $regs3[2];
            } else {
                $sorted_sql_query = $unsorted_sql_query . $sort_order;
            }
            $_url_params = array('db' => $db, 'table' => $table, 'sql_query' => $sorted_sql_query, 'session_max_rows' => $session_max_rows);
            $order_url = 'sql.php' . PMA_generate_common_url($_url_params);
            // 2.1.5 Displays the sorting URL
            // enable sort order swapping for image
            $order_link_params = array();
            if (isset($order_img) && $order_img != '') {
                if (strstr($order_img, 'asc')) {
                    $order_link_params['onmouseover'] = "\$('.soimg{$i}').toggle()";
                    $order_link_params['onmouseout'] = "\$('.soimg{$i}').toggle()";
                } elseif (strstr($order_img, 'desc')) {
                    $order_link_params['onmouseover'] = "\$('.soimg{$i}').toggle()";
                    $order_link_params['onmouseout'] = "\$('.soimg{$i}').toggle()";
                }
            }
            if ($GLOBALS['cfg']['HeaderFlipType'] == 'auto') {
                if (PMA_USR_BROWSER_AGENT == 'IE') {
                    $GLOBALS['cfg']['HeaderFlipType'] = 'css';
                } else {
                    $GLOBALS['cfg']['HeaderFlipType'] = 'fake';
                }
            }
            if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped' && $GLOBALS['cfg']['HeaderFlipType'] == 'css') {
                $order_link_params['style'] = 'direction: ltr; writing-mode: tb-rl;';
            }
            $order_link_params['title'] = __('Sort');
            $order_link_content = $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped' && $GLOBALS['cfg']['HeaderFlipType'] == 'fake' ? PMA_flipstring(htmlspecialchars($fields_meta[$i]->name), "<br />\n") : htmlspecialchars($fields_meta[$i]->name);
            $order_link = PMA_linkOrButton($order_url, $order_link_content . $order_img, $order_link_params, false, true);
            if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal' || $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped') {
                echo '<th';
                $th_class = array();
                $th_class[] = 'draggable';
                if ($col_visib && !$col_visib[$j]) {
                    $th_class[] = 'hide';
                }
                if ($condition_field) {
                    $th_class[] = 'condition';
                }
                $th_class[] = 'column_heading';
                if ($GLOBALS['cfg']['BrowsePointerEnable'] == true) {
                    $th_class[] = 'pointer';
                }
                if ($GLOBALS['cfg']['BrowseMarkerEnable'] == true) {
                    $th_class[] = 'marker';
                }
                echo ' class="' . implode(' ', $th_class) . '"';
                if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped') {
                    echo ' valign="bottom"';
                }
                echo '>' . $order_link . $comments . '</th>';
            }
            $vertical_display['desc'][] = '    <th ' . 'class="draggable' . ($condition_field ? ' condition' : '') . '">' . "\n" . $order_link . $comments . '    </th>' . "\n";
        } else {
            if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal' || $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped') {
                echo '<th';
                $th_class = array();
                $th_class[] = 'draggable';
                if ($col_visib && !$col_visib[$j]) {
                    $th_class[] = 'hide';
                }
                if ($condition_field) {
                    $th_class[] = 'condition';
                }
                echo ' class="' . implode(' ', $th_class) . '"';
                if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped') {
                    echo ' valign="bottom"';
                }
                if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped' && $GLOBALS['cfg']['HeaderFlipType'] == 'css') {
                    echo ' style="direction: ltr; writing-mode: tb-rl;"';
                }
                echo '>';
                if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped' && $GLOBALS['cfg']['HeaderFlipType'] == 'fake') {
                    echo PMA_flipstring(htmlspecialchars($fields_meta[$i]->name), '<br />');
                } else {
                    echo htmlspecialchars($fields_meta[$i]->name);
                }
                echo "\n" . $comments . '</th>';
            }
            $vertical_display['desc'][] = '    <th ' . 'class="draggable' . ($condition_field ? ' condition"' : '') . '">' . "\n" . '        ' . htmlspecialchars($fields_meta[$i]->name) . "\n" . $comments . '    </th>';
        }
        // end else (2.2)
    }
    // end for
    // 3. Displays the needed checkboxes at the right
    //    column of the result table header if possible and required...
    if (($GLOBALS['cfg']['RowActionLinks'] == 'right' || $GLOBALS['cfg']['RowActionLinks'] == 'both') && ($is_display['edit_lnk'] != 'nn' || $is_display['del_lnk'] != 'nn') && $is_display['text_btn'] == '1') {
        $vertical_display['emptyafter'] = $is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn' ? 4 : 1;
        if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal' || $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped') {
            echo "\n";
            ?>
        <th <?php 
            echo $colspan;
            ?>
><?php 
            echo $full_or_partial_text_link;
            ?>
</th>
            <?php 
            // end horizontal/horizontalflipped mode
        } else {
            $vertical_display['textbtn'] = '    <th ' . $rowspan . ' valign="middle">' . "\n" . '        ' . "\n" . '    </th>' . "\n";
        }
        // end vertical mode
    } elseif (($GLOBALS['cfg']['RowActionLinks'] == 'left' || $GLOBALS['cfg']['RowActionLinks'] == 'both') && ($is_display['edit_lnk'] == 'nn' && $is_display['del_lnk'] == 'nn') && !$GLOBALS['is_header_sent']) {
        $vertical_display['emptyafter'] = $is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn' ? 4 : 1;
        if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal' || $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped') {
            echo "\n";
            ?>
<td<?php 
            echo $colspan;
            ?>
></td>
            <?php 
            // end horizontal/horizontalflipped mode
        } else {
            $vertical_display['textbtn'] = '    <td' . $rowspan . '></td>' . "\n";
        }
        // end vertical mode
    }
    if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal' || $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped') {
        ?>
</tr>
</thead>
        <?php 
    }
    return true;
}
Example #17
0
 /**
  * Returns the breadcrumbs as HTML
  *
  * @return string HTML formatted breadcrumbs
  */
 private function _getBreadcrumbs()
 {
     $retval = '';
     $tbl_is_view = PMA_Table::isView($this->_db, $this->_table);
     $server_info = !empty($GLOBALS['cfg']['Server']['verbose']) ? $GLOBALS['cfg']['Server']['verbose'] : $GLOBALS['cfg']['Server']['host'];
     $server_info .= empty($GLOBALS['cfg']['Server']['port']) ? '' : ':' . $GLOBALS['cfg']['Server']['port'];
     $separator = "<span class='separator item'>&nbsp;»</span>";
     $item = '<a href="%1$s?%2$s" class="item">';
     if ($GLOBALS['cfg']['NavigationBarIconic'] !== true) {
         $item .= '%4$s: ';
     }
     $item .= '%3$s</a>';
     $retval .= "<div id='floating_menubar'></div>";
     $retval .= "<div id='serverinfo'>";
     if ($GLOBALS['cfg']['NavigationBarIconic']) {
         $retval .= PMA_getImage('s_host.png', '', array('class' => 'item'));
     }
     $retval .= sprintf($item, $GLOBALS['cfg']['DefaultTabServer'], PMA_generate_common_url(), htmlspecialchars($server_info), __('Server'));
     if (strlen($this->_db)) {
         $retval .= $separator;
         if ($GLOBALS['cfg']['NavigationBarIconic']) {
             $retval .= PMA_getImage('s_db.png', '', array('class' => 'item'));
         }
         $retval .= sprintf($item, $GLOBALS['cfg']['DefaultTabDatabase'], PMA_generate_common_url($this->_db), htmlspecialchars($this->_db), __('Database'));
         // if the table is being dropped, $_REQUEST['purge'] is set to '1'
         // so do not display the table name in upper div
         if (strlen($this->_table) && !(isset($_REQUEST['purge']) && $_REQUEST['purge'] == '1')) {
             include_once './libraries/tbl_info.inc.php';
             $retval .= $separator;
             if ($GLOBALS['cfg']['NavigationBarIconic']) {
                 $icon = $tbl_is_view ? 'b_views.png' : 's_tbl.png';
                 $retval .= PMA_getImage($icon, '', array('class' => 'item'));
             }
             $retval .= sprintf($item, $GLOBALS['cfg']['DefaultTabTable'], PMA_generate_common_url($this->_db, $this->_table), str_replace(' ', '&nbsp;', htmlspecialchars($this->_table)), $tbl_is_view ? __('View') : __('Table'));
             /**
              * Displays table comment
              */
             if (!empty($show_comment) && !isset($GLOBALS['avoid_show_comment'])) {
                 if (strstr($show_comment, '; InnoDB free')) {
                     $show_comment = preg_replace('@; InnoDB free:.*?$@', '', $show_comment);
                 }
                 $retval .= '<span class="table_comment"';
                 $retval .= ' id="span_table_comment">&quot;';
                 $retval .= htmlspecialchars($show_comment);
                 $retval .= '&quot;</span>';
             }
             // end if
         } else {
             // no table selected, display database comment if present
             /**
              * Settings for relations stuff
              */
             include_once './libraries/relation.lib.php';
             $cfgRelation = PMA_getRelationsParam();
             // Get additional information about tables for tooltip is done
             // in libraries/db_info.inc.php only once
             if ($cfgRelation['commwork']) {
                 $comment = PMA_getDbComment($this->_db);
                 /**
                  * Displays table comment
                  */
                 if (!empty($comment)) {
                     $retval .= '<span class="table_comment"' . ' id="span_table_comment">&quot;' . htmlspecialchars($comment) . '&quot;</span>';
                 }
                 // end if
             }
         }
     }
     $retval .= '<div class="clearfloat"></div>';
     $retval .= '</div>';
     return $retval;
 }
Example #18
0
           }

            $new_table_string = '<tr>' . "\n";
            $new_table_string .= '<td class="center"> <input type="checkbox" id="checkbox_tbl_" name="selected_tbl[]" value="'.htmlspecialchars($table).'" /> </td>' . "\n";

            $new_table_string .= '<th>';
            $new_table_string .= '<a href="sql.php' . PMA_generate_common_url($tbl_url_params) . '">'. $table . '</a>';

            if (PMA_Tracker::isActive()) {
                $truename = str_replace(' ', '&nbsp;', htmlspecialchars($table));
                if (PMA_Tracker::isTracked($db, $truename)) {
                    $new_table_string .= '<a href="tbl_tracking.php' . PMA_generate_common_url($tbl_url_params) . '">';
                    $new_table_string .= PMA_getImage('eye.png', __('Tracking is active.'));
                } elseif (PMA_Tracker::getVersion($db, $truename) > 0) {
                    $new_table_string .= '<a href="tbl_tracking.php' . PMA_generate_common_url($tbl_url_params) . '">';
                    $new_table_string .= PMA_getImage('eye_grey.png', __('Tracking is not active.'));
                }
                unset($truename);
            }
            $new_table_string .= '</th>' . "\n";

            $new_table_string .= '<td>' . $titles['NoBrowse'] . '</td>' . "\n";

            $new_table_string .= '<td><a href="tbl_structure.php' . PMA_generate_common_url($tbl_url_params) . '">' . $titles['Structure'] . '</a></td>' . "\n";

            $new_table_string .= '<td>' . $titles['NoSearch'] . '</td>' . "\n";

            $new_table_string .= '<td><a href="tbl_change.php' . PMA_generate_common_url($tbl_url_params) . '">' . $titles['Insert'] . '</a></td>' . "\n";

            $new_table_string .= '<td>' . $titles['NoEmpty'] . '</td>' . "\n";
Example #19
0
/**
 * prints bookmark fieldset
 *
 * @usedby  PMA_sqlQueryForm()
 */
function PMA_sqlQueryFormBookmark()
{
    $bookmark_list = PMA_Bookmark_getList($GLOBALS['db']);
    if (!$bookmark_list || count($bookmark_list) < 1) {
        return;
    }
    echo '<fieldset id="bookmarkoptions">';
    echo '<legend>';
    echo __('Bookmarked SQL query') . '</legend>' . "\n";
    echo '<div class="formelement">';
    echo '<select name="id_bookmark" id="id_bookmark">' . "\n";
    echo '<option value="">&nbsp;</option>' . "\n";
    foreach ($bookmark_list as $key => $value) {
        echo '<option value="' . htmlspecialchars($key) . '">' . htmlspecialchars($value) . '</option>' . "\n";
    }
    // &nbsp; is required for correct display with styles/line height
    echo '</select>&nbsp;' . "\n";
    echo '</div>' . "\n";
    echo '<div class="formelement">' . "\n";
    echo __('Variable');
    if ($GLOBALS['cfg']['ReplaceHelpImg']) {
        echo ' <a href="Documentation.html#faqbookmark"' . ' target="documentation">' . PMA_getImage('b_help.png', __('Documentation')) . '</a>';
    } else {
        echo ' (<a href="Documentation.html#faqbookmark"' . ' target="documentation">' . __('Documentation') . '</a>): ';
    }
    echo '<input type="text" name="bookmark_variable" class="textfield"' . ' size="10" />' . "\n";
    echo '</div>' . "\n";
    echo '<div class="formelement">' . "\n";
    echo '<input type="radio" name="action_bookmark" value="0"' . ' id="radio_bookmark_exe" checked="checked" />' . '<label for="radio_bookmark_exe">' . __('Submit') . '</label>' . "\n";
    echo '<input type="radio" name="action_bookmark" value="1"' . ' id="radio_bookmark_view" />' . '<label for="radio_bookmark_view">' . __('View only') . '</label>' . "\n";
    echo '<input type="radio" name="action_bookmark" value="2"' . ' id="radio_bookmark_del" />' . '<label for="radio_bookmark_del">' . __('Delete') . '</label>' . "\n";
    echo '</div>' . "\n";
    echo '<div class="clearfloat"></div>' . "\n";
    echo '</fieldset>' . "\n";
    echo '<fieldset id="bookmarkoptionsfooter" class="tblFooters">' . "\n";
    echo '<input type="submit" name="SQL" id="button_submit_bookmark" value="' . __('Go') . '" />';
    echo '<div class="clearfloat"></div>' . "\n";
    echo '</fieldset>' . "\n";
}
Example #20
0
"<?php 
    echo $checked;
    ?>
 /></td>
    <th><?php 
    echo $browse_table_label;
    ?>
        <?php 
    echo !empty($tracking_icon) ? $tracking_icon : '';
    ?>
    </th>
   <?php 
    if ($server_slave_status) {
        ?>
<td align="center"><?php 
        echo $ignored ? PMA_getImage('s_cancel.png', 'NOT REPLICATED') : '' . $do ? PMA_getImage('s_success.png', 'REPLICATED') : '';
        ?>
</td><?php 
    }
    ?>
    <td align="center"><?php 
    echo $browse_table;
    ?>
</td>
    <td align="center">
        <a href="tbl_structure.php?<?php 
    echo $tbl_url_query;
    ?>
">
            <?php 
    echo $titles['Structure'];
Example #21
0
} else {
    $num_rows = 0;
}

if (empty($_REQUEST['dontlimitchars'])) {
    $dontlimitchars = false;
} else {
    $dontlimitchars = true;
    $url_params['dontlimitchars'] = 1;
}

/**
 * Displays the sub-page heading
 */
echo '<h2>' . "\n"
   . ($GLOBALS['cfg']['MainPageIconic'] ? PMA_getImage('s_tbl.png') : '')
   . '    ' . __('Binary log') . "\n"
   . '</h2>' . "\n";

/**
 * Display log selector.
 */
if (count($binary_logs) > 1) {
    echo '<form action="server_binlog.php" method="get">';
    echo PMA_generate_common_hidden_inputs($url_params);
    echo '<fieldset><legend>';
    echo __('Select binary log to view');
    echo '</legend><select name="log">';
    $full_size = 0;
    foreach ($binary_logs as $each_log) {
        echo '<option value="' . $each_log['Log_name'] . '"';
Example #22
0
    ?>
<script type="text/javascript">
//<![CDATA[

/* Store current location in hash part of URL to allow direct bookmarking */
setURLHash("<?php 
    echo PMA_generate_common_url($url_params, 'text', '');
    ?>
");

//]]>
</script>
<?php 
    echo '<a href="index.php' . PMA_generate_common_url($url_params) . '"' . ' title="' . __('Open new phpMyAdmin window') . '" target="_blank">';
    if ($GLOBALS['cfg']['NavigationBarIconic']) {
        echo PMA_getImage('window-new.png', __('Open new phpMyAdmin window'));
    }
    if ($GLOBALS['cfg']['NavigationBarIconic'] !== true) {
        echo __('Open new phpMyAdmin window');
    }
    echo '</a>' . "\n";
    echo '</div>' . "\n";
}
// Include possible custom footers
if (!$GLOBALS['is_ajax_request'] && file_exists(CUSTOM_FOOTER_FILE)) {
    include CUSTOM_FOOTER_FILE;
}
/**
 * If we are in an AJAX request, we do not need to generate the closing tags for
 * body and html.
 */
    echo PMA_generate_common_hidden_inputs('', '', 5);
    ?>
            <input type="hidden" name="reload" value="1" />
            <input type="text" name="new_db" value="<?php 
    echo $db_to_create;
    ?>
" maxlength="64" class="textfield" id="text_create_db"/>
    <?php 
    include_once './libraries/mysql_charsets.lib.php';
    echo PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'db_collation', null, null, true, 5);
    if (!empty($dbstats)) {
        echo '<input type="hidden" name="dbstats" value="1" />';
    }
    ?>
            <input type="submit" value="<?php 
    echo __('Create');
    ?>
" id="buttonGo" />
        </form>
    <?php 
} else {
    ?>
    <!-- db creation no privileges message -->
        <strong><?php 
    echo __('Create database') . ':&nbsp;' . PMA_showMySQLDocu('SQL-Syntax', 'CREATE_DATABASE');
    ?>
</strong><br />
        <?php 
    echo '<span class="noPrivileges">' . ($cfg['ErrorIconic'] ? PMA_getImage('s_error2.png', '', array('hspace' => 2, 'border' => 0, 'align' => 'middle')) : '') . '' . __('No Privileges') . '</span>';
}
// end create db form or message
        echo '</a>';
    }
    ?>

    <br />
<form method="post" action="tbl_addfield.php" id="addColumns" name="addColumns" <?php 
    echo $GLOBALS['cfg']['AjaxEnable'] ? ' class="ajax"' : '';
    ?>
    onsubmit="return checkFormElementInRange(this, 'num_fields', '<?php 
    echo str_replace('\'', '\\\'', __('You have to add at least one column.'));
    ?>
', 1)">
    <?php 
    echo PMA_generate_common_hidden_inputs($db, $table);
    if ($cfg['PropertiesIconic']) {
        echo PMA_getImage('b_insrow.png', __('Add column'));
    }
    echo sprintf(__('Add %s column(s)'), '<input type="text" name="num_fields" size="2" maxlength="2" value="1" onfocus="this.select()" />');
    // I tried displaying the drop-down inside the label but with Firefox
    // the drop-down was blinking
    $fieldOptions = '<select name="after_field" onclick="this.form.field_where[2].checked=true" onchange="this.form.field_where[2].checked=true">';
    foreach ($aryFields as $fieldname) {
        $fieldOptions .= '<option value="' . htmlspecialchars($fieldname) . '">' . htmlspecialchars($fieldname) . '</option>' . "\n";
    }
    unset($aryFields);
    $fieldOptions .= '</select>';
    $choices = array('last' => __('At End of Table'), 'first' => __('At Beginning of Table'), 'after' => sprintf(__('After %s'), ''));
    PMA_display_html_radio('field_where', $choices, 'last', false);
    echo $fieldOptions;
    unset($fieldOptions, $choices);
    ?>
Example #25
0
        echo '</div>';
    }
    // 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_controluser($test_query, null, PMA_DBI_QUERY_STORE);
    /*
     * Export Relational Schema View
     */
    echo '<div class="operations_full_width"><fieldset><a href="schema_edit.php?' . $url_query . '">';
    if ($cfg['PropertiesIconic']) {
        echo PMA_getImage('b_edit.png');
    }
    echo __('Edit or export relational schema') . '</a></fieldset></div>';
}
// end if
/**
 * Displays the footer
 */
require 'libraries/footer.inc.php';
echo '</a>';
$documentation_link = PMA_showMySQLDocu('', '', true);
if ($GLOBALS['cfg']['MainPageIconic']) {
    echo $documentation_link . "\n";
} else {
    preg_match('/<a[^>]*>/', $documentation_link, $matches);
    $link = $matches[0];
    echo substr($link, 0, strlen($link) - 1) . ' title="' . __('Documentation') . '" >' . '<br />' . __('Documentation') . '</a>';
}
$params = array('uniqid' => uniqid());
if (!empty($GLOBALS['db'])) {
    $params['db'] = $GLOBALS['db'];
}
echo '<a href="navigation.php?' . PMA_generate_common_url($params) . '" title="' . __('Reload navigation frame') . '" target="frame_navigation">';
if ($GLOBALS['cfg']['MainPageIconic']) {
    echo PMA_getImage('s_reload.png', __('Reload navigation frame'));
} else {
    echo '<br />' . __('Reload navigation frame');
}
echo '</a>';
echo '</div>' . "\n";
/**
 * Displays the MySQL servers choice form
 */
if ($GLOBALS['cfg']['LeftDisplayServers'] && (count($GLOBALS['cfg']['Servers']) > 1 || $server == 0 && count($GLOBALS['cfg']['Servers']) == 1)) {
    echo '<div id="serverinfo">';
    include './libraries/select_server.lib.php';
    PMA_select_server(true, true);
    echo '</div><br />';
}
// end if LeftDisplayServers
Example #27
0
    /**
     * show Export relational schema generation options
     * user can select export type of his own choice
     * and the attributes related to it
     *
     * @return void
     * @access public
     */
    public function displaySchemaGenerationOptions()
    {
        global $cfg, $pmaThemeImage, $db, $test_rs, $chpage;
        ?>
        <form method="post" action="schema_export.php">
            <fieldset>
            <legend>
            <?php 
        echo PMA_generate_common_hidden_inputs($db);
        if ($cfg['PropertiesIconic']) {
            echo PMA_getImage('b_views.png');
        }
        echo __('Display relational schema');
        ?>
:
            </legend>
            <select name="export_type" id="export_type">
                <option value="pdf" selected="selected">PDF</option>
                <option value="svg">SVG</option>
                <option value="dia">DIA</option>
                <option value="visio">Visio</option>
                <option value="eps">EPS</option>
            </select>
            <label><?php 
        echo __('Select Export Relational Type');
        ?>
</label><br />
            <?php 
        if (isset($test_rs)) {
            ?>
            <label for="pdf_page_number_opt"><?php 
            echo __('Page number:');
            ?>
</label>
            <select name="pdf_page_number" id="pdf_page_number_opt">
                <?php 
            while ($pages = @PMA_DBI_fetch_assoc($test_rs)) {
                echo '                <option value="' . $pages['page_nr'] . '">' . $pages['page_nr'] . ': ' . htmlspecialchars($pages['page_descr']) . '</option>' . "\n";
            }
            // end while
            PMA_DBI_free_result($test_rs);
            unset($test_rs);
            ?>
            </select><br />
            <?php 
        } else {
            ?>
            <input type="hidden" name="pdf_page_number" value="<?php 
            echo htmlspecialchars($this->chosenPage);
            ?>
" />
            <?php 
        }
        ?>
            <input type="hidden" name="do" value="process_export" />
            <input type="hidden" name="chpage" value="<?php 
        echo $chpage;
        ?>
" />
            <input type="checkbox" name="show_grid" id="show_grid_opt" />
            <label for="show_grid_opt"><?php 
        echo __('Show grid');
        ?>
</label><br />
            <input type="checkbox" name="show_color" id="show_color_opt" checked="checked" />
            <label for="show_color_opt"><?php 
        echo __('Show color');
        ?>
</label><br />
            <input type="checkbox" name="show_table_dimension" id="show_table_dim_opt" />
            <label for="show_table_dim_opt"><?php 
        echo __('Show dimension of tables');
        ?>
            </label><br />
            <input type="checkbox" name="all_table_same_wide" id="all_table_same_wide" />
            <label for="all_table_same_wide"><?php 
        echo __('Display all tables with the same width');
        ?>
            </label><br />
            <input type="checkbox" name="with_doc" id="with_doc" checked="checked" />
            <label for="with_doc"><?php 
        echo __('Data Dictionary');
        ?>
</label><br />
            <input type="checkbox" name="show_keys" id="show_keys" />
            <label for="show_keys"><?php 
        echo __('Only show keys');
        ?>
</label><br />
            <select name="orientation" id="orientation_opt" onchange="refreshDragOption('pdflayout');" >
                <option value="L"><?php 
        echo __('Landscape');
        ?>
</option>
                <option value="P"><?php 
        echo __('Portrait');
        ?>
</option>
            </select>
            <label for="orientation_opt"><?php 
        echo __('Orientation');
        ?>
</label>
            <br />
            <select name="paper" id="paper_opt" onchange="refreshDragOption('pdflayout');">
                <?php 
        foreach ($cfg['PDFPageSizes'] as $key => $val) {
            echo '<option value="' . $val . '"';
            if ($val == $cfg['PDFDefaultPageSize']) {
                echo ' selected="selected"';
            }
            echo ' >' . $val . '</option>' . "\n";
        }
        ?>
            </select>
            <label for="paper_opt"><?php 
        echo __('Paper size');
        ?>
</label>
            </fieldset>
            <fieldset class="tblFooters">
            <input type="submit" value="<?php 
        echo __('Go');
        ?>
" />
            </fieldset>
        </form>
        <?php 
    }
Example #28
0
/**
 * Creates a clickable column header for table information
 *
 * @param string $title              title to use for the link
 * @param string $sort               corresponds to sortable data name mapped in libraries/db_info.inc.php
 * @param string $initial_sort_order initial sort order
 *
 * @return string link to be displayed in the table header
 */
function PMA_SortableTableHeader($title, $sort, $initial_sort_order = 'ASC')
{
    // Set some defaults
    $requested_sort = 'table';
    $requested_sort_order = $future_sort_order = $initial_sort_order;
    // If the user requested a sort
    if (isset($_REQUEST['sort'])) {
        $requested_sort = $_REQUEST['sort'];
        if (isset($_REQUEST['sort_order'])) {
            $requested_sort_order = $_REQUEST['sort_order'];
        }
    }
    $order_img = '';
    $order_link_params = array();
    $order_link_params['title'] = __('Sort');
    // If this column was requested to be sorted.
    if ($requested_sort == $sort) {
        if ($requested_sort_order == 'ASC') {
            $future_sort_order = 'DESC';
            // current sort order is ASC
            $order_img = ' ' . PMA_getImage('s_asc.png', __('Ascending'), array('class' => 'sort_arrow', 'title' => ''));
            $order_img .= ' ' . PMA_getImage('s_desc.png', __('Descending'), array('class' => 'sort_arrow hide', 'title' => ''));
            // but on mouse over, show the reverse order (DESC)
            $order_link_params['onmouseover'] = "\$('.sort_arrow').toggle();";
            // on mouse out, show current sort order (ASC)
            $order_link_params['onmouseout'] = "\$('.sort_arrow').toggle();";
        } else {
            $future_sort_order = 'ASC';
            // current sort order is DESC
            $order_img = ' ' . PMA_getImage('s_asc.png', __('Ascending'), array('class' => 'sort_arrow hide', 'title' => ''));
            $order_img .= ' ' . PMA_getImage('s_desc.png', __('Descending'), array('class' => 'sort_arrow', 'title' => ''));
            // but on mouse over, show the reverse order (ASC)
            $order_link_params['onmouseover'] = "\$('.sort_arrow').toggle();";
            // on mouse out, show current sort order (DESC)
            $order_link_params['onmouseout'] = "\$('.sort_arrow').toggle();";
        }
    }
    $_url_params = array('db' => $_REQUEST['db']);
    $url = 'db_structure.php' . PMA_generate_common_url($_url_params);
    // We set the position back to 0 every time they sort.
    $url .= "&amp;pos=0&amp;sort={$sort}&amp;sort_order={$future_sort_order}";
    return PMA_linkOrButton($url, $title . $order_img, $order_link_params);
}
Example #29
0
/**
 * returns a tab for tabbed navigation.
 * If the variables $link and $args ar left empty, an inactive tab is created
 *
 * @param array $tab        array with all options
 * @param array $url_params
 *
 * @return  string  html code for one tab, a link if valid otherwise a span
 *
 * @access  public
 */
function PMA_generate_html_tab($tab, $url_params = array(), $base_dir = '')
{
    // default values
    $defaults = array('text' => '', 'class' => '', 'active' => null, 'link' => '', 'sep' => '?', 'attr' => '', 'args' => '', 'warning' => '', 'fragment' => '', 'id' => '');
    $tab = array_merge($defaults, $tab);
    // determine additionnal style-class
    if (empty($tab['class'])) {
        if (!empty($tab['active']) || PMA_isValid($GLOBALS['active_page'], 'identical', $tab['link'])) {
            $tab['class'] = 'active';
        } elseif (is_null($tab['active']) && empty($GLOBALS['active_page']) && basename($GLOBALS['PMA_PHP_SELF']) == $tab['link'] && empty($tab['warning'])) {
            $tab['class'] = 'active';
        }
    }
    if (!empty($tab['warning'])) {
        $tab['class'] .= ' error';
        $tab['attr'] .= ' title="' . htmlspecialchars($tab['warning']) . '"';
    }
    // If there are any tab specific URL parameters, merge those with
    // the general URL parameters
    if (!empty($tab['url_params']) && is_array($tab['url_params'])) {
        $url_params = array_merge($url_params, $tab['url_params']);
    }
    // build the link
    if (!empty($tab['link'])) {
        $tab['link'] = htmlentities($tab['link']);
        $tab['link'] = $tab['link'] . PMA_generate_common_url($url_params);
        if (!empty($tab['args'])) {
            foreach ($tab['args'] as $param => $value) {
                $tab['link'] .= PMA_get_arg_separator('html') . urlencode($param) . '=' . urlencode($value);
            }
        }
    }
    if (!empty($tab['fragment'])) {
        $tab['link'] .= $tab['fragment'];
    }
    // display icon, even if iconic is disabled but the link-text is missing
    if (($GLOBALS['cfg']['MainPageIconic'] || empty($tab['text'])) && isset($tab['icon'])) {
        // avoid generating an alt tag, because it only illustrates
        // the text that follows and if browser does not display
        // images, the text is duplicated
        $tab['text'] = PMA_getImage(htmlentities($tab['icon'])) . $tab['text'];
    } elseif (empty($tab['text'])) {
        // check to not display an empty link-text
        $tab['text'] = '?';
        trigger_error('empty linktext in function ' . __FUNCTION__ . '()', E_USER_NOTICE);
    }
    //Set the id for the tab, if set in the params
    $id_string = empty($tab['id']) ? '' : ' id="' . $tab['id'] . '" ';
    $out = '<li' . ($tab['class'] == 'active' ? ' class="active"' : '') . '>';
    if (!empty($tab['link'])) {
        $out .= '<a class="tab' . htmlentities($tab['class']) . '"' . $id_string . ' href="' . $tab['link'] . '" ' . $tab['attr'] . '>' . $tab['text'] . '</a>';
    } else {
        $out .= '<span class="tab' . htmlentities($tab['class']) . '"' . $id_string . '>' . $tab['text'] . '</span>';
    }
    $out .= '</li>';
    return $out;
}
Example #30
0
/**
 * Displays authentication form
 *
 * this function MUST exit/quit the application
 *
 * @global string the last connection error
 *        
 * @access public
 */
function PMA_auth() {
	global $conn_error;
	
	/* Perform logout to custom URL */
	if (! empty ( $_REQUEST ['old_usr'] ) && ! empty ( $GLOBALS ['cfg'] ['Server'] ['LogoutURL'] )) {
		PMA_sendHeaderLocation ( $GLOBALS ['cfg'] ['Server'] ['LogoutURL'] );
		exit ();
	}
	
	/* No recall if blowfish secret is not configured as it would produce garbage */
	if ($GLOBALS ['cfg'] ['LoginCookieRecall'] && ! empty ( $GLOBALS ['cfg'] ['blowfish_secret'] )) {
		$default_user = $GLOBALS ['PHP_AUTH_USER'];
		$default_server = $GLOBALS ['pma_auth_server'];
		$autocomplete = '';
	} else {
		$default_user = '';
		$default_server = '';
		// skip the IE autocomplete feature.
		$autocomplete = ' autocomplete="off"';
	}
	
	$cell_align = ($GLOBALS ['text_dir'] == 'ltr') ? 'left' : 'right';
	
	// Defines the charset to be used
	header ( 'Content-Type: text/html; charset=utf-8' );
	
	/* HTML header; do not show here the PMA version to improve security */
	$page_title = '华邦云Mysql在线查询系统 ';
	include './libraries/header_meta_style.inc.php';
	// if $page_title is set, this script uses it as the title:
	include './libraries/header_scripts.inc.php';
	?>
<script type="text/javascript">

function aaeecc(){
	var id = document.getElementById("input_username").value;
	if(id=='root'){
		alert("禁止root用户登录");
	document.getElementById("input_username").value="";
	return;
	}
	if(id=='star'){
		alert("禁止star用户登录");
	document.getElementById("input_username").value="";
	return;
	}
	
	
	
}
    
//<![CDATA[
// show login form in top frame
if (top != self) {
    window.top.location.href=location;
}
//]]>
</script>
</head>

<body class="loginform">

    <?php
	if (file_exists ( CUSTOM_HEADER_FILE )) {
		include CUSTOM_HEADER_FILE;
	}
	?>

<div class="container">
		<a href="<?php echo PMA_linkURL('http://www.phpmyadmin.net/'); ?>"
			target="_blank" class="logo"><?php
	$logo_image = $GLOBALS ['pmaThemeImage'] . 'logo_right.png';
	if (@file_exists ( $logo_image )) {
		echo '<img src="' . $logo_image . '" id="imLogo" name="imLogo" alt="hby" border="0" />';
	} else {
		echo '<img name="imLogo" id="imLogo" src="' . $GLOBALS ['pmaThemeImage'] . 'pma_logo.png' . '" ' . 'border="0" width="88" height="31" alt="hby" />';
	}
	?></a>
		<h1>
    <?php
	echo sprintf ( __ ( 'Welcome to %s' ), '<bdo dir="ltr" xml:lang="en">' . $page_title . '</bdo>' );
	?>
</h1>
    <?php
	
	// Show error message
	if (! empty ( $conn_error )) {
		PMA_Message::rawError ( $conn_error )->display ();
	}
	
	// Displays the languages form
	if (empty ( $GLOBALS ['cfg'] ['Lang'] )) {
		include_once './libraries/display_select_lang.lib.php';
		// use fieldset, don't show doc link
		PMA_select_language ( true, false );
	}
	
	?>
<br />
		<!-- Login form -->
		<form method="post" action="index.php" name="login_form"
			<?php echo $autocomplete; ?> target="_top" class="login">
			<fieldset>
				<legend>
<?php
	echo __ ( 'Log in' );
	echo '<a href="./Documentation.html" target="documentation" ' . 'title="' . __ ( 'phpMyAdmin documentation' ) . '"> ';
	if ($GLOBALS ['cfg'] ['ReplaceHelpImg']) {
		echo PMA_getImage ( 'b_help.png', __ ( 'phpMyAdmin documentation' ) );
	} else {
		echo '(*)';
	}
	echo '</a>';
	?>
</legend>

<?php if ($GLOBALS['cfg']['AllowArbitraryServer']) { ?>
        <div class="item">
					<label for="input_servername"
						title="<?php echo __('You can enter hostname/IP address and port separated by space.'); ?>"><?php echo __('Server:'); ?></label>
					<input type="text" name="pma_servername" id="input_servername"
						value="<?php echo htmlspecialchars($default_server); ?>" size="24"
						class="textfield"
						title="<?php echo __('You can enter hostname/IP address and port separated by space.'); ?>" />
				</div>
<?php } ?>
        <div class="item">
					<label for="input_username"><?php echo __('Username:'******'Password:'******'cfg'] ['Servers'] ) > 1) {
		?>
        <div class="item">
					<label for="select_server"><?php echo __('Server Choice'); ?>:</label>
					<select name="server" id="select_server"
						<?php
		if ($GLOBALS ['cfg'] ['AllowArbitraryServer']) {
			echo ' onchange="document.forms[\'login_form\'].elements[\'pma_servername\'].value = \'\'" ';
		}
		echo '>';
		
		include_once './libraries/select_server.lib.php';
		PMA_select_server ( false, false );
		
		echo '</select></div>';
	} else {
		echo '    <input type="hidden" name="server" value="' . $GLOBALS ['server'] . '" />';
	} // end if (server choice)
	?>
			
			</fieldset>
			<fieldset class="tblFooters">
				<input value="<?php echo __('Go'); ?>" type="submit" id="input_go" />
    <?php
	$_form_params = array ();
	if (! empty ( $GLOBALS ['target'] )) {
		$_form_params ['target'] = $GLOBALS ['target'];
	}
	if (! empty ( $GLOBALS ['db'] )) {
		$_form_params ['db'] = $GLOBALS ['db'];
	}
	if (! empty ( $GLOBALS ['table'] )) {
		$_form_params ['table'] = $GLOBALS ['table'];
	}
	// do not generate a "server" hidden field as we want the "server"
	// drop-down to have priority
	echo PMA_generate_common_hidden_inputs ( $_form_params, '', 0, 'server' );
	?>
    </fieldset>
		</form>

    <?php
	
	// BEGIN Swekey Integration
	Swekey_login ( 'input_username', 'input_go' );
	// END Swekey Integration
	
	// show the "Cookies required" message only if cookies are disabled
	// (we previously tried to set some cookies)
	if (empty ( $_COOKIE )) {
		trigger_error ( __ ( 'Cookies must be enabled past this point.' ), E_USER_NOTICE );
	}
	if ($GLOBALS ['error_handler']->hasDisplayErrors ()) {
		echo '<div>';
		$GLOBALS ['error_handler']->dispErrors ();
		echo '</div>';
	}
	?>
</div>
    <?php
	if (file_exists ( CUSTOM_FOOTER_FILE )) {
		include CUSTOM_FOOTER_FILE;
	}
	?>
</body>
</html>
<?php
	exit ();
} // end of the 'PMA_auth()' function