Resolved conflicts

This commit is contained in:
Chanaka Indrajith 2012-06-27 21:53:59 +05:30
commit 39d37fafcc
140 changed files with 45629 additions and 45459 deletions

View File

@ -41,6 +41,9 @@ VerboseMultiSubmit, ReplaceHelpImg
+ Ajaxified "Create View" functionality
+ [import] New plugin: import mediawiki
+ Add Ajax support to Fast filter in order to search the term in all database tables
- bug #3535015 [navi] DbFilter, TableFilter clear button hidden on Chrome
3.5.3.0 (not yet released)
3.5.2.0 (not yet released)
- bug #3521416 [interface] JS error when editing index

View File

@ -631,9 +631,10 @@ if ($cfgRelation['pdfwork'] && $num_tables > 0) { ?>
$test_query = '
SELECT *
FROM ' . $common_functions->backquote($GLOBALS['cfgRelation']['db']) . '.' . $common_functions->backquote($cfgRelation['pdf_pages']) . '
FROM ' . $common_functions->backquote($GLOBALS['cfgRelation']['db'])
. '.' . $common_functions->backquote($cfgRelation['pdf_pages']) . '
WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\'';
$test_rs = PMA_query_as_controluser($test_query, null, PMA_DBI_QUERY_STORE);
$test_rs = PMA_queryAsControlUser($test_query, null, PMA_DBI_QUERY_STORE);
/*
* Export Relational Schema View

View File

@ -103,7 +103,7 @@ $sub_part = '';
if ( $GLOBALS['is_ajax_request'] != true) {
include 'libraries/db_info.inc.php';
echo '<div id="searchresults">';
$response->addHTML('<div id="searchresults">');
}
/**
@ -200,78 +200,134 @@ if (isset($_REQUEST['submit_search'])) {
return $sql;
} // end of the "PMA_getSearchSqls()" function
$response->addHTML(
PMA_dbSearchGetSearchResults(
$tables_selected, $searched, $option_str,
$search_str, $search_option, (! empty($field_str) ? $field_str : '')
)
);
} // end 1.
/**
* Displays the results
*/
/**
* Displays database search results
*
* @param array $tables_selected Tables on which search is to be performed
* @param string $searched The search word/phrase/regexp
* @param string $option_str Type of search
* @param string $search_str the string to search
* @param integer $search_option type of search
* (1 -> 1 word at least, 2 -> all words,
* 3 -> exact string, 4 -> regexp)
* @param string $field_str Restrict the search to this field
*
* @return string HTML for search results
*/
function PMA_dbSearchGetSearchResults($tables_selected, $searched, $option_str,
$search_str, $search_option, $field_str = null
) {
$this_url_params = array(
'db' => $GLOBALS['db'],
'goto' => 'db_sql.php',
'pos' => 0,
'is_js_confirmed' => 0,
);
$html_output = '';
// Displays search string
echo '<br />' . "\n"
. '<table class="data">' . "\n"
. '<caption class="tblHeaders">' . "\n"
$html_output .= '<br />'
. '<table class="data">'
. '<caption class="tblHeaders">'
. sprintf(
__('Search results for "<i>%s</i>" %s:'),
$searched, $option_str
) . "\n"
. '</caption>' . "\n";
)
. '</caption>';
$num_search_result_total = 0;
$odd_row = true;
// For each table selected as search criteria
foreach ($tables_selected as $each_table) {
// Gets the SQL statements
$newsearchsqls = PMA_getSearchSqls(
$each_table, (! empty($field_str) ? $field_str : ''),
$search_str, $search_option
);
// Executes the "COUNT" statement
$res_cnt = PMA_DBI_fetch_value($newsearchsqls['select_count']);
$num_search_result_total += $res_cnt;
$sql_query .= $newsearchsqls['select_count'];
echo '<tr class="noclick ' . ($odd_row ? 'odd' : 'even') . '">'
. '<td>' . sprintf(
_ngettext('%1$s match inside table <i>%2$s</i>', '%1$s matches inside table <i>%2$s</i>', $res_cnt),
$res_cnt, htmlspecialchars($each_table)
) . "</td>\n";
if ($res_cnt > 0) {
$this_url_params['sql_query'] = $newsearchsqls['select_fields'];
$browse_result_path = 'sql.php' . PMA_generate_common_url($this_url_params);
?>
<td> <a name="browse_search" href="<?php echo $browse_result_path; ?>" onclick="loadResult('<?php echo $browse_result_path ?> ',' <?php echo $each_table?> ' , '<?php echo PMA_generate_common_url($GLOBALS['db'], $each_table)?>','<?php echo ($GLOBALS['cfg']['AjaxEnable']); ?>');return false;" ><?php echo __('Browse') ?></a> </td>
<?php
$this_url_params['sql_query'] = $newsearchsqls['delete'];
$delete_result_path = 'sql.php' . PMA_generate_common_url($this_url_params);
?>
<td> <a name="delete_search" href="<?php echo $delete_result_path; ?>" onclick="deleteResult('<?php echo $delete_result_path ?>' , ' <?php printf(__('Delete the matches for the %s table?'), htmlspecialchars($each_table)); ?>','<?php echo ($GLOBALS['cfg']['AjaxEnable']); ?>');return false;" ><?php echo __('Delete') ?></a> </td>
<?php
} else {
echo '<td>&nbsp;</td>' . "\n"
.'<td>&nbsp;</td>' . "\n";
}// end if else
$html_output .= PMA_dbSearchGetResultsRow(
$each_table, $newsearchsqls, $odd_row
);
$odd_row = ! $odd_row;
echo '</tr>' . "\n";
} // end for
echo '</table>' . "\n";
$html_output .= '</table>';
if (count($tables_selected) > 1) {
echo '<p>' . sprintf(
_ngettext('<b>Total:</b> <i>%s</i> match', '<b>Total:</b> <i>%s</i> matches', $num_search_result_total),
$html_output .= '<p>';
$html_output .= sprintf(
_ngettext(
'<b>Total:</b> <i>%s</i> match',
'<b>Total:</b> <i>%s</i> matches',
$num_search_result_total
),
$num_search_result_total
) . '</p>' . "\n";
);
$html_output .= '</p>';
}
} // end 1.
return $html_output;
}
/**
* Provides search results row with browse/delete links.
* (for a table)
*
* @param string $each_table Tables on which search is to be performed
* @param array $newsearchsqls Contains SQL queries
* @param bool $odd_row For displaying contrasting table rows
*
* @return string HTML row
*/
function PMA_dbSearchGetResultsRow($each_table, $newsearchsqls, $odd_row)
{
$res_cnt = PMA_DBI_fetch_value($newsearchsqls['select_count']);
// Start forming search results row
$html_output = '<tr class="noclick ' . ($odd_row ? 'odd' : 'even') . '">';
$html_output .= '<td>';
$html_output .= sprintf(
_ngettext(
'%1$s match in <strong>%2$s</strong>',
'%1$s matches in <strong>%2$s</strong>', $res_cnt
),
$res_cnt, htmlspecialchars($each_table)
);
$html_output .= '</td>';
if ($res_cnt > 0) {
$this_url_params['sql_query'] = $newsearchsqls['select_fields'];
$browse_result_path = 'sql.php' . PMA_generate_common_url($this_url_params);
$html_output .= '<td><a name="browse_search" href="'
. $browse_result_path . '" onclick="loadResult(\''
. $browse_result_path . '\',\'' . $each_table . '\',\''
. PMA_generate_common_url($GLOBALS['db'], $each_table) . '\',\''
. ($GLOBALS['cfg']['AjaxEnable']) .'\');return false;" >'
. __('Browse') . '</a></td>';
$this_url_params['sql_query'] = $newsearchsqls['delete'];
$delete_result_path = 'sql.php' . PMA_generate_common_url($this_url_params);
$html_output .= '<td><a name="delete_search" href="'
. $delete_result_path . '" onclick="deleteResult(\''
. $delete_result_path . '\' , \''
. sprintf(
__('Delete the matches for the %s table?'),
htmlspecialchars($each_table)
)
. '\',\'' . ($GLOBALS['cfg']['AjaxEnable']) . '\');return false;">'
. __('Delete') . '</a></td>';
} else {
$html_output .= '<td>&nbsp;</td>'
.'<td>&nbsp;</td>';
}// end if else
$html_output .= '</tr>';
return $html_output;
}
/**
* If we are in an Ajax request, we need to exit after displaying all the HTML
@ -279,98 +335,134 @@ if (isset($_REQUEST['submit_search'])) {
if ($GLOBALS['is_ajax_request'] == true) {
exit;
} else {
echo '</div>';//end searchresults div
$response->addHTML('</div>');//end searchresults div
}
/**
* 2. Displays the main search form
* Provides the main search form's html
*
* @param string $searched Keyword/Regular expression to be searched
* @param integer $search_option Type of search (one word, phrase etc.)
* @param array $tables_names_only Names of all tables
* @param array $tables_selected Tables on which search is to be performed
* @param array $url_params URL parameters
* @param string $field_str Restrict the search to this field
*
* @return string HTML for selection form
*/
?>
<a id="db_search"></a>
<form id="db_search_form"<?php echo ($GLOBALS['cfg']['AjaxEnable'] ? ' class="ajax"' : ''); ?> method="post" action="db_search.php" name="db_search">
<?php echo PMA_generate_common_hidden_inputs($GLOBALS['db']); ?>
<fieldset>
<legend><?php echo __('Search in database'); ?></legend>
function PMA_dbSearchGetSelectionForm($searched, $search_option, $tables_names_only,
$tables_selected, $url_params, $field_str = null
) {
$common_functions = PMA_CommonFunctions::getInstance();
$html_output = '<a id="db_search"></a>';
$html_output .= '<form id="db_search_form"'
. ($GLOBALS['cfg']['AjaxEnable'] ? ' class="ajax"' : '')
. ' method="post" action="db_search.php" name="db_search">';
$html_output .= PMA_generate_common_hidden_inputs($GLOBALS['db']);
$html_output .= '<fieldset>';
// set legend caption
$html_output .= '<legend>' . __('Search in database') . '</legend>';
$html_output .= '<table class="formlayout">';
// inputbox for search phrase
$html_output .= '<tr>';
$html_output .= '<td>' . __('Words or values to search for (wildcard: "%"):')
. '</td>';
$html_output .= '<td><input type="text" name="search_str" size="60"'
. ' value="' . $searched . '" /></td>';
$html_output .= '</tr>';
// choices for types of search
$html_output .= '<tr>';
$html_output .= '<td class="right vtop">' . __('Find:') . '</td>';
$html_output .= '<td>';
$choices = array(
'1' => __('at least one of the words') . $common_functions->showHint(__('Words are separated by a space character (" ").')),
'2' => __('all words') . $common_functions->showHint(__('Words are separated by a space character (" ").')),
'3' => __('the exact phrase'),
'4' => __('as regular expression') . ' ' . $common_functions->showMySQLDocu('Regexp', 'Regexp')
);
// 4th parameter set to true to add line breaks
// 5th parameter set to false to avoid htmlspecialchars() escaping in the label
// since we have some HTML in some labels
$html_output .= $common_functions->getRadioFields(
'search_option', $choices, $search_option, true, false
);
$html_output .= '</td></tr>';
// displays table names as select options
$html_output .= '<tr>';
$html_output .= '<td class="right vtop">' . __('Inside tables:') . '</td>';
$html_output .= '<td rowspan="2">';
$html_output .= '<select name="table_select[]" size="6" multiple="multiple">';
foreach ($tables_names_only as $each_table) {
if (in_array($each_table, $tables_selected)) {
$is_selected = ' selected="selected"';
} else {
$is_selected = '';
}
$html_output .= '<option value="' . htmlspecialchars($each_table) . '"'
. $is_selected . '>'
. str_replace(' ', '&nbsp;', htmlspecialchars($each_table))
. '</option>';
} // end for
$html_output .= '</select>';
$alter_select
= '<a href="db_search.php' . PMA_generate_common_url(array_merge($url_params, array('selectall' => 1))) . '#db_search"'
. ' onclick="setSelectOptions(\'db_search\', \'table_select[]\', true); return false;">' . __('Select All') . '</a>'
. '&nbsp;/&nbsp;'
. '<a href="db_search.php' . PMA_generate_common_url(array_merge($url_params, array('unselectall' => 1))) . '#db_search"'
. ' onclick="setSelectOptions(\'db_search\', \'table_select[]\', false); return false;">' . __('Unselect All') . '</a>';
$html_output .= '</td></tr>';
$html_output .= '<tr><td class="right vbottom">' . $alter_select . '</td></tr>';
$html_output .= '<tr>';
$html_output .= '<td class="right">' . __('Inside column:') . '</td>';
$html_output .= '<td><input type="text" name="field_str" size="60"'
. 'value="' . (! empty($field_str) ? htmlspecialchars($field_str) : '')
. '" /></td>';
$html_output .= '</tr>';
$html_output .= '</table>';
$html_output .= '</fieldset>';
$html_output .= '<fieldset class="tblFooters">';
$html_output .= '<input type="submit" name="submit_search" value="'
. __('Go') . '" id="buttonGo" />';
$html_output .= '</fieldset>';
$html_output .= '</form>';
$html_output .= getResultDivs();
return $html_output;
}
<table class="formlayout">
<tr><td><?php echo __('Words or values to search for (wildcard: "%"):'); ?></td>
<td><input type="text" name="search_str" size="60"
value="<?php echo $searched; ?>" /></td>
</tr>
<tr><td class="right vtop">
<?php echo __('Find:'); ?></td>
<td><?php
/**
* Provides div tags for browsing search results and sql query form.
*
* @return string div tags
*/
function getResultDivs()
{
$html_output = '<!-- These two table-image and table-link elements display'
. ' the table name in browse search results -->';
$html_output .= '<div id="table-info">';
$html_output .= '<a class="item" id="table-link" ></a>';
$html_output .= '</div>';
// div for browsing results
$html_output .= '<div id="browse-results">';
$html_output .= '<!-- this browse-results div is used to load the browse and delete'
. ' results in the db search -->';
$html_output .= '</div>';
$html_output .= '<br class="clearfloat" />';
$html_output .= '<div id="sqlqueryform">';
$html_output .= '<!-- this sqlqueryform div is used to load the delete form in'
. ' the db search -->';
$html_output .= '</div>';
$html_output .= '<!-- toggle query box link-->';
$html_output .= '<a id="togglequerybox"></a>';
return $html_output;
}
$choices = array(
'1' => __('at least one of the words') . $common_functions->showHint(__('Words are separated by a space character (" ").')),
'2' => __('all words') . $common_functions->showHint(__('Words are separated by a space character (" ").')),
'3' => __('the exact phrase'),
'4' => __('as regular expression') . ' ' . $common_functions->showMySQLDocu('Regexp', 'Regexp')
$response->addHTML(
PMA_dbSearchGetSelectionForm(
$searched, $search_option, $tables_names_only, $tables_selected, $url_params,
(! empty($field_str) ? $field_str : '')
)
);
// 4th parameter set to true to add line breaks
// 5th parameter set to false to avoid htmlspecialchars() escaping in the label
// since we have some HTML in some labels
echo $common_functions->getRadioFields(
'search_option', $choices, $search_option, true, false
);
unset($choices);
?>
</td>
</tr>
<tr><td class="right vtop">
<?php echo __('Inside tables:'); ?></td>
<td rowspan="2">
<?php
echo ' <select name="table_select[]" size="6" multiple="multiple">' . "\n";
foreach ($tables_names_only as $each_table) {
if (in_array($each_table, $tables_selected)) {
$is_selected = ' selected="selected"';
} else {
$is_selected = '';
}
echo ' <option value="' . htmlspecialchars($each_table) . '"'
. $is_selected . '>'
. str_replace(' ', '&nbsp;', htmlspecialchars($each_table)) . '</option>' . "\n";
} // end while
echo ' </select>' . "\n";
$alter_select
= '<a href="db_search.php' . PMA_generate_common_url(array_merge($url_params, array('selectall' => 1))) . '#db_search"'
. ' onclick="setSelectOptions(\'db_search\', \'table_select[]\', true); return false;">' . __('Select All') . '</a>'
. '&nbsp;/&nbsp;'
. '<a href="db_search.php' . PMA_generate_common_url(array_merge($url_params, array('unselectall' => 1))) . '#db_search"'
. ' onclick="setSelectOptions(\'db_search\', \'table_select[]\', false); return false;">' . __('Unselect All') . '</a>';
?>
</td>
</tr>
<tr><td class="right vbottom">
<?php echo $alter_select; ?></td>
</tr>
<tr><td class="right">
<?php echo __('Inside column:'); ?></td>
<td><input type="text" name="field_str" size="60"
value="<?php echo ! empty($field_str) ? htmlspecialchars($field_str) : ''; ?>" /></td>
</tr>
</table>
</fieldset>
<fieldset class="tblFooters">
<input type="submit" name="submit_search" value="<?php echo __('Go'); ?>"
id="buttonGo" />
</fieldset>
</form>
<!-- These two table-image and table-link elements display the table name in browse search results -->
<div id='table-info'>
<a class="item" id="table-link" ></a>
</div>
<div id="browse-results">
<!-- this browse-results div is used to load the browse and delete results in the db search -->
</div>
<br class="clearfloat" />
<div id="sqlqueryform">
<!-- this sqlqueryform div is used to load the delete form in the db search -->
</div>
<!-- toggle query box link-->
<a id="togglequerybox"></a>

View File

@ -460,7 +460,7 @@ foreach ($tables as $keyname => $each_table) {
?>"
id="row_tbl_<?php echo $i; ?>">
<td class="center">
<input type="checkbox" name="selected_tbl[]"
<input type="checkbox" name="selected_tbl[]" class="checkall"
value="<?php echo htmlspecialchars($each_table['TABLE_NAME']); ?>"
id="checkbox_tbl_<?php echo $i; ?>"<?php echo $checked; ?> /></td>
<th><?php echo $browse_table_label; ?>
@ -684,13 +684,8 @@ $checkall_url = 'db_structure.php?' . PMA_generate_common_url($db);
?>
<img class="selectallarrow" src="<?php echo $pmaThemeImage .'arrow_'.$text_dir.'.png'; ?>"
width="38" height="22" alt="<?php echo __('With selected:'); ?>" />
<a href="<?php echo $checkall_url; ?>&amp;checkall=1"
onclick="if (markAllRows('tablesForm')) return false;">
<?php echo __('Check All'); ?></a>
/
<a href="<?php echo $checkall_url; ?>"
onclick="if (unMarkAllRows('tablesForm')) return false;">
<?php echo __('Uncheck All'); ?></a>
<input type="checkbox" id="checkall" title="<?php echo __('Check All'); ?>" />
<label for="checkall"><?php echo __('Check All'); ?></label>
<?php if ($overhead_check != '') { ?>
/
<a href="#" onclick="unMarkAllRows('tablesForm');

View File

@ -67,7 +67,7 @@ $all_tables_query = ' SELECT table_name, MAX(version) as version FROM ' .
' GROUP BY table_name' .
' ORDER BY table_name ASC';
$all_tables_result = PMA_query_as_controluser($all_tables_query);
$all_tables_result = PMA_queryAsControlUser($all_tables_query);
// If a HEAD version exists
if (PMA_DBI_num_rows($all_tables_result) > 0) {
@ -113,7 +113,7 @@ if (PMA_DBI_num_rows($all_tables_result) > 0) {
. '\' AND `table_name` = \'' . $common_functions->sqlAddSlashes($table_name)
. '\' AND `version` = \'' . $version_number . '\'';
$table_result = PMA_query_as_controluser($table_query);
$table_result = PMA_queryAsControlUser($table_query);
$version_data = PMA_DBI_fetch_array($table_result);
if ($version_data['tracking_active'] == 1) {

View File

@ -394,7 +394,7 @@ if (! $save_on_server) {
// (avoid rewriting data containing HTML with anchors and forms;
// this was reported to happen under Plesk)
@ini_set('url_rewriter.tags', '');
$filename = PMA_sanitize_filename($filename);
$filename = PMA_sanitizeFilename($filename);
PMA_downloadHeader($filename, $mime_type);
} else {
@ -748,7 +748,7 @@ if (! empty($asfile)) {
// 1. as a zipped file
if ($compression == 'zip') {
if (@function_exists('gzcompress')) {
$zipfile = new zipfile();
$zipfile = new ZipFile();
$zipfile -> addFile($dump_buffer, substr($filename, 0, -4));
$dump_buffer = $zipfile -> file();
}

View File

@ -24,60 +24,33 @@ if (version_compare(PHP_VERSION, '5.4.0', '>=')
&& ini_get('session.upload_progress.enabled')
) {
if (!isset($_POST['session_upload_progress'])) {
$sessionupload = array();
$prefix = ini_get('session.upload_progress.prefix');
$sessionupload = array();
$prefix = ini_get('session.upload_progress.prefix');
session_start();
foreach ($_SESSION as $key => $value) {
// only copy session-prefixed data
if (substr($key, 0, strlen($prefix)) == $prefix) {
$sessionupload[$key] = $value;
}
session_start();
foreach ($_SESSION as $key => $value) {
// only copy session-prefixed data
if (substr($key, 0, strlen($prefix)) == $prefix) {
$sessionupload[$key] = $value;
}
// perform internal self-request
$url = 'http' .
((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 's' : '') .
'://' . $_SERVER['HTTP_HOST'] .
$_SERVER['REQUEST_URI'];
if (!function_exists('curl_exec') || !function_exists('getallheaders')) {
die();
}
$headers = @getallheaders();
if (!isset($headers['Cookie'])) {
die();
}
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt(
$ch, CURLOPT_POSTFIELDS,
'session_upload_progress=' . rawurlencode(serialize($sessionupload))
);
curl_setopt($ch, CURLOPT_COOKIE, $headers['Cookie']);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
curl_setopt($ch, CURLOPT_TIMEOUT, 3);
// to avoid problems with self-signed certs
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
// show the result of the internal request
echo @curl_exec($ch);
die();
}
// PMA will kill all variables, so let's use a constant
define('SESSIONUPLOAD', serialize($sessionupload));
session_write_close();
session_name('phpMyAdmin');
session_id($_COOKIE['phpMyAdmin']);
}
define('PMA_MINIMUM_COMMON', 1);
require_once 'libraries/common.inc.php';
require_once 'libraries/display_import_ajax.lib.php';
if (isset($_POST['session_upload_progress'])) {
// this is the internal request response
// restore sessionupload from the POSTed data (see above),
// then write sessionupload back into the loaded session
if (defined('SESSIONUPLOAD')) {
// write sessionupload back into the loaded PMA session
$sessionupload = unserialize($_POST['session_upload_progress']);
$sessionupload = unserialize(SESSIONUPLOAD);
foreach ($sessionupload as $key => $value) {
$_SESSION[$key] = $value;
}

View File

@ -558,7 +558,7 @@ $(function() {
var checked = $checkbox.prop('checked');
if (!$(e.target).is(':checkbox, label')) {
checked = !checked;
$checkbox.prop('checked', checked);
$checkbox.prop('checked', checked).trigger('change');
}
if (checked) {
$tr.addClass('marked');
@ -593,7 +593,8 @@ $(function() {
.slice(start, end + 1)
.removeClass('marked')
.find(':checkbox')
.prop('checked', false);
.prop('checked', false)
.trigger('change');
}
// handle new shift click
@ -609,7 +610,8 @@ $(function() {
.slice(start, end + 1)
.addClass('marked')
.find(':checkbox')
.prop('checked', true);
.prop('checked', true)
.trigger('change');
// remember the last shift clicked row
last_shift_clicked_row = curr_row;
@ -617,7 +619,7 @@ $(function() {
});
addDateTimePicker();
/**
* Add attribute to text boxes for iOS devices (based on bugID: 3508912)
*/
@ -669,6 +671,7 @@ function markAllRows(container_id)
{
$("#" + container_id).find("input:checkbox:enabled").prop('checked', true)
.trigger("change")
.parents("tr").addClass("marked");
return true;
}
@ -683,6 +686,7 @@ function unMarkAllRows(container_id)
{
$("#" + container_id).find("input:checkbox:enabled").prop('checked', false)
.trigger("change")
.parents("tr").removeClass("marked");
return true;
}
@ -1879,7 +1883,7 @@ function PMA_createProfilingChartJqplot(target, data)
seriesDefaults: {
renderer: $.jqplot.PieRenderer,
rendererOptions: {
showDataLabels: true
showDataLabels: true
}
},
legend: {
@ -3782,6 +3786,33 @@ $(document).ready(function () {
}); // end $.live()
});
/**
* Watches checkboxes in a form to set the checkall box accordingly
*/
var checkboxes_sel = "input.checkall:checkbox:enabled";
$(checkboxes_sel).live("change", function () {
var $form = $(this.form);
// total number of checkboxes in current form
var total_boxes = $form.find(checkboxes_sel).length;
// number of checkboxes checked in current form
var checked_boxes = $form.find(checkboxes_sel + ":checked").length;
var $checkall = $form.find("input#checkall");
if (total_boxes == checked_boxes) {
$checkall.prop({checked: true, indeterminate: false});
}
else if (checked_boxes > 0) {
$checkall.prop({checked: true, indeterminate: true});
}
else {
$checkall.prop({checked: false, indeterminate: false});
}
});
$("input#checkall").live("change", function() {
var is_checked = $(this).is(":checked");
$(this.form).find(checkboxes_sel).prop("checked", is_checked)
.parents("tr").toggleClass("marked", is_checked);
});
/**
* Toggles row colors of a set of 'tr' elements starting from a given element
*

View File

@ -30,7 +30,8 @@ $(function() {
* @var selected_dbs Array containing the names of the checked databases
*/
var selected_dbs = [];
$form.find('input:checkbox:checked').each(function () {
// loop over all checked checkboxes, except the #checkall checkbox
$form.find('input:checkbox:checked:not(#checkall)').each(function () {
$(this).closest('tr').addClass('removeMe');
selected_dbs[selected_dbs.length] = 'DROP DATABASE `' + escapeHtml($(this).val()) + '`;';
});

View File

@ -12,7 +12,7 @@ if (! defined('PHPMYADMIN')) {
/**
* Load vendor configuration.
*/
require './libraries/vendor_config.php';
require_once './libraries/vendor_config.php';
/**
* Configuration class

View File

@ -4275,10 +4275,6 @@ class PMA_DisplayResults
'sql_query' => $this->_sql_query,
'goto' => $this->_goto,
);
$uncheckall_url = 'sql.php' . PMA_generate_common_url($_url_params);
$_url_params['checkall'] = '1';
$checkall_url = 'sql.php' . PMA_generate_common_url($_url_params);
if ($_SESSION['tmp_user_values']['disp_direction'] == self::DISP_DIR_VERTICAL) {
@ -4312,10 +4308,9 @@ class PMA_DisplayResults
. ' alt="' . __('With selected:') . '" />';
}
$links_html .= $checkall_link . "\n"
. ' / ' . "\n"
. $uncheckall_link . "\n"
. '<i>' . __('With selected:') . '</i>' . "\n";
$links_html .= '<input type="checkbox" id="checkall" title="' . __('Check All') . '" /> '
. '<label for="checkall">' . __('Check All') . '</label> '
. '<i style="margin-left: 2em">' . __('With selected:') . '</i>' . "\n";
$links_html .= $this->getCommonFunctions()->getButtonOrImage(
'submit_mult', 'mult_submit', 'submit_mult_change',
@ -4566,13 +4561,13 @@ class PMA_DisplayResults
* @param string $transform_options transformation parameters
* @param string $default_function default transformation function
* @param object $meta the meta-information about this field
* @param array $url_params parameters that should go to the
* @param array $url_params parameters that should go to the
* download link
*
* @return mixed string or float
*
*
* @access private
*
*
* @see _getDataCellForBlobColumns(), _getDataCellForGeometryColumns(),
* _getDataCellForNonNumericAndNonBlobColumns(),
* _getSortedColumnMessage()
@ -4656,12 +4651,12 @@ class PMA_DisplayResults
* @param bool $is_field_truncated whether the field is truncated
*
* @return string formatted data
*
*
* @access private
*
*
* @see _getDataCellForNumericColumns(), _getDataCellForGeometryColumns(),
* _getDataCellForNonNumericAndNonBlobColumns(),
*
*
*/
private function _getRowData(
$class, $condition_field, $analyzed_sql, $meta, $map, $data,
@ -4838,9 +4833,9 @@ class PMA_DisplayResults
* @param string $class css classes for the td element
*
* @return string the generated HTML
*
*
* @access private
*
*
* @see _getTableBody(), _getCheckboxAndLinks()
*/
private function _getCheckboxForMultiRowSubmissions(
@ -4861,7 +4856,7 @@ class PMA_DisplayResults
. '<input type="checkbox" id="id_rows_to_delete'
. $row_no . $id_suffix
. '" name="rows_to_delete[' . $row_no . ']"'
. ' class="multi_checkbox"'
. ' class="multi_checkbox checkall"'
. ' value="' . $where_clause_html . '" '
. (isset($GLOBALS['checkall'])
? 'checked="checked"'
@ -4887,9 +4882,9 @@ class PMA_DisplayResults
* @param string $where_clause_html url encoded where clause
*
* @return string the generated HTML
*
*
* @access private
*
*
* @see _getTableBody(), _getCheckboxAndLinks()
*/
private function _getEditLink(
@ -4929,9 +4924,9 @@ class PMA_DisplayResults
* @param string $class css classes for the td element
*
* @return string the generated HTML
*
*
* @access private
*
*
* @see _getTableBody(), _getCheckboxAndLinks()
*/
private function _getCopyLink(
@ -4976,9 +4971,9 @@ class PMA_DisplayResults
* @param string $class css classes for the td element
*
* @return string the generated HTML
*
*
* @access private
*
*
* @see _getTableBody(), _getCheckboxAndLinks()
*/
private function _getDeleteLink($del_url, $del_str, $js_conf, $class)
@ -5027,9 +5022,9 @@ class PMA_DisplayResults
* @param string $js_conf text for the JS confirmation
*
* @return string the generated HTML
*
*
* @access private
*
*
* @see _getPlacedLinks()
*/
private function _getCheckboxAndLinks(
@ -5085,6 +5080,6 @@ class PMA_DisplayResults
return $ret;
} // end of the '_getCheckboxAndLinks()' function
}
?>

View File

@ -106,7 +106,7 @@ class PMA_Footer
// set current db, table and sql query in the querywindow
$query = '';
if (strlen($GLOBALS['sql_query']) > $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']) {
if (isset($GLOBALS['sql_query']) && strlen($GLOBALS['sql_query']) > $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']) {
$query = PMA_escapeJsString($GLOBALS['sql_query']);
}
$this->_scripts->addCode("

View File

@ -337,7 +337,7 @@ class PMA_Header
*/
$GLOBALS['now'] = gmdate('D, d M Y H:i:s') . ' GMT';
/* Prevent against ClickJacking by allowing frames only from same origin */
if (! $GLOBALS['cfg']['AllowThirdPartyFraming']) {
if (! $GLOBALS['cfg']['AllowThirdPartyFraming'] && ! defined('TESTSUITE')) {
header(
'X-Frame-Options: SAMEORIGIN'
);
@ -353,7 +353,7 @@ class PMA_Header
);
}
PMA_noCacheHeader();
if (! defined('IS_TRANSFORMATION_WRAPPER')) {
if (! defined('IS_TRANSFORMATION_WRAPPER') && ! defined('TESTSUITE')) {
// Define the charset to be used
header('Content-Type: text/html; charset=utf-8');
}

View File

@ -21,50 +21,50 @@ class PMA_Index
*
* @var array
*/
protected static $_registry = array();
private static $_registry = array();
/**
* @var string The name of the schema
*/
protected $_schema = '';
private $_schema = '';
/**
* @var string The name of the table
*/
protected $_table = '';
private $_table = '';
/**
* @var string The name of the index
*/
protected $_name = '';
private $_name = '';
/**
* Columns in index
*
* @var array
*/
protected $_columns = array();
private $_columns = array();
/**
* The index method used (BTREE, SPATIAL, FULLTEXT, HASH, RTREE).
*
* @var string
*/
protected $_type = '';
private $_type = '';
/**
* The index choice (PRIMARY, UNIQUE, INDEX, SPATIAL, FULLTEXT)
*
* @var string
*/
protected $_choice = '';
private $_choice = '';
/**
* Various remarks.
*
* @var string
*/
protected $_remarks = '';
private $_remarks = '';
/**
* Any comment provided for the index with a COMMENT attribute when the
@ -72,19 +72,19 @@ class PMA_Index
*
* @var string
*/
protected $_comment = '';
private $_comment = '';
/**
* @var integer 0 if the index cannot contain duplicates, 1 if it can.
*/
protected $_non_unique = 0;
private $_non_unique = 0;
/**
* Indicates how the key is packed. NULL if it is not.
*
* @var string
*/
protected $_packed = null;
private $_packed = null;
/**
* Constructor
@ -157,7 +157,7 @@ class PMA_Index
*
* @return boolean whether loading was successful
*/
static protected function _loadIndexes($table, $schema)
static private function _loadIndexes($table, $schema)
{
if (isset(PMA_Index::$_registry[$schema][$table])) {
return true;
@ -202,7 +202,8 @@ class PMA_Index
// $columns[names][]
// $columns[sub_parts][]
foreach ($columns['names'] as $key => $name) {
$sub_part = isset($columns['sub_parts'][$key]) ? $columns['sub_parts'][$key] : '';
$sub_part = isset($columns['sub_parts'][$key])
? $columns['sub_parts'][$key] : '';
$_columns[] = array(
'Column_name' => $name,
'Sub_part' => $sub_part,
@ -435,7 +436,10 @@ class PMA_Index
if (! $print_mode) {
$r = '<fieldset>';
$r .= '<legend id="index_header">' . __('Indexes');
$r .= $common_functions->showMySQLDocu('optimization', 'optimizing-database-structure');
$r .= $common_functions->showMySQLDocu(
'optimization', 'optimizing-database-structure'
);
$r .= '</legend>';
$r .= $no_indexes;
if (count($indexes) < 1) {
@ -482,24 +486,39 @@ class PMA_Index
if ($GLOBALS['cfg']['AjaxEnable']) {
$r .= ' ajax';
}
$r .= '" ' . $row_span . '>'
. ' <a href="tbl_indexes.php' . PMA_generate_common_url($this_params)
. '">' . $common_functions->getIcon('b_edit.png', __('Edit')) . '</a>'
$r .= '" ' . $row_span . '>' . ' <a href="tbl_indexes.php'
. PMA_generate_common_url($this_params) . '">'
. $common_functions->getIcon('b_edit.png', __('Edit')) . '</a>'
. '</td>' . "\n";
$this_params = $GLOBALS['url_params'];
if ($index->getName() == 'PRIMARY') {
$this_params['sql_query'] = 'ALTER TABLE ' . $common_functions->backquote($table) . ' DROP PRIMARY KEY;';
$this_params['message_to_show'] = __('The primary key has been dropped');
$js_msg = PMA_jsFormat('ALTER TABLE ' . $table . ' DROP PRIMARY KEY');
$this_params['sql_query'] = 'ALTER TABLE '
. $common_functions->backquote($table)
. ' DROP PRIMARY KEY;';
$this_params['message_to_show']
= __('The primary key has been dropped');
$js_msg = PMA_jsFormat(
'ALTER TABLE ' . $table . ' DROP PRIMARY KEY'
);
} else {
$this_params['sql_query'] = 'ALTER TABLE ' . $common_functions->backquote($table) . ' DROP INDEX ' . $common_functions->backquote($index->getName()) . ';';
$this_params['message_to_show'] = sprintf(__('Index %s has been dropped'), $index->getName());
$js_msg = PMA_jsFormat('ALTER TABLE ' . $table . ' DROP INDEX ' . $index->getName()) . ';';
$this_params['sql_query'] = 'ALTER TABLE '
. $common_functions->backquote($table) . ' DROP INDEX '
. $common_functions->backquote($index->getName()) . ';';
$this_params['message_to_show'] = sprintf(
__('Index %s has been dropped'), $index->getName()
);
$js_msg = PMA_jsFormat(
'ALTER TABLE ' . $table . ' DROP INDEX '
. $index->getName() . ';'
);
}
$r .= '<td ' . $row_span . '>';
$r .= '<input type="hidden" class="drop_primary_key_index_msg" value="' . $js_msg . '" />';
$r .= '<input type="hidden" class="drop_primary_key_index_msg"'
. ' value="' . $js_msg . '" />';
$r .= ' <a ';
if ($GLOBALS['cfg']['AjaxEnable']) {
$r .= 'class="drop_primary_key_index_anchor" ';
@ -511,11 +530,17 @@ class PMA_Index
}
if (! $print_mode) {
$r .= '<th ' . $row_span . '>' . htmlspecialchars($index->getName()) . '</th>';
$r .= '<th ' . $row_span . '>'
. htmlspecialchars($index->getName())
. '</th>';
} else {
$r .= '<td ' . $row_span . '>' . htmlspecialchars($index->getName()) . '</td>';
$r .= '<td ' . $row_span . '>'
. htmlspecialchars($index->getName())
. '</td>';
}
$r .= '<td ' . $row_span . '>' . htmlspecialchars($index->getType()) . '</td>';
$r .= '<td ' . $row_span . '>'
. htmlspecialchars($index->getType())
. '</td>';
$r .= '<td ' . $row_span . '>' . $index->isUnique(true) . '</td>';
$r .= '<td ' . $row_span . '>' . $index->isPacked(true) . '</td>';
@ -528,9 +553,15 @@ class PMA_Index
$r .= ' (' . $column->getSubPart() . ')';
}
$r .= '</td>';
$r .= '<td>' . htmlspecialchars($column->getCardinality()) . '</td>';
$r .= '<td>' . htmlspecialchars($column->getCollation()) . '</td>';
$r .= '<td>' . htmlspecialchars($column->getNull(true)) . '</td>';
$r .= '<td>'
. htmlspecialchars($column->getCardinality())
. '</td>';
$r .= '<td>'
. htmlspecialchars($column->getCollation())
. '</td>';
$r .= '<td>'
. htmlspecialchars($column->getNull(true))
. '</td>';
if ($column->getSeqInIndex() == 1) {
$r .= '<td ' . $row_span . '>'
@ -597,7 +628,9 @@ class PMA_Index
// did not find any difference
// so it makes no sense to have this two equal indexes
$message = PMA_Message::notice(__('The indexes %1$s and %2$s seem to be equal and one of them could possibly be removed.'));
$message = PMA_Message::notice(
__('The indexes %1$s and %2$s seem to be equal and one of them could possibly be removed.')
);
$message->addParam($each_index->getName());
$message->addParam($while_index->getName());
$output .= $message->getDisplay();
@ -619,17 +652,18 @@ class PMA_Index_Column
/**
* @var string The column name
*/
protected $_name = '';
private $_name = '';
/**
* @var integer The column sequence number in the index, starting with 1.
*/
protected $_seq_in_index = 1;
private $_seq_in_index = 1;
/**
* @var string How the column is sorted in the index. “A” (Ascending) or NULL (Not sorted)
* @var string How the column is sorted in the index. “A” (Ascending) or
* NULL (Not sorted)
*/
protected $_collation = null;
private $_collation = null;
/**
* The number of indexed characters if the column is only partly indexed,
@ -637,7 +671,7 @@ class PMA_Index_Column
*
* @var integer
*/
protected $_sub_part = null;
private $_sub_part = null;
/**
* Contains YES if the column may contain NULL.
@ -645,7 +679,7 @@ class PMA_Index_Column
*
* @var string
*/
protected $_null = '';
private $_null = '';
/**
* An estimate of the number of unique values in the index. This is updated
@ -656,7 +690,7 @@ class PMA_Index_Column
*
* @var integer
*/
protected $_cardinality = null;
private $_cardinality = null;
public function __construct($params = array())
{

View File

@ -267,12 +267,7 @@ class PMA_Menu
{
$db_is_information_schema = PMA_is_system_schema($this->_db);
$tbl_is_view = PMA_Table::isView($this->_db, $this->_table);
$table_status = PMA_Table::sGetStatusInfo($this->_db, $this->_table);
$table_info_num_rows = 0;
if (isset($table_status['Rows'])) {
$table_info_num_rows = $table_status['Rows'];
}
$table_info_num_rows = PMA_Table::countRecords($this->_db, $this->_table);
$tabs = array();

View File

@ -1,7 +1,7 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
*
*
*
* @package PhpMyAdmin
*/
@ -10,7 +10,7 @@ if (! defined('PHPMYADMIN')) {
}
/**
*
*
*
* @package PhpMyAdmin
*/
@ -85,7 +85,9 @@ class PMA_OutputBuffering
ob_start('ob_gzhandler');
}
ob_start();
header('X-ob_mode: ' . $this->_mode);
if (! defined('TESTSUITE')) {
header('X-ob_mode: ' . $this->_mode);
}
register_shutdown_function('PMA_OutputBuffering::stop');
$this->_on = true;
}

View File

@ -83,7 +83,7 @@ class PMA_RecentTable
= " SELECT `tables` FROM " . $this->pma_table .
" WHERE `username` = '" . $GLOBALS['cfg']['Server']['user'] . "'";
$row = PMA_DBI_fetch_array(PMA_query_as_controluser($sql_query));
$row = PMA_DBI_fetch_array(PMA_queryAsControlUser($sql_query));
if (isset($row[0])) {
return json_decode($row[0], true);
} else {

View File

@ -23,7 +23,8 @@ define('PMA_ENGINE_DETAILS_TYPE_NUMERIC', 2); //Has no effect yet...
define('PMA_ENGINE_DETAILS_TYPE_BOOLEAN', 3); // 'ON' or 'OFF'
/**
* base Storage Engine Class
* Base Storage Engine Class
*
* @package PhpMyAdmin
*/
class PMA_StorageEngine
@ -75,7 +76,8 @@ class PMA_StorageEngine
AND p.plugin_name NOT IN ('FunctionEngine', 'schema')";
$storage_engines = PMA_DBI_fetch_result($sql, 'Engine');
} else {
$storage_engines = PMA_DBI_fetch_result('SHOW STORAGE ENGINES', 'Engine');
$storage_engines
= PMA_DBI_fetch_result('SHOW STORAGE ENGINES', 'Engine');
}
}
@ -88,7 +90,8 @@ class PMA_StorageEngine
* @param string $name The name of the select form element
* @param string $id The ID of the form field
* @param string $selected The selected engine
* @param boolean $offerUnavailableEngines Should unavailable storage engines be offered?
* @param boolean $offerUnavailableEngines Should unavailable storage
* engines be offered?
*
* @static
* @return string html selectbox
@ -116,8 +119,10 @@ class PMA_StorageEngine
$output .= ' <option value="' . htmlspecialchars($key). '"'
. (empty($details['Comment'])
? '' : ' title="' . htmlspecialchars($details['Comment']) . '"')
. (strtolower($key) == $selected || (empty($selected) && $details['Support'] == 'DEFAULT')
? ' selected="selected"' : '') . '>' . "\n"
. (strtolower($key) == $selected
|| (empty($selected) && $details['Support'] == 'DEFAULT')
? ' selected="selected"' : '')
. '>' . "\n"
. ' ' . htmlspecialchars($details['Engine']) . "\n"
. ' </option>' . "\n";
}
@ -216,7 +221,7 @@ class PMA_StorageEngine
}
/**
* returns the engine specific handling for
* Returns the engine specific handling for
* PMA_ENGINE_DETAILS_TYPE_SIZE type variables.
*
* This function should be overridden when

View File

@ -269,49 +269,6 @@ class PMA_Table
return null;
}
/**
* loads structure data
* (this function is work in progress? not yet used)
*
* @return boolean
*/
function loadStructure()
{
$table_info = PMA_DBI_get_tables_full(
$this->getDbName(),
$this->getName()
);
if (false === $table_info) {
return false;
}
$this->settings = $table_info;
if ($this->get('TABLE_ROWS') === null) {
$this->set(
'TABLE_ROWS',
PMA_Table::countRecords(
$this->getDbName(),
$this->getName(),
true
)
);
}
$create_options = explode(' ', $this->get('TABLE_ROWS'));
// export create options by its name as variables into global namespace
// f.e. pack_keys=1 becomes available as $pack_keys with value of '1'
foreach ($create_options as $each_create_option) {
$each_create_option = explode('=', $each_create_option);
if (isset($each_create_option[1])) {
$this->set($$each_create_option[0], $each_create_option[1]);
}
}
return true;
}
/**
* Checks if this is a merge table
*
@ -734,7 +691,7 @@ class PMA_Table
// must use PMA_DBI_QUERY_STORE here, since we execute another
// query inside the loop
$table_copy_rs = PMA_query_as_controluser(
$table_copy_rs = PMA_queryAsControlUser(
$table_copy_query, true, PMA_DBI_QUERY_STORE
);
@ -755,7 +712,7 @@ class PMA_Table
(\'' . implode('\', \'', $value_parts) . '\',
\'' . implode('\', \'', $new_value_parts) . '\')';
PMA_query_as_controluser($new_table_query);
PMA_queryAsControlUser($new_table_query);
$last_id = PMA_DBI_insert_id();
} // end while
@ -1051,7 +1008,7 @@ class PMA_Table
. '\'' . $common_functions->sqlAddSlashes($comments_copy_row['transformation']) . '\','
. '\'' . $common_functions->sqlAddSlashes($comments_copy_row['transformation_options']) . '\'' : '')
. ')';
PMA_query_as_controluser($new_comment_query);
PMA_queryAsControlUser($new_comment_query);
} // end while
PMA_DBI_free_result($comments_copy_rs);
unset($comments_copy_rs);
@ -1413,7 +1370,7 @@ class PMA_Table
. " AND `db_name` = '" . $this->getCommonFunctions()->sqlAddSlashes($this->db_name) . "'"
. " AND `table_name` = '" . $this->getCommonFunctions()->sqlAddSlashes($this->name) . "'";
$row = PMA_DBI_fetch_array(PMA_query_as_controluser($sql_query));
$row = PMA_DBI_fetch_array(PMA_queryAsControlUser($sql_query));
if (isset($row[0])) {
return json_decode($row[0], true);
} else {

View File

@ -220,7 +220,7 @@ class PMA_Tracker
" AND table_name = '" . $common_functions->sqlAddSlashes($tablename) . "' " .
" ORDER BY version DESC";
$row = PMA_DBI_fetch_array(PMA_query_as_controluser($sql_query));
$row = PMA_DBI_fetch_array(PMA_queryAsControlUser($sql_query));
if (isset($row['tracking_active']) && $row['tracking_active'] == 1) {
return true;
@ -331,7 +331,7 @@ class PMA_Tracker
'" . $common_functions->sqlAddSlashes("\n") . "',
'" . $common_functions->sqlAddSlashes(self::_transformTrackingSet($tracking_set)) . "' )";
$result = PMA_query_as_controluser($sql_query);
$result = PMA_queryAsControlUser($sql_query);
if ($result) {
// Deactivate previous version
@ -357,8 +357,10 @@ class PMA_Tracker
$common_functions = PMA_CommonFunctions::getInstance();
$sql_query = "/*NOTRACK*/\n"
. "DELETE FROM " . self::$pma_table
. " WHERE `db_name` = '" . $common_functions->sqlAddSlashes($dbname) . "'"
. " AND `table_name` = '" . $common_functions->sqlAddSlashes($tablename) . "'";
. " WHERE `db_name` = '"
. $common_functions->sqlAddSlashes($dbname) . "'"
. " AND `table_name` = '"
. $common_functions->sqlAddSlashes($tablename) . "'";
$result = PMA_query_as_controluser($sql_query);
return $result;
@ -423,7 +425,7 @@ class PMA_Tracker
'" . $common_functions->sqlAddSlashes("\n") . "',
'" . $common_functions->sqlAddSlashes(self::_transformTrackingSet($tracking_set)) . "' )";
$result = PMA_query_as_controluser($sql_query);
$result = PMA_queryAsControlUser($sql_query);
return $result;
}
@ -452,7 +454,7 @@ class PMA_Tracker
" AND `table_name` = '" . $common_functions->sqlAddSlashes($tablename) . "' " .
" AND `version` = '" . $common_functions->sqlAddSlashes($version) . "' ";
$result = PMA_query_as_controluser($sql_query);
$result = PMA_queryAsControlUser($sql_query);
return $result;
}
@ -501,7 +503,7 @@ class PMA_Tracker
" AND `table_name` = '" . $common_functions->sqlAddSlashes($tablename) . "' " .
" AND `version` = '" . $common_functions->sqlAddSlashes($version) . "' ";
$result = PMA_query_as_controluser($sql_query);
$result = PMA_queryAsControlUser($sql_query);
return $result;
}
@ -566,7 +568,7 @@ class PMA_Tracker
? ' AND tracking & ' . self::_transformTrackingSet($statement) . ' <> 0'
: " AND FIND_IN_SET('" . $statement . "',tracking) > 0" ;
}
$row = PMA_DBI_fetch_array(PMA_query_as_controluser($sql_query));
$row = PMA_DBI_fetch_array(PMA_queryAsControlUser($sql_query));
return isset($row[0])
? $row[0]
: -1;
@ -601,7 +603,7 @@ class PMA_Tracker
$sql_query .= " AND `version` = '" . $common_functions->sqlAddSlashes($version) ."' ".
" ORDER BY `version` DESC LIMIT 1";
$mixed = PMA_DBI_fetch_assoc(PMA_query_as_controluser($sql_query));
$mixed = PMA_DBI_fetch_assoc(PMA_queryAsControlUser($sql_query));
// Parse log
$log_schema_entries = explode('# log ', $mixed['schema_sql']);
@ -1026,7 +1028,7 @@ class PMA_Tracker
" AND `table_name` = '" . $common_functions->sqlAddSlashes($result['tablename']) . "' " .
" AND `version` = '" . $common_functions->sqlAddSlashes($version) . "' ";
$result = PMA_query_as_controluser($sql_query);
$result = PMA_queryAsControlUser($sql_query);
}
}
}

View File

@ -123,7 +123,7 @@ function PMA_auth_fails()
include_once './libraries/select_server.lib.php';
echo '<tr>' . "\n";
echo ' <td>' . "\n";
PMA_select_server(true, true);
PMA_selectServer(true, true);
echo ' </td>' . "\n";
echo '</tr>' . "\n";
}

View File

@ -256,7 +256,7 @@ function PMA_auth()
echo '>';
include_once './libraries/select_server.lib.php';
PMA_select_server(false, false);
PMA_selectServer(false, false);
echo '</select></div>';
} else {

View File

@ -80,7 +80,7 @@ function PMA_buildHtmlForDb(
$out = '';
if ($is_superuser || $GLOBALS['cfg']['AllowUserDropDatabase']) {
$out .= '<td class="tool">';
$out .= '<input type="checkbox" name="selected_dbs[]" '
$out .= '<input type="checkbox" name="selected_dbs[]" class="checkall" '
. 'title="' . htmlspecialchars($current['SCHEMA_NAME']) . '" '
. 'value="' . htmlspecialchars($current['SCHEMA_NAME']) . '" ';

View File

@ -2287,7 +2287,8 @@ class PMA_CommonFunctions
&& ($meta->type != 'timestamp')
&& ($meta->type != 'real')
) {
$con_val = '= ' . $row[$i];
$con_val = '= ' . $row[$i];
} elseif ((($meta->type == 'blob') || ($meta->type == 'string'))
// hexify only if this is a true not empty BLOB or a BINARY
@ -2317,16 +2318,17 @@ class PMA_CommonFunctions
}
} elseif ($meta->type == 'bit') {
$con_val = "= b'"
. $this->printableBitValue($row[$i], $meta->length) . "'";
} else {
$con_val = '= \'' . $this->sqlAddSlashes($row[$i], false, true) . '\'';
}
}
}
if ($con_val != null) {
$condition .= $con_val . ' AND';
if ($meta->primary_key > 0) {

View File

@ -575,6 +575,9 @@ function PMA_sendHeaderLocation($uri, $use_refresh = false)
*/
function PMA_noCacheHeader()
{
if (defined('TESTSUITE')) {
return;
}
// rfc2616 - Section 14.21
header('Expires: ' . date(DATE_RFC1123));
// HTTP/1.1

View File

@ -663,7 +663,8 @@ function PMA_DBI_get_tables_full($database, $table = false,
$each_tables[$table_name]['TABLE_TYPE'] = 'VIEW';
} else {
/**
* @todo difference between 'TEMPORARY' and 'BASE TABLE' but how to detect?
* @todo difference between 'TEMPORARY' and 'BASE TABLE'
* but how to detect?
*/
$each_tables[$table_name]['TABLE_TYPE'] = 'BASE TABLE';
}
@ -880,7 +881,9 @@ function PMA_DBI_get_databases_full($database = null, $force_stats = false,
$databases[$database_name]['SCHEMA_DATA_FREE'] = 0;
$res = PMA_DBI_query('SHOW TABLE STATUS FROM '
. $common_functions->backquote($database_name) . ';');
. $common_functions->backquote($database_name) . ';'
);
while ($row = PMA_DBI_fetch_assoc($res)) {
$databases[$database_name]['SCHEMA_TABLES']++;
$databases[$database_name]['SCHEMA_TABLE_ROWS']
@ -1439,9 +1442,10 @@ function PMA_DBI_postConnect($link, $is_controluser = false)
if (!PMA_DRIZZLE) {
if (! empty($GLOBALS['collation_connection'])) {
PMA_DBI_query("SET CHARACTER SET 'utf8';", $link, PMA_DBI_QUERY_STORE);
$set_collation_con_query = "SET collation_connection = '"
. PMA_sqlAddSlashes($GLOBALS['collation_connection']) . "';";
PMA_DBI_query(
"SET collation_connection = '"
. $common_functions->sqlAddSlashes($GLOBALS['collation_connection']) . "';",
$set_collation_con_query,
$link,
PMA_DBI_QUERY_STORE
);

View File

@ -39,7 +39,7 @@ if (empty($import_list)) {
$('#upload_form_status').css("display", "inline"); // show progress bar
$('#upload_form_status_info').css("display", "inline"); // - || -
<?php
if ($_SESSION[$SESSION_KEY]["handler"]!="noplugin") {
if ($_SESSION[$SESSION_KEY]["handler"] != "noplugin") {
?>
var finished = false;
var percent = 0.0;
@ -156,7 +156,7 @@ if ($_SESSION[$SESSION_KEY]["handler"]!="noplugin") {
</script>
<form action="import.php" method="post" enctype="multipart/form-data"
name="import"<?php
if ($_SESSION[$SESSION_KEY]["handler"]!="noplugin") {
if ($_SESSION[$SESSION_KEY]["handler"] != "noplugin") {
echo ' target="import_upload_iframe"';
} ?>>
<input type="hidden" name="<?php echo $ID_KEY; ?>" value="<?php echo $upload_id ; ?>" />

View File

@ -83,8 +83,6 @@ function PMA_import_uploadprogressCheck()
/**
* Checks if PHP 5.4 session upload-progress feature is available.
* Due to a bug in PHP 5.4's session upload feature (see /import_status.php),
* we need to check for cURL support.
*
* @return boolean true if PHP 5.4 session upload-progress is available,
* false if it is not
@ -93,7 +91,6 @@ function PMA_import_sessionCheck()
{
if (PMA_PHP_INT_VERSION < 50400
|| ! ini_get('session.upload_progress.enabled')
|| ! function_exists('curl_exec')
) {
return false;
}

View File

@ -124,7 +124,7 @@ class PMA_GIS_Visualization
*/
private function _sanitizeName($file_name, $ext)
{
$file_name = PMA_sanitize_filename($file_name);
$file_name = PMA_sanitizeFilename($file_name);
// Check if the user already added extension;
// get the substring where the extension would be if it was included

View File

@ -135,7 +135,7 @@ function PMA_importRunQuery($sql = '', $full = '', $controluser = false)
);
} elseif ($run_query) {
if ($controluser) {
$result = PMA_query_as_controluser(
$result = PMA_queryAsControlUser(
$import_run_buffer['sql']
);
} else {

View File

@ -21,8 +21,8 @@ if (! defined('PHPMYADMIN')) {
*
* @return array $_form_params array of insert/edit form parameters
*/
function PMA_getFormParametersForInsertForm(
$db, $table, $where_clauses, $where_clause_array, $err_url
function PMA_getFormParametersForInsertForm($db, $table, $where_clauses,
$where_clause_array, $err_url
) {
$_form_params = array(
'db' => $db,
@ -52,7 +52,7 @@ function PMA_getFormParametersForInsertForm(
* @return type containing insert_mode,whereClauses, result array
* where_clauses_array and found_unique_key boolean value
*/
function PMA_getValuesForEditMode($where_clause, $table, $db)
function PMA_getStuffForEditMode($where_clause, $table, $db)
{
$found_unique_key = false;
if (isset($where_clause)) {
@ -191,10 +191,12 @@ function PMA_loadFirstRowInEditMode($table, $db)
*
* @return array Add some url parameters to $url_params array and return it
*/
function PMA_urlParamsInEditMode($url_params)
function PMA_urlParamsInEditMode($url_params, $where_clause_array, $where_clause)
{
if (isset($_REQUEST['where_clause'])) {
$url_params['where_clause'] = trim($_REQUEST['where_clause']);
if (isset($where_clause)) {
foreach ($where_clause_array as $key_id => $where_clause) {
$url_params['where_clause'] = trim($where_clause);
}
}
if (! empty($_REQUEST['sql_query'])) {
$url_params['sql_query'] = $_REQUEST['sql_query'];
@ -305,7 +307,7 @@ function PMA_getDefaultForDatetime($column)
*
* @param array $column description of column in given table
* @param array $comments_map comments for every column that has a comment
* @param boolean $timestamp_seen whether a timestamp has been seen
* @param boolean $timestamp_seen whether a timestamp has been seen
*
* @return array description of column in given table
*/
@ -413,7 +415,7 @@ function PMA_isColumnChar($column)
* Retrieve set, enum, timestamp table columns
*
* @param array $column description of column in given table
* @param boolean $timestamp_seen whether a timestamp has been seen
* @param boolean $timestamp_seen whether a timestamp has been seen
*
* @return array $column['pma_type'], $column['wrap'], $column['first_timestamp']
*/
@ -569,10 +571,16 @@ function PMA_getNullifyCodeForNullColumn($column, $foreigners, $foreignData)
}
} elseif (strstr($column['True_Type'], 'set')) {
$nullify_code = '3';
} elseif ($foreigners && isset($foreigners[$column['Field']]) && $foreignData['foreign_link'] == false) {
} elseif ($foreigners
&& isset($foreigners[$column['Field']])
&& $foreignData['foreign_link'] == false
) {
// foreign key in a drop-down
$nullify_code = '4';
} elseif ($foreigners && isset($foreigners[$column['Field']]) && $foreignData['foreign_link'] == true) {
} elseif ($foreigners
&& isset($foreigners[$column['Field']])
&& $foreignData['foreign_link'] == true
) {
// foreign key with a browsing icon
$nullify_code = '6';
} else {
@ -640,7 +648,9 @@ function PMA_getValueColumn($column, $backup_field, $column_name_appendix,
$idindex, $data, $foreignData
);
} elseif ($GLOBALS['cfg']['LongtextDoubleTextarea'] && strstr($column['pma_type'], 'longtext')) {
} elseif ($GLOBALS['cfg']['LongtextDoubleTextarea']
&& strstr($column['pma_type'], 'longtext')
) {
$html_output = '&nbsp;</td>';
$html_output .= '</tr>';
$html_output .= '<tr class="' . ($odd_row ? 'odd' : 'even') . '">'
@ -652,6 +662,7 @@ function PMA_getValueColumn($column, $backup_field, $column_name_appendix,
);
} elseif (strstr($column['pma_type'], 'text')) {
$html_output .= PMA_getTextarea(
$column, $backup_field, $column_name_appendix, $unnullify_trigger,
$tabindex, $tabindex_for_value, $idindex, $text_dir,
@ -665,7 +676,8 @@ function PMA_getValueColumn($column, $backup_field, $column_name_appendix,
} elseif ($column['pma_type'] == 'enum') {
$html_output .= PMA_getPmaTypeEnum(
$paramsArrayForColumns, $column, $extracted_columnspec
$column, $backup_field, $column_name_appendix, $extracted_columnspec,
$unnullify_trigger, $tabindex, $tabindex_for_value, $idindex, $data
);
} elseif ($column['pma_type'] == 'set') {
@ -725,14 +737,16 @@ function PMA_getForeignLink($column, $backup_field, $column_name_appendix,
list($db, $table) = $paramTableDbArray;
$html_output = '';
$html_output .= $backup_field . "\n";
$html_output .= '<input type="hidden" name="fields_type' . $column_name_appendix . '" value="foreign" />';
$html_output .= '<input type="hidden" name="fields_type'
. $column_name_appendix . '" value="foreign" />';
$html_output .= '<input type="text" name="fields' . $column_name_appendix . '"'
. 'class="textfield" ' . $unnullify_trigger
. 'tabindex="' . ($tabindex + $tabindex_for_value) . '"'
. 'id="field_' . ($idindex) . '_3"'
. 'tabindex="' . ($tabindex + $tabindex_for_value) . '" '
. 'id="field_' . ($idindex) . '_3" '
. 'value="' . htmlspecialchars($data) . '" />'
. '<a class="hide foreign_values_anchor" target="_blank" onclick="window.open(this.href,'
. '\'foreigners\', \'width=640,height=240,scrollbars=yes,resizable=yes\'); return false;" href="browse_foreigners.php?'
. '<a class="hide foreign_values_anchor" target="_blank" '
. 'onclick="window.open(this.href,\'foreigners\', \'width=640,height=240,scrollbars=yes,resizable=yes\'); return false;" '
. 'href="browse_foreigners.php?'
. PMA_generate_common_url($db, $table) . '&amp;field='
. PMA_escapeJsString(urlencode($column['Field']) . $rownumber_param) . '">'
. str_replace("'", "\'", $titles['Browse']) . '</a>';
@ -803,7 +817,9 @@ function PMA_getTextarea($column, $backup_field, $column_name_appendix,
$the_class = 'char';
$textAreaRows = $GLOBALS['cfg']['CharTextareaRows'];
$textareaCols = $GLOBALS['cfg']['CharTextareaCols'];
} elseif (($GLOBALS['cfg']['LongtextDoubleTextarea'] && strstr($column['pma_type'], 'longtext'))) {
} elseif ($GLOBALS['cfg']['LongtextDoubleTextarea']
&& strstr($column['pma_type'], 'longtext')
) {
$textAreaRows = $GLOBALS['cfg']['TextareaRows']*2;
$textareaCols = $GLOBALS['cfg']['TextareaCols']*2;
}
@ -825,17 +841,23 @@ function PMA_getTextarea($column, $backup_field, $column_name_appendix,
/**
* Get HTML for enum type
*
* @param array $column description of column in given table
* @param string $backup_field hidden input field
* @param string $column_name_appendix the name atttibute
* @param array $extracted_columnspec associative array containing type,
* spec_in_brackets and possibly
* enum_set_values (another array)
* @param type $column description of column in given table
* @param type $backup_field hidden input field
* @param type $column_name_appendix the name atttibute
* @param type $extracted_columnspec associative array containing type,
* spec_in_brackets and possibly
* enum_set_values (another array)
* @param type $unnullify_trigger validation string
* @param type $tabindex tab index
* @param type $tabindex_for_value offset for the values tabindex
* @param type $idindex id index
* @param type $data data to edit
*
* @return string an html snippet
* @return type string an html snippet
*/
function PMA_getPmaTypeEnum(
$column, $backup_field, $column_name_appendix, $extracted_columnspec
function PMA_getPmaTypeEnum($column, $backup_field, $column_name_appendix,
$extracted_columnspec, $unnullify_trigger, $tabindex, $tabindex_for_value,
$idindex, $data
) {
$html_output = '';
if (! isset($column['values'])) {
@ -918,9 +940,9 @@ function PMA_getDropDownDependingOnLength(
$html_output .= '<option value="' . $enum_value['html'] . '"';
if ($data == $enum_value['plain']
|| ($data == ''
&& (! isset($_REQUEST['where_clause']) || $column['Null'] != 'YES')
&& isset($column['Default'])
&& $enum_value['plain'] == $column['Default'])
&& (! isset($_REQUEST['where_clause']) || $column['Null'] != 'YES')
&& isset($column['Default'])
&& $enum_value['plain'] == $column['Default'])
) {
$html_output .= ' selected="selected"';
}
@ -959,9 +981,9 @@ function PMA_getRadioButtonDependingOnLength(
. $unnullify_trigger;
if ($data == $enum_value['plain']
|| ($data == ''
&& (! isset($_REQUEST['where_clause']) || $column['Null'] != 'YES')
&& isset($column['Default'])
&& $enum_value['plain'] == $column['Default'])
&& (! isset($_REQUEST['where_clause']) || $column['Null'] != 'YES')
&& isset($column['Default'])
&& $enum_value['plain'] == $column['Default'])
) {
$html_output .= ' checked="checked"';
}
@ -1084,7 +1106,6 @@ function PMA_getBinaryAndBlobColumn(
$html_output .= ' ('. $data_size [0] . ' ' . $data_size[1] . ')';
unset($data_size);
}
$html_output .= '<input type="hidden" name="fields_type'
. $column_name_appendix . '" value="protected" />'
. '<input type="hidden" name="fields'
@ -1384,6 +1405,7 @@ function PMA_getContinueInsertionForm($table, $db, $where_clause_array, $err_url
if (isset($_REQUEST['where_clause'])) {
foreach ($where_clause_array as $key_id => $where_clause) {
$html_output .= '<input type="hidden" name="where_clause['
. $key_id . ']" value="'
. htmlspecialchars(trim($where_clause)) . '" />'. "\n";
@ -1458,7 +1480,8 @@ function PMA_getActionsPanel($where_clause, $after_insert, $tabindex,
*/
function PMA_getSubmitTypeDropDown($where_clause, $tabindex, $tabindex_for_value)
{
$html_output = '<select name="submit_type" class="control_at_footer" tabindex="' . ($tabindex + $tabindex_for_value + 1) . '">';
$html_output = '<select name="submit_type" class="control_at_footer" tabindex="'
. ($tabindex + $tabindex_for_value + 1) . '">';
if (isset($where_clause)) {
$html_output .= '<option value="save">' . __('Save') . '</option>';
}
@ -1487,13 +1510,16 @@ function PMA_getSubmitTypeDropDown($where_clause, $tabindex, $tabindex_for_value
function PMA_getAfterInsertDropDown($where_clause, $after_insert, $found_unique_key)
{
$html_output = '<select name="after_insert">'
. '<option value="back" ' . ($after_insert == 'back' ? 'selected="selected"' : '') . '>'
. '<option value="back" '
. ($after_insert == 'back' ? 'selected="selected"' : '') . '>'
. __('Go back to previous page') . '</option>'
. '<option value="new_insert" ' . ($after_insert == 'new_insert' ? 'selected="selected"' : '') . '>'
. '<option value="new_insert" '
. ($after_insert == 'new_insert' ? 'selected="selected"' : '') . '>'
. __('Insert another new row') . '</option>';
if (isset($where_clause)) {
$html_output .= '<option value="same_insert" ' . ($after_insert == 'same_insert' ? 'selected="selected"' : '') . '>'
$html_output .= '<option value="same_insert" '
. ($after_insert == 'same_insert' ? 'selected="selected"' : '') . '>'
. __('Go back to this page') . '</option>';
// If we have just numeric primary key, we can also edit next
@ -1511,7 +1537,8 @@ function PMA_getAfterInsertDropDown($where_clause, $after_insert, $found_unique_
}
}
if ($found_unique_key && $is_numeric) {
$html_output .= '<option value="edit_next" '. ($after_insert == 'edit_next' ? 'selected="selected"' : '') . '>'
$html_output .= '<option value="edit_next" '
. ($after_insert == 'edit_next' ? 'selected="selected"' : '') . '>'
. __('Edit next row') . '</option>';
}
@ -1619,8 +1646,12 @@ function PMA_getSpecialCharsAndBackupFieldForExistingRow(
$special_chars = htmlspecialchars($current_row[$column['Field']]);
} else {
// special binary "characters"
if ($column['is_binary'] || ($column['is_blob'] && ! $GLOBALS['cfg']['ProtectBinary'])) {
if ($_SESSION['tmp_user_values']['display_binary_as_hex'] && $GLOBALS['cfg']['ShowFunctionFields']) {
if ($column['is_binary']
|| ($column['is_blob'] && ! $GLOBALS['cfg']['ProtectBinary'])
) {
if ($_SESSION['tmp_user_values']['display_binary_as_hex']
&& $GLOBALS['cfg']['ShowFunctionFields']
) {
$current_row[$column['Field']] = bin2hex($current_row[$column['Field']]);
$column['display_binary_as_hex'] = true;
} else {
@ -1640,9 +1671,14 @@ function PMA_getSpecialCharsAndBackupFieldForExistingRow(
$data = $current_row[$column['Field']];
} // end if... else...
//when copying row, it is useful to empty auto-increment column to prevent duplicate key error
if (isset($_REQUEST['default_action']) && $_REQUEST['default_action'] === 'insert') {
if ($column['Key'] === 'PRI' && strpos($column['Extra'], 'auto_increment') !== false) {
//when copying row, it is useful to empty auto-increment column
// to prevent duplicate key error
if (isset($_REQUEST['default_action'])
&& $_REQUEST['default_action'] === 'insert'
) {
if ($column['Key'] === 'PRI'
&& strpos($column['Extra'], 'auto_increment') !== false
) {
$data = $special_chars_encoded = $special_chars = null;
}
}
@ -1654,7 +1690,13 @@ function PMA_getSpecialCharsAndBackupFieldForExistingRow(
. $column_name_appendix . '" value="'
. htmlspecialchars($current_row[$column['Field']]) . '" />';
return array($real_null_value, $special_chars_encoded, $special_chars, $data, $backup_field);
return array(
$real_null_value,
$special_chars_encoded,
$special_chars,
$data,
$backup_field
);
}
/**
@ -1663,7 +1705,8 @@ function PMA_getSpecialCharsAndBackupFieldForExistingRow(
* @param type $column description of column in given table
* @param boolean $real_null_value whether column value null or not null
*
* @return array $real_null_value, $data, $special_chars, $backup_field, $special_chars_encoded
* @return array $real_null_value, $data, $special_chars,
* $backup_field, $special_chars_encoded
*/
function PMA_getSpecialCharsAndBackupFieldForInsertingMode(
$column, $real_null_value
@ -1707,7 +1750,9 @@ function PMA_getParamsForUpdateOrInsert()
{
if (isset($_REQUEST['where_clause'])) {
// we were editing something => use the WHERE clause
$loop_array = (is_array($_REQUEST['where_clause']) ? $_REQUEST['where_clause'] : array($_REQUEST['where_clause']));
$loop_array = is_array($_REQUEST['where_clause'])
? $_REQUEST['where_clause']
: array($_REQUEST['where_clause']);
$using_key = true;
$is_insert = $_REQUEST['submit_type'] == 'insert'
|| $_REQUEST['submit_type'] == 'showinsert'
@ -1851,7 +1896,8 @@ function PMA_buildSqlQuery($is_insertignore, $query_fields, $value_sets)
$query[] = $insert_command . 'INTO '
. PMA_CommonFunctions::getInstance()->backquote($GLOBALS['db']) . '.'
. PMA_CommonFunctions::getInstance()->backquote($GLOBALS['table'])
. ' (' . implode(', ', $query_fields) . ') VALUES (' . implode('), (', $value_sets) . ')';
. ' (' . implode(', ', $query_fields) . ') VALUES ('
. implode('), (', $value_sets) . ')';
unset($insert_command, $query_fields);
return $query;
}
@ -1917,7 +1963,6 @@ function PMA_executeSqlQuery($url_params, $query)
}
$warning_messages = PMA_getWarningMessages();
}
return array(
$url_params,
$total_affected_rows,
@ -1943,4 +1988,349 @@ function PMA_getWarningMessages()
}
return $warning_essages;
}
/**
* Column to display from the foreign table?
*
* @param string $where_comparison string that contain relation field value
* @param string $relation_field_value relation field value
* @param array $map all Relations to foreign tables for a given
* table or optionally a given column in a table
* @param string $relation_field relation field
*
* @return string $dispval display value from the foriegn table
*/
function PMA_getDisplayValueForForeignTableColumn($where_comparison,
$relation_field_value, $map, $relation_field
) {
$display_field = PMA_getDisplayField(
$map[$relation_field]['foreign_db'],
$map[$relation_field]['foreign_table']
);
// Field to display from the foreign table?
if (isset($display_field) && strlen($display_field)) {
$dispsql = 'SELECT ' . PMA_backquote($display_field)
. ' FROM ' . PMA_backquote($map[$relation_field]['foreign_db'])
. '.' . PMA_backquote($map[$relation_field]['foreign_table'])
. ' WHERE ' . PMA_backquote($map[$relation_field]['foreign_field'])
. $where_comparison;
$dispresult = PMA_DBI_try_query($dispsql, null, PMA_DBI_QUERY_STORE);
if ($dispresult && PMA_DBI_num_rows($dispresult) > 0) {
list($dispval) = PMA_DBI_fetch_row($dispresult, 0);
}
@PMA_DBI_free_result($dispresult);
return $dispval;
}
return '';
}
/**
* Display option in the cell according to user choises
*
* @param array $map all Relations to foreign tables for a given
* table or optionally a given column in a table
* @param string $relation_field relation field
* @param string $where_comparison string that contain relation field value
* @param string $dispval display value from the foriegn table
* @param string $relation_field_value relation field value
*
* @return string $output HTML <a> tag
*/
function PMA_getLinkForRelationalDisplayField($map, $relation_field,
$where_comparison, $dispval, $relation_field_value
) {
if ('K' == $_SESSION['tmp_user_values']['relational_display']) {
// user chose "relational key" in the display options, so
// the title contains the display field
$title = (! empty($dispval))
? ' title="' . htmlspecialchars($dispval) . '"'
: '';
} else {
$title = ' title="' . htmlspecialchars($relation_field_value) . '"';
}
$_url_params = array(
'db' => $map[$relation_field]['foreign_db'],
'table' => $map[$relation_field]['foreign_table'],
'pos' => '0',
'sql_query' => 'SELECT * FROM '
. PMA_backquote($map[$relation_field]['foreign_db'])
. '.' . PMA_backquote($map[$relation_field]['foreign_table'])
. ' WHERE ' . PMA_backquote($map[$relation_field]['foreign_field'])
. $where_comparison
);
$output = '<a href="sql.php' . PMA_generate_common_url($_url_params) . '"' . $title . '>';
if ('D' == $_SESSION['tmp_user_values']['relational_display']) {
// user chose "relational display field" in the
// display options, so show display field in the cell
$output .= (!empty($dispval)) ? htmlspecialchars($dispval) : '';
} else {
// otherwise display data in the cell
$output .= htmlspecialchars($relation_field_value);
}
$output .= '</a>';
return $output;
}
/**
* Get transformation function and transformation options
*
* @param string $db db name
* @param string $table table name
* @param array $transformation mimetypes for all columns of a table
* [field_name][field_key]
* @param array $edited_values transform fields list
* @param array $extra_data extra data array
*
* @return array $extra_data
*/
function PMA_getTransformationFunctionAndTransformationOptions($db, $table,
$transformation, $edited_values, $extra_data, $include_file
) {
foreach ($edited_values as $cell_index => $curr_cell_edited_values) {
if (isset($curr_cell_edited_values[$column_name])) {
$column_data = $curr_cell_edited_values[$column_name];
$_url_params = array(
'db' => $db,
'table' => $table,
'where_clause' => $_REQUEST['where_clause'],
'transform_key' => $column_name,
);
if (file_exists('libraries/transformations/' . $include_file)) {
$transformfunction_name
= str_replace('.inc.php', '', $transformation['transformation']);
include_once 'libraries/transformations/' . $include_file;
if (function_exists('PMA_transformation_' . $transformfunction_name)) {
$transform_function = 'PMA_transformation_' . $transformfunction_name;
$transform_options = PMA_transformation_getOptions(
isset($transformation['transformation_options'])
? $transformation['transformation_options']
: ''
);
$transform_options['wrapper_link'] = PMA_generate_common_url($_url_params);
}
}
$extra_data['transformations'][$cell_index]
= $transform_function($column_data, $transform_options);
}
} // end of loop for each transformation cell
return $extra_data;
}
/**
* Get current value in multi edit mode
*
* @param array $multi_edit_colummns multiple edit column array
* @param array $multi_edit_columns_name multiple edit columns name array
* @param array $multi_edit_funcs multiple edit functions array
* @param array $gis_from_text_functions array that contains gis from text functions
* @param string $current_value current value in the column
* @param array $gis_from_wkb_functions initialy $val is $multi_edit_colummns[$key]
* @param array $func_optional_param array('RAND','UNIX_TIMESTAMP')
* @param array $func_no_param array of set of string
* @param string $key an md5 of the column name
*
* @return array $cur_value
*/
function PMA_getCurrentValueAsAnArrayForMultipleEdit($multi_edit_colummns,
$multi_edit_columns_name, $multi_edit_funcs, $gis_from_text_functions,
$current_value, $gis_from_wkb_functions, $func_optional_param,
$func_no_param, $key
) {
if (empty($multi_edit_funcs[$key])) {
return $current_value;
} elseif ('UUID' === $multi_edit_funcs[$key]) {
/* This way user will know what UUID new row has */
$uuid = PMA_DBI_fetch_value('SELECT UUID()');
return "'" . $uuid . "'";
} elseif ((in_array($multi_edit_funcs[$key], $gis_from_text_functions)
&& substr($current_value, 0, 3) == "'''")
|| in_array($multi_edit_funcs[$key], $gis_from_wkb_functions)
) {
// Remove enclosing apostrophes
$current_value = substr($current_value, 1, strlen($current_value) - 2);
// Remove escaping apostrophes
$current_value = str_replace("''", "'", $current_value);
return $multi_edit_funcs[$key] . '(' . $current_value . ')';
} elseif (! in_array($multi_edit_funcs[$key], $func_no_param)
|| ($current_value != "''"
&& in_array($multi_edit_funcs[$key], $func_optional_param))
) {
return $multi_edit_funcs[$key] . '(' . $current_value . ')';
} else {
return $multi_edit_funcs[$key] . '()';
}
}
/**
* Get query values array and query fileds array for insert and update in multi edit
*
* @param array $multi_edit_columns_name multiple edit columns name array
* @param array $multi_edit_columns_null multiple edit columns null array
* @param string $current_value current value in the column in loop
* @param array $multi_edit_columns_prev multiple edit previous columns array
* @param array $multi_edit_funcs multiple edit functions array
* @param boolean $is_insert boolean value whether insert or not
* @param array $query_values SET part of the sql query
* @param array $query_fields array of query fileds
* @param string $current_value_as_an_array current value in the column as an array
* @param array $value_sets array of valu sets
* @param string $key an md5 of the column name
* @param array $multi_edit_columns_null_prev array of multiple edit columnd null previous
*
* @return array ($query_values, $query_fields)
*/
function PMA_getQueryValuesForInsertAndUpdateInMultipleEdit($multi_edit_columns_name,
$multi_edit_columns_null, $current_value, $multi_edit_columns_prev,
$multi_edit_funcs,$is_insert, $query_values, $query_fields,
$current_value_as_an_array, $value_sets, $key, $multi_edit_columns_null_prev
) {
// i n s e r t
if ($is_insert) {
// no need to add column into the valuelist
if (strlen($current_value_as_an_array)) {
$query_values[] = $current_value_as_an_array;
// first inserted row so prepare the list of fields
if (empty($value_sets)) {
$query_fields[] = PMA_backquote($multi_edit_columns_name[$key]);
}
}
} elseif (! empty($multi_edit_columns_null_prev[$key])
&& ! isset($multi_edit_columns_null[$key])
) {
// u p d a t e
// field had the null checkbox before the update
// field no longer has the null checkbox
$query_values[] = PMA_backquote($multi_edit_columns_name[$key])
. ' = ' . $current_value_as_an_array;
} elseif (empty($multi_edit_funcs[$key])
&& isset($multi_edit_columns_prev[$key])
&& ("'" . PMA_sqlAddSlashes($multi_edit_columns_prev[$key]) . "'" == $current_value)
) {
// No change for this column and no MySQL function is used -> next column
} elseif (! empty($current_value)) {
// avoid setting a field to NULL when it's already NULL
// (field had the null checkbox before the update
// field still has the null checkbox)
if (empty($multi_edit_columns_null_prev[$key])
|| empty($multi_edit_columns_null[$key])
) {
$query_values[] = PMA_backquote($multi_edit_columns_name[$key])
. ' = ' . $current_value_as_an_array;
}
}
return array($query_values, $query_fields);
}
/**
* Get the current column value in the form for different data types
*
* @param string $possibly_uploaded_val uploaded file content
* @param string $key an md5 of the column name
* @param array $multi_edit_columns_type array of multi edit column types
* @param string $current_value current column value in the form
* @param array $multi_edit_auto_increment multi edit auto increment
* @param string $rownumber index of where clause array
* @param array $multi_edit_columns_name multi edit column names array
* @param array $multi_edit_columns_null multi edit columns null array
* @param array $multi_edit_columns_null_prev multi edit columns previous null
* @param boolean $is_insert whether insert or not
* @param boolean $using_key whether editing or new row
* @param array $where_clause where clauses
* @param string $table table name
*
* @return string $current_value current column value in the form
*/
function PMA_getCurrentValueForDifferentTypes($possibly_uploaded_val, $key,
$multi_edit_columns_type, $current_value, $multi_edit_auto_increment,
$rownumber, $multi_edit_columns_name, $multi_edit_columns_null,
$multi_edit_columns_null_prev, $is_insert, $using_key, $where_clause, $table
) {
// Fetch the current values of a row to use in case we have a protected field
if ($is_insert
&& $using_key && isset($multi_edit_columns_type)
&& is_array($multi_edit_columns_type) && isset($where_clause)
) {
$protected_row = PMA_DBI_fetch_single_row(
'SELECT * FROM ' . PMA_backquote($table) . ' WHERE ' . $where_clause . ';'
);
}
if (false !== $possibly_uploaded_val) {
$current_value = $possibly_uploaded_val;
} else {
// c o l u m n v a l u e i n t h e f o r m
if (isset($multi_edit_columns_type[$key])) {
$type = $multi_edit_columns_type[$key];
} else {
$type = '';
}
if ($type != 'protected' && $type != 'set' && 0 === strlen($current_value)) {
// best way to avoid problems in strict mode
// (works also in non-strict mode)
if (isset($multi_edit_auto_increment)
&& isset($multi_edit_auto_increment[$key])
) {
$current_value = 'NULL';
} else {
$current_value = "''";
}
} elseif ($type == 'set') {
if (! empty($_REQUEST['fields']['multi_edit'][$rownumber][$key])) {
$current_value = implode(',', $_REQUEST['fields']['multi_edit'][$rownumber][$key]);
$current_value = "'" . PMA_sqlAddSlashes($current_value) . "'";
} else {
$current_value = "''";
}
} elseif ($type == 'protected') {
// here we are in protected mode (asked in the config)
// so tbl_change has put this special value in the
// coulmns array, so we do not change the column value
// but we can still handle column upload
// when in UPDATE mode, do not alter field's contents. When in INSERT
// mode, insert empty field because no values were submitted.
// If protected blobs where set, insert original fields content.
if (! empty($protected_row[$multi_edit_columns_name[$key]])) {
$current_value = '0x' . bin2hex($protected_row[$multi_edit_columns_name[$key]]);
} else {
$current_value = '';
}
} elseif ($type == 'bit') {
$current_value = preg_replace('/[^01]/', '0', $current_value);
$current_value = "b'" . PMA_sqlAddSlashes($current_value) . "'";
} elseif (! ($type == 'datetime' || $type == 'timestamp')
|| $current_value != 'CURRENT_TIMESTAMP'
) {
$current_value = "'" . PMA_sqlAddSlashes($current_value) . "'";
}
// Was the Null checkbox checked for this field?
// (if there is a value, we ignore the Null checkbox: this could
// be possible if Javascript is disabled in the browser)
if (! empty($multi_edit_columns_null[$key])
&& ($current_value == "''" || $current_value == '')
) {
$current_value = 'NULL';
}
// The Null checkbox was unchecked for this field
if (empty($current_value)
&& ! empty($multi_edit_columns_null_prev[$key])
&& ! isset($multi_edit_columns_null[$key])
) {
$current_value = "''";
}
} // end else (column value in the form)
return $current_value;
}
?>

View File

@ -103,7 +103,7 @@ echo '</div>' . "\n";
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);
PMA_selectServer(true, true);
echo '</div><br />';
} // end if LeftDisplayServers
?>

View File

@ -32,7 +32,7 @@ $GLOBALS['OpenDocumentNS'] = 'xmlns:office="urn:oasis:names:tc:opendocument:xmln
*/
function PMA_createOpenDocument($mime, $data)
{
$zipfile = new zipfile();
$zipfile = new ZipFile();
$zipfile -> addFile($mime, 'mimetype');
$zipfile -> addFile($data, 'content.xml');
$zipfile -> addFile(

View File

@ -21,7 +21,7 @@ if (! defined('PHPMYADMIN')) {
* @access public
*
*/
function PMA_query_as_controluser($sql, $show_error = true, $options = 0)
function PMA_queryAsControlUser($sql, $show_error = true, $options = 0)
{
// Avoid caching of the number of rows affected; for example, this function
// is called for tracking purposes but we want to display the correct number
@ -50,7 +50,7 @@ function PMA_query_as_controluser($sql, $show_error = true, $options = 0)
} else {
return false;
}
} // end of the "PMA_query_as_controluser()" function
} // end of the "PMA_queryAsControlUser()" function
/**
* Returns current relation parameters
@ -383,8 +383,10 @@ function PMA__getRelationsParam()
// fear it might be too slow
$tab_query = 'SHOW TABLES FROM '
. PMA_CommonFunctions::getInstance()->backquote($GLOBALS['cfg']['Server']['pmadb']);
$tab_rs = PMA_query_as_controluser($tab_query, false, PMA_DBI_QUERY_STORE);
. PMA_CommonFunctions::getInstance()->backquote(
$GLOBALS['cfg']['Server']['pmadb']
);
$tab_rs = PMA_queryAsControlUser($tab_query, false, PMA_DBI_QUERY_STORE);
if (! $tab_rs) {
// query failed ... ?
@ -694,7 +696,7 @@ function PMA_getDbComment($db)
WHERE db_name = '" . $common_functions->sqlAddSlashes($db) . "'
AND table_name = ''
AND column_name = '(db_comment)'";
$com_rs = PMA_query_as_controluser($com_qry, true, PMA_DBI_QUERY_STORE);
$com_rs = PMA_queryAsControlUser($com_qry, true, PMA_DBI_QUERY_STORE);
if ($com_rs && PMA_DBI_num_rows($com_rs) > 0) {
$row = PMA_DBI_fetch_assoc($com_rs);
@ -726,7 +728,7 @@ function PMA_getDbComments()
SELECT `db_name`, `comment`
FROM " . $common_functions->backquote($cfgRelation['db']) . "." . $common_functions->backquote($cfgRelation['column_info']) . "
WHERE `column_name` = '(db_comment)'";
$com_rs = PMA_query_as_controluser($com_qry, true, PMA_DBI_QUERY_STORE);
$com_rs = PMA_queryAsControlUser($com_qry, true, PMA_DBI_QUERY_STORE);
if ($com_rs && PMA_DBI_num_rows($com_rs) > 0) {
while ($row = PMA_DBI_fetch_assoc($com_rs)) {
@ -781,7 +783,7 @@ function PMA_setDbComment($db, $comment = '')
}
if (isset($upd_query)) {
return PMA_query_as_controluser($upd_query);
return PMA_queryAsControlUser($upd_query);
}
return false;
@ -835,7 +837,7 @@ function PMA_setHistory($db, $table, $username, $sqlquery)
return;
}
PMA_query_as_controluser(
PMA_queryAsControlUser(
'INSERT INTO
' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['history']) . '
(`username`,
@ -915,7 +917,7 @@ function PMA_purgeHistory($username)
LIMIT ' . $GLOBALS['cfg']['QueryHistoryMax'] . ', 1';
if ($max_time = PMA_DBI_fetch_value($search_query, 0, 0, $GLOBALS['controllink'])) {
PMA_query_as_controluser(
PMA_queryAsControlUser(
'DELETE FROM
' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['history']) . '
WHERE `username` = \'' . $common_functions->sqlAddSlashes($username) . '\'
@ -1235,7 +1237,7 @@ function PMA_REL_renameField($db, $table, $field, $new_name)
. ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\''
. ' AND table_name = \'' . $common_functions->sqlAddSlashes($table) . '\''
. ' AND display_field = \'' . $common_functions->sqlAddSlashes($field) . '\'';
PMA_query_as_controluser($table_query);
PMA_queryAsControlUser($table_query);
}
if ($cfgRelation['relwork']) {
@ -1246,7 +1248,7 @@ function PMA_REL_renameField($db, $table, $field, $new_name)
. ' WHERE master_db = \'' . $common_functions->sqlAddSlashes($db) . '\''
. ' AND master_table = \'' . $common_functions->sqlAddSlashes($table) . '\''
. ' AND master_field = \'' . $common_functions->sqlAddSlashes($field) . '\'';
PMA_query_as_controluser($table_query);
PMA_queryAsControlUser($table_query);
$table_query = 'UPDATE '
. $common_functions->backquote($cfgRelation['db']) . '.'
@ -1255,7 +1257,8 @@ function PMA_REL_renameField($db, $table, $field, $new_name)
. ' WHERE foreign_db = \'' . $common_functions->sqlAddSlashes($db) . '\''
. ' AND foreign_table = \'' . $common_functions->sqlAddSlashes($table) . '\''
. ' AND foreign_field = \'' . $common_functions->sqlAddSlashes($field) . '\'';
PMA_query_as_controluser($table_query);
PMA_queryAsControlUser($table_query);
} // end if relwork
}
@ -1290,7 +1293,7 @@ function PMA_REL_renameSingleTable($table,
. $db_field . ' = \'' . $common_functions->sqlAddSlashes($source_db) . '\''
. ' AND '
. $table_field . ' = \'' . $common_functions->sqlAddSlashes($source_table) . '\'';
PMA_query_as_controluser($query);
PMA_queryAsControlUser($query);
}
@ -1396,7 +1399,8 @@ function PMA_REL_createPage($newpage, $cfgRelation, $db)
. ' VALUES (\''
. $common_functions->sqlAddSlashes($db) . '\', \''
. $common_functions->sqlAddSlashes($newpage) . '\')';
PMA_query_as_controluser($ins_query, false);
PMA_queryAsControlUser($ins_query, false);
return PMA_DBI_insert_id(
isset($GLOBALS['controllink']) ? $GLOBALS['controllink'] : ''
);

View File

@ -27,7 +27,7 @@ function PMA_relationsCleanupColumn($db, $table, $column)
. ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\''
. ' AND table_name = \'' . $common_functions->sqlAddSlashes($table) . '\''
. ' AND column_name = \'' . $common_functions->sqlAddSlashes($column) . '\'';
PMA_query_as_controluser($remove_query);
PMA_queryAsControlUser($remove_query);
}
if ($cfgRelation['displaywork']) {
@ -35,7 +35,7 @@ function PMA_relationsCleanupColumn($db, $table, $column)
. ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\''
. ' AND table_name = \'' . $common_functions->sqlAddSlashes($table) . '\''
. ' AND display_field = \'' . $common_functions->sqlAddSlashes($column) . '\'';
PMA_query_as_controluser($remove_query);
PMA_queryAsControlUser($remove_query);
}
if ($cfgRelation['relwork']) {
@ -43,13 +43,13 @@ function PMA_relationsCleanupColumn($db, $table, $column)
. ' WHERE master_db = \'' . $common_functions->sqlAddSlashes($db) . '\''
. ' AND master_table = \'' . $common_functions->sqlAddSlashes($table) . '\''
. ' AND master_field = \'' . $common_functions->sqlAddSlashes($column) . '\'';
PMA_query_as_controluser($remove_query);
PMA_queryAsControlUser($remove_query);
$remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['relation'])
. ' WHERE foreign_db = \'' . $common_functions->sqlAddSlashes($db) . '\''
. ' AND foreign_table = \'' . $common_functions->sqlAddSlashes($table) . '\''
. ' AND foreign_field = \'' . $common_functions->sqlAddSlashes($column) . '\'';
PMA_query_as_controluser($remove_query);
PMA_queryAsControlUser($remove_query);
}
}
@ -69,40 +69,40 @@ function PMA_relationsCleanupTable($db, $table)
$remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['column_info'])
. ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\''
. ' AND table_name = \'' . $common_functions->sqlAddSlashes($table) . '\'';
PMA_query_as_controluser($remove_query);
PMA_queryAsControlUser($remove_query);
}
if ($cfgRelation['displaywork']) {
$remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['table_info'])
. ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\''
. ' AND table_name = \'' . $common_functions->sqlAddSlashes($table) . '\'';
PMA_query_as_controluser($remove_query);
PMA_queryAsControlUser($remove_query);
}
if ($cfgRelation['pdfwork']) {
$remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['table_coords'])
. ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\''
. ' AND table_name = \'' . $common_functions->sqlAddSlashes($table) . '\'';
PMA_query_as_controluser($remove_query);
PMA_queryAsControlUser($remove_query);
}
if ($cfgRelation['designerwork']) {
$remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['designer_coords'])
. ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\''
. ' AND table_name = \'' . $common_functions->sqlAddSlashes($table) . '\'';
PMA_query_as_controluser($remove_query);
PMA_queryAsControlUser($remove_query);
}
if ($cfgRelation['relwork']) {
$remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['relation'])
. ' WHERE master_db = \'' . $common_functions->sqlAddSlashes($db) . '\''
. ' AND master_table = \'' . $common_functions->sqlAddSlashes($table) . '\'';
PMA_query_as_controluser($remove_query);
PMA_queryAsControlUser($remove_query);
$remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['relation'])
. ' WHERE foreign_db = \'' . $common_functions->sqlAddSlashes($db) . '\''
. ' AND foreign_table = \'' . $common_functions->sqlAddSlashes($table) . '\'';
PMA_query_as_controluser($remove_query);
PMA_queryAsControlUser($remove_query);
}
}
@ -120,45 +120,45 @@ function PMA_relationsCleanupDatabase($db)
if ($cfgRelation['commwork']) {
$remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['column_info'])
. ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\'';
PMA_query_as_controluser($remove_query);
PMA_queryAsControlUser($remove_query);
}
if ($cfgRelation['bookmarkwork']) {
$remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['bookmark'])
. ' WHERE dbase = \'' . $common_functions->sqlAddSlashes($db) . '\'';
PMA_query_as_controluser($remove_query);
PMA_queryAsControlUser($remove_query);
}
if ($cfgRelation['displaywork']) {
$remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['table_info'])
. ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\'';
PMA_query_as_controluser($remove_query);
PMA_queryAsControlUser($remove_query);
}
if ($cfgRelation['pdfwork']) {
$remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['pdf_pages'])
. ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\'';
PMA_query_as_controluser($remove_query);
PMA_queryAsControlUser($remove_query);
$remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['table_coords'])
. ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\'';
PMA_query_as_controluser($remove_query);
PMA_queryAsControlUser($remove_query);
}
if ($cfgRelation['designerwork']) {
$remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['designer_coords'])
. ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\'';
PMA_query_as_controluser($remove_query);
PMA_queryAsControlUser($remove_query);
}
if ($cfgRelation['relwork']) {
$remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['relation'])
. ' WHERE master_db = \'' . $common_functions->sqlAddSlashes($db) . '\'';
PMA_query_as_controluser($remove_query);
PMA_queryAsControlUser($remove_query);
$remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['relation'])
. ' WHERE foreign_db = \'' . $common_functions->sqlAddSlashes($db) . '\'';
PMA_query_as_controluser($remove_query);
PMA_queryAsControlUser($remove_query);
}
}

View File

@ -152,7 +152,7 @@ function PMA_sanitize($message, $escape = false, $safe = false)
* @return string the sanitized filename
*
*/
function PMA_sanitize_filename($filename)
function PMA_sanitizeFilename($filename)
{
$filename = preg_replace('/[^A-Za-z0-9_.-]/', '_', $filename);
return $filename;

View File

@ -260,7 +260,7 @@ class Table_Stats
. ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\''
. ' AND table_name = \'' . $common_functions->sqlAddSlashes($tableName) . '\''
. ' AND pdf_page_number = ' . $pageNumber;
$result = PMA_query_as_controluser($sql, false, PMA_DBI_QUERY_STORE);
$result = PMA_queryAsControlUser($sql, false, PMA_DBI_QUERY_STORE);
if (! $result || ! PMA_DBI_num_rows($result)) {
$dia->dieSchema(
$pageNumber,

View File

@ -465,7 +465,7 @@ class Table_Stats
. ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\''
. ' AND table_name = \'' . $common_functions->sqlAddSlashes($tableName) . '\''
. ' AND pdf_page_number = ' . $pageNumber;
$result = PMA_query_as_controluser($sql, false, PMA_DBI_QUERY_STORE);
$result = PMA_queryAsControlUser($sql, false, PMA_DBI_QUERY_STORE);
if (! $result || ! PMA_DBI_num_rows($result)) {
$eps->dieSchema(

View File

@ -201,7 +201,7 @@ class PMA_Export_Relation_Schema
. ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\''
. ' AND pdf_page_number = ' . $pageNumber;
$tab_rs = PMA_query_as_controluser($tab_sql, null, PMA_DBI_QUERY_STORE);
$tab_rs = PMA_queryAsControlUser($tab_sql, null, PMA_DBI_QUERY_STORE);
if (!$tab_rs || !PMA_DBI_num_rows($tab_rs) > 0) {
$this->dieSchema('', __('This page does not contain any tables!'));
}

View File

@ -241,7 +241,7 @@ class PMA_Schema_PDF extends PMA_PDF
. $this->getCommonFunctions()->backquote($cfgRelation['pdf_pages'])
. ' WHERE db_name = \'' . $this->getCommonFunctions()->sqlAddSlashes($db) . '\''
. ' AND page_nr = \'' . $pdf_page_number . '\'';
$test_rs = PMA_query_as_controluser($test_query);
$test_rs = PMA_queryAsControlUser($test_query);
$pages = @PMA_DBI_fetch_assoc($test_rs);
$this->SetFont($this->_ff, 'B', 14);
$this->Cell(0, 6, ucfirst($pages['page_descr']), 'B', 1, 'C');
@ -497,7 +497,7 @@ class Table_Stats
. ' WHERE db_name = \'' . $this->getCommonFunctions()->sqlAddSlashes($db) . '\''
. ' AND table_name = \'' . $this->getCommonFunctions()->sqlAddSlashes($tableName) . '\''
. ' AND pdf_page_number = ' . $pageNumber;
$result = PMA_query_as_controluser($sql, false, PMA_DBI_QUERY_STORE);
$result = PMA_queryAsControlUser($sql, false, PMA_DBI_QUERY_STORE);
if (! $result || ! PMA_DBI_num_rows($result)) {
$pdf->Error(
sprintf(
@ -1198,7 +1198,7 @@ class PMA_Pdf_Relation_Schema extends PMA_Export_Relation_Schema
. $this->getCommonFunctions()->backquote($GLOBALS['cfgRelation']['db']) . '.'
. $this->getCommonFunctions()->backquote($cfgRelation['pdf_pages'])
. ' WHERE page_nr = ' . $pageNumber;
$_name_rs = PMA_query_as_controluser($_name_sql);
$_name_rs = PMA_queryAsControlUser($_name_sql);
if ($_name_rs) {
$_name_row = PMA_DBI_fetch_row($_name_rs);
$filename = $_name_row[0] . '.pdf';

View File

@ -433,7 +433,7 @@ class Table_Stats
. ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\''
. ' AND table_name = \'' . $common_functions->sqlAddSlashes($tableName) . '\''
. ' AND pdf_page_number = ' . $pageNumber;
$result = PMA_query_as_controluser($sql, false, PMA_DBI_QUERY_STORE);
$result = PMA_queryAsControlUser($sql, false, PMA_DBI_QUERY_STORE);
if (!$result || !PMA_DBI_num_rows($result)) {
$svg->dieSchema(

View File

@ -196,7 +196,8 @@ class PMA_User_Schema
. $this->getCommonFunctions()->backquote($GLOBALS['cfgRelation']['db']) . '.'
. $this->getCommonFunctions()->backquote($cfgRelation['pdf_pages'])
. ' WHERE db_name = \'' . $this->getCommonFunctions()->sqlAddSlashes($db) . '\'';
$page_rs = PMA_query_as_controluser($page_query, false, PMA_DBI_QUERY_STORE);
$page_rs = PMA_queryAsControlUser($page_query, false, PMA_DBI_QUERY_STORE);
if ($page_rs && PMA_DBI_num_rows($page_rs) > 0) {
?>
<form method="get" action="schema_edit.php" name="frm_select_page">
@ -282,7 +283,7 @@ class PMA_User_Schema
. '.' . $this->getCommonFunctions()->backquote($cfgRelation['table_coords'])
. ' WHERE db_name = \'' . $this->getCommonFunctions()->sqlAddSlashes($db) . '\''
. ' AND pdf_page_number = \'' . $this->getCommonFunctions()->sqlAddSlashes($this->chosenPage) . '\'';
$page_rs = PMA_query_as_controluser($page_query, false);
$page_rs = PMA_queryAsControlUser($page_query, false);
$array_sh_page = array();
while ($temp_sh_page = @PMA_DBI_fetch_assoc($page_rs)) {
$array_sh_page[] = $temp_sh_page;
@ -618,7 +619,7 @@ class PMA_User_Schema
. ' AND table_name = \'' . $this->getCommonFunctions()->sqlAddSlashes($current_row) . '\'' . "\n"
. ' AND pdf_page_number = \'' . $this->getCommonFunctions()->sqlAddSlashes($chpage) . '\'';
echo $del_query;
PMA_query_as_controluser($del_query, false);
PMA_queryAsControlUser($del_query, false);
}
}
@ -666,7 +667,7 @@ class PMA_User_Schema
. $this->getCommonFunctions()->backquote($cfgRelation['table_coords'])
. ' WHERE db_name = \'' . $this->getCommonFunctions()->sqlAddSlashes($db) . '\''
. ' AND pdf_page_number = \'' . $this->getCommonFunctions()->sqlAddSlashes($choosePage) . '\'';
PMA_query_as_controluser($query, false);
PMA_queryAsControlUser($query, false);
}
/**
@ -685,7 +686,7 @@ class PMA_User_Schema
. $this->getCommonFunctions()->backquote($cfgRelation['pdf_pages'])
. ' WHERE db_name = \'' . $this->getCommonFunctions()->sqlAddSlashes($db) . '\''
. ' AND page_nr = \'' . $this->getCommonFunctions()->sqlAddSlashes($choosePage) . '\'';
PMA_query_as_controluser($query, false);
PMA_queryAsControlUser($query, false);
}
/**
@ -746,7 +747,7 @@ class PMA_User_Schema
. ' WHERE master_db = \'' . $this->getCommonFunctions()->sqlAddSlashes($db) . '\''
. ' GROUP BY master_table'
. ' ORDER BY COUNT(master_table) DESC';
$master_tables_rs = PMA_query_as_controluser(
$master_tables_rs = PMA_queryAsControlUser(
$master_tables, false, PMA_DBI_QUERY_STORE
);
if ($master_tables_rs && PMA_DBI_num_rows($master_tables_rs) > 0) {
@ -827,7 +828,7 @@ class PMA_User_Schema
. 'VALUES (\'' . $this->getCommonFunctions()->sqlAddSlashes($db) . '\', \''
. $this->getCommonFunctions()->sqlAddSlashes($current_table) . '\',' . $pageNumber
. ',' . $pos_x . ',' . $pos_y . ')';
PMA_query_as_controluser($insert_query, false);
PMA_queryAsControlUser($insert_query, false);
/*
* compute for the next table
@ -885,7 +886,7 @@ class PMA_User_Schema
. ' WHERE db_name = \'' . $this->getCommonFunctions()->sqlAddSlashes($db) . '\''
. ' AND table_name = \'' . $this->getCommonFunctions()->sqlAddSlashes($arrvalue['name']) . '\''
. ' AND pdf_page_number = \'' . $this->getCommonFunctions()->sqlAddSlashes($this->chosenPage) . '\'';
$test_rs = PMA_query_as_controluser($test_query, false, PMA_DBI_QUERY_STORE);
$test_rs = PMA_queryAsControlUser($test_query, false, PMA_DBI_QUERY_STORE);
//echo $test_query;
if ($test_rs && PMA_DBI_num_rows($test_rs) > 0) {
if (isset($arrvalue['delete']) && $arrvalue['delete'] == 'y') {
@ -913,7 +914,7 @@ class PMA_User_Schema
. $arrvalue['x'] . ',' . $arrvalue['y'] . ')';
}
//echo $ch_query;
PMA_query_as_controluser($ch_query, false);
PMA_queryAsControlUser($ch_query, false);
} // end if
} // end for
}

View File

@ -264,7 +264,7 @@ class Table_Stats
. ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\''
. ' AND table_name = \'' . $common_functions->sqlAddSlashes($tableName) . '\''
. ' AND pdf_page_number = ' . $pageNumber;
$result = PMA_query_as_controluser($sql, false, PMA_DBI_QUERY_STORE);
$result = PMA_queryAsControlUser($sql, false, PMA_DBI_QUERY_STORE);
if (!$result || !PMA_DBI_num_rows($result)) {
$visio->dieSchema(

View File

@ -10,12 +10,14 @@ if (! defined('PHPMYADMIN')) {
}
/**
* display server selection in list or selectbox form, or option tags only
* Display server selection in list or selectbox form, or option tags only
*
* @param boolean $not_only_options whether to include form tags or not
* @param boolean $ommit_fieldset whether to ommit fieldset tag or not
*
* @return void
*/
function PMA_select_server($not_only_options, $ommit_fieldset)
function PMA_selectServer($not_only_options, $ommit_fieldset)
{
// Show as list?
if ($not_only_options) {

View File

@ -42,7 +42,13 @@ if ($is_superuser && ! PMA_DRIZZLE) {
*/
$binary_logs = PMA_DRIZZLE
? null
: PMA_DBI_fetch_result('SHOW MASTER LOGS', 'Log_name', null, null, PMA_DBI_QUERY_STORE);
: PMA_DBI_fetch_result(
'SHOW MASTER LOGS',
'Log_name',
null,
null,
PMA_DBI_QUERY_STORE
);
PMA_CommonFunctions::getInstance()->checkParameters(
array('is_superuser', 'url_query'), false

View File

@ -23,7 +23,7 @@ if (! defined('PHPMYADMIN')) {
* names of tables present in source database
* but absent from target database
*
* @return nothing
* @return void
*/
function PMA_getMatchingTables($trg_tables, $src_tables, &$matching_tables,
&$uncommon_source_tables
@ -52,7 +52,7 @@ function PMA_getMatchingTables($trg_tables, $src_tables, &$matching_tables,
* names of tables presnet in target database
* but absent from source database
*
* @return nothing
* @return void
*/
function PMA_getNonMatchingTargetTables($trg_tables, $matching_tables,
&$uncommon_target_tables
@ -103,7 +103,7 @@ function PMA_getNonMatchingTargetTables($trg_tables, $matching_tables,
* reference to contain names of keys for
* each matching table
*
* @return nothing
* @return void
*/
function PMA_dataDiffInTables($src_db, $trg_db, $src_link, $trg_link,
&$matching_table, &$matching_tables_fields, &$update_array, &$insert_array,
@ -350,7 +350,7 @@ function PMA_dataDiffInTables($src_db, $trg_db, $src_link, $trg_link,
* @param string $src_db name of source database
* @param db_link $src_link connection established with source server
*
* @return nothing
* @return void
*/
function PMA_findDeleteRowsFromTargetTables(&$delete_array, $matching_table,
$matching_table_index, $trg_keys, $src_keys, $trg_db, $trg_link, $src_db, $src_link
@ -450,7 +450,7 @@ function PMA_dataDiffInUncommonTables($source_tables_uncommon, $src_db, $src_lin
* @param array $matching_table_keys matching keys for table
* @param bool $display whether to display query
*
* @return nothing
* @return void
*/
function PMA_updateTargetTables(
$table, $update_array, $src_db, $trg_db,
@ -504,10 +504,6 @@ function PMA_updateTargetTables(
* PMA_insertIntoTargetTable() inserts missing rows in the target table
* using $array_insert[$matching_table_index]
*
* @todo this function uses undefined variables and is possibly broken:
* $matching_tables, $matching_tables_fields, $remove_indexes_array,
* $matching_table_keys
*
* @param array $matching_table matching table names
* @param string $src_db name of source database
* @param string $trg_db name of target database
@ -545,7 +541,11 @@ function PMA_updateTargetTables(
* @param array &$update_array rows that are to be updated in target
* @param bool $display whether to display query
*
* @return nothing
* @return void
*
* @todo this function uses undefined variables and is possibly broken:
* $matching_tables, $matching_tables_fields, $remove_indexes_array,
* $matching_table_keys
*/
function PMA_insertIntoTargetTable($matching_table, $src_db, $trg_db, $src_link,
$trg_link, $table_fields, &$array_insert, $matching_table_index,
@ -719,7 +719,7 @@ function PMA_insertIntoTargetTable($matching_table, $src_db, $trg_db, $src_link,
* @param array &$uncommon_tables_fields field names of the uncommon table
* @param bool $display whether to display query
*
* @return nothing
* @return void
*/
function PMA_createTargetTables($src_db, $trg_db, $src_link, $trg_link,
&$uncommon_tables, $table_index, &$uncommon_tables_fields, $display
@ -792,7 +792,7 @@ function PMA_createTargetTables($src_db, $trg_db, $src_link, $trg_link,
* @param array $uncommon_tables_fields field names of the uncommon table
* @param bool $display whether to display query
*
* @return nothing
* @return void
*
* @todo This turns NULL values into '' (empty string)
*/
@ -844,7 +844,7 @@ function PMA_populateTargetTables($src_db, $trg_db, $src_link, $trg_link,
* @param array $delete_array key values of rows that are to be deleted
* @param bool $display whether to display query
*
* @return nothing
* @return void
*/
function PMA_deleteFromTargetTable($trg_db, $trg_link, $matching_tables,
$table_index, $target_tables_keys, $delete_array, $display
@ -935,7 +935,7 @@ function PMA_deleteFromTargetTable($trg_db, $trg_link, $matching_tables,
* @param array &$target_tables_keys field names which is key in the target table
* @param int $matching_table_index number of the matching table
*
* @return nothing
* @return void
*/
function PMA_structureDiffInTables($src_db, $trg_db, $src_link, $trg_link,
$matching_tables, &$source_columns, &$target_columns, &$alter_str_array,
@ -1018,7 +1018,7 @@ function PMA_structureDiffInTables($src_db, $trg_db, $src_link, $trg_link,
* @param array $uncommon_cols
* @param bool $display whether to display query
*
* @return nothing
* @return void
*/
function PMA_addColumnsInTargetTable($src_db, $trg_db, $src_link, $trg_link,
$matching_tables, $source_columns, &$add_column_array, $matching_tables_fields,
@ -1117,7 +1117,7 @@ function PMA_addColumnsInTargetTable($src_db, $trg_db, $src_link, $trg_link,
* @param array &$uncommon_tables_fields field names of the uncommon table
* @param bool $display whether to display query
*
* @return nothing
* @return void
*/
function PMA_checkForeignKeys($src_db, $src_link, $trg_db, $trg_link,
$referenced_table, &$uncommon_tables, &$uncommon_tables_fields, $display
@ -1158,7 +1158,7 @@ function PMA_checkForeignKeys($src_db, $src_link, $trg_db, $trg_link,
* @param int $matching_table_index number of the matching table
* @param bool $display whether to display query
*
* @return nothing
* @return void
*/
function PMA_alterTargetTableStructure($trg_db, $trg_link, $matching_tables,
&$source_columns, &$alter_str_array, $matching_tables_fields, $criteria,
@ -1296,7 +1296,7 @@ function PMA_alterTargetTableStructure($trg_db, $trg_link, $matching_tables,
* $matchiing_tables array
* @param bool $display whether to display query
*
* @return nothing
* @return void
*/
function PMA_removeColumnsFromTargetTable($trg_db, $trg_link, $matching_tables,
$uncommon_columns, $table_counter, $display
@ -1367,7 +1367,7 @@ function PMA_removeColumnsFromTargetTable($trg_db, $trg_link, $matching_tables,
* removed from the target table
* @param int $table_counter number of the matching table
*
* @return nothing
* @return void
*/
function PMA_indexesDiffInTables($src_db, $trg_db, $src_link, $trg_link,
$matching_tables, &$source_indexes, &$target_indexes, &$add_indexes_array,
@ -1434,7 +1434,7 @@ function PMA_indexesDiffInTables($src_db, $trg_db, $src_link, $trg_link,
* @param int $table_counter number of the matching table
* @param bool $display whether to display query
*
* @return nothing
* @return void
*/
function PMA_applyIndexesDiff($trg_db, $trg_link, $matching_tables, $source_indexes,
$target_indexes, $add_indexes_array, $alter_indexes_array,
@ -1578,7 +1578,7 @@ function PMA_syncDisplayHeaderCompare($src_db, $trg_db)
*
* @param array $rows
*
* @return nothing
* @return void
*/
function PMA_syncDisplayDataCompare($rows)
{

View File

@ -22,7 +22,7 @@ require_once './libraries/file_listing.php'; // used for file listing
require_once './libraries/bookmark.lib.php'; // used for file listing
/**
* prints the sql query boxes
* Prints the sql query boxes
*
* @param boolean|string $query query to display in the textarea
* or true to display last executed
@ -31,6 +31,8 @@ require_once './libraries/bookmark.lib.php'; // used for file listing
* false if not inside querywindow
* @param string $delimiter delimeter
*
* @return void
*
* @usedby server_sql.php
* @usedby db_sql.php
* @usedby tbl_sql.php
@ -150,21 +152,25 @@ function PMA_sqlQueryForm($query = true, $display_tab = false, $delimiter = ';')
<?php
}
// print an empty div, which will be later filled with the sql query results by ajax
// print an empty div, which will be later filled with
// the sql query results by ajax
echo '<div id="sqlqueryresults"></div>';
}
/**
* prints querybox fieldset
* Prints querybox fieldset
*
* @param string $query query to display in the textarea
* @param boolean $is_querywindow if inside querywindow or not
* @param string $delimiter default delimiter to use
*
* @return void
*
* @usedby PMA_sqlQueryForm()
*/
function PMA_sqlQueryFormInsert($query = '', $is_querywindow = false, $delimiter = ';')
{
function PMA_sqlQueryFormInsert(
$query = '', $is_querywindow = false, $delimiter = ';'
) {
$common_functions = PMA_CommonFunctions::getInstance();
@ -215,7 +221,7 @@ function PMA_sqlQueryFormInsert($query = '', $is_querywindow = false, $delimiter
$legend = sprintf(__('Run SQL query/queries on database %s'), $tmp_db_link);
if (empty($query)) {
$query = $common_functions->expandUserString(
$GLOBALS['cfg']['DefaultQueryDatabase'], 'PMA_CommonFunctions::getInstance()->backquote'
$GLOBALS['cfg']['DefaultQueryDatabase'], 'backquote'
);
}
} else {
@ -239,7 +245,7 @@ function PMA_sqlQueryFormInsert($query = '', $is_querywindow = false, $delimiter
$legend = sprintf(__('Run SQL query/queries on database %s'), $tmp_db_link);
if (empty($query)) {
$query = $common_functions->expandUserString(
$GLOBALS['cfg']['DefaultQueryTable'], 'PMA_CommonFunctions::getInstance()->backquote'
$GLOBALS['cfg']['DefaultQueryTable'], 'backquote'
);
}
}
@ -262,7 +268,8 @@ function PMA_sqlQueryFormInsert($query = '', $is_querywindow = false, $delimiter
.' rows="' . $height . '"'
.' dir="' . $GLOBALS['text_dir'] . '"'
.$auto_sel . $locking . '>' . htmlspecialchars($query) . '</textarea>' . "\n";
// Add buttons to generate query easily for select all,single select,insert,update and delete
// Add buttons to generate query easily for
// select all, single select, insert, update and delete
if (count($fields_list)) {
echo '<input type="button" value="SELECT *" id="selectall" class="button sqlbutton" />';
echo '<input type="button" value="SELECT" id="select" class="button sqlbutton" />';
@ -359,7 +366,8 @@ function PMA_sqlQueryFormInsert($query = '', $is_querywindow = false, $delimiter
if (! $is_querywindow) {
echo '<input type="checkbox" name="retain_query_box" value="1" '
. 'id="retain_query_box" tabindex="133" '
. ($GLOBALS['cfg']['RetainQueryBox'] === false ? '' : ' checked="checked"')
. ($GLOBALS['cfg']['RetainQueryBox'] === false
? '' : ' checked="checked"')
. ' />'
. '<label for="retain_query_box">' . __('Retain query box')
. '</label>';
@ -372,7 +380,9 @@ function PMA_sqlQueryFormInsert($query = '', $is_querywindow = false, $delimiter
}
/**
* prints bookmark fieldset
* Prints bookmark fieldset
*
* @return void
*
* @usedby PMA_sqlQueryForm()
*/
@ -426,7 +436,9 @@ function PMA_sqlQueryFormBookmark()
}
/**
* prints bookmark fieldset
* Prints bookmark fieldset
*
* @return void
*
* @usedby PMA_sqlQueryForm()
*/
@ -436,10 +448,16 @@ function PMA_sqlQueryFormUpload()
$common_functions = PMA_CommonFunctions::getInstance();
$errors = array ();
$matcher = '@\.sql(\.(' . PMA_supportedDecompressions() . '))?$@'; // we allow only SQL here
// we allow only SQL here
$matcher = '@\.sql(\.(' . PMA_supportedDecompressions() . '))?$@';
if (!empty($GLOBALS['cfg']['UploadDir'])) {
$files = PMA_getFileSelectOptions($common_functions->userDir($GLOBALS['cfg']['UploadDir']), $matcher, (isset($timeout_passed) && $timeout_passed && isset($local_import_file)) ? $local_import_file : '');
$files = PMA_getFileSelectOptions(
$common_functions->userDir($GLOBALS['cfg']['UploadDir']), $matcher,
(isset($timeout_passed) && $timeout_passed && isset($local_import_file))
? $local_import_file
: ''
);
} else {
$files = '';
}

View File

@ -307,8 +307,9 @@ if (!$GLOBALS['sqlvalidator_error']) {
* @return void
* @access public
*/
function setConnectionTechnology($connection_technology, $connection_technology_version)
{
function setConnectionTechnology(
$connection_technology, $connection_technology_version
) {
$this->connection_technology = $connection_technology;
$this->connection_technology_version = $connection_technology_version;
} // end of the "setConnectionTechnology()" function
@ -323,8 +324,9 @@ if (!$GLOBALS['sqlvalidator_error']) {
* @return void
* @access public
*/
function appendConnectionTechnology($connection_technology, $connection_technology_version)
{
function appendConnectionTechnology(
$connection_technology, $connection_technology_version
) {
$this->connection_technology .= ' - ' . $connection_technology;
$this->connection_technology_version .= ' - ' . $connection_technology_version;
} // end of the "appendConnectionTechnology()" function

View File

@ -1,108 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* handle field values (possibly uploaded from a file)
*
* original if-clause checked, whether input was stored in a possible
* fields_upload_XX var. Now check, if the field is set. If it is empty or a
* malicious file, do not alter fields contents. If an empty or invalid file is
* specified, the binary data gets deleter. Maybe a nice new text-variable is
* appropriate to document this behaviour.
*
* security cautions! You could trick the form and submit any file the
* webserver has access to for upload to a binary field. Shouldn't be that easy! ;)
*
* default is to advance to the field-value parsing. Will only be set to
* true when a binary file is uploaded, thus bypassing further manipulation of $val.
*
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Gets some core libraries
*/
require_once './libraries/File.class.php';
$file_to_insert = new PMA_File();
$file_to_insert->checkTblChangeForm($key, $rownumber);
$common_functions = PMA_CommonFunctions::getInstance();
$possibly_uploaded_val = $file_to_insert->getContent();
if ($file_to_insert->isError()) {
$message .= $file_to_insert->getError();
}
$file_to_insert->cleanUp();
if (false !== $possibly_uploaded_val) {
$val = $possibly_uploaded_val;
} else {
// f i e l d v a l u e i n t h e f o r m
if (isset($multi_edit_columns_type[$key])) {
$type = $multi_edit_columns_type[$key];
} else {
$type = '';
}
// $key contains the md5() of the fieldname
if ($type != 'protected' && $type != 'set' && 0 === strlen($val)) {
// best way to avoid problems in strict mode (works also in non-strict mode)
if (isset($multi_edit_auto_increment)
&& isset($multi_edit_auto_increment[$key])
) {
$val = 'NULL';
} else {
$val = "''";
}
} elseif ($type == 'set') {
if (! empty($_REQUEST['fields']['multi_edit'][$rownumber][$key])) {
$val = implode(',', $_REQUEST['fields']['multi_edit'][$rownumber][$key]);
$val = "'" . $common_functions->sqlAddSlashes($val) . "'";
} else {
$val = "''";
}
} elseif ($type == 'protected') {
// here we are in protected mode (asked in the config)
// so tbl_change has put this special value in the
// fields array, so we do not change the field value
// but we can still handle field upload
// when in UPDATE mode, do not alter field's contents. When in INSERT
// mode, insert empty field because no values were submitted. If protected
// blobs where set, insert original fields content.
if (! empty($prot_row[$multi_edit_columns_name[$key]])) {
$val = '0x' . bin2hex($prot_row[$multi_edit_columns_name[$key]]);
} else {
$val = '';
}
} elseif ($type == 'bit') {
$val = preg_replace('/[^01]/', '0', $val);
$val = "b'" . $common_functions->sqlAddSlashes($val) . "'";
} elseif (! ($type == 'datetime' || $type == 'timestamp')
|| $val != 'CURRENT_TIMESTAMP'
) {
$val = "'" . $common_functions->sqlAddSlashes($val) . "'";
}
// Was the Null checkbox checked for this field?
// (if there is a value, we ignore the Null checkbox: this could
// be possible if Javascript is disabled in the browser)
if (! empty($multi_edit_columns_null[$key]) && ($val == "''" || $val == '')) {
$val = 'NULL';
}
// The Null checkbox was unchecked for this field
if (empty($val)
&& ! empty($multi_edit_columns_null_prev[$key])
&& ! isset($multi_edit_columns_null[$key])
) {
$val = "''";
}
} // end else (field value in the form)
unset($type);
?>

View File

@ -231,7 +231,7 @@ function PMA_setMIME($db, $table, $key, $mimetype, $transformation,
WHERE `db_name` = \'' . $common_functions->sqlAddSlashes($db) . '\'
AND `table_name` = \'' . $common_functions->sqlAddSlashes($table) . '\'
AND `column_name` = \'' . $common_functions->sqlAddSlashes($key) . '\'';
$test_rs = PMA_query_as_controluser($test_qry, true, PMA_DBI_QUERY_STORE);
$test_rs = PMA_queryAsControlUser($test_qry, true, PMA_DBI_QUERY_STORE);
if ($test_rs && PMA_DBI_num_rows($test_rs) > 0) {
$row = @PMA_DBI_fetch_assoc($test_rs);
@ -267,7 +267,7 @@ function PMA_setMIME($db, $table, $key, $mimetype, $transformation,
}
if (isset($upd_query)) {
return PMA_query_as_controluser($upd_query);
return PMA_queryAsControlUser($upd_query);
} else {
return false;
}

View File

@ -32,8 +32,9 @@ if (! defined('PHPMYADMIN')) {
*
* @access public
*/
function PMA_generate_common_hidden_inputs($db = '', $table = '', $indent = 0, $skip = array())
{
function PMA_generate_common_hidden_inputs($db = '', $table = '',
$indent = 0, $skip = array()
) {
if (is_array($db)) {
$params =& $db;
$_indent = empty($table) ? $indent : $table;

View File

@ -17,7 +17,7 @@ if (! defined('PHPMYADMIN')) {
* @package PhpMyAdmin
* @see Official ZIP file format: http://www.pkware.com/support/zip-app-note
*/
class zipfile
class ZipFile
{
/**
* Whether to echo zip as it's built or return as string from -> file
@ -212,5 +212,5 @@ class zipfile
}
} // end of the 'file()' method
} // end of the 'zipfile' class
} // end of the 'ZipFile' class
?>

View File

@ -84,7 +84,7 @@ if ($server > 0
) {
echo '<li id="li_select_server">';
include_once 'libraries/select_server.lib.php';
PMA_select_server(true, true);
PMA_selectServer(true, true);
echo '</li>';
}

View File

@ -168,8 +168,8 @@ if (! $GLOBALS['server']) {
if (count($GLOBALS['pma']->databases) >= $GLOBALS['cfg']['LeftDisplayDatabaseFilterMinimum']) {
?>
<span id="NavDbFilter">
<span id="clear_fast_db_filter" title="<?php echo __('Clear'); ?>">X</span>
<input type="text" class="gray" name="fast_db_filter" id="fast_db_filter" title="<?php echo __('Filter databases by name'); ?>" value="<?php echo __('Filter databases by name'); ?>" />
<span id="clear_fast_db_filter" title="<?php echo __('Clear'); ?>">X</span>
</span>
<?php
}
@ -240,8 +240,8 @@ if ($GLOBALS['cfg']['LeftFrameLight'] && strlen($GLOBALS['db'])) {
if ($table_count >= $GLOBALS['cfg']['LeftDisplayTableFilterMinimum']) {
?>
<span id="NavFilter">
<span id="clear_fast_filter" title="<?php echo __('Clear'); ?>">X</span>
<input type="text" class="gray" name="fast_filter" id="fast_filter" title="<?php echo __('Filter tables by name'); ?>" value="<?php echo __('Filter tables by name'); ?>" />
<span id="clear_fast_filter" title="<?php echo __('Clear'); ?>">X</span>
</span>
<?php
}

View File

@ -42,7 +42,7 @@ if ($cfgRelation['displaywork']) {
}
if (isset($upd_query)) {
$upd_rs = PMA_query_as_controluser($upd_query);
$upd_rs = PMA_queryAsControlUser($upd_query);
}
} // end if

View File

@ -59,11 +59,11 @@ if (isset($mode)) {
if ('export' == $mode) {
$sql = "REPLACE INTO " . $pma_table . " (db_name, table_name, pdf_page_number, x, y) SELECT db_name, table_name, " . $pdf_page_number_q . ", ROUND(x/" . $scale_q . ") , ROUND(y/" . $scale_q . ") y FROM " . $pmd_table . " WHERE db_name = '" . $common_functions->sqlAddSlashes($db) . "'";
PMA_query_as_controluser($sql, true, PMA_DBI_QUERY_STORE);
PMA_queryAsControlUser($sql, true, PMA_DBI_QUERY_STORE);
}
if ('import' == $mode) {
PMA_query_as_controluser(
PMA_queryAsControlUser(
'UPDATE ' . $pma_table . ',' . $pmd_table .
' SET ' . $pmd_table . '.`x`= ' . $pma_table . '.`x` * '. $scale_q . ',
' . $pmd_table . '.`y`= ' . $pma_table . '.`y` * '. $scale_q .'
@ -100,7 +100,7 @@ echo '<fieldset><legend>' . __('Import/Export coordinates for PDF schema') . '</
$choices = array();
$table_info_result = PMA_query_as_controluser(
$table_info_result = PMA_queryAsControlUser(
'SELECT * FROM ' . $common_functions->backquote($GLOBALS['cfgRelation']['db'])
. '.' . $common_functions->backquote($cfgRelation['pdf_pages'])
. ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\''

View File

@ -97,7 +97,7 @@ if ($common_functions->isForeignKeySupported($type_T1)
. '\'' . $common_functions->sqlAddSlashes($T1) . '\','
. '\'' . $common_functions->sqlAddSlashes($F1) . '\')';
if (PMA_query_as_controluser($q, false, PMA_DBI_QUERY_STORE)) {
if (PMA_queryAsControlUser($q, false, PMA_DBI_QUERY_STORE)) {
PMD_return_new(1, __('Internal relation added'));
} else {
PMD_return_new(0, __('Error: Relation not added.'));

View File

@ -50,7 +50,7 @@ if ($common_functions->isForeignKeySupported($type_T1)
}
if ($try_to_delete_internal_relation) {
// internal relations
PMA_query_as_controluser(
PMA_queryAsControlUser(
'DELETE FROM '
. $common_functions->backquote($GLOBALS['cfgRelation']['db']) . '.'
. $cfg['Server']['relation'].' WHERE '

View File

@ -40,14 +40,14 @@ foreach ($post_params as $one_post_param) {
foreach ($t_x as $key => $value) {
$KEY = empty($IS_AJAX) ? urldecode($key) : $key; // table name decode (post PDF exp/imp)
list($DB,$TAB) = explode(".", $KEY);
PMA_query_as_controluser(
PMA_queryAsControlUser(
'DELETE FROM ' . $common_functions->backquote($GLOBALS['cfgRelation']['db']) . '.' . $common_functions->backquote($GLOBALS['cfgRelation']['designer_coords'])
. ' WHERE `db_name` = \'' . $common_functions->sqlAddSlashes($DB) . '\''
. ' AND `table_name` = \'' . $common_functions->sqlAddSlashes($TAB) . '\'',
true, PMA_DBI_QUERY_STORE
);
PMA_query_as_controluser(
PMA_queryAsControlUser(
'INSERT INTO ' . $common_functions->backquote($GLOBALS['cfgRelation']['db']) . '.' . $common_functions->backquote($GLOBALS['cfgRelation']['designer_coords'])
. ' (db_name, table_name, x, y, v, h)'
. ' VALUES ('

1265
po/af.po

File diff suppressed because it is too large Load Diff

1285
po/ar.po

File diff suppressed because it is too large Load Diff

1265
po/az.po

File diff suppressed because it is too large Load Diff

1281
po/be.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1275
po/bg.po

File diff suppressed because it is too large Load Diff

1269
po/bn.po

File diff suppressed because it is too large Load Diff

1277
po/br.po

File diff suppressed because it is too large Load Diff

1269
po/bs.po

File diff suppressed because it is too large Load Diff

1285
po/ca.po

File diff suppressed because it is too large Load Diff

1261
po/ckb.po

File diff suppressed because it is too large Load Diff

1227
po/cs.po

File diff suppressed because it is too large Load Diff

1271
po/cy.po

File diff suppressed because it is too large Load Diff

1468
po/da.po

File diff suppressed because it is too large Load Diff

1295
po/de.po

File diff suppressed because it is too large Load Diff

1307
po/el.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1379
po/es.po

File diff suppressed because it is too large Load Diff

1305
po/et.po

File diff suppressed because it is too large Load Diff

1269
po/eu.po

File diff suppressed because it is too large Load Diff

1279
po/fa.po

File diff suppressed because it is too large Load Diff

1570
po/fi.po

File diff suppressed because it is too large Load Diff

1325
po/fr.po

File diff suppressed because it is too large Load Diff

1279
po/gl.po

File diff suppressed because it is too large Load Diff

1263
po/he.po

File diff suppressed because it is too large Load Diff

1273
po/hi.po

File diff suppressed because it is too large Load Diff

1281
po/hr.po

File diff suppressed because it is too large Load Diff

1293
po/hu.po

File diff suppressed because it is too large Load Diff

1260
po/hy.po

File diff suppressed because it is too large Load Diff

1275
po/id.po

File diff suppressed because it is too large Load Diff

1287
po/it.po

File diff suppressed because it is too large Load Diff

1294
po/ja.po

File diff suppressed because it is too large Load Diff

1271
po/ka.po

File diff suppressed because it is too large Load Diff

1263
po/kk.po

File diff suppressed because it is too large Load Diff

1275
po/ko.po

File diff suppressed because it is too large Load Diff

1283
po/lt.po

File diff suppressed because it is too large Load Diff

1269
po/lv.po

File diff suppressed because it is too large Load Diff

1265
po/mk.po

File diff suppressed because it is too large Load Diff

1277
po/ml.po

File diff suppressed because it is too large Load Diff

1277
po/mn.po

File diff suppressed because it is too large Load Diff

1265
po/ms.po

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More